commit 7737c504e1c8eaa8d3d01cf6fefd350160c5ed2dfe915e5d4ef1754102baa6e3 Author: Tomáš Chvátal Date: Tue Jan 28 08:10:08 2020 +0000 Accepting request 767696 from home:mnhauke:branches:home:ojkastl_buildservice:Redfish_openSUSE Initial package for python-formats OBS-URL: https://build.opensuse.org/request/show/767696 OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-formats?expand=0&rev=1 diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..9b03811 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,23 @@ +## Default LFS +*.7z filter=lfs diff=lfs merge=lfs -text +*.bsp filter=lfs diff=lfs merge=lfs -text +*.bz2 filter=lfs diff=lfs merge=lfs -text +*.gem filter=lfs diff=lfs merge=lfs -text +*.gz filter=lfs diff=lfs merge=lfs -text +*.jar filter=lfs diff=lfs merge=lfs -text +*.lz filter=lfs diff=lfs merge=lfs -text +*.lzma filter=lfs diff=lfs merge=lfs -text +*.obscpio filter=lfs diff=lfs merge=lfs -text +*.oxt filter=lfs diff=lfs merge=lfs -text +*.pdf filter=lfs diff=lfs merge=lfs -text +*.png filter=lfs diff=lfs merge=lfs -text +*.rpm filter=lfs diff=lfs merge=lfs -text +*.tbz filter=lfs diff=lfs merge=lfs -text +*.tbz2 filter=lfs diff=lfs merge=lfs -text +*.tgz filter=lfs diff=lfs merge=lfs -text +*.ttf filter=lfs diff=lfs merge=lfs -text +*.txz filter=lfs diff=lfs merge=lfs -text +*.whl filter=lfs diff=lfs merge=lfs -text +*.xz filter=lfs diff=lfs merge=lfs -text +*.zip filter=lfs diff=lfs merge=lfs -text +*.zst filter=lfs diff=lfs merge=lfs -text diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..57affb6 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.osc diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..c775758 --- /dev/null +++ b/LICENSE @@ -0,0 +1,1048 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + formats/LICENSE at master · redodo/formats · GitHub + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Skip to content + + + + + + + + + + + +
+ +
+ + +
+ +
+ + + +
+
+
+ + + + + + + + + + + + + +
+ +
+ +
+

+ + + / + + formats + + +

+ + +
+ + + +
+ + + + + + +
+
+
+ + + + + + + + + Permalink + + + + + +
+ + +
+ + Branch: + master + + + + +
+ + + +
+
+
+ +
+ + Find file + + + Copy path + +
+
+ + +
+ + Find file + + + Copy path + +
+
+ + + +
+
+
+ +

+ redodo/formats is licensed under the +

+

MIT License

+

A short and simple permissive license with conditions only requiring preservation of copyright and license notices. Licensed works, modifications, and larger works may be distributed under different terms and without source code.

+
+ +
+
+

Permissions

+
    +
  • + + + Commercial use + +
  • +
  • + + + Modification + +
  • +
  • + + + Distribution + +
  • +
  • + + + Private use + +
  • +
+
+
+

Limitations

+
    +
  • + + + Liability + +
  • +
  • + + + Warranty + +
  • +
+
+
+

Conditions

+
    +
  • + + + License and copyright notice + +
  • +
+
+
+
+

+ This is not legal advice. + Learn more about repository licenses. +

