Skip to main content

Flake8 plugin that requires frozendict and frozenset instead of dict and set

Project description

flake8-frozen-collections

A Flake8 plugin that prohibits the use of mutable dict and set, requiring frozendict and frozenset instead.

Installation

pip install flake8-frozen-collections

Usage

flake8 your_project/

Error Codes

Code Description
FCS100 Use frozendict instead of dict
FCS200 Use frozenset instead of set

What Is Checked

  • Literals {...} and {key: value}
  • Calls to dict(...) and set(...)
  • dict/set comprehensions
  • Type annotations dict[...], set[...], dict, set
  • Checks isinstance(..., dict) and isinstance(..., set)

Example

# Bad
mapping: dict[str, int] = {"a": 1}
tags: set[str] = {"x", "y"}

# Good
from frozendict import frozendict

mapping = frozendict({"a": 1})
tags = frozenset({"x", "y"})

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

flake8_frozen_collections-0.0.1.tar.gz (2.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

flake8_frozen_collections-0.0.1-py3-none-any.whl (3.6 kB view details)

Uploaded Python 3

File details

Details for the file flake8_frozen_collections-0.0.1.tar.gz.

File metadata

  • Download URL: flake8_frozen_collections-0.0.1.tar.gz
  • Upload date:
  • Size: 2.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.4 CPython/3.13.6 Darwin/24.3.0

File hashes

Hashes for flake8_frozen_collections-0.0.1.tar.gz
Algorithm Hash digest
SHA256 2689b7fbcaba1ec0f6c4bbd637f508aec1748eb8a24c8597271315575063c80b
MD5 ae1db0103365bbb93511d723e6895907
BLAKE2b-256 8c9c974face5b03445058db6b986c755168263eefbcb25c6352718418976d456

See more details on using hashes here.

File details

Details for the file flake8_frozen_collections-0.0.1-py3-none-any.whl.

File metadata

File hashes

Hashes for flake8_frozen_collections-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 ac152d85b3dac6699e3db12e83f0484f20b9ed5d87ea7720bc5159d1e60f00f4
MD5 0196a8b76c8f9fdb22a4a7586a3053eb
BLAKE2b-256 c08aa6e4c986a32a1ecc14358121a8682293889dc1d2995d9d7a82f4081507b0

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page