Commit Graph

169 Commits

Author SHA1 Message Date
Uiri 19b0f573fe Fix #109: Parse error involving [], {} and '' 2017-06-23 22:53:58 -04:00
Uiri 7ec24e35db Fix #106: Correctly serialize timezone info 2017-06-18 16:11:58 -04:00
Uiri 00b638d6c6 Wrap lines to comply with flake8 2017-06-07 22:54:48 -04:00
Uiri b471378c7c Merge branch 'testing' into master 2017-06-07 22:48:26 -04:00
Uiri 5b801b45d4 Clean up TESTING.md and rename to CONTRIBUTING 2017-06-07 22:47:21 -04:00
Uiri a735f2869c Don't run flake8 for py2.6 which is unsupported. 2017-05-26 22:26:32 -04:00
Uiri ca9f42aaac Update Travis with flake8 check 2017-05-26 22:26:32 -04:00
Uiri b955a3c3f5 PEP8 and Flake8 style compliance
Change all of the explicit backslash line continuations into
implicit line continuations. This isn't strictly required by flake8

Clean up all the issues with overly long lines introduced since my
last cleanup.

Fix some whitespace issues.

Ignore py2-specific code causing an issue for the py3 lint in
tests/decoding_test.py
2017-05-26 22:26:32 -04:00
Uiri 70a25d6970 Update Flake8 Preferences
Enable all the errors - the code isn't too bad stylistically.

Remove maximum complexity threshold. The code base is rather complex
(for now).

Set maximum line length to 80. This is slightly more generous than the
default value of 79 but less generous than the previously suggested
120.

Allow certain lines to be ignored - this is necessary for lines which
will trip up the checks in python2 but not python3 or vice versa due
to differences between the python versions.
2017-05-26 22:26:32 -04:00
x10an14 16e4b1d102 Feature: Enforce PEP8 standard specified in .flake8 for toml.py
With the exception that the `loads()` function triggers:
```toml.py:107:1: C901 'loads' is too complex (87)
def loads(s, _dict=dict):
```

