class documentation
class GitAttributes:
Constructors: GitAttributes.from_file(filename), GitAttributes.from_path(path), GitAttributes(patterns)
A collection of gitattributes patterns that can match paths.
| Class Method | from |
Create GitAttributes from a gitattributes file. |
| Class Method | from |
Create GitAttributes from .gitattributes in a directory. |
| Method | __init__ |
Initialize GitAttributes. |
| Method | __iter__ |
Iterate over patterns. |
| Method | __len__ |
Return the number of patterns. |
| Method | add |
Add patterns to the collection. |
| Method | match |
Get attributes for a path by matching against patterns. |
| Method | remove |
Remove all attributes for a pattern. |
| Method | set |
Set an attribute for a pattern. |
| Method | to |
Convert GitAttributes to bytes format suitable for writing to file. |
| Method | write |
Write GitAttributes to a file. |
| Instance Variable | _patterns |
Undocumented |
Create GitAttributes from a gitattributes file.
| Parameters | |
filename:str | bytes | Path to the .gitattributes file |
| Returns | |
GitAttributes | New GitAttributes instance |
Create GitAttributes from .gitattributes in a directory.
| Parameters | |
path:str | bytes | Directory path to check for .gitattributes |
| Returns | |
GitAttributes | New GitAttributes instance |
Get attributes for a path by matching against patterns.
| Parameters | |
path:bytes | Path to match (relative to repository root) |
| Returns | |
dict[ | Dictionary of attributes that apply to this path |
Set an attribute for a pattern.
| Parameters | |
pattern:bytes | The file pattern |
name:bytes | Attribute name |
value:AttributeValue | Attribute value (bytes, True, False, or None) |
Convert GitAttributes to bytes format suitable for writing to file.
| Returns | |
bytes | Bytes representation of the gitattributes file |