tinycss2_core_attributes
This is a companion to the tinycss2 project that provides
a list of "core attribute" names for every tinycss Node class.
This allows you to traverse the parse tree or print out information
(for example, for debugging), all without special-casing every node type.
For example:
>>> import tinycss2
>>> from tinycss2_core_attributes import get_core_attrs
>>> decl = tinycss2.parse_one_declaration('width: 100%;')
>>> decl
<Declaration width: …>
>>> get_core_attrs(decl)
['name', 'value', 'important']
>>> for attr_name in get_core_attrs(decl):
... print(f'{attr_name}: {getattr(decl, attr_name)}')
...
name: width
value: [<WhitespaceToken>, <PercentageToken 100%>, <LiteralToken ;>]
important: False
The "core attributes" are ones that contain information about the individual node. This excludes:
- attributes common to all nodes, like
typeandsource_line - attributes that can be trivially computed from other core attributes,
like
lower_at_keyword(which you can compute fromat_keyword - the undocumented
representationof string and URL tokens (which can't always be computed fromvalue)
The purpose of this project is to show that this concept of "core attributes"
is useful. Perhaps it could be added to tinycss2 itself.
API
The project provides a single function:
get_core_attrs
get_core_attrs(node)
Takes a tinycss2.ast.Node instance or subclass, and returns a list of
names of its "core attributes".
CLI interface
There's a demo!
Run python -m tinycss2_core_attributes FILE.css to parse FILE.css and
display a colorized dump of the AST.
Use --help to see all options.
Versioning
This project is tightly tied to tinycss2, and uses the tinycss2 version
it is compatible with plus a change counter at the end.
Thus, tinycss2_core_attributes 1.5.1.0 requires tinycss2 1.5.1.
Licence
To the extent possible under law, the author(s) have dedicated all copyright and related and neighboring rights to this work to the public domain worldwide. This work is distributed without any warranty.
See the CC0 Public Domain Dedication: http://creativecommons.org/publicdomain/zero/1.0/
Metadata
Release files for tinycss2-core-attributes 1.5.1.0
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 |
|---|---|---|---|---|
| tinycss2_core_attributes-1.5.1.0.tar.gz | 8.0 kB | Without provenance | Details for tinycss2_core_attributes-1.5.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| tinycss2_core_attributes-1.5.1.0-py3-none-any.whl | Python 3 | none | any | Details for tinycss2_core_attributes-1.5.1.0-py3-none-any.whl |
Total release size: 15.6 kB
Release files / tinycss2_core_attributes-1.5.1.0.tar.gz
| Download URL | tinycss2_core_attributes-1.5.1.0.tar.gz |
|---|---|
| Size | 8.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
aa16d847c6934262d2ac6c06f38a66b13d7bfcb669a68274f1dbf11f5acbac69
|
|
BLAKE2b-256 checksum How to use checksums |
ad66bd7c8893788a2e47ce8b192d0b52122c77f6b0cec759937d5c546e24ff51
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.11.15 {"installer":{"name":"uv","version":"0.11.15","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Fedora Linux","version":"44","id":"","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Release files / tinycss2_core_attributes-1.5.1.0-py3-none-any.whl
| Download URL | tinycss2_core_attributes-1.5.1.0-py3-none-any.whl |
|---|---|
| Size | 7.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
3f8c74f1317df548955529994a3bd5ca3b909cfa8fcdcaf268064b6205a17e22
|
|
BLAKE2b-256 checksum How to use checksums |
0ebee632589719656d73a8b52801683f3f1a852b0fd4f109d70bb0e59e300a17
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.11.15 {"installer":{"name":"uv","version":"0.11.15","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Fedora Linux","version":"44","id":"","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Security for tinycss2-core-attributes 1.5.1.0
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.