Modify your own source code with this piece of Python black magic.
When a piece of code calls replace_me(value), that line will be replaced with the given value. If you want to insert a comment and keep the line that inserted it, use insert_comment(value).
ATTENTION: Calling these functions will modify your source code. Keep backups.
Example:
from replace_me import replace_me, insert_comment
# If you run this program, this source code will change.
# These two lines will become the same:
# Hello World
replace_me("Hello World", as_comment=True)
# Code generation. Creates a hard coded list of 100 numbers.
replace_me('numbers = ' + str(list(range(100))))
import random
# The next comment will be replaced with a random number.
insert_comment(random.randint(1, 10))
# ??
# Pseudo-quine, replaces the line with itself.
quine = 'replace_me(quine)'
replace_me(quine)
Metadata
Release files for replace_me 0.1.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| replace_me-0.1.4.tar.gz | 2.5 kB | Without provenance | Details for replace_me-0.1.4.tar.gz |
Release files / replace_me-0.1.4.tar.gz
| Download URL | replace_me-0.1.4.tar.gz |
|---|---|
| Size | 2.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
99179545a9f554571a243d7ac5ba3d732e158a3f07a39e78dd7cba055d5673c9
|
|
BLAKE2b-256 checksum How to use checksums |
e24794ea09325e1674db48dc3f9a66e2535e49840c69dbdd24eb1c831e308eee
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for replace_me 0.1.4
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.