%global _empty_manifest_terminate_build 0 Name: python-dotmap Version: 1.3.30 Release: 1 Summary: ordered, dynamically-expandable dot-access dictionary License: MIT URL: https://github.com/drgrib/dotmap Source0: https://mirrors.nju.edu.cn/pypi/web/packages/bc/68/c186606e4f2bf731abd18044ea201e70c3c244bf468f41368820d197fca5/dotmap-1.3.30.tar.gz BuildArch: noarch %description # DotMap [![Build Status](https://travis-ci.com/drgrib/dotmap.svg?branch=master)](https://travis-ci.com/drgrib/dotmap) [![Donate](https://img.shields.io/badge/Donate-PayPal-green.svg)](https://www.paypal.com/donate?business=N2GLXLS5KBFBY&item_name=Chris+Redford¤cy_code=USD) # Install ``` pip3 install dotmap ``` ## Upgrade Get updates for current installation ``` pip3 install --upgrade dotmap ``` # Features `DotMap` is a dot-access `dict` subclass that - has dynamic hierarchy creation (autovivification) - can be initialized with keys - easily initializes from `dict` - easily converts to `dict` - is ordered by insertion The key feature is exactly what you want: dot-access ```python from dotmap import DotMap m = DotMap() m.name = 'Joe' print('Hello ' + m.name) # Hello Joe ``` However, `DotMap` is a `dict` and you can treat it like a `dict` as needed ```python print(m['name']) # Joe m.name += ' Smith' m['name'] += ' Jr' print(m.name) # Joe Smith Jr ``` It also has fast, automatic hierarchy (which can be deactivated by initializing with `DotMap(_dynamic=False)`) ```python m = DotMap() m.people.steve.age = 31 ``` And key initialization ```python m = DotMap(a=1, b=2) ``` You can initialize it from `dict` and convert it to `dict` ```python d = {'a':1, 'b':2} m = DotMap(d) print(m) # DotMap(a=1, b=2) print(m.toDict()) # {'a': 1, 'b': 2} ``` And it has iteration that is ordered by insertion ```python m = DotMap() m.people.john.age = 32 m.people.john.job = 'programmer' m.people.mary.age = 24 m.people.mary.job = 'designer' m.people.dave.age = 55 m.people.dave.job = 'manager' for k, v in m.people.items(): print(k, v) print # john DotMap(age=32, job='programmer') # mary DotMap(age=24, job='designer') # dave DotMap(age=55, job='manager') ``` It also has automatic counter initialization ```python m = DotMap() for i in range(7): m.counter += 1 print(m.counter) # 7 ``` And automatic addition initializations of any other type ```python m = DotMap() m.quote += 'lions' m.quote += ' and tigers' m.quote += ' and bears' m.quote += ', oh my' print(m.quote) # lions and tigers and bears, oh my ``` There is also built-in `pprint` as `dict` or `json` for debugging a large `DotMap` ```python m.pprint() # {'people': {'dave': {'age': 55, 'job': 'manager'}, # 'john': {'age': 32, 'job': 'programmer'}, # 'mary': {'age': 24, 'job': 'designer'}}} m.pprint(pformat='json') # { # "people": { # "dave": { # "age": 55, # "job": "manager" # }, # "john": { # "age": 32, # "job": "programmer" # }, # "mary": { # "age": 24, # "job": "designer" # } # } # } ``` And many other features involving dots and dictionaries that will be immediately intuitive when used. %package -n python3-dotmap Summary: ordered, dynamically-expandable dot-access dictionary Provides: python-dotmap BuildRequires: python3-devel BuildRequires: python3-setuptools BuildRequires: python3-pip %description -n python3-dotmap # DotMap [![Build Status](https://travis-ci.com/drgrib/dotmap.svg?branch=master)](https://travis-ci.com/drgrib/dotmap) [![Donate](https://img.shields.io/badge/Donate-PayPal-green.svg)](https://www.paypal.com/donate?business=N2GLXLS5KBFBY&item_name=Chris+Redford¤cy_code=USD) # Install ``` pip3 install dotmap ``` ## Upgrade Get updates for current installation ``` pip3 install --upgrade dotmap ``` # Features `DotMap` is a dot-access `dict` subclass that - has dynamic hierarchy creation (autovivification) - can be initialized with keys - easily initializes from `dict` - easily converts to `dict` - is ordered by insertion The key feature is exactly what you want: dot-access ```python from dotmap import DotMap m = DotMap() m.name = 'Joe' print('Hello ' + m.name) # Hello Joe ``` However, `DotMap` is a `dict` and you can treat it like a `dict` as needed ```python print(m['name']) # Joe m.name += ' Smith' m['name'] += ' Jr' print(m.name) # Joe Smith Jr ``` It also has fast, automatic hierarchy (which can be deactivated by initializing with `DotMap(_dynamic=False)`) ```python m = DotMap() m.people.steve.age = 31 ``` And key initialization ```python m = DotMap(a=1, b=2) ``` You can initialize it from `dict` and convert it to `dict` ```python d = {'a':1, 'b':2} m = DotMap(d) print(m) # DotMap(a=1, b=2) print(m.toDict()) # {'a': 1, 'b': 2} ``` And it has iteration that is ordered by insertion ```python m = DotMap() m.people.john.age = 32 m.people.john.job = 'programmer' m.people.mary.age = 24 m.people.mary.job = 'designer' m.people.dave.age = 55 m.people.dave.job = 'manager' for k, v in m.people.items(): print(k, v) print # john DotMap(age=32, job='programmer') # mary DotMap(age=24, job='designer') # dave DotMap(age=55, job='manager') ``` It also has automatic counter initialization ```python m = DotMap() for i in range(7): m.counter += 1 print(m.counter) # 7 ``` And automatic addition initializations of any other type ```python m = DotMap() m.quote += 'lions' m.quote += ' and tigers' m.quote += ' and bears' m.quote += ', oh my' print(m.quote) # lions and tigers and bears, oh my ``` There is also built-in `pprint` as `dict` or `json` for debugging a large `DotMap` ```python m.pprint() # {'people': {'dave': {'age': 55, 'job': 'manager'}, # 'john': {'age': 32, 'job': 'programmer'}, # 'mary': {'age': 24, 'job': 'designer'}}} m.pprint(pformat='json') # { # "people": { # "dave": { # "age": 55, # "job": "manager" # }, # "john": { # "age": 32, # "job": "programmer" # }, # "mary": { # "age": 24, # "job": "designer" # } # } # } ``` And many other features involving dots and dictionaries that will be immediately intuitive when used. %package help Summary: Development documents and examples for dotmap Provides: python3-dotmap-doc %description help # DotMap [![Build Status](https://travis-ci.com/drgrib/dotmap.svg?branch=master)](https://travis-ci.com/drgrib/dotmap) [![Donate](https://img.shields.io/badge/Donate-PayPal-green.svg)](https://www.paypal.com/donate?business=N2GLXLS5KBFBY&item_name=Chris+Redford¤cy_code=USD) # Install ``` pip3 install dotmap ``` ## Upgrade Get updates for current installation ``` pip3 install --upgrade dotmap ``` # Features `DotMap` is a dot-access `dict` subclass that - has dynamic hierarchy creation (autovivification) - can be initialized with keys - easily initializes from `dict` - easily converts to `dict` - is ordered by insertion The key feature is exactly what you want: dot-access ```python from dotmap import DotMap m = DotMap() m.name = 'Joe' print('Hello ' + m.name) # Hello Joe ``` However, `DotMap` is a `dict` and you can treat it like a `dict` as needed ```python print(m['name']) # Joe m.name += ' Smith' m['name'] += ' Jr' print(m.name) # Joe Smith Jr ``` It also has fast, automatic hierarchy (which can be deactivated by initializing with `DotMap(_dynamic=False)`) ```python m = DotMap() m.people.steve.age = 31 ``` And key initialization ```python m = DotMap(a=1, b=2) ``` You can initialize it from `dict` and convert it to `dict` ```python d = {'a':1, 'b':2} m = DotMap(d) print(m) # DotMap(a=1, b=2) print(m.toDict()) # {'a': 1, 'b': 2} ``` And it has iteration that is ordered by insertion ```python m = DotMap() m.people.john.age = 32 m.people.john.job = 'programmer' m.people.mary.age = 24 m.people.mary.job = 'designer' m.people.dave.age = 55 m.people.dave.job = 'manager' for k, v in m.people.items(): print(k, v) print # john DotMap(age=32, job='programmer') # mary DotMap(age=24, job='designer') # dave DotMap(age=55, job='manager') ``` It also has automatic counter initialization ```python m = DotMap() for i in range(7): m.counter += 1 print(m.counter) # 7 ``` And automatic addition initializations of any other type ```python m = DotMap() m.quote += 'lions' m.quote += ' and tigers' m.quote += ' and bears' m.quote += ', oh my' print(m.quote) # lions and tigers and bears, oh my ``` There is also built-in `pprint` as `dict` or `json` for debugging a large `DotMap` ```python m.pprint() # {'people': {'dave': {'age': 55, 'job': 'manager'}, # 'john': {'age': 32, 'job': 'programmer'}, # 'mary': {'age': 24, 'job': 'designer'}}} m.pprint(pformat='json') # { # "people": { # "dave": { # "age": 55, # "job": "manager" # }, # "john": { # "age": 32, # "job": "programmer" # }, # "mary": { # "age": 24, # "job": "designer" # } # } # } ``` And many other features involving dots and dictionaries that will be immediately intuitive when used. %prep %autosetup -n dotmap-1.3.30 %build %py3_build %install %py3_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 python3-dotmap -f filelist.lst %dir %{python3_sitelib}/* %files help -f doclist.lst %{_docdir}/* %changelog * Mon Apr 10 2023 Python_Bot - 1.3.30-1 - Package Spec generated