librecoding 0.1.0__py3-none-any.whl → 0.2.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
librecoding/__init__.py CHANGED
@@ -1,3 +1,31 @@
1
+ """librecoding — модуль, который можно вызвать как функцию."""
2
+
3
+ import sys
4
+ from types import ModuleType
5
+
1
6
  from .core import greet
2
- __all__ = ["greet"]
3
- __version__ = "0.1.0"
7
+
8
+ __version__ = "0.2.0"
9
+
10
+ BANNER = "Привет, мир! (из librecoding)"
11
+
12
+
13
+ def hello() -> str:
14
+ """Явный способ попросить приветствие."""
15
+ print(BANNER)
16
+ return BANNER
17
+
18
+
19
+ class _LibreCodingModule(ModuleType):
20
+ """Модуль, который ведёт себя как функция: librecoding()."""
21
+
22
+ def __call__(self, obj=None, *args, **kwargs):
23
+ print(BANNER)
24
+ if callable(obj) and not args and not kwargs:
25
+ return obj
26
+ return BANNER
27
+
28
+
29
+ sys.modules[__name__].__class__ = _LibreCodingModule
30
+
31
+ __all__ = ["greet", "hello", "BANNER"]
librecoding/core.py CHANGED
@@ -1,2 +1,5 @@
1
- def greet(name: str) -> str:
2
- return f"Привет, {name}!"
1
+ def greet(name: str = "мир") -> str:
2
+ """Печатает и возвращает приветствие."""
3
+ msg = f"Привет, {name}!"
4
+ print(msg)
5
+ return msg
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: librecoding
3
- Version: 0.1.0
3
+ Version: 0.2.0
4
4
  Summary: Free and open-source coding library
5
5
  Author: ar
6
6
  License-Expression: MIT
@@ -0,0 +1,5 @@
1
+ librecoding/__init__.py,sha256=KuD4mR8Q-qzh6uK_LFPCDVvkx-PRQf88haQ1sc6T2IE,782
2
+ librecoding/core.py,sha256=UO5R_K8a-XwaJAhwl3cybnCSbk2tkpcnqrT0d-PIdTA,180
3
+ librecoding-0.2.0.dist-info/METADATA,sha256=BtlepHX34KPTTrNIU5tOCAFFd8LhyJzLFbFGfipPjX8,331
4
+ librecoding-0.2.0.dist-info/WHEEL,sha256=W3fkpkm7-wf9vBI5Z-7s0eWkeM-spu78I8Neb98DeEg,87
5
+ librecoding-0.2.0.dist-info/RECORD,,
@@ -1,5 +0,0 @@
1
- librecoding/__init__.py,sha256=m-J5HlIfhfcGoua01s61Zuz2ExXTE5ybxx2Eve2O6ek,66
2
- librecoding/core.py,sha256=WRxU_QgqpRakXck1GUQZP8wqBGDaW5psac23c3YvAm4,65
3
- librecoding-0.1.0.dist-info/METADATA,sha256=DNprzmBs3wYz83vU7-OWfXN6e7hT8pxK8mL6nTXyr2I,331
4
- librecoding-0.1.0.dist-info/WHEEL,sha256=W3fkpkm7-wf9vBI5Z-7s0eWkeM-spu78I8Neb98DeEg,87
5
- librecoding-0.1.0.dist-info/RECORD,,