Skip to main content

various handy utilities

Project description

intrand.py

Python utilities that are useful in their own little ways.

Installation

pip: pip install --upgrade intrand

Usage

import intrand

# some default values
defaults = {
	"preferences":{
		"color":"blue",
		"size":"medium",
		"gradient":True
	}
}

# some user input (perhaps via API)
userConfig = {
	"id":1234567890,
	"name":{
		"first":"John",
		"middle":"James",
		"last":"Smith"
	},
	"preferences":{
		"color":"gray"
	}
}

intrand.dict_utils.merge(defaults, userConfig)	# merge keys present in defaults,
												# but missing in userConfig
												# into userConfig

print(userConfig)

Optionally, you may choose to overwrite your existing values with the new by specifying overwrite=True.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for intrand, version 0.0.6
Filename, size File type Python version Upload date Hashes
Filename, size intrand-0.0.6-py3-none-any.whl (3.8 kB) File type Wheel Python version py3 Upload date Hashes View
Filename, size intrand-0.0.6.tar.gz (2.6 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring DigiCert DigiCert EV certificate Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page