forbiddencurse 1.0.0__tar.gz

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,51 @@
1
+ Metadata-Version: 2.4
2
+ Name: forbiddencurse
3
+ Version: 1.0.0
4
+ Summary: Modificated curse
5
+ Author-email: Muhammed Zeynalli <bildiris15@gmail.com>
6
+ License-Expression: MIT
7
+ Requires-Python: >=3.9
8
+ Description-Content-Type: text/markdown
9
+ Requires-Dist: forbiddenfruit
10
+
11
+ ### About the module
12
+ Hello!
13
+ You probably know about `forbiddenfruit` module. `curse` in this module can create your own attributes **only for certain types**. `forbiddenfruit` does not have an official command for all types. But not in this module!
14
+ This module is a tiny module. Because its only function is to make a attributes not only for certain types, make a **to all types**! Code:
15
+ ```Python
16
+ from forbiddencurse import Curse
17
+ def add(a, b):
18
+ return a+b
19
+ class A: # Not important for Curse working, this's only demonstration
20
+ def __add__(self, b):
21
+ return "Added!"
22
+ Curse(add)
23
+ print((5).add(6)) # 11
24
+ print("Hello".add(" World!")) # "Hello World!"
25
+ print(A().add(5)) # Added!
26
+ ```
27
+ This applies to almost all types!
28
+ ### Default values
29
+ - `types`: If you're don't want all types, only some types like a normal Curse, you can change this to important types. Default is `None`:
30
+ ```Python
31
+ Curse(add, types=[str, int])
32
+ ```
33
+ - `name`: If you want to curse function with another name, you can change this parameter. Default is `None`:
34
+ ```Python
35
+ Curse(add, name="other_add")
36
+ ```
37
+ This's created an attribute "other_add", no add. On this argument, add is only rule, not name.
38
+ - `Property` - default `False`. If this's `True`, this make a property function
39
+ ### Other interesting functions and variables
40
+ This module has other interesting things.
41
+ - `Reverse` - like `forbiddenfruit` `reverse` and `Curse` in this module
42
+ - `allTypes` and `allClasses` - after the curse the function(without `types` parameter!), this variables will have all types(in `allTypes`) and all classes(in `allClasses`) in list! If you don't want to curse function and get this, write this code:
43
+ ```Python
44
+ from forbiddencurse import Curse, Reverse, allTypes
45
+ def _(self):
46
+ return None
47
+ Curse(_)
48
+ Reverse(_)
49
+ print(allTypes) # print an array with all Python types!
50
+ ```
51
+ This rule working and to `allClasses`😉
@@ -0,0 +1,41 @@
1
+ ### About the module
2
+ Hello!
3
+ You probably know about `forbiddenfruit` module. `curse` in this module can create your own attributes **only for certain types**. `forbiddenfruit` does not have an official command for all types. But not in this module!
4
+ This module is a tiny module. Because its only function is to make a attributes not only for certain types, make a **to all types**! Code:
5
+ ```Python
6
+ from forbiddencurse import Curse
7
+ def add(a, b):
8
+ return a+b
9
+ class A: # Not important for Curse working, this's only demonstration
10
+ def __add__(self, b):
11
+ return "Added!"
12
+ Curse(add)
13
+ print((5).add(6)) # 11
14
+ print("Hello".add(" World!")) # "Hello World!"
15
+ print(A().add(5)) # Added!
16
+ ```
17
+ This applies to almost all types!
18
+ ### Default values
19
+ - `types`: If you're don't want all types, only some types like a normal Curse, you can change this to important types. Default is `None`:
20
+ ```Python
21
+ Curse(add, types=[str, int])
22
+ ```
23
+ - `name`: If you want to curse function with another name, you can change this parameter. Default is `None`:
24
+ ```Python
25
+ Curse(add, name="other_add")
26
+ ```
27
+ This's created an attribute "other_add", no add. On this argument, add is only rule, not name.
28
+ - `Property` - default `False`. If this's `True`, this make a property function
29
+ ### Other interesting functions and variables
30
+ This module has other interesting things.
31
+ - `Reverse` - like `forbiddenfruit` `reverse` and `Curse` in this module
32
+ - `allTypes` and `allClasses` - after the curse the function(without `types` parameter!), this variables will have all types(in `allTypes`) and all classes(in `allClasses`) in list! If you don't want to curse function and get this, write this code:
33
+ ```Python
34
+ from forbiddencurse import Curse, Reverse, allTypes
35
+ def _(self):
36
+ return None
37
+ Curse(_)
38
+ Reverse(_)
39
+ print(allTypes) # print an array with all Python types!
40
+ ```
41
+ This rule working and to `allClasses`😉
@@ -0,0 +1 @@
1
+ from .forbiddencurse import *
@@ -0,0 +1,66 @@
1
+ from gc import get_objects
2
+ from forbiddenfruit import curse, reverse
3
+ import builtins
4
+ allTypes=[]
5
+ allClasses=[]
6
+ def Curse(f, types=None, name=None, Property=False):
7
+ global allTypes, allClasses
8
+ if types is None and not allTypes:
9
+ stackClass=list(globals().values())
10
+ seen=set()
11
+ for i in get_objects():
12
+ if isinstance(i, type):
13
+ allTypes.append(i)
14
+ for i in dir(builtins):
15
+ obj=getattr(builtins, i)
16
+ if isinstance(obj, type):
17
+ allTypes.append(obj)
18
+ while stackClass:
19
+ i=stackClass.pop()
20
+ if id(i) in seen:
21
+ continue
22
+ seen.add(id(i))
23
+ if isinstance(i, type):
24
+ allClasses.append(i)
25
+ try:
26
+ stackClass.extend(vars(i).values())
27
+ except Exception:
28
+ pass
29
+ for i in allTypes+allClasses if types is None else types:
30
+ try:
31
+ curse(i, f.__name__ if name is None else name, f if not Property else property(f))
32
+ except Exception:
33
+ pass
34
+ def Reverse(f, types=None, name=None):
35
+ global allTypes, allClasses
36
+ if types is None and not allTypes:
37
+ stackClass=list(globals().values())
38
+ seen=set()
39
+ for i in get_objects():
40
+ if isinstance(i, type):
41
+ allTypes.append(i)
42
+ for i in dir(builtins):
43
+ obj=getattr(builtins, i)
44
+ if isinstance(obj, type):
45
+ allTypes.append(obj)
46
+ while stackClass:
47
+ i=stackClass.pop()
48
+ if id(i) in seen:
49
+ continue
50
+ seen.add(id(i))
51
+ if isinstance(i, type):
52
+ allClasses.append(i)
53
+ try:
54
+ stackClass.extend(vars(i).values())
55
+ except Exception:
56
+ pass
57
+ for i in allTypes+allClasses if types is None else types:
58
+ try:
59
+ reverse(i, f.__name__ if name is None else name)
60
+ except Exception:
61
+ pass
62
+ def _(self):
63
+ return None
64
+ Curse(_)
65
+ Reverse(_)
66
+ print(allTypes)
@@ -0,0 +1,51 @@
1
+ Metadata-Version: 2.4
2
+ Name: forbiddencurse
3
+ Version: 1.0.0
4
+ Summary: Modificated curse
5
+ Author-email: Muhammed Zeynalli <bildiris15@gmail.com>
6
+ License-Expression: MIT
7
+ Requires-Python: >=3.9
8
+ Description-Content-Type: text/markdown
9
+ Requires-Dist: forbiddenfruit
10
+
11
+ ### About the module
12
+ Hello!
13
+ You probably know about `forbiddenfruit` module. `curse` in this module can create your own attributes **only for certain types**. `forbiddenfruit` does not have an official command for all types. But not in this module!
14
+ This module is a tiny module. Because its only function is to make a attributes not only for certain types, make a **to all types**! Code:
15
+ ```Python
16
+ from forbiddencurse import Curse
17
+ def add(a, b):
18
+ return a+b
19
+ class A: # Not important for Curse working, this's only demonstration
20
+ def __add__(self, b):
21
+ return "Added!"
22
+ Curse(add)
23
+ print((5).add(6)) # 11
24
+ print("Hello".add(" World!")) # "Hello World!"
25
+ print(A().add(5)) # Added!
26
+ ```
27
+ This applies to almost all types!
28
+ ### Default values
29
+ - `types`: If you're don't want all types, only some types like a normal Curse, you can change this to important types. Default is `None`:
30
+ ```Python
31
+ Curse(add, types=[str, int])
32
+ ```
33
+ - `name`: If you want to curse function with another name, you can change this parameter. Default is `None`:
34
+ ```Python
35
+ Curse(add, name="other_add")
36
+ ```
37
+ This's created an attribute "other_add", no add. On this argument, add is only rule, not name.
38
+ - `Property` - default `False`. If this's `True`, this make a property function
39
+ ### Other interesting functions and variables
40
+ This module has other interesting things.
41
+ - `Reverse` - like `forbiddenfruit` `reverse` and `Curse` in this module
42
+ - `allTypes` and `allClasses` - after the curse the function(without `types` parameter!), this variables will have all types(in `allTypes`) and all classes(in `allClasses`) in list! If you don't want to curse function and get this, write this code:
43
+ ```Python
44
+ from forbiddencurse import Curse, Reverse, allTypes
45
+ def _(self):
46
+ return None
47
+ Curse(_)
48
+ Reverse(_)
49
+ print(allTypes) # print an array with all Python types!
50
+ ```
51
+ This rule working and to `allClasses`😉
@@ -0,0 +1,9 @@
1
+ README.md
2
+ pyproject.toml
3
+ forbiddencurse/__init__.py
4
+ forbiddencurse/forbiddencurse.py
5
+ forbiddencurse.egg-info/PKG-INFO
6
+ forbiddencurse.egg-info/SOURCES.txt
7
+ forbiddencurse.egg-info/dependency_links.txt
8
+ forbiddencurse.egg-info/requires.txt
9
+ forbiddencurse.egg-info/top_level.txt
@@ -0,0 +1 @@
1
+ forbiddenfruit
@@ -0,0 +1 @@
1
+ forbiddencurse
@@ -0,0 +1,12 @@
1
+ [project]
2
+ name="forbiddencurse"
3
+ version="1.0.0"
4
+ description="Modificated curse"
5
+ requires-python=">=3.9"
6
+ dependencies=["forbiddenfruit"]
7
+ readme="README.md"
8
+ license="MIT"
9
+ authors=[{name="Muhammed Zeynalli", email="bildiris15@gmail.com"}]
10
+ [build-system]
11
+ requires=["setuptools"]
12
+ build-backend="setuptools.build_meta"
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+