fasttransform 0.0.1__tar.gz → 0.0.2__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.
Files changed (20) hide show
  1. {fasttransform-0.0.1/fasttransform.egg-info → fasttransform-0.0.2}/PKG-INFO +15 -2
  2. {fasttransform-0.0.1 → fasttransform-0.0.2}/fasttransform/__init__.py +1 -1
  3. {fasttransform-0.0.1 → fasttransform-0.0.2}/fasttransform/transform.py +19 -12
  4. {fasttransform-0.0.1 → fasttransform-0.0.2/fasttransform.egg-info}/PKG-INFO +15 -2
  5. fasttransform-0.0.2/pyproject.toml +11 -0
  6. {fasttransform-0.0.1 → fasttransform-0.0.2}/settings.ini +7 -14
  7. fasttransform-0.0.1/pyproject.toml +0 -3
  8. {fasttransform-0.0.1 → fasttransform-0.0.2}/LICENSE +0 -0
  9. {fasttransform-0.0.1 → fasttransform-0.0.2}/MANIFEST.in +0 -0
  10. {fasttransform-0.0.1 → fasttransform-0.0.2}/README.md +0 -0
  11. {fasttransform-0.0.1 → fasttransform-0.0.2}/fasttransform/_modidx.py +0 -0
  12. {fasttransform-0.0.1 → fasttransform-0.0.2}/fasttransform/cast.py +0 -0
  13. {fasttransform-0.0.1 → fasttransform-0.0.2}/fasttransform.egg-info/SOURCES.txt +0 -0
  14. {fasttransform-0.0.1 → fasttransform-0.0.2}/fasttransform.egg-info/dependency_links.txt +0 -0
  15. {fasttransform-0.0.1 → fasttransform-0.0.2}/fasttransform.egg-info/entry_points.txt +0 -0
  16. {fasttransform-0.0.1 → fasttransform-0.0.2}/fasttransform.egg-info/not-zip-safe +0 -0
  17. {fasttransform-0.0.1 → fasttransform-0.0.2}/fasttransform.egg-info/requires.txt +0 -0
  18. {fasttransform-0.0.1 → fasttransform-0.0.2}/fasttransform.egg-info/top_level.txt +0 -0
  19. {fasttransform-0.0.1 → fasttransform-0.0.2}/setup.cfg +0 -0
  20. {fasttransform-0.0.1 → fasttransform-0.0.2}/setup.py +0 -0
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.4
2
2
  Name: fasttransform
3
- Version: 0.0.1
3
+ Version: 0.0.2
4
4
  Summary: Transform is the main building block of data pipelines in fastai. And elsewhere if you want.
5
5
  Home-page: https://github.com/AnswerDotAI/fasttransform
6
6
  Author: Jeremy Howard and Rens Dimmendaal and Alexis Gallagher
@@ -24,6 +24,19 @@ Provides-Extra: dev
24
24
  Requires-Dist: matplotlib; extra == "dev"
25
25
  Requires-Dist: numpy; extra == "dev"
26
26
  Requires-Dist: pandas; extra == "dev"
27
+ Dynamic: author
28
+ Dynamic: author-email
29
+ Dynamic: classifier
30
+ Dynamic: description
31
+ Dynamic: description-content-type
32
+ Dynamic: home-page
33
+ Dynamic: keywords
34
+ Dynamic: license
35
+ Dynamic: license-file
36
+ Dynamic: provides-extra
37
+ Dynamic: requires-dist
38
+ Dynamic: requires-python
39
+ Dynamic: summary
27
40
 
28
41
  # Welcome to fasttransform
29
42
 
@@ -1,4 +1,4 @@
1
- __version__ = "0.0.1"
1
+ __version__ = "0.0.2"
2
2
 
3
3
  from .cast import *
4
4
  from .transform import *