This commit is based off PR #99.
2017-05-26 22:26:32 -04:00
x10an14 b3abd4c356 Feature: Let load() handle non-existing files in list. (#99)
* Feature: Let load() handle non-existing files in list.

* Feature/Enhancement: Return FileNotFoundError if no valid files are given (in list) to toml.load().

Ignore any files in list which do not exist on system.

* Enhancement: Add Python 2 support for new feature's Exception raise.

As [discussed here](https://github.com/uiri/toml/pull/99#issuecomment-302256123).
2017-05-26 20:46:43 -04:00
x10an14 c2857b6f40 Enhancement/Bugfix: Specify which files require Python 3. 2017-05-17 15:08:49 +02:00
x10an14 e15fb80060 Feature: Updated TESTING instructions.
Future TODO: Make .py test-files executable without polluting machine environment.
(AKA: Through a virtualenv permit `import toml` without raising `ImportError`).
2017-05-17 13:42:18 +02:00
Marcus Ottosson d31bcc796e #97: Add __version__ and __spec__
* Enable support for toml.__version__

* Add __spec__

Include reference to which version of the specification this library currently implements.
https://github.com/toml-lang/toml/blob/v0.4.0/README.md
2017-05-12 00:09:14 -04:00
Uiri 1921458b46 Fix #98 - Parse empty inline tables 2017-05-08 20:44:52 -04:00
Uiri 3521cccf3f Fix #94 - Raise TomlDecodeError on empty value 2017-04-29 14:20:28 -04:00
Uiri 2483797c88 Fix #76 Broken Multiline String Arrays
Also ensure ' is just as valid as " for identifying string arrays.
2017-04-21 21:37:24 -04:00
Uiri 85476a2fe4 Fix #62 - Load bearing whitespace 2017-04-21 21:18:01 -04:00
Uiri 59640f923b Avoid emitting lines for unnecessary parent tables 2017-04-13 12:34:08 -04:00
Uiri 49c0d39b07 Fix #60 - Correctly emit empty tables 2017-04-12 19:44:21 -04:00
Uiri 55291c907b Fix #80 - A different multiline whitespace bug 2017-04-12 19:35:04 -04:00
Uiri 65b80867d6 Fix #68 - Multiline string whitespace preservation 2017-04-12 19:21:27 -04:00
Florian Baumann d7c3e49530 Do not strip() line if its part of multiline str
Fixes #71
2017-04-12 18:53:53 -04:00
Uiri dab00e9880 Turn off Travis Email notifications 2017-04-12 14:15:33 -04:00
Uiri 83b4f8a348 Fix #63: Strip leading 0 in exponent part 2017-04-12 13:18:15 -04:00
Jack Evans 9083bfae75 Fixed lamdbda dictionary lookup issues 2017-04-11 19:19:46 -04:00
Jack Evans 7d1294b83c Replace range(len(iterable)) with enumerate
Used enumerate to cache the value of sl[i] as item at each iteration.
Hopefully avoids repeated duplicate array lookups.

Was only safe to replace sl[i] with item in locations were prior
mutation is guaranteed not to happen during each iteration
2017-04-11 19:19:46 -04:00
Jack Evans 739fe9a542 Replace _dump if checks with single lookup
Replaced potentially multiple if statement checks with single dictinoary
lookup using type(v) as a parameter. If the type isn't found in the
dictionary it returns the value of v by default

Moved string dump and list dump logic out into seperate helper
functions.
2017-04-11 19:19:46 -04:00
Uiri e176ae93d6 Preserve inline tables with a dynamic subclass of _dict 2017-04-11 15:09:21 -04:00
Ryan Hiebert f96537db73 Do not override dict __init__ 2017-04-11 00:33:11 -04:00
Uiri 0762d642d9 Add ALL supported python versions to .travis.yml
Unfortunately, pypy3 defaults to ASCII for sys.stdin :/
2017-04-08 22:23:00 -04:00
zed 50a0206518 always read toml file using utf-8 2017-04-08 22:12:08 -04:00
Uiri 58079b1f05 Update README with badges and test info 2017-03-30 02:42:57 -04:00
Ryan Hiebert 309faab06d Fix negative partial-hour offsets
The sign of the offset needs to be applied after the timedelta
is constructed, or else in the case of negative offsets the minutes
will be counted in the opposite direction as the hours.
2017-03-30 02:35:42 -04:00
zed 25e40fd9c3 fixes uiri/toml#81 2017-03-29 23:13:21 -04:00
Nate Prewitt 87993ce14d moving to dict object 2017-03-29 22:52:41 -04:00
Nate Prewitt 8f61c527fd reusing _dump_value 2017-03-29 22:52:41 -04:00
Nate Prewitt d9bd9b34bc add preserve flag to dumps to preserve inline table syntax 2017-03-29 22:52:41 -04:00
Uiri b13f1a5dad Use my toml-test fork which contains 104 tests 2017-03-29 22:44:17 -04:00
Uiri f3ea620146 Add shell scripts for local testing. 2017-03-29 22:41:07 -04:00
Samuel Vasko fc0f755254 Small docs fixes 2017-03-05 22:04:51 +00:00
Samuel Vasko 62df72c1df Added API reference to Readme 2017-03-05 22:02:52 +00:00
Samuel Vasko 3ca649b387 Updated _dict description 2017-03-05 21:10:35 +00:00
Samuel Vasko b5875bf733 Updated travis build 2017-03-03 22:24:36 +00:00
Samuel Vasko ff9e16c6a7 Moved tests to separate folder 2017-03-03 21:28:50 +00:00
Samuel Vasko bd3f842af2 Added comments to public API 2017-03-01 22:16:42 +00:00
Samuel Vasko 05224ed33f Added minus sign to allow negative numbers in inline dicts 2017-01-02 15:41:41 +00:00
Uiri ef729b0658 Fix #67 - TomlDecodeError doesn't get raised 2016-12-21 16:06:47 -05:00
Uiri 93236c2fb9 Fix #65: Emit blank lines between tables 2016-11-23 12:46:35 -05:00
Thomas Kluyver c45b5ff79e Fix #64 detection of array of objects (inline tables)
A string can contain '{', so "{ in s" is not a good enough test of
whether something is an inline table.
2016-11-23 12:26:46 -05:00