All Projects â†’ drgrib â†’ Dotmap

drgrib / Dotmap

Licence: mit
Dot access dictionary with dynamic hierarchy creation and ordered iteration

Programming Languages

python
139335 projects - #7 most used programming language
python3
1442 projects
python2
120 projects

Projects that are alternatives of or similar to Dotmap

EasyWayLocation
This library contain all utils related to google location. like, getting lat or long, Address and Location Setting dialog, many more...
Stars: ✭ 142 (-47.99%)
Mutual labels:  maps
react-vector-maps
🗺 A React component for interactive vector maps of the world and 100+ countries
Stars: ✭ 112 (-58.97%)
Mutual labels:  maps
awesome-hokchew
A curated list of resources about the Hokchew / Foochow language. 閩東語福州話的資源整合列表。
Stars: ✭ 16 (-94.14%)
Mutual labels:  dictionaries
org
No description or website provided.
Stars: ✭ 15 (-94.51%)
Mutual labels:  maps
geoblaze
Blazing Fast JavaScript Raster Processing Engine
Stars: ✭ 80 (-70.7%)
Mutual labels:  maps
MyGoldenDict
My personal goldendict-dictionaries collection
Stars: ✭ 13 (-95.24%)
Mutual labels:  dictionaries
google-maps-at-88-mph
Google Maps keeps old satellite imagery around for a while – this tool collects what's available for a user-specified region in the form of a GIF.
Stars: ✭ 93 (-65.93%)
Mutual labels:  maps
Fd Dictionaries
hand-written dictionaries from the FreeDict project
Stars: ✭ 268 (-1.83%)
Mutual labels:  dictionaries
polylineencoder
A C++ implementation of Google Encoded Polyline Algorithm Format (encoder/decoder)
Stars: ✭ 15 (-94.51%)
Mutual labels:  maps
angular-mapboxgl-directive
AngularJS directive for Mapbox GL
Stars: ✭ 43 (-84.25%)
Mutual labels:  maps
poor-maps
Maps and navigation for Sailfish OS
Stars: ✭ 42 (-84.62%)
Mutual labels:  maps
chilemapas
Mapas terrestres de Chile con topologias simplificadas.
Stars: ✭ 23 (-91.58%)
Mutual labels:  maps
Long-Map-Benchmarks
Benchmarking the best way to store long, Object value pairs in a map.
Stars: ✭ 32 (-88.28%)
Mutual labels:  maps
leaflet-locationpicker
Simple location picker on Leaflet map
Stars: ✭ 31 (-88.64%)
Mutual labels:  maps
DawgSharp
DAWG String Dictionary in C#
Stars: ✭ 72 (-73.63%)
Mutual labels:  dictionaries
Offroad-routing-engine
Off-road Navigation System
Stars: ✭ 16 (-94.14%)
Mutual labels:  maps
map-machine
Python renderer for OpenStreetMap with custom icons intended to display as many map features as possible
Stars: ✭ 82 (-69.96%)
Mutual labels:  maps
Shareabouts
Shareabouts is a mapping application for crowdsourced info gathering.
Stars: ✭ 269 (-1.47%)
Mutual labels:  maps
Mapper
OpenOrienteering Mapper is a software for creating maps for the orienteering sport.
Stars: ✭ 258 (-5.49%)
Mutual labels:  maps
flagfillr
Use flags as fills for ggplot2 maps. (WIP)
Stars: ✭ 23 (-91.58%)
Mutual labels:  maps

DotMap

Build Status

Donate

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
  • 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

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

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

m = DotMap()
m.people.steve.age = 31

And key initialization

m = DotMap(a=1, b=2)

You can initialize it from dict and convert it to dict

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

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

m = DotMap()
for i in range(7):
	m.counter += 1
print(m.counter)
# 7

And automatic addition initializations of any other type

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

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.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].