GithubHelp home page GithubHelp logo

profig's People

Contributors

dhagrow avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

profig's Issues

byte-string keys are not accepted as strings

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'])
>>> 

Tests fail on windows 10 64 bit Python35

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)

Test failure test_get_source on Arch Linux

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>

dummy issue

filler issue created by bitbucket_issue_migration

Initializing a key when a value has already been set can sometimes raise an exception

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'

[off-topic] - can we please have sage on pypi?

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

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.