Code
Hub
Workspaces
Following
Trending
Connect
MCP
copy
Create free account
hub
/
github.com/psf/black
/ functions
Functions
1,067 in github.com/psf/black
⨍
Functions
1,067
◇
Types & classes
148
↳
Endpoints
29
↓ 1 callers
Function
ipynb_diff
Return a unified diff string between each cell in notebooks `a` and `b`.
src/black/output.py:41
↓ 1 callers
Function
is_arith_like
Whether node is an arithmetic or a binary arithmetic expression
src/black/nodes.py:515
↓ 1 callers
Function
is_async_stmt_or_funcdef
Return True if the given leaf starts an async def/for/with statement. Note that `async def` can be either an `async_stmt` or `async_funcdef`,
src/black/nodes.py:806
↓ 1 callers
Function
is_atom_with_invisible_parens
Given a `LN`, determines whether it's an atom `node` with invisible parens. Useful in dedupe-ing and normalizing parens.
src/black/nodes.py:748
↓ 1 callers
Method
is_complex_subscript
Return True iff `leaf` is part of a slice with non-trivial exprs.
src/black/lines.py:410
↓ 1 callers
Function
is_docstring
(leaf: Leaf)
src/black/nodes.py:525
↓ 1 callers
Function
is_empty_tuple
Return True if `node` holds an empty tuple.
src/black/nodes.py:540
↓ 1 callers
Method
is_fmt_pass_converted
Is this line converted from fmt off/skip code? If first_leaf_matches is not None, it only returns True if the first leaf of converted
src/black/lines.py:199
↓ 1 callers
Function
is_import
Return True if the given leaf starts an import statement.
src/black/nodes.py:778
↓ 1 callers
Function
is_number_token
(nl: NL)
src/black/nodes.py:887
↓ 1 callers
Function
is_part_of_annotation
Returns whether this leaf is part of type annotations.
src/black/nodes.py:891
↓ 1 callers
Function
is_simple_decorator_expression
Return True iff `node` could be a 'dotted name' decorator This function takes the node of the 'namedexpr_test' of the new decorator grammar a
src/black/nodes.py:646
↓ 1 callers
Function
is_simple_decorator_trailer
Return True iff `node` is a trailer valid in a simple decorator
src/black/nodes.py:620
↓ 1 callers
Function
is_simple_lookup
(index: int, step: Literal[1, -1])
src/black/trans.py:100
↓ 1 callers
Function
is_simple_operand
(index: int, kind: Literal["base", "exponent"])
src/black/trans.py:124
↓ 1 callers
Function
is_split_after_delimiter
Return the priority of the `leaf` delimiter, given a line break after it. The delimiter priorities returned here are from those delimiters that w
src/black/brackets.py:217
↓ 1 callers
Function
is_split_before_delimiter
Return the priority of the `leaf` delimiter, given a line break before it. The delimiter priorities returned here are from those delimiters that
src/black/brackets.py:231
↓ 1 callers
Function
is_string_token
(nl: NL)
src/black/nodes.py:883
↓ 1 callers
Function
is_tuple_containing_walrus
Return True if `node` holds a tuple that contains a walrus operator.
src/black/nodes.py:566
↓ 1 callers
Function
is_walrus_assignment
Return True iff `node` is of the shape ( test := test )
src/black/nodes.py:614
↓ 1 callers
Function
is_with_or_async_with_stmt
Return True if the given leaf starts a with or async with statement.
src/black/nodes.py:792
↓ 1 callers
Function
is_yield
Return True if `node` holds a `yield` or `yield from` expression.
src/black/nodes.py:670
↓ 1 callers
Function
lib2to3_parse
Given a string with source, return the lib2to3 Node.
tests/data/py_310/pattern_matching_generic.py:91
↓ 1 callers
Function
lines_with_leading_tabs_expanded
Splits string into lines and expands only leading tabs (following the normal Python rules)
src/black/strings.py:53
↓ 1 callers
Method
lock
(self)
src/blib2to3/pgen2/driver.py:57
↓ 1 callers
Function
main
(bind_host: str, bind_port: int)
src/blackd/__init__.py:66
↓ 1 callers
Function
main
The uncompromising code formatter.
src/black/__init__.py:427
↓ 1 callers
Function
main
Main program, when run as a script: produce grammar pickle files. Calls load_grammar for each argument, a path to a grammar text file.
src/blib2to3/pgen2/driver.py:312
↓ 1 callers
Function
main
()
scripts/make_width_table.py:49
↓ 1 callers
Function
main
(changes: str, the_basics: str)
scripts/check_version_in_basics_example.py:14
↓ 1 callers
Function
main
(changes: str, source_version_control: str)
scripts/check_pre_commit_rev_in_example.py:20
↓ 1 callers
Function
main
()
scripts/diff_shades_gha_helper.py:104
↓ 1 callers
Function
main
()
tests/data/simple_cases/comments9.py:83
↓ 1 callers
Function
main
()
gallery/gallery.py:245
↓ 1 callers
Function
make_app
()
src/blackd/__init__.py:74
↓ 1 callers
Function
make_comment
Return a consistently formatted comment from the given `content` string. All comments (except for "##", "#!", "#:", '#'") should have a single
src/black/comments.py:113
↓ 1 callers
Method
make_dfa
(self, start: "NFAState", finish: "NFAState")
src/blib2to3/pgen2/pgen.py:205
↓ 1 callers
Method
make_first
(self, c: PgenGrammar, name: Text)
src/blib2to3/pgen2/pgen.py:79
↓ 1 callers
Method
make_grammar
(self)
src/blib2to3/pgen2/pgen.py:54
↓ 1 callers
Function
make_pypi_svg
(version: str)
docs/conf.py:25
↓ 1 callers
Function
make_width_table
()
scripts/make_width_table.py:25
↓ 1 callers
Function
mask_cell
Mask IPython magics so content becomes parseable Python code. For example, %matplotlib inline 'foo' becomes "25716
src/black/handle_ipynb_magics.py:131
↓ 1 callers
Method
match_seq
Does this pattern exactly match a sequence of nodes?
src/blib2to3/pytree.py:811
↓ 1 callers
Function
matches_grammar
(src_txt: str, grammar: Grammar)
src/black/parsing.py:134
↓ 1 callers
Function
max_delimiter_priority_in_atom
Return maximum delimiter priority inside `node`. This is specific to atoms with contents contained in a pair of parentheses. If `node` isn't
src/black/brackets.py:327
↓ 1 callers
Function
maybe
(*choices)
src/blib2to3/pgen2/tokenize.py:77
↓ 1 callers
Method
maybe_decrement_after_for_loop_variable
See `maybe_increment_for_loop_variable` above for explanation.
src/black/brackets.py:172
↓ 1 callers
Method
maybe_decrement_after_lambda_arguments
See `maybe_increment_lambda_arguments` above for explanation.
src/black/brackets.py:199
↓ 1 callers
Method
maybe_empty_lines
Return the number of extra empty lines before and after the `current_line`. This is for separating `def`, `async def` and `class` with extra
src/black/lines.py:528
↓ 1 callers
Method
maybe_increment_for_loop_variable
In a for loop, or comprehension, the variables are often unpacks. To avoid splitting on the comma in this situation, increase the depth of
src/black/brackets.py:159
↓ 1 callers
Method
maybe_increment_lambda_arguments
In a lambda expression, there might be more than one argument. To avoid splitting on the comma in this situation, increase the depth of
src/black/brackets.py:186
↓ 1 callers
Function
no
(name: str)
tests/optional.py:121
↓ 1 callers
Function
normalize_fmt_off
Convert content between `# fmt: off`/`# fmt: on` into standalone comments.
src/black/comments.py:139
↓ 1 callers
Function
normalize_numeric_literal
Normalizes numeric (float, int, and complex) literals. All letters used in the representation are normalized to lowercase.
src/black/numerics.py:44
↓ 1 callers
Function
normalize_unicode_escape_sequences
Replace hex codes in Unicode escape sequences with lowercase representation.
src/black/strings.py:253
↓ 1 callers
Function
nullcontext
Return an empty context manager. To be used like `nullcontext` in Python 3.7.
src/black/__init__.py:1396
↓ 1 callers
Method
optimize
A subclass can define this as a hook for optimizations. Returns either self or another node with the same effect.
src/blib2to3/pytree.py:546
↓ 1 callers
Method
out
(msg: str, **kwargs: Any)
tests/test_black.py:531
↓ 1 callers
Method
parse
(self)
src/blib2to3/pgen2/pgen.py:180
↓ 1 callers
Method
parse_alt
(self)
src/blib2to3/pgen2/pgen.py:305
↓ 1 callers
Function
parse_ast
(src: str)
src/black/parsing.py:176
↓ 1 callers
Method
parse_atom
(self)
src/blib2to3/pgen2/pgen.py:334
↓ 1 callers
Method
parse_graminit_c
Parse the .c file written by pgen. (Internal) The file looks as follows. The first two lines are always this: #include "pgenheader
src/blib2to3/pgen2/conv.py:85
↓ 1 callers
Method
parse_graminit_h
Parse the .h file written by pgen. (Internal) This file is a sequence of #define statements defining the nonterminals of the grammar
src/blib2to3/pgen2/conv.py:55
↓ 1 callers
Method
parse_item
(self)
src/blib2to3/pgen2/pgen.py:314
↓ 1 callers
Function
parse_pyproject_toml
Parse a pyproject toml file, pulling out relevant parts for Black. If parsing fails, will raise a tomllib.TOMLDecodeError.
src/black/files.py:113
↓ 1 callers
Function
parse_python_variant_header
(value: str)
src/blackd/__init__.py:186
↓ 1 callers
Function
parse_req_python_specifier
Parse a specifier string (i.e. ``">=3.7,<3.10"``) to a list of TargetVersion. If parsing fails, will raise a packaging.specifiers.InvalidSpecifie
src/black/files.py:171
↓ 1 callers
Function
parse_req_python_version
Parse a version string (i.e. ``"3.7"``) to a list of TargetVersion. If parsing fails, will raise a packaging.version.InvalidVersion error. If
src/black/files.py:156
↓ 1 callers
Function
parse_single_version
( src: str, version: Tuple[int, int], *, type_comments: bool )
src/black/parsing.py:150
↓ 1 callers
Method
parse_stream
Parse a stream and return the syntax tree.
src/blib2to3/pgen2/driver.py:197
↓ 1 callers
Method
parse_stream_raw
Parse a stream and return the syntax tree.
src/blib2to3/pgen2/driver.py:192
↓ 1 callers
Function
patch_click
Make Click not crash on Python 3.6 with LANG=C. On certain misconfigured environments, Python 3 selects the ASCII encoding as the default whi
src/black/__init__.py:1404
↓ 1 callers
Function
patched_main
()
src/blackd/__init__.py:219
↓ 1 callers
Function
path_empty
Exit if there is no `src` provided for formatting
src/black/__init__.py:704
↓ 1 callers
Function
path_is_excluded
( normalized_path: str, pattern: Optional[Pattern[str]], )
src/black/files.py:290
↓ 1 callers
Function
path_is_ignored
( path: Path, gitignore_dict: Dict[Path, PathSpec], report: Report )
src/black/files.py:277
↓ 1 callers
Method
pop_custom_splits
Custom Split Map Getter Method Returns: * A list of the custom splits that are mapped to @string, if any exist.
src/black/trans.py:333
↓ 1 callers
Method
post_order
Return a post-order iterator for the tree. This must be implemented by the concrete subclass.
src/blib2to3/pytree.py:120
↓ 1 callers
Function
prev_siblings_are
Return if the `node` and its previous siblings match types against the provided list of tokens; the provided `node`has its type matched against th
src/black/nodes.py:426
↓ 1 callers
Function
put_trailing_semicolon_back
Put trailing semicolon back if cell originally had it. Mirrors the logic in `quiet` from `IPython.core.displayhook`, but uses ``tokenize_rt``
src/black/handle_ipynb_magics.py:107
↓ 1 callers
Function
read_jupyter_notebook_from_file
(file_name: Path)
tests/util.py:197
↓ 1 callers
Function
read_or_stop
()
src/blib2to3/pgen2/tokenize.py:334
↓ 1 callers
Function
reformat_code
Reformat and print out `content` without spawning child processes. Similar to `reformat_one`, but for string content. `fast`, `write_bac
src/black/__init__.py:716
↓ 1 callers
Function
reformat_many
Reformat multiple files using a ProcessPoolExecutor.
src/black/concurrency.py:70
↓ 1 callers
Function
reformat_one
Reformat a single file under `src` without spawning child processes. `fast`, `write_back`, and `mode` options are passed to :func:`format_fil
src/black/__init__.py:743
↓ 1 callers
Method
release
(self)
src/blib2to3/pgen2/driver.py:69
↓ 1 callers
Function
remove_await_parens
(node: Node)
src/black/linegen.py:1213
↓ 1 callers
Method
remove_trailing_comma
Remove the trailing comma and moves the comments attached to it.
src/black/lines.py:402
↓ 1 callers
Function
remove_trailing_semicolon
Remove trailing semicolon from Jupyter notebook cell. For example, fig, ax = plt.subplots() ax.plot(x_data, y_data); # plot dat
src/black/handle_ipynb_magics.py:75
↓ 1 callers
Function
remove_with_parens
Recursively hide optional parens in `with` statements.
src/black/linegen.py:1293
↓ 1 callers
Function
replace_cell_magics
Replace cell magic with token. Note that 'src' will already have been processed by IPython's TransformerManager().transform_cell. Exampl
src/black/handle_ipynb_magics.py:197
↓ 1 callers
Function
replace_magics
Replace magics within body of cell. Note that 'src' will already have been processed by IPython's TransformerManager().transform_cell. E
src/black/handle_ipynb_magics.py:228
↓ 1 callers
Function
returns_list
()
tests/data/py_311/pep_646.py:112
↓ 1 callers
Function
right_hand_split
Split line into many lines, starting with the last matching bracket pair. If the split was by optional parentheses, attempt splitting without the
src/black/linegen.py:666
↓ 1 callers
Function
run_transformer
( line: Line, transform: Transformer, mode: Mode, features: Collection[Feature], *, li
src/black/linegen.py:1504
↓ 1 callers
Function
schedule_formatting
Run formatting of `sources` in parallel using the provided `executor`. (Use ProcessPoolExecutors for actual parallelism.) `write_back`, `fas
src/black/concurrency.py:119
↓ 1 callers
Method
setup
Prepare for parsing. This *must* be called before starting to parse. The optional argument is an alternative start symbol; it
src/blib2to3/pgen2/parse.py:214
↓ 1 callers
Method
shift
Shift a token. (Internal)
src/blib2to3/pgen2/parse.py:355
↓ 1 callers
Function
should_split_line
Should `line` be immediately split with `delimiter_split()` after RHS?
src/black/linegen.py:1401
← previous
next →
301–400 of 1,067, ranked by callers