Comments (3)
Complexity: 20
def nested_dict(
*,
data: IndexedDict,
keys: list[str] | str,
keys_node: Node,
value: Any | None = None,
value_node: Node | None = None,
) -> None:
build_key = []
for _, is_last, key in mark_ends(keys if isinstance(keys, list) else [keys]):
build_key.append(key)
data = _nested_dict_handle_list(data)
if is_last and key in data:
raise DuplicatedKey(f"Defining a key multiple times is invalid: {key}")
if key not in data:
if is_last:
if key in data:
raise DuplicatedKey(
f"Defining a key multiple times is invalid: {key}"
)
data[(key, keys_node)] = (
value if value is not None else IndexedDict(),
value_node or keys_node,
)
continue
data[(key, keys_node)] = (IndexedDict(), value_node or keys_node)
data = data[key]
from complexipy.
Also, consider the list comprehension cases
from complexipy.
![image](https://private-user-images.githubusercontent.com/50106623/341627112-c6a4ab9a-acd5-42ed-9502-14e038e45bb3.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjMzNzIxMDcsIm5iZiI6MTcyMzM3MTgwNywicGF0aCI6Ii81MDEwNjYyMy8zNDE2MjcxMTItYzZhNGFiOWEtYWNkNS00MmVkLTk1MDItMTRlMDM4ZTQ1YmIzLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA4MTElMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwODExVDEwMjMyN1omWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWY3NmEwNWU2YmQyNzE3ZDUyNzUyM2VmYzFlNzU5Nzc4MzZmODg0NDg3MmM1ZTcxYTlhZjM0MWQzY2M4ZmU2YzAmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.ahWo_lOOr3DtGjzElWAXNelSbOM_iLHyVd1vxcLDlNM)
from complexipy.
Related Issues (20)
- Calculate the cognitive complexity of a repo
- Delete directory flag
- ignore files
- Consider changing the report format
- Improve the algorithm HOT 1
- Consider adding the report line by line to know the cognitive complexity
- Add support for Js HOT 3
- Calculate the cognitive complexity for each function
- Fix algorithm
- Show progress bar
- Add parameter to reduce the verbosity
- Feature Request: Sort Output by Complexity HOT 2
- pre-commit hook HOT 2
- Refactor the return types HOT 1
- Consider support for older versions of Python HOT 3
- Support multiple paths HOT 1
- enhance output
- Add Nix
- bug: cannot install complexipy HOT 6
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.
from complexipy.