code-smaller 0.1.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.
@@ -0,0 +1,34 @@
1
+ Metadata-Version: 2.4
2
+ Name: code-smaller
3
+ Version: 0.1.0
4
+ Summary: Code-smaller python abstractions
5
+ Author-email: Ari Fishman <arifishman39@gmail.com>
6
+ License-Expression: Apache-2.0
7
+ Project-URL: Homepage, https://github.com/codesmaller/code-smaller
8
+ Project-URL: Repository, https://github.com/codesmaller/code-smaller
9
+ Requires-Python: >=3.11
10
+ Description-Content-Type: text/markdown
11
+ License-File: LICENSE
12
+ Dynamic: license-file
13
+
14
+ # code-smaller
15
+
16
+ Simple, intuitive abstractions for common Python tasks.
17
+
18
+ ## Status
19
+
20
+ 🚧 **Early Development** – APIs changing constantly. Pin the version you are using!
21
+
22
+ ## Contributing
23
+
24
+ Feedback and abstraction requests are welcome! Open an issue to suggest new ideas or improvements.
25
+
26
+ ## License
27
+
28
+ [Apache 2.0](LICENSE)
29
+
30
+ ## Installation
31
+
32
+ ```bash
33
+ pip install code-smaller
34
+ ```
@@ -0,0 +1,9 @@
1
+ code_smaller-0.1.0.dist-info/licenses/LICENSE,sha256=sDcNbwpkS5sM6O0Y_lvTilLF0pO0bATQz5GTOvyex8c,774
2
+ smaller/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
3
+ smaller/default.py,sha256=Oxru7W_7prBa23s9Ow0TeE7-CrZIERIFlISgsoQAvho,224
4
+ smaller/sentinel.py,sha256=P7M-kf8aC1ZMoqa6C41WEkMvSvXPyoDDcjke5z3tx3k,624
5
+ smaller/unset.py,sha256=F7SUOGnN8PaV77feIqbzp_toYkN_JuMXcJJs_h-vI6g,260
6
+ code_smaller-0.1.0.dist-info/METADATA,sha256=ZbamVZd1c0iL9hSqaOMVo2o-ZUKja0wNlskkcZhGKGo,838
7
+ code_smaller-0.1.0.dist-info/WHEEL,sha256=aeYiig01lYGDzBgS8HxWXOg3uV61G9ijOsup-k9o1sk,91
8
+ code_smaller-0.1.0.dist-info/top_level.txt,sha256=aVySEblKTzpEX93T6tYAjpfjrG18zc6QXHgIVjKD0lk,8
9
+ code_smaller-0.1.0.dist-info/RECORD,,
@@ -0,0 +1,5 @@
1
+ Wheel-Version: 1.0
2
+ Generator: setuptools (82.0.1)
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
5
+
@@ -0,0 +1,19 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ Copyright [2025] Ari Fishman
8
+
9
+ Licensed under the Apache License, Version 2.0 (the "License");
10
+ you may not use this file except in compliance with the License.
11
+ You may obtain a copy of the License at
12
+
13
+ http://www.apache.org/licenses/LICENSE-2.0
14
+
15
+ Unless required by applicable law or agreed to in writing, software
16
+ distributed under the License is distributed on an "AS IS" BASIS,
17
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18
+ See the License for the specific language governing permissions and
19
+ limitations under the License.
@@ -0,0 +1 @@
1
+ smaller
smaller/__init__.py ADDED
File without changes
smaller/default.py ADDED
@@ -0,0 +1,12 @@
1
+ from .sentinel import Sentinel
2
+
3
+
4
+ """
5
+ Sentinel placeholder for default values.
6
+
7
+ Usage:
8
+ def func(param=DEFAULT):
9
+ if param is DEFAULT:
10
+ ...
11
+ """
12
+ DEFAULT = Sentinel(name="DEFAULT", truthy=True)
smaller/sentinel.py ADDED
@@ -0,0 +1,27 @@
1
+
2
+ from dataclasses import dataclass
3
+
4
+
5
+ @dataclass(frozen=True, slots=True)
6
+ class Sentinel:
7
+ """
8
+ Custom truthy or falsy "sentinel" object for representing special states or values.
9
+
10
+ Usage:
11
+ DEFAULT = Sentinel(name="DEFAULT", truthy=True)
12
+
13
+ if value is DEFAULT:
14
+ ...
15
+ """
16
+
17
+ # object representation string for logs and debugging
18
+ name: str
19
+
20
+ # whether the sentinel should evaluate to True or False in if statements
21
+ truthy: bool
22
+
23
+ def __bool__(self) -> bool:
24
+ return self.truthy
25
+
26
+ def __repr__(self) -> str:
27
+ return f"{self.name}"
smaller/unset.py ADDED
@@ -0,0 +1,12 @@
1
+ from .sentinel import Sentinel
2
+
3
+
4
+ """
5
+ Sentinel for identifying omitted parameter vs parameter explicitly set to None etc.
6
+
7
+ Usage:
8
+ def func(param=UNSET):
9
+ if param is UNSET:
10
+ ...
11
+ """
12
+ UNSET = Sentinel(name="UNSET", truthy=False)