oldenglish 0.1.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,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 IliyA
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,97 @@
1
+ Metadata-Version: 2.4
2
+ Name: oldenglish
3
+ Version: 0.1.0
4
+ Summary: Rename print/input/help/count/find/replace/if/else/def to custom spellings
5
+ Author-email: IliyA <Mersulant@protonmail.com>
6
+ License: MIT License
7
+
8
+ Copyright (c) 2026 IliyA
9
+
10
+ Permission is hereby granted, free of charge, to any person obtaining a copy
11
+ of this software and associated documentation files (the "Software"), to deal
12
+ in the Software without restriction, including without limitation the rights
13
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
14
+ copies of the Software, and to permit persons to whom the Software is
15
+ furnished to do so, subject to the following conditions:
16
+
17
+ The above copyright notice and this permission notice shall be included in all
18
+ copies or substantial portions of the Software.
19
+
20
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
21
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
23
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
24
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
25
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
26
+ SOFTWARE.
27
+
28
+ Classifier: Programming Language :: Python :: 3
29
+ Classifier: License :: OSI Approved :: MIT License
30
+ Classifier: Operating System :: OS Independent
31
+ Requires-Python: >=3.8
32
+ Description-Content-Type: text/markdown
33
+ License-File: LICENSE
34
+ Dynamic: license-file
35
+
36
+ # oldenglish
37
+
38
+ Changes python default names to old ones.
39
+
40
+ | Original | Custom | Type |
41
+ |--------------|-------------|--------------------|
42
+ | `print` | `publish` | function |
43
+ | `input` | `hark` | function |
44
+ | `help` | `aid` | function |
45
+ | `.count()` | `reckon()` | function |
46
+ | `.find()` | `seek()` | function |
47
+ | `.replace()` | `exchge()` | function |
48
+ | `if` | `an it be` | keyword (via hook) |
49
+ | `else` | `otherwise` | keyword (via hook) |
50
+ | `def` | `decree` | keyword (via hook) |
51
+
52
+ ## Function renames
53
+
54
+ These just work, no setup needed:
55
+
56
+ ```python
57
+ from oldenglish import publish, hark, aid, reckon, seek, exchge
58
+
59
+ publish("hello")
60
+ name = hark("what's your name? ")
61
+ aid(str)
62
+ reckon("abcabc", "a") # like "abcabc".count("a")
63
+ seek("abcabc", "b") # like "abcabc".find("b")
64
+ exchge("hi", "hi", "bye") # like "hi".replace("hi", "bye")
65
+ ```
66
+
67
+ ## Keyword renames
68
+
69
+ `if`/`else`/`def` are actual reserved words, so you can't just alias
70
+ them. Instead, write your code in a file ending in `.oe.py` and this
71
+ package will rewrite it into real Python before it's compiled:
72
+
73
+ ```python
74
+ # main.oe.py
75
+ from oldenglish import publish
76
+
77
+ decree greet(name):
78
+ an it be name == "world":
79
+ publish("hello world")
80
+ otherwise:
81
+ publish("hello " + name)
82
+
83
+ greet("world")
84
+ ```
85
+
86
+ Then from a normal `.py` file:
87
+
88
+ ```python
89
+ import oldenglish
90
+ oldenglish.enable_keywords()
91
+
92
+ import main # loads main.oe.py
93
+ ```
94
+
95
+ ## License
96
+
97
+ MIT, see LICENSE.
@@ -0,0 +1,62 @@
1
+ # oldenglish
2
+
3
+ Changes python default names to old ones.
4
+
5
+ | Original | Custom | Type |
6
+ |--------------|-------------|--------------------|
7
+ | `print` | `publish` | function |
8
+ | `input` | `hark` | function |
9
+ | `help` | `aid` | function |
10
+ | `.count()` | `reckon()` | function |
11
+ | `.find()` | `seek()` | function |
12
+ | `.replace()` | `exchge()` | function |
13
+ | `if` | `an it be` | keyword (via hook) |
14
+ | `else` | `otherwise` | keyword (via hook) |
15
+ | `def` | `decree` | keyword (via hook) |
16
+
17
+ ## Function renames
18
+
19
+ These just work, no setup needed:
20
+
21
+ ```python
22
+ from oldenglish import publish, hark, aid, reckon, seek, exchge
23
+
24
+ publish("hello")
25
+ name = hark("what's your name? ")
26
+ aid(str)
27
+ reckon("abcabc", "a") # like "abcabc".count("a")
28
+ seek("abcabc", "b") # like "abcabc".find("b")
29
+ exchge("hi", "hi", "bye") # like "hi".replace("hi", "bye")
30
+ ```
31
+
32
+ ## Keyword renames
33
+
34
+ `if`/`else`/`def` are actual reserved words, so you can't just alias
35
+ them. Instead, write your code in a file ending in `.oe.py` and this
36
+ package will rewrite it into real Python before it's compiled:
37
+
38
+ ```python
39
+ # main.oe.py
40
+ from oldenglish import publish
41
+
42
+ decree greet(name):
43
+ an it be name == "world":
44
+ publish("hello world")
45
+ otherwise:
46
+ publish("hello " + name)
47
+
48
+ greet("world")
49
+ ```
50
+
51
+ Then from a normal `.py` file:
52
+
53
+ ```python
54
+ import oldenglish
55
+ oldenglish.enable_keywords()
56
+
57
+ import main # loads main.oe.py
58
+ ```
59
+
60
+ ## License
61
+
62
+ MIT, see LICENSE.
@@ -0,0 +1,23 @@
1
+ """
2
+ oldenglish - swap out print/input/help/count/find/replace and if/else/def
3
+ for old-timey spellings, because why not.
4
+
5
+ print/input/help are just names bound to functions, so those are easy,
6
+ just aliases. if/else/def are actual keywords though, and Python won't
7
+ let you rename those at runtime - so for those we cheat with an import
8
+ hook that rewrites the source text before it gets compiled. See loader.py
9
+ if you're curious how that works.
10
+
11
+ Usage:
12
+ import oldenglish
13
+ oldenglish.enable_keywords()
14
+ import main # loads main.oe.py
15
+ """
16
+
17
+ from .funcs import publish, aid, hark, reckon, seek, exchge
18
+ from .loader import enable_keywords, disable_keywords
19
+
20
+ __all__ = [
21
+ "publish", "aid", "hark", "reckon", "seek", "exchge",
22
+ "enable_keywords", "disable_keywords",
23
+ ]
@@ -0,0 +1,28 @@
1
+ # plain aliases for print/input/help - these just point at the same
2
+ # functions, no wrapping needed
3
+ #
4
+ # count/find/replace aren't standalone functions in Python (they're
5
+ # methods on str/list etc), so reckon/seek/exchge take the object as
6
+ # the first arg instead, e.g. reckon("abcabc", "a") instead of
7
+ # "abcabc".count("a")
8
+
9
+ import builtins
10
+
11
+ publish = builtins.print
12
+ hark = builtins.input
13
+ aid = builtins.help
14
+
15
+
16
+ def reckon(obj, *args, **kwargs):
17
+ # same as obj.count(...)
18
+ return obj.count(*args, **kwargs)
19
+
20
+
21
+ def seek(obj, *args, **kwargs):
22
+ # same as obj.find(...)
23
+ return obj.find(*args, **kwargs)
24
+
25
+
26
+ def exchge(obj, *args, **kwargs):
27
+ # same as obj.replace(...)
28
+ return obj.replace(*args, **kwargs)
@@ -0,0 +1,91 @@
1
+ # Import hook that rewrites source text so our fake "keywords" become
2
+ # real Python keywords before the interpreter ever sees them.
3
+ #
4
+ # an it be -> if
5
+ # otherwise -> else
6
+ # decree -> def
7
+ #
8
+ # Only touches files ending in .oe.py, everything else is left alone.
9
+ #
10
+ # Usage:
11
+ # # main.oe.py
12
+ # decree greet(name):
13
+ # an it be name == "world":
14
+ # publish("hello world")
15
+ # otherwise:
16
+ # publish("hello " + name)
17
+ #
18
+ # # some_entrypoint.py
19
+ # import oldenglish
20
+ # oldenglish.enable_keywords()
21
+ # import main # actually loads main.oe.py
22
+
23
+ import re
24
+ import sys
25
+ import importlib.abc
26
+ import importlib.machinery
27
+ import importlib.util
28
+
29
+ _SUFFIX = ".oe.py"
30
+
31
+ # longer/more specific phrases go first, otherwise "an it be" could get
32
+ # chewed up by a shorter pattern matching part of it
33
+ _REPLACEMENTS = [
34
+ (re.compile(r"\ban it be\b"), "if"),
35
+ (re.compile(r"\botherwise\b"), "else"),
36
+ (re.compile(r"\bdecree\b"), "def"),
37
+ ]
38
+
39
+
40
+ def _transpile(source):
41
+ for pattern, replacement in _REPLACEMENTS:
42
+ source = pattern.sub(replacement, source)
43
+ return source
44
+
45
+
46
+ class _OldEnglishLoader(importlib.machinery.SourceFileLoader):
47
+ def get_data(self, path):
48
+ data = super().get_data(path)
49
+ if path.endswith(_SUFFIX):
50
+ data = _transpile(data.decode("utf-8")).encode("utf-8")
51
+ return data
52
+
53
+
54
+ class _OldEnglishFinder(importlib.abc.MetaPathFinder):
55
+ """Looks for a <modname>.oe.py file on sys.path."""
56
+
57
+ def find_spec(self, fullname, path, target=None):
58
+ search_paths = path if path is not None else sys.path
59
+ modname = fullname.rsplit(".", 1)[-1]
60
+
61
+ for entry in search_paths:
62
+ candidate = f"{entry}/{modname}{_SUFFIX}"
63
+ try:
64
+ with open(candidate, "rb"):
65
+ pass
66
+ except OSError:
67
+ continue
68
+
69
+ loader = _OldEnglishLoader(fullname, candidate)
70
+ return importlib.util.spec_from_file_location(
71
+ fullname, candidate, loader=loader
72
+ )
73
+ return None
74
+
75
+
76
+ _finder = _OldEnglishFinder()
77
+ _installed = False
78
+
79
+
80
+ def enable_keywords():
81
+ global _installed
82
+ if not _installed:
83
+ sys.meta_path.insert(0, _finder)
84
+ _installed = True
85
+
86
+
87
+ def disable_keywords():
88
+ global _installed
89
+ if _installed:
90
+ sys.meta_path.remove(_finder)
91
+ _installed = False
@@ -0,0 +1,97 @@
1
+ Metadata-Version: 2.4
2
+ Name: oldenglish
3
+ Version: 0.1.0
4
+ Summary: Rename print/input/help/count/find/replace/if/else/def to custom spellings
5
+ Author-email: IliyA <Mersulant@protonmail.com>
6
+ License: MIT License
7
+
8
+ Copyright (c) 2026 IliyA
9
+
10
+ Permission is hereby granted, free of charge, to any person obtaining a copy
11
+ of this software and associated documentation files (the "Software"), to deal
12
+ in the Software without restriction, including without limitation the rights
13
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
14
+ copies of the Software, and to permit persons to whom the Software is
15
+ furnished to do so, subject to the following conditions:
16
+
17
+ The above copyright notice and this permission notice shall be included in all
18
+ copies or substantial portions of the Software.
19
+
20
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
21
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
23
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
24
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
25
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
26
+ SOFTWARE.
27
+
28
+ Classifier: Programming Language :: Python :: 3
29
+ Classifier: License :: OSI Approved :: MIT License
30
+ Classifier: Operating System :: OS Independent
31
+ Requires-Python: >=3.8
32
+ Description-Content-Type: text/markdown
33
+ License-File: LICENSE
34
+ Dynamic: license-file
35
+
36
+ # oldenglish
37
+
38
+ Changes python default names to old ones.
39
+
40
+ | Original | Custom | Type |
41
+ |--------------|-------------|--------------------|
42
+ | `print` | `publish` | function |
43
+ | `input` | `hark` | function |
44
+ | `help` | `aid` | function |
45
+ | `.count()` | `reckon()` | function |
46
+ | `.find()` | `seek()` | function |
47
+ | `.replace()` | `exchge()` | function |
48
+ | `if` | `an it be` | keyword (via hook) |
49
+ | `else` | `otherwise` | keyword (via hook) |
50
+ | `def` | `decree` | keyword (via hook) |
51
+
52
+ ## Function renames
53
+
54
+ These just work, no setup needed:
55
+
56
+ ```python
57
+ from oldenglish import publish, hark, aid, reckon, seek, exchge
58
+
59
+ publish("hello")
60
+ name = hark("what's your name? ")
61
+ aid(str)
62
+ reckon("abcabc", "a") # like "abcabc".count("a")
63
+ seek("abcabc", "b") # like "abcabc".find("b")
64
+ exchge("hi", "hi", "bye") # like "hi".replace("hi", "bye")
65
+ ```
66
+
67
+ ## Keyword renames
68
+
69
+ `if`/`else`/`def` are actual reserved words, so you can't just alias
70
+ them. Instead, write your code in a file ending in `.oe.py` and this
71
+ package will rewrite it into real Python before it's compiled:
72
+
73
+ ```python
74
+ # main.oe.py
75
+ from oldenglish import publish
76
+
77
+ decree greet(name):
78
+ an it be name == "world":
79
+ publish("hello world")
80
+ otherwise:
81
+ publish("hello " + name)
82
+
83
+ greet("world")
84
+ ```
85
+
86
+ Then from a normal `.py` file:
87
+
88
+ ```python
89
+ import oldenglish
90
+ oldenglish.enable_keywords()
91
+
92
+ import main # loads main.oe.py
93
+ ```
94
+
95
+ ## License
96
+
97
+ MIT, see LICENSE.
@@ -0,0 +1,10 @@
1
+ LICENSE
2
+ README.md
3
+ pyproject.toml
4
+ oldenglish/__init__.py
5
+ oldenglish/funcs.py
6
+ oldenglish/loader.py
7
+ oldenglish.egg-info/PKG-INFO
8
+ oldenglish.egg-info/SOURCES.txt
9
+ oldenglish.egg-info/dependency_links.txt
10
+ oldenglish.egg-info/top_level.txt
@@ -0,0 +1 @@
1
+ oldenglish
@@ -0,0 +1,20 @@
1
+ [build-system]
2
+ requires = ["setuptools>=61.0"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "oldenglish"
7
+ version = "0.1.0"
8
+ description = "Rename print/input/help/count/find/replace/if/else/def to custom spellings"
9
+ readme = "README.md"
10
+ requires-python = ">=3.8"
11
+ authors = [{ name = "IliyA", email = "Mersulant@protonmail.com" }]
12
+ license = { file = "LICENSE" }
13
+ classifiers = [
14
+ "Programming Language :: Python :: 3",
15
+ "License :: OSI Approved :: MIT License",
16
+ "Operating System :: OS Independent",
17
+ ]
18
+
19
+ [tool.setuptools]
20
+ packages = ["oldenglish"]
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+