Permalink
Cannot retrieve contributors at this time
Flake8 Extension for f-strings
Usage
Install with:
pip install flake8_complex_f_strings
Errors
Code | Message |
---|---|
FCS100 | too complex f-string |
Examples
f'Too complex {some_amazing_func(variable)}' # <-- too complex f-string
Total Weekly Downloads (33)
- GitHub Stars
-
1
- Forks
-
1
- Contributors
-
1
Direct Usage Popularity
The PyPI package flake8-complex-f-strings receives a total of
33 downloads a week. As such, we scored
flake8-complex-f-strings popularity level to be Limited.
Based on project statistics from the GitHub repository for the
PyPI package flake8-complex-f-strings, we found that it has been
starred 1 times.
The download numbers shown are the average weekly downloads from the
last 6 weeks.
Security and license risk for latest version
- Release Date
- Apr 14, 2021
- Direct Vulnerabilities
-
-
0
C
-
0
H
-
0
M
-
0
L
-
- Indirect Vulnerabilities
-
-
0
C
-
0
H
-
0
M
-
0
L
-
All security vulnerabilities belong to
production dependencies of direct and indirect
packages.
MIT
No
We found a way for you to contribute to the project! Looks like
flake8-complex-f-strings is missing a security policy.
You can
connect your project’s repository to Snyk
to stay up to date on security alerts and receive automatic fix pull
requests.
Keep your project free of vulnerabilities with Snyk
Commit Frequency
- Open Issues
- 0
- Open PR
- 1
- Last Release
-
2 years ago
- Last Commit
-
2 years ago
Further analysis of the maintenance status of flake8-complex-f-strings based on
released PyPI versions cadence, the repository activity,
and other data points determined that its maintenance is
Inactive.
An important project maintenance signal to consider for flake8-complex-f-strings is
that it
hasn’t seen any new versions released to PyPI in the
past 12 months, and could be considered as a discontinued project, or that which
receives low attention from its maintainers.
In the past month we didn’t find any pull request activity or change in
issues status has been detected for the GitHub repository.
- Python Versions Compatibility
-
Unspecified
- Age
-
2 years
- Latest Release
-
2 years ago
- Dependencies
-
2 Direct / 14 Total
- Versions
-
1
- Maintainers
-
1
- Wheels
-
OS Independent
What’s wrong
The following line raises WPS237
self.info(f"Count={count:,}")
37:19 WPS237 Found a too complex `f` string self.info(f"Count={count:,}")
How it should be
It should not do that, as that does not seem an overly complex f-string.
It is formatting an int as a comma separated value: f"count={count:,}"
-> "count=1,234"
- this is the same as
"count={count:,}".format(count=count)
Flake8 version and plugins
{ "dependencies": [], "platform": { "python_implementation": "CPython", "python_version": "3.7.3", "system": "Darwin" }, "plugins": [ { "is_local": false, "plugin": "flake8-bandit", "version": "2.1.2" }, { "is_local": false, "plugin": "flake8-broken-line", "version": "0.3.0" }, { "is_local": false, "plugin": "flake8-bugbear", "version": "20.11.1" }, { "is_local": false, "plugin": "flake8-comprehensions", "version": "3.3.1" }, { "is_local": false, "plugin": "flake8-darglint", "version": "1.6.0" }, { "is_local": false, "plugin": "flake8-debugger", "version": "4.0.0" }, { "is_local": false, "plugin": "flake8-docstrings", "version": "1.5.0, pydocstyle: 5.1.1" }, { "is_local": false, "plugin": "flake8-eradicate", "version": "1.0.0" }, { "is_local": false, "plugin": "flake8-string-format", "version": "0.3.0" }, { "is_local": false, "plugin": "flake8_commas", "version": "2.0.0" }, { "is_local": false, "plugin": "flake8_isort", "version": "4.0.0" }, { "is_local": false, "plugin": "flake8_quotes", "version": "3.2.0" }, { "is_local": false, "plugin": "mccabe", "version": "0.6.1" }, { "is_local": false, "plugin": "naming", "version": "0.11.1" }, { "is_local": false, "plugin": "pycodestyle", "version": "2.6.0" }, { "is_local": false, "plugin": "pyflakes", "version": "2.2.0" }, { "is_local": false, "plugin": "rst-docstrings", "version": "0.0.14" }, { "is_local": false, "plugin": "wemake_python_styleguide", "version": "0.15.2" } ], "version": "3.8.4" }
pip information
pip 21.0.1
cannot show pip freeze
OS information
macOS Catalina 10.15.7 (19H114
View Code? Open in Web Editor
NEW
This project forked from anatoly-kor/flake8_complex_f_strings
0.0
0.0
9 KB
Flake8 Extension for too complex f-strings
License: MIT License
Python 100.00%
flake8_complex_f_strings’s Introduction
Flake8 Extension for f-strings
Usage
Install with:
pip install flake8_complex_f_strings
Errors
Code | Message |
---|---|
FCS100 | too complex f-string |
Examples
f'Too complex {some_amazing_func(variable)}' # <-- too complex f-string
flake8_complex_f_strings’s People
Contributors
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
Ниже мой фрагмент кода. При запуске кода в python 3.7 я получаю сообщение об ошибке SyntaxError: f-string: expressions nested too deeply
. Как мне провести рефакторинг моего кода?
GRAPH_QL_FIELDS = """
cubeId
title
deleted
timeVariableFormat
statisticalProgram {
name
}
topics{
topicId
}
}
"""
query_topics = (
f'query cubesWithTopicLink($deleted: Boolean!, $topicId: String, $first: Int, $skip: Int) {{'
f'dataCubes(where:{AND:[{topics_some: {{topicId: $topicId}}}, {deleted: $deleted}]}, first: $first, skip: $skip) {{'
f'{GRAPH_QL_FIELDS}'
f'dataCubesConnection(where: {topics_some: {topicId: $topicId}})'
f'{{aggregate{{count}}}}'
f'}}'
)
2 ответа
Лучший ответ
Вы можете использовать многострочные строки f"""This will work as expected with other nested strings '{3+5}'"""
0
oropo
18 Мар 2022 в 18:23
Вы не можете вкладывать f-string
, как f'{f"my_var"}'
, поэтому вам следует реорганизовать свой код, удалив вложенные f-строки и разделив их на дополнительные f-строки.
Как заявил Димитрис Фасаракис Хиллиард:
Я не думаю, что форматированные строковые литералы, допускающие вложение (под вложением я подразумеваю f'{f»..»}’), являются результатом тщательного рассмотрения возможных вариантов использования, я больше убежден, что это просто разрешено в чтобы они соответствовали своей спецификации.
В спецификации указано, что они поддерживают полные выражения Python* внутри скобок. Также утверждается, что форматированный строковый литерал на самом деле является просто выражением, которое оценивается во время выполнения (см. здесь и здесь< /а>). В результате имеет смысл разрешить форматированный строковый литерал в качестве выражения внутри другого форматированного строкового литерала, запретив это, что сведет на нет полную поддержку выражений Python.
Тот факт, что вы не можете найти случаи использования, упомянутые в документации (и только найти тесты в наборе тестов), объясняется тем, что это, вероятно, хороший (побочный) эффект от реализации, а не мотивирующий вариант использования.
-1
Saeed
13 Ноя 2020 в 12:26