uid stringlengths 24 24 | split stringclasses 1
value | category stringclasses 2
values | content stringlengths 5 482k | signature stringlengths 1 14k | suffix stringlengths 1 482k | prefix stringlengths 9 14k | prefix_token_count int64 3 5.01k | prefix_token_budget int64 64 256 | element_token_count int64 1 292k | signature_token_count int64 1 5.01k | prefix_context_token_count int64 0 255 | repo stringlengths 7 112 | path stringlengths 4 208 | language stringclasses 1
value | name stringlengths 1 218 | qualname stringlengths 1 218 | start_line int64 1 26.7k | end_line int64 1 26.7k | signature_start_line int64 1 26.7k | signature_end_line int64 1 26.7k | source_hash stringlengths 40 40 | source_dataset stringclasses 1
value | source_split stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
4fab6ea4c3184cc874facabd | train | class | class Interactions(BaseModel):
"""
enable: bool, default True
Whether to create this element
cat_enable: bool, default False
where enable categorical column in interactions. By default it is False,
which means only numerical interactions are computed. If set to True, cat-cat
... | class Interactions(BaseModel):
| """
enable: bool, default True
Whether to create this element
cat_enable: bool, default False
where enable categorical column in interactions. By default it is False,
which means only numerical interactions are computed. If set to True, cat-cat
and cat-num interactions will b... | ):
"""
enable: bool, default True
Whether to create this element
"""
enable: bool = True
class Variables(BaseModel):
"""
enable: bool, default True
Whether to create this element
"""
enable: bool = True
class Interactions(BaseModel):
| 64 | 64 | 89 | 6 | 57 | Waterpine/dataprep-1 | dataprep/eda/configs.py | Python | Interactions | Interactions | 1,108 | 1,119 | 1,108 | 1,108 | 697306eec3b0c41c7d1fe40e5265edd782f8ad9a | bigcode/the-stack | train |
465ea8796d95be5c08ea7fc7 | train | class | class Nested(BaseModel):
"""
enable: bool, default True
Whether to create this element
ngroups: int, default 10
Maximum number of most frequent values from the first column to display
nsubgroups: int, default 5
Maximum number of most frequent values from the second column to disp... | class Nested(BaseModel):
| """
enable: bool, default True
Whether to create this element
ngroups: int, default 10
Maximum number of most frequent values from the first column to display
nsubgroups: int, default 5
Maximum number of most frequent values from the second column to display (computed
on ... |
"""
vals = [tile_size, height, width]
names = ["hexbin.tile_size", "height", "width"]
descs = [
"Tile size, measured from the middle of the hexagon to the left or right corner",
"Height of the plot",
"Width of the plot",
]
return [(f"'... | 104 | 105 | 351 | 5 | 99 | Waterpine/dataprep-1 | dataprep/eda/configs.py | Python | Nested | Nested | 747 | 781 | 747 | 747 | 700ffde4e3ecd15357c48ebae0404d5552c503b1 | bigcode/the-stack | train |
d9f3f49f8342e55d88fba4d0 | train | class | class Hexbin(BaseModel):
"""
enable: bool, default True
Whether to create this element
tile_size: float, default "auto"
The size of the tile in the hexbin plot. Measured from the middle
of a hexagon to its left or right corner.
height: int, default "auto"
Height of the pl... | class Hexbin(BaseModel):
| """
enable: bool, default True
Whether to create this element
tile_size: float, default "auto"
The size of the tile in the hexbin plot. Measured from the middle
of a hexagon to its left or right corner.
height: int, default "auto"
Height of the plot
width: int, defaul... | _size is not None) and (user_set_sample_rate is not None):
raise AttributeError(
f"Scatter plot set sample size {user_set_sample_size} and "
+ f"sample rate {user_set_sample_rate}, please only set one of them."
)
if user_set_sample_rate is not None:
... | 80 | 80 | 267 | 6 | 73 | Waterpine/dataprep-1 | dataprep/eda/configs.py | Python | Hexbin | Hexbin | 715 | 744 | 715 | 715 | ef2ff2b88333464c92bf69659e09d8d14126665b | bigcode/the-stack | train |
8ae94eb8dea037caf126a660 | train | class | class Stacked(BaseModel):
"""
enable: bool, default True
Whether to create this element
ngroups: int, default 10
Maximum number of most frequent values from the first column to display
nsubgroups: int, default 5
Maximum number of most frequent values from the second column to dis... | class Stacked(BaseModel):
| """
enable: bool, default True
Whether to create this element
ngroups: int, default 10
Maximum number of most frequent values from the first column to display
nsubgroups: int, default 5
Maximum number of most frequent values from the second column to display (computed
on ... | , self.nsubgroups, height, width]
names = ["nested.ngroups", "nested.nsubgroups", "height", "width"]
descs = [
f"Maximum number of most frequent values in column {x} to display",
f"""Maximum number of most frequent values in column {y} to display (computed
on the filt... | 140 | 141 | 472 | 6 | 134 | Waterpine/dataprep-1 | dataprep/eda/configs.py | Python | Stacked | Stacked | 784 | 827 | 784 | 784 | 6a561c41f6f1ce1ae689c98fac20503d94efda5d | bigcode/the-stack | train |
302012a18e2671462b0fa939 | train | class | class Bar(BaseModel):
"""
enable: bool, default True
Whether to create this element
bars: int, default 10
Maximum number of bars to display
sort_descending: bool, default True
Whether to sort the bars in descending order
yscale: str, default "linear"
Y-axis scale ("li... | class Bar(BaseModel):
| """
enable: bool, default True
Whether to create this element
bars: int, default 10
Maximum number of bars to display
sort_descending: bool, default True
Whether to sort the bars in descending order
yscale: str, default "linear"
Y-axis scale ("linear" or "log")
co... | ("linear" or "log")',
"Color",
"Height of the plot",
"Width of the plot",
]
return [(f"'{name}': {_form(val)}", desc) for name, val, desc in zip(names, vals, descs)]
def grid_how_to_guide(self) -> List[Tuple[str, str]]:
"""
how-to guide for plot(... | 186 | 187 | 626 | 5 | 181 | Waterpine/dataprep-1 | dataprep/eda/configs.py | Python | Bar | Bar | 207 | 269 | 207 | 207 | 81804788b6c49eb5bd0265196b93021a6b244ca1 | bigcode/the-stack | train |
053e48b99c3495811aa02f18 | train | class | class Variables(BaseModel):
"""
enable: bool, default True
Whether to create this element
"""
enable: bool = True
| class Variables(BaseModel):
| """
enable: bool, default True
Whether to create this element
"""
enable: bool = True
| """
return f"'{val}'" if isinstance(val, str) else val
# The following five classes are for create_report
class Overview(BaseModel):
"""
enable: bool, default True
Whether to create this element
"""
enable: bool = True
class Variables(BaseModel):
| 64 | 64 | 31 | 5 | 58 | Waterpine/dataprep-1 | dataprep/eda/configs.py | Python | Variables | Variables | 1,099 | 1,105 | 1,099 | 1,099 | 739047f5a4d0b8dfef7ba26b888b4beff7b574e7 | bigcode/the-stack | train |
77cff66ab399770a032496fd | train | class | class QQNorm(BaseModel):
"""
enable: bool, default True
Whether to create this element
point_color: str, default "#1f77b4"
Color of the density histogram
line_color: str, default "#d62728
Color of the density line
height: int, default "auto"
Height of the plot
wid... | class QQNorm(BaseModel):
| """
enable: bool, default True
Whether to create this element
point_color: str, default "#1f77b4"
Color of the density histogram
line_color: str, default "#d62728
Color of the density line
height: int, default "auto"
Height of the plot
width: int, default "auto"
... | the histogram",
'Y-axis scale ("linear" or "log")',
"Color of the density histogram",
"Color of the density line",
"Height of the plot",
"Width of the plot",
]
return [(f"'{name}': {_form(val)}", desc) for name, val, desc in zip(names, vals, d... | 85 | 86 | 287 | 6 | 79 | Waterpine/dataprep-1 | dataprep/eda/configs.py | Python | QQNorm | QQNorm | 315 | 347 | 315 | 315 | f4a4f4d992a3aca0d912ca7be11e2e9f42a4133a | bigcode/the-stack | train |
bc0dcd7a2a7dea50c9a3c022 | train | class | class ValueTable(BaseModel):
"""
enable: bool, default True
Whether to create this element
ngroups: int, default 10
Number of values to show in the table
"""
enable: bool = True
ngroups: int = 10
def how_to_guide(self) -> List[Tuple[str, str]]:
"""
how-to gu... | class ValueTable(BaseModel):
| """
enable: bool, default True
Whether to create this element
ngroups: int, default 10
Number of values to show in the table
"""
enable: bool = True
ngroups: int = 10
def how_to_guide(self) -> List[Tuple[str, str]]:
"""
how-to guide for plot(df, x)
"... | and maximum values to
compute the pdf at""",
"Height of the plot",
"Width of the plot",
]
return [(f"'{name}': {val}", desc) for name, val, desc in zip(names, vals, descs)]
class ValueTable(BaseModel):
| 63 | 64 | 152 | 6 | 57 | Waterpine/dataprep-1 | dataprep/eda/configs.py | Python | ValueTable | ValueTable | 1,061 | 1,079 | 1,061 | 1,061 | 63fd28f4a32afaf32e477670bad064aae2a3fcb6 | bigcode/the-stack | train |
f9a4194fd943f8e4fb6556ba | train | class | class Overview(BaseModel):
"""
enable: bool, default True
Whether to create this element
"""
enable: bool = True
| class Overview(BaseModel):
| """
enable: bool, default True
Whether to create this element
"""
enable: bool = True
| (names, vals, descs)]
def _form(val: Any) -> Any:
"""
Format a value for the how-to guide
"""
return f"'{val}'" if isinstance(val, str) else val
# The following five classes are for create_report
class Overview(BaseModel):
| 64 | 64 | 31 | 5 | 58 | Waterpine/dataprep-1 | dataprep/eda/configs.py | Python | Overview | Overview | 1,090 | 1,096 | 1,090 | 1,090 | 7611fea24333537bcbacd26dbf064b18e9fd573b | bigcode/the-stack | train |
d1bae10497373b84cb600e42 | train | class | class WordFrequency(BaseModel):
"""
enable: bool, default True
Whether to create this element
top_words: int, default 30
Maximum number of most frequent words to display
stopword: bool, default True
Whether to remove stopwords
lemmatize: bool, default False
Whether to... | class WordFrequency(BaseModel):
| """
enable: bool, default True
Whether to create this element
top_words: int, default 30
Maximum number of most frequent words to display
stopword: bool, default True
Whether to remove stopwords
lemmatize: bool, default False
Whether to lemmatize the words
stem: b... | wordcloud.lemmatize",
"wordcloud.stem",
"height",
"width",
]
descs = [
"Maximum number of most frequent words to display",
"Whether to remove stopwords",
"Whether to lemmatize the words",
"Whether to apply Potter Stem on... | 119 | 120 | 401 | 6 | 113 | Waterpine/dataprep-1 | dataprep/eda/configs.py | Python | WordFrequency | WordFrequency | 500 | 548 | 500 | 500 | 4bff369fcf4b18de4bc5181f2cedd53247501e43 | bigcode/the-stack | train |
b0b02ac683626451cd9d1cd2 | train | class | class KendallTau(BaseModel):
"""
enable: bool, default True
Whether to create this element
height: int, default "auto"
Height of the plot
width: int, default "auto"
Width of the plot
"""
enable: bool = True
height: Union[int, None] = None
width: Union[int, None] ... | class KendallTau(BaseModel):
| """
enable: bool, default True
Whether to create this element
height: int, default "auto"
Height of the plot
width: int, default "auto"
Width of the plot
"""
enable: bool = True
height: Union[int, None] = None
width: Union[int, None] = None
def how_to_guide(... | , width]
names = ["height", "width"]
descs = ["Height of the plot", "Width of the plot"]
return [(f"'{name}': {val}", desc) for name, val, desc in zip(names, vals, descs)]
class KendallTau(BaseModel):
| 63 | 64 | 179 | 6 | 57 | Waterpine/dataprep-1 | dataprep/eda/configs.py | Python | KendallTau | KendallTau | 922 | 943 | 922 | 922 | 102de7918645eaa8c9b3d4e0eb1b789638a5cc83 | bigcode/the-stack | train |
53c1c47fff5c51f5725951c0 | train | class | class Spearman(BaseModel):
"""
height: int, default "auto"
Height of the plot
width: int, default "auto"
Width of the plot
"""
enable: bool = True
height: Union[int, None] = None
width: Union[int, None] = None
def how_to_guide(self, height: int, width: int) -> List[Tupl... | class Spearman(BaseModel):
| """
height: int, default "auto"
Height of the plot
width: int, default "auto"
Width of the plot
"""
enable: bool = True
height: Union[int, None] = None
width: Union[int, None] = None
def how_to_guide(self, height: int, width: int) -> List[Tuple[str, str]]:
"""
... | , width]
names = ["height", "width"]
descs = ["Height of the plot", "Width of the plot"]
return [(f"'{name}': {val}", desc) for name, val, desc in zip(names, vals, descs)]
class Spearman(BaseModel):
| 63 | 64 | 164 | 6 | 57 | Waterpine/dataprep-1 | dataprep/eda/configs.py | Python | Spearman | Spearman | 900 | 919 | 900 | 900 | dd791f400ec7a76582d6bd1af915fcee1d9111f1 | bigcode/the-stack | train |
50654c3018eb5017598aa963 | train | class | class Scatter(BaseModel):
"""
enable: bool, default True
Whether to create this element
sample_size: int, optional, default=1000
Number of points to randomly sample per partition.
Cannot be used with sample_rate.
sample_rate: float, optional, default None
sample rate per ... | class Scatter(BaseModel):
| """
enable: bool, default True
Whether to create this element
sample_size: int, optional, default=1000
Number of points to randomly sample per partition.
Cannot be used with sample_rate.
sample_rate: float, optional, default None
sample rate per partition. Cannot be used ... | agg: str = "mean"
height: Union[int, None] = None
width: Union[int, None] = None
def nom_cont_how_to_guide(self, height: int, width: int) -> List[Tuple[str, str]]:
"""
how-to guide for plot(df, nominal, continuous)
"""
vals = [self.ngroups, self.sort_descending, height, wid... | 186 | 187 | 626 | 5 | 181 | Waterpine/dataprep-1 | dataprep/eda/configs.py | Python | Scatter | Scatter | 642 | 712 | 642 | 642 | c272e441f412fe63fdeba5d555c1886c1bf37b36 | bigcode/the-stack | train |
604d52e9fa5d501e05a8b067 | train | class | class KDE(BaseModel):
"""
enable: bool, default True
Whether to create this element
bins: int, default 50
Number of bins in the histogram
yscale: str, default "linear"
Y-axis scale ("linear" or "log")
hist_color: str, default "#aec7e8"
Color of the density histogram
... | class KDE(BaseModel):
| """
enable: bool, default True
Whether to create this element
bins: int, default 50
Number of bins in the histogram
yscale: str, default "linear"
Y-axis scale ("linear" or "log")
hist_color: str, default "#aec7e8"
Color of the density histogram
line_color: str, de... | , descs)]
def missing_how_to_guide(self, height: int, width: int) -> List[Tuple[str, str]]:
"""
how-to guide for plot_missing(df, x, [y])
"""
vals = [height, width]
names = ["height", "width"]
descs = ["Height of the plot", "Width of the plot"]
return [(f"'{n... | 115 | 116 | 387 | 5 | 110 | Waterpine/dataprep-1 | dataprep/eda/configs.py | Python | KDE | KDE | 272 | 312 | 272 | 272 | d49fc105094b6518ffa1d917bef9781b1811570a | bigcode/the-stack | train |
c3c650b73ca165e1718cc6cb | train | class | class Plot(BaseModel):
"""
Class containing global parameters for the plots
"""
width: Union[int, None] = None
height: Union[int, None] = None
bins: Union[int, None] = None
ngroups: Union[int, None] = None
report: bool = False
| class Plot(BaseModel):
| """
Class containing global parameters for the plots
"""
width: Union[int, None] = None
height: Union[int, None] = None
bins: Union[int, None] = None
ngroups: Union[int, None] = None
report: bool = False
| # This dictionary map is used for session control in create_report
DISPLAY_REPORT_MAP = {
"Overview": "overview",
"Variables": "variables",
"Interactions": "interactions",
"Correlations": "correlations",
"Missing Values": "missingvalues",
}
class Plot(BaseModel):
| 64 | 64 | 70 | 5 | 59 | Waterpine/dataprep-1 | dataprep/eda/configs.py | Python | Plot | Plot | 65 | 74 | 65 | 65 | e61e54d5e65ab93dc1495a4cfeb14afa328d584c | bigcode/the-stack | train |
8c3a2287fc2d7c9f2e2a3714 | train | class | class Correlations(BaseModel):
"""
enable: bool, default True
Whether to create this element
value_range
If the correlation value is out of the range, don't show it.
k
Choose top-k element
"""
enable: bool = True
value_range: Optional[Tuple[float, float]] = None
... | class Correlations(BaseModel):
| """
enable: bool, default True
Whether to create this element
value_range
If the correlation value is out of the range, don't show it.
k
Choose top-k element
"""
enable: bool = True
value_range: Optional[Tuple[float, float]] = None
k: Optional[int] = None
de... |
where enable categorical column in interactions. By default it is False,
which means only numerical interactions are computed. If set to True, cat-cat
and cat-num interactions will be computed.
"""
enable: bool = True
cat_enable: bool = False
class Correlations(BaseModel):
| 64 | 64 | 202 | 6 | 57 | Waterpine/dataprep-1 | dataprep/eda/configs.py | Python | Correlations | Correlations | 1,122 | 1,146 | 1,122 | 1,122 | bc1a5ac4b0fb2daf68aaac6f3c5a272337e9cf32 | bigcode/the-stack | train |
a0ad14aebb43fbce891753f7 | train | class | class Heatmap(BaseModel):
"""
enable: bool, default True
Whether to create this element
ngroups: int, default 10
Maximum number of most frequent values from the first column to display
nsubgroups: int, default 5
Maximum number of most frequent values from the second column to dis... | class Heatmap(BaseModel):
| """
enable: bool, default True
Whether to create this element
ngroups: int, default 10
Maximum number of most frequent values from the first column to display
nsubgroups: int, default 5
Maximum number of most frequent values from the second column to display (computed
on ... | , height, width]
names = ["stacked.ngroups", "stacked.nsubgroups", "height", "width"]
descs = [
f"Maximum number of most frequent values in column {x} to display",
f"""Maximum number of most frequent values in column {y} to display (computed
on the filtered data consi... | 137 | 138 | 462 | 6 | 131 | Waterpine/dataprep-1 | dataprep/eda/configs.py | Python | Heatmap | Heatmap | 830 | 873 | 830 | 830 | 6a3aa79c01fd23e44d2f5a07c91b2b91f5a46503 | bigcode/the-stack | train |
191145350281d39988e430b7 | train | class | class Box(BaseModel):
"""
enable: bool, default True
Whether to create this element
ngroups: int, default 15
Maximum number of groups to display
bins: int, default 50
Number of bins
unit: str, default "auto"
Defines the time unit to group values over for a datetime co... | class Box(BaseModel):
| """
enable: bool, default True
Whether to create this element
ngroups: int, default 15
Maximum number of groups to display
bins: int, default 50
Number of bins
unit: str, default "auto"
Defines the time unit to group values over for a datetime column.
It can b... | """
enable: bool = True
point_color: str = "#1f77b4"
line_color: str = "#d62728"
height: Union[int, None] = None
width: Union[int, None] = None
def how_to_guide(self, height: int, width: int) -> List[Tuple[str, str]]:
"""
how-to guide for plot(df, x)
"""
vals =... | 198 | 199 | 664 | 5 | 193 | Waterpine/dataprep-1 | dataprep/eda/configs.py | Python | Box | Box | 350 | 412 | 350 | 350 | 3f3c4cdb1d025971584e4ce5ec7412b03071bac6 | bigcode/the-stack | train |
35c566848a061e9cadff29a2 | train | class | class Config(BaseModel):
"""
Configuration class
"""
# pylint: disable=too-many-instance-attributes
hist: Hist = Field(default_factory=Hist)
bar: Bar = Field(default_factory=Bar)
pie: Pie = Field(default_factory=Pie)
line: Line = Field(default_factory=Line)
stats: Stats = Field(defa... | class Config(BaseModel):
| """
Configuration class
"""
# pylint: disable=too-many-instance-attributes
hist: Hist = Field(default_factory=Hist)
bar: Bar = Field(default_factory=Bar)
pie: Pie = Field(default_factory=Pie)
line: Line = Field(default_factory=Line)
stats: Stats = Field(default_factory=Stats)
wo... | """
enable: bool = True
cat_enable: bool = False
class Correlations(BaseModel):
"""
enable: bool, default True
Whether to create this element
value_range
If the correlation value is out of the range, don't show it.
k
Choose top-k element
"""
enable: bool = Tr... | 256 | 256 | 1,362 | 5 | 250 | Waterpine/dataprep-1 | dataprep/eda/configs.py | Python | Config | Config | 1,158 | 1,281 | 1,158 | 1,158 | cf905ee00c1781fe3c4fe9e6d7ecdcc35844ebbf | bigcode/the-stack | train |
35b43463b36a02c162b910fb | train | class | class Hist(BaseModel):
"""
enable: bool, default True
Whether to create this element
bins: int, default 50
Number of bins in the histogram
yscale: str, default "linear"
Y-axis scale ("linear" or "log")
color: str, default "#aec7e8"
Color of the histogram
height: i... | class Hist(BaseModel):
| """
enable: bool, default True
Whether to create this element
bins: int, default 50
Number of bins in the histogram
yscale: str, default "linear"
Y-axis scale ("linear" or "log")
color: str, default "#aec7e8"
Color of the histogram
height: int, default "auto"
... | infinity__threshold: int = 1
zeros__threshold: int = 5
negatives__threshold: int = 1
normal__threshold: float = 0.99
high_cardinality__threshold: int = 50
constant__threshold: int = 1
outstanding_no1__threshold: float = 1.5
attribution__threshold: float = 0.5
high_word_cardinality__thre... | 134 | 134 | 449 | 5 | 128 | Waterpine/dataprep-1 | dataprep/eda/configs.py | Python | Hist | Hist | 159 | 204 | 159 | 159 | 80520ca0135435fb2a6f01b41a5a42c1a5730aab | bigcode/the-stack | train |
3d7eb1fc28e1ce35a152d3e4 | train | function | def _form(val: Any) -> Any:
"""
Format a value for the how-to guide
"""
return f"'{val}'" if isinstance(val, str) else val
| def _form(val: Any) -> Any:
| """
Format a value for the how-to guide
"""
return f"'{val}'" if isinstance(val, str) else val
| names = ["value_table.ngroups"]
descs = ["The number of distinct values to show"]
return [(f"'{name}': {_form(val)}", desc) for name, val, desc in zip(names, vals, descs)]
def _form(val: Any) -> Any:
| 63 | 64 | 41 | 10 | 53 | Waterpine/dataprep-1 | dataprep/eda/configs.py | Python | _form | _form | 1,082 | 1,086 | 1,082 | 1,082 | 37498bf211e6c8ad1a207e85a54dea4e9f8b14b4 | bigcode/the-stack | train |
ca77b45d1d9047e0f56ae9e9 | train | class | class Diff(BaseModel):
"""
Define the parameters in the plot_diff
"""
label: Union[List[str], None] = None
baseline: int = 0
density: bool = False
| class Diff(BaseModel):
| """
Define the parameters in the plot_diff
"""
label: Union[List[str], None] = None
baseline: int = 0
density: bool = False
| parameters for the plots
"""
width: Union[int, None] = None
height: Union[int, None] = None
bins: Union[int, None] = None
ngroups: Union[int, None] = None
report: bool = False
class Diff(BaseModel):
| 64 | 64 | 45 | 5 | 58 | Waterpine/dataprep-1 | dataprep/eda/configs.py | Python | Diff | Diff | 77 | 84 | 77 | 77 | d1602451ae27784cce6c71b51068194a5736c5ad | bigcode/the-stack | train |
54c58615c8c75816f4280ce0 | train | class | class CDF(BaseModel):
"""
enable: bool, default True
Whether to create this element
sample_size:
Number of evenly spaced samples between the minimum and maximum values to compute the cdf at
height: int, default "auto"
Height of the plot
width: int, default "auto"
Widt... | class CDF(BaseModel):
| """
enable: bool, default True
Whether to create this element
sample_size:
Number of evenly spaced samples between the minimum and maximum values to compute the cdf at
height: int, default "auto"
Height of the plot
width: int, default "auto"
Width of the plot
"""
... | """Number of evenly spaced samples between the minimum and maximum values to
compute the pdf at""",
"Height of the plot",
"Width of the plot",
]
return [(f"'{name}': {val}", desc) for name, val, desc in zip(names, vals, descs)]
class CDF(BaseModel):
| 73 | 74 | 247 | 6 | 67 | Waterpine/dataprep-1 | dataprep/eda/configs.py | Python | CDF | CDF | 1,029 | 1,058 | 1,029 | 1,029 | b43346f2c17513f845fdc6962a2a9317d77bfaa6 | bigcode/the-stack | train |
9c266da49e100f949245874e | train | class | class Stats(BaseModel):
"""
enable: bool, default True
Whether to display the stats section
"""
enable: bool = True
| class Stats(BaseModel):
| """
enable: bool, default True
Whether to display the stats section
"""
enable: bool = True
| [int, None] = None
report: bool = False
class Diff(BaseModel):
"""
Define the parameters in the plot_diff
"""
label: Union[List[str], None] = None
baseline: int = 0
density: bool = False
class Stats(BaseModel):
| 64 | 64 | 32 | 5 | 58 | Waterpine/dataprep-1 | dataprep/eda/configs.py | Python | Stats | Stats | 87 | 93 | 87 | 87 | 9261d45758aeb14ef4f00355a86af8d84d124c56 | bigcode/the-stack | train |
39d616255acba29f0194cd1a | train | class | class PDF(BaseModel):
"""
enable: bool, default True
Whether to create this element
sample_size: int, default 100
Number of evenly spaced samples between the minimum and maximum values to compute the pdf at
height: int, default "auto"
Height of the plot
width: int, default "a... | class PDF(BaseModel):
| """
enable: bool, default True
Whether to create this element
sample_size: int, default 100
Number of evenly spaced samples between the minimum and maximum values to compute the pdf at
height: int, default "auto"
Height of the plot
width: int, default "auto"
Width of ... | how-to guide
"""
vals = [height, width]
names = ["height", "width"]
descs = ["Height of the plot", "Width of the plot"]
return [(f"'{name}': {val}", desc) for name, val, desc in zip(names, vals, descs)]
class PDF(BaseModel):
| 74 | 75 | 251 | 5 | 69 | Waterpine/dataprep-1 | dataprep/eda/configs.py | Python | PDF | PDF | 997 | 1,026 | 997 | 997 | 24e239c9487174a28fd3a9ada4a03925c40118bf | bigcode/the-stack | train |
d8d960c74ee8e5759eface4a | train | class | class MissingValues(BaseModel):
"""
enable: bool, default True
Whether to create this element
"""
enable: bool = True
| class MissingValues(BaseModel):
| """
enable: bool, default True
Whether to create this element
"""
enable: bool = True
| [
"If the correlation value is out of the range, don't show it",
"Choose top-k element",
]
return [(f"'{name}': {_form(val)}", desc) for name, val, desc in zip(names, vals, descs)]
class MissingValues(BaseModel):
| 63 | 64 | 32 | 6 | 57 | Waterpine/dataprep-1 | dataprep/eda/configs.py | Python | MissingValues | MissingValues | 1,149 | 1,155 | 1,149 | 1,149 | d36c9ff5071f2161bccaf2ef40c1b6de833ea221 | bigcode/the-stack | train |
8c517114b5db8ca77d793d11 | train | class | class Spectrum(BaseModel):
"""
enable: bool, default True
Whether to create this element
bins: int, default 20
Number of bins
height: int, default "auto"
Height of the plot
width: int, default "auto"
Width of the plot
"""
enable: bool = True
bins: int = 2... | class Spectrum(BaseModel):
| """
enable: bool, default True
Whether to create this element
bins: int, default 20
Number of bins
height: int, default "auto"
Height of the plot
width: int, default "auto"
Width of the plot
"""
enable: bool = True
bins: int = 20
height: Union[int, No... | height, width]
names = ["height", "width"]
descs = ["Height of the plot", "Width of the plot"]
return [(f"'{name}': {val}", desc) for name, val, desc in zip(names, vals, descs)]
class Spectrum(BaseModel):
| 63 | 64 | 215 | 5 | 58 | Waterpine/dataprep-1 | dataprep/eda/configs.py | Python | Spectrum | Spectrum | 946 | 970 | 946 | 946 | 9897a8324b5f11ea9ed008abbae97a4b7ecb66f8 | bigcode/the-stack | train |
ba507467f60b016ff4663d21 | train | class | class WordLength(BaseModel):
"""
enable: bool, default True
Whether to create this element
bins: int, default 50
Number of bins in the histogram
yscale: str, default "linear"
Y-axis scale ("linear" or "log")
color: str, default "#aec7e8"
Color of the histogram
hei... | class WordLength(BaseModel):
| """
enable: bool, default True
Whether to create this element
bins: int, default 50
Number of bins in the histogram
yscale: str, default "linear"
Y-axis scale ("linear" or "log")
color: str, default "#aec7e8"
Color of the histogram
height: int, default "auto"
... | s = [
"Maximum number of most frequent words to display",
"Whether to remove stopwords",
"Whether to lemmatize the words",
"Whether to apply Potter Stem on the words",
"Color",
"Height of the plot",
"Width of the plot",
]
... | 98 | 99 | 331 | 6 | 92 | Waterpine/dataprep-1 | dataprep/eda/configs.py | Python | WordLength | WordLength | 551 | 587 | 551 | 551 | 78973af4192393e890391d4b091997eff1dc8f9a | bigcode/the-stack | train |
d4bf0f49e231194129696311 | train | class | class WordCloud(BaseModel):
"""
enable: bool, default True
Whether to create this element
top_words: int, default 30
Maximum number of most frequent words to display
stopword: bool, default True
Whether to remove stopwords
lemmatize: bool, default False
Whether to lem... | class WordCloud(BaseModel):
| """
enable: bool, default True
Whether to create this element
top_words: int, default 30
Maximum number of most frequent words to display
stopword: bool, default True
Whether to remove stopwords
lemmatize: bool, default False
Whether to lemmatize the words
stem: b... | pie.slices", "pie.sort_descending", "pie.colors", "height", "width"]
descs = [
"Maximum number of pie slices to display",
"Whether to sort the slices in descending order of frequency",
"List of colors",
"Height of the plot",
"Width of the plot",
... | 105 | 106 | 356 | 6 | 99 | Waterpine/dataprep-1 | dataprep/eda/configs.py | Python | WordCloud | WordCloud | 454 | 497 | 454 | 454 | 135b1b234401de9986cfd7e0c6a9d6493ce2f137 | bigcode/the-stack | train |
fb72d9d1178ea8eb1a6e6601 | train | function | async def setup(bot):
cog = ServerBlock(bot)
await cog.initialize()
bot.add_cog(cog) | async def setup(bot):
| cog = ServerBlock(bot)
await cog.initialize()
bot.add_cog(cog) | import json
from pathlib import Path
from .serverblock import ServerBlock
with open(Path(__file__).parent / "info.json") as fp:
__red_end_user_data_statement__ = json.load(fp)["end_user_data_statement"]
async def setup(bot):
| 54 | 64 | 25 | 5 | 49 | LeOctavius/Kreusada-Cogs | serverblock/__init__.py | Python | setup | setup | 9 | 12 | 9 | 9 | d8a5591a5632f015df89283fefe7b74532c3d93e | bigcode/the-stack | train |
8c9b72ae060bc1ba251755d3 | train | function | def get_debugger():
"""
Test importing each debuggers Python module to figure out which
one we are in. Save it to the global state for others to use.
"""
global DEBUGGER
if DEBUGGER:
return DEBUGGER
try:
import gdb
DEBUGGER = 'gdb'
return DEBUGGER
except... | def get_debugger():
| """
Test importing each debuggers Python module to figure out which
one we are in. Save it to the global state for others to use.
"""
global DEBUGGER
if DEBUGGER:
return DEBUGGER
try:
import gdb
DEBUGGER = 'gdb'
return DEBUGGER
except:
pass
... | from __future__ import absolute_import
import importlib
import logging
import pkgutil
logger = logging.getLogger(__name__)
DEBUGGER = None
PLUGIN_PREFIX = "gdbundle_"
LOADED_PLUGINS = []
def get_debugger():
| 53 | 64 | 119 | 5 | 48 | Leo-Ryu/gdbundle | gdbundle/__init__.py | Python | get_debugger | get_debugger | 14 | 38 | 14 | 14 | e8707b96cb474b7da7a7ff9731ea4583107cb748 | bigcode/the-stack | train |
d375b24ba3f41405036bd9df | train | function | def load_plugin(name):
"""
Attempt to load the plugin with the name given.
:param module_name: Explicit plugin to load.
"""
load_module(PLUGIN_PREFIX + name)
| def load_plugin(name):
| """
Attempt to load the plugin with the name given.
:param module_name: Explicit plugin to load.
"""
load_module(PLUGIN_PREFIX + name)
| try:
scripts = plugin_loader.gdbundle_load()
except Exception as e:
logging.warning("Failed to call `gdb_scripts` function in gdbundle module: {}".format(module_name), exc_info=True)
return
LOADED_PLUGINS.append(module_name)
def load_plugin(name):
| 64 | 64 | 40 | 5 | 59 | Leo-Ryu/gdbundle | gdbundle/__init__.py | Python | load_plugin | load_plugin | 65 | 71 | 65 | 65 | c0a3bf7922866d8cff0e062694a504151db66f81 | bigcode/the-stack | train |
8531b48d061281e568a1c7ac | train | function | def init(include=None, exclude=None):
"""
The default entry point for gdbundle. This will load the gdbundle GDB
commands and discover and load gdbundle plugins.
:param include: Plugin names to load. All others will be ignored.
:param exclude: Plugin names to not load.
.. note:: The plugin name... | def init(include=None, exclude=None):
| """
The default entry point for gdbundle. This will load the gdbundle GDB
commands and discover and load gdbundle plugins.
:param include: Plugin names to load. All others will be ignored.
:param exclude: Plugin names to not load.
.. note:: The plugin names passed into this function should not... | Load the GDB commands for gdbundle
"""
debugger = get_debugger()
if debugger == 'gdb':
from gdbundle import commands_gdb
elif debugger == 'lldb':
from gdbundle import commands_lldb
def init(include=None, exclude=None):
| 64 | 64 | 145 | 8 | 55 | Leo-Ryu/gdbundle | gdbundle/__init__.py | Python | init | init | 113 | 126 | 113 | 113 | b9b67f0de01dafd71cdbcef5ff6516f81a15a17e | bigcode/the-stack | train |
681db40722aaf5e32cd4fd3b | train | function | def load_module(module_name):
"""
Attempt to load the module with the name given.
:param module_name: Explicit module to load. Can be called directly to load plugins
that don't being with `gdbundle_`.
"""
try:
loader_name = "{}.{}_loader".format(module_name, get_debu... | def load_module(module_name):
| """
Attempt to load the module with the name given.
:param module_name: Explicit module to load. Can be called directly to load plugins
that don't being with `gdbundle_`.
"""
try:
loader_name = "{}.{}_loader".format(module_name, get_debugger())
plugin_loader ... | db
DEBUGGER = 'gdb'
return DEBUGGER
except:
pass
try:
import lldb
DEBUGGER = 'lldb'
return DEBUGGER
except:
pass
raise Exception("Could not detect debugger used")
def load_module(module_name):
| 64 | 64 | 183 | 6 | 58 | Leo-Ryu/gdbundle | gdbundle/__init__.py | Python | load_module | load_module | 41 | 62 | 41 | 41 | a56204558481cdbce6153e93a77a773f77a43994 | bigcode/the-stack | train |
5c0093e61bdad3c4d41ebe31 | train | function | def load_commands():
"""
Load the GDB commands for gdbundle
"""
debugger = get_debugger()
if debugger == 'gdb':
from gdbundle import commands_gdb
elif debugger == 'lldb':
from gdbundle import commands_lldb
| def load_commands():
| """
Load the GDB commands for gdbundle
"""
debugger = get_debugger()
if debugger == 'gdb':
from gdbundle import commands_gdb
elif debugger == 'lldb':
from gdbundle import commands_lldb
| all plugins from the list that are in `exclude`
if exclude:
exclude = [s.lower() for s in exclude]
plugins = [p for p in plugins if p not in exclude]
for name in plugins:
# Import the plugin module
load_plugin(name)
def load_commands():
| 64 | 64 | 62 | 4 | 60 | Leo-Ryu/gdbundle | gdbundle/__init__.py | Python | load_commands | load_commands | 102 | 110 | 102 | 102 | b4162bd7dd2cf32cb71b0630a830345befa2d279 | bigcode/the-stack | train |
407bb128c257a8d1fa77341d | train | function | def discover_and_load_plugins(include=None, exclude=None):
"""
This will load the gdbundle GDB commands and discover and load gdbundle
plugins.
"""
# Pull out all possible plugins matching the prefix
plugins = [
name.replace(PLUGIN_PREFIX, "").lower()
for finder, name, ispkg in ... | def discover_and_load_plugins(include=None, exclude=None):
| """
This will load the gdbundle GDB commands and discover and load gdbundle
plugins.
"""
# Pull out all possible plugins matching the prefix
plugins = [
name.replace(PLUGIN_PREFIX, "").lower()
for finder, name, ispkg in pkgutil.iter_modules()
if name.startswith(PLUGIN_PR... | return
LOADED_PLUGINS.append(module_name)
def load_plugin(name):
"""
Attempt to load the plugin with the name given.
:param module_name: Explicit plugin to load.
"""
load_module(PLUGIN_PREFIX + name)
def discover_and_load_plugins(include=None, exclude=None):
| 64 | 64 | 193 | 11 | 53 | Leo-Ryu/gdbundle | gdbundle/__init__.py | Python | discover_and_load_plugins | discover_and_load_plugins | 74 | 99 | 74 | 74 | 39d8fda17ca510678f005a23f37c71d289518d81 | bigcode/the-stack | train |
8d11ea595407444482a41f9e | train | function | def csv_upload(request):
if request.method == 'POST' and request.FILES['myfile']:
myfile = request.FILES['myfile']
fs = FileSystemStorage()
filename = fs.save("data.csv", myfile)
uploaded_file_url = fs.url(filename)
time.sleep(2)
return redirect('brush_graph')
... | def csv_upload(request):
| if request.method == 'POST' and request.FILES['myfile']:
myfile = request.FILES['myfile']
fs = FileSystemStorage()
filename = fs.save("data.csv", myfile)
uploaded_file_url = fs.url(filename)
time.sleep(2)
return redirect('brush_graph')
return render(request... | from django.shortcuts import render, redirect
from django.core.files.storage import FileSystemStorage
from django.conf import settings
import numpy as np
import pandas as pd
import os
import json
import time
from pages.new_SAX import get_segment_data
def csv_upload(request):
| 59 | 64 | 84 | 5 | 53 | rakesh-lagare/Thesis_Work | Django/Thesis/Motif_Discovery/pages/views.py | Python | csv_upload | csv_upload | 12 | 20 | 12 | 12 | de42083404a3ee54dadab066bce6dc70c0910ad3 | bigcode/the-stack | train |
c927d98f4f391187257f580c | train | function | def images_display(request):
path="C:/Megatron/Thesis/Thesis_Work/Django/Thesis/Motif_Discovery/static/ops"
img_list =os.listdir(path)
#os.remove("static/ops/.png")
#print("File Removed!")
return render(request, 'images.html', {'images': img_list})
| def images_display(request):
| path="C:/Megatron/Thesis/Thesis_Work/Django/Thesis/Motif_Discovery/static/ops"
img_list =os.listdir(path)
#os.remove("static/ops/.png")
#print("File Removed!")
return render(request, 'images.html', {'images': img_list})
| .get('start')
end = request.POST.get('end')
get_segment_data(csv_data,start,end)
return redirect('images')
return render(request, 'brush_graph.html', data )
def home(request):
return render(request, 'test.html', {} )
def images_display(request):
| 63 | 64 | 74 | 5 | 58 | rakesh-lagare/Thesis_Work | Django/Thesis/Motif_Discovery/pages/views.py | Python | images_display | images_display | 49 | 57 | 49 | 50 | 179f96c9b6bffa6a01458be9613279cabcc1f61b | bigcode/the-stack | train |
388c8f2003c7d7cb51bbb6b7 | train | function | def home(request):
return render(request, 'test.html', {} )
| def home(request):
| return render(request, 'test.html', {} )
| _data
}
if request.method == 'POST' :
start = request.POST.get('start')
end = request.POST.get('end')
get_segment_data(csv_data,start,end)
return redirect('images')
return render(request, 'brush_graph.html', data )
def home(request):
| 63 | 64 | 16 | 4 | 59 | rakesh-lagare/Thesis_Work | Django/Thesis/Motif_Discovery/pages/views.py | Python | home | home | 43 | 44 | 43 | 43 | 06ebb34433de95cc8aa4daeb60c1b6a67239d490 | bigcode/the-stack | train |
f7acf43271506f57106a3eda | train | function | def brush_graph(request):
csv_data= read_csv()
data={
"key" : "csv",
"value": csv_data
}
if request.method == 'POST' :
start = request.POST.get('start')
end = request.POST.get('end')
get_segment_data(csv_data,start,end)
return redirect('images')
... | def brush_graph(request):
| csv_data= read_csv()
data={
"key" : "csv",
"value": csv_data
}
if request.method == 'POST' :
start = request.POST.get('start')
end = request.POST.get('end')
get_segment_data(csv_data,start,end)
return redirect('images')
return render(request, '... | request.FILES['myfile']
fs = FileSystemStorage()
filename = fs.save("data.csv", myfile)
uploaded_file_url = fs.url(filename)
time.sleep(2)
return redirect('brush_graph')
return render(request, 'csv_upload.html')
def brush_graph(request):
| 63 | 64 | 88 | 5 | 58 | rakesh-lagare/Thesis_Work | Django/Thesis/Motif_Discovery/pages/views.py | Python | brush_graph | brush_graph | 24 | 38 | 24 | 24 | 5ad1d68a60768e0673be1079a896a5e480a94165 | bigcode/the-stack | train |
781f50bf7edcff3d1fb02bbd | train | function | def read_csv():
data = pd.read_csv('files/data.csv', header=None,usecols=[1],skiprows=1)
x1 = np.asfarray(data.values.flatten(),float)
x1= x1.tolist()
#os.remove("files/data.csv")
#print("File Removed!")
return x1
| def read_csv():
| data = pd.read_csv('files/data.csv', header=None,usecols=[1],skiprows=1)
x1 = np.asfarray(data.values.flatten(),float)
x1= x1.tolist()
#os.remove("files/data.csv")
#print("File Removed!")
return x1
| /Thesis_Work/Django/Thesis/Motif_Discovery/static/ops"
img_list =os.listdir(path)
#os.remove("static/ops/.png")
#print("File Removed!")
return render(request, 'images.html', {'images': img_list})
def read_csv():
| 63 | 64 | 72 | 4 | 59 | rakesh-lagare/Thesis_Work | Django/Thesis/Motif_Discovery/pages/views.py | Python | read_csv | read_csv | 60 | 68 | 60 | 60 | ddff1c6c536732726548c047cf7f58e83dc1f0b3 | bigcode/the-stack | train |
72b59607bb522698aa6157bb | train | class | class IrfMember(object):
"""This class is used to get and build IRF port configurations
on a ``HPCOM7`` device.
Args:
device (HPCOM7): connected instance of
a ``pyhpecw7.comware.HPCOM7`` object.
Attributes:
device (HPCOM7): connected instance of
a ``pyhpecw7.com... | class IrfMember(object):
| """This class is used to get and build IRF port configurations
on a ``HPCOM7`` device.
Args:
device (HPCOM7): connected instance of
a ``pyhpecw7.comware.HPCOM7`` object.
Attributes:
device (HPCOM7): connected instance of
a ``pyhpecw7.comware.HPCOM7`` object.
... | ))
port_elems = findall_in_data('IRFPort', nc_get_reply.data_ele)
for port_ele in port_elems:
iface_elems = findall_in_data('Interface', port_ele)
port_num = find_in_data('Port', port_ele).text
member_num = find_in_data('MemberID', port_ele).text
if irf_... | 256 | 256 | 1,810 | 6 | 249 | vincentbernat/pyhpecw7 | pyhpecw7/features/irf.py | Python | IrfMember | IrfMember | 203 | 472 | 203 | 203 | e9bafc20b8e30ab8ae95bd55454713ac18511c97 | bigcode/the-stack | train |
3fb536761a4cc2c9b27ccee5 | train | class | class IrfPort(object):
"""This class is used to get and build IRF port configurations
on a ``HPCOM7`` device.
Args:
device (HPCOM7): connected instance of
a ``pyhpecw7.comware.HPCOM7`` object.
Attributes:
device (HPCOM7): connected instance of
a ``pyhpecw7.comwa... | class IrfPort(object):
| """This class is used to get and build IRF port configurations
on a ``HPCOM7`` device.
Args:
device (HPCOM7): connected instance of
a ``pyhpecw7.comware.HPCOM7`` object.
Attributes:
device (HPCOM7): connected instance of
a ``pyhpecw7.comware.HPCOM7`` object.
... | """This module is used to configure IRF for a
``HPCOM7`` device. The ``IRFMember`` class is used
to change the IRF member numbers on the device, and
can force a reboot. The ``IRFPort`` class is used to
bind physical ports to IRF ports. ``IRFMember`` should
be used first and the ``IRFPort``.
"""
from pyhpecw7.utils.xml... | 136 | 256 | 1,395 | 6 | 129 | vincentbernat/pyhpecw7 | pyhpecw7/features/irf.py | Python | IrfPort | IrfPort | 15 | 200 | 15 | 15 | 480f33006b9e4616c56f662b94f83ac3626bc4cd | bigcode/the-stack | train |
b5ad8a01e62cd95b4d16756a | train | function | def test_WindowAndFlipC01B_axes_guard():
ddata = DummyDataset(axes=('b', 0, 1, 'c'))
raised_error = False
try:
wf = WindowAndFlipC01B(window_shape=(3, 3), randomize=[ddata])
except ValueError:
raised_error = True
assert_equal(raised_error, True)
| def test_WindowAndFlipC01B_axes_guard():
| ddata = DummyDataset(axes=('b', 0, 1, 'c'))
raised_error = False
try:
wf = WindowAndFlipC01B(window_shape=(3, 3), randomize=[ddata])
except ValueError:
raised_error = True
assert_equal(raised_error, True)
| if (image[:, :i] == 0).all():
saw_padding['l', i] = True
wf.on_monitor(None, None, None)
new_topo = ddata.get_topological_view()
iters += 1
def test_WindowAndFlipC01B_axes_guard():
| 64 | 64 | 83 | 11 | 52 | julianser/pylearn2 | pylearn2/train_extensions/tests/test_window_flip.py | Python | test_WindowAndFlipC01B_axes_guard | test_WindowAndFlipC01B_axes_guard | 164 | 171 | 164 | 164 | ed86853a569b1b0b8618aeecb613bcf1f498c0d3 | bigcode/the-stack | train |
b9bf238cb29e4f57059b21dd | train | function | def check_window_flip_coverage_B01C(flip):
ddata = DummyDataset(axes=('b', 0, 1, 'c'))
topo = ddata.get_topological_view()
ref_win = [set() for _ in xrange(4)]
for b in xrange(topo.shape[0]):
for i in xrange(3):
for j in xrange(3):
window = topo[b, i:i + 3, j:j + 3, :... | def check_window_flip_coverage_B01C(flip):
| ddata = DummyDataset(axes=('b', 0, 1, 'c'))
topo = ddata.get_topological_view()
ref_win = [set() for _ in xrange(4)]
for b in xrange(topo.shape[0]):
for i in xrange(3):
for j in xrange(3):
window = topo[b, i:i + 3, j:j + 3, :]
assert_equal((3, 3), wind... | ) for a, b in zip(ref_win, actual_win)):
prev_topo = curr_topo.copy()
wf.on_monitor(None, ddata, None)
curr_topo = ddata.get_topological_view()
assert_(not (prev_topo == curr_topo).all())
for b in xrange(topo.shape[-1]):
hashed = _hash_array(curr_topo[..., b])
... | 114 | 114 | 383 | 12 | 102 | julianser/pylearn2 | pylearn2/train_extensions/tests/test_window_flip.py | Python | check_window_flip_coverage_B01C | check_window_flip_coverage_B01C | 88 | 117 | 88 | 88 | 6eaacd308b29047982a2abd3e811b5d6c2854936 | bigcode/the-stack | train |
f287308a634b2b9a7c908c2f | train | function | def check_padding(axes, use_old_c01b=False):
padding = 3
ddata = DummyDataset()
topo = ddata.get_topological_view()
if use_old_c01b:
wf_cls = WindowAndFlipC01B
else:
wf_cls = WindowAndFlip
wf = wf_cls(window_shape=(5, 5), randomize=[ddata],
pad_randomized=paddi... | def check_padding(axes, use_old_c01b=False):
| padding = 3
ddata = DummyDataset()
topo = ddata.get_topological_view()
if use_old_c01b:
wf_cls = WindowAndFlipC01B
else:
wf_cls = WindowAndFlip
wf = wf_cls(window_shape=(5, 5), randomize=[ddata],
pad_randomized=padding)
wf.setup(None, None, None)
new_top... | ], hashed)
actual_win[b].add(hashed)
def test_padding():
# Old interface WindowAndFlipC01B
yield check_padding, ('c', 0, 1, 'b'), True
# New interface WindowAndFlip
yield check_padding, ('c', 0, 1, 'b')
yield check_padding, ('b', 0, 1, 'c')
def check_padding(axes, use_old_c01b=False):
... | 101 | 101 | 338 | 13 | 88 | julianser/pylearn2 | pylearn2/train_extensions/tests/test_window_flip.py | Python | check_padding | check_padding | 128 | 161 | 128 | 129 | 82adb16a7580c1a6ccdcfd3348fa6f52c6352d90 | bigcode/the-stack | train |
1f631ee316e98666e068cbc4 | train | function | def check_window_flip_coverage_C01B(flip, use_old_c01b=False):
# 4 5x5x2 images (stored in a 2x5x5x4 tensor)
ddata = DummyDataset(axes=('c', 0, 1, 'b'))
topo = ddata.get_topological_view()
# ref_win[b]: a set of hashes, computed from all possible 3x3 windows of
# topo[..., b].
ref_w... | def check_window_flip_coverage_C01B(flip, use_old_c01b=False):
# 4 5x5x2 images (stored in a 2x5x5x4 tensor)
| ddata = DummyDataset(axes=('c', 0, 1, 'b'))
topo = ddata.get_topological_view()
# ref_win[b]: a set of hashes, computed from all possible 3x3 windows of
# topo[..., b].
ref_win = [set() for _ in xrange(4)]
for b in xrange(topo.shape[-1]):
# get all possible 3x3 windows withi... | ())
return h.hexdigest()
def test_window_flip_coverage():
# Old interface WindowAndFlipC01B
yield check_window_flip_coverage_C01B, True, True
yield check_window_flip_coverage_C01B, False, True
# New interface WindowAndFlip
yield check_window_flip_coverage_C01B, True
yield check_window_flip... | 159 | 159 | 533 | 44 | 114 | julianser/pylearn2 | pylearn2/train_extensions/tests/test_window_flip.py | Python | check_window_flip_coverage_C01B | check_window_flip_coverage_C01B | 41 | 85 | 41 | 42 | eb8b32f497d2586d8eb8fec05f065a734f5ccb10 | bigcode/the-stack | train |
46d4bddb127732a7fe50617c | train | class | class DummyDataset(DenseDesignMatrix):
def __init__(self, axes=('c', 0, 1, 'b')):
assert_contains([('c', 0, 1, 'b'), ('b', 0, 1, 'c')], axes)
axes = list(axes)
vc = DefaultViewConverter((5, 5, 2), axes=axes)
rng = numpy.random.RandomState([2013, 3, 12])
X = rng.normal(size=(4... | class DummyDataset(DenseDesignMatrix):
| def __init__(self, axes=('c', 0, 1, 'b')):
assert_contains([('c', 0, 1, 'b'), ('b', 0, 1, 'c')], axes)
axes = list(axes)
vc = DefaultViewConverter((5, 5, 2), axes=axes)
rng = numpy.random.RandomState([2013, 3, 12])
X = rng.normal(size=(4, 50)).astype('float32')
super(... | from pylearn2.train_extensions.window_flip import WindowAndFlipC01B
from pylearn2.datasets.dense_design_matrix import (
DenseDesignMatrix,
DefaultViewConverter
)
from pylearn2.utils.testing import assert_equal, assert_contains, assert_
class DummyDataset(DenseDesignMatrix):
| 63 | 64 | 140 | 7 | 56 | julianser/pylearn2 | pylearn2/train_extensions/tests/test_window_flip.py | Python | DummyDataset | DummyDataset | 15 | 22 | 15 | 15 | 2a3f576df4ad40ed619deb848396dddd7d94df0d | bigcode/the-stack | train |
c704b190b156f6385329def4 | train | function | def _hash_array(arr):
h = hashlib.sha1(arr.copy())
return h.hexdigest()
| def _hash_array(arr):
| h = hashlib.sha1(arr.copy())
return h.hexdigest()
| axes)
rng = numpy.random.RandomState([2013, 3, 12])
X = rng.normal(size=(4, 50)).astype('float32')
super(DummyDataset, self).__init__(X=X, view_converter=vc, axes=axes)
def _hash_array(arr):
| 64 | 64 | 21 | 6 | 58 | julianser/pylearn2 | pylearn2/train_extensions/tests/test_window_flip.py | Python | _hash_array | _hash_array | 25 | 27 | 25 | 25 | 82b393ae2d5dfae91baac342b8476f657413d5a8 | bigcode/the-stack | train |
d39c444881f5dc9a7dd22a16 | train | function | def test_window_flip_coverage():
# Old interface WindowAndFlipC01B
yield check_window_flip_coverage_C01B, True, True
yield check_window_flip_coverage_C01B, False, True
# New interface WindowAndFlip
yield check_window_flip_coverage_C01B, True
yield check_window_flip_coverage_C01B, False
yield... | def test_window_flip_coverage():
# Old interface WindowAndFlipC01B
| yield check_window_flip_coverage_C01B, True, True
yield check_window_flip_coverage_C01B, False, True
# New interface WindowAndFlip
yield check_window_flip_coverage_C01B, True
yield check_window_flip_coverage_C01B, False
yield check_window_flip_coverage_B01C, True
yield check_window_flip_cove... | float32')
super(DummyDataset, self).__init__(X=X, view_converter=vc, axes=axes)
def _hash_array(arr):
h = hashlib.sha1(arr.copy())
return h.hexdigest()
def test_window_flip_coverage():
# Old interface WindowAndFlipC01B
| 64 | 64 | 108 | 18 | 46 | julianser/pylearn2 | pylearn2/train_extensions/tests/test_window_flip.py | Python | test_window_flip_coverage | test_window_flip_coverage | 30 | 38 | 30 | 31 | 9a3fcf4d1450d8ce758c97ed50e6226301c91a93 | bigcode/the-stack | train |
e55ea7f2c92f986dbfa994f0 | train | function | def test_padding():
# Old interface WindowAndFlipC01B
yield check_padding, ('c', 0, 1, 'b'), True
# New interface WindowAndFlip
yield check_padding, ('c', 0, 1, 'b')
yield check_padding, ('b', 0, 1, 'c')
| def test_padding():
# Old interface WindowAndFlipC01B
| yield check_padding, ('c', 0, 1, 'b'), True
# New interface WindowAndFlip
yield check_padding, ('c', 0, 1, 'b')
yield check_padding, ('b', 0, 1, 'c')
| == curr_topo).all())
for b in xrange(topo.shape[0]):
hashed = _hash_array(curr_topo[b, ...])
assert_contains(ref_win[b], hashed)
actual_win[b].add(hashed)
def test_padding():
# Old interface WindowAndFlipC01B
| 64 | 64 | 76 | 15 | 49 | julianser/pylearn2 | pylearn2/train_extensions/tests/test_window_flip.py | Python | test_padding | test_padding | 120 | 125 | 120 | 121 | 22896df9f0d719c8437155773cb06c95de0f92d7 | bigcode/the-stack | train |
1097d1293485202481885a25 | train | class | class TestRSTGenerator(TestCase):
def _make_one(self):
from soho.generators.rst import RSTGenerator
return RSTGenerator()
def _call_generate(self, filename):
import os.path
generator = self._make_one()
here = os.path.dirname(__file__)
path = os.path.join(here, '... | class TestRSTGenerator(TestCase):
| def _make_one(self):
from soho.generators.rst import RSTGenerator
return RSTGenerator()
def _call_generate(self, filename):
import os.path
generator = self._make_one()
here = os.path.dirname(__file__)
path = os.path.join(here, 'fixtures', filename)
return... | from unittest import TestCase
class TestRSTGenerator(TestCase):
| 13 | 123 | 411 | 7 | 5 | dbaty/soho | tests/test_generators_rst.py | Python | TestRSTGenerator | TestRSTGenerator | 4 | 46 | 4 | 5 | 4fac18854a58f692ea496307f0d9c7e2897059c7 | bigcode/the-stack | train |
38c203f7a61fc6acdc7d4e25 | train | class | class ResCompany(models.Model):
_inherit = 'res.company'
payment_acquirer_onboarding_state = fields.Selection([('not_done', "Not done"), ('just_done', "Just done"), ('done', "Done")], string="State of the onboarding payment acquirer step", default='not_done')
# YTI FIXME: Check if it's really needed on the... | class ResCompany(models.Model):
| _inherit = 'res.company'
payment_acquirer_onboarding_state = fields.Selection([('not_done', "Not done"), ('just_done', "Just done"), ('done', "Done")], string="State of the onboarding payment acquirer step", default='not_done')
# YTI FIXME: Check if it's really needed on the company. Should be enough on th... | # -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo import api, fields, models
class ResCompany(models.Model):
| 40 | 78 | 261 | 6 | 33 | jjiege/odoo | addons/payment/models/res_company.py | Python | ResCompany | ResCompany | 7 | 31 | 7 | 7 | 39a0c8ed318e5e6ba22190ac98074a56332a9406 | bigcode/the-stack | train |
c8e09c957aba3a574623c39f | train | class | class BankMemberSignalsToProcessTestCase(BanksTableTestBase, unittest.TestCase):
# Note: Table is defined in base class BanksTableTestBase
def _create_bank_and_bank_member(self) -> t.Tuple[str, str]:
table_manager = BanksTable(self.get_table())
bank = table_manager.create_bank("TEST_BANK", "Te... | class BankMemberSignalsToProcessTestCase(BanksTableTestBase, unittest.TestCase):
# Note: Table is defined in base class BanksTableTestBase
| def _create_bank_and_bank_member(self) -> t.Tuple[str, str]:
table_manager = BanksTable(self.get_table())
bank = table_manager.create_bank("TEST_BANK", "Test bank description")
bank_member = table_manager.add_bank_member(
bank_id=bank.bank_id,
content_type=VideoConte... | # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
import typing as t
import unittest
import random
from threatexchange import signal_type
from threatexchange.content_type.video import VideoContent
from threatexchange.signal_type.video_tmk_pdqf import VideoTmkPdqfSignal
from hmalib.common.models.... | 143 | 256 | 978 | 33 | 109 | crhird/ThreatExchange | hasher-matcher-actioner/hmalib/common/models/tests/test_bank_member_signals_to_process.py | Python | BankMemberSignalsToProcessTestCase | BankMemberSignalsToProcessTestCase | 16 | 145 | 16 | 18 | 6b672b915fe5600ba1b063c3125706f959fa55d0 | bigcode/the-stack | train |
9b0ef83e94fc989b6b8d554b | train | class | class SimpleTests(unittest.TestCase):
def testSimple(self):
self.assertEqual(str(TargetTriple("x86_64", "linux", "gnu")), "x86_64-linux-gnu")
def testKeyability(self):
a = {TargetTriple("x86_64", "linux", "gnu"): 1}
self.assertEqual(a[TargetTriple("x86_64", "linux", "gnu")], 1)
| class SimpleTests(unittest.TestCase):
| def testSimple(self):
self.assertEqual(str(TargetTriple("x86_64", "linux", "gnu")), "x86_64-linux-gnu")
def testKeyability(self):
a = {TargetTriple("x86_64", "linux", "gnu"): 1}
self.assertEqual(a[TargetTriple("x86_64", "linux", "gnu")], 1)
| collections import OrderedDict
import unittest
thisFile = Path(__file__).absolute()
thisDir = thisFile.parent.absolute()
repoMainDir = thisDir.parent.absolute()
sys.path.insert(0, str(repoMainDir))
dict = OrderedDict
from TargetTriple import TargetTriple
class SimpleTests(unittest.TestCase):
| 64 | 64 | 91 | 7 | 56 | prebuilder/TargetTriple.py | tests/tests.py | Python | SimpleTests | SimpleTests | 16 | 22 | 16 | 16 | 540ee5c3f48bcfdeb2b52927380d0ffe3061449f | bigcode/the-stack | train |
10dc40e6359d058415838ffc | train | class | class InnerEyeInference(abc.ABC):
"""
A base class that defines the methods that need to be present for doing inference on a trained model. This
form of inference is slightly different from what PyTorch Lightning does in its `Trainer.test` method. In
particular, this inference can be executed on any of ... | class InnerEyeInference(abc.ABC):
| """
A base class that defines the methods that need to be present for doing inference on a trained model. This
form of inference is slightly different from what PyTorch Lightning does in its `Trainer.test` method. In
particular, this inference can be executed on any of the training, validation, or test ... | Microsoft Corporation. All rights reserved.
# Licensed under the MIT License (MIT). See LICENSE in the repo root for license information.
# ------------------------------------------------------------------------------------------
import abc
from typing import Any, Dict, Iterator, List, Optional, Tuple
from pathlib ... | 247 | 247 | 825 | 9 | 237 | faz1993/InnerEye-DeepLearning | InnerEye/ML/lightning_container.py | Python | InnerEyeInference | InnerEyeInference | 28 | 108 | 28 | 28 | 4e16e6c74ee71d2e08353890a2b4373d0ec9098f | bigcode/the-stack | train |
8b1d54e1ce94234e7ff8765b | train | class | class LightningModuleWithOptimizer(LightningModule):
"""
A base class that supplies a method to configure optimizers and LR schedulers. To use this in your model,
inherit from this class instead of from LightningModule.
If this class is used, all configuration options for the optimizers and LR scheduler... | class LightningModuleWithOptimizer(LightningModule):
| """
A base class that supplies a method to configure optimizers and LR schedulers. To use this in your model,
inherit from this class instead of from LightningModule.
If this class is used, all configuration options for the optimizers and LR schedulers will be also available as
commandline arguments... | count = 0
for m in model_outputs:
count += 1
if aggregate_output is None:
aggregate_output = m
else:
aggregate_output += m
if count == 0 or aggregate_output is None:
raise ValueError("There were no results to aggregate.")
... | 85 | 85 | 285 | 10 | 74 | faz1993/InnerEye-DeepLearning | InnerEye/ML/lightning_container.py | Python | LightningModuleWithOptimizer | LightningModuleWithOptimizer | 111 | 134 | 111 | 111 | fa5feeffbae56457a263adc67c6f51e90161d079 | bigcode/the-stack | train |
52ff60107e06e98338ae371f | train | class | class LightningContainer(GenericConfig,
WorkflowParams,
DatasetParams,
OutputParams,
TrainerParams,
OptimizerParams):
"""
A LightningContainer contains all information to train a user-spe... | class LightningContainer(GenericConfig,
WorkflowParams,
DatasetParams,
OutputParams,
TrainerParams,
OptimizerParams):
| """
A LightningContainer contains all information to train a user-specified PyTorch Lightning model. The model that
should be trained is returned by the `create_model` method. The training data must be returned in the form of
a LightningDataModule, by the `get_data_module` method.
"""
def __ini... | options for the optimizers and LR schedulers will be also available as
commandline arguments (for example, you can supply the InnerEye runner with "--l_rate=1e-2" to change the learning
rate.
"""
# These fields will be set by the LightningContainer when the model is created.
_optimizer_params = Opt... | 256 | 256 | 2,127 | 27 | 229 | faz1993/InnerEye-DeepLearning | InnerEye/ML/lightning_container.py | Python | LightningContainer | LightningContainer | 137 | 351 | 137 | 142 | a86b8b4e5ebb9a379d3ef4ff31c20ad63e21d5a2 | bigcode/the-stack | train |
3e00f5206bc76193336273a4 | train | function | def get_output_filenames():
return os.listdir(os.path.join(tempfile.gettempdir(), 'test_inject_module_output'))
| def get_output_filenames():
| return os.listdir(os.path.join(tempfile.gettempdir(), 'test_inject_module_output'))
| tempfile
@pytest.fixture
def cleanup_third_party_modules_output():
output_dir = os.path.join(tempfile.gettempdir(), 'test_inject_module_output')
shutil.rmtree(output_dir, ignore_errors=True)
yield
shutil.rmtree(output_dir, ignore_errors=True)
def get_output_filenames():
| 64 | 64 | 26 | 6 | 58 | hxri/mars | mars/deploy/oscar/tests/modules/utils.py | Python | get_output_filenames | get_output_filenames | 29 | 30 | 29 | 29 | f1448557c010854f3223891b7d3dd248551776f6 | bigcode/the-stack | train |
1b68e35cf0dfc00e4b97151f | train | function | @pytest.fixture
def cleanup_third_party_modules_output():
output_dir = os.path.join(tempfile.gettempdir(), 'test_inject_module_output')
shutil.rmtree(output_dir, ignore_errors=True)
yield
shutil.rmtree(output_dir, ignore_errors=True)
| @pytest.fixture
def cleanup_third_party_modules_output():
| output_dir = os.path.join(tempfile.gettempdir(), 'test_inject_module_output')
shutil.rmtree(output_dir, ignore_errors=True)
yield
shutil.rmtree(output_dir, ignore_errors=True)
| distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import os
import shutil
import pytest
import tempfile
@pytest.fixture
def cleanup_third_party_modules_outpu... | 64 | 64 | 56 | 11 | 52 | hxri/mars | mars/deploy/oscar/tests/modules/utils.py | Python | cleanup_third_party_modules_output | cleanup_third_party_modules_output | 21 | 26 | 21 | 22 | e202ff23b494cb15214dfb965ced6c5df15948d0 | bigcode/the-stack | train |
2e1279a4d0ff2fb304d4e0f7 | train | class | class FakeObject(base.RESTObject):
pass
| class FakeObject(base.RESTObject):
| pass
| import unittest
from GitLabApi import base
class FakeGitlab(object):
foo = 'bar'
@property
def attributes(self):
return {'foo': 'bar'}
class FakeObject(base.RESTObject):
| 47 | 64 | 11 | 8 | 39 | Alek96/SZR | SZR/apps/GitLabApi/tests/test_base.py | Python | FakeObject | FakeObject | 14 | 15 | 14 | 14 | f2a16284dd0583d48b2a91c9d904acc4ed3e5b67 | bigcode/the-stack | train |
f1eb50e5ee0a4b4a1530033d | train | class | class TestRESTObject(unittest.TestCase):
def test_instance(self):
obj = FakeObject(FakeGitlab())
self.assertIsInstance(obj._rest_object, FakeGitlab)
def test_attrs_get(self):
obj = FakeObject(FakeGitlab())
self.assertEqual('bar', obj.foo)
self.assertRaises(AttributeErro... | class TestRESTObject(unittest.TestCase):
| def test_instance(self):
obj = FakeObject(FakeGitlab())
self.assertIsInstance(obj._rest_object, FakeGitlab)
def test_attrs_get(self):
obj = FakeObject(FakeGitlab())
self.assertEqual('bar', obj.foo)
self.assertRaises(AttributeError, getattr, obj, 'bar')
def test_att... | class TestRESTManager(unittest.TestCase):
def test_instance(self):
class MGR(base.RESTManager):
_obj_cls = FakeObject
mgr = MGR(FakeGitlab())
self.assertIsInstance(mgr._rest_manager, FakeGitlab)
class TestRESTObject(unittest.TestCase):
| 64 | 64 | 141 | 8 | 56 | Alek96/SZR | SZR/apps/GitLabApi/tests/test_base.py | Python | TestRESTObject | TestRESTObject | 31 | 51 | 31 | 31 | 813c03403c8a72c37420fae3f787283a7146fc58 | bigcode/the-stack | train |
01d94e2f4dc5c468229d440d | train | class | class FakeManager(base.RESTManager):
_obj_cls = FakeObject
| class FakeManager(base.RESTManager):
| _obj_cls = FakeObject
| import unittest
from GitLabApi import base
class FakeGitlab(object):
foo = 'bar'
@property
def attributes(self):
return {'foo': 'bar'}
class FakeObject(base.RESTObject):
pass
class FakeManager(base.RESTManager):
| 59 | 64 | 16 | 8 | 50 | Alek96/SZR | SZR/apps/GitLabApi/tests/test_base.py | Python | FakeManager | FakeManager | 18 | 19 | 18 | 18 | efa05a5ebef68984ca16e94870fd9c45425b5cee | bigcode/the-stack | train |
aef1598d3d0e41121908cb2d | train | class | class FakeGitlab(object):
foo = 'bar'
@property
def attributes(self):
return {'foo': 'bar'}
| class FakeGitlab(object):
| foo = 'bar'
@property
def attributes(self):
return {'foo': 'bar'}
| import unittest
from GitLabApi import base
class FakeGitlab(object):
| 16 | 64 | 29 | 6 | 9 | Alek96/SZR | SZR/apps/GitLabApi/tests/test_base.py | Python | FakeGitlab | FakeGitlab | 6 | 11 | 6 | 6 | ec4736ce9a6f11d6ab2b790965d0c3e72278e318 | bigcode/the-stack | train |
8268013b544b5d0e40978970 | train | class | class TestRESTManager(unittest.TestCase):
def test_instance(self):
class MGR(base.RESTManager):
_obj_cls = FakeObject
mgr = MGR(FakeGitlab())
self.assertIsInstance(mgr._rest_manager, FakeGitlab)
| class TestRESTManager(unittest.TestCase):
| def test_instance(self):
class MGR(base.RESTManager):
_obj_cls = FakeObject
mgr = MGR(FakeGitlab())
self.assertIsInstance(mgr._rest_manager, FakeGitlab)
| FakeGitlab(object):
foo = 'bar'
@property
def attributes(self):
return {'foo': 'bar'}
class FakeObject(base.RESTObject):
pass
class FakeManager(base.RESTManager):
_obj_cls = FakeObject
class TestRESTManager(unittest.TestCase):
| 64 | 64 | 56 | 8 | 55 | Alek96/SZR | SZR/apps/GitLabApi/tests/test_base.py | Python | TestRESTManager | TestRESTManager | 22 | 28 | 22 | 22 | c03237d1c7faef361614aa7d310f8ec55351bf75 | bigcode/the-stack | train |
a5dabddab9c495072b826292 | train | class | class SortOption(object):
"""
Simple object to store store options
"""
def __init__(self, field: Field, sort_order: SortOrder):
self.field = field
self.sort_order = sort_order
| class SortOption(object):
| """
Simple object to store store options
"""
def __init__(self, field: Field, sort_order: SortOrder):
self.field = field
self.sort_order = sort_order
| from enum import Enum
from typing import List, Iterable
from dp_conceptual_search.search.sort_by import SortOrder
from dp_conceptual_search.ons.search.fields import AvailableFields, Field
class SortOption(object):
| 46 | 64 | 48 | 5 | 40 | flaxandteal/dp-conceptual-search | dp_conceptual_search/ons/search/sort_fields.py | Python | SortOption | SortOption | 8 | 14 | 8 | 8 | 388e162238bc6e35412ba30c5c1e763ba5dd62d0 | bigcode/the-stack | train |
a9294b564c03a83bd94d101b | train | class | class SortField(Enum):
"""
Enum of all available sort options by key
"""
first_letter: List[SortOption] = [
SortOption(AvailableFields.TITLE_FIRST_LETTER.value, SortOrder.ASC),
SortOption(AvailableFields.TITLE_RAW.value, SortOrder.ASC),
SortOption(AvailableFields.RELEASE_DATE.val... | class SortField(Enum):
| """
Enum of all available sort options by key
"""
first_letter: List[SortOption] = [
SortOption(AvailableFields.TITLE_FIRST_LETTER.value, SortOrder.ASC),
SortOption(AvailableFields.TITLE_RAW.value, SortOrder.ASC),
SortOption(AvailableFields.RELEASE_DATE.value, SortOrder.ASC)
... | from enum import Enum
from typing import List, Iterable
from dp_conceptual_search.search.sort_by import SortOrder
from dp_conceptual_search.ons.search.fields import AvailableFields, Field
class SortOption(object):
"""
Simple object to store store options
"""
def __init__(self, field: Field, sort_orde... | 94 | 142 | 476 | 5 | 88 | flaxandteal/dp-conceptual-search | dp_conceptual_search/ons/search/sort_fields.py | Python | SortField | SortField | 17 | 79 | 17 | 17 | b535cf15760a6bbe008628736f3b1b7b5793dbdb | bigcode/the-stack | train |
49b545eb38f51031763c16f8 | train | function | def query_sort(sort_field: SortField) -> List[dict]:
s = []
option: SortOption
for option in sort_field.value:
d = {
option.field.name: {
"order": option.sort_order.value
}
}
s.append(d)
return s
| def query_sort(sort_field: SortField) -> List[dict]:
| s = []
option: SortOption
for option in sort_field.value:
d = {
option.field.name: {
"order": option.sort_order.value
}
}
s.append(d)
return s
|
:param label:
:return:
"""
if SortField.is_sort_field(label):
return SortField[label]
else:
raise NotImplementedError("No such SortField for string: '{0}'".format(label))
def query_sort(sort_field: SortField) -> List[dict]:
| 64 | 64 | 64 | 14 | 50 | flaxandteal/dp-conceptual-search | dp_conceptual_search/ons/search/sort_fields.py | Python | query_sort | query_sort | 82 | 94 | 82 | 82 | 70de6cdece3fef17bea7a8e4b1f3f5b985efb71f | bigcode/the-stack | train |
f991d0bad750ecf3d3d36186 | train | function | def run_periodic_analytics_reporter(config_file_path, logfile_path):
"""
Function for gathering, communicating and archiving various data.
arguments:
config_file_path: file path to a JSON configuration file
logfile_path: file path where logs will be stored locally
"""
#loa... | def run_periodic_analytics_reporter(config_file_path, logfile_path):
| """
Function for gathering, communicating and archiving various data.
arguments:
config_file_path: file path to a JSON configuration file
logfile_path: file path where logs will be stored locally
"""
#load configuration data from JSON file
config_file = open(config_fil... | Google Drive Archiving
Intended for finding periodic stats on service usage.
Makes API requests, compiles data into files at specified location,
uploads data and files to Google Drive, then sends email to relevant parties.
Note: requires Mediasite report to already exist and various configurations/keys
to be prov... | 194 | 194 | 649 | 15 | 178 | d33bs/lst_periodic_analytics_reporter | main.py | Python | run_periodic_analytics_reporter | run_periodic_analytics_reporter | 30 | 101 | 30 | 30 | f5c2067fdc422f6d430605bba2c0f1916a7a78ad | bigcode/the-stack | train |
78fce520cb5fcf4116eeb096 | train | function | def get_tab_from_url(url):
page = requests.get(url)
tab_soup = BeautifulSoup(page.text, 'lxml')
tab_content = tab_soup.find('div', class_="tb_ct").text
return tab_content
| def get_tab_from_url(url):
| page = requests.get(url)
tab_soup = BeautifulSoup(page.text, 'lxml')
tab_content = tab_soup.find('div', class_="tb_ct").text
return tab_content
| (1)
elif page.status_code >= 500:
print('[error] Looks like ultimate-guitar is having trouble fulfilling the request.')
print('[error] Try again in a bit or check if the site is up right now.')
sys.exit(1)
return results
def get_tab_from_url(url):
| 64 | 64 | 48 | 7 | 56 | ccabrales/TabHero | tabhero_functions.py | Python | get_tab_from_url | get_tab_from_url | 95 | 99 | 95 | 95 | edb532f9ca063cafe35e3c6269e840da20d2c2af | bigcode/the-stack | train |
33230125d7d39ac133d495d8 | train | function | def tabs_search(query):
print('Searching...\n')
results = []
ultimate_guitar = 'https://www.ultimate-guitar.com'
endpoint = ultimate_guitar + '/search.php?search_type=title&order=&value=' + query
page = requests.get(endpoint)
if page.status_code == 200:
tabs_soup = BeautifulSoup(page.text, 'lxml')
results_... | def tabs_search(query):
| print('Searching...\n')
results = []
ultimate_guitar = 'https://www.ultimate-guitar.com'
endpoint = ultimate_guitar + '/search.php?search_type=title&order=&value=' + query
page = requests.get(endpoint)
if page.status_code == 200:
tabs_soup = BeautifulSoup(page.text, 'lxml')
results_table = tabs_soup.find('... | format(self.artist, self.title)
spacer = ('-' * (len(header))).encode('utf-8')
tab = get_tab_from_url(self.url).encode('utf-8')
tab_output = '{}\n{}\n{}\n'.format(header, spacer, tab)
return tab_output
# Generates a file name for the tab as a text file
def generate_filename(self):
return '{} - {} -.txt'.f... | 145 | 145 | 486 | 5 | 139 | ccabrales/TabHero | tabhero_functions.py | Python | tabs_search | tabs_search | 37 | 93 | 37 | 37 | 138620b93d39331eca3ec77334ee152a76e4063a | bigcode/the-stack | train |
db35ca21c70957ec2a03881b | train | function | def choose_from_results(results):
for i in range(len(results)):
curr_result = results[i]
result_text = '[{}] {} - {} - {}/5 - {}'.format(i + 1, curr_result.artist, curr_result.title, curr_result.rating, curr_result.tab_type)
print(result_text)
choice = 0
while choice < 1 or choice > len(results):
try:
ch... | def choose_from_results(results):
| for i in range(len(results)):
curr_result = results[i]
result_text = '[{}] {} - {} - {}/5 - {}'.format(i + 1, curr_result.artist, curr_result.title, curr_result.rating, curr_result.tab_type)
print(result_text)
choice = 0
while choice < 1 or choice > len(results):
try:
choice = int(input('\nSelect a tab n... | .')
sys.exit(1)
return results
def get_tab_from_url(url):
page = requests.get(url)
tab_soup = BeautifulSoup(page.text, 'lxml')
tab_content = tab_soup.find('div', class_="tb_ct").text
return tab_content
def choose_from_results(results):
| 64 | 64 | 130 | 6 | 57 | ccabrales/TabHero | tabhero_functions.py | Python | choose_from_results | choose_from_results | 101 | 114 | 101 | 101 | 7640228ad99ba9050338a754aedc6c0ddb733370 | bigcode/the-stack | train |
5e92eeac1567f30900e9bcc2 | train | class | class TabResult():
def __init__(self, artist, title, tab_id, rating, tab_type, url):
self.artist = artist
self.title = title
self.tab_id = tab_id
self.rating = rating
self.tab_type = tab_type
self.url = url
# Formats the tab output for printing to terminal or writing to file
def format_tab_output(self):... | class TabResult():
| def __init__(self, artist, title, tab_id, rating, tab_type, url):
self.artist = artist
self.title = title
self.tab_id = tab_id
self.rating = rating
self.tab_type = tab_type
self.url = url
# Formats the tab output for printing to terminal or writing to file
def format_tab_output(self):
header = '{} - {... | /bin/env python
import sys
from bs4 import BeautifulSoup
import lxml
import requests
# Types that won't be considered
rejected_types = ['tab pro', 'video lesson', 'guitar pro', 'power tab']
# Class that will act as an individual tab result
class TabResult():
| 64 | 64 | 193 | 4 | 59 | ccabrales/TabHero | tabhero_functions.py | Python | TabResult | TabResult | 12 | 32 | 12 | 12 | 523bc45e09e541b2c4fbdfca1a3a16d7312c0099 | bigcode/the-stack | train |
1944467f2af2597d15721b5c | train | class | class Google(Search) :
#Conducts the main search
def conduct_search(self, query, pages) :
query = query.replace(" ", "+")
if (self.useproxy) :
super(Google, self).update_proxy(True)
if (self.verbose) :
bcolors.printBold("Conducting google search...")
... | class Google(Search) :
#Conducts the main search
| def conduct_search(self, query, pages) :
query = query.replace(" ", "+")
if (self.useproxy) :
super(Google, self).update_proxy(True)
if (self.verbose) :
bcolors.printBold("Conducting google search...")
page = 0
while (page < pages) :
# wait... | are converted to +
# query is given by ?q=query
# page is given by the index of the first search result,
# i.e. &start=20
# sample query: http://www.google.se/search?q=cp+nice&start=20
#----------------------------------------------------------#
from Search import Search
from Proxy import Proxy
import urllib.request
i... | 141 | 141 | 470 | 14 | 127 | Spectrum256/webvulns | dev/GoogleSearcher.py | Python | Google | Google | 21 | 79 | 21 | 23 | 7fb13db422e864ff557d4ed394e5b97485a83826 | bigcode/the-stack | train |
7db7b6c3c79674587dabf791 | train | class | class FPN(nn.Module):
'Feature Pyramid Network - https://arxiv.org/abs/1612.03144'
def __init__(self, features):
super().__init__()
self.stride = 128
self.features = features
is_light = features.bottleneck == vrn.BasicBlock
channels = [128, 256, 512] if is_light else [... | class FPN(nn.Module):
| 'Feature Pyramid Network - https://arxiv.org/abs/1612.03144'
def __init__(self, features):
super().__init__()
self.stride = 128
self.features = features
is_light = features.bottleneck == vrn.BasicBlock
channels = [128, 256, 512] if is_light else [512, 1024, 2048]
... | import torch.nn as nn
import torch.nn.functional as F
from torchvision.models import resnet as vrn
from .resnet import ResNet
from .utils import register
class FPN(nn.Module):
| 43 | 153 | 510 | 6 | 36 | azuredsky/retinanet-examples | retinanet/backbones/fpn.py | Python | FPN | FPN | 8 | 55 | 8 | 8 | c79bf52b4e8fc1b6eded245d564c3bb88650a64a | bigcode/the-stack | train |
fd8af547671ae8ad13d15911 | train | function | @register
def ResNet50FPN():
return FPN(ResNet(layers=[3, 4, 6, 3], bottleneck=vrn.Bottleneck, outputs=[3, 4, 5], url=vrn.model_urls['resnet50']))
| @register
def ResNet50FPN():
| return FPN(ResNet(layers=[3, 4, 6, 3], bottleneck=vrn.Bottleneck, outputs=[3, 4, 5], url=vrn.model_urls['resnet50']))
| FPN():
return FPN(ResNet(layers=[3, 4, 6, 3], bottleneck=vrn.BasicBlock, outputs=[3, 4, 5], url=vrn.model_urls['resnet34']))
@register
def ResNet50FPN():
| 63 | 64 | 61 | 10 | 53 | azuredsky/retinanet-examples | retinanet/backbones/fpn.py | Python | ResNet50FPN | ResNet50FPN | 65 | 67 | 65 | 66 | 0bd124d63477058060bed615795c7168d3f30282 | bigcode/the-stack | train |
d12eba44cff9cbc11ea1ecaa | train | function | @register
def ResNet34FPN():
return FPN(ResNet(layers=[3, 4, 6, 3], bottleneck=vrn.BasicBlock, outputs=[3, 4, 5], url=vrn.model_urls['resnet34']))
| @register
def ResNet34FPN():
| return FPN(ResNet(layers=[3, 4, 6, 3], bottleneck=vrn.BasicBlock, outputs=[3, 4, 5], url=vrn.model_urls['resnet34']))
| FPN():
return FPN(ResNet(layers=[2, 2, 2, 2], bottleneck=vrn.BasicBlock, outputs=[3, 4, 5], url=vrn.model_urls['resnet18']))
@register
def ResNet34FPN():
| 63 | 64 | 60 | 10 | 53 | azuredsky/retinanet-examples | retinanet/backbones/fpn.py | Python | ResNet34FPN | ResNet34FPN | 61 | 63 | 61 | 62 | 80cf3f17846d30ad624b207f1157d0036f314b1b | bigcode/the-stack | train |
6a5ebe5b94847f568b2a3dc1 | train | function | @register
def ResNet18FPN():
return FPN(ResNet(layers=[2, 2, 2, 2], bottleneck=vrn.BasicBlock, outputs=[3, 4, 5], url=vrn.model_urls['resnet18']))
| @register
def ResNet18FPN():
| return FPN(ResNet(layers=[2, 2, 2, 2], bottleneck=vrn.BasicBlock, outputs=[3, 4, 5], url=vrn.model_urls['resnet18']))
| (p6))
p3 = self.smooth3(p3)
p4 = self.smooth4(p4)
p5 = self.smooth5(p5)
return [p3, p4, p5, p6, p7]
@register
def ResNet18FPN():
| 64 | 64 | 60 | 10 | 54 | azuredsky/retinanet-examples | retinanet/backbones/fpn.py | Python | ResNet18FPN | ResNet18FPN | 57 | 59 | 57 | 58 | 0292f29beaaa95577182a4f64b7ef76b685b9f74 | bigcode/the-stack | train |
a6772ec1b475e03dbb5008f1 | train | function | @register
def ResNeXt101_32x8dFPN():
return FPN(ResNet(layers=[3, 4, 23, 3], bottleneck=vrn.Bottleneck, outputs=[3, 4, 5], groups=32, width_per_group=8, url=vrn.model_urls['resnext101_32x8d']))
| @register
def ResNeXt101_32x8dFPN():
| return FPN(ResNet(layers=[3, 4, 23, 3], bottleneck=vrn.Bottleneck, outputs=[3, 4, 5], groups=32, width_per_group=8, url=vrn.model_urls['resnext101_32x8d']))
| 3], bottleneck=vrn.Bottleneck, outputs=[3, 4, 5], groups=32, width_per_group=4, url=vrn.model_urls['resnext50_32x4d']))
@register
def ResNeXt101_32x8dFPN():
| 63 | 64 | 82 | 16 | 47 | azuredsky/retinanet-examples | retinanet/backbones/fpn.py | Python | ResNeXt101_32x8dFPN | ResNeXt101_32x8dFPN | 81 | 83 | 81 | 82 | 0ff305191776d2903446a1ea2627c29219d8d254 | bigcode/the-stack | train |
00e2c4b076b94642cc32eaf2 | train | function | @register
def ResNeXt50_32x4dFPN():
return FPN(ResNet(layers=[3, 4, 6, 3], bottleneck=vrn.Bottleneck, outputs=[3, 4, 5], groups=32, width_per_group=4, url=vrn.model_urls['resnext50_32x4d']))
| @register
def ResNeXt50_32x4dFPN():
| return FPN(ResNet(layers=[3, 4, 6, 3], bottleneck=vrn.Bottleneck, outputs=[3, 4, 5], groups=32, width_per_group=4, url=vrn.model_urls['resnext50_32x4d']))
| (ResNet(layers=[3, 8, 36, 3], bottleneck=vrn.Bottleneck, outputs=[3, 4, 5], url=vrn.model_urls['resnet152']))
@register
def ResNeXt50_32x4dFPN():
| 63 | 64 | 82 | 16 | 47 | azuredsky/retinanet-examples | retinanet/backbones/fpn.py | Python | ResNeXt50_32x4dFPN | ResNeXt50_32x4dFPN | 77 | 79 | 77 | 78 | daa3c93317425129a56bc11df8d56663b833ab36 | bigcode/the-stack | train |
ddc6a2ffc7919a169cae44c5 | train | function | @register
def ResNet152FPN():
return FPN(ResNet(layers=[3, 8, 36, 3], bottleneck=vrn.Bottleneck, outputs=[3, 4, 5], url=vrn.model_urls['resnet152']))
| @register
def ResNet152FPN():
| return FPN(ResNet(layers=[3, 8, 36, 3], bottleneck=vrn.Bottleneck, outputs=[3, 4, 5], url=vrn.model_urls['resnet152']))
| PN():
return FPN(ResNet(layers=[3, 4, 23, 3], bottleneck=vrn.Bottleneck, outputs=[3, 4, 5], url=vrn.model_urls['resnet101']))
@register
def ResNet152FPN():
| 63 | 64 | 61 | 10 | 53 | azuredsky/retinanet-examples | retinanet/backbones/fpn.py | Python | ResNet152FPN | ResNet152FPN | 73 | 75 | 73 | 74 | 28c21fb8355963f6e87cda5bb5ae249f2041216f | bigcode/the-stack | train |
72e7cc4dc1485b22c6512685 | train | function | @register
def ResNet101FPN():
return FPN(ResNet(layers=[3, 4, 23, 3], bottleneck=vrn.Bottleneck, outputs=[3, 4, 5], url=vrn.model_urls['resnet101']))
| @register
def ResNet101FPN():
| return FPN(ResNet(layers=[3, 4, 23, 3], bottleneck=vrn.Bottleneck, outputs=[3, 4, 5], url=vrn.model_urls['resnet101']))
| PN():
return FPN(ResNet(layers=[3, 4, 6, 3], bottleneck=vrn.Bottleneck, outputs=[3, 4, 5], url=vrn.model_urls['resnet50']))
@register
def ResNet101FPN():
| 63 | 64 | 61 | 10 | 53 | azuredsky/retinanet-examples | retinanet/backbones/fpn.py | Python | ResNet101FPN | ResNet101FPN | 69 | 71 | 69 | 70 | 97a535bca1a02d88173d6a6d7df299e9bba71e95 | bigcode/the-stack | train |
6529be88e527b522e071bb2e | train | function | def _versioned_shlib_soname(env, libnode, version, prefix, suffix):
return _versioned_lib_soname(env, libnode, version, prefix, suffix, _versioned_shlib_name)
| def _versioned_shlib_soname(env, libnode, version, prefix, suffix):
| return _versioned_lib_soname(env, libnode, version, prefix, suffix, _versioned_shlib_name)
| )
else:
soname = name + '.' + major
if Verbose:
print("_versioned_lib_soname: soname={!r}".format(soname))
return soname
def _versioned_shlib_soname(env, libnode, version, prefix, suffix):
| 64 | 64 | 47 | 20 | 43 | janem-msu/scons | SCons/Tool/link.py | Python | _versioned_shlib_soname | _versioned_shlib_soname | 189 | 190 | 189 | 189 | d38d5e6078f9fbc985688566cb5d786e5eb7387d | bigcode/the-stack | train |
b9cc38b65664ea26281c0806 | train | function | def _versioned_ldmod_symlinks(env, libnode, version, prefix, suffix):
name_func = _versioned_ldmod_name
soname_func = _versioned_ldmod_soname
name_func = env['LINKCALLBACKS']['VersionedLdModName']
soname_func = env['LINKCALLBACKS']['VersionedLdModSoname']
return _versioned_lib_symlinks(env, libnod... | def _versioned_ldmod_symlinks(env, libnode, version, prefix, suffix):
| name_func = _versioned_ldmod_name
soname_func = _versioned_ldmod_soname
name_func = env['LINKCALLBACKS']['VersionedLdModName']
soname_func = env['LINKCALLBACKS']['VersionedLdModSoname']
return _versioned_lib_symlinks(env, libnode, version, prefix, suffix, name_func, soname_func)
| ame_func = env['LINKCALLBACKS']['VersionedShLibSoname']
return _versioned_lib_symlinks(env, libnode, version, prefix, suffix, name_func, soname_func)
def _versioned_ldmod_symlinks(env, libnode, version, prefix, suffix):
| 64 | 64 | 108 | 20 | 44 | janem-msu/scons | SCons/Tool/link.py | Python | _versioned_ldmod_symlinks | _versioned_ldmod_symlinks | 251 | 258 | 251 | 251 | 4772d91b3100a0402586f6cbaa80e620adcfc059 | bigcode/the-stack | train |
2e03a1d95ff3672bdc3efe17 | train | function | def smart_link(source, target, env, for_signature):
has_cplusplus = iscplusplus(source)
has_fortran = isfortran(env, source)
has_d = isD(env, source)
if has_cplusplus and has_fortran and not has_d:
global issued_mixed_link_warning
if not issued_mixed_link_warning:
msg = "Usin... | def smart_link(source, target, env, for_signature):
| has_cplusplus = iscplusplus(source)
has_fortran = isfortran(env, source)
has_d = isD(env, source)
if has_cplusplus and has_fortran and not has_d:
global issued_mixed_link_warning
if not issued_mixed_link_warning:
msg = "Using $CXX to link Fortran and C++ code together.\n\t" +... | LibSymlinks, ShLibSymlinkGenerator, \
LdModSymlinkGenerator, ShLibPrefixGenerator, ShLibSuffixGenerator, LdModPrefixGenerator, LdModSuffixGenerator, \
LdModSonameGenerator
issued_mixed_link_warning = False
def smart_link(source, target, env, for_signature):
| 71 | 71 | 239 | 12 | 58 | janem-msu/scons | SCons/Tool/link.py | Python | smart_link | smart_link | 53 | 75 | 53 | 53 | b6036e1425076bfaa20ad9460f5993903760f70b | bigcode/the-stack | train |
71536113b5f3799cead58cb1 | train | function | def _versioned_shlib_symlinks(env, libnode, version, prefix, suffix):
name_func = env['LINKCALLBACKS']['VersionedShLibName']
soname_func = env['LINKCALLBACKS']['VersionedShLibSoname']
return _versioned_lib_symlinks(env, libnode, version, prefix, suffix, name_func, soname_func)
| def _versioned_shlib_symlinks(env, libnode, version, prefix, suffix):
| name_func = env['LINKCALLBACKS']['VersionedShLibName']
soname_func = env['LINKCALLBACKS']['VersionedShLibSoname']
return _versioned_lib_symlinks(env, libnode, version, prefix, suffix, name_func, soname_func)
| node)]
if Verbose:
print("_versioned_lib_symlinks: return symlinks={!r}".format(
StringizeLibSymlinks(symlinks)))
return symlinks
def _versioned_shlib_symlinks(env, libnode, version, prefix, suffix):
| 64 | 64 | 83 | 20 | 43 | janem-msu/scons | SCons/Tool/link.py | Python | _versioned_shlib_symlinks | _versioned_shlib_symlinks | 244 | 248 | 244 | 244 | 498b0d3bb7aa463ab7268d0dd0a3e07be2841924 | bigcode/the-stack | train |
4ed7a0c73132290e5b24ddc1 | train | function | def _versioned_ldmod_name(env, libnode, version, prefix, suffix, **kw):
prefix_generator = LdModPrefixGenerator
suffix_generator = LdModSuffixGenerator
return _versioned_lib_name(env, libnode, version, prefix, suffix, prefix_generator, suffix_generator, **kw)
| def _versioned_ldmod_name(env, libnode, version, prefix, suffix, **kw):
| prefix_generator = LdModPrefixGenerator
suffix_generator = LdModSuffixGenerator
return _versioned_lib_name(env, libnode, version, prefix, suffix, prefix_generator, suffix_generator, **kw)
| _generator = ShLibPrefixGenerator
suffix_generator = ShLibSuffixGenerator
return _versioned_lib_name(env, libnode, version, prefix, suffix, prefix_generator, suffix_generator, **kw)
def _versioned_ldmod_name(env, libnode, version, prefix, suffix, **kw):
| 64 | 64 | 68 | 21 | 43 | janem-msu/scons | SCons/Tool/link.py | Python | _versioned_ldmod_name | _versioned_ldmod_name | 149 | 152 | 149 | 149 | 9fe80a996eaa4a027602f4991bcb4e7f3c64d6b7 | bigcode/the-stack | train |
5c0bdb4583cbf8cfd769c197 | train | function | def _versioned_ldmod_soname(env, libnode, version, prefix, suffix):
return _versioned_lib_soname(env, libnode, version, prefix, suffix, _versioned_ldmod_name)
| def _versioned_ldmod_soname(env, libnode, version, prefix, suffix):
| return _versioned_lib_soname(env, libnode, version, prefix, suffix, _versioned_ldmod_name)
| ed_shlib_soname(env, libnode, version, prefix, suffix):
return _versioned_lib_soname(env, libnode, version, prefix, suffix, _versioned_shlib_name)
def _versioned_ldmod_soname(env, libnode, version, prefix, suffix):
| 64 | 64 | 47 | 20 | 44 | janem-msu/scons | SCons/Tool/link.py | Python | _versioned_ldmod_soname | _versioned_ldmod_soname | 193 | 194 | 193 | 193 | 200cc0274b4e675c6293ea9d9b79bce36b311291 | bigcode/the-stack | train |
07343231c40939a735c89cec | train | function | def _versioned_lib_callbacks():
return {
'VersionedShLibSuffix': _versioned_lib_suffix,
'VersionedLdModSuffix': _versioned_lib_suffix,
'VersionedShLibSymlinks': _versioned_shlib_symlinks,
'VersionedLdModSymlinks': _versioned_ldmod_symlinks,
'VersionedShLibName': _versioned_sh... | def _versioned_lib_callbacks():
| return {
'VersionedShLibSuffix': _versioned_lib_suffix,
'VersionedLdModSuffix': _versioned_lib_suffix,
'VersionedShLibSymlinks': _versioned_shlib_symlinks,
'VersionedLdModSymlinks': _versioned_ldmod_symlinks,
'VersionedShLibName': _versioned_shlib_name,
'VersionedLdMo... | LINKCALLBACKS']['VersionedLdModName']
soname_func = env['LINKCALLBACKS']['VersionedLdModSoname']
return _versioned_lib_symlinks(env, libnode, version, prefix, suffix, name_func, soname_func)
def _versioned_lib_callbacks():
| 64 | 64 | 146 | 7 | 57 | janem-msu/scons | SCons/Tool/link.py | Python | _versioned_lib_callbacks | _versioned_lib_callbacks | 261 | 271 | 261 | 261 | 23bf87aac6a3a07f227628e547f6d2368b113492 | bigcode/the-stack | train |
bb614d268139430c31fff7d5 | train | function | def exists(env):
# This module isn't really a Tool on its own, it's common logic for
# other linkers.
return None
| def exists(env):
# This module isn't really a Tool on its own, it's common logic for
# other linkers.
| return None
| ODULEVERSION'] = '$SHLIBVERSION'
env['LDMODULENOVERSIONSYMLINKS'] = '$SHLIBNOVERSIONSYMLINKS'
def exists(env):
# This module isn't really a Tool on its own, it's common logic for
# other linkers.
| 64 | 64 | 31 | 27 | 37 | janem-msu/scons | SCons/Tool/link.py | Python | exists | exists | 359 | 362 | 359 | 361 | f5217e3df6bba82ba7f223b322618a91869068b3 | bigcode/the-stack | train |
5797995a9b8b7e22f644d494 | train | function | def generate(env):
"""Add Builders and construction variables for gnulink to an Environment."""
SCons.Tool.createSharedLibBuilder(env)
SCons.Tool.createProgBuilder(env)
env['SHLINK'] = '$LINK'
env['SHLINKFLAGS'] = SCons.Util.CLVar('$LINKFLAGS -shared')
env['SHLINKCOM'] = '$SHLINK -o $TARGET $SH... | def generate(env):
| """Add Builders and construction variables for gnulink to an Environment."""
SCons.Tool.createSharedLibBuilder(env)
SCons.Tool.createProgBuilder(env)
env['SHLINK'] = '$LINK'
env['SHLINKFLAGS'] = SCons.Util.CLVar('$LINKFLAGS -shared')
env['SHLINKCOM'] = '$SHLINK -o $TARGET $SHLINKFLAGS $__SHLIBV... | '] = '$LDMODULEVERSIONFLAGS -Wl,-soname=$_LDMODULESONAME'
env['_SHLIBSONAME'] = '${ShLibSonameGenerator(__env__,TARGET)}'
env['_LDMODULESONAME'] = '${LdModSonameGenerator(__env__,TARGET)}'
env['ShLibSonameGenerator'] = ShLibSonameGenerator
env['LdModSonameGenerator'] = LdModSonameGenerat... | 170 | 170 | 568 | 4 | 166 | janem-msu/scons | SCons/Tool/link.py | Python | generate | generate | 314 | 356 | 314 | 314 | 1e996316046e746121f4b22a90bb559e2850a400 | bigcode/the-stack | train |
a60732db780df83f063e1b60 | train | function | def _lib_emitter(target, source, env, **kw):
Verbose = False
if Verbose:
print("_lib_emitter: target[0]={!r}".format(target[0].get_path()))
for tgt in target:
if SCons.Util.is_String(tgt):
tgt = env.File(tgt)
tgt.attributes.shared = 1
try:
symlink_generator =... | def _lib_emitter(target, source, env, **kw):
| Verbose = False
if Verbose:
print("_lib_emitter: target[0]={!r}".format(target[0].get_path()))
for tgt in target:
if SCons.Util.is_String(tgt):
tgt = env.File(tgt)
tgt.attributes.shared = 1
try:
symlink_generator = kw['symlink_generator']
except KeyError:... | ']
env['SHLINKCOM'] = env['SHDLINKCOM']
return '$DC'
elif has_fortran:
return '$FORTRAN'
elif has_cplusplus:
return '$CXX'
return '$CC'
def _lib_emitter(target, source, env, **kw):
| 64 | 64 | 209 | 14 | 50 | janem-msu/scons | SCons/Tool/link.py | Python | _lib_emitter | _lib_emitter | 78 | 101 | 78 | 78 | 93ca0673b6aa3b346997734a3f74843dbc5bb3b7 | bigcode/the-stack | train |
3f5691073978e90cbb89c470 | train | function | def _versioned_lib_soname(env, libnode, version, prefix, suffix, name_func):
"""For libnode='/optional/dir/libfoo.so.X.Y.Z' it returns 'libfoo.so.X'"""
Verbose = False
if Verbose:
print("_versioned_lib_soname: version={!r}".format(version))
name = name_func(env, libnode, version, prefix, suffix)... | def _versioned_lib_soname(env, libnode, version, prefix, suffix, name_func):
| """For libnode='/optional/dir/libfoo.so.X.Y.Z' it returns 'libfoo.so.X'"""
Verbose = False
if Verbose:
print("_versioned_lib_soname: version={!r}".format(version))
name = name_func(env, libnode, version, prefix, suffix)
if Verbose:
print("_versioned_lib_soname: name={!r}".format(name... | if not suffix.endswith(version):
suffix = suffix + '.' + version
if Verbose:
print("_versioned_lib_suffix: return suffix={!r}".format(suffix))
return suffix
def _versioned_lib_soname(env, libnode, version, prefix, suffix, name_func):
| 64 | 64 | 211 | 22 | 41 | janem-msu/scons | SCons/Tool/link.py | Python | _versioned_lib_soname | _versioned_lib_soname | 168 | 186 | 168 | 168 | 65cb6460e4c9847e280bccb93fff01688e8eae3a | bigcode/the-stack | train |
a6e3eb1eaf06491350493d4b | train | function | def _versioned_lib_symlinks(env, libnode, version, prefix, suffix, name_func, soname_func):
"""Generate link names that should be created for a versioned shared library.
Returns a dictionary in the form { linkname : linktarget }
"""
Verbose = False
if Verbose:
print("_versioned_lib_symli... | def _versioned_lib_symlinks(env, libnode, version, prefix, suffix, name_func, soname_func):
| """Generate link names that should be created for a versioned shared library.
Returns a dictionary in the form { linkname : linktarget }
"""
Verbose = False
if Verbose:
print("_versioned_lib_symlinks: libnode={!r}".format(libnode.get_path()))
print("_versioned_lib_symlinks: versi... | ame: soname={!r}".format(soname))
return soname
def _versioned_shlib_soname(env, libnode, version, prefix, suffix):
return _versioned_lib_soname(env, libnode, version, prefix, suffix, _versioned_shlib_name)
def _versioned_ldmod_soname(env, libnode, version, prefix, suffix):
return _versioned_lib_soname(... | 137 | 137 | 458 | 26 | 111 | janem-msu/scons | SCons/Tool/link.py | Python | _versioned_lib_symlinks | _versioned_lib_symlinks | 197 | 241 | 197 | 197 | 51008503dfeb148043b0e32a2643aab11c7f9b17 | bigcode/the-stack | train |
dc6ee20be183596b2f2edf5a | train | function | def ldmod_emitter(target, source, env):
return _lib_emitter(target, source, env, symlink_generator=LdModSymlinkGenerator)
| def ldmod_emitter(target, source, env):
| return _lib_emitter(target, source, env, symlink_generator=LdModSymlinkGenerator)
| target[0].attributes.shliblinks = symlinks
return (target, source)
def shlib_emitter(target, source, env):
return _lib_emitter(target, source, env, symlink_generator=ShLibSymlinkGenerator)
def ldmod_emitter(target, source, env):
| 64 | 64 | 33 | 11 | 53 | janem-msu/scons | SCons/Tool/link.py | Python | ldmod_emitter | ldmod_emitter | 108 | 109 | 108 | 108 | 6f3dcdd87c634888e434b1076f19f45667411b2b | bigcode/the-stack | train |
fb3440ca567944b0ba389795 | train | function | def _versioned_lib_suffix(env, suffix, version):
"""For suffix='.so' and version='0.1.2' it returns '.so.0.1.2'"""
Verbose = False
if Verbose:
print("_versioned_lib_suffix: suffix={!r}".format(suffix))
print("_versioned_lib_suffix: version={!r}".format(version))
if not suffix.endswith(ve... | def _versioned_lib_suffix(env, suffix, version):
| """For suffix='.so' and version='0.1.2' it returns '.so.0.1.2'"""
Verbose = False
if Verbose:
print("_versioned_lib_suffix: suffix={!r}".format(suffix))
print("_versioned_lib_suffix: version={!r}".format(version))
if not suffix.endswith(version):
suffix = suffix + '.' + version
... | suffix, **kw):
prefix_generator = LdModPrefixGenerator
suffix_generator = LdModSuffixGenerator
return _versioned_lib_name(env, libnode, version, prefix, suffix, prefix_generator, suffix_generator, **kw)
def _versioned_lib_suffix(env, suffix, version):
| 64 | 64 | 124 | 12 | 52 | janem-msu/scons | SCons/Tool/link.py | Python | _versioned_lib_suffix | _versioned_lib_suffix | 155 | 165 | 155 | 155 | 774b067d77d24b18bbf392376e5f512ff029b03f | bigcode/the-stack | train |
7b0b388af29966a1731d0684 | train | function | def _versioned_lib_name(env, libnode, version, prefix, suffix, prefix_generator, suffix_generator, **kw):
"""For libnode='/optional/dir/libfoo.so.X.Y.Z' it returns 'libfoo.so'"""
Verbose = False
if Verbose:
print("_versioned_lib_name: libnode={!r}".format(libnode.get_path()))
print("_versio... | def _versioned_lib_name(env, libnode, version, prefix, suffix, prefix_generator, suffix_generator, **kw):
| """For libnode='/optional/dir/libfoo.so.X.Y.Z' it returns 'libfoo.so'"""
Verbose = False
if Verbose:
print("_versioned_lib_name: libnode={!r}".format(libnode.get_path()))
print("_versioned_lib_name: version={!r}".format(version))
print("_versioned_lib_name: prefix={!r}".format(prefi... | _emitter(target, source, env):
return _lib_emitter(target, source, env, symlink_generator=ShLibSymlinkGenerator)
def ldmod_emitter(target, source, env):
return _lib_emitter(target, source, env, symlink_generator=LdModSymlinkGenerator)
# This is generic enough to be included here...
def _versioned_lib_name(e... | 99 | 99 | 332 | 26 | 73 | janem-msu/scons | SCons/Tool/link.py | Python | _versioned_lib_name | _versioned_lib_name | 113 | 140 | 113 | 113 | dcd872a4b80ea711f1d028c326921e70fbbe24f8 | bigcode/the-stack | train |
25c24a38cc11ce7ad3c8a984 | train | function | def shlib_emitter(target, source, env):
return _lib_emitter(target, source, env, symlink_generator=ShLibSymlinkGenerator)
| def shlib_emitter(target, source, env):
| return _lib_emitter(target, source, env, symlink_generator=ShLibSymlinkGenerator)
| inks={!r}".format(symlinks))
if symlinks:
EmitLibSymlinks(env, symlinks, target[0])
target[0].attributes.shliblinks = symlinks
return (target, source)
def shlib_emitter(target, source, env):
| 64 | 64 | 33 | 11 | 53 | janem-msu/scons | SCons/Tool/link.py | Python | shlib_emitter | shlib_emitter | 104 | 105 | 104 | 104 | 228aaa2fc1eb17202aacfd90ed45429ca210579f | bigcode/the-stack | train |
6310d6dc2cff7a84a3ff6826 | train | function | def _setup_versioned_lib_variables(env, **kw):
"""
Setup all variables required by the versioning machinery
"""
tool = None
try:
tool = kw['tool']
except KeyError:
pass
use_soname = False
try:
use_soname = kw['use_soname']
except KeyError:
pass
... | def _setup_versioned_lib_variables(env, **kw):
| """
Setup all variables required by the versioning machinery
"""
tool = None
try:
tool = kw['tool']
except KeyError:
pass
use_soname = False
try:
use_soname = kw['use_soname']
except KeyError:
pass
# The $_SHLIBVERSIONFLAGS define extra commandl... | versioned_lib_suffix,
'VersionedShLibSymlinks': _versioned_shlib_symlinks,
'VersionedLdModSymlinks': _versioned_ldmod_symlinks,
'VersionedShLibName': _versioned_shlib_name,
'VersionedLdModName': _versioned_ldmod_name,
'VersionedShLibSoname': _versioned_shlib_soname,
'Vers... | 125 | 125 | 418 | 12 | 113 | janem-msu/scons | SCons/Tool/link.py | Python | _setup_versioned_lib_variables | _setup_versioned_lib_variables | 274 | 311 | 274 | 274 | a1d3959b0136c72a2e3499007a3160ee90047c17 | bigcode/the-stack | train |
bcf0fa7950a3cc87db1f33b3 | train | function | def _versioned_shlib_name(env, libnode, version, prefix, suffix, **kw):
prefix_generator = ShLibPrefixGenerator
suffix_generator = ShLibSuffixGenerator
return _versioned_lib_name(env, libnode, version, prefix, suffix, prefix_generator, suffix_generator, **kw)
| def _versioned_shlib_name(env, libnode, version, prefix, suffix, **kw):
| prefix_generator = ShLibPrefixGenerator
suffix_generator = ShLibSuffixGenerator
return _versioned_lib_name(env, libnode, version, prefix, suffix, prefix_generator, suffix_generator, **kw)
| , versioned_name)
name = re.sub(versioned_suffix_re, suffix, name)
if Verbose:
print("_versioned_lib_name: name={!r}".format(name))
return name
def _versioned_shlib_name(env, libnode, version, prefix, suffix, **kw):
| 64 | 64 | 66 | 21 | 42 | janem-msu/scons | SCons/Tool/link.py | Python | _versioned_shlib_name | _versioned_shlib_name | 143 | 146 | 143 | 143 | 54cb6402629670a79400e915ff07cf45fb1883ad | bigcode/the-stack | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.