Загрузить файлы в «/»
This commit is contained in:
parent
c2895dfba8
commit
6b457ae132
2 changed files with 36 additions and 6 deletions
16
shell.nix
16
shell.nix
|
|
@ -2,13 +2,17 @@
|
|||
|
||||
pkgs.mkShell {
|
||||
packages = [
|
||||
(pkgs.python3.withPackages (pythonPackages: [
|
||||
pythonPackages.simpy
|
||||
pythonPackages.prompt-toolkit
|
||||
# Python + third-party deps
|
||||
(pkgs.python313.withPackages (ps: [
|
||||
ps.simpy
|
||||
ps.prompt-toolkit
|
||||
]))
|
||||
|
||||
pkgs.basedpyright
|
||||
pkgs.codex-acp
|
||||
pkgs.clang
|
||||
# Frontend toolchain
|
||||
pkgs.nodejs_22
|
||||
];
|
||||
|
||||
shellHook = ''
|
||||
echo "simpy-terns: python $(python --version 2>&1 | cut -d' ' -f2), node $(node --version)"
|
||||
'';
|
||||
}
|
||||
|
|
|
|||
26
tern.py
Normal file
26
tern.py
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
from enum import Enum
|
||||
from typing import override
|
||||
|
||||
|
||||
class Tern(Enum):
|
||||
N = -1
|
||||
U = 0
|
||||
Y = 1
|
||||
|
||||
@override
|
||||
def __str__(self):
|
||||
if self.value == -1:
|
||||
return "0"
|
||||
if self.value == 1:
|
||||
return "1"
|
||||
return "N"
|
||||
|
||||
@classmethod
|
||||
def from_string(cls, s: str) -> "Tern":
|
||||
if s == "N":
|
||||
return Tern.U
|
||||
if s == "0":
|
||||
return Tern.N
|
||||
if s == "1":
|
||||
return Tern.Y
|
||||
return cls[s]
|
||||
Loading…
Reference in a new issue