pymethodbook 0.1.0__tar.gz → 0.2.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.
- {pymethodbook-0.1.0 → pymethodbook-0.2.0}/PKG-INFO +7 -4
- {pymethodbook-0.1.0 → pymethodbook-0.2.0}/README.md +6 -3
- {pymethodbook-0.1.0 → pymethodbook-0.2.0}/ROADMAP.md +4 -2
- {pymethodbook-0.1.0 → pymethodbook-0.2.0}/pymethodbook/__init__.py +1 -1
- pymethodbook-0.2.0/pymethodbook/data/set.json +74 -0
- pymethodbook-0.2.0/pymethodbook/data/str.json +74 -0
- pymethodbook-0.2.0/pymethodbook/data/tuple.json +14 -0
- {pymethodbook-0.1.0 → pymethodbook-0.2.0}/pyproject.toml +1 -1
- {pymethodbook-0.1.0 → pymethodbook-0.2.0}/tests/test_core.py +3 -3
- {pymethodbook-0.1.0 → pymethodbook-0.2.0}/.github/workflows/ci.yml +0 -0
- {pymethodbook-0.1.0 → pymethodbook-0.2.0}/.gitignore +0 -0
- {pymethodbook-0.1.0 → pymethodbook-0.2.0}/CONTRIBUTING.md +0 -0
- {pymethodbook-0.1.0 → pymethodbook-0.2.0}/LICENSE +0 -0
- {pymethodbook-0.1.0 → pymethodbook-0.2.0}/pymethodbook/cli.py +0 -0
- {pymethodbook-0.1.0 → pymethodbook-0.2.0}/pymethodbook/core.py +0 -0
- {pymethodbook-0.1.0 → pymethodbook-0.2.0}/pymethodbook/data/dict.json +0 -0
- {pymethodbook-0.1.0 → pymethodbook-0.2.0}/pymethodbook/data/list.json +0 -0
- {pymethodbook-0.1.0 → pymethodbook-0.2.0}/pymethodbook/render.py +0 -0
- {pymethodbook-0.1.0 → pymethodbook-0.2.0}/scripts/validate_data.py +0 -0
- {pymethodbook-0.1.0 → pymethodbook-0.2.0}/tests/test_cli.py +0 -0
- {pymethodbook-0.1.0 → pymethodbook-0.2.0}/tests/test_data_schema.py +0 -0
- {pymethodbook-0.1.0 → pymethodbook-0.2.0}/tests/test_render.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: pymethodbook
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.2.0
|
|
4
4
|
Summary: A terminal-first reference tool for Python's built-in methods — curated descriptions, runnable examples, and a searchable CLI.
|
|
5
5
|
Project-URL: Homepage, https://github.com/logeshchandrasekar/pymethodbook
|
|
6
6
|
Project-URL: Repository, https://github.com/logeshchandrasekar/pymethodbook
|
|
@@ -64,13 +64,16 @@ search("copy")
|
|
|
64
64
|
|
|
65
65
|
- `list` — 11 methods
|
|
66
66
|
- `dict` — 11 methods
|
|
67
|
+
- `str` — 12 methods
|
|
68
|
+
- `set` — 12 methods
|
|
69
|
+
- `tuple` — 2 methods (tuples are immutable — count and index are genuinely the only two)
|
|
67
70
|
|
|
68
|
-
More types (`str`, `set`, `tuple`) are on the roadmap — see [ROADMAP.md](ROADMAP.md)
|
|
71
|
+
More types (`str`, `set`, `tuple`) are on the roadmap — see [ROADMAP.md](https://github.com/logeshchandrasekar/pymethodbook/blob/main/ROADMAP.md)
|
|
69
72
|
|
|
70
73
|
## Contributing
|
|
71
74
|
|
|
72
|
-
Adding a method doesn't require touching any Python code — see [CONTRIBUTING.md](CONTRIBUTING.md)
|
|
75
|
+
Adding a method doesn't require touching any Python code — see [CONTRIBUTING.md](https://github.com/logeshchandrasekar/pymethodbook/blob/main/CONTRIBUTING.md)
|
|
73
76
|
|
|
74
77
|
## License
|
|
75
78
|
|
|
76
|
-
MIT — see [LICENSE](LICENSE)
|
|
79
|
+
MIT — see [LICENSE](https://github.com/logeshchandrasekar/pymethodbook/blob/main/LICENSE)
|
|
@@ -36,13 +36,16 @@ search("copy")
|
|
|
36
36
|
|
|
37
37
|
- `list` — 11 methods
|
|
38
38
|
- `dict` — 11 methods
|
|
39
|
+
- `str` — 12 methods
|
|
40
|
+
- `set` — 12 methods
|
|
41
|
+
- `tuple` — 2 methods (tuples are immutable — count and index are genuinely the only two)
|
|
39
42
|
|
|
40
|
-
More types (`str`, `set`, `tuple`) are on the roadmap — see [ROADMAP.md](ROADMAP.md)
|
|
43
|
+
More types (`str`, `set`, `tuple`) are on the roadmap — see [ROADMAP.md](https://github.com/logeshchandrasekar/pymethodbook/blob/main/ROADMAP.md)
|
|
41
44
|
|
|
42
45
|
## Contributing
|
|
43
46
|
|
|
44
|
-
Adding a method doesn't require touching any Python code — see [CONTRIBUTING.md](CONTRIBUTING.md)
|
|
47
|
+
Adding a method doesn't require touching any Python code — see [CONTRIBUTING.md](https://github.com/logeshchandrasekar/pymethodbook/blob/main/CONTRIBUTING.md)
|
|
45
48
|
|
|
46
49
|
## License
|
|
47
50
|
|
|
48
|
-
MIT — see [LICENSE](LICENSE)
|
|
51
|
+
MIT — see [LICENSE](https://github.com/logeshchandrasekar/pymethodbook/blob/main/LICENSE)
|
|
@@ -16,6 +16,8 @@ Currently supported types: `list`, `dict` (v1).
|
|
|
16
16
|
## v5
|
|
17
17
|
- Community-contributed "type packs" — a plugin format so others can add coverage (e.g. pandas) without touching core
|
|
18
18
|
|
|
19
|
+
## Shipped
|
|
20
|
+
- v0.2.0 — Full `str`, `set`, and `tuple` coverage
|
|
21
|
+
|
|
19
22
|
## Ongoing
|
|
20
|
-
-
|
|
21
|
-
- Improving example quality based on GitHub issues and requests.
|
|
23
|
+
- Improving example quality based on GitHub issues and requests
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
{
|
|
2
|
+
"add": {
|
|
3
|
+
"signature": "set.add(item)",
|
|
4
|
+
"description": "Adds a single item to the set, in place; has no effect if it's already present.",
|
|
5
|
+
"example": "s = {1, 2}\ns.add(3)\n# s -> {1, 2, 3}",
|
|
6
|
+
"category": "mutating"
|
|
7
|
+
},
|
|
8
|
+
"remove": {
|
|
9
|
+
"signature": "set.remove(item)",
|
|
10
|
+
"description": "Removes item from the set; raises KeyError if it isn't present.",
|
|
11
|
+
"example": "s = {1, 2, 3}\ns.remove(2)\n# s -> {1, 3}",
|
|
12
|
+
"category": "mutating"
|
|
13
|
+
},
|
|
14
|
+
"discard": {
|
|
15
|
+
"signature": "set.discard(item)",
|
|
16
|
+
"description": "Removes item from the set if present; does nothing (no error) if it isn't.",
|
|
17
|
+
"example": "s = {1, 2}\ns.discard(5)\n# s -> {1, 2}, no error even though 5 wasn't present",
|
|
18
|
+
"category": "mutating"
|
|
19
|
+
},
|
|
20
|
+
"pop": {
|
|
21
|
+
"signature": "set.pop()",
|
|
22
|
+
"description": "Removes and returns an arbitrary item from the set (sets are unordered, so you don't control which one).",
|
|
23
|
+
"example": "s = {1, 2, 3}\nitem = s.pop()\n# item -> one of 1, 2, or 3, removed from s",
|
|
24
|
+
"category": "mutating"
|
|
25
|
+
},
|
|
26
|
+
"clear": {
|
|
27
|
+
"signature": "set.clear()",
|
|
28
|
+
"description": "Removes all items from the set, in place.",
|
|
29
|
+
"example": "s = {1, 2}\ns.clear()\n# s -> set()",
|
|
30
|
+
"category": "mutating"
|
|
31
|
+
},
|
|
32
|
+
"union": {
|
|
33
|
+
"signature": "set.union(other)",
|
|
34
|
+
"description": "Returns a new set containing all items from both sets.",
|
|
35
|
+
"example": "{1, 2}.union({2, 3})\n# -> {1, 2, 3}",
|
|
36
|
+
"category": "read-only"
|
|
37
|
+
},
|
|
38
|
+
"intersection": {
|
|
39
|
+
"signature": "set.intersection(other)",
|
|
40
|
+
"description": "Returns a new set containing only items present in both sets.",
|
|
41
|
+
"example": "{1, 2, 3}.intersection({2, 3, 4})\n# -> {2, 3}",
|
|
42
|
+
"category": "read-only"
|
|
43
|
+
},
|
|
44
|
+
"difference": {
|
|
45
|
+
"signature": "set.difference(other)",
|
|
46
|
+
"description": "Returns a new set with items in this set but not in other.",
|
|
47
|
+
"example": "{1, 2, 3}.difference({2})\n# -> {1, 3}",
|
|
48
|
+
"category": "read-only"
|
|
49
|
+
},
|
|
50
|
+
"symmetric_difference": {
|
|
51
|
+
"signature": "set.symmetric_difference(other)",
|
|
52
|
+
"description": "Returns a new set with items in either set but not in both.",
|
|
53
|
+
"example": "{1, 2}.symmetric_difference({2, 3})\n# -> {1, 3}",
|
|
54
|
+
"category": "read-only"
|
|
55
|
+
},
|
|
56
|
+
"issubset": {
|
|
57
|
+
"signature": "set.issubset(other)",
|
|
58
|
+
"description": "Returns True if every item in this set is also in other.",
|
|
59
|
+
"example": "{1, 2}.issubset({1, 2, 3})\n# -> True",
|
|
60
|
+
"category": "read-only"
|
|
61
|
+
},
|
|
62
|
+
"issuperset": {
|
|
63
|
+
"signature": "set.issuperset(other)",
|
|
64
|
+
"description": "Returns True if this set contains every item in other.",
|
|
65
|
+
"example": "{1, 2, 3}.issuperset({1, 2})\n# -> True",
|
|
66
|
+
"category": "read-only"
|
|
67
|
+
},
|
|
68
|
+
"copy": {
|
|
69
|
+
"signature": "set.copy()",
|
|
70
|
+
"description": "Returns a shallow copy of the set as a new, separate object.",
|
|
71
|
+
"example": "s = {1, 2}\ns2 = s.copy()\n# s2 -> {1, 2}, separate object",
|
|
72
|
+
"category": "read-only"
|
|
73
|
+
}
|
|
74
|
+
}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
{
|
|
2
|
+
"strip": {
|
|
3
|
+
"signature": "str.strip(chars=None)",
|
|
4
|
+
"description": "Removes leading and trailing whitespace (or the given characters) and returns a new string.",
|
|
5
|
+
"example": "' hello '.strip()\n# -> 'hello'",
|
|
6
|
+
"category": "read-only"
|
|
7
|
+
},
|
|
8
|
+
"lower": {
|
|
9
|
+
"signature": "str.lower()",
|
|
10
|
+
"description": "Returns a new string with all characters converted to lowercase.",
|
|
11
|
+
"example": "'HELLO'.lower()\n# -> 'hello'",
|
|
12
|
+
"category": "read-only"
|
|
13
|
+
},
|
|
14
|
+
"upper": {
|
|
15
|
+
"signature": "str.upper()",
|
|
16
|
+
"description": "Returns a new string with all characters converted to uppercase.",
|
|
17
|
+
"example": "'hello'.upper()\n# -> 'HELLO'",
|
|
18
|
+
"category": "read-only"
|
|
19
|
+
},
|
|
20
|
+
"split": {
|
|
21
|
+
"signature": "str.split(sep=None)",
|
|
22
|
+
"description": "Splits the string into a list of substrings using sep as the delimiter (whitespace by default).",
|
|
23
|
+
"example": "'a,b,c'.split(',')\n# -> ['a', 'b', 'c']",
|
|
24
|
+
"category": "read-only"
|
|
25
|
+
},
|
|
26
|
+
"join": {
|
|
27
|
+
"signature": "str.join(iterable)",
|
|
28
|
+
"description": "Joins the items of an iterable into a single string, using this string as the separator.",
|
|
29
|
+
"example": "','.join(['a', 'b', 'c'])\n# -> 'a,b,c'",
|
|
30
|
+
"category": "read-only"
|
|
31
|
+
},
|
|
32
|
+
"replace": {
|
|
33
|
+
"signature": "str.replace(old, new)",
|
|
34
|
+
"description": "Returns a new string with all occurrences of old replaced by new.",
|
|
35
|
+
"example": "'hello'.replace('l', 'L')\n# -> 'heLLo'",
|
|
36
|
+
"category": "read-only"
|
|
37
|
+
},
|
|
38
|
+
"startswith": {
|
|
39
|
+
"signature": "str.startswith(prefix)",
|
|
40
|
+
"description": "Returns True if the string starts with prefix.",
|
|
41
|
+
"example": "'hello'.startswith('he')\n# -> True",
|
|
42
|
+
"category": "read-only"
|
|
43
|
+
},
|
|
44
|
+
"endswith": {
|
|
45
|
+
"signature": "str.endswith(suffix)",
|
|
46
|
+
"description": "Returns True if the string ends with suffix.",
|
|
47
|
+
"example": "'hello'.endswith('lo')\n# -> True",
|
|
48
|
+
"category": "read-only"
|
|
49
|
+
},
|
|
50
|
+
"find": {
|
|
51
|
+
"signature": "str.find(sub)",
|
|
52
|
+
"description": "Returns the lowest index where sub is found, or -1 if not found — never raises an error.",
|
|
53
|
+
"example": "'hello'.find('l')\n# -> 2",
|
|
54
|
+
"category": "read-only"
|
|
55
|
+
},
|
|
56
|
+
"format": {
|
|
57
|
+
"signature": "str.format(*args, **kwargs)",
|
|
58
|
+
"description": "Returns a new formatted string, filling {} placeholders from the given args and kwargs.",
|
|
59
|
+
"example": "'{}, {}!'.format('Hello', 'World')\n# -> 'Hello, World!'",
|
|
60
|
+
"category": "read-only"
|
|
61
|
+
},
|
|
62
|
+
"isdigit": {
|
|
63
|
+
"signature": "str.isdigit()",
|
|
64
|
+
"description": "Returns True if every character is a digit and the string is non-empty.",
|
|
65
|
+
"example": "'123'.isdigit()\n# -> True",
|
|
66
|
+
"category": "read-only"
|
|
67
|
+
},
|
|
68
|
+
"isalpha": {
|
|
69
|
+
"signature": "str.isalpha()",
|
|
70
|
+
"description": "Returns True if every character is alphabetic and the string is non-empty.",
|
|
71
|
+
"example": "'abc'.isalpha()\n# -> True",
|
|
72
|
+
"category": "read-only"
|
|
73
|
+
}
|
|
74
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
{
|
|
2
|
+
"count": {
|
|
3
|
+
"signature": "tuple.count(value)",
|
|
4
|
+
"description": "Returns how many times value appears in the tuple.",
|
|
5
|
+
"example": "(1, 2, 2, 3).count(2)\n# -> 2",
|
|
6
|
+
"category": "read-only"
|
|
7
|
+
},
|
|
8
|
+
"index": {
|
|
9
|
+
"signature": "tuple.index(value)",
|
|
10
|
+
"description": "Returns the index of the first occurrence of value; raises ValueError if not found.",
|
|
11
|
+
"example": "(10, 20, 30).index(20)\n# -> 1",
|
|
12
|
+
"category": "read-only"
|
|
13
|
+
}
|
|
14
|
+
}
|
|
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "pymethodbook"
|
|
7
|
-
version = "0.
|
|
7
|
+
version = "0.2.0"
|
|
8
8
|
description = "A terminal-first reference tool for Python's built-in methods — curated descriptions, runnable examples, and a searchable CLI."
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
requires-python = ">=3.8"
|
|
@@ -5,10 +5,10 @@ from pymethodbook.core import (
|
|
|
5
5
|
)
|
|
6
6
|
|
|
7
7
|
|
|
8
|
-
def
|
|
8
|
+
def test_available_types_includes_all_core_types():
|
|
9
9
|
types = available_types()
|
|
10
|
-
|
|
11
|
-
|
|
10
|
+
for expected in ("list", "dict", "str", "set", "tuple"):
|
|
11
|
+
assert expected in types
|
|
12
12
|
|
|
13
13
|
|
|
14
14
|
def test_load_type_returns_dict_with_entries():
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|