Skip to content

robertchase/ergaleia

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

63 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ergaleia

a library of tools for python

Ergaleia is a library of random tools that might be useful when writing stuff in python.

I found myself copying most of these things around from repo to repo, making small tweaks along the way and letting things slowly drift out of sync. That was a bad idea. I thought about making a bunch of individual repos, one for each tool, but didn't like that either. So here they are, thrown together. Maybe you'll find this useful.

You can borrow and steal if you want, just keep the license intact.

compatability

Tested with 2.7 and 3.6.

the tools

config

A pythonic configuration object that reads key=value settings from a text file. The text file is constrained to a set of valid keys, which can have default values if not present in a config file.

config documentation

A mini config object for managing settings within a module is also available.

mini documentation

from_xml

A conversion tool to turn an XML document into a nested python dict. So, why did they invent XML again?

from_xml documentation

import_by_path

A function loader that locates and dynamically loads functions using dotted-path notation.

import_by_path documentation

load_from_path

A pair of file loader functions that can find, and load, files in pythonic ways.

This is a file-loader on top of normalize_path.

load_from_path documentation

load_lines_from_path documentation

nested_get

Index deep python dict structures in a single bound.

Sometimes, like when XML documents are converted into python dicts (cough, cough), data structures can end up being uncomfortably deep. The nested_get function allows safe deep-traversal with default values and optionally required structure.

nested_get documentation

normalize_path

Find non-python files buried in the python directories using dot-notation instead of direct file references. Useful for data or configuration files.

normalize_path documentation

un_comment

Truncate a string at a comment character. Handles escaped characters and whitespace stripping.

un_comment documentation

to_args

Parse a string into args and kwargs. Might be useful for mini-languages or configuration tasks.

to_args documentation

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published