batutils 2.2.0__tar.gz → 2.2.1__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.
- {batutils-2.2.0 → batutils-2.2.1}/PKG-INFO +62 -41
- batutils-2.2.1/README.md +95 -0
- {batutils-2.2.0 → batutils-2.2.1}/batutils/__init__.py +1 -1
- {batutils-2.2.0 → batutils-2.2.1}/batutils.egg-info/PKG-INFO +62 -41
- {batutils-2.2.0 → batutils-2.2.1}/batutils.egg-info/top_level.txt +1 -0
- batutils-2.2.0/README.md +0 -74
- {batutils-2.2.0 → batutils-2.2.1}/LICENSE +0 -0
- {batutils-2.2.0 → batutils-2.2.1}/batutils/_common/__init__.py +0 -0
- {batutils-2.2.0 → batutils-2.2.1}/batutils/_common/_decode.py +0 -0
- {batutils-2.2.0 → batutils-2.2.1}/batutils/dtu/__init__.py +0 -0
- {batutils-2.2.0 → batutils-2.2.1}/batutils/dtu/casting/__init__.py +0 -0
- {batutils-2.2.0 → batutils-2.2.1}/batutils/dtu/casting/_any.py +0 -0
- {batutils-2.2.0 → batutils-2.2.1}/batutils/dtu/casting/_filetime.py +0 -0
- {batutils-2.2.0 → batutils-2.2.1}/batutils/dtu/casting/_instant.py +0 -0
- {batutils-2.2.0 → batutils-2.2.1}/batutils/dtu/casting/_string.py +0 -0
- {batutils-2.2.0 → batutils-2.2.1}/batutils/dtu/casting/_timestamp.py +0 -0
- {batutils-2.2.0 → batutils-2.2.1}/batutils/dtu/formatting/__init__.py +0 -0
- {batutils-2.2.0 → batutils-2.2.1}/batutils/dtu/formatting/_delta.py +0 -0
- {batutils-2.2.0 → batutils-2.2.1}/batutils/dtu/formatting/_serialize.py +0 -0
- {batutils-2.2.0 → batutils-2.2.1}/batutils/dtu/parsers/__init__.py +0 -0
- {batutils-2.2.0 → batutils-2.2.1}/batutils/dtu/parsers/_string.py +0 -0
- {batutils-2.2.0 → batutils-2.2.1}/batutils/dtu/parsers/_timedelta.py +0 -0
- {batutils-2.2.0 → batutils-2.2.1}/batutils/dtu/shortcuts/__init__.py +0 -0
- {batutils-2.2.0 → batutils-2.2.1}/batutils/dtu/shortcuts/_aliases.py +0 -0
- {batutils-2.2.0 → batutils-2.2.1}/batutils/dtu/shortcuts/_checkers.py +0 -0
- {batutils-2.2.0 → batutils-2.2.1}/batutils/dtu/shortcuts/_finders.py +0 -0
- {batutils-2.2.0 → batutils-2.2.1}/batutils/dtu/structs/__init__.py +0 -0
- {batutils-2.2.0 → batutils-2.2.1}/batutils/dtu/structs/_base.py +0 -0
- {batutils-2.2.0 → batutils-2.2.1}/batutils/dtu/structs/_deltasplit.py +0 -0
- {batutils-2.2.0 → batutils-2.2.1}/batutils/dtu/structs/_types.py +0 -0
- {batutils-2.2.0 → batutils-2.2.1}/batutils/dtu/structs/aliases.py +0 -0
- {batutils-2.2.0 → batutils-2.2.1}/batutils/dtu/structs/consts.py +0 -0
- {batutils-2.2.0 → batutils-2.2.1}/batutils/structs/__init__.py +0 -0
- {batutils-2.2.0 → batutils-2.2.1}/batutils/structs/_base.py +0 -0
- {batutils-2.2.0 → batutils-2.2.1}/batutils/tpu/__init__.py +0 -0
- {batutils-2.2.0 → batutils-2.2.1}/batutils/tpu/casting/__init__.py +0 -0
- {batutils-2.2.0 → batutils-2.2.1}/batutils/tpu/casting/_currency.py +0 -0
- {batutils-2.2.0 → batutils-2.2.1}/batutils/tpu/casting/_evals.py +0 -0
- {batutils-2.2.0 → batutils-2.2.1}/batutils/tpu/casting/_ip.py +0 -0
- {batutils-2.2.0 → batutils-2.2.1}/batutils/tpu/casting/_mask.py +0 -0
- {batutils-2.2.0 → batutils-2.2.1}/batutils/tpu/casting/_params.py +0 -0
- {batutils-2.2.0 → batutils-2.2.1}/batutils/tpu/casting/_serialize.py +0 -0
- {batutils-2.2.0 → batutils-2.2.1}/batutils/tpu/comparison/__init__.py +0 -0
- {batutils-2.2.0 → batutils-2.2.1}/batutils/tpu/comparison/_mixin.py +0 -0
- {batutils-2.2.0 → batutils-2.2.1}/batutils/tpu/insp/__init__.py +0 -0
- {batutils-2.2.0 → batutils-2.2.1}/batutils/tpu/insp/_insp_old.py +0 -0
- {batutils-2.2.0 → batutils-2.2.1}/batutils/tpu/insp/_typecheck.py +0 -0
- {batutils-2.2.0 → batutils-2.2.1}/batutils/tpu/iters/__init__.py +0 -0
- {batutils-2.2.0 → batutils-2.2.1}/batutils/tpu/iters/_attrs.py +0 -0
- {batutils-2.2.0 → batutils-2.2.1}/batutils/tpu/iters/_dicts.py +0 -0
- {batutils-2.2.0 → batutils-2.2.1}/batutils/tpu/iters/_group.py +0 -0
- {batutils-2.2.0 → batutils-2.2.1}/batutils/tpu/iters/_lists.py +0 -0
- {batutils-2.2.0 → batutils-2.2.1}/batutils/tpu/size/__init__.py +0 -0
- {batutils-2.2.0 → batutils-2.2.1}/batutils/tpu/size/_total.py +0 -0
- {batutils-2.2.0 → batutils-2.2.1}/batutils/tpu/strimp/__init__.py +0 -0
- {batutils-2.2.0 → batutils-2.2.1}/batutils/tpu/strimp/_getters.py +0 -0
- {batutils-2.2.0 → batutils-2.2.1}/batutils/tpu/string/__init__.py +0 -0
- {batutils-2.2.0 → batutils-2.2.1}/batutils/tpu/string/_string.py +0 -0
- {batutils-2.2.0 → batutils-2.2.1}/batutils/tpu/structs/__init__.py +0 -0
- {batutils-2.2.0 → batutils-2.2.1}/batutils/tpu/structs/_base.py +0 -0
- {batutils-2.2.0 → batutils-2.2.1}/batutils/tpu/structs/empty/__init__.py +0 -0
- {batutils-2.2.0 → batutils-2.2.1}/batutils/tpu/structs/empty/_empty.py +0 -0
- {batutils-2.2.0 → batutils-2.2.1}/batutils/tpu/structs/enumex/__init__.py +0 -0
- {batutils-2.2.0 → batutils-2.2.1}/batutils/tpu/structs/enumex/_enumextra.py +0 -0
- {batutils-2.2.0 → batutils-2.2.1}/batutils/tpu/structs/fluid/__init__.py +0 -0
- {batutils-2.2.0 → batutils-2.2.1}/batutils/tpu/structs/fluid/_attrfluid.py +0 -0
- {batutils-2.2.0 → batutils-2.2.1}/batutils/tpu/structs/sentience/__init__.py +0 -0
- {batutils-2.2.0 → batutils-2.2.1}/batutils/tpu/structs/sentience/_builder.py +0 -0
- {batutils-2.2.0 → batutils-2.2.1}/batutils/tpu/structs/serializers/__init__.py +0 -0
- {batutils-2.2.0 → batutils-2.2.1}/batutils/tpu/structs/serializers/_json.py +0 -0
- {batutils-2.2.0 → batutils-2.2.1}/batutils/tpu/structs/serializers/_jsonsafe.py +0 -0
- {batutils-2.2.0 → batutils-2.2.1}/batutils/tpu/structs/serializers/_universal.py +0 -0
- {batutils-2.2.0 → batutils-2.2.1}/batutils/tpu/structs/singleton/__init__.py +0 -0
- {batutils-2.2.0 → batutils-2.2.1}/batutils/tpu/structs/singleton/_singleton.py +0 -0
- {batutils-2.2.0 → batutils-2.2.1}/batutils.egg-info/SOURCES.txt +0 -0
- {batutils-2.2.0 → batutils-2.2.1}/batutils.egg-info/dependency_links.txt +0 -0
- {batutils-2.2.0 → batutils-2.2.1}/pyproject.toml +0 -0
- {batutils-2.2.0 → batutils-2.2.1}/setup.cfg +0 -0
- {batutils-2.2.0 → batutils-2.2.1}/setup.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: batutils
|
|
3
|
-
Version: 2.2.
|
|
3
|
+
Version: 2.2.1
|
|
4
4
|
Summary: Team Batcave's utilities for date and/or time objects and values and messing with types and so much more.
|
|
5
5
|
Author-email: Thordur Matthiasson <doddi79@gmail.com>, John Aldis <johnaldis@ccpgames.com>
|
|
6
6
|
License: MIT License
|
|
@@ -50,57 +50,69 @@ Description-Content-Type: text/markdown
|
|
|
50
50
|
License-File: LICENSE
|
|
51
51
|
Dynamic: license-file
|
|
52
52
|
|
|
53
|
-
# Team Batcave Python Toolkit
|
|
53
|
+
# batutils - Team Batcave Python Toolkit
|
|
54
54
|
|
|
55
|
-
|
|
56
|
-
development and maintenance beyond Team Batcave's lifespan.
|
|
55
|
+
[](https://pypi.org/project/batutils/)
|
|
57
56
|
|
|
58
|
-
|
|
59
|
-
Batcave
|
|
57
|
+
A grab-bag of small, dependency-free Python utilities for working with dates
|
|
58
|
+
and times and for everyday type juggling, originally written by Team Batcave
|
|
59
|
+
at CCP Games.
|
|
60
60
|
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
Here's the README of the [Date Time Utils](batutils/dtu/README.md) submodule.
|
|
68
|
-
|
|
69
|
-
Here's the README of the [Type Utils](batutils/tpu/README.md) submodule.
|
|
61
|
+
This is a fork of [`ccptools`](https://github.com/ccpgames/ccptools), kept alive
|
|
62
|
+
beyond the original team's lifespan. Our two most commonly used internal packages,
|
|
63
|
+
`datetimeutils` and `typeutils`, had names that were too generic for PyPI and were
|
|
64
|
+
used in 80-90% of our other projects, so they were smooshed together into one
|
|
65
|
+
package.
|
|
70
66
|
|
|
67
|
+
```bash
|
|
68
|
+
pip install batutils
|
|
69
|
+
```
|
|
71
70
|
|
|
72
|
-
|
|
71
|
+
Requires Python 3.10 or newer.
|
|
73
72
|
|
|
74
|
-
|
|
73
|
+
## What's inside
|
|
75
74
|
|
|
75
|
+
| Submodule | Formerly | What it is | Docs |
|
|
76
|
+
|-----------|----------|------------|------|
|
|
77
|
+
| `batutils.dtu` | `datetimeutils` | Casting, parsing, formatting and shortcuts for date/time values | [Date/Time Utils](batutils/dtu/README.md) |
|
|
78
|
+
| `batutils.tpu` | `typeutils` | Safe type evaluation, nested dict/list helpers, enums, singletons, serializers and more | [Type Utils](batutils/tpu/README.md) |
|
|
79
|
+
| `batutils.structs` | | One-line "usual imports" for your modules | [below](#common-imports) |
|
|
76
80
|
|
|
77
|
-
|
|
81
|
+
**Looking for a specific function?** Use the task-oriented
|
|
82
|
+
[Public API index](docs/api-index.md).
|
|
78
83
|
|
|
79
|
-
|
|
84
|
+
## Quick taste
|
|
80
85
|
|
|
81
86
|
```python
|
|
82
87
|
from batutils import dtu
|
|
88
|
+
from batutils.tpu.casting import int_eval, bool_eval
|
|
89
|
+
from batutils.tpu.iters import nested_get
|
|
90
|
+
|
|
91
|
+
dtu.any_to_datetime('2024-04-02 13:47:25') # datetime(2024, 4, 2, 13, 47, 25)
|
|
92
|
+
dtu.agostr(dtu.ago(days=5)) # '5 days'
|
|
93
|
+
int_eval('0x10') # 16
|
|
94
|
+
bool_eval('Yes') # True
|
|
95
|
+
nested_get({'a': {'b': [1, 2, 3]}}, ('a', 'b', -1)) # 3
|
|
83
96
|
```
|
|
84
97
|
|
|
85
|
-
##
|
|
98
|
+
## Common imports
|
|
99
|
+
|
|
100
|
+
`from batutils.structs import *` pulls in the imports that nearly every file in
|
|
101
|
+
our projects needs:
|
|
86
102
|
|
|
87
|
-
Importing `*` from the `structs` submodule will import all of the most
|
|
88
|
-
commonly used imports in our projects:
|
|
89
103
|
```python
|
|
90
|
-
from typing import *
|
|
91
|
-
|
|
92
|
-
import
|
|
93
|
-
import
|
|
94
|
-
import
|
|
95
|
-
import
|
|
96
|
-
import
|
|
97
|
-
import
|
|
98
|
-
import time # Very commonly used
|
|
104
|
+
from typing import * # for type annotations
|
|
105
|
+
import abc # interfaces (Abstract Base Classes)
|
|
106
|
+
import dataclasses # dataclass structs
|
|
107
|
+
import decimal # anything involving money
|
|
108
|
+
import enum # also used for struct creation
|
|
109
|
+
import logging # used pretty much everywhere
|
|
110
|
+
import re # used surprisingly frequently
|
|
111
|
+
import time # very commonly used
|
|
99
112
|
```
|
|
100
113
|
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
package instead:
|
|
114
|
+
`datetime` itself is not included. Instead you get the date/time aliases from
|
|
115
|
+
`batutils.dtu.structs.aliases`:
|
|
104
116
|
|
|
105
117
|
```python
|
|
106
118
|
Date = datetime.date
|
|
@@ -111,16 +123,25 @@ TzInfo = datetime.tzinfo
|
|
|
111
123
|
TimeZone = datetime.timezone
|
|
112
124
|
```
|
|
113
125
|
|
|
114
|
-
|
|
115
|
-
classes from the Type Utils submodule:
|
|
126
|
+
Plus a few of the most commonly used helpers from the type utils:
|
|
116
127
|
|
|
117
|
-
-
|
|
118
|
-
-
|
|
119
|
-
-
|
|
128
|
+
- the `Singleton` metaclass
|
|
129
|
+
- `Empty`, `EmptyDict` and `if_empty`
|
|
130
|
+
- the `EnumEx` base class for enums (adds the `from_any` class method)
|
|
120
131
|
|
|
121
|
-
So
|
|
122
|
-
need in every Python file with a single line:
|
|
132
|
+
So one line covers roughly 90% of the imports we need in any given file:
|
|
123
133
|
|
|
124
134
|
```python
|
|
125
135
|
from batutils.structs import *
|
|
126
136
|
```
|
|
137
|
+
|
|
138
|
+
## Changes from `ccptools`
|
|
139
|
+
|
|
140
|
+
The `legacyapi` submodule has been removed. See the [changelog](CHANGELOG.md)
|
|
141
|
+
for the full history.
|
|
142
|
+
|
|
143
|
+
## Contributing and license
|
|
144
|
+
|
|
145
|
+
Issues and pull requests are welcome at
|
|
146
|
+
[github.com/doddi79/batutils](https://github.com/doddi79/batutils). Released
|
|
147
|
+
under the [MIT License](LICENSE).
|
batutils-2.2.1/README.md
ADDED
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
# batutils - Team Batcave Python Toolkit
|
|
2
|
+
|
|
3
|
+
[](https://pypi.org/project/batutils/)
|
|
4
|
+
|
|
5
|
+
A grab-bag of small, dependency-free Python utilities for working with dates
|
|
6
|
+
and times and for everyday type juggling, originally written by Team Batcave
|
|
7
|
+
at CCP Games.
|
|
8
|
+
|
|
9
|
+
This is a fork of [`ccptools`](https://github.com/ccpgames/ccptools), kept alive
|
|
10
|
+
beyond the original team's lifespan. Our two most commonly used internal packages,
|
|
11
|
+
`datetimeutils` and `typeutils`, had names that were too generic for PyPI and were
|
|
12
|
+
used in 80-90% of our other projects, so they were smooshed together into one
|
|
13
|
+
package.
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
pip install batutils
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
Requires Python 3.10 or newer.
|
|
20
|
+
|
|
21
|
+
## What's inside
|
|
22
|
+
|
|
23
|
+
| Submodule | Formerly | What it is | Docs |
|
|
24
|
+
|-----------|----------|------------|------|
|
|
25
|
+
| `batutils.dtu` | `datetimeutils` | Casting, parsing, formatting and shortcuts for date/time values | [Date/Time Utils](batutils/dtu/README.md) |
|
|
26
|
+
| `batutils.tpu` | `typeutils` | Safe type evaluation, nested dict/list helpers, enums, singletons, serializers and more | [Type Utils](batutils/tpu/README.md) |
|
|
27
|
+
| `batutils.structs` | | One-line "usual imports" for your modules | [below](#common-imports) |
|
|
28
|
+
|
|
29
|
+
**Looking for a specific function?** Use the task-oriented
|
|
30
|
+
[Public API index](docs/api-index.md).
|
|
31
|
+
|
|
32
|
+
## Quick taste
|
|
33
|
+
|
|
34
|
+
```python
|
|
35
|
+
from batutils import dtu
|
|
36
|
+
from batutils.tpu.casting import int_eval, bool_eval
|
|
37
|
+
from batutils.tpu.iters import nested_get
|
|
38
|
+
|
|
39
|
+
dtu.any_to_datetime('2024-04-02 13:47:25') # datetime(2024, 4, 2, 13, 47, 25)
|
|
40
|
+
dtu.agostr(dtu.ago(days=5)) # '5 days'
|
|
41
|
+
int_eval('0x10') # 16
|
|
42
|
+
bool_eval('Yes') # True
|
|
43
|
+
nested_get({'a': {'b': [1, 2, 3]}}, ('a', 'b', -1)) # 3
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
## Common imports
|
|
47
|
+
|
|
48
|
+
`from batutils.structs import *` pulls in the imports that nearly every file in
|
|
49
|
+
our projects needs:
|
|
50
|
+
|
|
51
|
+
```python
|
|
52
|
+
from typing import * # for type annotations
|
|
53
|
+
import abc # interfaces (Abstract Base Classes)
|
|
54
|
+
import dataclasses # dataclass structs
|
|
55
|
+
import decimal # anything involving money
|
|
56
|
+
import enum # also used for struct creation
|
|
57
|
+
import logging # used pretty much everywhere
|
|
58
|
+
import re # used surprisingly frequently
|
|
59
|
+
import time # very commonly used
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
`datetime` itself is not included. Instead you get the date/time aliases from
|
|
63
|
+
`batutils.dtu.structs.aliases`:
|
|
64
|
+
|
|
65
|
+
```python
|
|
66
|
+
Date = datetime.date
|
|
67
|
+
Time = datetime.time
|
|
68
|
+
Datetime = datetime.datetime
|
|
69
|
+
TimeDelta = datetime.timedelta
|
|
70
|
+
TzInfo = datetime.tzinfo
|
|
71
|
+
TimeZone = datetime.timezone
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
Plus a few of the most commonly used helpers from the type utils:
|
|
75
|
+
|
|
76
|
+
- the `Singleton` metaclass
|
|
77
|
+
- `Empty`, `EmptyDict` and `if_empty`
|
|
78
|
+
- the `EnumEx` base class for enums (adds the `from_any` class method)
|
|
79
|
+
|
|
80
|
+
So one line covers roughly 90% of the imports we need in any given file:
|
|
81
|
+
|
|
82
|
+
```python
|
|
83
|
+
from batutils.structs import *
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
## Changes from `ccptools`
|
|
87
|
+
|
|
88
|
+
The `legacyapi` submodule has been removed. See the [changelog](CHANGELOG.md)
|
|
89
|
+
for the full history.
|
|
90
|
+
|
|
91
|
+
## Contributing and license
|
|
92
|
+
|
|
93
|
+
Issues and pull requests are welcome at
|
|
94
|
+
[github.com/doddi79/batutils](https://github.com/doddi79/batutils). Released
|
|
95
|
+
under the [MIT License](LICENSE).
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: batutils
|
|
3
|
-
Version: 2.2.
|
|
3
|
+
Version: 2.2.1
|
|
4
4
|
Summary: Team Batcave's utilities for date and/or time objects and values and messing with types and so much more.
|
|
5
5
|
Author-email: Thordur Matthiasson <doddi79@gmail.com>, John Aldis <johnaldis@ccpgames.com>
|
|
6
6
|
License: MIT License
|
|
@@ -50,57 +50,69 @@ Description-Content-Type: text/markdown
|
|
|
50
50
|
License-File: LICENSE
|
|
51
51
|
Dynamic: license-file
|
|
52
52
|
|
|
53
|
-
# Team Batcave Python Toolkit
|
|
53
|
+
# batutils - Team Batcave Python Toolkit
|
|
54
54
|
|
|
55
|
-
|
|
56
|
-
development and maintenance beyond Team Batcave's lifespan.
|
|
55
|
+
[](https://pypi.org/project/batutils/)
|
|
57
56
|
|
|
58
|
-
|
|
59
|
-
Batcave
|
|
57
|
+
A grab-bag of small, dependency-free Python utilities for working with dates
|
|
58
|
+
and times and for everyday type juggling, originally written by Team Batcave
|
|
59
|
+
at CCP Games.
|
|
60
60
|
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
Here's the README of the [Date Time Utils](batutils/dtu/README.md) submodule.
|
|
68
|
-
|
|
69
|
-
Here's the README of the [Type Utils](batutils/tpu/README.md) submodule.
|
|
61
|
+
This is a fork of [`ccptools`](https://github.com/ccpgames/ccptools), kept alive
|
|
62
|
+
beyond the original team's lifespan. Our two most commonly used internal packages,
|
|
63
|
+
`datetimeutils` and `typeutils`, had names that were too generic for PyPI and were
|
|
64
|
+
used in 80-90% of our other projects, so they were smooshed together into one
|
|
65
|
+
package.
|
|
70
66
|
|
|
67
|
+
```bash
|
|
68
|
+
pip install batutils
|
|
69
|
+
```
|
|
71
70
|
|
|
72
|
-
|
|
71
|
+
Requires Python 3.10 or newer.
|
|
73
72
|
|
|
74
|
-
|
|
73
|
+
## What's inside
|
|
75
74
|
|
|
75
|
+
| Submodule | Formerly | What it is | Docs |
|
|
76
|
+
|-----------|----------|------------|------|
|
|
77
|
+
| `batutils.dtu` | `datetimeutils` | Casting, parsing, formatting and shortcuts for date/time values | [Date/Time Utils](batutils/dtu/README.md) |
|
|
78
|
+
| `batutils.tpu` | `typeutils` | Safe type evaluation, nested dict/list helpers, enums, singletons, serializers and more | [Type Utils](batutils/tpu/README.md) |
|
|
79
|
+
| `batutils.structs` | | One-line "usual imports" for your modules | [below](#common-imports) |
|
|
76
80
|
|
|
77
|
-
|
|
81
|
+
**Looking for a specific function?** Use the task-oriented
|
|
82
|
+
[Public API index](docs/api-index.md).
|
|
78
83
|
|
|
79
|
-
|
|
84
|
+
## Quick taste
|
|
80
85
|
|
|
81
86
|
```python
|
|
82
87
|
from batutils import dtu
|
|
88
|
+
from batutils.tpu.casting import int_eval, bool_eval
|
|
89
|
+
from batutils.tpu.iters import nested_get
|
|
90
|
+
|
|
91
|
+
dtu.any_to_datetime('2024-04-02 13:47:25') # datetime(2024, 4, 2, 13, 47, 25)
|
|
92
|
+
dtu.agostr(dtu.ago(days=5)) # '5 days'
|
|
93
|
+
int_eval('0x10') # 16
|
|
94
|
+
bool_eval('Yes') # True
|
|
95
|
+
nested_get({'a': {'b': [1, 2, 3]}}, ('a', 'b', -1)) # 3
|
|
83
96
|
```
|
|
84
97
|
|
|
85
|
-
##
|
|
98
|
+
## Common imports
|
|
99
|
+
|
|
100
|
+
`from batutils.structs import *` pulls in the imports that nearly every file in
|
|
101
|
+
our projects needs:
|
|
86
102
|
|
|
87
|
-
Importing `*` from the `structs` submodule will import all of the most
|
|
88
|
-
commonly used imports in our projects:
|
|
89
103
|
```python
|
|
90
|
-
from typing import *
|
|
91
|
-
|
|
92
|
-
import
|
|
93
|
-
import
|
|
94
|
-
import
|
|
95
|
-
import
|
|
96
|
-
import
|
|
97
|
-
import
|
|
98
|
-
import time # Very commonly used
|
|
104
|
+
from typing import * # for type annotations
|
|
105
|
+
import abc # interfaces (Abstract Base Classes)
|
|
106
|
+
import dataclasses # dataclass structs
|
|
107
|
+
import decimal # anything involving money
|
|
108
|
+
import enum # also used for struct creation
|
|
109
|
+
import logging # used pretty much everywhere
|
|
110
|
+
import re # used surprisingly frequently
|
|
111
|
+
import time # very commonly used
|
|
99
112
|
```
|
|
100
113
|
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
package instead:
|
|
114
|
+
`datetime` itself is not included. Instead you get the date/time aliases from
|
|
115
|
+
`batutils.dtu.structs.aliases`:
|
|
104
116
|
|
|
105
117
|
```python
|
|
106
118
|
Date = datetime.date
|
|
@@ -111,16 +123,25 @@ TzInfo = datetime.tzinfo
|
|
|
111
123
|
TimeZone = datetime.timezone
|
|
112
124
|
```
|
|
113
125
|
|
|
114
|
-
|
|
115
|
-
classes from the Type Utils submodule:
|
|
126
|
+
Plus a few of the most commonly used helpers from the type utils:
|
|
116
127
|
|
|
117
|
-
-
|
|
118
|
-
-
|
|
119
|
-
-
|
|
128
|
+
- the `Singleton` metaclass
|
|
129
|
+
- `Empty`, `EmptyDict` and `if_empty`
|
|
130
|
+
- the `EnumEx` base class for enums (adds the `from_any` class method)
|
|
120
131
|
|
|
121
|
-
So
|
|
122
|
-
need in every Python file with a single line:
|
|
132
|
+
So one line covers roughly 90% of the imports we need in any given file:
|
|
123
133
|
|
|
124
134
|
```python
|
|
125
135
|
from batutils.structs import *
|
|
126
136
|
```
|
|
137
|
+
|
|
138
|
+
## Changes from `ccptools`
|
|
139
|
+
|
|
140
|
+
The `legacyapi` submodule has been removed. See the [changelog](CHANGELOG.md)
|
|
141
|
+
for the full history.
|
|
142
|
+
|
|
143
|
+
## Contributing and license
|
|
144
|
+
|
|
145
|
+
Issues and pull requests are welcome at
|
|
146
|
+
[github.com/doddi79/batutils](https://github.com/doddi79/batutils). Released
|
|
147
|
+
under the [MIT License](LICENSE).
|
batutils-2.2.0/README.md
DELETED
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
# Team Batcave Python Toolkit
|
|
2
|
-
|
|
3
|
-
The `batutils` is a fork of the `batutils` package in order to continue its
|
|
4
|
-
development and maintenance beyond Team Batcave's lifespan.
|
|
5
|
-
|
|
6
|
-
It is a smooshup of a few Python packages from the CCP Tools Team of old (Team
|
|
7
|
-
Batcave).
|
|
8
|
-
|
|
9
|
-
Our two most commonly used internal packages, called `datetimeutils` and
|
|
10
|
-
`typeutils` were too _generically_ named for Pypi.org and since they were
|
|
11
|
-
both used in something like 80-90% of our other projects, it made sense to
|
|
12
|
-
just smoosh them together in one module, and thus, the `batutils` package
|
|
13
|
-
was born.
|
|
14
|
-
|
|
15
|
-
Here's the README of the [Date Time Utils](batutils/dtu/README.md) submodule.
|
|
16
|
-
|
|
17
|
-
Here's the README of the [Type Utils](batutils/tpu/README.md) submodule.
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
### Changes from `ccptools`
|
|
21
|
-
|
|
22
|
-
The `legacyapi` submodule has been removed.
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
## Date-Time Utils
|
|
26
|
-
|
|
27
|
-
The old `datetimeutils` package is now included here as the `dtu` submodule.
|
|
28
|
-
|
|
29
|
-
```python
|
|
30
|
-
from batutils import dtu
|
|
31
|
-
```
|
|
32
|
-
|
|
33
|
-
## Structs
|
|
34
|
-
|
|
35
|
-
Importing `*` from the `structs` submodule will import all of the most
|
|
36
|
-
commonly used imports in our projects:
|
|
37
|
-
```python
|
|
38
|
-
from typing import * # For type annotation
|
|
39
|
-
|
|
40
|
-
import abc # For interfaces (Abstract Base Classes)
|
|
41
|
-
import dataclasses # For dataclass structs
|
|
42
|
-
import decimal # Used whenever we're handling money
|
|
43
|
-
import enum # Also used for struct creation
|
|
44
|
-
import logging # Used pretty much everywhere
|
|
45
|
-
import re # Used surprisingly frequently
|
|
46
|
-
import time # Very commonly used
|
|
47
|
-
```
|
|
48
|
-
|
|
49
|
-
Note that datetime is not included in this. That's because tt'll also import
|
|
50
|
-
the aliases from the Datetime Utils (`batutils.dtu.structs.aliases`)
|
|
51
|
-
package instead:
|
|
52
|
-
|
|
53
|
-
```python
|
|
54
|
-
Date = datetime.date
|
|
55
|
-
Time = datetime.time
|
|
56
|
-
Datetime = datetime.datetime
|
|
57
|
-
TimeDelta = datetime.timedelta
|
|
58
|
-
TzInfo = datetime.tzinfo
|
|
59
|
-
TimeZone = datetime.timezone
|
|
60
|
-
```
|
|
61
|
-
|
|
62
|
-
Furthermore, it'll also include a few of the most commonly used utility
|
|
63
|
-
classes from the Type Utils submodule:
|
|
64
|
-
|
|
65
|
-
- The `Singleton` Meta Class
|
|
66
|
-
- The `Empty` and `EmptyDict` classes as well as the `if_empty` method
|
|
67
|
-
- The `EnumEx` base class for Enums with the `from_any` class method
|
|
68
|
-
|
|
69
|
-
So in most cases we can cover something like 90% of any imports we tend to
|
|
70
|
-
need in every Python file with a single line:
|
|
71
|
-
|
|
72
|
-
```python
|
|
73
|
-
from batutils.structs import *
|
|
74
|
-
```
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|