Metadata-Version: 2.1
Name: randomly-change-self
Version: 0.1.1
Summary: Change all instances of `self` to `this` in one randomly chosen scope
Home-page: https://github.com/sco1/
Author: sco1
Author-email: sco1.git@gmail.com
Requires-Python: >=3.10,<4.0
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: 3.13
Classifier: Typing :: Typed
Requires-Dist: tokenize-rt (>=5.2,<6.0)
Project-URL: Repository, https://github.com/sco1/randomly-change-self
Description-Content-Type: text/markdown

# randomly-change-self
[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/randomly-change-self/0.1.1?logo=python&logoColor=FFD43B)](https://pypi.org/project/randomly-change-self/)
[![PyPI](https://img.shields.io/pypi/v/randomly-change-self?logo=Python&logoColor=FFD43B)](https://pypi.org/project/randomly-change-self/)
[![PyPI - License](https://img.shields.io/pypi/l/randomly-change-self?color=magenta)](https://github.com/sco1/randomly-change-self/blob/master/LICENSE)
[![pre-commit.ci status](https://results.pre-commit.ci/badge/github/sco1/randomly-change-self/main.svg)](https://results.pre-commit.ci/latest/github/sco1/randomly-change-self/main)
[![Code style: black](https://img.shields.io/badge/code%20style-black-black)](https://github.com/psf/black)

Change all instances of `self` to `this` in one randomly chosen scope per file.

Inspired by [David Beazley's toot](https://mastodon.social/@dabeaz/111703946510399408).

## Installation
Install from PyPi with your favorite `pip` invocation:

```bash
$ python3 -m pip install randomly-change-self
```

You can confirm proper installation via the `randomly-change-self` CLI:
<!-- [[[cog
import cog
from subprocess import PIPE, run
out = run(["randomly-change-self", "--help"], stdout=PIPE, encoding="ascii")
cog.out(
    f"```\n$ randomly-change-self --help\n{out.stdout.rstrip()}\n```"
)
]]] -->
```
$ randomly-change-self --help
usage: randomly-change-self [-h]
                            [--consider-mercury-in-retrograde CONSIDER_MERCURY_IN_RETROGRADE]
                            [filenames ...]

positional arguments:
  filenames

options:
  -h, --help            show this help message and exit
  --consider-mercury-in-retrograde CONSIDER_MERCURY_IN_RETROGRADE
```
<!-- [[[end]]] -->

## 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.

### `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](https://mercuryretrogradeapi.com/about.html). 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](https://pre-commit.com/) hook. Wow!

```yaml
- repo: https://github.com/sco1/randomly-change-self
  rev: v0.1.1
  hooks:
  - id: randomly-change-self
    args: [--consider-mercury-in-retrograde=False]
```

