<commit_before>import inspect
from textwrap import fill, indent


# TODO contents of columns
# TODO explain categorical
# TODO handle color
# TODO handle details of box/violin/histogram
# TODO handle details of column selection with `dimensions`
# TODO document "or `None`, default `None`" in various places
# TODO standardize positioning and casing of 'default'

colref = (
    "str or int or Series or array-like",
    "Either a name of a column in `data_frame`, or a pandas Series or array_like object.",
)

colref_list = (
    "list of str or int, or Series or array-like",
    "Either names of columns in `data_frame`, or pandas Series, or array_like objects",
)

docs = dict(
    data_frame=[
        "DataFrame or array-like or dict",
        "This argument needs to be passed for column names (and not keyword names) to be used.",
        "Array-like and dict are tranformed internally to a pandas DataFrame.",
    ],
    x=[
        *colref,
        "Values from this column or array_like are used to position marks along the x axis in cartesian coordinates.",
        "For horizontal `histogram`s, these values are used as inputs to `histfunc`.",
    ],
    y=[
        *colref,
        "Values from this column or array_like are used to position marks along the y axis in cartesian coordinates.",
        "For vertical `histogram`s, these values are used as inputs to `histfunc`.",
    ],
    z=[
        *colref,
        "Values from this column or array_like are used to position marks along the z axis in cartesian coordinates.",
        "For `density_heatmap` and `density_contour` these values are used as the inputs to `histfunc`.",
    ],
    a=[
        *colref,
        "Values from this column or array_like are used to position marks along the a axis in ternary coordinates.",
    ],
    b=[
        *colref,
        "Values from this column or array_like are used to position marks along the b axis in ternary coordinates.",
    ],
    c=[
        *colref,
        "Values from this column or array_like are used to position marks along the c axis in ternary coordinates.",
    ],
    r=[
        *colref,
        "Values from this column or array_like are used to position marks along the radial axis in polar coordinates.",
    ],
    theta=[
        *colref,
        "Values from this column or array_like are used to position marks along the angular axis in polar coordinates.",
    ],
    lat=[
        *colref,
        "Values from this column or array_like are used to position marks according to latitude on a map.",
    ],
    lon=[
        *colref,
        "Values from this column or array_like are used to position marks according to longitude on a map.",
    ],
    locations=[
        *colref,
        "Values from this column or array_like are to be interpreted according to `locationmode` and mapped to longitude/latitude.",
    ],
    dimensions=[
        "list of str",
        "Names of columns in `data_frame` to be used in multidimensional visualization.",
    ],
    error_x=[
        *colref,
        "Values from this column or array_like are used to size x-axis error bars.",
        "If `error_x_minus` is `None`, error bars will be symmetrical, otherwise `error_x` is used for the positive direction only.",
    ],
    error_x_minus=[
        *colref,
        "Values from this column or array_like are used to size x-axis error bars in the negative direction.",
        "Ignored if `error_x` is `None`.",
    ],
    error_y=[
        *colref,
        "Values from this column or array_like are used to size y-axis error bars.",
        "If `error_y_minus` is `None`, error bars will be symmetrical, otherwise `error_y` is used for the positive direction only.",
    ],
    error_y_minus=[
        *colref,
        "Values from this column or array_like are used to size y-axis error bars in the negative direction.",
        "Ignored if `error_y` is `None`.",
    ],
    error_z=[
        *colref,
        "Values from this column or array_like are used to size z-axis error bars.",
        "If `error_z_minus` is `None`, error bars will be symmetrical, otherwise `error_z` is used for the positive direction only.",
    ],
    error_z_minus=[
        *colref,
        "Values from this column or array_like are used to size z-axis error bars in the negative direction.",
        "Ignored if `error_z` is `None`.",
    ],
    color=[
        *colref,
        "Values from this column or array_like are used to assign color to marks.",
    ],
    opacity=["float", "Value between 0 and 1. Sets the opacity for markers."],
    line_dash=[
        *colref,
        "Values from this column or array_like are used to assign dash-patterns to lines.",
    ],
    line_group=[
        *colref,
        "Values from this column or array_like are used to group rows of `data_frame` into lines.",
    ],
    symbol=[
        *colref,
        "Values from this column or array_like are used to assign symbols to marks.",
    ],
    size=[
        *colref,
        "Values from this column or array_like are used to assign mark sizes.",
    ],
    hover_name=[
        *colref,
        "Values from this column or array_like appear in bold in the hover tooltip.",
    ],
    hover_data=[
        *colref_list,
        "Values from these columns appear as extra data in the hover tooltip.",
    ],
    custom_data=[
        *colref_list,
        "Values from these columns are extra data, to be used in widgets or Dash callbacks for example. This data is not user-visible but is included in events emitted by the figure (lasso selection etc.)",
    ],
    text=[
        *colref,
        "Values from this column or array_like appear in the figure as text labels.",
    ],
    locationmode=[
        "str",
        "One of 'ISO-3', 'USA-states', or 'country names'",
        "Determines the set of locations used to match entries in `locations` to regions on the map.",
    ],
    facet_row=[
        *colref,
        "Values from this column or array_like are used to assign marks to facetted subplots in the vertical direction.",
    ],
    facet_col=[
        *colref,
        "Values from this column or array_like are used to assign marks to facetted subplots in the horizontal direction.",
    ],
    animation_frame=[
        *colref,
        "Values from this column or array_like are used to assign marks to animation frames.",
    ],
    animation_group=[
        *colref,
        "Values from this column or array_like are used to provide object-constancy across animation frames: rows with matching `animation_group`s will be treated as if they describe the same object in each frame.",
    ],
    symbol_sequence=[
        "list of str",
        "Strings should define valid plotly.js symbols.",
        "When `symbol` is set, values in that column are assigned symbols by cycling through `symbol_sequence` in the order described in `category_orders`, unless the value of `symbol` is a key in `symbol_map`.",
    ],
    symbol_map=[
        "dict with str keys and str values (default `{}`)",
        "String values should define plotly.js symbols",
        "Used to override `symbol_sequence` to assign a specific symbols to marks corresponding with specific values.",
        "Keys in `symbol_map` should be values in the column denoted by `symbol`.",
    ],
    line_dash_map=[
        "dict with str keys and str values (default `{}`)",
        "Strings values define plotly.js dash-patterns.",
        "Used to override `line_dash_sequences` to assign a specific dash-patterns to lines corresponding with specific values.",
        "Keys in `line_dash_map` should be values in the column denoted by `line_dash`.",
    ],
    line_dash_sequence=[
        "list of str",
        "Strings should define valid plotly.js dash-patterns.",
        "When `line_dash` is set, values in that column are assigned dash-patterns by cycling through `line_dash_sequence` in the order described in `category_orders`, unless the value of `line_dash` is a key in `line_dash_map`.",
    ],<commit_msg>Reformat colref variables to support Python2.7<commit_after>import inspect
from textwrap import fill, indent


# TODO contents of columns
# TODO explain categorical
# TODO handle color
# TODO handle details of box/violin/histogram
# TODO handle details of column selection with `dimensions`
# TODO document "or `None`, default `None`" in various places
# TODO standardize positioning and casing of 'default'

colref_type = "str or int or Series or array-like"
colref_desc = "Either a name of a column in `data_frame`, or a pandas Series or array_like object."
colref_list_type = "list of str or int, or Series or array-like"
colref_list_desc = "Either names of columns in `data_frame`, or pandas Series, or array_like objects"

docs = dict(
    data_frame=[
        "DataFrame or array-like or dict",
        "This argument needs to be passed for column names (and not keyword names) to be used.",
        "Array-like and dict are tranformed internally to a pandas DataFrame.",
    ],
    x=[
        colref_type, colref_desc,
        "Values from this column or array_like are used to position marks along the x axis in cartesian coordinates.",
        "For horizontal `histogram`s, these values are used as inputs to `histfunc`.",
    ],
    y=[
        colref_type, colref_desc,
        "Values from this column or array_like are used to position marks along the y axis in cartesian coordinates.",
        "For vertical `histogram`s, these values are used as inputs to `histfunc`.",
    ],
    z=[
        colref_type, colref_desc,
        "Values from this column or array_like are used to position marks along the z axis in cartesian coordinates.",
        "For `density_heatmap` and `density_contour` these values are used as the inputs to `histfunc`.",
    ],
    a=[
        colref_type, colref_desc,
        "Values from this column or array_like are used to position marks along the a axis in ternary coordinates.",
    ],
    b=[
        colref_type, colref_desc,
        "Values from this column or array_like are used to position marks along the b axis in ternary coordinates.",
    ],
    c=[
        colref_type, colref_desc,
        "Values from this column or array_like are used to position marks along the c axis in ternary coordinates.",
    ],
    r=[
        colref_type, colref_desc,
        "Values from this column or array_like are used to position marks along the radial axis in polar coordinates.",
    ],
    theta=[
        colref_type, colref_desc,
        "Values from this column or array_like are used to position marks along the angular axis in polar coordinates.",
    ],
    lat=[
        colref_type, colref_desc,
        "Values from this column or array_like are used to position marks according to latitude on a map.",
    ],
    lon=[
        colref_type, colref_desc,
        "Values from this column or array_like are used to position marks according to longitude on a map.",
    ],
    locations=[
        colref_type, colref_desc,
        "Values from this column or array_like are to be interpreted according to `locationmode` and mapped to longitude/latitude.",
    ],
    dimensions=[
        "list of str",
        "Names of columns in `data_frame` to be used in multidimensional visualization.",
    ],
    error_x=[
        colref_type, colref_desc,
        "Values from this column or array_like are used to size x-axis error bars.",
        "If `error_x_minus` is `None`, error bars will be symmetrical, otherwise `error_x` is used for the positive direction only.",
    ],
    error_x_minus=[
        colref_type, colref_desc,
        "Values from this column or array_like are used to size x-axis error bars in the negative direction.",
        "Ignored if `error_x` is `None`.",
    ],
    error_y=[
        colref_type, colref_desc,
        "Values from this column or array_like are used to size y-axis error bars.",
        "If `error_y_minus` is `None`, error bars will be symmetrical, otherwise `error_y` is used for the positive direction only.",
    ],
    error_y_minus=[
        colref_type, colref_desc,
        "Values from this column or array_like are used to size y-axis error bars in the negative direction.",
        "Ignored if `error_y` is `None`.",
    ],
    error_z=[
        colref_type, colref_desc,
        "Values from this column or array_like are used to size z-axis error bars.",
        "If `error_z_minus` is `None`, error bars will be symmetrical, otherwise `error_z` is used for the positive direction only.",
    ],
    error_z_minus=[
        colref_type, colref_desc,
        "Values from this column or array_like are used to size z-axis error bars in the negative direction.",
        "Ignored if `error_z` is `None`.",
    ],
    color=[
        colref_type, colref_desc,
        "Values from this column or array_like are used to assign color to marks.",
    ],
    opacity=["float", "Value between 0 and 1. Sets the opacity for markers."],
    line_dash=[
        colref_type, colref_desc,
        "Values from this column or array_like are used to assign dash-patterns to lines.",
    ],
    line_group=[
        colref_type, colref_desc,
        "Values from this column or array_like are used to group rows of `data_frame` into lines.",
    ],
    symbol=[
        colref_type, colref_desc,
        "Values from this column or array_like are used to assign symbols to marks.",
    ],
    size=[
        colref_type, colref_desc,
        "Values from this column or array_like are used to assign mark sizes.",
    ],
    hover_name=[
        colref_type, colref_desc,
        "Values from this column or array_like appear in bold in the hover tooltip.",
    ],
    hover_data=[
        colref_list_type, colref_list_desc,
        "Values from these columns appear as extra data in the hover tooltip.",
    ],
    custom_data=[
        colref_list_type, colref_list_desc,
        "Values from these columns are extra data, to be used in widgets or Dash callbacks for example. This data is not user-visible but is included in events emitted by the figure (lasso selection etc.)",
    ],
    text=[
        colref_type, colref_desc,
        "Values from this column or array_like appear in the figure as text labels.",
    ],
    locationmode=[
        "str",
        "One of 'ISO-3', 'USA-states', or 'country names'",
        "Determines the set of locations used to match entries in `locations` to regions on the map.",
    ],
    facet_row=[
        colref_type, colref_desc,
        "Values from this column or array_like are used to assign marks to facetted subplots in the vertical direction.",
    ],
    facet_col=[
        colref_type, colref_desc,
        "Values from this column or array_like are used to assign marks to facetted subplots in the horizontal direction.",
    ],
    animation_frame=[
        colref_type, colref_desc,
        "Values from this column or array_like are used to assign marks to animation frames.",
    ],
    animation_group=[
        colref_type, colref_desc,
        "Values from this column or array_like are used to provide object-constancy across animation frames: rows with matching `animation_group`s will be treated as if they describe the same object in each frame.",
    ],
    symbol_sequence=[
        "list of str",
        "Strings should define valid plotly.js symbols.",
        "When `symbol` is set, values in that column are assigned symbols by cycling through `symbol_sequence` in the order described in `category_orders`, unless the value of `symbol` is a key in `symbol_map`.",
    ],
    symbol_map=[
        "dict with str keys and str values (default `{}`)",
        "String values should define plotly.js symbols",
        "Used to override `symbol_sequence` to assign a specific symbols to marks corresponding with specific values.",
        "Keys in `symbol_map` should be values in the column denoted by `symbol`.",
    ],
    line_dash_map=[
        "dict with str keys and str values (default `{}`)",
        "Strings values define plotly.js dash-patterns.",
        "Used to override `line_dash_sequences` to assign a specific dash-patterns to lines corresponding with specific values.",
        "Keys in `line_dash_map` should be values in the column denoted by `line_dash`.",
    ],
    line_dash_sequence=[
        "list of str",
        "Strings should define valid plotly.js dash-patterns.",
        "When `line_dash` is set, values in that column are assigned dash-patterns by cycling through `line_dash_sequence` in the order described in `category_orders`, unless the value of `line_dash` is a key in `line_dash_map`.",
    ],
{'fraction_non_alphanumeric': 0.07853151475094634, 'fraction_numerical': 0.0004806825692483326, 'mean_word_length': 2.779291553133515, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3622252', 'n_tokens_mistral': 4508, 'n_tokens_neox': 4433, 'n_words': 2055}