singer-python 6.2.0__tar.gz → 6.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.
Files changed (37) hide show
  1. {singer_python-6.2.0/singer_python.egg-info → singer-python-6.2.1}/PKG-INFO +2 -9
  2. {singer_python-6.2.0 → singer-python-6.2.1}/setup.py +1 -1
  3. {singer_python-6.2.0 → singer-python-6.2.1}/singer/schema_generation.py +22 -8
  4. {singer_python-6.2.0 → singer-python-6.2.1}/singer/transform.py +2 -2
  5. {singer_python-6.2.0 → singer-python-6.2.1/singer_python.egg-info}/PKG-INFO +2 -9
  6. {singer_python-6.2.0 → singer-python-6.2.1}/tests/test_transform.py +2 -2
  7. {singer_python-6.2.0 → singer-python-6.2.1}/LICENSE +0 -0
  8. {singer_python-6.2.0 → singer-python-6.2.1}/README.md +0 -0
  9. {singer_python-6.2.0 → singer-python-6.2.1}/setup.cfg +0 -0
  10. {singer_python-6.2.0 → singer-python-6.2.1}/singer/__init__.py +0 -0
  11. {singer_python-6.2.0 → singer-python-6.2.1}/singer/bookmarks.py +0 -0
  12. {singer_python-6.2.0 → singer-python-6.2.1}/singer/catalog.py +0 -0
  13. {singer_python-6.2.0 → singer-python-6.2.1}/singer/exceptions.py +0 -0
  14. {singer_python-6.2.0 → singer-python-6.2.1}/singer/logger.py +0 -0
  15. {singer_python-6.2.0 → singer-python-6.2.1}/singer/logging.conf +0 -0
  16. {singer_python-6.2.0 → singer-python-6.2.1}/singer/messages.py +0 -0
  17. {singer_python-6.2.0 → singer-python-6.2.1}/singer/metadata.py +0 -0
  18. {singer_python-6.2.0 → singer-python-6.2.1}/singer/metrics.py +0 -0
  19. {singer_python-6.2.0 → singer-python-6.2.1}/singer/requests.py +0 -0
  20. {singer_python-6.2.0 → singer-python-6.2.1}/singer/schema.py +0 -0
  21. {singer_python-6.2.0 → singer-python-6.2.1}/singer/statediff.py +0 -0
  22. {singer_python-6.2.0 → singer-python-6.2.1}/singer/utils.py +0 -0
  23. {singer_python-6.2.0 → singer-python-6.2.1}/singer_python.egg-info/SOURCES.txt +0 -0
  24. {singer_python-6.2.0 → singer-python-6.2.1}/singer_python.egg-info/dependency_links.txt +0 -0
  25. {singer_python-6.2.0 → singer-python-6.2.1}/singer_python.egg-info/requires.txt +0 -0
  26. {singer_python-6.2.0 → singer-python-6.2.1}/singer_python.egg-info/top_level.txt +0 -0
  27. {singer_python-6.2.0 → singer-python-6.2.1}/tests/__init__.py +0 -0
  28. {singer_python-6.2.0 → singer-python-6.2.1}/tests/test_bookmarks.py +0 -0
  29. {singer_python-6.2.0 → singer-python-6.2.1}/tests/test_catalog.py +0 -0
  30. {singer_python-6.2.0 → singer-python-6.2.1}/tests/test_exceptions.py +0 -0
  31. {singer_python-6.2.0 → singer-python-6.2.1}/tests/test_metadata.py +0 -0
  32. {singer_python-6.2.0 → singer-python-6.2.1}/tests/test_metrics.py +0 -0
  33. {singer_python-6.2.0 → singer-python-6.2.1}/tests/test_schema.py +0 -0
  34. {singer_python-6.2.0 → singer-python-6.2.1}/tests/test_schema_generation.py +0 -0
  35. {singer_python-6.2.0 → singer-python-6.2.1}/tests/test_singer.py +0 -0
  36. {singer_python-6.2.0 → singer-python-6.2.1}/tests/test_statediff.py +0 -0
  37. {singer_python-6.2.0 → singer-python-6.2.1}/tests/test_utils.py +0 -0
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.4
1
+ Metadata-Version: 2.1
2
2
  Name: singer-python
3
- Version: 6.2.0
3
+ Version: 6.2.1
4
4
  Summary: Singer.io utility library
5
5
  Home-page: http://singer.io
6
6
  Author: Stitch
@@ -18,10 +18,3 @@ Requires-Dist: ipython; extra == "dev"
18
18
  Requires-Dist: ipdb; extra == "dev"
19
19
  Requires-Dist: nose; extra == "dev"
20
20
  Requires-Dist: singer-tools; extra == "dev"