@@ -8,6 +8,7 @@ __all__ = ['Sig', 'Transform', 'InplaceTransform', 'DisplayedTransform', 'ItemTr
8
8
 
9
9
  # %% ../nbs/01_transform.ipynb 1
10
10
  from typing import Any
11
+ import inspect
11
12
 
12
13
  from fastcore.imports import *
13
14
  from fastcore.foundation import *
@@ -63,7 +64,11 @@ class _TfmMeta(type):
63
64
  if not hasattr(cls, nm): setattr(cls, nm, Function(f).dispatch(f))
64
65
  else: getattr(cls,nm).dispatch(f)
65
66
  return cls
66
- return super().__call__(*args, **kwargs)
67
+ obj = super().__call__(*args, **kwargs)
68
+ # _TfmMeta.__new__ replaces cls.__signature__ which breaks the signature of a callable
69
+ # instances of cls, fix it
70
+ if hasattr(obj, '__call__'): obj.__signature__ = inspect.signature(obj.__call__)
71
+ return obj
67
72
 
68
73
 
69
74
  def __new__(cls, name, bases, namespace):
@@ -73,6 +78,8 @@ class _TfmMeta(type):
73
78
  funcs = [getattr(new_cls, nm)] + [getattr(b, nm,None) for b in bases]
74
79
  funcs = [f for f in funcs if f]
75
80
  if funcs: setattr(new_cls, nm, _merge_funcs(*funcs))
81
+ # _TfmMeta.__call__ shadows the signature of inheriting classes, set it back
82
+ new_cls.__signature__ = inspect.signature(new_cls.__init__)
76
83
  return new_cls
77
84
 
78
85
  # %% ../nbs/01_transform.ipynb 14
@@ -130,21 +137,21 @@ class Transform(metaclass=_TfmMeta):
130
137
 
131
138
  add_docs(Transform, decode="Delegate to decodes to undo transform", setup="Delegate to setups to set up transform")
132
139
 
133
- # %% ../nbs/01_transform.ipynb 155
140
+ # %% ../nbs/01_transform.ipynb 156
134
141
  class InplaceTransform(Transform):
135
142
  "A `Transform` that modifies in-place and just returns whatever it's passed"
136
143
  def _call(self, fn, *args, split_idx=None, **kwargs):
137
144
  super()._call(fn,*args, split_idx=split_idx, **kwargs)
138
145
  return args[0]
139
146
 
140
- # %% ../nbs/01_transform.ipynb 159
147
+ # %% ../nbs/01_transform.ipynb 160
141
148
  class DisplayedTransform(Transform):
142
149
  "A transform with a `__repr__` that shows its attrs"
143
150
 
144
151
  @property
145
152
  def name(self): return f"{super().name} -- {getattr(self,'__stored_args__',{})}\n"
146
153
 
147
- # %% ../nbs/01_transform.ipynb 165
154
+ # %% ../nbs/01_transform.ipynb 166
148
155
  class ItemTransform(Transform):
149
156
  "A transform that always take tuples as items"
150
157
  _retain = True
@@ -158,13 +165,13 @@ class ItemTransform(Transform):
158
165
  return retain_type(y, x, Any)
159
166
 
160
167
 
161
- # %% ../nbs/01_transform.ipynb 174
168
+ # %% ../nbs/01_transform.ipynb 175
162
169
  def get_func(t, name, *args, **kwargs):
163
170
  "Get the `t.name` (potentially partial-ized with `args` and `kwargs`) or `noop` if not defined"
164
171
  f = nested_callable(t, name)
165
172
  return f if not (args or kwargs) else partial(f, *args, **kwargs)
166
173
 
167
- # %% ../nbs/01_transform.ipynb 178
174
+ # %% ../nbs/01_transform.ipynb 179
168
175
  class Func():
169
176
  "Basic wrapper around a `name` with `args` and `kwargs` to call on a given type"
170
177
  def __init__(self, name, *args, **kwargs): self.name,self.args,self.kwargs = name,args,kwargs
@@ -172,7 +179,7 @@ class Func():
172
179
  def _get(self, t): return get_func(t, self.name, *self.args, **self.kwargs)
173
180
  def __call__(self,t): return mapped(self._get, t)
174
181
 
175
- # %% ../nbs/01_transform.ipynb 181
182
+ # %% ../nbs/01_transform.ipynb 182
176
183
  class _Sig():
177
184
  def __getattr__(self,k):
178
185
  def _inner(*args, **kwargs): return Func(k, *args, **kwargs)
@@ -181,7 +188,7 @@ class _Sig():
181
188
  Sig = _Sig()
182
189
 
183
190
 
184
- # %% ../nbs/01_transform.ipynb 187
191
+ # %% ../nbs/01_transform.ipynb 188
185
192
  def compose_tfms(x, tfms, is_enc=True, reverse=False, **kwargs):
186
193
  "Apply all `func_nm` attribute of `tfms` on `x`, maybe in `reverse` order"
187
194
  if reverse: tfms = reversed(tfms)
@@ -191,13 +198,13 @@ def compose_tfms(x, tfms, is_enc=True, reverse=False, **kwargs):
191
198
  return x
192
199
 
193
200
 
194
- # %% ../nbs/01_transform.ipynb 192
201
+ # %% ../nbs/01_transform.ipynb 193
195
202
  def mk_transform(f):
196
203
  "Convert function `f` to `Transform` if it isn't already one"
197
204
  f = instantiate(f)
198
205
  return f if isinstance(f,(Transform,Pipeline)) else Transform(f)
199
206
 
200
- # %% ../nbs/01_transform.ipynb 193
207
+ # %% ../nbs/01_transform.ipynb 194
201
208
  def gather_attrs(o, k, nm):
202
209
  "Used in __getattr__ to collect all attrs `k` from `self.{nm}`"
203
210
  if k.startswith('_') or k==nm: raise AttributeError(k)
@@ -206,12 +213,12 @@ def gather_attrs(o, k, nm):
206
213
  if not res: raise AttributeError(k)
207
214
  return res[0] if len(res)==1 else L(res)
208
215
 
209
- # %% ../nbs/01_transform.ipynb 194
216
+ # %% ../nbs/01_transform.ipynb 195
210
217
  def gather_attr_names(o, nm):
211
218
  "Used in __dir__ to collect all attrs `k` from `self.{nm}`"
212
219
  return L(getattr(o,nm)).map(dir).concat().unique()
213
220
 
214
- # %% ../nbs/01_transform.ipynb 195
221
+ # %% ../nbs/01_transform.ipynb 196
215
222
  class Pipeline:
216
223
  "A pipeline of composed (for encode/decode) transforms, setup with types"
217
224
  def __init__(self, funcs=None, split_idx=None):
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.4
2
2
  Name: fasttransform
3
- Version: 0.0.1
3
+ Version: 0.0.2
4
4
  Summary: Transform is the main building block of data pipelines in fastai. And elsewhere if you want.
5
5
  Home-page: https://github.com/AnswerDotAI/fasttransform
6
6
  Author: Jeremy Howard and Rens Dimmendaal and Alexis Gallagher
@@ -24,6 +24,19 @@ Provides-Extra: dev
24
24
  Requires-Dist: matplotlib; extra == "dev"
25
25
  Requires-Dist: numpy; extra == "dev"
26
26
  Requires-Dist: pandas; extra == "dev"
27
+ Dynamic: author
28
+ Dynamic: author-email
29
+ Dynamic: classifier
30
+ Dynamic: description
31
+ Dynamic: description-content-type
32
+ Dynamic: home-page
33
+ Dynamic: keywords
34
+ Dynamic: license
35
+ Dynamic: license-file
36
+ Dynamic: provides-extra
37
+ Dynamic: requires-dist
38
+ Dynamic: requires-python
39
+ Dynamic: summary
27
40
 
28
41
  # Welcome to fasttransform
29
42
 
@@ -0,0 +1,11 @@
1
+ [build-system]
2
+ requires = ["setuptools>=64.0"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name="fasttransform"
7
+ requires-python=">=3.9"
8
+ dynamic = [ "keywords", "description", "version", "dependencies", "optional-dependencies", "readme", "license", "authors", "classifiers", "entry-points", "scripts", "urls"]
9
+
10
+ [tool.uv]
11
+ cache-keys = [{ file = "pyproject.toml" }, { file = "settings.ini" }, { file = "setup.py" }]
@@ -1,32 +1,22 @@
1
1
  [DEFAULT]
2
- # All sections below are required unless otherwise specified.
3
- # See https://github.com/AnswerDotAI/nbdev/blob/main/settings.ini for examples.
4
-
5
- ### Python library ###
6
2
  repo = fasttransform
7
- lib_name = %(repo)s
8
- version = 0.0.1
3
+ lib_name = fasttransform
4
+ version = 0.0.2
9
5
  min_python = 3.9
10
6
  license = apache2
11
7
  black_formatting = False
12
-
13
- ### nbdev ###
14
8
  doc_path = _docs
15
9
  lib_path = fasttransform
16
10
  nbs_path = nbs
17
11
  recursive = True
18
12
  tst_flags = notest
19
13
  put_version_in_init = True
20
-
21
- ### Docs ###
22
14
  branch = main
23
15
  custom_sidebar = False
24
16
  doc_host = https://AnswerDotAI.github.io
25
17
  doc_baseurl = /fasttransform
26
18
  git_url = https://github.com/AnswerDotAI/fasttransform
27
19
  title = fasttransform
28
-
29
- ### PyPI ###
30
20
  audience = Developers
31
21
  author = Jeremy Howard and Rens Dimmendaal and Alexis Gallagher
32
22
  author_email = info@fast.ai
@@ -36,11 +26,14 @@ keywords = nbdev jupyter notebook python
36
26
  language = English
37
27
  status = 3
38
28
  user = AnswerDotAI
39
-
40
- ### Optional ###
41
29
  requirements = fastcore plum-dispatch
42
30
  dev_requirements = matplotlib numpy pandas
43
31
  readme_nb = index.ipynb
44
32
  jupyter_hooks = False
45
33
  clean_ids = True
46
34
  clear_all = False
35
+ allowed_metadata_keys =
36
+ allowed_cell_metadata_keys =
37
+ cell_number = True
38
+ skip_procs =
39
+
@@ -1,3 +0,0 @@
1
- [build-system]
2
- requires = ["setuptools>=64.0"]
3
- build-backend = "setuptools.build_meta"
File without changes
File without changes
File without changes
File without changes
File without changes