Skip to content

zachvance/persistent_switch

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 

Repository files navigation

Persistent Switch

Persistent Switch is a small module utilizing pickle to make persistent, nameable, boolean variables and alter or test their states.

The variable names and states are stored in a dictionary, which is saved and loaded as a .pickle file so they are callable on subsequent runs of the program.

Examples:

from persistent_switch import make, ison, on

switch = "S1"

# Create a switch named S1, with the default state as off (a value of 0).
make(switch)

# Test if the switch S1 is on, returns False.
ison(switch)

# Turn the switch S1 on.
on(switch)

# Test if the switch S1 is on again - this time returns True.
ison(switch)

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages