dictature 0.13.1__tar.gz → 0.13.3__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 (27) hide show
  1. {dictature-0.13.1/src/dictature.egg-info → dictature-0.13.3}/PKG-INFO +1 -1
  2. {dictature-0.13.1 → dictature-0.13.3}/pyproject.toml +1 -1
  3. {dictature-0.13.1 → dictature-0.13.3}/src/dictature/backend/mysql.py +1 -1
  4. {dictature-0.13.1 → dictature-0.13.3}/src/dictature/backend/sqlite.py +1 -1
  5. {dictature-0.13.1 → dictature-0.13.3}/src/dictature/dictature.py +7 -4
  6. {dictature-0.13.1 → dictature-0.13.3/src/dictature.egg-info}/PKG-INFO +1 -1
  7. {dictature-0.13.1 → dictature-0.13.3}/LICENSE +0 -0
  8. {dictature-0.13.1 → dictature-0.13.3}/README.md +0 -0
  9. {dictature-0.13.1 → dictature-0.13.3}/setup.cfg +0 -0
  10. {dictature-0.13.1 → dictature-0.13.3}/src/dictature/__init__.py +0 -0
  11. {dictature-0.13.1 → dictature-0.13.3}/src/dictature/backend/__init__.py +0 -0
  12. {dictature-0.13.1 → dictature-0.13.3}/src/dictature/backend/directory.py +0 -0
  13. {dictature-0.13.1 → dictature-0.13.3}/src/dictature/backend/misp.py +0 -0
  14. {dictature-0.13.1 → dictature-0.13.3}/src/dictature/backend/mock.py +0 -0
  15. {dictature-0.13.1 → dictature-0.13.3}/src/dictature/backend/s3.py +0 -0
  16. {dictature-0.13.1 → dictature-0.13.3}/src/dictature/backend/webdav.py +0 -0
  17. {dictature-0.13.1 → dictature-0.13.3}/src/dictature/transformer/__init__.py +0 -0
  18. {dictature-0.13.1 → dictature-0.13.3}/src/dictature/transformer/aes.py +0 -0
  19. {dictature-0.13.1 → dictature-0.13.3}/src/dictature/transformer/gzip.py +0 -0
  20. {dictature-0.13.1 → dictature-0.13.3}/src/dictature/transformer/hmac.py +0 -0
  21. {dictature-0.13.1 → dictature-0.13.3}/src/dictature/transformer/mock.py +0 -0
  22. {dictature-0.13.1 → dictature-0.13.3}/src/dictature/transformer/passthrough.py +0 -0
  23. {dictature-0.13.1 → dictature-0.13.3}/src/dictature/transformer/pipeline.py +0 -0
  24. {dictature-0.13.1 → dictature-0.13.3}/src/dictature.egg-info/SOURCES.txt +0 -0
  25. {dictature-0.13.1 → dictature-0.13.3}/src/dictature.egg-info/dependency_links.txt +0 -0
  26. {dictature-0.13.1 → dictature-0.13.3}/src/dictature.egg-info/top_level.txt +0 -0
  27. {dictature-0.13.1 → dictature-0.13.3}/tests/test_operations.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: dictature
3
- Version: 0.13.1
3
+ Version: 0.13.3
4
4
  Summary: dictature -- A generic wrapper around dict-like interface with mulitple backends
5
5
  Author-email: Adam Hlavacek <git@adamhlavacek.com>
6
6
  Project-URL: Homepage, https://github.com/esoadamo/dictature
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "dictature"
7
- version = "0.13.1"
7
+ version = "0.13.3"
8
8
  description = "dictature -- A generic wrapper around dict-like interface with mulitple backends"
9
9
  authors = [
10
10
  { name = "Adam Hlavacek", email = "git@adamhlavacek.com" }
@@ -38,7 +38,7 @@ class DictatureBackendMySQL(DictatureBackendMock):
38
38
  def keys(self) -> Iterable[str]:
39
39
  # noinspection SqlResolve
40
40
  tables = self._execute(f"SELECT table_name FROM information_schema.tables WHERE table_schema = %s AND table_name LIKE '{self.__prefix}%'", (self.__connection_params['database'],))
41
- return {table[0][3:] for table in tables}
41
+ return {table[0][len(self.__prefix):] for table in tables}
42
42
 
43
43
  def table(self, name: str) -> 'DictatureTableMock':
44
44
  return DictatureTableMySQL(self, name, self.__prefix)
@@ -24,7 +24,7 @@ class DictatureBackendSQLite(DictatureBackendMock):
24
24
 
25
25
  def keys(self) -> Iterable[str]:
26
26
  tables = self._execute(f"SELECT tbl_name FROM sqlite_master WHERE type='table' AND tbl_name LIKE '{self.__prefix}%'")
27
- return {table[0][3:] for table in tables}
27
+ return {table[0][len(self.__prefix):] for table in tables}
28
28
 
29
29
  def table(self, name: str) -> 'DictatureTableMock':
30
30
  return DictatureTableSQLite(self, name, self.__prefix)
@@ -39,7 +39,7 @@ class Dictature:
39
39
  Return all table names
40
40
  :return: all table names
41
41
  """
42
- return set(map(self.__name_transformer.backward, self.__backend.keys()))
42
+ return set(map(self.__table_name_transformer.backward, self.__backend.keys()))
43
43
 
44
44
  def values(self) -> Iterator["DictatureTable"]:
45
45
  """
@@ -84,6 +84,7 @@ class Dictature:
84
84
  item,
85
85
  name_transformer=self.__name_transformer,
86
86
  value_transformer=self.__value_transformer,
87
+ table_name_transformer=self.__table_name_transformer,
87
88
  allow_pickle=self.__allow_pickle,
88
89
  )
89
90
  return self.__table_cache[item]
@@ -119,6 +120,7 @@ class DictatureTable:
119
120
  table_name: str,
120
121
  name_transformer: MockTransformer = PassthroughTransformer(),
121
122
  value_transformer: MockTransformer = PassthroughTransformer(),
123
+ table_name_transformer: Optional[MockTransformer] = None,
122
124
  allow_pickle: bool = True
123
125
  ):
124
126
  """
@@ -132,6 +134,7 @@ class DictatureTable:
132
134
  self.__backend = backend
133
135
  self.__name_transformer = name_transformer
134
136
  self.__value_transformer = value_transformer
137
+ self.__table_name_transformer = table_name_transformer or name_transformer
135
138
  self.__table = self.__backend.table(self.__table_key(table_name))
136
139
  self.__table_created = False
137
140
  self.__allow_pickle = allow_pickle
@@ -297,8 +300,8 @@ class DictatureTable:
297
300
  :param table_name: table name to transform
298
301
  :return: transformed table name
299
302
  """
300
- if not self.__name_transformer.static:
303
+ if not self.__table_name_transformer.static:
301
304
  for key in self.__backend.keys():
302
- if self.__name_transformer.backward(key) == table_name:
305
+ if self.__table_name_transformer.backward(key) == table_name:
303
306
  return key
304
- return self.__name_transformer.forward(table_name)
307
+ return self.__table_name_transformer.forward(table_name)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: dictature
3
- Version: 0.13.1
3
+ Version: 0.13.3
4
4
  Summary: dictature -- A generic wrapper around dict-like interface with mulitple backends
5
5
  Author-email: Adam Hlavacek <git@adamhlavacek.com>
6
6
  Project-URL: Homepage, https://github.com/esoadamo/dictature
File without changes
File without changes
File without changes