Skip to content

Commit 1d849e0

Browse files
committed
wip
1 parent 7421638 commit 1d849e0

File tree

504 files changed

+1741
-11114
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

504 files changed

+1741
-11114
lines changed

.gitignore

+5-1
Original file line numberDiff line numberDiff line change
@@ -1 +1,5 @@
1-
*.pyc
1+
.venv/
2+
.vscode/*
3+
!.vscode/launch.json
4+
5+
__pycache__

.pylintrc

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
[MASTER]
2+
disable=
3+
C0114,
4+
C0115,
5+
C0116,

.python-version

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
3.12.1

.vscode/launch.json

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{
2+
// Utilisez IntelliSense pour en savoir plus sur les attributs possibles.
3+
// Pointez pour afficher la description des attributs existants.
4+
// Pour plus d'informations, visitez : https://go.microsoft.com/fwlink/?linkid=830387
5+
"version": "0.2.0",
6+
"configurations": [
7+
{
8+
"name": "Python : fichier actif",
9+
"type": "python",
10+
"request": "launch",
11+
"program": "${file}",
12+
"console": "integratedTerminal",
13+
"justMyCode": true
14+
}
15+
]
16+
}

.vscode/settings.json

-3
This file was deleted.

Pipfile

-16
This file was deleted.

Pipfile.lock

-347
This file was deleted.

poetry.lock

+221
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
File renamed without changes.

pyoro/banks/__init__.py

Whitespace-only changes.

pyoro/banks/bank.py

+40
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
import typing
2+
3+
from pyoro.exceptions.already_initialized import AlreadyInitializedException
4+
5+
T = typing.TypeVar("T")
6+
7+
8+
class Bank(typing.Generic[T]):
9+
_instance = None
10+
11+
@classmethod
12+
def build(cls):
13+
if cls._instance is None:
14+
cls._instance = cls()
15+
cls._instance.load()
16+
return cls._instance
17+
18+
@classmethod
19+
def get_instance(cls):
20+
if cls._instance is None:
21+
cls._instance = cls()
22+
return cls._instance
23+
24+
def __init__(self):
25+
if self._instance is not None:
26+
raise AlreadyInitializedException(
27+
f"Bank '{self.__class__.__name__}' already initialized"
28+
)
29+
self.data: dict[str, T] = {}
30+
31+
def load(self):
32+
pass
33+
34+
def get(self, key: str) -> T:
35+
if key not in self.data:
36+
raise KeyError(f"Key '{key}' not found in bank '{self.__class__.__name__}'")
37+
return self.data[key]
38+
39+
def __getitem__(self, key: str):
40+
return self.get(key)

0 commit comments

Comments
 (0)