randomly-change-self 0.2.0

Creator: bradpython12

Last updated:

Add to Cart

Description:

randomlychangeself 0.2.0

randomly-change-self





Change all instances of self to this in one randomly chosen scope per file.
Inspired by David Beazley's toot.
Installation
Install from PyPi with your favorite pip invocation:
$ python3 -m pip install randomly-change-self

You can confirm proper installation via the randomly-change-self CLI:

$ randomly-change-self --help
usage: randomly-change-self [-h] [--replace-with REPLACE_WITH]
[--consider-mercury-in-retrograde CONSIDER_MERCURY_IN_RETROGRADE]
[filenames ...]

positional arguments:
filenames

options:
-h, --help show this help message and exit
--replace-with REPLACE_WITH
--consider-mercury-in-retrograde CONSIDER_MERCURY_IN_RETROGRADE


Arguments
filenames
A collection of filename(s) to process. While this isn't required, you should probably pass some filename(s) if you want something to happen.
replace-with
Specify the string to replace "self" with. Defaults to "this"
It's assumed that this value is a valid Python identifier. No validation of this is done, we're all adults here.
consider-mercury-in-retrograde
Set to True if you only want to make changes if Mercury is in retrograde.
NOTE: Because it turns out that astrophysics is a little challenging and I haven't done it since college, this is currently implemented as an API call to the Mercury Retrograde API. This call should fail gracefully, and if an issue is encountered then your flag will be ignored and your code will get changed anyway.
Pre-Commit
You can even use this as a pre-commit hook. Wow!
- repo: https://github.com/sco1/randomly-change-self
rev: v0.2.0
hooks:
- id: randomly-change-self
args: [--consider-mercury-in-retrograde=False]

License

For personal and professional use. You cannot resell or redistribute these repositories in their original state.

Customer Reviews

There are no reviews.