dhagrow / profig Goto Github PK
View Code? Open in Web Editor NEWA straightforward configuration library for Python.
License: MIT License
A straightforward configuration library for Python.
License: MIT License
Original report by Anonymous.
In Python 2 it is common to use byte-strings as keys, so this should be supported.
As seen below, the byte-string key is split into sections and is considered a different key than the unicode-string.
#!python
>>> c = profig.Config()
>>> c['test'] = 2
>>> c
4: Config(sources=[], keys=[u't.e.s.t'])
>>> c[u'test'] = 2
>>> c
5: Config(sources=[], keys=[u't.e.s.t', u'test'])
>>>
Original report by Miguel Turner (Bitbucket: dhagrow, GitHub: dhagrow).
Round-tripping should preserve comments and white-space where it makes sense. Both the INI and Profig formats should support this.
Original report by xoviat (Bitbucket: xoviat, GitHub: xoviat).
#!python
Unable to test TOML cases
Unable to test YAML cases
Unable to test MessagePack cases
...E................................EEE...E.EEE.E.....
======================================================================
ERROR: test_formats (__main__.TestBasic)
----------------------------------------------------------------------
Traceback (most recent call last):
File "tests.py", line 43, in test_formats
self.assertIsInstance(c.format, profig.INIFormat)
AttributeError: module 'profig' has no attribute 'INIFormat'
======================================================================
ERROR: test_basic (__main__.TestJSONFormat)
----------------------------------------------------------------------
Traceback (most recent call last):
File "C:\Program Files\Python35\lib\site-packages\profig.py", line 435, in _process_format
cls = Config._formats[format]
KeyError: 'json'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "tests.py", line 506, in setUp
self.c = profig.Config(format='json')
File "C:\Program Files\Python35\lib\site-packages\profig.py", line 527, in __init__
self.set_format(format)
File "C:\Program Files\Python35\lib\site-packages\profig.py", line 553, in set_format
self._format = self._process_format(format)
File "C:\Program Files\Python35\lib\site-packages\profig.py", line 437, in _process_format
raise UnknownFormatError(e)
profig.UnknownFormatError: 'json'
======================================================================
ERROR: test_unicode_read (__main__.TestJSONFormat)
----------------------------------------------------------------------
Traceback (most recent call last):
File "C:\Program Files\Python35\lib\site-packages\profig.py", line 435, in _process_format
cls = Config._formats[format]
KeyError: 'json'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "tests.py", line 506, in setUp
self.c = profig.Config(format='json')
File "C:\Program Files\Python35\lib\site-packages\profig.py", line 527, in __init__
self.set_format(format)
File "C:\Program Files\Python35\lib\site-packages\profig.py", line 553, in set_format
self._format = self._process_format(format)
File "C:\Program Files\Python35\lib\site-packages\profig.py", line 437, in _process_format
raise UnknownFormatError(e)
profig.UnknownFormatError: 'json'
======================================================================
ERROR: test_unicode_write (__main__.TestJSONFormat)
----------------------------------------------------------------------
Traceback (most recent call last):
File "C:\Program Files\Python35\lib\site-packages\profig.py", line 435, in _process_format
cls = Config._formats[format]
KeyError: 'json'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "tests.py", line 506, in setUp
self.c = profig.Config(format='json')
File "C:\Program Files\Python35\lib\site-packages\profig.py", line 527, in __init__
self.set_format(format)
File "C:\Program Files\Python35\lib\site-packages\profig.py", line 553, in set_format
self._format = self._process_format(format)
File "C:\Program Files\Python35\lib\site-packages\profig.py", line 437, in _process_format
raise UnknownFormatError(e)
profig.UnknownFormatError: 'json'
======================================================================
ERROR: test_binary_read (__main__.TestRegistryFormat)
----------------------------------------------------------------------
Traceback (most recent call last):
File "tests.py", line 832, in test_binary_read
c.read()
File "C:\Program Files\Python35\lib\site-packages\profig.py", line 162, in read
self._read(sources, format)
File "C:\Program Files\Python35\lib\site-packages\profig.py", line 386, in _read
lines = format.read(file)
File "C:\Program Files\Python35\lib\site-packages\profig.py", line 907, in read
subsection = section.section(key)
File "C:\Program Files\Python35\lib\site-packages\profig.py", line 288, in section
for name in self._make_key(key):
File "C:\Program Files\Python35\lib\site-packages\profig.py", line 471, in _make_key
raise TypeError(err.format(p))
TypeError: invalid value for key: '<PyHKEY:0x0000000000000144>'
======================================================================
ERROR: test_sync_blank (__main__.TestRegistryFormat)
----------------------------------------------------------------------
Traceback (most recent call last):
File "tests.py", line 817, in test_sync_blank
c.sync()
File "C:\Program Files\Python35\lib\site-packages\profig.py", line 147, in sync
lines = self._read(sources, format)
File "C:\Program Files\Python35\lib\site-packages\profig.py", line 386, in _read
lines = format.read(file)
File "C:\Program Files\Python35\lib\site-packages\profig.py", line 907, in read
subsection = section.section(key)
File "C:\Program Files\Python35\lib\site-packages\profig.py", line 288, in section
for name in self._make_key(key):
File "C:\Program Files\Python35\lib\site-packages\profig.py", line 471, in _make_key
raise TypeError(err.format(p))
TypeError: invalid value for key: '<PyHKEY:0x0000000000000140>'
======================================================================
ERROR: test_sync_read_blank (__main__.TestRegistryFormat)
----------------------------------------------------------------------
Traceback (most recent call last):
File "tests.py", line 799, in test_sync_read_blank
c.read()
File "C:\Program Files\Python35\lib\site-packages\profig.py", line 162, in read
self._read(sources, format)
File "C:\Program Files\Python35\lib\site-packages\profig.py", line 386, in _read
lines = format.read(file)
File "C:\Program Files\Python35\lib\site-packages\profig.py", line 907, in read
subsection = section.section(key)
File "C:\Program Files\Python35\lib\site-packages\profig.py", line 288, in section
for name in self._make_key(key):
File "C:\Program Files\Python35\lib\site-packages\profig.py", line 471, in _make_key
raise TypeError(err.format(p))
TypeError: invalid value for key: '<PyHKEY:0x0000000000000144>'
======================================================================
ERROR: test_unicode_read (__main__.TestRegistryFormat)
----------------------------------------------------------------------
Traceback (most recent call last):
File "tests.py", line 851, in test_unicode_read
c.read()
File "C:\Program Files\Python35\lib\site-packages\profig.py", line 162, in read
self._read(sources, format)
File "C:\Program Files\Python35\lib\site-packages\profig.py", line 386, in _read
lines = format.read(file)
File "C:\Program Files\Python35\lib\site-packages\profig.py", line 907, in read
subsection = section.section(key)
File "C:\Program Files\Python35\lib\site-packages\profig.py", line 288, in section
for name in self._make_key(key):
File "C:\Program Files\Python35\lib\site-packages\profig.py", line 471, in _make_key
raise TypeError(err.format(p))
TypeError: invalid value for key: '<PyHKEY:0x0000000000000144>'
======================================================================
ERROR: test_unsupported_type_read (__main__.TestRegistryFormat)
----------------------------------------------------------------------
Traceback (most recent call last):
File "tests.py", line 869, in test_unsupported_type_read
c.read()
File "C:\Program Files\Python35\lib\site-packages\profig.py", line 162, in read
self._read(sources, format)
File "C:\Program Files\Python35\lib\site-packages\profig.py", line 386, in _read
lines = format.read(file)
File "C:\Program Files\Python35\lib\site-packages\profig.py", line 907, in read
subsection = section.section(key)
File "C:\Program Files\Python35\lib\site-packages\profig.py", line 288, in section
for name in self._make_key(key):
File "C:\Program Files\Python35\lib\site-packages\profig.py", line 471, in _make_key
raise TypeError(err.format(p))
TypeError: invalid value for key: '<PyHKEY:0x0000000000000144>'
----------------------------------------------------------------------
Ran 54 tests in 0.044s
FAILED (errors=9)
Original report by Donald Webster (Bitbucket: [Donald Webster](https://bitbucket.org/Donald Webster), ).
Hi, I'm not super familiar w/ python or testing in python, but I'm trying to enable tests on an AUR package for profig and one of the tests that seems super simple is failing. What am I doing wrong? :)
======================================================================
FAIL: test_get_source (tests.TestMisc)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/fryfrog/aur/python-profig/src/profig-0.4.1/tests.py", line 635, in test_get_source
self.assertEqual(profig.get_source('test'), os.path.join(path, 'test'))
AssertionError: 'test' != '/home/fryfrog/aur/python-profig/src/profig-0.4.1/test'
- test
+ /home/fryfrog/aur/python-profig/src/profig-0.4.1/test
----------------------------------------------------------------------
Ran 42 tests in 0.025s
FAILED (failures=1)
Test failed: <unittest.runner.TextTestResult run=42 errors=0 failures=1>
error: Test failed: <unittest.runner.TextTestResult run=42 errors=0 failures=1>
_winreg
does not support unicode on Python 2.7: https://stackoverflow.com/questions/33605172/python-27-winreg-not-fully-supports-read-write-unicode-string-to-registry
Original report by Miguel Turner (Bitbucket: dhagrow, GitHub: dhagrow).
This would make it possible to store configs for subsections in separate files.
filler issue created by bitbucket_issue_migration
Original report by Miguel Turner (Bitbucket: dhagrow, GitHub: dhagrow).
Add an option to formats to column align output.
Original report by Miguel Turner (Bitbucket: dhagrow, GitHub: dhagrow).
Checking for existing values will make it possible to sync before any calls to Config.init.
Original report by Miguel Turner (Bitbucket: dhagrow, GitHub: dhagrow).
Add support for setting comments for each key that will be output to config files.
Original report by Miguel Turner (Bitbucket: dhagrow, GitHub: dhagrow).
Original report by Miguel Turner (Bitbucket: dhagrow, GitHub: dhagrow).
Original report by Miguel Turner (Bitbucket: dhagrow, GitHub: dhagrow).
This happens when using coercer keys with names that do not match the names the names of a value's type.
#!python
>>> import profig
>>> c = profig.Config()
>>> c['val'] = ['a']
>>> c.init('val', [], 'path_list')
Traceback (most recent call last):
File "<pyshell#2>", line 4, in <module>
c.init('val', [], 'path_list')
...
ConvertError: 'list' object has no attribute 'split'
Original report by Miguel Turner (Bitbucket: dhagrow, GitHub: dhagrow).
Original report by Anonymous.
Automatic conversion of byte-strings to hex is unintuitive to python 2 users. If ascii encoding is possible, it should be used. The difficulty is in knowing when to decode ascii, or hex codes.
Dear Miguel,
Sage (aka SageMath, for purposes of not clashing with Sage the accounting software) is a Python-based computer algebra system, see also https://www.sagemath.org/ - active since 2006.
On https://trac.sagemath.org/ticket/28796 we noticed that in 2018 (apparently) you set up https://pypi.org/project/sage/ - which is
basically a placeholder, that only saw 1 release, and has no functionality.
As we are (finally...) moving towards putting more parts of SageMath on pypi, it would be quite convenient for us to get hold of https://pypi.org/project/sage/. Could we please have it?
cc: @embray @mkoeppe @williamstein @vbraun @saraedum @jhpalmieri
Original report by Miguel Turner (Bitbucket: dhagrow, GitHub: dhagrow).
Only types directly supported by the registry are currently supported. Other types should be serialized to byte-strings.
Original report by Miguel Turner (Bitbucket: dhagrow, GitHub: dhagrow).
This can be useful to cleanup old configs when changes are made.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.