Reusable f-strings
Project description
F-yeah!
Reusable f-strings
Shed all outdated format sytles from your code. With F-yeah Just add parentheses and be on your way.
Usage
No more copying around f-strings
Keep your templates DRY without reverting to older format styles.
def action1(value):
assert isinstance(value, int), 'Expected value to be an integer, got {type(value)} instead'
return value * value
def action2(value):
assert isinstance(value, int), 'Expected value to be an integer, got {type(value)} instead'
return value ** value
Just write the template once to get consistent strings that stay in sync.
from fyeah import f
bad_check = 'Expected value to be an integer, got {type(value)} instead'
def action1(value):
assert isinstance(value, int), f(bad_check)
return value * value
def action2(value):
assert isinstance(value, int), f(bad_check)
return value ** value
No more format calls, ever!
Consolidate on f-string style format for all templates, local or global.
bad_check = 'expected value to be an integer, got {type(value)} instead'
def action1(value):
assert isinstance(value, int), bad_check.format(value=value)
return value * value
def action2(value):
assert isinstance(value, int), bad_check.format(value=value)
return value ** value
Just use the same format string as a reusable f-string instead.
from fyeah import f
bad_check = 'Expected value to be an integer, got {type(value)} instead'
def action1(value):
assert isinstance(value, int), f(bad_check)
return value * value
def action2(value):
assert isinstance(value, int), f(bad_check)
return value ** value
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
f-yeah-0.1.5.tar.gz
(4.2 kB
view hashes)
Built Distributions
Close
Hashes for f_yeah-0.1.5-cp38-cp38-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | bb0be9963c0550e9d5a8701ba7aed755ef495eefb0e459f3b1a354541d58f223 |
|
MD5 | 35c8cd44e8205353f0ea0f451141d43c |
|
BLAKE2b-256 | 880e80883af4a500a3f522f9e9c6dbdbd4b0ec3779b62131fbfa03f9e293d2c1 |
Close
Hashes for f_yeah-0.1.5-cp38-cp38-macosx_10_14_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 705b7d8120bae36faf202b97502f48f98af9bdedbb3b431b187af80256ce0de5 |
|
MD5 | 39bbacbd77d1761d45854c7451ac61c0 |
|
BLAKE2b-256 | 0dd5160b01fa88fd5e4423c08084c65efd1d61c450e6d7607cb81d83bbb97b31 |
Close
Hashes for f_yeah-0.1.5-cp37-cp37m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1042568d8d5b387db68bc736c96555b3b48e4d07f63e6b9a15fef036617aecc7 |
|
MD5 | 5a432952f9e53d777c6461062754efa4 |
|
BLAKE2b-256 | 7a01a99765f44c80e658fc844b491876b95ae96dec637544a5fe56bec317f809 |
Close
Hashes for f_yeah-0.1.5-cp37-cp37m-macosx_10_14_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 73ca1c02b99681a7f84e15eb6e14e60aaa009b9d0e6efcce700d3b8c026c93a9 |
|
MD5 | 6009458a5c80aea60dce9f6c1f596ca1 |
|
BLAKE2b-256 | 03fd9e157e3283438fb7f3e845e65d6fc10162702f32d3a2a7e00b8252c3903d |
Close
Hashes for f_yeah-0.1.5-cp36-cp36m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 769e7c98af07591536ae6680227bff8e5b2bf1fcfeb8b0f8361fea27028e1b5b |
|
MD5 | e06ab214f076beda89bb4c588209bf65 |
|
BLAKE2b-256 | dfc50dc26bfe69e4bc5129a5a9895e5d7769bf90d4a127dad3b894749979e1ad |
Close
Hashes for f_yeah-0.1.5-cp36-cp36m-macosx_10_14_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 86d2d4a2a1eaef56fdd3708b8063417f6d2ded1174fc07f40e525858b467cd67 |
|
MD5 | 78184be623c74f168e09b828343fe7f3 |
|
BLAKE2b-256 | 642ddb95300fe8f63c50d3313d1958826bb81bcae0a4594249d290202a8d1103 |