index int64 0 50.7k | project_path stringclasses 279
values | completion_path stringlengths 57 199 | signature_postion stringlengths 3 11 | class_position stringlengths 3 11 | function_name stringlengths 1 62 | class_name stringlengths 0 55 | body_position stringlengths 3 11 | body_position_with_comments stringlengths 3 11 | masked_class stringlengths 14 8.32k | masked_class_with_comment stringlengths 14 8.32k | func_body stringlengths 9 6.72k | func_body_with_comment stringlengths 9 6.72k | len_func_body int64 1 643 | len_input int64 10 2.02k | len_output int64 4 1.9k | total int64 20 2.05k | file_code stringlengths 14 442k | file_code_with_comment stringlengths 14 442k |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
27,413 | /home/hieuvd/dung_repo/raw/stars_01/ydataai_ydata-profiling/ydata-profiling | /home/hieuvd/dung_repo/raw/stars_01/ydataai_ydata-profiling/ydata-profiling/src/ydata_profiling/model/typeset.py | 78,80 | 60,98 | get_relations | Numeric | 80,91 | 80,91 | class Numeric(visions.VisionsBaseType):
"""Type for all numeric (float, int) columns.
Can be transformed from
- Unsupported
- String
Examples
--------
>>> s = pd.Series([1, 2, 5, 3, 8, 9])
>>> s in Numeric
True
>>> s = pd.Series([.34... | class Numeric(visions.VisionsBaseType):
"""Type for all numeric (float, int) columns.
Can be transformed from
- Unsupported
- String
Examples
--------
>>> s = pd.Series([1, 2, 5, 3, 8, 9])
>>> s in Numeric
True
>>> s = pd.Series([.34... | return [
IdentityRelation(Unsupported),
InferenceRelation(
Text,
relationship=lambda x, y: partial(string_is_numeric, k=config)(
x, y
),
transformer=string_to_numeric,
... | return [
IdentityRelation(Unsupported),
InferenceRelation(
Text,
relationship=lambda x, y: partial(string_is_numeric, k=config)(
x, y
),
transformer=string_to_numeric,
... | 16 | 257 | 84 | 341 | import datetime
import imghdr
import os
import warnings
from functools import partial, wraps
from typing import Callable, Sequence, Set
from urllib.parse import urlparse
import pandas as pd
import visions
from multimethod import multimethod
from pandas.api import types as pdt
from visions.backends.pandas.series_utils ... | import datetime
import imghdr
import os
import warnings
from functools import partial, wraps
from typing import Callable, Sequence, Set
from urllib.parse import urlparse
import pandas as pd
import visions
from multimethod import multimethod
from pandas.api import types as pdt
from visions.backends.pandas.series_utils ... |
27,414 | /home/hieuvd/dung_repo/raw/stars_01/ydataai_ydata-profiling/ydata-profiling | /home/hieuvd/dung_repo/raw/stars_01/ydataai_ydata-profiling/ydata-profiling/src/ydata_profiling/model/typeset.py | 268,272 | 263,278 | contains_op | Path | 272,278 | 272,278 | class Path(visions.VisionsBaseType):
@staticmethod
def get_relations() -> Sequence[TypeRelation]:
return [IdentityRelation(Text)]
@staticmethod
@multimethod
@series_handle_nulls
def contains_op(series: pd.Series, state: dict) -> bool:
FILL_FUNC_BODY | class Path(visions.VisionsBaseType):
@staticmethod
def get_relations() -> Sequence[TypeRelation]:
return [IdentityRelation(Text)]
@staticmethod
@multimethod
@series_handle_nulls
def contains_op(series: pd.Series, state: dict) -> bool:
FILL_FUNC_BODY | # TODO: use coercion utils
try:
return all(os.path.isabs(p) for p in series)
except TypeError:
return False
| # TODO: use coercion utils
try:
return all(os.path.isabs(p) for p in series)
except TypeError:
return False
| 16 | 97 | 51 | 148 | import datetime
import imghdr
import os
import warnings
from functools import partial, wraps
from typing import Callable, Sequence, Set
from urllib.parse import urlparse
import pandas as pd
import visions
from multimethod import multimethod
from pandas.api import types as pdt
from visions.backends.pandas.series_utils ... | import datetime
import imghdr
import os
import warnings
from functools import partial, wraps
from typing import Callable, Sequence, Set
from urllib.parse import urlparse
import pandas as pd
import visions
from multimethod import multimethod
from pandas.api import types as pdt
from visions.backends.pandas.series_utils ... |
27,415 | /home/hieuvd/dung_repo/raw/stars_01/ydataai_ydata-profiling/ydata-profiling | /home/hieuvd/dung_repo/raw/stars_01/ydataai_ydata-profiling/ydata-profiling/src/ydata_profiling/model/typeset.py | 357,358 | 342,362 | _get_type | ProfilingTypeSet | 358,362 | 358,362 | class ProfilingTypeSet(visions.VisionsTypeset):
def __init__(self, config: Settings, type_schema: dict = None):
self.config = config
types = typeset_types(config)
with warnings.catch_warnings():
warnings.filterwarnings("ignore", category=UserWarning)
super().__init_... | class ProfilingTypeSet(visions.VisionsTypeset):
def __init__(self, config: Settings, type_schema: dict = None):
self.config = config
types = typeset_types(config)
with warnings.catch_warnings():
warnings.filterwarnings("ignore", category=UserWarning)
super().__init_... | for t in self.types:
if t.__name__.lower() == type_name.lower():
return t
raise ValueError(f"Type [{type_name}] not found.")
| for t in self.types:
if t.__name__.lower() == type_name.lower():
return t
raise ValueError(f"Type [{type_name}] not found.")
| 15 | 199 | 52 | 251 | import datetime
import imghdr
import os
import warnings
from functools import partial, wraps
from typing import Callable, Sequence, Set
from urllib.parse import urlparse
import pandas as pd
import visions
from multimethod import multimethod
from pandas.api import types as pdt
from visions.backends.pandas.series_utils ... | import datetime
import imghdr
import os
import warnings
from functools import partial, wraps
from typing import Callable, Sequence, Set
from urllib.parse import urlparse
import pandas as pd
import visions
from multimethod import multimethod
from pandas.api import types as pdt
from visions.backends.pandas.series_utils ... |
27,416 | /home/hieuvd/dung_repo/raw/stars_01/ydataai_ydata-profiling/ydata-profiling | /home/hieuvd/dung_repo/raw/stars_01/ydataai_ydata-profiling/ydata-profiling/src/ydata_profiling/model/typeset.py | 119,124 | 98,130 | contains_op | Text | 124,130 | 124,130 | class Text(visions.VisionsBaseType):
"""Type for plaintext columns.
Like name, note, string identifier, residence etc.
Examples
--------
>>> s = pd.Series(["AX01", "BC32", "AC00"])
>>> s in Categorical
True
>>> s = pd.Series([1, 2, 3, 4])
>>>... | class Text(visions.VisionsBaseType):
"""Type for plaintext columns.
Like name, note, string identifier, residence etc.
Examples
--------
>>> s = pd.Series(["AX01", "BC32", "AC00"])
>>> s in Categorical
True
>>> s = pd.Series([1, 2, 3, 4])
>>>... | return (
not pdt.is_categorical_dtype(series)
and pdt.is_string_dtype(series)
and series_is_string(series, state)
)
| return (
not pdt.is_categorical_dtype(series)
and pdt.is_string_dtype(series)
and series_is_string(series, state)
)
| 10 | 216 | 59 | 275 | import datetime
import imghdr
import os
import warnings
from functools import partial, wraps
from typing import Callable, Sequence, Set
from urllib.parse import urlparse
import pandas as pd
import visions
from multimethod import multimethod
from pandas.api import types as pdt
from visions.backends.pandas.series_utils ... | import datetime
import imghdr
import os
import warnings
from functools import partial, wraps
from typing import Callable, Sequence, Set
from urllib.parse import urlparse
import pandas as pd
import visions
from multimethod import multimethod
from pandas.api import types as pdt
from visions.backends.pandas.series_utils ... |
27,417 | /home/hieuvd/dung_repo/raw/stars_01/ydataai_ydata-profiling/ydata-profiling | /home/hieuvd/dung_repo/raw/stars_01/ydataai_ydata-profiling/ydata-profiling/src/ydata_profiling/model/typeset.py | 310,311 | 300,325 | is_timedependent | TimeSeries | 311,322 | 311,322 | class TimeSeries(visions.VisionsBaseType):
@staticmethod
def get_relations() -> Sequence[TypeRelation]:
return [IdentityRelation(Numeric)]
@staticmethod
@multimethod
@series_not_empty
@series_handle_nulls
def contains_op(series: pd.Series, state: ... | class TimeSeries(visions.VisionsBaseType):
@staticmethod
def get_relations() -> Sequence[TypeRelation]:
return [IdentityRelation(Numeric)]
@staticmethod
@multimethod
@series_not_empty
@series_handle_nulls
def contains_op(series: pd.Series, state: ... | autocorrelation_threshold = config.vars.timeseries.autocorrelation
lags = config.vars.timeseries.lags
with warnings.catch_warnings():
warnings.simplefilter("ignore", RuntimeWarning)
for lag in lags:
autcorr =... | autocorrelation_threshold = config.vars.timeseries.autocorrelation
lags = config.vars.timeseries.lags
with warnings.catch_warnings():
warnings.simplefilter("ignore", RuntimeWarning)
for lag in lags:
autcorr =... | 25 | 178 | 118 | 296 | import datetime
import imghdr
import os
import warnings
from functools import partial, wraps
from typing import Callable, Sequence, Set
from urllib.parse import urlparse
import pandas as pd
import visions
from multimethod import multimethod
from pandas.api import types as pdt
from visions.backends.pandas.series_utils ... | import datetime
import imghdr
import os
import warnings
from functools import partial, wraps
from typing import Callable, Sequence, Set
from urllib.parse import urlparse
import pandas as pd
import visions
from multimethod import multimethod
from pandas.api import types as pdt
from visions.backends.pandas.series_utils ... |
27,418 | /home/hieuvd/dung_repo/raw/stars_01/ydataai_ydata-profiling/ydata-profiling | /home/hieuvd/dung_repo/raw/stars_01/ydataai_ydata-profiling/ydata-profiling/src/ydata_profiling/model/typeset.py | 252,256 | 247,263 | contains_op | URL | 256,263 | 256,263 | class URL(visions.VisionsBaseType):
@staticmethod
def get_relations() -> Sequence[TypeRelation]:
return [IdentityRelation(Text)]
@staticmethod
@multimethod
@series_handle_nulls
def contains_op(series: pd.Series, state: dict) -> bool:
FILL_FUNC_BODY | class URL(visions.VisionsBaseType):
@staticmethod
def get_relations() -> Sequence[TypeRelation]:
return [IdentityRelation(Text)]
@staticmethod
@multimethod
@series_handle_nulls
def contains_op(series: pd.Series, state: dict) -> bool:
FILL_FUNC_BODY | # TODO: use coercion utils
try:
url_gen = (urlparse(x) for x in series)
return all(x.netloc and x.scheme for x in url_gen) # noqa: TC300
except AttributeError:
return False
| # TODO: use coercion utils
try:
url_gen = (urlparse(x) for x in series)
return all(x.netloc and x.scheme for x in url_gen) # noqa: TC300
except AttributeError:
return False
| 28 | 97 | 82 | 179 | import datetime
import imghdr
import os
import warnings
from functools import partial, wraps
from typing import Callable, Sequence, Set
from urllib.parse import urlparse
import pandas as pd
import visions
from multimethod import multimethod
from pandas.api import types as pdt
from visions.backends.pandas.series_utils ... | import datetime
import imghdr
import os
import warnings
from functools import partial, wraps
from typing import Callable, Sequence, Set
from urllib.parse import urlparse
import pandas as pd
import visions
from multimethod import multimethod
from pandas.api import types as pdt
from visions.backends.pandas.series_utils ... |
27,419 | /home/hieuvd/dung_repo/raw/stars_01/ydataai_ydata-profiling/ydata-profiling | /home/hieuvd/dung_repo/raw/stars_01/ydataai_ydata-profiling/ydata-profiling/src/ydata_profiling/model/typeset_relations.py | 90,92 | 1,144 | string_is_datetime | 93,99 | 92,99 | import functools
from typing import Callable, Dict
import numpy as np
import pandas as pd
from pandas.api import types as pdt
from visions.backends.pandas.series_utils import series_handle_nulls
from ydata_profiling.config import Settings
from ydata_profiling.utils.versions import is_pandas_1
def is_nullable(series... | import functools
from typing import Callable, Dict
import numpy as np
import pandas as pd
from pandas.api import types as pdt
from visions.backends.pandas.series_utils import series_handle_nulls
from ydata_profiling.config import Settings
from ydata_profiling.utils.versions import is_pandas_1
def is_nullable(series... | try:
return not string_to_datetime(series, state).isna().all()
except: # noqa: E722
return False
| """If we can transform data to datetime and at least one is valid date."""
try:
return not string_to_datetime(series, state).isna().all()
except: # noqa: E722
return False
| 11 | 1,381 | 49 | 1,430 | import functools
from typing import Callable, Dict
import numpy as np
import pandas as pd
from pandas.api import types as pdt
from visions.backends.pandas.series_utils import series_handle_nulls
from ydata_profiling.config import Settings
from ydata_profiling.utils.versions import is_pandas_1
def is_nullable(series... | import functools
from typing import Callable, Dict
import numpy as np
import pandas as pd
from pandas.api import types as pdt
from visions.backends.pandas.series_utils import series_handle_nulls
from ydata_profiling.config import Settings
from ydata_profiling.utils.versions import is_pandas_1
def is_nullable(series... | |
27,421 | /home/hieuvd/dung_repo/raw/stars_01/ydataai_ydata-profiling/ydata-profiling | /home/hieuvd/dung_repo/raw/stars_01/ydataai_ydata-profiling/ydata-profiling/src/ydata_profiling/report/presentation/core/alerts.py | 17,18 | 8,19 | render | Alerts | 18,19 | 18,19 | class Alerts(ItemRenderer):
def __init__(
self, alerts: Union[List[Alert], Dict[str, List[Alert]]], style: Style, **kwargs
):
super().__init__("alerts", {"alerts": alerts, "style": style}, **kwargs)
def __repr__(self):
return "Alerts"
def render(self) -> Any:
FILL_FUNC_BODY | class Alerts(ItemRenderer):
def __init__(
self, alerts: Union[List[Alert], Dict[str, List[Alert]]], style: Style, **kwargs
):
super().__init__("alerts", {"alerts": alerts, "style": style}, **kwargs)
def __repr__(self):
return "Alerts"
def render(self) -> Any:
FILL_FUNC_BODY | raise NotImplementedError()
| raise NotImplementedError()
| 2 | 114 | 10 | 124 | from typing import Any, Dict, List, Union
from ydata_profiling.config import Style
from ydata_profiling.model.alerts import Alert
from ydata_profiling.report.presentation.core.item_renderer import ItemRenderer
class Alerts(ItemRenderer):
def __init__(
self, alerts: Union[List[Alert], Dict[str, List[Alert... | from typing import Any, Dict, List, Union
from ydata_profiling.config import Style
from ydata_profiling.model.alerts import Alert
from ydata_profiling.report.presentation.core.item_renderer import ItemRenderer
class Alerts(ItemRenderer):
def __init__(
self, alerts: Union[List[Alert], Dict[str, List[Alert... |
27,422 | /home/hieuvd/dung_repo/raw/stars_01/ydataai_ydata-profiling/ydata-profiling | /home/hieuvd/dung_repo/raw/stars_01/ydataai_ydata-profiling/ydata-profiling/src/ydata_profiling/report/presentation/core/collapse.py | 18,20 | 8,25 | convert_to_class | Collapse | 20,25 | 20,25 | class Collapse(ItemRenderer):
def __init__(self, button: ToggleButton, item: Renderable, **kwargs):
super().__init__("collapse", {"button": button, "item": item}, **kwargs)
def __repr__(self) -> str:
return "Collapse"
def render(self) -> Any:
raise NotImplementedError()
@class... | class Collapse(ItemRenderer):
def __init__(self, button: ToggleButton, item: Renderable, **kwargs):
super().__init__("collapse", {"button": button, "item": item}, **kwargs)
def __repr__(self) -> str:
return "Collapse"
def render(self) -> Any:
raise NotImplementedError()
@class... | obj.__class__ = cls
if "button" in obj.content:
flv(obj.content["button"])
if "item" in obj.content:
flv(obj.content["item"])
| obj.__class__ = cls
if "button" in obj.content:
flv(obj.content["button"])
if "item" in obj.content:
flv(obj.content["item"])
| 13 | 139 | 60 | 199 | from typing import Any, Callable
from ydata_profiling.report.presentation.core.item_renderer import ItemRenderer
from ydata_profiling.report.presentation.core.renderable import Renderable
from ydata_profiling.report.presentation.core.toggle_button import ToggleButton
class Collapse(ItemRenderer):
def __init__(se... | from typing import Any, Callable
from ydata_profiling.report.presentation.core.item_renderer import ItemRenderer
from ydata_profiling.report.presentation.core.renderable import Renderable
from ydata_profiling.report.presentation.core.toggle_button import ToggleButton
class Collapse(ItemRenderer):
def __init__(se... |
27,423 | /home/hieuvd/dung_repo/raw/stars_01/ydataai_ydata-profiling/ydata-profiling | /home/hieuvd/dung_repo/raw/stars_01/ydataai_ydata-profiling/ydata-profiling/src/ydata_profiling/report/presentation/core/container.py | 40,42 | 6,46 | convert_to_class | Container | 42,46 | 42,46 | class Container(Renderable):
def __init__(
self,
items: Sequence[Renderable],
sequence_type: str,
nested: bool = False,
name: Optional[str] = None,
anchor_id: Optional[str] = None,
classes: Optional[str] = None,
**kwargs,
):
args = {"items"... | class Container(Renderable):
def __init__(
self,
items: Sequence[Renderable],
sequence_type: str,
nested: bool = False,
name: Optional[str] = None,
anchor_id: Optional[str] = None,
classes: Optional[str] = None,
**kwargs,
):
args = {"items"... | obj.__class__ = cls
if "items" in obj.content:
for item in obj.content["items"]:
flv(item)
| obj.__class__ = cls
if "items" in obj.content:
for item in obj.content["items"]:
flv(item)
| 12 | 347 | 43 | 390 | from typing import Any, Callable, Optional, Sequence
from ydata_profiling.report.presentation.core.renderable import Renderable
class Container(Renderable):
def __init__(
self,
items: Sequence[Renderable],
sequence_type: str,
nested: bool = False,
name: Optional[str] = Non... | from typing import Any, Callable, Optional, Sequence
from ydata_profiling.report.presentation.core.renderable import Renderable
class Container(Renderable):
def __init__(
self,
items: Sequence[Renderable],
sequence_type: str,
nested: bool = False,
name: Optional[str] = Non... |
27,424 | /home/hieuvd/dung_repo/raw/stars_01/ydataai_ydata-profiling/ydata-profiling | /home/hieuvd/dung_repo/raw/stars_01/ydataai_ydata-profiling/ydata-profiling/src/ydata_profiling/report/presentation/core/correlation_table.py | 20,21 | 8,22 | render | CorrelationTable | 21,22 | 21,22 | class CorrelationTable(ItemRenderer):
def __init__(self, name: str, correlation_matrix: pd.DataFrame, **kwargs):
super().__init__(
"correlation_table",
{"correlation_matrix": correlation_matrix},
name=name,
**kwargs
)
def __repr__(self) -> str:
... | class CorrelationTable(ItemRenderer):
def __init__(self, name: str, correlation_matrix: pd.DataFrame, **kwargs):
super().__init__(
"correlation_table",
{"correlation_matrix": correlation_matrix},
name=name,
**kwargs
)
def __repr__(self) -> str:
... | raise NotImplementedError()
| raise NotImplementedError()
| 2 | 118 | 10 | 128 | from typing import Any
import pandas as pd
from ydata_profiling.report.presentation.core.item_renderer import ItemRenderer
class CorrelationTable(ItemRenderer):
def __init__(self, name: str, correlation_matrix: pd.DataFrame, **kwargs):
super().__init__(
"correlation_table",
{"cor... | from typing import Any
import pandas as pd
from ydata_profiling.report.presentation.core.item_renderer import ItemRenderer
class CorrelationTable(ItemRenderer):
def __init__(self, name: str, correlation_matrix: pd.DataFrame, **kwargs):
super().__init__(
"correlation_table",
{"cor... |
27,425 | /home/hieuvd/dung_repo/raw/stars_01/ydataai_ydata-profiling/ydata-profiling | /home/hieuvd/dung_repo/raw/stars_01/ydataai_ydata-profiling/ydata-profiling/src/ydata_profiling/report/presentation/core/dropdown.py | 40,42 | 8,45 | convert_to_class | Dropdown | 42,45 | 42,45 | class Dropdown(ItemRenderer):
def __init__(
self,
name: str,
id: str,
items: list,
item: Container,
anchor_id: str,
classes: list,
is_row: bool,
**kwargs
):
super().__init__(
"dropdown",
{
"na... | class Dropdown(ItemRenderer):
def __init__(
self,
name: str,
id: str,
items: list,
item: Container,
anchor_id: str,
classes: list,
is_row: bool,
**kwargs
):
super().__init__(
"dropdown",
{
"na... | obj.__class__ = cls
if "item" in obj.content:
flv(obj.content["item"])
| obj.__class__ = cls
if "item" in obj.content:
flv(obj.content["item"])
| 8 | 244 | 35 | 279 | from typing import Any, Callable
from ydata_profiling.report.presentation.core.container import Container
from ydata_profiling.report.presentation.core.item_renderer import ItemRenderer
from ydata_profiling.report.presentation.core.renderable import Renderable
class Dropdown(ItemRenderer):
def __init__(
... | from typing import Any, Callable
from ydata_profiling.report.presentation.core.container import Container
from ydata_profiling.report.presentation.core.item_renderer import ItemRenderer
from ydata_profiling.report.presentation.core.renderable import Renderable
class Dropdown(ItemRenderer):
def __init__(
... |
27,426 | /home/hieuvd/dung_repo/raw/stars_01/ydataai_ydata-profiling/ydata-profiling | /home/hieuvd/dung_repo/raw/stars_01/ydataai_ydata-profiling/ydata-profiling/src/ydata_profiling/report/presentation/core/duplicate.py | 15,16 | 8,17 | render | Duplicate | 16,17 | 16,17 | class Duplicate(ItemRenderer):
def __init__(self, name: str, duplicate: pd.DataFrame, **kwargs):
super().__init__("duplicate", {"duplicate": duplicate}, name=name, **kwargs)
def __repr__(self) -> str:
return "Duplicate"
def render(self) -> Any:
FILL_FUNC_BODY | class Duplicate(ItemRenderer):
def __init__(self, name: str, duplicate: pd.DataFrame, **kwargs):
super().__init__("duplicate", {"duplicate": duplicate}, name=name, **kwargs)
def __repr__(self) -> str:
return "Duplicate"
def render(self) -> Any:
FILL_FUNC_BODY | raise NotImplementedError()
| raise NotImplementedError()
| 2 | 98 | 10 | 108 | from typing import Any
import pandas as pd
from ydata_profiling.report.presentation.core.item_renderer import ItemRenderer
class Duplicate(ItemRenderer):
def __init__(self, name: str, duplicate: pd.DataFrame, **kwargs):
super().__init__("duplicate", {"duplicate": duplicate}, name=name, **kwargs)
de... | from typing import Any
import pandas as pd
from ydata_profiling.report.presentation.core.item_renderer import ItemRenderer
class Duplicate(ItemRenderer):
def __init__(self, name: str, duplicate: pd.DataFrame, **kwargs):
super().__init__("duplicate", {"duplicate": duplicate}, name=name, **kwargs)
de... |
27,427 | /home/hieuvd/dung_repo/raw/stars_01/ydataai_ydata-profiling/ydata-profiling | /home/hieuvd/dung_repo/raw/stars_01/ydataai_ydata-profiling/ydata-profiling/src/ydata_profiling/report/presentation/core/frequency_table.py | 13,14 | 6,15 | render | FrequencyTable | 14,15 | 14,15 | class FrequencyTable(ItemRenderer):
def __init__(self, rows: list, redact: bool, **kwargs):
super().__init__("frequency_table", {"rows": rows, "redact": redact}, **kwargs)
def __repr__(self) -> str:
return "FrequencyTable"
def render(self) -> Any:
FILL_FUNC_BODY | class FrequencyTable(ItemRenderer):
def __init__(self, rows: list, redact: bool, **kwargs):
super().__init__("frequency_table", {"rows": rows, "redact": redact}, **kwargs)
def __repr__(self) -> str:
return "FrequencyTable"
def render(self) -> Any:
FILL_FUNC_BODY | raise NotImplementedError()
| raise NotImplementedError()
| 2 | 100 | 10 | 110 | from typing import Any
from ydata_profiling.report.presentation.core.item_renderer import ItemRenderer
class FrequencyTable(ItemRenderer):
def __init__(self, rows: list, redact: bool, **kwargs):
super().__init__("frequency_table", {"rows": rows, "redact": redact}, **kwargs)
def __repr__(self) -> str... | from typing import Any
from ydata_profiling.report.presentation.core.item_renderer import ItemRenderer
class FrequencyTable(ItemRenderer):
def __init__(self, rows: list, redact: bool, **kwargs):
super().__init__("frequency_table", {"rows": rows, "redact": redact}, **kwargs)
def __repr__(self) -> str... |
27,428 | /home/hieuvd/dung_repo/raw/stars_01/ydataai_ydata-profiling/ydata-profiling | /home/hieuvd/dung_repo/raw/stars_01/ydataai_ydata-profiling/ydata-profiling/src/ydata_profiling/report/presentation/core/frequency_table_small.py | 15,16 | 6,17 | render | FrequencyTableSmall | 16,17 | 16,17 | class FrequencyTableSmall(ItemRenderer):
def __init__(self, rows: List[Any], redact: bool, **kwargs):
super().__init__(
"frequency_table_small", {"rows": rows, "redact": redact}, **kwargs
)
def __repr__(self) -> str:
return "FrequencyTableSmall"
def render(self) -> Any:... | class FrequencyTableSmall(ItemRenderer):
def __init__(self, rows: List[Any], redact: bool, **kwargs):
super().__init__(
"frequency_table_small", {"rows": rows, "redact": redact}, **kwargs
)
def __repr__(self) -> str:
return "FrequencyTableSmall"
def render(self) -> Any:... | raise NotImplementedError()
| raise NotImplementedError()
| 2 | 110 | 10 | 120 | from typing import Any, List
from ydata_profiling.report.presentation.core.item_renderer import ItemRenderer
class FrequencyTableSmall(ItemRenderer):
def __init__(self, rows: List[Any], redact: bool, **kwargs):
super().__init__(
"frequency_table_small", {"rows": rows, "redact": redact}, **kwa... | from typing import Any, List
from ydata_profiling.report.presentation.core.item_renderer import ItemRenderer
class FrequencyTableSmall(ItemRenderer):
def __init__(self, rows: List[Any], redact: bool, **kwargs):
super().__init__(
"frequency_table_small", {"rows": rows, "redact": redact}, **kwa... |
27,429 | /home/hieuvd/dung_repo/raw/stars_01/ydataai_ydata-profiling/ydata-profiling | /home/hieuvd/dung_repo/raw/stars_01/ydataai_ydata-profiling/ydata-profiling/src/ydata_profiling/report/presentation/core/html.py | 13,14 | 6,15 | render | HTML | 14,15 | 14,15 | class HTML(ItemRenderer):
def __init__(self, content: str, **kwargs):
super().__init__("html", {"html": content}, **kwargs)
def __repr__(self) -> str:
return "HTML"
def render(self) -> Any:
FILL_FUNC_BODY | class HTML(ItemRenderer):
def __init__(self, content: str, **kwargs):
super().__init__("html", {"html": content}, **kwargs)
def __repr__(self) -> str:
return "HTML"
def render(self) -> Any:
FILL_FUNC_BODY | raise NotImplementedError()
| raise NotImplementedError()
| 2 | 82 | 10 | 92 | from typing import Any
from ydata_profiling.report.presentation.core.item_renderer import ItemRenderer
class HTML(ItemRenderer):
def __init__(self, content: str, **kwargs):
super().__init__("html", {"html": content}, **kwargs)
def __repr__(self) -> str:
return "HTML"
def render(self) ->... | from typing import Any
from ydata_profiling.report.presentation.core.item_renderer import ItemRenderer
class HTML(ItemRenderer):
def __init__(self, content: str, **kwargs):
super().__init__("html", {"html": content}, **kwargs)
def __repr__(self) -> str:
return "HTML"
def render(self) ->... |
27,430 | /home/hieuvd/dung_repo/raw/stars_01/ydataai_ydata-profiling/ydata-profiling | /home/hieuvd/dung_repo/raw/stars_01/ydataai_ydata-profiling/ydata-profiling/src/ydata_profiling/report/presentation/core/image.py | 33,34 | 7,35 | render | Image | 34,35 | 34,35 | class Image(ItemRenderer):
def __init__(
self,
image: str,
image_format: ImageType,
alt: str,
caption: Optional[str] = None,
**kwargs,
):
if image is None:
raise ValueError(f"Image may not be None (alt={alt}, caption={caption})")
super... | class Image(ItemRenderer):
def __init__(
self,
image: str,
image_format: ImageType,
alt: str,
caption: Optional[str] = None,
**kwargs,
):
if image is None:
raise ValueError(f"Image may not be None (alt={alt}, caption={caption})")
super... | raise NotImplementedError()
| raise NotImplementedError()
| 2 | 194 | 10 | 204 | from typing import Any, Optional
from ydata_profiling.config import ImageType
from ydata_profiling.report.presentation.core.item_renderer import ItemRenderer
class Image(ItemRenderer):
def __init__(
self,
image: str,
image_format: ImageType,
alt: str,
caption: Optional[str... | from typing import Any, Optional
from ydata_profiling.config import ImageType
from ydata_profiling.report.presentation.core.item_renderer import ItemRenderer
class Image(ItemRenderer):
def __init__(
self,
image: str,
image_format: ImageType,
alt: str,
caption: Optional[str... |
27,431 | /home/hieuvd/dung_repo/raw/stars_01/ydataai_ydata-profiling/ydata-profiling | /home/hieuvd/dung_repo/raw/stars_01/ydataai_ydata-profiling/ydata-profiling/src/ydata_profiling/report/presentation/core/renderable.py | 40,42 | 5,43 | convert_to_class | Renderable | 42,43 | 42,43 | class Renderable(ABC):
def __init__(
self,
content: Dict[str, Any],
name: Optional[str] = None,
anchor_id: Optional[str] = None,
classes: Optional[str] = None,
):
self.content = content
if name is not None:
self.content["name"] = name
i... | class Renderable(ABC):
def __init__(
self,
content: Dict[str, Any],
name: Optional[str] = None,
anchor_id: Optional[str] = None,
classes: Optional[str] = None,
):
self.content = content
if name is not None:
self.content["name"] = name
i... | obj.__class__ = cls
| obj.__class__ = cls
| 3 | 298 | 10 | 308 | from abc import ABC, abstractmethod
from typing import Any, Callable, Dict, Optional
class Renderable(ABC):
def __init__(
self,
content: Dict[str, Any],
name: Optional[str] = None,
anchor_id: Optional[str] = None,
classes: Optional[str] = None,
):
self.content =... | from abc import ABC, abstractmethod
from typing import Any, Callable, Dict, Optional
class Renderable(ABC):
def __init__(
self,
content: Dict[str, Any],
name: Optional[str] = None,
anchor_id: Optional[str] = None,
classes: Optional[str] = None,
):
self.content =... |
27,432 | /home/hieuvd/dung_repo/raw/stars_01/ydataai_ydata-profiling/ydata-profiling | /home/hieuvd/dung_repo/raw/stars_01/ydataai_ydata-profiling/ydata-profiling/src/ydata_profiling/report/presentation/core/root.py | 29,31 | 8,36 | convert_to_class | Root | 31,36 | 31,36 | class Root(ItemRenderer):
"""
Wrapper for the report.
"""
def __init__(
self, name: str, body: Renderable, footer: Renderable, style: Style, **kwargs
):
super().__init__(
"report",
{"body": body, "footer": footer, "style": style},
name=name,
... | class Root(ItemRenderer):
"""
Wrapper for the report.
"""
def __init__(
self, name: str, body: Renderable, footer: Renderable, style: Style, **kwargs
):
super().__init__(
"report",
{"body": body, "footer": footer, "style": style},
name=name,
... | obj.__class__ = cls
if "body" in obj.content:
flv(obj.content["body"])
if "footer" in obj.content:
flv(obj.content["footer"])
| obj.__class__ = cls
if "body" in obj.content:
flv(obj.content["body"])
if "footer" in obj.content:
flv(obj.content["footer"])
| 13 | 190 | 60 | 250 | from typing import Any, Callable
from ydata_profiling.config import Style
from ydata_profiling.report.presentation.core.item_renderer import ItemRenderer
from ydata_profiling.report.presentation.core.renderable import Renderable
class Root(ItemRenderer):
"""
Wrapper for the report.
"""
def __init__(... | from typing import Any, Callable
from ydata_profiling.config import Style
from ydata_profiling.report.presentation.core.item_renderer import ItemRenderer
from ydata_profiling.report.presentation.core.renderable import Renderable
class Root(ItemRenderer):
"""
Wrapper for the report.
"""
def __init__(... |
27,433 | /home/hieuvd/dung_repo/raw/stars_01/ydataai_ydata-profiling/ydata-profiling | /home/hieuvd/dung_repo/raw/stars_01/ydataai_ydata-profiling/ydata-profiling/src/ydata_profiling/report/presentation/core/sample.py | 19,20 | 8,21 | render | Sample | 20,21 | 20,21 | class Sample(ItemRenderer):
def __init__(
self, name: str, sample: pd.DataFrame, caption: Optional[str] = None, **kwargs
):
super().__init__(
"sample", {"sample": sample, "caption": caption}, name=name, **kwargs
)
def __repr__(self) -> str:
return "Sample"
d... | class Sample(ItemRenderer):
def __init__(
self, name: str, sample: pd.DataFrame, caption: Optional[str] = None, **kwargs
):
super().__init__(
"sample", {"sample": sample, "caption": caption}, name=name, **kwargs
)
def __repr__(self) -> str:
return "Sample"
d... | raise NotImplementedError()
| raise NotImplementedError()
| 2 | 119 | 10 | 129 | from typing import Any, Optional
import pandas as pd
from ydata_profiling.report.presentation.core.item_renderer import ItemRenderer
class Sample(ItemRenderer):
def __init__(
self, name: str, sample: pd.DataFrame, caption: Optional[str] = None, **kwargs
):
super().__init__(
"samp... | from typing import Any, Optional
import pandas as pd
from ydata_profiling.report.presentation.core.item_renderer import ItemRenderer
class Sample(ItemRenderer):
def __init__(
self, name: str, sample: pd.DataFrame, caption: Optional[str] = None, **kwargs
):
super().__init__(
"samp... |
27,434 | /home/hieuvd/dung_repo/raw/stars_01/ydataai_ydata-profiling/ydata-profiling | /home/hieuvd/dung_repo/raw/stars_01/ydataai_ydata-profiling/ydata-profiling/src/ydata_profiling/report/presentation/core/table.py | 25,26 | 7,27 | render | Table | 26,27 | 26,27 | class Table(ItemRenderer):
def __init__(
self,
rows: Sequence,
style: Style,
name: Optional[str] = None,
caption: Optional[str] = None,
**kwargs
):
super().__init__(
"table",
{"rows": rows, "name": name, "caption": caption, "style":... | class Table(ItemRenderer):
def __init__(
self,
rows: Sequence,
style: Style,
name: Optional[str] = None,
caption: Optional[str] = None,
**kwargs
):
super().__init__(
"table",
{"rows": rows, "name": name, "caption": caption, "style":... | raise NotImplementedError()
| raise NotImplementedError()
| 2 | 145 | 10 | 155 | from typing import Any, Optional, Sequence
from ydata_profiling.config import Style
from ydata_profiling.report.presentation.core.item_renderer import ItemRenderer
class Table(ItemRenderer):
def __init__(
self,
rows: Sequence,
style: Style,
name: Optional[str] = None,
capt... | from typing import Any, Optional, Sequence
from ydata_profiling.config import Style
from ydata_profiling.report.presentation.core.item_renderer import ItemRenderer
class Table(ItemRenderer):
def __init__(
self,
rows: Sequence,
style: Style,
name: Optional[str] = None,
capt... |
27,435 | /home/hieuvd/dung_repo/raw/stars_01/ydataai_ydata-profiling/ydata-profiling | /home/hieuvd/dung_repo/raw/stars_01/ydataai_ydata-profiling/ydata-profiling/src/ydata_profiling/report/presentation/core/toggle_button.py | 13,14 | 6,15 | render | ToggleButton | 14,15 | 14,15 | class ToggleButton(ItemRenderer):
def __init__(self, text: str, **kwargs):
super().__init__("toggle_button", {"text": text}, **kwargs)
def __repr__(self) -> str:
return "ToggleButton"
def render(self) -> Any:
FILL_FUNC_BODY | class ToggleButton(ItemRenderer):
def __init__(self, text: str, **kwargs):
super().__init__("toggle_button", {"text": text}, **kwargs)
def __repr__(self) -> str:
return "ToggleButton"
def render(self) -> Any:
FILL_FUNC_BODY | raise NotImplementedError()
| raise NotImplementedError()
| 2 | 88 | 10 | 98 | from typing import Any
from ydata_profiling.report.presentation.core.item_renderer import ItemRenderer
class ToggleButton(ItemRenderer):
def __init__(self, text: str, **kwargs):
super().__init__("toggle_button", {"text": text}, **kwargs)
def __repr__(self) -> str:
return "ToggleButton"
... | from typing import Any
from ydata_profiling.report.presentation.core.item_renderer import ItemRenderer
class ToggleButton(ItemRenderer):
def __init__(self, text: str, **kwargs):
super().__init__("toggle_button", {"text": text}, **kwargs)
def __repr__(self) -> str:
return "ToggleButton"
... |
27,436 | /home/hieuvd/dung_repo/raw/stars_01/ydataai_ydata-profiling/ydata-profiling | /home/hieuvd/dung_repo/raw/stars_01/ydataai_ydata-profiling/ydata-profiling/src/ydata_profiling/report/presentation/core/variable.py | 34,36 | 7,41 | convert_to_class | Variable | 36,41 | 36,41 | class Variable(ItemRenderer):
def __init__(
self,
top: Renderable,
bottom: Optional[Renderable] = None,
ignore: bool = False,
**kwargs,
):
super().__init__(
"variable", {"top": top, "bottom": bottom, "ignore": ignore}, **kwargs
)
def __str... | class Variable(ItemRenderer):
def __init__(
self,
top: Renderable,
bottom: Optional[Renderable] = None,
ignore: bool = False,
**kwargs,
):
super().__init__(
"variable", {"top": top, "bottom": bottom, "ignore": ignore}, **kwargs
)
def __str... | obj.__class__ = cls
if "top" in obj.content and obj.content["top"] is not None:
flv(obj.content["top"])
if "bottom" in obj.content and obj.content["bottom"] is not None:
flv(obj.content["bottom"])
| obj.__class__ = cls
if "top" in obj.content and obj.content["top"] is not None:
flv(obj.content["top"])
if "bottom" in obj.content and obj.content["bottom"] is not None:
flv(obj.content["bottom"])
| 23 | 264 | 80 | 344 | from typing import Any, Callable, Optional
from ydata_profiling.report.presentation.core.item_renderer import ItemRenderer
from ydata_profiling.report.presentation.core.renderable import Renderable
class Variable(ItemRenderer):
def __init__(
self,
top: Renderable,
bottom: Optional[Rendera... | from typing import Any, Callable, Optional
from ydata_profiling.report.presentation.core.item_renderer import ItemRenderer
from ydata_profiling.report.presentation.core.renderable import Renderable
class Variable(ItemRenderer):
def __init__(
self,
top: Renderable,
bottom: Optional[Rendera... |
27,437 | /home/hieuvd/dung_repo/raw/stars_01/ydataai_ydata-profiling/ydata-profiling | /home/hieuvd/dung_repo/raw/stars_01/ydataai_ydata-profiling/ydata-profiling/src/ydata_profiling/report/presentation/core/variable_info.py | 35,36 | 8,37 | render | VariableInfo | 36,37 | 36,37 | class VariableInfo(ItemRenderer):
def __init__(
self,
anchor_id: str,
var_name: str,
var_type: str,
alerts: List[Alert],
description: str,
style: Style,
**kwargs
):
super().__init__(
"variable_info",
{
... | class VariableInfo(ItemRenderer):
def __init__(
self,
anchor_id: str,
var_name: str,
var_type: str,
alerts: List[Alert],
description: str,
style: Style,
**kwargs
):
super().__init__(
"variable_info",
{
... | raise NotImplementedError()
| raise NotImplementedError()
| 2 | 199 | 10 | 209 | from typing import Any, List
from ydata_profiling.config import Style
from ydata_profiling.model.alerts import Alert
from ydata_profiling.report.presentation.core.item_renderer import ItemRenderer
class VariableInfo(ItemRenderer):
def __init__(
self,
anchor_id: str,
var_name: str,
... | from typing import Any, List
from ydata_profiling.config import Style
from ydata_profiling.model.alerts import Alert
from ydata_profiling.report.presentation.core.item_renderer import ItemRenderer
class VariableInfo(ItemRenderer):
def __init__(
self,
anchor_id: str,
var_name: str,
... |
27,438 | /home/hieuvd/dung_repo/raw/stars_01/ydataai_ydata-profiling/ydata-profiling | /home/hieuvd/dung_repo/raw/stars_01/ydataai_ydata-profiling/ydata-profiling/src/ydata_profiling/report/presentation/flavours/flavours.py | 78,79 | 1,154 | HTMLReport | 87,92 | 79,92 | from typing import Callable, Dict, Type
from ydata_profiling.report.presentation.core import Root
from ydata_profiling.report.presentation.core.renderable import Renderable
def apply_renderable_mapping(
mapping: Dict[Type[Renderable], Type[Renderable]],
structure: Renderable,
flavour: Callable,
) -> None... | from typing import Callable, Dict, Type
from ydata_profiling.report.presentation.core import Root
from ydata_profiling.report.presentation.core.renderable import Renderable
def apply_renderable_mapping(
mapping: Dict[Type[Renderable], Type[Renderable]],
structure: Renderable,
flavour: Callable,
) -> None... | mapping = get_html_renderable_mapping()
apply_renderable_mapping(mapping, structure, flavour=HTMLReport)
return structure
| """Adds HTML flavour to Renderable
Args:
structure:
Returns:
"""
mapping = get_html_renderable_mapping()
apply_renderable_mapping(mapping, structure, flavour=HTMLReport)
return structure
| 8 | 1,091 | 42 | 1,133 | from typing import Callable, Dict, Type
from ydata_profiling.report.presentation.core import Root
from ydata_profiling.report.presentation.core.renderable import Renderable
def apply_renderable_mapping(
mapping: Dict[Type[Renderable], Type[Renderable]],
structure: Renderable,
flavour: Callable,
) -> None... | from typing import Callable, Dict, Type
from ydata_profiling.report.presentation.core import Root
from ydata_profiling.report.presentation.core.renderable import Renderable
def apply_renderable_mapping(
mapping: Dict[Type[Renderable], Type[Renderable]],
structure: Renderable,
flavour: Callable,
) -> None... | |
27,439 | /home/hieuvd/dung_repo/raw/stars_01/ydataai_ydata-profiling/ydata-profiling | /home/hieuvd/dung_repo/raw/stars_01/ydataai_ydata-profiling/ydata-profiling/src/ydata_profiling/report/presentation/flavours/html/alerts.py | 6,7 | 5,28 | render | HTMLAlerts | 7,28 | 7,28 | class HTMLAlerts(Alerts):
def render(self) -> str:
FILL_FUNC_BODY | class HTMLAlerts(Alerts):
def render(self) -> str:
FILL_FUNC_BODY | styles = {
"constant": "warning",
"unsupported": "warning",
"type_date": "warning",
"constant_length": "primary",
"high_cardinality": "primary",
"imbalance": "primary",
"unique": "primary",
"uniform": "primary",
... | styles = {
"constant": "warning",
"unsupported": "warning",
"type_date": "warning",
"constant_length": "primary",
"high_cardinality": "primary",
"imbalance": "primary",
"unique": "primary",
"uniform": "primary",
... | 41 | 30 | 215 | 245 | from ydata_profiling.report.presentation.core.alerts import Alerts
from ydata_profiling.report.presentation.flavours.html import templates
class HTMLAlerts(Alerts):
def render(self) -> str:
FILL_FUNC_BODY | from ydata_profiling.report.presentation.core.alerts import Alerts
from ydata_profiling.report.presentation.flavours.html import templates
class HTMLAlerts(Alerts):
def render(self) -> str:
FILL_FUNC_BODY |
27,440 | /home/hieuvd/dung_repo/raw/stars_01/ydataai_ydata-profiling/ydata-profiling | /home/hieuvd/dung_repo/raw/stars_01/ydataai_ydata-profiling/ydata-profiling/src/ydata_profiling/report/presentation/flavours/html/collapse.py | 6,7 | 5,8 | render | HTMLCollapse | 7,8 | 7,8 | class HTMLCollapse(Collapse):
def render(self) -> str:
FILL_FUNC_BODY | class HTMLCollapse(Collapse):
def render(self) -> str:
FILL_FUNC_BODY | return templates.template("collapse.html").render(**self.content)
| return templates.template("collapse.html").render(**self.content)
| 2 | 30 | 19 | 49 | from ydata_profiling.report.presentation.core import Collapse
from ydata_profiling.report.presentation.flavours.html import templates
class HTMLCollapse(Collapse):
def render(self) -> str:
FILL_FUNC_BODY | from ydata_profiling.report.presentation.core import Collapse
from ydata_profiling.report.presentation.flavours.html import templates
class HTMLCollapse(Collapse):
def render(self) -> str:
FILL_FUNC_BODY |
27,441 | /home/hieuvd/dung_repo/raw/stars_01/ydataai_ydata-profiling/ydata-profiling | /home/hieuvd/dung_repo/raw/stars_01/ydataai_ydata-profiling/ydata-profiling/src/ydata_profiling/report/presentation/flavours/html/container.py | 6,7 | 5,45 | render | HTMLContainer | 7,45 | 7,45 | class HTMLContainer(Container):
def render(self) -> str:
FILL_FUNC_BODY | class HTMLContainer(Container):
def render(self) -> str:
FILL_FUNC_BODY | if self.sequence_type in ["list", "accordion"]:
return templates.template("sequence/list.html").render(
anchor_id=self.content["anchor_id"], items=self.content["items"]
)
elif self.sequence_type == "named_list":
return templates.template("sequence/name... | if self.sequence_type in ["list", "accordion"]:
return templates.template("sequence/list.html").render(
anchor_id=self.content["anchor_id"], items=self.content["items"]
)
elif self.sequence_type == "named_list":
return templates.template("sequence/name... | 75 | 28 | 487 | 515 | from ydata_profiling.report.presentation.core.container import Container
from ydata_profiling.report.presentation.flavours.html import templates
class HTMLContainer(Container):
def render(self) -> str:
FILL_FUNC_BODY | from ydata_profiling.report.presentation.core.container import Container
from ydata_profiling.report.presentation.flavours.html import templates
class HTMLContainer(Container):
def render(self) -> str:
FILL_FUNC_BODY |
27,442 | /home/hieuvd/dung_repo/raw/stars_01/ydataai_ydata-profiling/ydata-profiling | /home/hieuvd/dung_repo/raw/stars_01/ydataai_ydata-profiling/ydata-profiling/src/ydata_profiling/report/presentation/flavours/html/correlation_table.py | 6,7 | 5,14 | render | HTMLCorrelationTable | 7,14 | 7,14 | class HTMLCorrelationTable(CorrelationTable):
def render(self) -> str:
FILL_FUNC_BODY | class HTMLCorrelationTable(CorrelationTable):
def render(self) -> str:
FILL_FUNC_BODY | correlation_matrix_html = self.content["correlation_matrix"].to_html(
classes="correlation-table table table-striped",
float_format="{:.3f}".format,
)
return templates.template("correlation_table.html").render(
**self.content, correlation_matrix_html=correlati... | correlation_matrix_html = self.content["correlation_matrix"].to_html(
classes="correlation-table table table-striped",
float_format="{:.3f}".format,
)
return templates.template("correlation_table.html").render(
**self.content, correlation_matrix_html=correlati... | 13 | 32 | 99 | 131 | from ydata_profiling.report.presentation.core.correlation_table import CorrelationTable
from ydata_profiling.report.presentation.flavours.html import templates
class HTMLCorrelationTable(CorrelationTable):
def render(self) -> str:
FILL_FUNC_BODY | from ydata_profiling.report.presentation.core.correlation_table import CorrelationTable
from ydata_profiling.report.presentation.flavours.html import templates
class HTMLCorrelationTable(CorrelationTable):
def render(self) -> str:
FILL_FUNC_BODY |
27,443 | /home/hieuvd/dung_repo/raw/stars_01/ydataai_ydata-profiling/ydata-profiling | /home/hieuvd/dung_repo/raw/stars_01/ydataai_ydata-profiling/ydata-profiling/src/ydata_profiling/report/presentation/flavours/html/dropdown.py | 6,7 | 5,8 | render | HTMLDropdown | 7,8 | 7,8 | class HTMLDropdown(Dropdown):
def render(self) -> str:
FILL_FUNC_BODY | class HTMLDropdown(Dropdown):
def render(self) -> str:
FILL_FUNC_BODY | return templates.template("dropdown.html").render(**self.content)
| return templates.template("dropdown.html").render(**self.content)
| 2 | 30 | 19 | 49 | from ydata_profiling.report.presentation.core import Dropdown
from ydata_profiling.report.presentation.flavours.html import templates
class HTMLDropdown(Dropdown):
def render(self) -> str:
FILL_FUNC_BODY | from ydata_profiling.report.presentation.core import Dropdown
from ydata_profiling.report.presentation.flavours.html import templates
class HTMLDropdown(Dropdown):
def render(self) -> str:
FILL_FUNC_BODY |
27,444 | /home/hieuvd/dung_repo/raw/stars_01/ydataai_ydata-profiling/ydata-profiling | /home/hieuvd/dung_repo/raw/stars_01/ydataai_ydata-profiling/ydata-profiling/src/ydata_profiling/report/presentation/flavours/html/duplicate.py | 7,8 | 1,25 | to_html | 8,19 | 8,19 | import pandas as pd
from ydata_profiling.report.presentation.core.duplicate import Duplicate
from ydata_profiling.report.presentation.flavours.html import templates
def to_html(df: pd.DataFrame) -> str:
FILL_FUNC_BODYclass HTMLDuplicate(Duplicate):
def render(self) -> str:
duplicate_html = to_html(self.c... | import pandas as pd
from ydata_profiling.report.presentation.core.duplicate import Duplicate
from ydata_profiling.report.presentation.flavours.html import templates
def to_html(df: pd.DataFrame) -> str:
FILL_FUNC_BODYclass HTMLDuplicate(Duplicate):
def render(self) -> str:
duplicate_html = to_html(self.c... | html = df.to_html(
classes="duplicate table table-striped",
)
if df.empty:
html = html.replace(
"<tbody>",
f"<tbody><tr><td colspan={len(df.columns) + 1}>Dataset does not contain duplicate rows.</td></tr>",
)
return html
| html = df.to_html(
classes="duplicate table table-striped",
)
if df.empty:
html = html.replace(
"<tbody>",
f"<tbody><tr><td colspan={len(df.columns) + 1}>Dataset does not contain duplicate rows.</td></tr>",
)
return html
| 25 | 150 | 107 | 257 | import pandas as pd
from ydata_profiling.report.presentation.core.duplicate import Duplicate
from ydata_profiling.report.presentation.flavours.html import templates
def to_html(df: pd.DataFrame) -> str:
FILL_FUNC_BODYclass HTMLDuplicate(Duplicate):
def render(self) -> str:
duplicate_html = to_html(self.c... | import pandas as pd
from ydata_profiling.report.presentation.core.duplicate import Duplicate
from ydata_profiling.report.presentation.flavours.html import templates
def to_html(df: pd.DataFrame) -> str:
FILL_FUNC_BODYclass HTMLDuplicate(Duplicate):
def render(self) -> str:
duplicate_html = to_html(self.c... | |
27,445 | /home/hieuvd/dung_repo/raw/stars_01/ydataai_ydata-profiling/ydata-profiling | /home/hieuvd/dung_repo/raw/stars_01/ydataai_ydata-profiling/ydata-profiling/src/ydata_profiling/report/presentation/flavours/html/duplicate.py | 20,21 | 19,25 | render | HTMLDuplicate | 21,25 | 21,25 | class HTMLDuplicate(Duplicate):
def render(self) -> str:
FILL_FUNC_BODY | class HTMLDuplicate(Duplicate):
def render(self) -> str:
FILL_FUNC_BODY | duplicate_html = to_html(self.content["duplicate"])
return templates.template("duplicate.html").render(
**self.content, duplicate_html=duplicate_html
)
| duplicate_html = to_html(self.content["duplicate"])
return templates.template("duplicate.html").render(
**self.content, duplicate_html=duplicate_html
)
| 8 | 30 | 54 | 84 | import pandas as pd
from ydata_profiling.report.presentation.core.duplicate import Duplicate
from ydata_profiling.report.presentation.flavours.html import templates
def to_html(df: pd.DataFrame) -> str:
html = df.to_html(
classes="duplicate table table-striped",
)
if df.empty:
html = html... | import pandas as pd
from ydata_profiling.report.presentation.core.duplicate import Duplicate
from ydata_profiling.report.presentation.flavours.html import templates
def to_html(df: pd.DataFrame) -> str:
html = df.to_html(
classes="duplicate table table-striped",
)
if df.empty:
html = html... |
27,446 | /home/hieuvd/dung_repo/raw/stars_01/ydataai_ydata-profiling/ydata-profiling | /home/hieuvd/dung_repo/raw/stars_01/ydataai_ydata-profiling/ydata-profiling/src/ydata_profiling/report/presentation/flavours/html/frequency_table.py | 6,7 | 5,21 | render | HTMLFrequencyTable | 7,21 | 7,21 | class HTMLFrequencyTable(FrequencyTable):
def render(self) -> str:
FILL_FUNC_BODY | class HTMLFrequencyTable(FrequencyTable):
def render(self) -> str:
FILL_FUNC_BODY | if isinstance(self.content["rows"][0], list):
html = ""
kwargs = self.content.copy()
del kwargs["rows"]
for idx, rows in enumerate(self.content["rows"]):
html += templates.template("frequency_table.html").render(
rows=rows, idx... | if isinstance(self.content["rows"][0], list):
html = ""
kwargs = self.content.copy()
del kwargs["rows"]
for idx, rows in enumerate(self.content["rows"]):
html += templates.template("frequency_table.html").render(
rows=rows, idx... | 31 | 32 | 142 | 174 | from ydata_profiling.report.presentation.core import FrequencyTable
from ydata_profiling.report.presentation.flavours.html import templates
class HTMLFrequencyTable(FrequencyTable):
def render(self) -> str:
FILL_FUNC_BODY | from ydata_profiling.report.presentation.core import FrequencyTable
from ydata_profiling.report.presentation.flavours.html import templates
class HTMLFrequencyTable(FrequencyTable):
def render(self) -> str:
FILL_FUNC_BODY |
27,447 | /home/hieuvd/dung_repo/raw/stars_01/ydataai_ydata-profiling/ydata-profiling | /home/hieuvd/dung_repo/raw/stars_01/ydataai_ydata-profiling/ydata-profiling/src/ydata_profiling/report/presentation/flavours/html/frequency_table_small.py | 6,7 | 5,16 | render | HTMLFrequencyTableSmall | 7,16 | 7,16 | class HTMLFrequencyTableSmall(FrequencyTableSmall):
def render(self) -> str:
FILL_FUNC_BODY | class HTMLFrequencyTableSmall(FrequencyTableSmall):
def render(self) -> str:
FILL_FUNC_BODY | html = ""
kwargs = self.content.copy()
del kwargs["rows"]
for idx, rows in enumerate(self.content["rows"]):
html += templates.template("frequency_table_small.html").render(
rows=rows, idx=idx, **kwargs
)
return html
| html = ""
kwargs = self.content.copy()
del kwargs["rows"]
for idx, rows in enumerate(self.content["rows"]):
html += templates.template("frequency_table_small.html").render(
rows=rows, idx=idx, **kwargs
)
return html
| 22 | 34 | 90 | 124 | from ydata_profiling.report.presentation.core import FrequencyTableSmall
from ydata_profiling.report.presentation.flavours.html import templates
class HTMLFrequencyTableSmall(FrequencyTableSmall):
def render(self) -> str:
FILL_FUNC_BODY | from ydata_profiling.report.presentation.core import FrequencyTableSmall
from ydata_profiling.report.presentation.flavours.html import templates
class HTMLFrequencyTableSmall(FrequencyTableSmall):
def render(self) -> str:
FILL_FUNC_BODY |
27,448 | /home/hieuvd/dung_repo/raw/stars_01/ydataai_ydata-profiling/ydata-profiling | /home/hieuvd/dung_repo/raw/stars_01/ydataai_ydata-profiling/ydata-profiling/src/ydata_profiling/report/presentation/flavours/html/html.py | 5,6 | 4,7 | render | HTMLHTML | 6,7 | 6,7 | class HTMLHTML(HTML):
def render(self) -> str:
FILL_FUNC_BODY | class HTMLHTML(HTML):
def render(self) -> str:
FILL_FUNC_BODY | return self.content["html"]
| return self.content["html"]
| 2 | 28 | 10 | 38 | from ydata_profiling.report.presentation.core import HTML
class HTMLHTML(HTML):
def render(self) -> str:
FILL_FUNC_BODY | from ydata_profiling.report.presentation.core import HTML
class HTMLHTML(HTML):
def render(self) -> str:
FILL_FUNC_BODY |
27,449 | /home/hieuvd/dung_repo/raw/stars_01/ydataai_ydata-profiling/ydata-profiling | /home/hieuvd/dung_repo/raw/stars_01/ydataai_ydata-profiling/ydata-profiling/src/ydata_profiling/report/presentation/flavours/html/image.py | 6,7 | 5,8 | render | HTMLImage | 7,8 | 7,8 | class HTMLImage(Image):
def render(self) -> str:
FILL_FUNC_BODY | class HTMLImage(Image):
def render(self) -> str:
FILL_FUNC_BODY | return templates.template("diagram.html").render(**self.content)
| return templates.template("diagram.html").render(**self.content)
| 2 | 28 | 20 | 48 | from ydata_profiling.report.presentation.core import Image
from ydata_profiling.report.presentation.flavours.html import templates
class HTMLImage(Image):
def render(self) -> str:
FILL_FUNC_BODY | from ydata_profiling.report.presentation.core import Image
from ydata_profiling.report.presentation.flavours.html import templates
class HTMLImage(Image):
def render(self) -> str:
FILL_FUNC_BODY |
27,450 | /home/hieuvd/dung_repo/raw/stars_01/ydataai_ydata-profiling/ydata-profiling | /home/hieuvd/dung_repo/raw/stars_01/ydataai_ydata-profiling/ydata-profiling/src/ydata_profiling/report/presentation/flavours/html/root.py | 6,7 | 5,15 | render | HTMLRoot | 7,15 | 7,15 | class HTMLRoot(Root):
def render(self, **kwargs) -> str:
FILL_FUNC_BODY | class HTMLRoot(Root):
def render(self, **kwargs) -> str:
FILL_FUNC_BODY | nav_items = [
(section.name, section.anchor_id)
for section in self.content["body"].content["items"]
]
return templates.template("report.html").render(
**self.content, nav_items=nav_items, **kwargs
)
| nav_items = [
(section.name, section.anchor_id)
for section in self.content["body"].content["items"]
]
return templates.template("report.html").render(
**self.content, nav_items=nav_items, **kwargs
)
| 16 | 31 | 80 | 111 | from ydata_profiling.report.presentation.core.root import Root
from ydata_profiling.report.presentation.flavours.html import templates
class HTMLRoot(Root):
def render(self, **kwargs) -> str:
FILL_FUNC_BODY | from ydata_profiling.report.presentation.core.root import Root
from ydata_profiling.report.presentation.flavours.html import templates
class HTMLRoot(Root):
def render(self, **kwargs) -> str:
FILL_FUNC_BODY |
27,451 | /home/hieuvd/dung_repo/raw/stars_01/ydataai_ydata-profiling/ydata-profiling | /home/hieuvd/dung_repo/raw/stars_01/ydataai_ydata-profiling/ydata-profiling/src/ydata_profiling/report/presentation/flavours/html/sample.py | 6,7 | 5,13 | render | HTMLSample | 7,13 | 7,13 | class HTMLSample(Sample):
def render(self) -> str:
FILL_FUNC_BODY | class HTMLSample(Sample):
def render(self) -> str:
FILL_FUNC_BODY | sample_html = self.content["sample"].to_html(
classes="sample table table-striped"
)
return templates.template("sample.html").render(
**self.content, sample_html=sample_html
)
| sample_html = self.content["sample"].to_html(
classes="sample table table-striped"
)
return templates.template("sample.html").render(
**self.content, sample_html=sample_html
)
| 12 | 28 | 67 | 95 | from ydata_profiling.report.presentation.core.sample import Sample
from ydata_profiling.report.presentation.flavours.html import templates
class HTMLSample(Sample):
def render(self) -> str:
FILL_FUNC_BODY | from ydata_profiling.report.presentation.core.sample import Sample
from ydata_profiling.report.presentation.flavours.html import templates
class HTMLSample(Sample):
def render(self) -> str:
FILL_FUNC_BODY |
27,452 | /home/hieuvd/dung_repo/raw/stars_01/ydataai_ydata-profiling/ydata-profiling | /home/hieuvd/dung_repo/raw/stars_01/ydataai_ydata-profiling/ydata-profiling/src/ydata_profiling/report/presentation/flavours/html/table.py | 6,7 | 5,8 | render | HTMLTable | 7,8 | 7,8 | class HTMLTable(Table):
def render(self) -> str:
FILL_FUNC_BODY | class HTMLTable(Table):
def render(self) -> str:
FILL_FUNC_BODY | return templates.template("table.html").render(**self.content)
| return templates.template("table.html").render(**self.content)
| 2 | 28 | 19 | 47 | from ydata_profiling.report.presentation.core.table import Table
from ydata_profiling.report.presentation.flavours.html import templates
class HTMLTable(Table):
def render(self) -> str:
FILL_FUNC_BODY | from ydata_profiling.report.presentation.core.table import Table
from ydata_profiling.report.presentation.flavours.html import templates
class HTMLTable(Table):
def render(self) -> str:
FILL_FUNC_BODY |
27,453 | /home/hieuvd/dung_repo/raw/stars_01/ydataai_ydata-profiling/ydata-profiling | /home/hieuvd/dung_repo/raw/stars_01/ydataai_ydata-profiling/ydata-profiling/src/ydata_profiling/report/presentation/flavours/html/templates.py | 37,38 | 1,78 | create_html_assets | 38,78 | 38,78 | """Contains all templates used for generating the HTML profile report"""
import shutil
from pathlib import Path
import jinja2
from ydata_profiling.config import Settings
from ydata_profiling.report.formatters import fmt, fmt_badge, fmt_numeric, fmt_percent
# Initializing Jinja
package_loader = jinja2.PackageLoader(
... | """Contains all templates used for generating the HTML profile report"""
import shutil
from pathlib import Path
import jinja2
from ydata_profiling.config import Settings
from ydata_profiling.report.formatters import fmt, fmt_badge, fmt_numeric, fmt_percent
# Initializing Jinja
package_loader = jinja2.PackageLoader(
... | theme = config.html.style.theme
path = output_file.with_name(str(config.html.assets_prefix))
if path.is_dir():
shutil.rmtree(path)
path.joinpath("images").mkdir(parents=True, exist_ok=True)
css = []
js = []
if config.html.use_local_assets:
if theme is not None:
... | theme = config.html.style.theme
path = output_file.with_name(str(config.html.assets_prefix))
if path.is_dir():
shutil.rmtree(path)
path.joinpath("images").mkdir(parents=True, exist_ok=True)
css = []
js = []
if config.html.use_local_assets:
if theme is not None:
... | 70 | 387 | 459 | 846 | """Contains all templates used for generating the HTML profile report"""
import shutil
from pathlib import Path
import jinja2
from ydata_profiling.config import Settings
from ydata_profiling.report.formatters import fmt, fmt_badge, fmt_numeric, fmt_percent
# Initializing Jinja
package_loader = jinja2.PackageLoader(
... | """Contains all templates used for generating the HTML profile report"""
import shutil
from pathlib import Path
import jinja2
from ydata_profiling.config import Settings
from ydata_profiling.report.formatters import fmt, fmt_badge, fmt_numeric, fmt_percent
# Initializing Jinja
package_loader = jinja2.PackageLoader(
... | |
27,454 | /home/hieuvd/dung_repo/raw/stars_01/ydataai_ydata-profiling/ydata-profiling | /home/hieuvd/dung_repo/raw/stars_01/ydataai_ydata-profiling/ydata-profiling/src/ydata_profiling/report/presentation/flavours/html/toggle_button.py | 6,7 | 5,8 | render | HTMLToggleButton | 7,8 | 7,8 | class HTMLToggleButton(ToggleButton):
def render(self) -> str:
FILL_FUNC_BODY | class HTMLToggleButton(ToggleButton):
def render(self) -> str:
FILL_FUNC_BODY | return templates.template("toggle_button.html").render(**self.content)
| return templates.template("toggle_button.html").render(**self.content)
| 2 | 32 | 21 | 53 | from ydata_profiling.report.presentation.core import ToggleButton
from ydata_profiling.report.presentation.flavours.html import templates
class HTMLToggleButton(ToggleButton):
def render(self) -> str:
FILL_FUNC_BODY | from ydata_profiling.report.presentation.core import ToggleButton
from ydata_profiling.report.presentation.flavours.html import templates
class HTMLToggleButton(ToggleButton):
def render(self) -> str:
FILL_FUNC_BODY |
27,455 | /home/hieuvd/dung_repo/raw/stars_01/ydataai_ydata-profiling/ydata-profiling | /home/hieuvd/dung_repo/raw/stars_01/ydataai_ydata-profiling/ydata-profiling/src/ydata_profiling/report/presentation/flavours/html/variable.py | 6,7 | 5,8 | render | HTMLVariable | 7,8 | 7,8 | class HTMLVariable(Variable):
def render(self) -> str:
FILL_FUNC_BODY | class HTMLVariable(Variable):
def render(self) -> str:
FILL_FUNC_BODY | return templates.template("variable.html").render(**self.content)
| return templates.template("variable.html").render(**self.content)
| 2 | 28 | 19 | 47 | from ydata_profiling.report.presentation.core import Variable
from ydata_profiling.report.presentation.flavours.html import templates
class HTMLVariable(Variable):
def render(self) -> str:
FILL_FUNC_BODY | from ydata_profiling.report.presentation.core import Variable
from ydata_profiling.report.presentation.flavours.html import templates
class HTMLVariable(Variable):
def render(self) -> str:
FILL_FUNC_BODY |
27,456 | /home/hieuvd/dung_repo/raw/stars_01/ydataai_ydata-profiling/ydata-profiling | /home/hieuvd/dung_repo/raw/stars_01/ydataai_ydata-profiling/ydata-profiling/src/ydata_profiling/report/presentation/flavours/html/variable_info.py | 6,7 | 5,8 | render | HTMLVariableInfo | 7,8 | 7,8 | class HTMLVariableInfo(VariableInfo):
def render(self) -> str:
FILL_FUNC_BODY | class HTMLVariableInfo(VariableInfo):
def render(self) -> str:
FILL_FUNC_BODY | return templates.template("variable_info.html").render(**self.content)
| return templates.template("variable_info.html").render(**self.content)
| 2 | 30 | 21 | 51 | from ydata_profiling.report.presentation.core import VariableInfo
from ydata_profiling.report.presentation.flavours.html import templates
class HTMLVariableInfo(VariableInfo):
def render(self) -> str:
FILL_FUNC_BODY | from ydata_profiling.report.presentation.core import VariableInfo
from ydata_profiling.report.presentation.flavours.html import templates
class HTMLVariableInfo(VariableInfo):
def render(self) -> str:
FILL_FUNC_BODY |
27,457 | /home/hieuvd/dung_repo/raw/stars_01/ydataai_ydata-profiling/ydata-profiling | /home/hieuvd/dung_repo/raw/stars_01/ydataai_ydata-profiling/ydata-profiling/src/ydata_profiling/report/presentation/frequency_table_utils.py | 7,10 | 1,142 | _frequency_table | 10,76 | 10,76 | from typing import Any, Dict, List, Union
import numpy as np
import pandas as pd
def _frequency_table(
freqtable: pd.Series, n: int, max_number_to_print: int
) -> List[Dict[str, Any]]:
FILL_FUNC_BODYdef freq_table(
freqtable: Union[pd.Series, List[pd.Series]],
n: Union[int, List[int]],
max_number_to_... | from typing import Any, Dict, List, Union
import numpy as np
import pandas as pd
def _frequency_table(
freqtable: pd.Series, n: int, max_number_to_print: int
) -> List[Dict[str, Any]]:
FILL_FUNC_BODYdef freq_table(
freqtable: Union[pd.Series, List[pd.Series]],
n: Union[int, List[int]],
max_number_to_... | # TODO: replace '' by '(Empty)' ?
if max_number_to_print > n:
max_number_to_print = n
if max_number_to_print < len(freqtable):
freq_other = np.sum(freqtable.iloc[max_number_to_print:])
min_freq = freqtable.values[max_number_to_print]
else:
freq_other = 0
min_fre... | # TODO: replace '' by '(Empty)' ?
if max_number_to_print > n:
max_number_to_print = n
if max_number_to_print < len(freqtable):
freq_other = np.sum(freqtable.iloc[max_number_to_print:])
min_freq = freqtable.values[max_number_to_print]
else:
freq_other = 0
min_fre... | 158 | 756 | 647 | 1,403 | from typing import Any, Dict, List, Union
import numpy as np
import pandas as pd
def _frequency_table(
freqtable: pd.Series, n: int, max_number_to_print: int
) -> List[Dict[str, Any]]:
FILL_FUNC_BODYdef freq_table(
freqtable: Union[pd.Series, List[pd.Series]],
n: Union[int, List[int]],
max_number_to_... | from typing import Any, Dict, List, Union
import numpy as np
import pandas as pd
def _frequency_table(
freqtable: pd.Series, n: int, max_number_to_print: int
) -> List[Dict[str, Any]]:
FILL_FUNC_BODYdef freq_table(
freqtable: Union[pd.Series, List[pd.Series]],
n: Union[int, List[int]],
max_number_to_... | |
27,458 | /home/hieuvd/dung_repo/raw/stars_01/ydataai_ydata-profiling/ydata-profiling | /home/hieuvd/dung_repo/raw/stars_01/ydataai_ydata-profiling/ydata-profiling/src/ydata_profiling/report/structure/correlations.py | 10,13 | 1,124 | get_correlation_items | 22,124 | 13,124 | from typing import List, Optional
from ydata_profiling.config import Settings
from ydata_profiling.model import BaseDescription
from ydata_profiling.report.presentation.core import Container, CorrelationTable, Image
from ydata_profiling.report.presentation.core.renderable import Renderable
from ydata_profiling.visuali... | from typing import List, Optional
from ydata_profiling.config import Settings
from ydata_profiling.model import BaseDescription
from ydata_profiling.report.presentation.core import Container, CorrelationTable, Image
from ydata_profiling.report.presentation.core.renderable import Renderable
from ydata_profiling.visuali... | items: List[Renderable] = []
key_to_data = {
"pearson": (-1, "Pearson's r"),
"spearman": (-1, "Spearman's ρ"),
"kendall": (-1, "Kendall's τ"),
"phi_k": (0, "Phik (φk)"),
"cramers": (0, "Cramér's V (φc)"),
"auto": (-1, "Auto"),
}
image_format = config.plo... | """Create the list of correlation items
Args:
config: report Settings object
summary: dict of correlations
Returns:
List of correlation items to show in the interface.
"""
items: List[Renderable] = []
key_to_data = {
"pearson": (-1, "Pearson's r"),
"spe... | 177 | 182 | 1,017 | 1,199 | from typing import List, Optional
from ydata_profiling.config import Settings
from ydata_profiling.model import BaseDescription
from ydata_profiling.report.presentation.core import Container, CorrelationTable, Image
from ydata_profiling.report.presentation.core.renderable import Renderable
from ydata_profiling.visuali... | from typing import List, Optional
from ydata_profiling.config import Settings
from ydata_profiling.model import BaseDescription
from ydata_profiling.report.presentation.core import Container, CorrelationTable, Image
from ydata_profiling.report.presentation.core.renderable import Renderable
from ydata_profiling.visuali... | |
27,461 | /home/hieuvd/dung_repo/raw/stars_01/ydataai_ydata-profiling/ydata-profiling | /home/hieuvd/dung_repo/raw/stars_01/ydataai_ydata-profiling/ydata-profiling/src/ydata_profiling/report/structure/variables/render_boolean.py | 19,20 | 1,133 | render_boolean | 20,133 | 20,133 | from typing import List
from ydata_profiling.config import Settings
from ydata_profiling.report.formatters import fmt, fmt_bytesize, fmt_percent
from ydata_profiling.report.presentation.core import (
Container,
FrequencyTable,
FrequencyTableSmall,
Image,
Table,
VariableInfo,
)
from ydata_profil... | from typing import List
from ydata_profiling.config import Settings
from ydata_profiling.report.formatters import fmt, fmt_bytesize, fmt_percent
from ydata_profiling.report.presentation.core import (
Container,
FrequencyTable,
FrequencyTableSmall,
Image,
Table,
VariableInfo,
)
from ydata_profil... | varid = summary["varid"]
n_obs_bool = config.vars.bool.n_obs
image_format = config.plot.image_format
# Prepare variables
template_variables = render_common(config, summary)
# Element composition
info = VariableInfo(
anchor_id=summary["varid"],
alerts=summary["alerts"],
... | varid = summary["varid"]
n_obs_bool = config.vars.bool.n_obs
image_format = config.plot.image_format
# Prepare variables
template_variables = render_common(config, summary)
# Element composition
info = VariableInfo(
anchor_id=summary["varid"],
alerts=summary["alerts"],
... | 184 | 212 | 1,088 | 1,300 | from typing import List
from ydata_profiling.config import Settings
from ydata_profiling.report.formatters import fmt, fmt_bytesize, fmt_percent
from ydata_profiling.report.presentation.core import (
Container,
FrequencyTable,
FrequencyTableSmall,
Image,
Table,
VariableInfo,
)
from ydata_profil... | from typing import List
from ydata_profiling.config import Settings
from ydata_profiling.report.formatters import fmt, fmt_bytesize, fmt_percent
from ydata_profiling.report.presentation.core import (
Container,
FrequencyTable,
FrequencyTableSmall,
Image,
Table,
VariableInfo,
)
from ydata_profil... | |
27,462 | /home/hieuvd/dung_repo/raw/stars_01/ydataai_ydata-profiling/ydata-profiling | /home/hieuvd/dung_repo/raw/stars_01/ydataai_ydata-profiling/ydata-profiling/src/ydata_profiling/report/structure/variables/render_common.py | 8,9 | 1,32 | render_common | 9,32 | 9,32 | from ydata_profiling.config import Settings
from ydata_profiling.report.presentation.frequency_table_utils import (
extreme_obs_table,
freq_table,
)
def render_common(config: Settings, summary: dict) -> dict:
FILL_FUNC_BODY | from ydata_profiling.config import Settings
from ydata_profiling.report.presentation.frequency_table_utils import (
extreme_obs_table,
freq_table,
)
def render_common(config: Settings, summary: dict) -> dict:
FILL_FUNC_BODY | n_extreme_obs = config.n_extreme_obs
n_freq_table_max = config.n_freq_table_max
template_variables = {
# TODO: with nan
"freq_table_rows": freq_table(
freqtable=summary["value_counts_without_nan"],
n=summary["n"],
max_number_to_print=n_freq_table_max,
... | n_extreme_obs = config.n_extreme_obs
n_freq_table_max = config.n_freq_table_max
template_variables = {
# TODO: with nan
"freq_table_rows": freq_table(
freqtable=summary["value_counts_without_nan"],
n=summary["n"],
max_number_to_print=n_freq_table_max,
... | 34 | 80 | 273 | 353 | from ydata_profiling.config import Settings
from ydata_profiling.report.presentation.frequency_table_utils import (
extreme_obs_table,
freq_table,
)
def render_common(config: Settings, summary: dict) -> dict:
FILL_FUNC_BODY | from ydata_profiling.config import Settings
from ydata_profiling.report.presentation.frequency_table_utils import (
extreme_obs_table,
freq_table,
)
def render_common(config: Settings, summary: dict) -> dict:
FILL_FUNC_BODY | |
27,463 | /home/hieuvd/dung_repo/raw/stars_01/ydataai_ydata-profiling/ydata-profiling | /home/hieuvd/dung_repo/raw/stars_01/ydataai_ydata-profiling/ydata-profiling/src/ydata_profiling/report/structure/variables/render_complex.py | 18,19 | 1,103 | render_complex | 19,103 | 19,103 | from ydata_profiling.config import Settings
from ydata_profiling.report.formatters import (
fmt,
fmt_bytesize,
fmt_numeric,
fmt_percent,
)
from ydata_profiling.report.presentation.core import (
HTML,
Container,
Image,
Table,
VariableInfo,
)
from ydata_profiling.visualisation.plot imp... | from ydata_profiling.config import Settings
from ydata_profiling.report.formatters import (
fmt,
fmt_bytesize,
fmt_numeric,
fmt_percent,
)
from ydata_profiling.report.presentation.core import (
HTML,
Container,
Image,
Table,
VariableInfo,
)
from ydata_profiling.visualisation.plot imp... | varid = summary["varid"]
template_variables = {}
image_format = config.plot.image_format
# Top
info = VariableInfo(
summary["varid"],
summary["varname"],
"Complex number (ℂ)",
summary["alerts"],
summary["description"],
style=config.html.style,
... | varid = summary["varid"]
template_variables = {}
image_format = config.plot.image_format
# Top
info = VariableInfo(
summary["varid"],
summary["varname"],
"Complex number (ℂ)",
summary["alerts"],
summary["description"],
style=config.html.style,
... | 144 | 144 | 755 | 899 | from ydata_profiling.config import Settings
from ydata_profiling.report.formatters import (
fmt,
fmt_bytesize,
fmt_numeric,
fmt_percent,
)
from ydata_profiling.report.presentation.core import (
HTML,
Container,
Image,
Table,
VariableInfo,
)
from ydata_profiling.visualisation.plot imp... | from ydata_profiling.config import Settings
from ydata_profiling.report.formatters import (
fmt,
fmt_bytesize,
fmt_numeric,
fmt_percent,
)
from ydata_profiling.report.presentation.core import (
HTML,
Container,
Image,
Table,
VariableInfo,
)
from ydata_profiling.visualisation.plot imp... | |
27,464 | /home/hieuvd/dung_repo/raw/stars_01/ydataai_ydata-profiling/ydata-profiling | /home/hieuvd/dung_repo/raw/stars_01/ydataai_ydata-profiling/ydata-profiling/src/ydata_profiling/report/structure/variables/render_count.py | 19,20 | 1,158 | render_count | 20,158 | 20,158 | from ydata_profiling.config import Settings
from ydata_profiling.report.formatters import (
fmt,
fmt_bytesize,
fmt_numeric,
fmt_percent,
)
from ydata_profiling.report.presentation.core import (
Container,
FrequencyTable,
Image,
Table,
VariableInfo,
)
from ydata_profiling.report.struc... | from ydata_profiling.config import Settings
from ydata_profiling.report.formatters import (
fmt,
fmt_bytesize,
fmt_numeric,
fmt_percent,
)
from ydata_profiling.report.presentation.core import (
Container,
FrequencyTable,
Image,
Table,
VariableInfo,
)
from ydata_profiling.report.struc... | template_variables = render_common(config, summary)
image_format = config.plot.image_format
# Top
info = VariableInfo(
summary["varid"],
summary["varname"],
"Real number (ℝ / ℝ<sub>≥0</sub>)",
summary["alerts"],
summary["description"],
style=... | template_variables = render_common(config, summary)
image_format = config.plot.image_format
# Top
info = VariableInfo(
summary["varid"],
summary["varname"],
"Real number (ℝ / ℝ<sub>≥0</sub>)",
summary["alerts"],
summary["description"],
style=... | 217 | 172 | 1,227 | 1,399 | from ydata_profiling.config import Settings
from ydata_profiling.report.formatters import (
fmt,
fmt_bytesize,
fmt_numeric,
fmt_percent,
)
from ydata_profiling.report.presentation.core import (
Container,
FrequencyTable,
Image,
Table,
VariableInfo,
)
from ydata_profiling.report.struc... | from ydata_profiling.config import Settings
from ydata_profiling.report.formatters import (
fmt,
fmt_bytesize,
fmt_numeric,
fmt_percent,
)
from ydata_profiling.report.presentation.core import (
Container,
FrequencyTable,
Image,
Table,
VariableInfo,
)
from ydata_profiling.report.struc... | |
27,465 | /home/hieuvd/dung_repo/raw/stars_01/ydataai_ydata-profiling/ydata-profiling | /home/hieuvd/dung_repo/raw/stars_01/ydataai_ydata-profiling/ydata-profiling/src/ydata_profiling/report/structure/variables/render_date.py | 14,15 | 1,125 | render_date | 15,125 | 15,125 | from typing import Any, Dict
from ydata_profiling.config import Settings
from ydata_profiling.report.formatters import fmt, fmt_bytesize, fmt_percent
from ydata_profiling.report.presentation.core import (
Container,
Image,
Table,
VariableInfo,
)
from ydata_profiling.visualisation.plot import histogram,... | from typing import Any, Dict
from ydata_profiling.config import Settings
from ydata_profiling.report.formatters import fmt, fmt_bytesize, fmt_percent
from ydata_profiling.report.presentation.core import (
Container,
Image,
Table,
VariableInfo,
)
from ydata_profiling.visualisation.plot import histogram,... | varid = summary["varid"]
template_variables = {}
image_format = config.plot.image_format
# Top
info = VariableInfo(
summary["varid"],
summary["varname"],
"Date",
summary["alerts"],
summary["description"],
style=config.html.style,
)
table1 = ... | varid = summary["varid"]
template_variables = {}
image_format = config.plot.image_format
# Top
info = VariableInfo(
summary["varid"],
summary["varname"],
"Date",
summary["alerts"],
summary["description"],
style=config.html.style,
)
table1 = ... | 202 | 145 | 985 | 1,130 | from typing import Any, Dict
from ydata_profiling.config import Settings
from ydata_profiling.report.formatters import fmt, fmt_bytesize, fmt_percent
from ydata_profiling.report.presentation.core import (
Container,
Image,
Table,
VariableInfo,
)
from ydata_profiling.visualisation.plot import histogram,... | from typing import Any, Dict
from ydata_profiling.config import Settings
from ydata_profiling.report.formatters import fmt, fmt_bytesize, fmt_percent
from ydata_profiling.report.presentation.core import (
Container,
Image,
Table,
VariableInfo,
)
from ydata_profiling.visualisation.plot import histogram,... | |
27,466 | /home/hieuvd/dung_repo/raw/stars_01/ydataai_ydata-profiling/ydata-profiling | /home/hieuvd/dung_repo/raw/stars_01/ydataai_ydata-profiling/ydata-profiling/src/ydata_profiling/report/structure/variables/render_file.py | 11,12 | 1,66 | render_file | 12,66 | 12,66 | from typing import List
from ydata_profiling.config import Settings
from ydata_profiling.report.presentation.core import Container, FrequencyTable, Image
from ydata_profiling.report.presentation.core.renderable import Renderable
from ydata_profiling.report.presentation.frequency_table_utils import freq_table
from ydat... | from typing import List
from ydata_profiling.config import Settings
from ydata_profiling.report.presentation.core import Container, FrequencyTable, Image
from ydata_profiling.report.presentation.core.renderable import Renderable
from ydata_profiling.report.presentation.frequency_table_utils import freq_table
from ydat... | varid = summary["varid"]
template_variables = render_path(config, summary)
# Top
template_variables["top"].content["items"][0].content["var_type"] = "File"
n_freq_table_max = config.n_freq_table_max
image_format = config.plot.image_format
file_tabs: List[Renderable] = []
if "file_siz... | varid = summary["varid"]
template_variables = render_path(config, summary)
# Top
template_variables["top"].content["items"][0].content["var_type"] = "File"
n_freq_table_max = config.n_freq_table_max
image_format = config.plot.image_format
file_tabs: List[Renderable] = []
if "file_siz... | 92 | 158 | 567 | 725 | from typing import List
from ydata_profiling.config import Settings
from ydata_profiling.report.presentation.core import Container, FrequencyTable, Image
from ydata_profiling.report.presentation.core.renderable import Renderable
from ydata_profiling.report.presentation.frequency_table_utils import freq_table
from ydat... | from typing import List
from ydata_profiling.config import Settings
from ydata_profiling.report.presentation.core import Container, FrequencyTable, Image
from ydata_profiling.report.presentation.core.renderable import Renderable
from ydata_profiling.report.presentation.frequency_table_utils import freq_table
from ydat... | |
27,467 | /home/hieuvd/dung_repo/raw/stars_01/ydataai_ydata-profiling/ydata-profiling | /home/hieuvd/dung_repo/raw/stars_01/ydataai_ydata-profiling/ydata-profiling/src/ydata_profiling/report/structure/variables/render_generic.py | 11,12 | 1,46 | render_generic | 12,46 | 12,46 | from ydata_profiling.config import Settings
from ydata_profiling.report.formatters import fmt, fmt_bytesize, fmt_percent
from ydata_profiling.report.presentation.core import (
HTML,
Container,
Table,
VariableInfo,
)
def render_generic(config: Settings, summary: dict) -> dict:
FILL_FUNC_BODY | from ydata_profiling.config import Settings
from ydata_profiling.report.formatters import fmt, fmt_bytesize, fmt_percent
from ydata_profiling.report.presentation.core import (
HTML,
Container,
Table,
VariableInfo,
)
def render_generic(config: Settings, summary: dict) -> dict:
FILL_FUNC_BODY | info = VariableInfo(
anchor_id=summary["varid"],
alerts=summary["alerts"],
var_type="Unsupported",
var_name=summary["varname"],
description=summary["description"],
style=config.html.style,
)
table = Table(
[
{
"name": "Miss... | info = VariableInfo(
anchor_id=summary["varid"],
alerts=summary["alerts"],
var_type="Unsupported",
var_name=summary["varname"],
description=summary["description"],
style=config.html.style,
)
table = Table(
[
{
"name": "Miss... | 57 | 104 | 306 | 410 | from ydata_profiling.config import Settings
from ydata_profiling.report.formatters import fmt, fmt_bytesize, fmt_percent
from ydata_profiling.report.presentation.core import (
HTML,
Container,
Table,
VariableInfo,
)
def render_generic(config: Settings, summary: dict) -> dict:
FILL_FUNC_BODY | from ydata_profiling.config import Settings
from ydata_profiling.report.formatters import fmt, fmt_bytesize, fmt_percent
from ydata_profiling.report.presentation.core import (
HTML,
Container,
Table,
VariableInfo,
)
def render_generic(config: Settings, summary: dict) -> dict:
FILL_FUNC_BODY | |
27,468 | /home/hieuvd/dung_repo/raw/stars_01/ydataai_ydata-profiling/ydata-profiling | /home/hieuvd/dung_repo/raw/stars_01/ydataai_ydata-profiling/ydata-profiling/src/ydata_profiling/report/structure/variables/render_image.py | 16,17 | 1,205 | render_image | 17,205 | 17,205 | import pandas as pd
from ydata_profiling.config import Settings
from ydata_profiling.report.formatters import fmt_numeric
from ydata_profiling.report.presentation.core import (
Container,
FrequencyTable,
Image,
Table,
)
from ydata_profiling.report.presentation.frequency_table_utils import freq_table
fr... | import pandas as pd
from ydata_profiling.config import Settings
from ydata_profiling.report.formatters import fmt_numeric
from ydata_profiling.report.presentation.core import (
Container,
FrequencyTable,
Image,
Table,
)
from ydata_profiling.report.presentation.frequency_table_utils import freq_table
fr... | varid = summary["varid"]
n_freq_table_max = config.n_freq_table_max
redact = config.vars.cat.redact
template_variables = render_file(config, summary)
# Top
template_variables["top"].content["items"][0].content["var_type"] = "Image"
# Bottom
image_items = []
"""
Min Width ... | varid = summary["varid"]
n_freq_table_max = config.n_freq_table_max
redact = config.vars.cat.redact
template_variables = render_file(config, summary)
# Top
template_variables["top"].content["items"][0].content["var_type"] = "Image"
# Bottom
image_items = []
"""
Min Width ... | 288 | 172 | 1,616 | 1,788 | import pandas as pd
from ydata_profiling.config import Settings
from ydata_profiling.report.formatters import fmt_numeric
from ydata_profiling.report.presentation.core import (
Container,
FrequencyTable,
Image,
Table,
)
from ydata_profiling.report.presentation.frequency_table_utils import freq_table
fr... | import pandas as pd
from ydata_profiling.config import Settings
from ydata_profiling.report.formatters import fmt_numeric
from ydata_profiling.report.presentation.core import (
Container,
FrequencyTable,
Image,
Table,
)
from ydata_profiling.report.presentation.frequency_table_utils import freq_table
fr... | |
27,469 | /home/hieuvd/dung_repo/raw/stars_01/ydataai_ydata-profiling/ydata-profiling | /home/hieuvd/dung_repo/raw/stars_01/ydataai_ydata-profiling/ydata-profiling/src/ydata_profiling/report/structure/variables/render_path.py | 10,11 | 1,135 | render_path | 11,135 | 11,135 | from ydata_profiling.config import Settings
from ydata_profiling.report.formatters import fmt, fmt_numeric
from ydata_profiling.report.presentation.core import Container, FrequencyTable, Table
from ydata_profiling.report.presentation.frequency_table_utils import freq_table
from ydata_profiling.report.structure.variable... | from ydata_profiling.config import Settings
from ydata_profiling.report.formatters import fmt, fmt_numeric
from ydata_profiling.report.presentation.core import Container, FrequencyTable, Table
from ydata_profiling.report.presentation.frequency_table_utils import freq_table
from ydata_profiling.report.structure.variable... | varid = summary["varid"]
n_freq_table_max = config.n_freq_table_max
redact = config.vars.cat.redact
template_variables = render_categorical(config, summary)
keys = ["name", "parent", "suffix", "stem", "anchor"]
for path_part in keys:
template_variables[f"freqtable_{path_part}"] = freq_... | varid = summary["varid"]
n_freq_table_max = config.n_freq_table_max
redact = config.vars.cat.redact
template_variables = render_categorical(config, summary)
keys = ["name", "parent", "suffix", "stem", "anchor"]
for path_part in keys:
template_variables[f"freqtable_{path_part}"] = freq_... | 173 | 143 | 1,139 | 1,282 | from ydata_profiling.config import Settings
from ydata_profiling.report.formatters import fmt, fmt_numeric
from ydata_profiling.report.presentation.core import Container, FrequencyTable, Table
from ydata_profiling.report.presentation.frequency_table_utils import freq_table
from ydata_profiling.report.structure.variable... | from ydata_profiling.config import Settings
from ydata_profiling.report.formatters import fmt, fmt_numeric
from ydata_profiling.report.presentation.core import Container, FrequencyTable, Table
from ydata_profiling.report.presentation.frequency_table_utils import freq_table
from ydata_profiling.report.structure.variable... | |
27,472 | /home/hieuvd/dung_repo/raw/stars_01/ydataai_ydata-profiling/ydata-profiling | /home/hieuvd/dung_repo/raw/stars_01/ydataai_ydata-profiling/ydata-profiling/src/ydata_profiling/report/structure/variables/render_url.py | 14,15 | 1,133 | render_url | 15,133 | 15,133 | from ydata_profiling.config import Settings
from ydata_profiling.report.formatters import fmt, fmt_bytesize, fmt_percent
from ydata_profiling.report.presentation.core import (
Container,
FrequencyTable,
FrequencyTableSmall,
Table,
VariableInfo,
)
from ydata_profiling.report.presentation.frequency_ta... | from ydata_profiling.config import Settings
from ydata_profiling.report.formatters import fmt, fmt_bytesize, fmt_percent
from ydata_profiling.report.presentation.core import (
Container,
FrequencyTable,
FrequencyTableSmall,
Table,
VariableInfo,
)
from ydata_profiling.report.presentation.frequency_ta... | varid = summary["varid"]
n_freq_table_max = config.n_freq_table_max
n_obs_cat = config.vars.cat.n_obs
redact = config.vars.cat.redact
template_variables = render_common(config, summary)
keys = ["scheme", "netloc", "path", "query", "fragment"]
for url_part in keys:
template_variabl... | varid = summary["varid"]
n_freq_table_max = config.n_freq_table_max
n_obs_cat = config.vars.cat.n_obs
redact = config.vars.cat.redact
template_variables = render_common(config, summary)
keys = ["scheme", "netloc", "path", "query", "fragment"]
for url_part in keys:
template_variabl... | 190 | 160 | 1,196 | 1,356 | from ydata_profiling.config import Settings
from ydata_profiling.report.formatters import fmt, fmt_bytesize, fmt_percent
from ydata_profiling.report.presentation.core import (
Container,
FrequencyTable,
FrequencyTableSmall,
Table,
VariableInfo,
)
from ydata_profiling.report.presentation.frequency_ta... | from ydata_profiling.config import Settings
from ydata_profiling.report.formatters import fmt, fmt_bytesize, fmt_percent
from ydata_profiling.report.presentation.core import (
Container,
FrequencyTable,
FrequencyTableSmall,
Table,
VariableInfo,
)
from ydata_profiling.report.presentation.frequency_ta... | |
27,473 | /home/hieuvd/dung_repo/raw/stars_01/ydataai_ydata-profiling/ydata-profiling | /home/hieuvd/dung_repo/raw/stars_01/ydataai_ydata-profiling/ydata-profiling/src/ydata_profiling/utils/cache.py | 10,11 | 1,60 | cache_file | 20,36 | 11,36 | """Dataset cache utility functions"""
import zipfile
from pathlib import Path
from requests import get as get_file
from ydata_profiling.utils.paths import get_data_path
def cache_file(file_name: str, url: str) -> Path:
FILL_FUNC_BODYdef cache_zipped_file(file_name: str, url: str) -> Path:
"""Check if file_name ... | """Dataset cache utility functions"""
import zipfile
from pathlib import Path
from requests import get as get_file
from ydata_profiling.utils.paths import get_data_path
def cache_file(file_name: str, url: str) -> Path:
"""Check if file_name already is in the data path, otherwise download it from url.
Args:... |
data_path = get_data_path()
data_path.mkdir(exist_ok=True)
file_path = data_path / file_name
# If not exists, download and create file
if not file_path.exists():
response = get_file(url, allow_redirects=True)
response.raise_for_status()
file_path.write_bytes(response.cont... | """Check if file_name already is in the data path, otherwise download it from url.
Args:
file_name: the file name
url: the URL of the dataset
Returns:
The relative path to the dataset
"""
data_path = get_data_path()
data_path.mkdir(exist_ok=True)
file_path = data_... | 28 | 347 | 132 | 479 | """Dataset cache utility functions"""
import zipfile
from pathlib import Path
from requests import get as get_file
from ydata_profiling.utils.paths import get_data_path
def cache_file(file_name: str, url: str) -> Path:
FILL_FUNC_BODYdef cache_zipped_file(file_name: str, url: str) -> Path:
"""Check if file_name ... | """Dataset cache utility functions"""
import zipfile
from pathlib import Path
from requests import get as get_file
from ydata_profiling.utils.paths import get_data_path
def cache_file(file_name: str, url: str) -> Path:
"""Check if file_name already is in the data path, otherwise download it from url.
Args:... | |
27,474 | /home/hieuvd/dung_repo/raw/stars_01/ydataai_ydata-profiling/ydata-profiling | /home/hieuvd/dung_repo/raw/stars_01/ydataai_ydata-profiling/ydata-profiling/src/ydata_profiling/utils/compat.py | 8,10 | 1,15 | pandas_version_info | 14,15 | 10,15 | """Utility functions for (version) compatibility"""
from functools import lru_cache
from typing import Tuple
import pandas as pd
@lru_cache(maxsize=1)
def pandas_version_info() -> Tuple[int, ...]:
FILL_FUNC_BODY | """Utility functions for (version) compatibility"""
from functools import lru_cache
from typing import Tuple
import pandas as pd
@lru_cache(maxsize=1)
def pandas_version_info() -> Tuple[int, ...]:
"""
Get the Pandas version as a tuple of integers,
akin to `sys.version_info` for the Python version.
""... | return tuple(int(s) for s in pd.__version__.split("."))
| """
Get the Pandas version as a tuple of integers,
akin to `sys.version_info` for the Python version.
"""
return tuple(int(s) for s in pd.__version__.split("."))
| 6 | 115 | 23 | 138 | """Utility functions for (version) compatibility"""
from functools import lru_cache
from typing import Tuple
import pandas as pd
@lru_cache(maxsize=1)
def pandas_version_info() -> Tuple[int, ...]:
FILL_FUNC_BODY | """Utility functions for (version) compatibility"""
from functools import lru_cache
from typing import Tuple
import pandas as pd
@lru_cache(maxsize=1)
def pandas_version_info() -> Tuple[int, ...]:
"""
Get the Pandas version as a tuple of integers,
akin to `sys.version_info` for the Python version.
""... | |
27,476 | /home/hieuvd/dung_repo/raw/stars_01/ydataai_ydata-profiling/ydata-profiling | /home/hieuvd/dung_repo/raw/stars_01/ydataai_ydata-profiling/ydata-profiling/src/ydata_profiling/utils/imghdr_patch.py | 23,24 | 1,32 | test_jpeg3 | 25,29 | 24,29 | # Monkeypatch bug in imagehdr
from imghdr import tests
def test_jpeg1(h, f):
"""JPEG data in JFIF format"""
if b"JFIF" in h[:23]:
return "jpeg"
JPEG_MARK = (
b"\xff\xd8\xff\xdb\x00C\x00\x08\x06\x06"
b"\x07\x06\x05\x08\x07\x07\x07\t\t\x08\n\x0c\x14\r\x0c\x0b\x0b\x0c\x19\x12\x13\x0f"
)
def t... | # Monkeypatch bug in imagehdr
from imghdr import tests
def test_jpeg1(h, f):
"""JPEG data in JFIF format"""
if b"JFIF" in h[:23]:
return "jpeg"
JPEG_MARK = (
b"\xff\xd8\xff\xdb\x00C\x00\x08\x06\x06"
b"\x07\x06\x05\x08\x07\x07\x07\t\t\x08\n\x0c\x14\r\x0c\x0b\x0b\x0c\x19\x12\x13\x0f"
)
def t... | if h[6:10] in (b"JFIF", b"Exif") or h[:2] == b"\xff\xd8":
return "jpeg"
| """JPEG data in JFIF or Exif format"""
if h[6:10] in (b"JFIF", b"Exif") or h[:2] == b"\xff\xd8":
return "jpeg"
| 11 | 339 | 51 | 390 | # Monkeypatch bug in imagehdr
from imghdr import tests
def test_jpeg1(h, f):
"""JPEG data in JFIF format"""
if b"JFIF" in h[:23]:
return "jpeg"
JPEG_MARK = (
b"\xff\xd8\xff\xdb\x00C\x00\x08\x06\x06"
b"\x07\x06\x05\x08\x07\x07\x07\t\t\x08\n\x0c\x14\r\x0c\x0b\x0b\x0c\x19\x12\x13\x0f"
)
def t... | # Monkeypatch bug in imagehdr
from imghdr import tests
def test_jpeg1(h, f):
"""JPEG data in JFIF format"""
if b"JFIF" in h[:23]:
return "jpeg"
JPEG_MARK = (
b"\xff\xd8\xff\xdb\x00C\x00\x08\x06\x06"
b"\x07\x06\x05\x08\x07\x07\x07\t\t\x08\n\x0c\x14\r\x0c\x0b\x0b\x0c\x19\x12\x13\x0f"
)
def t... | |
27,477 | /home/hieuvd/dung_repo/raw/stars_01/ydataai_ydata-profiling/ydata-profiling | /home/hieuvd/dung_repo/raw/stars_01/ydataai_ydata-profiling/ydata-profiling/src/ydata_profiling/utils/logger.py | 16,17 | 12,37 | info_def_report | ProfilingLogger | 17,37 | 17,37 | class ProfilingLogger(logging.Logger):
def __init__(self, name: str, level: int =logging.INFO):
super().__init__(name, level)
def info_def_report(self, dataframe, timeseries: bool) -> None: # type: ignore
FILL_FUNC_BODY | class ProfilingLogger(logging.Logger):
def __init__(self, name: str, level: int =logging.INFO):
super().__init__(name, level)
def info_def_report(self, dataframe, timeseries: bool) -> None: # type: ignore
FILL_FUNC_BODY | if dataframe is pd.DataFrame:
dataframe = "pandas"
report_type = "regular"
elif dataframe is type(None):
dataframe = "pandas"
report_type = "compare"
else:
dataframe = "spark"
report_type = "regular"
datatype = "tim... | if dataframe is pd.DataFrame:
dataframe = "pandas"
report_type = "regular"
elif dataframe is type(None):
dataframe = "pandas"
report_type = "compare"
else:
dataframe = "spark"
report_type = "regular"
datatype = "tim... | 55 | 80 | 202 | 282 | """
Logger function for ydata-profiling reports
"""
import logging
import pandas as pd
from ydata_profiling.utils.common import analytics_features
class ProfilingLogger(logging.Logger):
def __init__(self, name: str, level: int =logging.INFO):
super().__init__(name, level)
def info_def_report(s... | """
Logger function for ydata-profiling reports
"""
import logging
import pandas as pd
from ydata_profiling.utils.common import analytics_features
class ProfilingLogger(logging.Logger):
def __init__(self, name: str, level: int =logging.INFO):
super().__init__(name, level)
def info_def_report(s... |
27,478 | /home/hieuvd/dung_repo/raw/stars_01/ydataai_ydata-profiling/ydata-profiling | /home/hieuvd/dung_repo/raw/stars_01/ydataai_ydata-profiling/ydata-profiling/src/ydata_profiling/utils/paths.py | 5,6 | 1,46 | get_project_root | 11,14 | 6,14 | """Paths that are useful throughout the project."""
from pathlib import Path
def get_project_root() -> Path:
FILL_FUNC_BODYdef get_config(file_name: str) -> Path:
"""Returns the path a config file.
Returns:
The path to a config file.
"""
return Path(__file__).parent.parent / file_name
def g... | """Paths that are useful throughout the project."""
from pathlib import Path
def get_project_root() -> Path:
"""Returns the path to the project root folder.
Returns:
The path to the project root folder.
"""
FILL_FUNC_BODYdef get_config(file_name: str) -> Path:
"""Returns the path a config fil... | return Path(__file__).parent.parent.parent.parent
| """Returns the path to the project root folder.
Returns:
The path to the project root folder.
"""
return Path(__file__).parent.parent.parent.parent
| 2 | 281 | 20 | 301 | """Paths that are useful throughout the project."""
from pathlib import Path
def get_project_root() -> Path:
FILL_FUNC_BODYdef get_config(file_name: str) -> Path:
"""Returns the path a config file.
Returns:
The path to a config file.
"""
return Path(__file__).parent.parent / file_name
def g... | """Paths that are useful throughout the project."""
from pathlib import Path
def get_project_root() -> Path:
"""Returns the path to the project root folder.
Returns:
The path to the project root folder.
"""
FILL_FUNC_BODYdef get_config(file_name: str) -> Path:
"""Returns the path a config fil... | |
27,479 | /home/hieuvd/dung_repo/raw/stars_01/ydataai_ydata-profiling/ydata-profiling | /home/hieuvd/dung_repo/raw/stars_01/ydataai_ydata-profiling/ydata-profiling/src/ydata_profiling/utils/progress_bar.py | 7,8 | 1,16 | progress | 8,16 | 8,16 | from functools import wraps
from typing import Any, Callable
from tqdm import tqdm
def progress(fn: Callable, bar: tqdm, message: str) -> Callable:
FILL_FUNC_BODY | from functools import wraps
from typing import Any, Callable
from tqdm import tqdm
def progress(fn: Callable, bar: tqdm, message: str) -> Callable:
FILL_FUNC_BODY | @wraps(fn)
def inner(*args, **kwargs) -> Any:
bar.set_postfix_str(message)
ret = fn(*args, **kwargs)
bar.update()
return ret
return inner
| @wraps(fn)
def inner(*args, **kwargs) -> Any:
bar.set_postfix_str(message)
ret = fn(*args, **kwargs)
bar.update()
return ret
return inner
| 16 | 62 | 69 | 131 | from functools import wraps
from typing import Any, Callable
from tqdm import tqdm
def progress(fn: Callable, bar: tqdm, message: str) -> Callable:
FILL_FUNC_BODY | from functools import wraps
from typing import Any, Callable
from tqdm import tqdm
def progress(fn: Callable, bar: tqdm, message: str) -> Callable:
FILL_FUNC_BODY | |
27,480 | /home/hieuvd/dung_repo/raw/stars_01/ydataai_ydata-profiling/ydata-profiling | /home/hieuvd/dung_repo/raw/stars_01/ydataai_ydata-profiling/ydata-profiling/src/ydata_profiling/utils/versions.py | 14,15 | 1,20 | pandas_major_version | 15,18 | 15,18 | try:
from importlib.metadata import version
except ImportError:
import pkg_resources
def version(pkg: str) -> str: # type: ignore
return pkg_resources.get_distribution(pkg).version
def pandas_version() -> list:
return list(map(int, version("pandas").split(".")))
def pandas_major_version() ... | try:
from importlib.metadata import version
except ImportError:
import pkg_resources
def version(pkg: str) -> str: # type: ignore
return pkg_resources.get_distribution(pkg).version
def pandas_version() -> list:
return list(map(int, version("pandas").split(".")))
def pandas_major_version() ... | return pandas_version()[0]
| return pandas_version()[0]
| 2 | 141 | 16 | 157 | try:
from importlib.metadata import version
except ImportError:
import pkg_resources
def version(pkg: str) -> str: # type: ignore
return pkg_resources.get_distribution(pkg).version
def pandas_version() -> list:
return list(map(int, version("pandas").split(".")))
def pandas_major_version() ... | try:
from importlib.metadata import version
except ImportError:
import pkg_resources
def version(pkg: str) -> str: # type: ignore
return pkg_resources.get_distribution(pkg).version
def pandas_version() -> list:
return list(map(int, version("pandas").split(".")))
def pandas_major_version() ... | |
27,481 | /home/hieuvd/dung_repo/raw/stars_01/ydataai_ydata-profiling/ydata-profiling | /home/hieuvd/dung_repo/raw/stars_01/ydataai_ydata-profiling/ydata-profiling/src/ydata_profiling/visualisation/context.py | 13,15 | 1,88 | manage_matplotlib_context | 16,88 | 15,88 | import contextlib
import warnings
from typing import Any
import matplotlib
import seaborn as sns
from pandas.plotting import (
deregister_matplotlib_converters,
register_matplotlib_converters,
)
@contextlib.contextmanager
def manage_matplotlib_context() -> Any:
FILL_FUNC_BODY | import contextlib
import warnings
from typing import Any
import matplotlib
import seaborn as sns
from pandas.plotting import (
deregister_matplotlib_converters,
register_matplotlib_converters,
)
@contextlib.contextmanager
def manage_matplotlib_context() -> Any:
"""Return a context manager for temporarily... | originalRcParams = matplotlib.rcParams.copy()
# Credits for this style go to the ggplot and seaborn packages.
# We copied the style file to remove dependencies on the Seaborn package.
# Check it out, it's an awesome library for plotting
customRcParams = {
"patch.facecolor": "#348ABD", ... | """Return a context manager for temporarily changing matplotlib unit registries and rcParams."""
originalRcParams = matplotlib.rcParams.copy()
# Credits for this style go to the ggplot and seaborn packages.
# We copied the style file to remove dependencies on the Seaborn package.
# Check it out... | 182 | 116 | 920 | 1,036 | import contextlib
import warnings
from typing import Any
import matplotlib
import seaborn as sns
from pandas.plotting import (
deregister_matplotlib_converters,
register_matplotlib_converters,
)
@contextlib.contextmanager
def manage_matplotlib_context() -> Any:
FILL_FUNC_BODY | import contextlib
import warnings
from typing import Any
import matplotlib
import seaborn as sns
from pandas.plotting import (
deregister_matplotlib_converters,
register_matplotlib_converters,
)
@contextlib.contextmanager
def manage_matplotlib_context() -> Any:
"""Return a context manager for temporarily... | |
27,482 | /home/hieuvd/dung_repo/raw/stars_01/ydataai_ydata-profiling/ydata-profiling | /home/hieuvd/dung_repo/raw/stars_01/ydataai_ydata-profiling/ydata-profiling/src/ydata_profiling/visualisation/missing.py | 99,103 | 1,139 | plot_missing_heatmap | 114,139 | 103,139 | """Plotting functions for the missing values diagrams"""
from typing import Any, List
from matplotlib import pyplot as plt
from ydata_profiling.config import Settings
from ydata_profiling.visualisation.context import manage_matplotlib_context
from ydata_profiling.visualisation.plot import (
missing_bar,
missi... | """Plotting functions for the missing values diagrams"""
from typing import Any, List
from matplotlib import pyplot as plt
from ydata_profiling.config import Settings
from ydata_profiling.visualisation.context import manage_matplotlib_context
from ydata_profiling.visualisation.plot import (
missing_bar,
missi... |
height = 4
if len(columns) > 10:
height += int((len(columns) - 10) / 5)
height = min(height, 10)
font_size = get_font_size(columns)
if len(columns) > 40:
font_size /= 1.4
missing_heatmap(
corr_mat=corr_mat,
mask=mask,
figsize=(10, height),
fonts... | """Generate missing values heatmap plot.
Args:
config: report Settings object
corr_mat: Correlation matrix.
maks: Upper-triangle mask.
columns: List of column names.
Returns:
The resulting missing values heatmap plot encoded as a string.
"""
height = 4
... | 52 | 1,067 | 294 | 1,361 | """Plotting functions for the missing values diagrams"""
from typing import Any, List
from matplotlib import pyplot as plt
from ydata_profiling.config import Settings
from ydata_profiling.visualisation.context import manage_matplotlib_context
from ydata_profiling.visualisation.plot import (
missing_bar,
missi... | """Plotting functions for the missing values diagrams"""
from typing import Any, List
from matplotlib import pyplot as plt
from ydata_profiling.config import Settings
from ydata_profiling.visualisation.context import manage_matplotlib_context
from ydata_profiling.visualisation.plot import (
missing_bar,
missi... | |
27,483 | /home/hieuvd/dung_repo/raw/stars_01/ydataai_ydata-profiling/ydata-profiling | /home/hieuvd/dung_repo/raw/stars_01/ydataai_ydata-profiling/ydata-profiling/src/ydata_profiling/visualisation/utils.py | 46,52 | 1,114 | plot_360_n0sc0pe | 61,114 | 52,114 | """Plotting utility functions."""
import base64
import uuid
from io import BytesIO, StringIO
from pathlib import Path
from typing import List, Optional, Tuple
from urllib.parse import quote
import matplotlib.pyplot as plt
from matplotlib.artist import Artist
from ydata_profiling.config import Settings
def hex_to_rg... | """Plotting utility functions."""
import base64
import uuid
from io import BytesIO, StringIO
from pathlib import Path
from typing import List, Optional, Tuple
from urllib.parse import quote
import matplotlib.pyplot as plt
from matplotlib.artist import Artist
from ydata_profiling.config import Settings
def hex_to_rg... |
if image_format is None:
image_format = config.plot.image_format.value
mime_types = {"png": "image/png", "svg": "image/svg+xml"}
if image_format not in mime_types:
raise ValueError('Can only 360 n0sc0pe "png" or "svg" format.')
if config.html.inline:
if image_format == "svg":
... | """Quickscope the plot to a base64 encoded string.
Args:
config: Settings
image_format: png or svg, overrides config.
Returns:
A base64 encoded version of the plot in the specified image format.
"""
if image_format is None:
image_format = config.plot.image_format.v... | 109 | 540 | 573 | 1,113 | """Plotting utility functions."""
import base64
import uuid
from io import BytesIO, StringIO
from pathlib import Path
from typing import List, Optional, Tuple
from urllib.parse import quote
import matplotlib.pyplot as plt
from matplotlib.artist import Artist
from ydata_profiling.config import Settings
def hex_to_rg... | """Plotting utility functions."""
import base64
import uuid
from io import BytesIO, StringIO
from pathlib import Path
from typing import List, Optional, Tuple
from urllib.parse import quote
import matplotlib.pyplot as plt
from matplotlib.artist import Artist
from ydata_profiling.config import Settings
def hex_to_rg... | |
27,513 | /home/hieuvd/dung_repo/raw/stars_01/youfou_wxpy/wxpy | /home/hieuvd/dung_repo/raw/stars_01/youfou_wxpy/wxpy/wxpy/api/chats/chats.py | 138,139 | 14,155 | add_all | Chats | 145,155 | 139,155 | class Chats(list):
"""
多个聊天对象的合集,可用于搜索或统计
"""
def __init__(self, chat_list=None, source=None):
if chat_list:
super(Chats, self).__init__(chat_list)
self.source = source
def __add__(self, other):
return Chats(super(Chats, self).__add__(other or list()))
def ... | class Chats(list):
"""
多个聊天对象的合集,可用于搜索或统计
"""
def __init__(self, chat_list=None, source=None):
if chat_list:
super(Chats, self).__init__(chat_list)
self.source = source
def __add__(self, other):
return Chats(super(Chats, self).__add__(other or list()))
def ... | to_add = self[:]
while to_add:
adding = to_add.pop(0)
logger.info('Adding {}'.format(adding))
ret = adding.add(verify_content=verify_content)
logger.info(ret)
logger.info('Waiting for {} seconds'.format(interval))
if to_add:
... | """
将合集中的所有用户加为好友,请小心应对调用频率限制!
:param interval: 间隔时间(秒)
:param verify_content: 验证说明文本
"""
to_add = self[:]
while to_add:
adding = to_add.pop(0)
logger.info('Adding {}'.format(adding))
ret = adding.add(verify_content=verify_con... | 21 | 1,294 | 110 | 1,404 | # coding: utf-8
from __future__ import unicode_literals
import logging
import time
from collections import Counter
from wxpy.utils import match_attributes, match_name
from wxpy.compatible import *
logger = logging.getLogger(__name__)
class Chats(list):
"""
多个聊天对象的合集,可用于搜索或统计
"""
def __init__(self,... | # coding: utf-8
from __future__ import unicode_literals
import logging
import time
from collections import Counter
from wxpy.utils import match_attributes, match_name
from wxpy.compatible import *
logger = logging.getLogger(__name__)
class Chats(list):
"""
多个聊天对象的合集,可用于搜索或统计
"""
def __init__(self,... |
27,514 | /home/hieuvd/dung_repo/raw/stars_01/youfou_wxpy/wxpy | /home/hieuvd/dung_repo/raw/stars_01/youfou_wxpy/wxpy/wxpy/api/chats/group.py | 169,171 | 14,177 | do | Group | 171,174 | 171,174 | class Group(Chat):
"""
群聊对象
"""
def __init__(self, raw, bot):
super(Group, self).__init__(raw, bot)
@property
def members(self):
"""
群聊的成员列表
"""
def raw_member_list(update=False):
if update:
self.update_group()
re... | class Group(Chat):
"""
群聊对象
"""
def __init__(self, raw, bot):
super(Group, self).__init__(raw, bot)
@property
def members(self):
"""
群聊的成员列表
"""
def raw_member_list(update=False):
if update:
self.update_group()
re... | logger.info('renaming group: {} => {}'.format(self.name, name))
return self.bot.core.set_chatroom_name(get_user_name(self), name)
| logger.info('renaming group: {} => {}'.format(self.name, name))
return self.bot.core.set_chatroom_name(get_user_name(self), name)
| 9 | 1,260 | 52 | 1,312 | # coding: utf-8
from __future__ import unicode_literals
import logging
from wxpy.utils import ensure_list, get_user_name, handle_response, wrap_user_name
from .chat import Chat
from .chats import Chats
from .member import Member
logger = logging.getLogger(__name__)
class Group(Chat):
"""
群聊对象
"""
... | # coding: utf-8
from __future__ import unicode_literals
import logging
from wxpy.utils import ensure_list, get_user_name, handle_response, wrap_user_name
from .chat import Chat
from .chats import Chats
from .member import Member
logger = logging.getLogger(__name__)
class Group(Chat):
"""
群聊对象
"""
... |
27,515 | /home/hieuvd/dung_repo/raw/stars_01/youfou_wxpy/wxpy | /home/hieuvd/dung_repo/raw/stars_01/youfou_wxpy/wxpy/wxpy/api/chats/groups.py | 43,44 | 8,72 | search | Groups | 53,72 | 44,72 | class Groups(list):
"""
群聊的合集,可用于按条件搜索
"""
# 记录已知的 shadow group 和 valid group
# shadow group 直接抛弃
# valid group 直接通过
# 其他的需要确认是否包含机器人自身,并再分类到上面两种群中
shadow_group_user_names = list()
valid_group_user_names = list()
def __init__(self, group_list=None):
if group_list:
... | class Groups(list):
"""
群聊的合集,可用于按条件搜索
"""
# 记录已知的 shadow group 和 valid group
# shadow group 直接抛弃
# valid group 直接通过
# 其他的需要确认是否包含机器人自身,并再分类到上面两种群中
shadow_group_user_names = list()
valid_group_user_names = list()
def __init__(self, group_list=None):
if group_list:
... |
users = ensure_list(users)
if users:
for user in users:
if not isinstance(user, User):
raise TypeError('expected `User`, got {} (type: {})'.format(user, type(user)))
def match(group):
if not match_name(group, keywords):
... | """
在群聊合集中,根据给定的条件进行搜索
:param keywords: 群聊名称关键词
:param users: 需包含的用户
:param attributes: 属性键值对,键可以是 owner(群主对象), is_owner(自身是否为群主), nick_name(精准名称) 等。
:return: 匹配条件的群聊列表
:rtype: :class:`wxpy.Groups`
"""
users = ensure_list(users)
if users:... | 50 | 505 | 161 | 666 | # coding: utf-8
from __future__ import unicode_literals
from wxpy.utils import ensure_list, match_attributes, match_name
from .user import User
class Groups(list):
"""
群聊的合集,可用于按条件搜索
"""
# 记录已知的 shadow group 和 valid group
# shadow group 直接抛弃
# valid group 直接通过
# 其他的需要确认是否包含机器人自身,并再分类到上面两... | # coding: utf-8
from __future__ import unicode_literals
from wxpy.utils import ensure_list, match_attributes, match_name
from .user import User
class Groups(list):
"""
群聊的合集,可用于按条件搜索
"""
# 记录已知的 shadow group 和 valid group
# shadow group 直接抛弃
# valid group 直接通过
# 其他的需要确认是否包含机器人自身,并再分类到上面两... |
27,516 | /home/hieuvd/dung_repo/raw/stars_01/youfou_wxpy/wxpy | /home/hieuvd/dung_repo/raw/stars_01/youfou_wxpy/wxpy/wxpy/api/chats/member.py | 19,21 | 10,49 | group | Member | 21,26 | 21,26 | class Member(User):
"""
群聊成员对象
"""
def __init__(self, raw, group):
super(Member, self).__init__(raw, group.bot)
self._group_user_name = group.user_name
@property
def group(self):
FILL_FUNC_BODY @property
def display_name(self):
"""
在群聊中的显示昵称
"""
... | class Member(User):
"""
群聊成员对象
"""
def __init__(self, raw, group):
super(Member, self).__init__(raw, group.bot)
self._group_user_name = group.user_name
@property
def group(self):
FILL_FUNC_BODY @property
def display_name(self):
"""
在群聊中的显示昵称
"""
... | for _group in self.bot.groups():
if _group.user_name == self._group_user_name:
return _group
raise Exception('failed to find the group belong to')
| for _group in self.bot.groups():
if _group.user_name == self._group_user_name:
return _group
raise Exception('failed to find the group belong to')
| 18 | 277 | 54 | 331 | # coding: utf-8
from __future__ import unicode_literals
from .user import User
# Todo: 若尝试获取群成员信息时为空,自动更新成员信息 (并要照顾到遍历所有群成员的场景)
class Member(User):
"""
群聊成员对象
"""
def __init__(self, raw, group):
super(Member, self).__init__(raw, group.bot)
self._group_user_name = group.user_name
... | # coding: utf-8
from __future__ import unicode_literals
from .user import User
# Todo: 若尝试获取群成员信息时为空,自动更新成员信息 (并要照顾到遍历所有群成员的场景)
class Member(User):
"""
群聊成员对象
"""
def __init__(self, raw, group):
super(Member, self).__init__(raw, group.bot)
self._group_user_name = group.user_name
... |
27,517 | /home/hieuvd/dung_repo/raw/stars_01/youfou_wxpy/wxpy | /home/hieuvd/dung_repo/raw/stars_01/youfou_wxpy/wxpy/wxpy/api/chats/user.py | 74,76 | 12,106 | is_friend | User | 81,89 | 76,89 | class User(Chat):
"""
好友(:class:`Friend`)、群聊成员(:class:`Member`),和公众号(:class:`MP`) 的基础类
"""
def __init__(self, raw, bot):
super(User, self).__init__(raw, bot)
@property
def remark_name(self):
"""
备注名称
"""
return self.raw.get('RemarkName')
@handle_res... | class User(Chat):
"""
好友(:class:`Friend`)、群聊成员(:class:`Member`),和公众号(:class:`MP`) 的基础类
"""
def __init__(self, raw, bot):
super(User, self).__init__(raw, bot)
@property
def remark_name(self):
"""
备注名称
"""
return self.raw.get('RemarkName')
@handle_res... | if self.bot:
try:
friends = self.bot.friends()
index = friends.index(self)
return friends[index]
except ValueError:
return False
| """
判断当前用户是否为好友关系
:return: 若为好友关系,返回对应的好友,否则返回 False
"""
if self.bot:
try:
friends = self.bot.friends()
index = friends.index(self)
return friends[index]
except ValueError:
return False
| 15 | 636 | 57 | 693 | # coding: utf-8
from __future__ import unicode_literals
import logging
from wxpy.utils import handle_response
from .chat import Chat
logger = logging.getLogger(__name__)
class User(Chat):
"""
好友(:class:`Friend`)、群聊成员(:class:`Member`),和公众号(:class:`MP`) 的基础类
"""
def __init__(self, raw, bot):
... | # coding: utf-8
from __future__ import unicode_literals
import logging
from wxpy.utils import handle_response
from .chat import Chat
logger = logging.getLogger(__name__)
class User(Chat):
"""
好友(:class:`Friend`)、群聊成员(:class:`Member`),和公众号(:class:`MP`) 的基础类
"""
def __init__(self, raw, bot):
... |
27,519 | /home/hieuvd/dung_repo/raw/stars_01/youfou_wxpy/wxpy | /home/hieuvd/dung_repo/raw/stars_01/youfou_wxpy/wxpy/wxpy/api/messages/message_config.py | 41,43 | 13,67 | enabled | MessageConfig | 46,49 | 43,49 | class MessageConfig(object):
"""
单个消息注册配置
"""
def __init__(
self, bot, func,
chats, msg_types, except_self,
run_async, enabled
):
self.bot = weakref.proxy(bot)
self.func = func
self.chats = ensure_list(chats)
self.msg_types = ensu... | class MessageConfig(object):
"""
单个消息注册配置
"""
def __init__(
self, bot, func,
chats, msg_types, except_self,
run_async, enabled
):
self.bot = weakref.proxy(bot)
self.func = func
self.chats = ensure_list(chats)
self.msg_types = ensu... | self._enabled = boolean
logger.info(self)
| """
设置配置的开启状态
"""
self._enabled = boolean
logger.info(self)
| 4 | 406 | 19 | 425 | # coding: utf-8
from __future__ import unicode_literals
import logging
import weakref
from wxpy.compatible.utils import force_encoded_string_output
from wxpy.utils import ensure_list
logger = logging.getLogger(__name__)
class MessageConfig(object):
"""
单个消息注册配置
"""
def __init__(
self, ... | # coding: utf-8
from __future__ import unicode_literals
import logging
import weakref
from wxpy.compatible.utils import force_encoded_string_output
from wxpy.utils import ensure_list
logger = logging.getLogger(__name__)
class MessageConfig(object):
"""
单个消息注册配置
"""
def __init__(
self, ... |
27,520 | /home/hieuvd/dung_repo/raw/stars_01/youfou_wxpy/wxpy | /home/hieuvd/dung_repo/raw/stars_01/youfou_wxpy/wxpy/wxpy/api/messages/messages.py | 28,29 | 8,46 | search | Messages | 37,46 | 29,46 | class Messages(list):
"""
多条消息的合集,可用于记录或搜索
"""
def __init__(self, msg_list=None, max_history=200):
if msg_list:
super(Messages, self).__init__(msg_list)
self.max_history = max_history
self._thread_lock = threading.Lock()
def append(self, msg):
"""
... | class Messages(list):
"""
多条消息的合集,可用于记录或搜索
"""
def __init__(self, msg_list=None, max_history=200):
if msg_list:
super(Messages, self).__init__(msg_list)
self.max_history = max_history
self._thread_lock = threading.Lock()
def append(self, msg):
"""
... |
def match(msg):
if not match_text(msg.text, keywords):
return
if not match_attributes(msg, **attributes):
return
return True
return Messages(filter(match, self), max_history=self.max_history)
| """
搜索消息记录
:param keywords: 文本关键词
:param attributes: 属性键值对
:return: 所有匹配的消息
:rtype: :class:`wxpy.Messages`
"""
def match(msg):
if not match_text(msg.text, keywords):
return
if not match_attributes(msg, **attributes... | 18 | 287 | 77 | 364 | # coding: utf-8
from __future__ import unicode_literals
import threading
from wxpy.utils import match_attributes, match_text
class Messages(list):
"""
多条消息的合集,可用于记录或搜索
"""
def __init__(self, msg_list=None, max_history=200):
if msg_list:
super(Messages, self).__init__(msg_list)
... | # coding: utf-8
from __future__ import unicode_literals
import threading
from wxpy.utils import match_attributes, match_text
class Messages(list):
"""
多条消息的合集,可用于记录或搜索
"""
def __init__(self, msg_list=None, max_history=200):
if msg_list:
super(Messages, self).__init__(msg_list)
... |
27,521 | /home/hieuvd/dung_repo/raw/stars_01/youfou_wxpy/wxpy | /home/hieuvd/dung_repo/raw/stars_01/youfou_wxpy/wxpy/wxpy/api/messages/registered.py | 19,20 | 9,103 | get_config | Registered | 26,44 | 20,44 | class Registered(list):
def __init__(self, bot):
"""
保存当前机器人所有已注册的消息配置
:param bot: 所属的机器人
"""
super(Registered, self).__init__()
self.bot = weakref.proxy(bot)
def get_config(self, msg):
FILL_FUNC_BODY def get_config_by_func(self, func):
"""
通过... | class Registered(list):
def __init__(self, bot):
"""
保存当前机器人所有已注册的消息配置
:param bot: 所属的机器人
"""
super(Registered, self).__init__()
self.bot = weakref.proxy(bot)
def get_config(self, msg):
"""
获取给定消息的注册配置。每条消息仅匹配一个注册配置,后注册的配置具有更高的匹配优先级。
:pa... |
for conf in self[::-1]:
if not conf.enabled or (conf.except_self and msg.sender == self.bot.self):
continue
if conf.msg_types and msg.type not in conf.msg_types:
continue
elif conf.msg_types is None and msg.type == SYSTEM:
co... | """
获取给定消息的注册配置。每条消息仅匹配一个注册配置,后注册的配置具有更高的匹配优先级。
:param msg: 给定的消息
:return: 匹配的回复配置
"""
for conf in self[::-1]:
if not conf.enabled or (conf.except_self and msg.sender == self.bot.self):
continue
if conf.msg_types and msg.type no... | 53 | 589 | 164 | 753 | # coding: utf-8
from __future__ import unicode_literals
import weakref
from wxpy.api.consts import SYSTEM
class Registered(list):
def __init__(self, bot):
"""
保存当前机器人所有已注册的消息配置
:param bot: 所属的机器人
"""
super(Registered, self).__init__()
self.bot = weakref.proxy(bot... | # coding: utf-8
from __future__ import unicode_literals
import weakref
from wxpy.api.consts import SYSTEM
class Registered(list):
def __init__(self, bot):
"""
保存当前机器人所有已注册的消息配置
:param bot: 所属的机器人
"""
super(Registered, self).__init__()
self.bot = weakref.proxy(bot... |
27,522 | /home/hieuvd/dung_repo/raw/stars_01/youfou_wxpy/wxpy | /home/hieuvd/dung_repo/raw/stars_01/youfou_wxpy/wxpy/wxpy/compatible/utils.py | 95,96 | 1,106 | force_encoded_string_output | 96,106 | 96,106 | # coding: utf-8
from __future__ import print_function
import warnings as _warnings
import os as _os
import sys as _sys
from tempfile import mkdtemp
import sys
from . import *
class TemporaryDirectory(object):
"""Create and return a temporary directory. This has the same
behavior as mkdtemp but can be used... | # coding: utf-8
from __future__ import print_function
import warnings as _warnings
import os as _os
import sys as _sys
from tempfile import mkdtemp
import sys
from . import *
class TemporaryDirectory(object):
"""Create and return a temporary directory. This has the same
behavior as mkdtemp but can be used... |
if sys.version_info.major < 3:
def _func(*args, **kwargs):
return func(*args, **kwargs).encode(sys.stdout.encoding or 'utf-8')
return _func
else:
return func |
if sys.version_info.major < 3:
def _func(*args, **kwargs):
return func(*args, **kwargs).encode(sys.stdout.encoding or 'utf-8')
return _func
else:
return func | 17 | 862 | 74 | 936 | # coding: utf-8
from __future__ import print_function
import warnings as _warnings
import os as _os
import sys as _sys
from tempfile import mkdtemp
import sys
from . import *
class TemporaryDirectory(object):
"""Create and return a temporary directory. This has the same
behavior as mkdtemp but can be used... | # coding: utf-8
from __future__ import print_function
import warnings as _warnings
import os as _os
import sys as _sys
from tempfile import mkdtemp
import sys
from . import *
class TemporaryDirectory(object):
"""Create and return a temporary directory. This has the same
behavior as mkdtemp but can be used... | |
27,523 | /home/hieuvd/dung_repo/raw/stars_01/youfou_wxpy/wxpy | /home/hieuvd/dung_repo/raw/stars_01/youfou_wxpy/wxpy/wxpy/compatible/utils.py | 37,38 | 14,95 | cleanup | TemporaryDirectory | 38,54 | 38,54 | class TemporaryDirectory(object):
"""Create and return a temporary directory. This has the same
behavior as mkdtemp but can be used as a context manager. For
example:
with TemporaryDirectory() as tmpdir:
...
Upon exiting the context, the directory and everything contained
in ... | class TemporaryDirectory(object):
"""Create and return a temporary directory. This has the same
behavior as mkdtemp but can be used as a context manager. For
example:
with TemporaryDirectory() as tmpdir:
...
Upon exiting the context, the directory and everything contained
in ... | if self.name and not self._closed:
try:
self._rmtree(self.name)
except (TypeError, AttributeError) as ex:
# Issue #10188: Emit a warning on stderr
# if the directory could not be cleaned
# up due to missing globals
... | if self.name and not self._closed:
try:
self._rmtree(self.name)
except (TypeError, AttributeError) as ex:
# Issue #10188: Emit a warning on stderr
# if the directory could not be cleaned
# up due to missing globals
... | 60 | 624 | 185 | 809 | # coding: utf-8
from __future__ import print_function
import warnings as _warnings
import os as _os
import sys as _sys
from tempfile import mkdtemp
import sys
from . import *
class TemporaryDirectory(object):
"""Create and return a temporary directory. This has the same
behavior as mkdtemp but can be used... | # coding: utf-8
from __future__ import print_function
import warnings as _warnings
import os as _os
import sys as _sys
from tempfile import mkdtemp
import sys
from . import *
class TemporaryDirectory(object):
"""Create and return a temporary directory. This has the same
behavior as mkdtemp but can be used... |
27,524 | /home/hieuvd/dung_repo/raw/stars_01/youfou_wxpy/wxpy | /home/hieuvd/dung_repo/raw/stars_01/youfou_wxpy/wxpy/wxpy/ext/logging_with_wechat.py | 38,39 | 1,56 | get_wechat_logger | 50,56 | 39,56 | # coding: utf-8
from __future__ import unicode_literals
import logging
from wxpy.utils import get_receiver
logger = logging.getLogger(__name__)
class WeChatLoggingHandler(logging.Handler):
def __init__(self, receiver=None):
"""
可向指定微信聊天对象发送日志的 Logging Handler
:param receiver:
... | # coding: utf-8
from __future__ import unicode_literals
import logging
from wxpy.utils import get_receiver
logger = logging.getLogger(__name__)
class WeChatLoggingHandler(logging.Handler):
def __init__(self, receiver=None):
"""
可向指定微信聊天对象发送日志的 Logging Handler
:param receiver:
... |
_logger = logging.getLogger(name=name)
_logger.setLevel(level=level)
_logger.addHandler(WeChatLoggingHandler(receiver=receiver))
return _logger
| """
获得一个可向指定微信聊天对象发送日志的 Logger
:param receiver:
* 当为 `None`, `True` 或字符串时,将以该值作为 `cache_path` 参数启动一个新的机器人,并发送到该机器人的"文件传输助手"
* 当为 :class:`机器人 <Bot>` 时,将发送到该机器人的"文件传输助手"
* 当为 :class:`聊天对象 <Chat>` 时,将发送到该聊天对象
:param name: Logger 名称
:param level: Logger 等级,默认为 `logging.WARNING`
... | 7 | 549 | 59 | 608 | # coding: utf-8
from __future__ import unicode_literals
import logging
from wxpy.utils import get_receiver
logger = logging.getLogger(__name__)
class WeChatLoggingHandler(logging.Handler):
def __init__(self, receiver=None):
"""
可向指定微信聊天对象发送日志的 Logging Handler
:param receiver:
... | # coding: utf-8
from __future__ import unicode_literals
import logging
from wxpy.utils import get_receiver
logger = logging.getLogger(__name__)
class WeChatLoggingHandler(logging.Handler):
def __init__(self, receiver=None):
"""
可向指定微信聊天对象发送日志的 Logging Handler
:param receiver:
... | |
27,525 | /home/hieuvd/dung_repo/raw/stars_01/youfou_wxpy/wxpy | /home/hieuvd/dung_repo/raw/stars_01/youfou_wxpy/wxpy/wxpy/ext/logging_with_wechat.py | 25,26 | 11,38 | emit | WeChatLoggingHandler | 26,38 | 26,38 | class WeChatLoggingHandler(logging.Handler):
def __init__(self, receiver=None):
"""
可向指定微信聊天对象发送日志的 Logging Handler
:param receiver:
* 当为 `None`, `True` 或字符串时,将以该值作为 `cache_path` 参数启动一个新的机器人,并发送到该机器人的"文件传输助手"
* 当为 :class:`机器人 <Bot>` 时,将发送到该机器人的"文件传输助手"
* ... | class WeChatLoggingHandler(logging.Handler):
def __init__(self, receiver=None):
"""
可向指定微信聊天对象发送日志的 Logging Handler
:param receiver:
* 当为 `None`, `True` 或字符串时,将以该值作为 `cache_path` 参数启动一个新的机器人,并发送到该机器人的"文件传输助手"
* 当为 :class:`机器人 <Bot>` 时,将发送到该机器人的"文件传输助手"
* ... | if record.name.startswith('wxpy.'):
# 排除 wxpy 的日志
return
# noinspection PyBroadException
try:
self.receiver.send(self.format(record))
except:
# Todo: 将异常输出到屏幕
pass
| if record.name.startswith('wxpy.'):
# 排除 wxpy 的日志
return
# noinspection PyBroadException
try:
self.receiver.send(self.format(record))
except:
# Todo: 将异常输出到屏幕
pass
| 17 | 218 | 93 | 311 | # coding: utf-8
from __future__ import unicode_literals
import logging
from wxpy.utils import get_receiver
logger = logging.getLogger(__name__)
class WeChatLoggingHandler(logging.Handler):
def __init__(self, receiver=None):
"""
可向指定微信聊天对象发送日志的 Logging Handler
:param receiver:
... | # coding: utf-8
from __future__ import unicode_literals
import logging
from wxpy.utils import get_receiver
logger = logging.getLogger(__name__)
class WeChatLoggingHandler(logging.Handler):
def __init__(self, receiver=None):
"""
可向指定微信聊天对象发送日志的 Logging Handler
:param receiver:
... |
27,527 | /home/hieuvd/dung_repo/raw/stars_01/youfou_wxpy/wxpy | /home/hieuvd/dung_repo/raw/stars_01/youfou_wxpy/wxpy/wxpy/ext/talk_bot_utils.py | 35,36 | 1,47 | next_topic | 39,47 | 36,47 | # coding: utf-8
from __future__ import unicode_literals
import random
import re
def get_context_user_id(msg, max_len=32, re_sub=r'[^a-zA-Z\d]'):
"""
| 通过消息对象获取 Tuling, XiaoI 等聊天机器人的上下文用户 ID
| 上下文用户 ID: 为群聊时,取群员的 user_name;非群聊时,取聊天对象的 user_name
:param msg: 消息对象
:param max_len: 最大长度 (从末尾截取)
:pa... | # coding: utf-8
from __future__ import unicode_literals
import random
import re
def get_context_user_id(msg, max_len=32, re_sub=r'[^a-zA-Z\d]'):
"""
| 通过消息对象获取 Tuling, XiaoI 等聊天机器人的上下文用户 ID
| 上下文用户 ID: 为群聊时,取群员的 user_name;非群聊时,取聊天对象的 user_name
:param msg: 消息对象
:param max_len: 最大长度 (从末尾截取)
:pa... |
return random.choice((
'换个话题吧',
'聊点别的吧',
'下一个话题吧',
'无言以对呢',
'这话我接不了呢'
))
| """
聊天机器人无法获取回复时的备用回复
"""
return random.choice((
'换个话题吧',
'聊点别的吧',
'下一个话题吧',
'无言以对呢',
'这话我接不了呢'
))
| 8 | 360 | 66 | 426 | # coding: utf-8
from __future__ import unicode_literals
import random
import re
def get_context_user_id(msg, max_len=32, re_sub=r'[^a-zA-Z\d]'):
"""
| 通过消息对象获取 Tuling, XiaoI 等聊天机器人的上下文用户 ID
| 上下文用户 ID: 为群聊时,取群员的 user_name;非群聊时,取聊天对象的 user_name
:param msg: 消息对象
:param max_len: 最大长度 (从末尾截取)
:pa... | # coding: utf-8
from __future__ import unicode_literals
import random
import re
def get_context_user_id(msg, max_len=32, re_sub=r'[^a-zA-Z\d]'):
"""
| 通过消息对象获取 Tuling, XiaoI 等聊天机器人的上下文用户 ID
| 上下文用户 ID: 为群聊时,取群员的 user_name;非群聊时,取聊天对象的 user_name
:param msg: 消息对象
:param max_len: 最大长度 (从末尾截取)
:pa... | |
27,528 | /home/hieuvd/dung_repo/raw/stars_01/youfou_wxpy/wxpy | /home/hieuvd/dung_repo/raw/stars_01/youfou_wxpy/wxpy/wxpy/ext/tuling.py | 42,43 | 16,153 | is_last_member | Tuling | 43,48 | 43,48 | class Tuling(object):
"""
与 wxpy 深度整合的图灵机器人
"""
'API 文档: http://tuling123.com/help/h_cent_webapi.jhtml'
# 考虑升级 API 版本: http://doc.tuling123.com/openapi2/263611
url = 'http://www.tuling123.com/openapi/api'
def __init__(self, api_key=None):
"""
| 内置的 api key 存在调用限制,建议自行申请。
... | class Tuling(object):
"""
与 wxpy 深度整合的图灵机器人
"""
'API 文档: http://tuling123.com/help/h_cent_webapi.jhtml'
# 考虑升级 API 版本: http://doc.tuling123.com/openapi2/263611
url = 'http://www.tuling123.com/openapi/api'
def __init__(self, api_key=None):
"""
| 内置的 api key 存在调用限制,建议自行申请。
... | if msg.member == self.last_member.get(msg.chat):
return True
else:
self.last_member[msg.chat] = msg.member
| if msg.member == self.last_member.get(msg.chat):
return True
else:
self.last_member[msg.chat] = msg.member
| 10 | 1,184 | 49 | 1,233 | # coding: utf-8
from __future__ import unicode_literals
import logging
import pprint
import requests
from wxpy.ext.talk_bot_utils import get_context_user_id, next_topic
from wxpy.utils.misc import get_text_without_at_bot
from wxpy.utils import enhance_connection
from wxpy.compatible import *
logger = logging.getLogg... | # coding: utf-8
from __future__ import unicode_literals
import logging
import pprint
import requests
from wxpy.ext.talk_bot_utils import get_context_user_id, next_topic
from wxpy.utils.misc import get_text_without_at_bot
from wxpy.utils import enhance_connection
from wxpy.compatible import *
logger = logging.getLogg... |
27,529 | /home/hieuvd/dung_repo/raw/stars_01/youfou_wxpy/wxpy | /home/hieuvd/dung_repo/raw/stars_01/youfou_wxpy/wxpy/wxpy/ext/xiaoi.py | 105,106 | 20,139 | reply_text | XiaoI | 112,139 | 106,139 | class XiaoI(object):
"""
与 wxpy 深度整合的小 i 机器人
"""
# noinspection SpellCheckingInspection
def __init__(self, key, secret):
"""
| 需要通过注册获得 key 和 secret
| 免费申请: http://cloud.xiaoi.com/
:param key: 你申请的 key
:param secret: 你申请的 secret
"""
self.key... | class XiaoI(object):
"""
与 wxpy 深度整合的小 i 机器人
"""
# noinspection SpellCheckingInspection
def __init__(self, key, secret):
"""
| 需要通过注册获得 key 和 secret
| 免费申请: http://cloud.xiaoi.com/
:param key: 你申请的 key
:param secret: 你申请的 secret
"""
self.key... |
error_response = (
"主人还没给我设置这类话题的回复",
)
if isinstance(msg, Message):
user_id = get_context_user_id(msg)
question = get_text_without_at_bot(msg)
else:
user_id = "abc"
question = msg or ""
params = {
"questi... | """
仅返回答复文本
:param msg: Message 对象,或消息文本
:return: 答复文本
"""
error_response = (
"主人还没给我设置这类话题的回复",
)
if isinstance(msg, Message):
user_id = get_context_user_id(msg)
question = get_text_without_at_bot(msg)
else:
... | 54 | 840 | 213 | 1,053 | # coding: utf-8
from __future__ import unicode_literals
# created by: Han Feng (https://github.com/hanx11)
import collections
import hashlib
import logging
import requests
from wxpy.api.messages import Message
from wxpy.ext.talk_bot_utils import get_context_user_id, next_topic
from wxpy.utils.misc import get_text_wi... | # coding: utf-8
from __future__ import unicode_literals
# created by: Han Feng (https://github.com/hanx11)
import collections
import hashlib
import logging
import requests
from wxpy.api.messages import Message
from wxpy.ext.talk_bot_utils import get_context_user_id, next_topic
from wxpy.utils.misc import get_text_wi... |
27,530 | /home/hieuvd/dung_repo/raw/stars_01/youfou_wxpy/wxpy | /home/hieuvd/dung_repo/raw/stars_01/youfou_wxpy/wxpy/wxpy/utils/base_request.py | 41,42 | 13,66 | request | BaseRequest | 48,66 | 42,66 | class BaseRequest(object):
def __init__(self, bot, uri, params=None):
"""
基本的 Web 微信请求模板,可用于修改后发送请求
可修改属性包括:
* url (会通过 url 参数自动拼接好)
* data (默认仅包含 BaseRequest 部分)
* headers
:param bot: 所使用的机器人对象
:param uri: API 路径,将与基础 URL 进行... | class BaseRequest(object):
def __init__(self, bot, uri, params=None):
"""
基本的 Web 微信请求模板,可用于修改后发送请求
可修改属性包括:
* url (会通过 url 参数自动拼接好)
* data (默认仅包含 BaseRequest 部分)
* headers
:param bot: 所使用的机器人对象
:param uri: API 路径,将与基础 URL 进行... |
if self.data:
self.data = json.dumps(self.data, ensure_ascii=False).encode('utf-8')
else:
self.data = None
@handle_response(to_class)
def do():
return itchat.returnvalues.ReturnValue(
rawResponse=self.bot.core.s.request(
... | """
(在完成修改后) 发送请求
:param method: 请求方法: 'GET', 'POST','PUT', 'DELETE' 等
:param to_class: 使用 `@handle_response(to_class)` 把结果转化为相应的类
"""
if self.data:
self.data = json.dumps(self.data, ensure_ascii=False).encode('utf-8')
else:
self.... | 24 | 379 | 157 | 536 | # coding: utf-8
from __future__ import unicode_literals
import functools
import json
import itchat.config
import itchat.returnvalues
from .misc import handle_response
class BaseRequest(object):
def __init__(self, bot, uri, params=None):
"""
基本的 Web 微信请求模板,可用于修改后发送请求
可修改属性包括:
... | # coding: utf-8
from __future__ import unicode_literals
import functools
import json
import itchat.config
import itchat.returnvalues
from .misc import handle_response
class BaseRequest(object):
def __init__(self, bot, uri, params=None):
"""
基本的 Web 微信请求模板,可用于修改后发送请求
可修改属性包括:
... |
27,531 | /home/hieuvd/dung_repo/raw/stars_01/youfou_wxpy/wxpy | /home/hieuvd/dung_repo/raw/stars_01/youfou_wxpy/wxpy/wxpy/utils/tools.py | 84,85 | 1,117 | detect_freq_limit | 93,117 | 85,117 | # coding: utf-8
from __future__ import unicode_literals
import logging
import time
from functools import wraps
from wxpy.exceptions import ResponseError
logger = logging.getLogger(__name__)
def dont_raise_response_error(func):
"""
装饰器:用于避免被装饰的函数在运行过程中抛出 ResponseError 错误
"""
@wraps(func)
def wr... | # coding: utf-8
from __future__ import unicode_literals
import logging
import time
from functools import wraps
from wxpy.exceptions import ResponseError
logger = logging.getLogger(__name__)
def dont_raise_response_error(func):
"""
装饰器:用于避免被装饰的函数在运行过程中抛出 ResponseError 错误
"""
@wraps(func)
def wr... |
start = time.time()
count = 0
while True:
try:
func(*args, **kwargs)
except ResponseError as e:
logger.info('freq limit reached: {} requests passed, error_info: {}'.format(count, e))
break
else:
count += 1
logger.debug('{}... | """
检测各类 Web 微信操作的频率限制,获得限制次数和周期
:param func: 需要执行的操作函数
:param args: 操作函数的位置参数
:param kwargs: 操作函数的命名参数
:return: 限制次数, 限制周期(秒数)
"""
start = time.time()
count = 0
while True:
try:
func(*args, **kwargs)
except ResponseError as e:
logge... | 60 | 756 | 219 | 975 | # coding: utf-8
from __future__ import unicode_literals
import logging
import time
from functools import wraps
from wxpy.exceptions import ResponseError
logger = logging.getLogger(__name__)
def dont_raise_response_error(func):
"""
装饰器:用于避免被装饰的函数在运行过程中抛出 ResponseError 错误
"""
@wraps(func)
def wr... | # coding: utf-8
from __future__ import unicode_literals
import logging
import time
from functools import wraps
from wxpy.exceptions import ResponseError
logger = logging.getLogger(__name__)
def dont_raise_response_error(func):
"""
装饰器:用于避免被装饰的函数在运行过程中抛出 ResponseError 错误
"""
@wraps(func)
def wr... | |
27,532 | /home/hieuvd/dung_repo/raw/stars_01/ytisf_theZoo/theZoo | /home/hieuvd/dung_repo/raw/stars_01/ytisf_theZoo/theZoo/imports/colors.py | 42,43 | 1,62 | underline | 43,45 | 43,45 | #!/usr/bin/env python
import os
BOLD = ''
NORM = ''
PURPLE = ''
BLUE = ''
GREEN = ''
YELLOW = ''
RED = ''
WHITE = ''
MAGENTA = ''
UNDERLINE = ''
if os.name is not 'nt':
PURPLE = '\033[95m'
BLUE = '\033[94m'
GREEN = '\033[92m'
YELLOW = '\033[93m'
RED = '\033[91m'
WHITE = '\033[0m'
MAGENTA = '\033[35m'
BOLD = ... | #!/usr/bin/env python
import os
BOLD = ''
NORM = ''
PURPLE = ''
BLUE = ''
GREEN = ''
YELLOW = ''
RED = ''
WHITE = ''
MAGENTA = ''
UNDERLINE = ''
if os.name is not 'nt':
PURPLE = '\033[95m'
BLUE = '\033[94m'
GREEN = '\033[92m'
YELLOW = '\033[93m'
RED = '\033[91m'
WHITE = '\033[0m'
MAGENTA = '\033[35m'
BOLD = ... | return UNDERLINE + str + WHITE
| return UNDERLINE + str + WHITE
| 6 | 412 | 14 | 426 | #!/usr/bin/env python
import os
BOLD = ''
NORM = ''
PURPLE = ''
BLUE = ''
GREEN = ''
YELLOW = ''
RED = ''
WHITE = ''
MAGENTA = ''
UNDERLINE = ''
if os.name is not 'nt':
PURPLE = '\033[95m'
BLUE = '\033[94m'
GREEN = '\033[92m'
YELLOW = '\033[93m'
RED = '\033[91m'
WHITE = '\033[0m'
MAGENTA = '\033[35m'
BOLD = ... | #!/usr/bin/env python
import os
BOLD = ''
NORM = ''
PURPLE = ''
BLUE = ''
GREEN = ''
YELLOW = ''
RED = ''
WHITE = ''
MAGENTA = ''
UNDERLINE = ''
if os.name is not 'nt':
PURPLE = '\033[95m'
BLUE = '\033[94m'
GREEN = '\033[92m'
YELLOW = '\033[93m'
RED = '\033[91m'
WHITE = '\033[0m'
MAGENTA = '\033[35m'
BOLD = ... | |
27,533 | /home/hieuvd/dung_repo/raw/stars_01/ytisf_theZoo/theZoo | /home/hieuvd/dung_repo/raw/stars_01/ytisf_theZoo/theZoo/imports/db_handler.py | 37,38 | 6,65 | query | DBHandler | 38,49 | 38,49 | class DBHandler:
def __init__(self):
try:
self.con = lite.connect(globals.vars.db_path)
self.cur = self.con.cursor()
except lite.Error as e:
print("An error occurred:", e.args[0])
sys.exit()
def get_full_details(self):
return self.cur.exe... | class DBHandler:
def __init__(self):
try:
self.con = lite.connect(globals.vars.db_path)
self.cur = self.con.cursor()
except lite.Error as e:
print("An error occurred:", e.args[0])
sys.exit()
def get_full_details(self):
return self.cur.exe... | if globals.vars.DEBUG_LEVEL is 2:
print(locals())
try:
if param is not '':
return self.cur.execute(query, param if type(param) is list else [param]).fetchall()
else:
return self.cur.execute(query).fetchall()
except lite.Error as... | if globals.vars.DEBUG_LEVEL is 2:
print(locals())
try:
if param is not '':
return self.cur.execute(query, param if type(param) is list else [param]).fetchall()
else:
return self.cur.execute(query).fetchall()
except lite.Error as... | 32 | 561 | 123 | 684 | import sqlite3 as lite
from imports import globals
import sys
class DBHandler:
def __init__(self):
try:
self.con = lite.connect(globals.vars.db_path)
self.cur = self.con.cursor()
except lite.Error as e:
print("An error occurred:", e.args[0])
sys.exi... | import sqlite3 as lite
from imports import globals
import sys
class DBHandler:
def __init__(self):
try:
self.con = lite.connect(globals.vars.db_path)
self.cur = self.con.cursor()
except lite.Error as e:
print("An error occurred:", e.args[0])
sys.exi... |
27,534 | /home/hieuvd/dung_repo/raw/stars_01/ytisf_theZoo/theZoo | /home/hieuvd/dung_repo/raw/stars_01/ytisf_theZoo/theZoo/imports/eula_handler.py | 38,39 | 24,62 | prompt_eula | EULA | 39,62 | 39,62 | class EULA:
def __init__(self, langs=None, oneRun=True):
#self.oneRun = oneRun
self.check_eula_file()
# self.prompt_eula()
def check_eula_file(self):
try:
with open(globals.vars.eula_file):
return 1
except IOError:
return 0
d... | class EULA:
def __init__(self, langs=None, oneRun=True):
#self.oneRun = oneRun
self.check_eula_file()
# self.prompt_eula()
def check_eula_file(self):
try:
with open(globals.vars.eula_file):
return 1
except IOError:
return 0
d... | globals.init()
os.system('cls' if os.name == 'nt' else 'clear')
notice = '_____________________________________________________________________________\n'
notice += '| ATTENTION!!! ATTENTION!!! ATTENTION!!! |\n'
notice += '| ... | globals.init()
os.system('cls' if os.name == 'nt' else 'clear')
notice = '_____________________________________________________________________________\n'
notice += '| ATTENTION!!! ATTENTION!!! ATTENTION!!! |\n'
notice += '| ... | 169 | 125 | 425 | 550 | #!/usr/bin/env python
# Malware DB - the most awesome free malware database on the air
# Copyright (C) 2014, Yuval Nativ, Lahad Ludar, 5Fingers
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free S... | #!/usr/bin/env python
# Malware DB - the most awesome free malware database on the air
# Copyright (C) 2014, Yuval Nativ, Lahad Ludar, 5Fingers
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free S... |
27,535 | /home/hieuvd/dung_repo/raw/stars_01/ytisf_theZoo/theZoo | /home/hieuvd/dung_repo/raw/stars_01/ytisf_theZoo/theZoo/imports/globals.py | 54,55 | 49,66 | complete | Completer | 55,66 | 55,66 | class Completer:
def __init__(self, commands):
self.commands = commands
self.prefix = None
def complete(self, prefix, index):
FILL_FUNC_BODY | class Completer:
def __init__(self, commands):
self.commands = commands
self.prefix = None
def complete(self, prefix, index):
FILL_FUNC_BODY | if prefix != self.prefix:
self.matchingCommand = [w for w in self.commands if w.startswith(prefix)
]
self.prefix = prefix
try:
return self.matchingCommand[index]
except IndexError:
return None
#######################################... | if prefix != self.prefix:
self.matchingCommand = [w for w in self.commands if w.startswith(prefix)
]
self.prefix = prefix
try:
return self.matchingCommand[index]
except IndexError:
return None
#######################################... | 25 | 52 | 87 | 139 | #!/usr/bin/env python
# Malware DB - the most awesome free malware database on the air
# Copyright (C) 2014-2025, Yuval Nativ, Lahad Ludar, 5Fingers
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the F... | #!/usr/bin/env python
# Malware DB - the most awesome free malware database on the air
# Copyright (C) 2014-2025, Yuval Nativ, Lahad Ludar, 5Fingers
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the F... |
27,536 | /home/hieuvd/dung_repo/raw/stars_01/ytisf_theZoo/theZoo | /home/hieuvd/dung_repo/raw/stars_01/ytisf_theZoo/theZoo/imports/globals.py | 24,25 | 22,49 | init | init | 25,49 | 25,49 | class init:
def init(self):
FILL_FUNC_BODY | class init:
def init(self):
FILL_FUNC_BODY | # Global Variables
version = "0.6.0 Moat"
appname = "theZoo"
codename = "Moat"
authors = "Yuval Nativ, Lahad Ludar, 5fingers"
maintainers = [ "Shahak Shalev", "Yuval Nativ" ]
github_add = "https://www.github.com/ytisf/theZoo"
licensev = "GPL v3.0"
... | # Global Variables
version = "0.6.0 Moat"
appname = "theZoo"
codename = "Moat"
authors = "Yuval Nativ, Lahad Ludar, 5fingers"
maintainers = [ "Shahak Shalev", "Yuval Nativ" ]
github_add = "https://www.github.com/ytisf/theZoo"
licensev = "GPL v3.0"
... | 167 | 22 | 527 | 549 | #!/usr/bin/env python
# Malware DB - the most awesome free malware database on the air
# Copyright (C) 2014-2025, Yuval Nativ, Lahad Ludar, 5Fingers
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the F... | #!/usr/bin/env python
# Malware DB - the most awesome free malware database on the air
# Copyright (C) 2014-2025, Yuval Nativ, Lahad Ludar, 5Fingers
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the F... |
27,537 | /home/hieuvd/dung_repo/raw/stars_01/ytisf_theZoo/theZoo | /home/hieuvd/dung_repo/raw/stars_01/ytisf_theZoo/theZoo/imports/manysearches.py | 14,15 | 6,70 | sort | MuchSearch | 15,53 | 15,53 | class MuchSearch(object):
def __init__(self):
self.db = db_handler.DBHandler()
self.names = [x.lower() for x in self.db.get_mal_names()]
self.tags = [x.lower() for x in self.db.get_mal_tags()]
#:todo: make this more efficient
def sort(self, args):
FILL_FUNC_BODY def build_query(... | class MuchSearch(object):
def __init__(self):
self.db = db_handler.DBHandler()
self.names = [x.lower() for x in self.db.get_mal_names()]
self.tags = [x.lower() for x in self.db.get_mal_tags()]
#:todo: make this more efficient
def sort(self, args):
FILL_FUNC_BODY def build_query(... | self.hits = {}
self.query = None
self.param = None
self.prequery = "SELECT ID, TYPE, LANGUAGE, ARCHITECTURE, PLATFORM, NAME FROM MALWARES WHERE "
self.postquery = " COLLATE NOCASE"
self.ar = []
args = [x.lower() for x in args]
for arg in args:
... | self.hits = {}
self.query = None
self.param = None
self.prequery = "SELECT ID, TYPE, LANGUAGE, ARCHITECTURE, PLATFORM, NAME FROM MALWARES WHERE "
self.postquery = " COLLATE NOCASE"
self.ar = []
args = [x.lower() for x in args]
for arg in args:
... | 150 | 354 | 450 | 804 | from imports import globals
from imports import db_handler
from imports.prettytable import PrettyTable
from imports.colors import *
class MuchSearch(object):
def __init__(self):
self.db = db_handler.DBHandler()
self.names = [x.lower() for x in self.db.get_mal_names()]
self.tags = [x.lower(... | from imports import globals
from imports import db_handler
from imports.prettytable import PrettyTable
from imports.colors import *
class MuchSearch(object):
def __init__(self):
self.db = db_handler.DBHandler()
self.names = [x.lower() for x in self.db.get_mal_names()]
self.tags = [x.lower(... |
27,538 | /home/hieuvd/dung_repo/raw/stars_01/ytisf_theZoo/theZoo | /home/hieuvd/dung_repo/raw/stars_01/ytisf_theZoo/theZoo/prep_file.py | 45,46 | 1,114 | prepare_file | 54,76 | 46,76 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Name: Prep File
Author: ytisf
Date of Creation: Unknown
Last Modified: April 05, 2024
Dev: K4YT3X
Last Modified: August 21, 2019
Licensed under the GNU General Public License Version 3 (GNU GPL v3),
available at: https://www.gnu.org/licenses/gpl-3.0.txt
(C) 2014-... | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Name: Prep File
Author: ytisf
Date of Creation: Unknown
Last Modified: April 05, 2024
Dev: K4YT3X
Last Modified: August 21, 2019
Licensed under the GNU General Public License Version 3 (GNU GPL v3),
available at: https://www.gnu.org/licenses/gpl-3.0.txt
(C) 2014-... | OUTPUT_FOLDER.mkdir(parents=True, exist_ok=True)
# create ZIP Archive
# we are using 7z because "zipfile" did not support adding a password
# Apparently "pyminizip" works just as well.
print('Info: Creating encrypted ZIP archive')
with pyzipper.AESZipFile(OUTPUT_FOLDER / f'{file_path.name}.zip'... | """ prep file from file path for submission
take file name, encrypt in ZIP with password 'infected', create MD5
and SHA1 sums and store all of that in a directory of it's own
Arguments:
file_path {pathlib.Path} -- path object of input file
"""
OUTPUT_FOLDER.mkdir(parents=True, exist_ok... | 85 | 792 | 414 | 1,206 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Name: Prep File
Author: ytisf
Date of Creation: Unknown
Last Modified: April 05, 2024
Dev: K4YT3X
Last Modified: August 21, 2019
Licensed under the GNU General Public License Version 3 (GNU GPL v3),
available at: https://www.gnu.org/licenses/gpl-3.0.txt
(C) 2014-... | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Name: Prep File
Author: ytisf
Date of Creation: Unknown
Last Modified: April 05, 2024
Dev: K4YT3X
Last Modified: August 21, 2019
Licensed under the GNU General Public License Version 3 (GNU GPL v3),
available at: https://www.gnu.org/licenses/gpl-3.0.txt
(C) 2014-... | |
27,539 | /home/hieuvd/dung_repo/raw/stars_01/ytisf_theZoo/theZoo | /home/hieuvd/dung_repo/raw/stars_01/ytisf_theZoo/theZoo/theZoo.py | 40,41 | 1,110 | main | 41,108 | 41,108 | #!/usr/bin/env python
# Malware DB - the most awesome free malware database on the air
# Copyright (C) 2014-2025, Yuval Nativ, Lahad Ludar, 5Fingers
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the F... | #!/usr/bin/env python
# Malware DB - the most awesome free malware database on the air
# Copyright (C) 2014-2025, Yuval Nativ, Lahad Ludar, 5Fingers
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the F... |
# Much much imports :)
updateHandler = Updater
eulaHandler = EULA()
bannerHandler = muchmuchstrings.banners()
db = db_handler.DBHandler()
terminalHandler = Controller()
def filter_array(array, colum, value):
ret_array = [row for row in array if value in row[colum]]
return r... |
# Much much imports :)
updateHandler = Updater
eulaHandler = EULA()
bannerHandler = muchmuchstrings.banners()
db = db_handler.DBHandler()
terminalHandler = Controller()
def filter_array(array, colum, value):
ret_array = [row for row in array if value in row[colum]]
return r... | 189 | 464 | 731 | 1,195 | #!/usr/bin/env python
# Malware DB - the most awesome free malware database on the air
# Copyright (C) 2014-2025, Yuval Nativ, Lahad Ludar, 5Fingers
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the F... | #!/usr/bin/env python
# Malware DB - the most awesome free malware database on the air
# Copyright (C) 2014-2025, Yuval Nativ, Lahad Ludar, 5Fingers
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the F... | |
27,667 | /home/hieuvd/dung_repo/raw/stars_02/0x00-0x00_ShellPop/ShellPop | /home/hieuvd/dung_repo/raw/stars_02/0x00-0x00_ShellPop/ShellPop/setup.py | 6,7 | 1,64 | applyChanges | 7,11 | 7,11 | from setuptools import setup
from setuptools.command.install import install
from subprocess import Popen, PIPE
import os
def applyChanges():
FILL_FUNC_BODYdef activateTabComplete():
proc = Popen("activate-global-python-argcomplete", stdout=PIPE, stderr=PIPE, shell=True)
_, _ = proc.communicate()
return Tru... | from setuptools import setup
from setuptools.command.install import install
from subprocess import Popen, PIPE
import os
def applyChanges():
FILL_FUNC_BODYdef activateTabComplete():
proc = Popen("activate-global-python-argcomplete", stdout=PIPE, stderr=PIPE, shell=True)
_, _ = proc.communicate()
return Tru... | proc = Popen("source ~/.bashrc", stdout=PIPE, stderr=PIPE, shell=True)
_, _ = proc.communicate()
return None
| proc = Popen("source ~/.bashrc", stdout=PIPE, stderr=PIPE, shell=True)
_, _ = proc.communicate()
return None
| 13 | 635 | 48 | 683 | from setuptools import setup
from setuptools.command.install import install
from subprocess import Popen, PIPE
import os
def applyChanges():
FILL_FUNC_BODYdef activateTabComplete():
proc = Popen("activate-global-python-argcomplete", stdout=PIPE, stderr=PIPE, shell=True)
_, _ = proc.communicate()
return Tru... | from setuptools import setup
from setuptools.command.install import install
from subprocess import Popen, PIPE
import os
def applyChanges():
FILL_FUNC_BODYdef activateTabComplete():
proc = Popen("activate-global-python-argcomplete", stdout=PIPE, stderr=PIPE, shell=True)
_, _ = proc.communicate()
return Tru... | |
27,668 | /home/hieuvd/dung_repo/raw/stars_02/0x00-0x00_ShellPop/ShellPop | /home/hieuvd/dung_repo/raw/stars_02/0x00-0x00_ShellPop/ShellPop/setup.py | 26,27 | 25,43 | run | CustomInstall | 27,43 | 27,43 | class CustomInstall(install):
def run(self):
FILL_FUNC_BODY | class CustomInstall(install):
def run(self):
FILL_FUNC_BODY | install.run(self)
bashrc_file = os.environ["HOME"] + os.sep + ".bashrc"
if not os.path.exists(bashrc_file):
return None
with open(bashrc_file, "r") as f:
bashrc_content = f.read()
if "shellpop" not in bashrc_content:
print("Registering shellpop... | install.run(self)
bashrc_file = os.environ["HOME"] + os.sep + ".bashrc"
if not os.path.exists(bashrc_file):
return None
with open(bashrc_file, "r") as f:
bashrc_content = f.read()
if "shellpop" not in bashrc_content:
print("Registering shellpop... | 61 | 24 | 208 | 232 | from setuptools import setup
from setuptools.command.install import install
from subprocess import Popen, PIPE
import os
def applyChanges():
proc = Popen("source ~/.bashrc", stdout=PIPE, stderr=PIPE, shell=True)
_, _ = proc.communicate()
return None
def activateTabComplete():
proc = Popen("activate-gl... | from setuptools import setup
from setuptools.command.install import install
from subprocess import Popen, PIPE
import os
def applyChanges():
proc = Popen("source ~/.bashrc", stdout=PIPE, stderr=PIPE, shell=True)
_, _ = proc.communicate()
return None
def activateTabComplete():
proc = Popen("activate-gl... |
27,783 | /home/hieuvd/dung_repo/raw/stars_02/AbanteAI_mentat/mentat | /home/hieuvd/dung_repo/raw/stars_02/AbanteAI_mentat/mentat/benchmarks/arg_parser.py | 4,5 | 1,83 | common_benchmark_parser | 5,83 | 5,83 | import argparse
def common_benchmark_parser():
FILL_FUNC_BODY | import argparse
def common_benchmark_parser():
FILL_FUNC_BODY | parser = argparse.ArgumentParser(description="Run exercism benchmarks")
parser.add_argument(
"--refresh_repo",
action="store_true",
default=False,
help="When set local changes will be discarded.",
)
parser.add_argument(
"--language",
default="python",
... | parser = argparse.ArgumentParser(description="Run exercism benchmarks")
parser.add_argument(
"--refresh_repo",
action="store_true",
default=False,
help="When set local changes will be discarded.",
)
parser.add_argument(
"--language",
default="python",
... | 170 | 25 | 719 | 744 | import argparse
def common_benchmark_parser():
FILL_FUNC_BODY | import argparse
def common_benchmark_parser():
FILL_FUNC_BODY | |
27,784 | /home/hieuvd/dung_repo/raw/stars_02/AbanteAI_mentat/mentat | /home/hieuvd/dung_repo/raw/stars_02/AbanteAI_mentat/mentat/benchmarks/benchmark_result.py | 45,46 | 11,75 | display_color | BenchmarkResult | 46,62 | 46,62 | @attr.define
class BenchmarkResult:
name: str = attr.ib()
family: Optional[str] = attr.ib(default=None)
cost: Optional[float] = attr.ib(default=None, metadata={"aggregation": "sum"})
tokens: Optional[int] = attr.ib(default=None, metadata={"aggregation": "average"})
count: int = attr.ib(default=1, me... | @attr.define
class BenchmarkResult:
name: str = attr.ib()
family: Optional[str] = attr.ib(default=None)
cost: Optional[float] = attr.ib(default=None, metadata={"aggregation": "sum"})
tokens: Optional[int] = attr.ib(default=None, metadata={"aggregation": "average"})
count: int = attr.ib(default=1, me... | if self.passed is None:
if self.indentation_error or self.off_by_one or self.syntax_error:
return "grey"
if self.missing_functionality or self.extra_functionality or self.referenced_format:
return "yellow"
if self.verify is not None:
... | if self.passed is None:
if self.indentation_error or self.off_by_one or self.syntax_error:
return "grey"
if self.missing_functionality or self.extra_functionality or self.referenced_format:
return "yellow"
if self.verify is not None:
... | 41 | 1,006 | 154 | 1,160 | from __future__ import annotations
import json
from typing import Optional
import attr
from mentat.transcripts import Transcript
@attr.define
class BenchmarkResult:
name: str = attr.ib()
family: Optional[str] = attr.ib(default=None)
cost: Optional[float] = attr.ib(default=None, metadata={"aggregation":... | from __future__ import annotations
import json
from typing import Optional
import attr
from mentat.transcripts import Transcript
@attr.define
class BenchmarkResult:
name: str = attr.ib()
family: Optional[str] = attr.ib(default=None)
cost: Optional[float] = attr.ib(default=None, metadata={"aggregation":... |
27,785 | /home/hieuvd/dung_repo/raw/stars_02/AbanteAI_mentat/mentat | /home/hieuvd/dung_repo/raw/stars_02/AbanteAI_mentat/mentat/benchmarks/benchmark_result_list.py | 11,12 | 1,44 | generate_list | 12,36 | 12,36 | #!/usr/bin/env python
import webbrowser
from pathlib import Path
from jinja2 import Environment, FileSystemLoader, select_autoescape
from benchmarks.benchmark_run_summary import BenchmarkRunSummary
from benchmarks.plot_generator import generate_plot_html
def generate_list(path: Path, output: Path):
FILL_FUNC_BODYif... | #!/usr/bin/env python
import webbrowser
from pathlib import Path
from jinja2 import Environment, FileSystemLoader, select_autoescape
from benchmarks.benchmark_run_summary import BenchmarkRunSummary
from benchmarks.plot_generator import generate_plot_html
def generate_list(path: Path, output: Path):
FILL_FUNC_BODYif... | summaries = []
for file in path.iterdir():
if file.is_file() and file.suffix == ".json":
summary = BenchmarkRunSummary.load_file(file)
summaries.append(summary)
plot = generate_plot_html(summaries)
env = Environment(
loader=FileSystemLoader(
[
... | summaries = []
for file in path.iterdir():
if file.is_file() and file.suffix == ".json":
summary = BenchmarkRunSummary.load_file(file)
summaries.append(summary)
plot = generate_plot_html(summaries)
env = Environment(
loader=FileSystemLoader(
[
... | 50 | 193 | 262 | 455 | #!/usr/bin/env python
import webbrowser
from pathlib import Path
from jinja2 import Environment, FileSystemLoader, select_autoescape
from benchmarks.benchmark_run_summary import BenchmarkRunSummary
from benchmarks.plot_generator import generate_plot_html
def generate_list(path: Path, output: Path):
FILL_FUNC_BODYif... | #!/usr/bin/env python
import webbrowser
from pathlib import Path
from jinja2 import Environment, FileSystemLoader, select_autoescape
from benchmarks.benchmark_run_summary import BenchmarkRunSummary
from benchmarks.plot_generator import generate_plot_html
def generate_list(path: Path, output: Path):
FILL_FUNC_BODYif... | |
27,787 | /home/hieuvd/dung_repo/raw/stars_02/AbanteAI_mentat/mentat | /home/hieuvd/dung_repo/raw/stars_02/AbanteAI_mentat/mentat/benchmarks/benchmark_runner.py | 217,218 | 152,258 | run | Benchmark | 218,258 | 218,258 | class Benchmark:
def __init__(
self,
title: str,
description: str = "",
config: Config = Config(),
verify: callable | None = None,
samples: list[Sample] = [],
):
self.title = title
self.description = description
self.config = config
... | class Benchmark:
def __init__(
self,
title: str,
description: str = "",
config: Config = Config(),
verify: callable | None = None,
samples: list[Sample] = [],
):
self.title = title
self.description = description
self.config = config
... | print("Benchmark:", self.title)
start_dir = Path.cwd()
results: list[BenchmarkResult] = []
for i, sample in enumerate(self.samples):
print(" Prompt:", sample.message_prompt)
for j in range(1, retries + 1):
formatted_title = re.sub(r"[ '\"/\\-^]", ... | print("Benchmark:", self.title)
start_dir = Path.cwd()
results: list[BenchmarkResult] = []
for i, sample in enumerate(self.samples):
print(" Prompt:", sample.message_prompt)
for j in range(1, retries + 1):
formatted_title = re.sub(r"[ '\"/\\-^]", ... | 106 | 617 | 506 | 1,123 | #!/usr/bin/env python
from __future__ import annotations
import asyncio
import importlib.util
import json
import os
import re
from datetime import datetime
from pathlib import Path
from typing import List
from uuid import uuid4
from openai.types.chat.completion_create_params import ResponseFormat
from spice import Sp... | #!/usr/bin/env python
from __future__ import annotations
import asyncio
import importlib.util
import json
import os
import re
from datetime import datetime
from pathlib import Path
from typing import List
from uuid import uuid4
from openai.types.chat.completion_create_params import ResponseFormat
from spice import Sp... |
27,788 | /home/hieuvd/dung_repo/raw/stars_02/AbanteAI_mentat/mentat | /home/hieuvd/dung_repo/raw/stars_02/AbanteAI_mentat/mentat/benchmarks/context_benchmark.py | 26,27 | 1,105 | run_auto_context_benchmark | 28,58 | 27,58 | import asyncio
import json
import os
from datetime import datetime
from pathlib import Path
from typing import Any
from ragdaemon.daemon import Daemon
from benchmarks.arg_parser import common_benchmark_parser
from benchmarks.run_sample import setup_sample
from benchmarks.swe_bench_runner import SWE_BENCH_SAMPLES_DIR,... | import asyncio
import json
import os
from datetime import datetime
from pathlib import Path
from typing import Any
from ragdaemon.daemon import Daemon
from benchmarks.arg_parser import common_benchmark_parser
from benchmarks.run_sample import setup_sample
from benchmarks.swe_bench_runner import SWE_BENCH_SAMPLES_DIR,... | starting_dir = Path.cwd()
if not config.auto_context_tokens or not sample.context:
raise ValueError(
"In order to run the auto-context benchmark, sample.context must not "
"be empty (ground truth) and config.auto_context_tokens must be > 0."
)
try:
_, cwd, _... | """Run a sample using Mentat and return the resulting diff"""
starting_dir = Path.cwd()
if not config.auto_context_tokens or not sample.context:
raise ValueError(
"In order to run the auto-context benchmark, sample.context must not "
"be empty (ground truth) and config.auto_... | 117 | 910 | 378 | 1,288 | import asyncio
import json
import os
from datetime import datetime
from pathlib import Path
from typing import Any
from ragdaemon.daemon import Daemon
from benchmarks.arg_parser import common_benchmark_parser
from benchmarks.run_sample import setup_sample
from benchmarks.swe_bench_runner import SWE_BENCH_SAMPLES_DIR,... | import asyncio
import json
import os
from datetime import datetime
from pathlib import Path
from typing import Any
from ragdaemon.daemon import Daemon
from benchmarks.arg_parser import common_benchmark_parser
from benchmarks.run_sample import setup_sample
from benchmarks.swe_bench_runner import SWE_BENCH_SAMPLES_DIR,... | |
27,789 | /home/hieuvd/dung_repo/raw/stars_02/AbanteAI_mentat/mentat | /home/hieuvd/dung_repo/raw/stars_02/AbanteAI_mentat/mentat/benchmarks/edit_rubric_benchmark.py | 73,74 | 1,162 | test_edit_quality | 74,150 | 74,150 | #!/usr/bin/env python
import asyncio
import json
import os
import subprocess
from itertools import islice
from pathlib import Path
from textwrap import dedent
from git import Repo
from openai import OpenAI
from benchmarks.arg_parser import common_benchmark_parser
from mentat import Mentat
from mentat.sampler.utils im... | #!/usr/bin/env python
import asyncio
import json
import os
import subprocess
from itertools import islice
from pathlib import Path
from textwrap import dedent
from git import Repo
from openai import OpenAI
from benchmarks.arg_parser import common_benchmark_parser
from mentat import Mentat
from mentat.sampler.utils im... | repo_path = Path(__file__).parent / f"../../benchmark_repos/{repo}"
tests = load_tests(repo_path)
results = load_results(repo_path)
if len(benchmarks) > 0:
tests_to_run = {k: v for k, v in tests.items() if k in benchmarks}
else:
tests_to_run = dict(islice(tests.items(), max_benchmar... | repo_path = Path(__file__).parent / f"../../benchmark_repos/{repo}"
tests = load_tests(repo_path)
results = load_results(repo_path)
if len(benchmarks) > 0:
tests_to_run = {k: v for k, v in tests.items() if k in benchmarks}
else:
tests_to_run = dict(islice(tests.items(), max_benchmar... | 179 | 693 | 791 | 1,484 | #!/usr/bin/env python
import asyncio
import json
import os
import subprocess
from itertools import islice
from pathlib import Path
from textwrap import dedent
from git import Repo
from openai import OpenAI
from benchmarks.arg_parser import common_benchmark_parser
from mentat import Mentat
from mentat.sampler.utils im... | #!/usr/bin/env python
import asyncio
import json
import os
import subprocess
from itertools import islice
from pathlib import Path
from textwrap import dedent
from git import Repo
from openai import OpenAI
from benchmarks.arg_parser import common_benchmark_parser
from mentat import Mentat
from mentat.sampler.utils im... | |
27,790 | /home/hieuvd/dung_repo/raw/stars_02/AbanteAI_mentat/mentat | /home/hieuvd/dung_repo/raw/stars_02/AbanteAI_mentat/mentat/benchmarks/exercise_runners/abstract_exercise_runner.py | 16,17 | 8,77 | _run_test_command | AbstractExerciseRunner | 17,31 | 17,31 | class AbstractExerciseRunner:
def __init__(self, exercise, extension):
self.name = exercise
self.dir = Path(f"exercises/practice/{exercise}").absolute()
self.file = Path(f"{exercise}.{extension}")
self.full_path = self.dir / self.file
self.test_output_file = self.dir / "test_... | class AbstractExerciseRunner:
def __init__(self, exercise, extension):
self.name = exercise
self.dir = Path(f"exercises/practice/{exercise}").absolute()
self.file = Path(f"{exercise}.{extension}")
self.full_path = self.dir / self.file
self.test_output_file = self.dir / "test_... | try:
proc = subprocess.run(
command,
stdout=subprocess.PIPE,
stderr=subprocess.STDOUT,
timeout=5,
cwd=cwd,
)
results = proc.stdout.decode("utf-8")
except subprocess.TimeoutExpired:
... | try:
proc = subprocess.run(
command,
stdout=subprocess.PIPE,
stderr=subprocess.STDOUT,
timeout=5,
cwd=cwd,
)
results = proc.stdout.decode("utf-8")
except subprocess.TimeoutExpired:
... | 26 | 569 | 136 | 705 | import os
import subprocess
from pathlib import Path
from benchmarks.benchmark_result import BenchmarkResult
class AbstractExerciseRunner:
def __init__(self, exercise, extension):
self.name = exercise
self.dir = Path(f"exercises/practice/{exercise}").absolute()
self.file = Path(f"{exercis... | import os
import subprocess
from pathlib import Path
from benchmarks.benchmark_result import BenchmarkResult
class AbstractExerciseRunner:
def __init__(self, exercise, extension):
self.name = exercise
self.dir = Path(f"exercises/practice/{exercise}").absolute()
self.file = Path(f"{exercis... |
27,791 | /home/hieuvd/dung_repo/raw/stars_02/AbanteAI_mentat/mentat | /home/hieuvd/dung_repo/raw/stars_02/AbanteAI_mentat/mentat/benchmarks/exercise_runners/clojure_exercise_runner.py | 15,16 | 6,22 | passed | ClojureExerciseRunner | 16,22 | 16,22 | class ClojureExerciseRunner(AbstractExerciseRunner):
def __init__(self, exercise):
super().__init__(exercise, "clj")
self.file = Path(exercise.replace("-", "_") + ".clj")
self.full_path = self.dir / "src" / self.file
def run_test(self):
self._run_test_command(["lein", "test", ":... | class ClojureExerciseRunner(AbstractExerciseRunner):
def __init__(self, exercise):
super().__init__(exercise, "clj")
self.file = Path(exercise.replace("-", "_") + ".clj")
self.full_path = self.dir / "src" / self.file
def run_test(self):
self._run_test_command(["lein", "test", ":... | try:
with open(self.test_output_file, "r") as f:
lines = f.readlines()
return "0 failures, 0 errors." in lines[-1]
except FileNotFoundError:
return False
| try:
with open(self.test_output_file, "r") as f:
lines = f.readlines()
return "0 failures, 0 errors." in lines[-1]
except FileNotFoundError:
return False
| 20 | 142 | 65 | 207 | from pathlib import Path
from benchmarks.exercise_runners.abstract_exercise_runner import AbstractExerciseRunner
class ClojureExerciseRunner(AbstractExerciseRunner):
def __init__(self, exercise):
super().__init__(exercise, "clj")
self.file = Path(exercise.replace("-", "_") + ".clj")
self.... | from pathlib import Path
from benchmarks.exercise_runners.abstract_exercise_runner import AbstractExerciseRunner
class ClojureExerciseRunner(AbstractExerciseRunner):
def __init__(self, exercise):
super().__init__(exercise, "clj")
self.file = Path(exercise.replace("-", "_") + ".clj")
self.... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.