Permalink
Browse files

Merge branch 'release/0.8.0'

  • Loading branch information...
2 parents 34724fa + dba75d6 commit 08ac0618d8d1590c395d4600174e186725a5eef1 @klen committed Jun 15, 2014
Showing with 28 additions and 17 deletions.
  1. +4 −1 Changelog
  2. +2 −1 Makefile
  3. +1 −1 README.rst
  4. +9 −8 inirama.py
  5. +0 −6 setup.cfg
  6. +3 −0 tests.py
  7. +3 −0 tests/test.ini
  8. +6 −0 tox.ini
View
5 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
View
3 Makefile
@@ -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
View
2 README.rst
@@ -10,7 +10,7 @@ Features:
- One single module;
- No requirements;
- Tiny interface;
- - Interpolation support;
+ - Supports variable interpolation;
.. _badges:
View
17 inirama.py
@@ -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
@@ -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')
@@ -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'.*'))
]
@@ -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]:
View
6 setup.cfg
@@ -3,9 +3,3 @@ universal = 1
[wheel]
universal = 1
-
-[pylama]
-ignore=D,C0111
-
-[pylama:tests.py]
-ignore=C0301,E501
View
3 tests.py
@@ -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)
View
3 tests/test.ini
@@ -18,5 +18,8 @@ continuation = one
three
safe_value = c:\\test\
number = 123
+key-with-hyphen = yes
+dot.name = yes
+WRONG_case = yes
[empty]
View
6 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

0 comments on commit 08ac061

Please sign in to comment.