21
- Dynamic: author
22
- Dynamic: classifier
23
- Dynamic: home-page
24
- Dynamic: license-file
25
- Dynamic: provides-extra
26
- Dynamic: requires-dist
27
- Dynamic: summary
@@ -4,7 +4,7 @@ from setuptools import setup, find_packages
4
4
  import subprocess
5
5
 
6
6
  setup(name="singer-python",
7
- version='6.2.0',
7
+ version='6.2.1',
8
8
  description="Singer.io utility library",
9
9
  author="Stitch",
10
10
  classifiers=['Programming Language :: Python :: 3 :: Only'],
@@ -18,19 +18,33 @@ def add_observations(acc, path, data):
18
18
  for key in data:
19
19
  add_observations(acc, path + ["object", key], data[key])
20
20
  elif isinstance(data, list):
21
+ if len(data) == 0:
22
+ add_observations(acc, path + ["array"], None)
21
23
  for item in data:
22
24
  add_observations(acc, path + ["array"], item)
23
25
  elif isinstance(data, str):
24
- # If the string parses as a date, add an observation that its a date
25
26
  try:
26
- data = dateutil.parser.parse(data)
27
- except (dateutil.parser.ParserError, OverflowError):
28
- data = None
29
- if data:
27
+ # If the string parses as a int, add an observation that it's a integer
28
+ int(data)
29
+ add_observation(acc, path + ["integer"])
30
+ return acc
31
+ except (ValueError, TypeError):
32
+ pass
33
+ try:
34
+ # If the string parses as a float, add an observation that it's a number
35
+ float(data)
36
+ add_observation(acc, path + ["number"])
37
+ return acc
38
+ except (ValueError, TypeError):
39
+ pass
40
+ try:
41
+ # If the string parses as a date, add an observation that it's a date
42
+ dateutil.parser.parse(data)
30
43
  add_observation(acc, path + ["date"])
31
- else:
32
- add_observation(acc, path + ["string"])
33
-
44
+ return acc
45
+ except (dateutil.parser.ParserError, OverflowError):
46
+ pass
47
+ add_observation(acc, path + ["string"])
34
48
  elif isinstance(data, bool):
35
49
  add_observation(acc, path + ["boolean"])
36
50
  elif isinstance(data, int):
@@ -266,13 +266,13 @@ class Transformer:
266
266
  else:
267
267
  return False, None
268
268
 
269
- elif schema.get("format") == "date-time":
269
+ elif typ == "string" and schema.get("format") == "date-time":
270
270
  data = self._transform_datetime(data)
271
271
  if data is None:
272
272
  return False, None
273
273
 
274
274
  return True, data
275
- elif schema.get("format") == "singer.decimal":
275
+ elif typ == "string" and schema.get("format") == "singer.decimal":
276
276
  if data is None:
277
277
  return False, None
278
278
 
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.4
1
+ Metadata-Version: 2.1
2
2
  Name: singer-python
3
- Version: 6.2.0
3
+ Version: 6.2.1
4
4
  Summary: Singer.io utility library
5
5
  Home-page: http://singer.io
6
6
  Author: Stitch
@@ -18,10 +18,3 @@ Requires-Dist: ipython; extra == "dev"
18
18
  Requires-Dist: ipdb; extra == "dev"
19
19
  Requires-Dist: nose; extra == "dev"
20
20
  Requires-Dist: singer-tools; extra == "dev"
21
- Dynamic: author
22
- Dynamic: classifier
23
- Dynamic: home-page
24
- Dynamic: license-file
25
- Dynamic: provides-extra
26
- Dynamic: requires-dist
27
- Dynamic: summary
@@ -25,7 +25,7 @@ class TestTransform(unittest.TestCase):
25
25
 
26
26
  def test_multi_type_object_transform(self):
27
27
  schema = {"type": ["null", "object", "string"],
28
- "properties": {"whatever": {"type": "date-time",
28
+ "properties": {"whatever": {"type": "string",
29
29
  "format": "date-time"}}}
30
30
  data = {"whatever": "2017-01-01"}
31
31
  expected = {"whatever": "2017-01-01T00:00:00.000000Z"}
@@ -36,7 +36,7 @@ class TestTransform(unittest.TestCase):
36
36
 
37
37
  def test_multi_type_array_transform(self):
38
38
  schema = {"type": ["null", "array", "integer"],
39
- "items": {"type": "date-time", "format": "date-time"}}
39
+ "items": {"type": "string", "format": "date-time"}}
40
40
  data = ["2017-01-01"]
41
41
  expected = ["2017-01-01T00:00:00.000000Z"]
42
42
  self.assertEqual(expected, transform(data, schema))
File without changes
File without changes
File without changes