加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
python-jmespath.spec 12.65 KB
一键复制 编辑 原始数据 按行查看 历史
%global _empty_manifest_terminate_build 0
Name: python-jmespath
Version: 0.9.0
Release: 1
Summary: JSON Matching Expressions
License: MIT License
URL: https://github.com/jmespath/jmespath.py
Source0: https://files.pythonhosted.org/packages/8f/d8/6e3e602a3e90c5e3961d3d159540df6b2ff32f5ab2ee8ee1d28235a425c1/jmespath-0.9.0.tar.gz
BuildArch: noarch
%description
JMESPath
========
.. image:: https://badges.gitter.im/Join Chat.svg
:target: https://gitter.im/jmespath/chat
.. image:: https://secure.travis-ci.org/jmespath/jmespath.py.png?branch=develop
:target: http://travis-ci.org/jmespath/jmespath.py
JMESPath (pronounced "james path") allows you to declaratively specify how to
extract elements from a JSON document.
For example, given this document::
{"foo": {"bar": "baz"}}
The jmespath expression ``foo.bar`` will return "baz".
JMESPath also supports:
Referencing elements in a list. Given the data::
{"foo": {"bar": ["one", "two"]}}
The expression: ``foo.bar[0]`` will return "one".
You can also reference all the items in a list using the ``*``
syntax::
{"foo": {"bar": [{"name": "one"}, {"name": "two"}]}}
The expression: ``foo.bar[*].name`` will return ["one", "two"].
Negative indexing is also supported (-1 refers to the last element
in the list). Given the data above, the expression
``foo.bar[-1].name`` will return "two".
The ``*`` can also be used for hash types::
{"foo": {"bar": {"name": "one"}, "baz": {"name": "two"}}}
The expression: ``foo.*.name`` will return ["one", "two"].
API
===
The ``jmespath.py`` library has two functions
that operate on python data structures. You can use ``search``
and give it the jmespath expression and the data::
>>> import jmespath
>>> path = jmespath.search('foo.bar', {'foo': {'bar': 'baz'}})
'baz'
Similar to the ``re`` module, you can use the ``compile`` function
to compile the JMESPath expression and use this parsed expression
to perform repeated searches::
>>> import jmespath
>>> expression = jmespath.compile('foo.bar')
>>> expression.search({'foo': {'bar': 'baz'}})
'baz'
>>> expression.search({'foo': {'bar': 'other'}})
'other'
This is useful if you're going to use the same jmespath expression to
search multiple documents. This avoids having to reparse the
JMESPath expression each time you search a new document.
Options
-------
You can provide an instance of ``jmespath.Options`` to control how
a JMESPath expression is evaluated. The most common scenario for
using an ``Options`` instance is if you want to have ordered output
of your dict keys. To do this you can use either of these options::
>>> import jmespath
>>> jmespath.search('{a: a, b: b},
... mydata,
... jmespath.Options(dict_cls=collections.OrderedDict))
>>> import jmespath
>>> parsed = jmespath.compile('{a: a, b: b}')
>>> parsed.search('{a: a, b: b},
... mydata,
... jmespath.Options(dict_cls=collections.OrderedDict))
Specification
=============
If you'd like to learn more about the JMESPath language, you can check out
the `JMESPath tutorial <http://jmespath.org/tutorial.html>`__. Also check
out the `JMESPath examples page <http://jmespath.org/examples.html>`__ for
examples of more complex jmespath queries.
The grammar is specified using ABNF, as described in
`RFC4234 <http://www.ietf.org/rfc/rfc4234.txt>`_.
You can find the most up to date
`grammar for JMESPath here <http://jmespath.org/specification.html#grammar>`__.
You can read the full
`JMESPath specification here <http://jmespath.org/specification.html>`__.
Testing
=======
In addition to the unit tests for the jmespath modules,
there is a ``tests/compliance`` directory that contains
.json files with test cases. This allows other implementations
to verify they are producing the correct output. Each json
file is grouped by feature.
Discuss
=======
Join us on our `Gitter channel <https://gitter.im/jmespath/chat>`__
if you want to chat or if you have any questions.
%package -n python2-jmespath
Summary: JSON Matching Expressions
Provides: python-jmespath
BuildRequires: python2-devel
BuildRequires: python2-setuptools
%description -n python2-jmespath
JMESPath
========
.. image:: https://badges.gitter.im/Join Chat.svg
:target: https://gitter.im/jmespath/chat
.. image:: https://secure.travis-ci.org/jmespath/jmespath.py.png?branch=develop
:target: http://travis-ci.org/jmespath/jmespath.py
JMESPath (pronounced "james path") allows you to declaratively specify how to
extract elements from a JSON document.
For example, given this document::
{"foo": {"bar": "baz"}}
The jmespath expression ``foo.bar`` will return "baz".
JMESPath also supports:
Referencing elements in a list. Given the data::
{"foo": {"bar": ["one", "two"]}}
The expression: ``foo.bar[0]`` will return "one".
You can also reference all the items in a list using the ``*``
syntax::
{"foo": {"bar": [{"name": "one"}, {"name": "two"}]}}
The expression: ``foo.bar[*].name`` will return ["one", "two"].
Negative indexing is also supported (-1 refers to the last element
in the list). Given the data above, the expression
``foo.bar[-1].name`` will return "two".
The ``*`` can also be used for hash types::
{"foo": {"bar": {"name": "one"}, "baz": {"name": "two"}}}
The expression: ``foo.*.name`` will return ["one", "two"].
API
===
The ``jmespath.py`` library has two functions
that operate on python data structures. You can use ``search``
and give it the jmespath expression and the data::
>>> import jmespath
>>> path = jmespath.search('foo.bar', {'foo': {'bar': 'baz'}})
'baz'
Similar to the ``re`` module, you can use the ``compile`` function
to compile the JMESPath expression and use this parsed expression
to perform repeated searches::
>>> import jmespath
>>> expression = jmespath.compile('foo.bar')
>>> expression.search({'foo': {'bar': 'baz'}})
'baz'
>>> expression.search({'foo': {'bar': 'other'}})
'other'
This is useful if you're going to use the same jmespath expression to
search multiple documents. This avoids having to reparse the
JMESPath expression each time you search a new document.
Options
-------
You can provide an instance of ``jmespath.Options`` to control how
a JMESPath expression is evaluated. The most common scenario for
using an ``Options`` instance is if you want to have ordered output
of your dict keys. To do this you can use either of these options::
>>> import jmespath
>>> jmespath.search('{a: a, b: b},
... mydata,
... jmespath.Options(dict_cls=collections.OrderedDict))
>>> import jmespath
>>> parsed = jmespath.compile('{a: a, b: b}')
>>> parsed.search('{a: a, b: b},
... mydata,
... jmespath.Options(dict_cls=collections.OrderedDict))
Specification
=============
If you'd like to learn more about the JMESPath language, you can check out
the `JMESPath tutorial <http://jmespath.org/tutorial.html>`__. Also check
out the `JMESPath examples page <http://jmespath.org/examples.html>`__ for
examples of more complex jmespath queries.
The grammar is specified using ABNF, as described in
`RFC4234 <http://www.ietf.org/rfc/rfc4234.txt>`_.
You can find the most up to date
`grammar for JMESPath here <http://jmespath.org/specification.html#grammar>`__.
You can read the full
`JMESPath specification here <http://jmespath.org/specification.html>`__.
Testing
=======
In addition to the unit tests for the jmespath modules,
there is a ``tests/compliance`` directory that contains
.json files with test cases. This allows other implementations
to verify they are producing the correct output. Each json
file is grouped by feature.
Discuss
=======
Join us on our `Gitter channel <https://gitter.im/jmespath/chat>`__
if you want to chat or if you have any questions.
%package help
Summary: Development documents and examples for jmespath
Provides: python2-jmespath-doc
%description help
JMESPath
========
.. image:: https://badges.gitter.im/Join Chat.svg
:target: https://gitter.im/jmespath/chat
.. image:: https://secure.travis-ci.org/jmespath/jmespath.py.png?branch=develop
:target: http://travis-ci.org/jmespath/jmespath.py
JMESPath (pronounced "james path") allows you to declaratively specify how to
extract elements from a JSON document.
For example, given this document::
{"foo": {"bar": "baz"}}
The jmespath expression ``foo.bar`` will return "baz".
JMESPath also supports:
Referencing elements in a list. Given the data::
{"foo": {"bar": ["one", "two"]}}
The expression: ``foo.bar[0]`` will return "one".
You can also reference all the items in a list using the ``*``
syntax::
{"foo": {"bar": [{"name": "one"}, {"name": "two"}]}}
The expression: ``foo.bar[*].name`` will return ["one", "two"].
Negative indexing is also supported (-1 refers to the last element
in the list). Given the data above, the expression
``foo.bar[-1].name`` will return "two".
The ``*`` can also be used for hash types::
{"foo": {"bar": {"name": "one"}, "baz": {"name": "two"}}}
The expression: ``foo.*.name`` will return ["one", "two"].
API
===
The ``jmespath.py`` library has two functions
that operate on python data structures. You can use ``search``
and give it the jmespath expression and the data::
>>> import jmespath
>>> path = jmespath.search('foo.bar', {'foo': {'bar': 'baz'}})
'baz'
Similar to the ``re`` module, you can use the ``compile`` function
to compile the JMESPath expression and use this parsed expression
to perform repeated searches::
>>> import jmespath
>>> expression = jmespath.compile('foo.bar')
>>> expression.search({'foo': {'bar': 'baz'}})
'baz'
>>> expression.search({'foo': {'bar': 'other'}})
'other'
This is useful if you're going to use the same jmespath expression to
search multiple documents. This avoids having to reparse the
JMESPath expression each time you search a new document.
Options
-------
You can provide an instance of ``jmespath.Options`` to control how
a JMESPath expression is evaluated. The most common scenario for
using an ``Options`` instance is if you want to have ordered output
of your dict keys. To do this you can use either of these options::
>>> import jmespath
>>> jmespath.search('{a: a, b: b},
... mydata,
... jmespath.Options(dict_cls=collections.OrderedDict))
>>> import jmespath
>>> parsed = jmespath.compile('{a: a, b: b}')
>>> parsed.search('{a: a, b: b},
... mydata,
... jmespath.Options(dict_cls=collections.OrderedDict))
Specification
=============
If you'd like to learn more about the JMESPath language, you can check out
the `JMESPath tutorial <http://jmespath.org/tutorial.html>`__. Also check
out the `JMESPath examples page <http://jmespath.org/examples.html>`__ for
examples of more complex jmespath queries.
The grammar is specified using ABNF, as described in
`RFC4234 <http://www.ietf.org/rfc/rfc4234.txt>`_.
You can find the most up to date
`grammar for JMESPath here <http://jmespath.org/specification.html#grammar>`__.
You can read the full
`JMESPath specification here <http://jmespath.org/specification.html>`__.
Testing
=======
In addition to the unit tests for the jmespath modules,
there is a ``tests/compliance`` directory that contains
.json files with test cases. This allows other implementations
to verify they are producing the correct output. Each json
file is grouped by feature.
Discuss
=======
Join us on our `Gitter channel <https://gitter.im/jmespath/chat>`__
if you want to chat or if you have any questions.
%prep
%autosetup -n jmespath-0.9.0
%build
%py2_build
%install
%py2_install
install -d -m755 %{buildroot}/%{_pkgdocdir}
if [ -d doc ]; then cp -arf doc %{buildroot}/%{_pkgdocdir}; fi
if [ -d docs ]; then cp -arf docs %{buildroot}/%{_pkgdocdir}; fi
if [ -d example ]; then cp -arf example %{buildroot}/%{_pkgdocdir}; fi
if [ -d examples ]; then cp -arf examples %{buildroot}/%{_pkgdocdir}; fi
pushd %{buildroot}
if [ -d usr/lib ]; then
find usr/lib -type f -printf "/%h/%f\n" >> filelist.lst
fi
if [ -d usr/lib64 ]; then
find usr/lib64 -type f -printf "/%h/%f\n" >> filelist.lst
fi
if [ -d usr/bin ]; then
find usr/bin -type f -printf "/%h/%f\n" >> filelist.lst
fi
if [ -d usr/sbin ]; then
find usr/sbin -type f -printf "/%h/%f\n" >> filelist.lst
fi
touch doclist.lst
if [ -d usr/share/man ]; then
find usr/share/man -type f -printf "/%h/%f.gz\n" >> doclist.lst
fi
popd
mv %{buildroot}/filelist.lst .
mv %{buildroot}/doclist.lst .
%files -n python2-jmespath -f filelist.lst
%dir %{python2_sitelib}/*
%files help -f doclist.lst
%{_docdir}/*
%changelog
* Fri Apr 30 2021 OpenStack_SIG <openstack@openeuler.org>
- Package Spec generated
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化