Skip to content

Commit

Permalink
Merge branch 'release/0.8.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
klen committed Jun 15, 2014
2 parents 34724fa + dba75d6 commit 08ac061
Show file tree
Hide file tree
Showing 8 changed files with 28 additions and 17 deletions.
5 changes: 4 additions & 1 deletion Changelog
@@ -1,7 +1,10 @@
2014-06-15 horneds

* Supports hyphens

2014-06-08 horneds

* Supports continuation values
* Version 0.7.0

2014-05-05 horneds

Expand Down
3 changes: 2 additions & 1 deletion Makefile
Expand Up @@ -28,7 +28,8 @@ register:
.PHONY: upload
# target: upload - Upload module on PyPi
upload:
@python setup.py sdist upload || echo 'Upload already'
@python setup.py sdist upload || echo 'Already uploaded'
@python setup.py bdist_wheel upload || echo 'Already uploaded'

.PHONY: t
# target: t - Runs tests
Expand Down
2 changes: 1 addition & 1 deletion README.rst
Expand Up @@ -10,7 +10,7 @@ Features:
- One single module;
- No requirements;
- Tiny interface;
- Interpolation support;
- Supports variable interpolation;

.. _badges:

Expand Down
17 changes: 9 additions & 8 deletions inirama.py
Expand Up @@ -16,6 +16,13 @@
"""
from __future__ import unicode_literals, print_function


__version__ = "0.8.0"
__project__ = "Inirama"
__author__ = "Kirill Klenov <horneds@gmail.com>"
__license__ = "BSD"


import io
import re
import logging
Expand Down Expand Up @@ -66,12 +73,6 @@ def keys(self):
iteritems = DictMixin.iteritems


__version__ = "0.7.0"
__project__ = "Inirama"
__author__ = "Kirill Klenov <horneds@gmail.com>"
__license__ = "BSD"


NS_LOGGER = logging.getLogger('inirama')


Expand Down Expand Up @@ -169,7 +170,7 @@ class INIScanner(Scanner):
('SECTION', re.compile(r'\[[^]]+\]')),
('IGNORE', re.compile(r'[ \r\t\n]+')),
('COMMENT', re.compile(r'[;#].*')),
('KEY', re.compile(r'[\w_]+\s*[:=].*')),
('KEY_VALUE', re.compile(r'[^=\s]+\s*[:=].*')),
('CONTINUATION', re.compile(r'.*'))
]

Expand Down Expand Up @@ -346,7 +347,7 @@ def parse(self, source, update=True, **params):
name = None

for token in scanner.tokens:
if token[0] == 'KEY':
if token[0] == 'KEY_VALUE':
name, value = re.split('[=:]', token[1], 1)
name, value = name.strip(), value.strip()
if not update and name in self[section]:
Expand Down
6 changes: 0 additions & 6 deletions setup.cfg
Expand Up @@ -3,9 +3,3 @@ universal = 1

[wheel]
universal = 1

[pylama]
ignore=D,C0111

[pylama:tests.py]
ignore=C0301,E501
3 changes: 3 additions & 0 deletions tests.py
Expand Up @@ -22,6 +22,9 @@ def test_parse(self):
self.assertEqual(parser['other']['safe_value'], 'c:\\\\test\\')
self.assertEqual(parser['other']['b'], '[test]')
self.assertEqual(parser['other']['number'], 123)
self.assertEqual(parser['other']['key-with-hyphen'], 'yes')
self.assertEqual(parser['other']['dot.name'], 'yes')
self.assertEqual(parser['other']['WRONG_case'], 'yes')

self.assertTrue('other' in parser)
self.assertFalse('another' in parser)
Expand Down
3 changes: 3 additions & 0 deletions tests/test.ini
Expand Up @@ -18,5 +18,8 @@ continuation = one
three
safe_value = c:\\test\
number = 123
key-with-hyphen = yes
dot.name = yes
WRONG_case = yes

[empty]
6 changes: 6 additions & 0 deletions tox.ini
@@ -1,6 +1,12 @@
[tox]
envlist = py26,py27,py33

[pylama]
ignore=D,C0111

[pylama:tests.py]
ignore=C0301,E501

[pytest]
addopts = tests.py

Expand Down

0 comments on commit 08ac061

Please sign in to comment.