+
+ + + + +
+ Fetching contributors… +
+ +
+ + Cannot retrieve contributors at this time +
+
+ + + + +
+ +
+
+ + 22 lines (17 sloc) + + 1.06 KB +
+ +
+ +
+ Raw + Blame + History +
+ + +
+ + + +
+
+
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
The MIT License (MIT)
+
Copyright (c) 2014 Hidde Bultsma
+
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
+
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
+
+ + + +
+ +
+ + + +
+ + +
+ + +
+
+ + + +
+
+ +
+
+ + +
+ + + + + + +
+ + + You can’t perform that action at this time. +
+ + + + + + + + + + + + + + + + + +
+ + + + diff --git a/formats-0.1.1.tar.gz b/formats-0.1.1.tar.gz new file mode 100644 index 0000000..fd60ac4 --- /dev/null +++ b/formats-0.1.1.tar.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:feb7e3d268d7a4182872f739f7a1af833032c624ddd3121741c47ac37b94385d +size 3686 diff --git a/python-formats.changes b/python-formats.changes new file mode 100644 index 0000000..07a20a7 --- /dev/null +++ b/python-formats.changes @@ -0,0 +1,17 @@ +------------------------------------------------------------------- +Sat Jan 25 22:29:10 UTC 2020 - Martin Hauke + +- Package license file +- Run testsuite +- Remove not unneeded dependencies + +------------------------------------------------------------------- +Wed Oct 18 18:49:17 UTC 2017 - opensuse_buildservice@ojkastl.de + +- adjusted spec to comply with singlespec convention + +------------------------------------------------------------------- +Tue Sep 6 11:27:37 UTC 2016 - mardnh@gmx.de + +- initial package, version 0.1.1 + diff --git a/python-formats.spec b/python-formats.spec new file mode 100644 index 0000000..52f3b37 --- /dev/null +++ b/python-formats.spec @@ -0,0 +1,58 @@ +# +# spec file for package python-formats +# +# Copyright (c) 2016-2020, Martin Hauke +# +# All modifications and additions to the file contributed by third parties +# remain the property of their copyright owners, unless otherwise agreed +# upon. The license for this file, and modifications and additions to the +# file, is the same license as for the pristine package itself (unless the +# license for the pristine package is not an Open Source License, in which +# case the license is the MIT License). An "Open Source License" is a +# license that conforms to the Open Source Definition (Version 1.9) +# published by the Open Source Initiative. + +# Please submit bugfixes or comments via http://bugs.opensuse.org/ +# + +%{?!python_module:%define python_module() python-%{**} python3-%{**}} +Name: python-formats +Version: 0.1.1 +Release: 0 +Summary: Support multiple formats with ease +License: MIT +Group: Development/Languages/Python +URL: https://github.com/redodo/formats +Source: https://files.pythonhosted.org/packages/source/f/formats/formats-%{version}.tar.gz +Source1: https://github.com/redodo/formats/blob/master/LICENSE +Source2: https://raw.githubusercontent.com/redodo/formats/master/test_formats.py +BuildRequires: %{python_module setuptools} +BuildRequires: fdupes +BuildRequires: python-rpm-macros +BuildArch: noarch +%python_subpackages + +%description +Formats will provide you with a consistent API to parse and compose data. + +%prep +%setup -q -n formats-%{version} +cp %{SOURCE1} . +cp %{SOURCE2} . + +%build +%python_build + +%install +%python_install +%python_expand %fdupes %{buildroot}%{$python_sitelib} + +%check +%python_expand %python_exec -m unittest discover -v + +%files %{python_files} +%license LICENSE +%doc README.rst +%{python_sitelib}/formats* + +%changelog diff --git a/test_formats.py b/test_formats.py new file mode 100644 index 0000000..7fc3324 --- /dev/null +++ b/test_formats.py @@ -0,0 +1,30 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- + +import unittest + +from formats import FormatBank + + +class TestFormats(unittest.TestCase): + + def test_discovery(self): + formats = FormatBank() + formats.discover() + + def test_registering(self): + formats = FormatBank() + formats.discover_json() + def composer(text): + return '1:%s' % text + def parser(text): + return text[2:] + formats.register('test', parser, composer) + assert formats.parse('test', '1:hello') == 'hello' + assert formats.compose('test', 'hello') == '1:hello' + assert formats.convert('test', 'json', '1:hello') == '"hello"' + assert formats.convert('test', 'test', '1:hello') == '1:hello' + + +if __name__ == '__main__': + unittest.main()