hexsha stringlengths 40 40 | repo stringlengths 7 114 | path stringlengths 4 124 | license listlengths 1 9 | language stringclasses 1
value | identifier stringlengths 1 71 | return_type stringlengths 1 749 ⌀ | original_string stringlengths 76 22.7k | original_docstring stringlengths 16 7.61k | docstring stringlengths 16 2.47k | docstring_tokens listlengths 6 477 | code stringlengths 14 10.2k | code_tokens listlengths 6 996 | short_docstring stringlengths 2 644 | short_docstring_tokens listlengths 1 116 | comment listlengths 1 89 | parameters listlengths 0 64 | docstring_params dict |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
2f2885041a850e932a78ebdc5bbc7513f3b6ae18 | DzimbaS/NBSDynamics | src/core/hydrodynamics/transect.py | [
"MIT"
] | Python | initiate | null | def initiate(self):
"""
Initialize the working model.
In this case, read the spatial configuration and the forcings
from files. Set the computing environment.
"""
csv: np.ndarray = np.genfromtxt(self.config_file, delimiter=",", skip_header=1)
self.x_coordinates = ... |
Initialize the working model.
In this case, read the spatial configuration and the forcings
from files. Set the computing environment.
| Initialize the working model.
In this case, read the spatial configuration and the forcings
from files. Set the computing environment. | [
"Initialize",
"the",
"working",
"model",
".",
"In",
"this",
"case",
"read",
"the",
"spatial",
"configuration",
"and",
"the",
"forcings",
"from",
"files",
".",
"Set",
"the",
"computing",
"environment",
"."
] | def initiate(self):
csv: np.ndarray = np.genfromtxt(self.config_file, delimiter=",", skip_header=1)
self.x_coordinates = csv[:, 0]
self.y_coordinates = csv[:, 1]
self.water_depth = csv[:, 2]
self.outpoint = csv[:, 3] == 1
forcings: np.ndarray = np.genfromtxt(
... | [
"def",
"initiate",
"(",
"self",
")",
":",
"csv",
":",
"np",
".",
"ndarray",
"=",
"np",
".",
"genfromtxt",
"(",
"self",
".",
"config_file",
",",
"delimiter",
"=",
"\",\"",
",",
"skip_header",
"=",
"1",
")",
"self",
".",
"x_coordinates",
"=",
"csv",
"[... | Initialize the working model. | [
"Initialize",
"the",
"working",
"model",
"."
] | [
"\"\"\"\n Initialize the working model.\n In this case, read the spatial configuration and the forcings\n from files. Set the computing environment.\n \"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
2f2885041a850e932a78ebdc5bbc7513f3b6ae18 | DzimbaS/NBSDynamics | src/core/hydrodynamics/transect.py | [
"MIT"
] | Python | update | <not_specific> | def update(self, coral, stormcat=0):
"""
Update the model, which is just knowing the waves
Args:
coral (Coral): Coral morphology to use.
stormcat (int, optional): Storm category. Defaults to 0.
Raises:
ValueError: When stormcat not in [0,3] range.
... |
Update the model, which is just knowing the waves
Args:
coral (Coral): Coral morphology to use.
stormcat (int, optional): Storm category. Defaults to 0.
Raises:
ValueError: When stormcat not in [0,3] range.
Returns:
Tuple: Tuple contain... | Update the model, which is just knowing the waves | [
"Update",
"the",
"model",
"which",
"is",
"just",
"knowing",
"the",
"waves"
] | def update(self, coral, stormcat=0):
mean_current_vel = 0
if stormcat in [0, 1, 2, 3]:
Hs = self.wave_height[stormcat]
T = self.wave_period[stormcat]
max_current_vel = self.max_curr_vel[stormcat]
h = self.water_depth
wave_vel = (
... | [
"def",
"update",
"(",
"self",
",",
"coral",
",",
"stormcat",
"=",
"0",
")",
":",
"mean_current_vel",
"=",
"0",
"if",
"stormcat",
"in",
"[",
"0",
",",
"1",
",",
"2",
",",
"3",
"]",
":",
"Hs",
"=",
"self",
".",
"wave_height",
"[",
"stormcat",
"]",
... | Update the model, which is just knowing the waves | [
"Update",
"the",
"model",
"which",
"is",
"just",
"knowing",
"the",
"waves"
] | [
"\"\"\"\n Update the model, which is just knowing the waves\n\n Args:\n coral (Coral): Coral morphology to use.\n stormcat (int, optional): Storm category. Defaults to 0.\n\n Raises:\n ValueError: When stormcat not in [0,3] range.\n\n Returns:\n ... | [
{
"param": "self",
"type": null
},
{
"param": "coral",
"type": null
},
{
"param": "stormcat",
"type": null
}
] | {
"returns": [
{
"docstring": "Tuple containing calculated current velocity, wave velocity and wave period.",
"docstring_tokens": [
"Tuple",
"containing",
"calculated",
"current",
"velocity",
"wave",
"velocity",
"and",
"wave",
... |
bc0b02d5fbe2b635e4a50b1b85575e58d8743c1f | DzimbaS/NBSDynamics | src/core/output/output_protocol.py | [
"MIT"
] | Python | output_params | ModelParameters | def output_params(self) -> ModelParameters:
"""
The output parameters needed to interact with the netcdf dataset.
Raises:
NotImplementedError: When the model does not implement its own definition.
Returns:
ModelParameters: Object with netcdf parameters as attrs.... |
The output parameters needed to interact with the netcdf dataset.
Raises:
NotImplementedError: When the model does not implement its own definition.
Returns:
ModelParameters: Object with netcdf parameters as attrs..
| The output parameters needed to interact with the netcdf dataset. | [
"The",
"output",
"parameters",
"needed",
"to",
"interact",
"with",
"the",
"netcdf",
"dataset",
"."
] | def output_params(self) -> ModelParameters:
raise NotImplementedError | [
"def",
"output_params",
"(",
"self",
")",
"->",
"ModelParameters",
":",
"raise",
"NotImplementedError"
] | The output parameters needed to interact with the netcdf dataset. | [
"The",
"output",
"parameters",
"needed",
"to",
"interact",
"with",
"the",
"netcdf",
"dataset",
"."
] | [
"\"\"\"\n The output parameters needed to interact with the netcdf dataset.\n\n Raises:\n NotImplementedError: When the model does not implement its own definition.\n\n Returns:\n ModelParameters: Object with netcdf parameters as attrs..\n \"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [
{
"docstring": "Object with netcdf parameters as attrs",
"docstring_tokens": [
"Object",
"with",
"netcdf",
"parameters",
"as",
"attrs"
],
"type": "ModelParameters"
}
],
"raises": [
{
"docstring": "When the mod... |
bc0b02d5fbe2b635e4a50b1b85575e58d8743c1f | DzimbaS/NBSDynamics | src/core/output/output_protocol.py | [
"MIT"
] | Python | output_filename | str | def output_filename(self) -> str:
"""
The basename with extension the output file will have.
Raises:
NotImplementedError: When the model does not implement its own definition.
Returns:
str: Output filename.
"""
raise NotImplementedError |
The basename with extension the output file will have.
Raises:
NotImplementedError: When the model does not implement its own definition.
Returns:
str: Output filename.
| The basename with extension the output file will have. | [
"The",
"basename",
"with",
"extension",
"the",
"output",
"file",
"will",
"have",
"."
] | def output_filename(self) -> str:
raise NotImplementedError | [
"def",
"output_filename",
"(",
"self",
")",
"->",
"str",
":",
"raise",
"NotImplementedError"
] | The basename with extension the output file will have. | [
"The",
"basename",
"with",
"extension",
"the",
"output",
"file",
"will",
"have",
"."
] | [
"\"\"\"\n The basename with extension the output file will have.\n\n Raises:\n NotImplementedError: When the model does not implement its own definition.\n\n Returns:\n str: Output filename.\n \"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [
{
"docstring": null,
"docstring_tokens": [
"None"
],
"type": "str"
}
],
"raises": [
{
"docstring": "When the model does not implement its own definition.",
"docstring_tokens": [
"When",
"the",
"model",
"does",
... |
bc0b02d5fbe2b635e4a50b1b85575e58d8743c1f | DzimbaS/NBSDynamics | src/core/output/output_protocol.py | [
"MIT"
] | Python | output_filepath | Path | def output_filepath(self) -> Path:
"""
The full path to the output file.
Raises:
NotImplementedError: When the model does not implement its own definition.
Returns:
Path: Output filepath.
"""
raise NotImplementedError |
The full path to the output file.
Raises:
NotImplementedError: When the model does not implement its own definition.
Returns:
Path: Output filepath.
| The full path to the output file. | [
"The",
"full",
"path",
"to",
"the",
"output",
"file",
"."
] | def output_filepath(self) -> Path:
raise NotImplementedError | [
"def",
"output_filepath",
"(",
"self",
")",
"->",
"Path",
":",
"raise",
"NotImplementedError"
] | The full path to the output file. | [
"The",
"full",
"path",
"to",
"the",
"output",
"file",
"."
] | [
"\"\"\"\n The full path to the output file.\n\n Raises:\n NotImplementedError: When the model does not implement its own definition.\n\n Returns:\n Path: Output filepath.\n \"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [
{
"docstring": null,
"docstring_tokens": [
"None"
],
"type": "Path"
}
],
"raises": [
{
"docstring": "When the model does not implement its own definition.",
"docstring_tokens": [
"When",
"the",
"model",
"does",
... |
bc0b02d5fbe2b635e4a50b1b85575e58d8743c1f | DzimbaS/NBSDynamics | src/core/output/output_protocol.py | [
"MIT"
] | Python | initialize | null | def initialize(self, coral: Coral):
"""
Initializes an output model with the given coral input.
Args:
coral (Coral): Coral input model.
Raises:
NotImplementedError: When the model does not implement its own definition.
"""
raise NotImplementedErr... |
Initializes an output model with the given coral input.
Args:
coral (Coral): Coral input model.
Raises:
NotImplementedError: When the model does not implement its own definition.
| Initializes an output model with the given coral input. | [
"Initializes",
"an",
"output",
"model",
"with",
"the",
"given",
"coral",
"input",
"."
] | def initialize(self, coral: Coral):
raise NotImplementedError | [
"def",
"initialize",
"(",
"self",
",",
"coral",
":",
"Coral",
")",
":",
"raise",
"NotImplementedError"
] | Initializes an output model with the given coral input. | [
"Initializes",
"an",
"output",
"model",
"with",
"the",
"given",
"coral",
"input",
"."
] | [
"\"\"\"\n Initializes an output model with the given coral input.\n\n Args:\n coral (Coral): Coral input model.\n\n Raises:\n NotImplementedError: When the model does not implement its own definition.\n \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "coral",
"type": "Coral"
}
] | {
"returns": [],
"raises": [
{
"docstring": "When the model does not implement its own definition.",
"docstring_tokens": [
"When",
"the",
"model",
"does",
"not",
"implement",
"its",
"own",
"definition",
"."
],
... |
bc0b02d5fbe2b635e4a50b1b85575e58d8743c1f | DzimbaS/NBSDynamics | src/core/output/output_protocol.py | [
"MIT"
] | Python | update | null | def update(self, coral: Coral, year: int):
"""
Updates the output model with the given coral and year.
Args:
coral (Coral): Coral input model.
year (int): Current calculation year.
Raises:
NotImplementedError: When the model does not implement its ow... |
Updates the output model with the given coral and year.
Args:
coral (Coral): Coral input model.
year (int): Current calculation year.
Raises:
NotImplementedError: When the model does not implement its own definition.
| Updates the output model with the given coral and year. | [
"Updates",
"the",
"output",
"model",
"with",
"the",
"given",
"coral",
"and",
"year",
"."
] | def update(self, coral: Coral, year: int):
raise NotImplementedError | [
"def",
"update",
"(",
"self",
",",
"coral",
":",
"Coral",
",",
"year",
":",
"int",
")",
":",
"raise",
"NotImplementedError"
] | Updates the output model with the given coral and year. | [
"Updates",
"the",
"output",
"model",
"with",
"the",
"given",
"coral",
"and",
"year",
"."
] | [
"\"\"\"\n Updates the output model with the given coral and year.\n\n Args:\n coral (Coral): Coral input model.\n year (int): Current calculation year.\n\n Raises:\n NotImplementedError: When the model does not implement its own definition.\n \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "coral",
"type": "Coral"
},
{
"param": "year",
"type": "int"
}
] | {
"returns": [],
"raises": [
{
"docstring": "When the model does not implement its own definition.",
"docstring_tokens": [
"When",
"the",
"model",
"does",
"not",
"implement",
"its",
"own",
"definition",
"."
],
... |
e5eccaa6fee97dcd9497c354015afbbe3a757f27 | DzimbaS/NBSDynamics | src/core/hydrodynamics/factory.py | [
"MIT"
] | Python | create | HydrodynamicProtocol | def create(model_name: str, *args, **kwargs) -> HydrodynamicProtocol:
"""
Creates a `HydrodynamicProtocol` based on the model_name type and the dictionary of
values (if any) given.
Args:
model_name (str): Model type name.
Returns:
HydrodynamicProtocol: I... |
Creates a `HydrodynamicProtocol` based on the model_name type and the dictionary of
values (if any) given.
Args:
model_name (str): Model type name.
Returns:
HydrodynamicProtocol: Instance of the requested model.
| Creates a `HydrodynamicProtocol` based on the model_name type and the dictionary of
values (if any) given. | [
"Creates",
"a",
"`",
"HydrodynamicProtocol",
"`",
"based",
"on",
"the",
"model_name",
"type",
"and",
"the",
"dictionary",
"of",
"values",
"(",
"if",
"any",
")",
"given",
"."
] | def create(model_name: str, *args, **kwargs) -> HydrodynamicProtocol:
m_type: HydrodynamicProtocol = HydrodynamicsFactory.get_hydrodynamic_model_type(
model_name
)
return m_type(**kwargs) | [
"def",
"create",
"(",
"model_name",
":",
"str",
",",
"*",
"args",
",",
"**",
"kwargs",
")",
"->",
"HydrodynamicProtocol",
":",
"m_type",
":",
"HydrodynamicProtocol",
"=",
"HydrodynamicsFactory",
".",
"get_hydrodynamic_model_type",
"(",
"model_name",
")",
"return",... | Creates a `HydrodynamicProtocol` based on the model_name type and the dictionary of
values (if any) given. | [
"Creates",
"a",
"`",
"HydrodynamicProtocol",
"`",
"based",
"on",
"the",
"model_name",
"type",
"and",
"the",
"dictionary",
"of",
"values",
"(",
"if",
"any",
")",
"given",
"."
] | [
"\"\"\"\n Creates a `HydrodynamicProtocol` based on the model_name type and the dictionary of\n values (if any) given.\n\n Args:\n model_name (str): Model type name.\n\n Returns:\n HydrodynamicProtocol: Instance of the requested model.\n \"\"\""
] | [
{
"param": "model_name",
"type": "str"
}
] | {
"returns": [
{
"docstring": "Instance of the requested model.",
"docstring_tokens": [
"Instance",
"of",
"the",
"requested",
"model",
"."
],
"type": "HydrodynamicProtocol"
}
],
"raises": [],
"params": [
{
"identifier": "m... |
383406e459365677062566ec2f35c7cf6cb4cb5b | DzimbaS/NBSDynamics | src/core/simulation/base_simulation.py | [
"MIT"
] | Python | validate_constants | Constants | def validate_constants(cls, field_value: Union[str, Path, Constants]) -> Constants:
"""
Validates the user-input constants value and transforms in case it's a filepath (str, Path).
Args:
field_value (Union[str, Path, Constants]): Value given by the user representing Constants.
... |
Validates the user-input constants value and transforms in case it's a filepath (str, Path).
Args:
field_value (Union[str, Path, Constants]): Value given by the user representing Constants.
Raises:
NotImplementedError: When the input value does not have any converter.
... | Validates the user-input constants value and transforms in case it's a filepath (str, Path). | [
"Validates",
"the",
"user",
"-",
"input",
"constants",
"value",
"and",
"transforms",
"in",
"case",
"it",
"'",
"s",
"a",
"filepath",
"(",
"str",
"Path",
")",
"."
] | def validate_constants(cls, field_value: Union[str, Path, Constants]) -> Constants:
if isinstance(field_value, Constants):
return field_value
if isinstance(field_value, str):
field_value = Path(field_value)
if isinstance(field_value, Path):
return Constants.fr... | [
"def",
"validate_constants",
"(",
"cls",
",",
"field_value",
":",
"Union",
"[",
"str",
",",
"Path",
",",
"Constants",
"]",
")",
"->",
"Constants",
":",
"if",
"isinstance",
"(",
"field_value",
",",
"Constants",
")",
":",
"return",
"field_value",
"if",
"isin... | Validates the user-input constants value and transforms in case it's a filepath (str, Path). | [
"Validates",
"the",
"user",
"-",
"input",
"constants",
"value",
"and",
"transforms",
"in",
"case",
"it",
"'",
"s",
"a",
"filepath",
"(",
"str",
"Path",
")",
"."
] | [
"\"\"\"\n Validates the user-input constants value and transforms in case it's a filepath (str, Path).\n\n Args:\n field_value (Union[str, Path, Constants]): Value given by the user representing Constants.\n\n Raises:\n NotImplementedError: When the input value does not ha... | [
{
"param": "cls",
"type": null
},
{
"param": "field_value",
"type": "Union[str, Path, Constants]"
}
] | {
"returns": [
{
"docstring": "Validated constants value.",
"docstring_tokens": [
"Validated",
"constants",
"value",
"."
],
"type": "Constants"
}
],
"raises": [
{
"docstring": "When the input value does not have any converter.",
"docs... |
383406e459365677062566ec2f35c7cf6cb4cb5b | DzimbaS/NBSDynamics | src/core/simulation/base_simulation.py | [
"MIT"
] | Python | initiate | Coral | def initiate(
self,
x_range: Optional[tuple] = None,
y_range: Optional[tuple] = None,
value: Optional[float] = None,
) -> Coral:
"""Initiate the coral distribution. The default coral distribution is a full coral cover over the whole domain.
More complex initial condit... | Initiate the coral distribution. The default coral distribution is a full coral cover over the whole domain.
More complex initial conditions of the coral cover cannot be realised with this method. See the documentation on
workarounds to achieve this anyway.
:param x_range: minimum and maximum x... | Initiate the coral distribution. The default coral distribution is a full coral cover over the whole domain.
More complex initial conditions of the coral cover cannot be realised with this method. See the documentation on
workarounds to achieve this anyway. | [
"Initiate",
"the",
"coral",
"distribution",
".",
"The",
"default",
"coral",
"distribution",
"is",
"a",
"full",
"coral",
"cover",
"over",
"the",
"whole",
"domain",
".",
"More",
"complex",
"initial",
"conditions",
"of",
"the",
"coral",
"cover",
"cannot",
"be",
... | def initiate(
self,
x_range: Optional[tuple] = None,
y_range: Optional[tuple] = None,
value: Optional[float] = None,
) -> Coral:
self.configure_hydrodynamics()
self.configure_output()
self.validate_simulation_directories()
self.validate_environment()
... | [
"def",
"initiate",
"(",
"self",
",",
"x_range",
":",
"Optional",
"[",
"tuple",
"]",
"=",
"None",
",",
"y_range",
":",
"Optional",
"[",
"tuple",
"]",
"=",
"None",
",",
"value",
":",
"Optional",
"[",
"float",
"]",
"=",
"None",
",",
")",
"->",
"Coral"... | Initiate the coral distribution. | [
"Initiate",
"the",
"coral",
"distribution",
"."
] | [
"\"\"\"Initiate the coral distribution. The default coral distribution is a full coral cover over the whole domain.\n More complex initial conditions of the coral cover cannot be realised with this method. See the documentation on\n workarounds to achieve this anyway.\n\n :param x_range: minimu... | [
{
"param": "self",
"type": null
},
{
"param": "x_range",
"type": "Optional[tuple]"
},
{
"param": "y_range",
"type": "Optional[tuple]"
},
{
"param": "value",
"type": "Optional[float]"
}
] | {
"returns": [
{
"docstring": "coral animal initiated",
"docstring_tokens": [
"coral",
"animal",
"initiated"
],
"type": "Coral"
}
],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_t... |
0189d4a636e1b83615ebd38e7f2a10c0fd840f6b | Max-Zhenzhera/my_vocab_backend | tests/test_api/base/post_route.py | [
"MIT"
] | Python | request_json | dict | def request_json(self) -> dict:
"""
The API route JSON (sent in request body) for successful response.
Abstract *class* attribute:
request_json: ClassVar[dict] = PydanticModel.dict()
""" |
The API route JSON (sent in request body) for successful response.
Abstract *class* attribute:
request_json: ClassVar[dict] = PydanticModel.dict()
| The API route JSON (sent in request body) for successful response. | [
"The",
"API",
"route",
"JSON",
"(",
"sent",
"in",
"request",
"body",
")",
"for",
"successful",
"response",
"."
] | def request_json(self) -> dict: | [
"def",
"request_json",
"(",
"self",
")",
"->",
"dict",
":"
] | The API route JSON (sent in request body) for successful response. | [
"The",
"API",
"route",
"JSON",
"(",
"sent",
"in",
"request",
"body",
")",
"for",
"successful",
"response",
"."
] | [
"\"\"\"\n The API route JSON (sent in request body) for successful response.\n\n Abstract *class* attribute:\n request_json: ClassVar[dict] = PydanticModel.dict()\n \"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
6a4a4d4e645be60e57812ff49bc06a1b740800ba | Max-Zhenzhera/my_vocab_backend | app/api/routes/endpoints/authentication.py | [
"MIT"
] | Python | create | User | async def create(
user_in_create: UserInCreate,
user_account_service: UserAccountService = Depends()
) -> User:
"""
Create a user by the given credentials.
Route just creates a user in db. Mostly aims at the test fixtures or manual testing.
Arguments
---------
< UserInCreate... |
Create a user by the given credentials.
Route just creates a user in db. Mostly aims at the test fixtures or manual testing.
Arguments
---------
< UserInCreate > model
Return
---------
* Body
< AuthenticationResult > model
Raise
---------
* 400 BAD... | Create a user by the given credentials.
Route just creates a user in db. Mostly aims at the test fixtures or manual testing.
Arguments
< UserInCreate > model
Return
Body
< AuthenticationResult > model
Raise
400 BAD REQUEST
The given credentials are invalid or (most likely) already used before. | [
"Create",
"a",
"user",
"by",
"the",
"given",
"credentials",
".",
"Route",
"just",
"creates",
"a",
"user",
"in",
"db",
".",
"Mostly",
"aims",
"at",
"the",
"test",
"fixtures",
"or",
"manual",
"testing",
".",
"Arguments",
"<",
"UserInCreate",
">",
"model",
... | async def create(
user_in_create: UserInCreate,
user_account_service: UserAccountService = Depends()
) -> User:
try:
user = await user_account_service.register_user(user_in_create)
except RegistrationError as error:
raise HTTPException(HTTP_400_BAD_REQUEST, error.detail)
else... | [
"async",
"def",
"create",
"(",
"user_in_create",
":",
"UserInCreate",
",",
"user_account_service",
":",
"UserAccountService",
"=",
"Depends",
"(",
")",
")",
"->",
"User",
":",
"try",
":",
"user",
"=",
"await",
"user_account_service",
".",
"register_user",
"(",
... | Create a user by the given credentials. | [
"Create",
"a",
"user",
"by",
"the",
"given",
"credentials",
"."
] | [
"\"\"\"\n Create a user by the given credentials.\n Route just creates a user in db. Mostly aims at the test fixtures or manual testing.\n\n Arguments\n ---------\n < UserInCreate > model\n\n Return\n ---------\n * Body\n < AuthenticationResult > model\n\n Raise\n --... | [
{
"param": "user_in_create",
"type": "UserInCreate"
},
{
"param": "user_account_service",
"type": "UserAccountService"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "user_in_create",
"type": "UserInCreate",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "user_account_service",
"type": "UserAccountService",
... |
3012ea9101d6241909f6cf9748c47188e59fb798 | Max-Zhenzhera/my_vocab_backend | tests/test_api/mixins/response_and_client.py | [
"MIT"
] | Python | fixture_response_and_client | ResponseAndClient | async def fixture_response_and_client(self, *args, **kwargs) -> ResponseAndClient:
"""
Abstract fixture that must return the tuple of response and client:
.. code-block:: python
return await test_client.get(self.url), test_client_user
Might be used when different t... |
Abstract fixture that must return the tuple of response and client:
.. code-block:: python
return await test_client.get(self.url), test_client_user
Might be used when different tests of the one test class
have to have access to *response* and *client* attributes.
... | Abstract fixture that must return the tuple of response and client:
code-block:: python
Might be used when different tests of the one test class
have to have access to *response* and *client* attributes. | [
"Abstract",
"fixture",
"that",
"must",
"return",
"the",
"tuple",
"of",
"response",
"and",
"client",
":",
"code",
"-",
"block",
"::",
"python",
"Might",
"be",
"used",
"when",
"different",
"tests",
"of",
"the",
"one",
"test",
"class",
"have",
"to",
"have",
... | async def fixture_response_and_client(self, *args, **kwargs) -> ResponseAndClient: | [
"async",
"def",
"fixture_response_and_client",
"(",
"self",
",",
"*",
"args",
",",
"**",
"kwargs",
")",
"->",
"ResponseAndClient",
":"
] | Abstract fixture that must return the tuple of response and client:
.. code-block:: python | [
"Abstract",
"fixture",
"that",
"must",
"return",
"the",
"tuple",
"of",
"response",
"and",
"client",
":",
"..",
"code",
"-",
"block",
"::",
"python"
] | [
"\"\"\"\n Abstract fixture that must return the tuple of response and client:\n\n .. code-block:: python\n\n return await test_client.get(self.url), test_client_user\n\n Might be used when different tests of the one test class\n have to have access to *response* and *c... | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
33d9ca1d799f043eb81077ef7c60d06151837666 | Max-Zhenzhera/my_vocab_backend | tests/test_api/test_auth/test_authentication/base/terminating_refresh_session_route.py | [
"MIT"
] | Python | fixture_old_refresh_token | str | async def fixture_old_refresh_token(self, *args, **kwargs) -> str:
"""
Abstract fixture that must return the refresh token from the authenticated user cookie
before that client execute logout/refresh (terminating refresh session) route.
.. code-block:: python
return... |
Abstract fixture that must return the refresh token from the authenticated user cookie
before that client execute logout/refresh (terminating refresh session) route.
.. code-block:: python
return authenticated_test_client.cookies[REFRESH_TOKEN_COOKIE_KEY]
| Abstract fixture that must return the refresh token from the authenticated user cookie
before that client execute logout/refresh (terminating refresh session) route.
code-block:: python
| [
"Abstract",
"fixture",
"that",
"must",
"return",
"the",
"refresh",
"token",
"from",
"the",
"authenticated",
"user",
"cookie",
"before",
"that",
"client",
"execute",
"logout",
"/",
"refresh",
"(",
"terminating",
"refresh",
"session",
")",
"route",
".",
"code",
... | async def fixture_old_refresh_token(self, *args, **kwargs) -> str: | [
"async",
"def",
"fixture_old_refresh_token",
"(",
"self",
",",
"*",
"args",
",",
"**",
"kwargs",
")",
"->",
"str",
":"
] | Abstract fixture that must return the refresh token from the authenticated user cookie
before that client execute logout/refresh (terminating refresh session) route. | [
"Abstract",
"fixture",
"that",
"must",
"return",
"the",
"refresh",
"token",
"from",
"the",
"authenticated",
"user",
"cookie",
"before",
"that",
"client",
"execute",
"logout",
"/",
"refresh",
"(",
"terminating",
"refresh",
"session",
")",
"route",
"."
] | [
"\"\"\"\n Abstract fixture that must return the refresh token from the authenticated user cookie\n before that client execute logout/refresh (terminating refresh session) route.\n\n .. code-block:: python\n\n return authenticated_test_client.cookies[REFRESH_TOKEN_COOKIE_KEY]\... | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
e642108dadd5dcbde7e0cfe1b8291d6f127de860 | Max-Zhenzhera/my_vocab_backend | app/services/authentication/oauth/base/oauth.py | [
"MIT"
] | Python | _build_oauth_connection_instance | BaseOAuthConnection | def _build_oauth_connection_instance(
self,
oauth_user: OAuthUser,
internal_user: User
) -> BaseOAuthConnection:
"""
Build OAuth connection instance that contains:
1. internal user id;
2. OAuth user id.
""" |
Build OAuth connection instance that contains:
1. internal user id;
2. OAuth user id.
| Build OAuth connection instance that contains:
1. internal user id;
2. | [
"Build",
"OAuth",
"connection",
"instance",
"that",
"contains",
":",
"1",
".",
"internal",
"user",
"id",
";",
"2",
"."
] | def _build_oauth_connection_instance(
self,
oauth_user: OAuthUser,
internal_user: User
) -> BaseOAuthConnection: | [
"def",
"_build_oauth_connection_instance",
"(",
"self",
",",
"oauth_user",
":",
"OAuthUser",
",",
"internal_user",
":",
"User",
")",
"->",
"BaseOAuthConnection",
":"
] | Build OAuth connection instance that contains:
1. internal user id;
2. | [
"Build",
"OAuth",
"connection",
"instance",
"that",
"contains",
":",
"1",
".",
"internal",
"user",
"id",
";",
"2",
"."
] | [
"\"\"\"\n Build OAuth connection instance that contains:\n 1. internal user id;\n 2. OAuth user id.\n \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "oauth_user",
"type": "OAuthUser"
},
{
"param": "internal_user",
"type": "User"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "oauth_user",
"type": "OAuthUser",
"docstring": null,
"docstri... |
c582f3bdee9b08dfddb9d97fa4f77f8c56e1ec71 | Max-Zhenzhera/my_vocab_backend | tests/test_api/test_auth/test_oauth/base/oauth_route.py | [
"MIT"
] | Python | oauth_user | OAuthUser | def oauth_user(self) -> OAuthUser:
"""
The OAuth user that interact in OAuth routes.
In all OAuth routes test cases
extracting of OAuth user is mocked.
Return value of this mock will be this property.
Abstract *class* attribute:
oauth_user: ClassVar[OAuthUse... |
The OAuth user that interact in OAuth routes.
In all OAuth routes test cases
extracting of OAuth user is mocked.
Return value of this mock will be this property.
Abstract *class* attribute:
oauth_user: ClassVar[OAuthUser] = test_user.service_name_oauth_user
... | The OAuth user that interact in OAuth routes.
In all OAuth routes test cases
extracting of OAuth user is mocked.
Return value of this mock will be this property.
| [
"The",
"OAuth",
"user",
"that",
"interact",
"in",
"OAuth",
"routes",
".",
"In",
"all",
"OAuth",
"routes",
"test",
"cases",
"extracting",
"of",
"OAuth",
"user",
"is",
"mocked",
".",
"Return",
"value",
"of",
"this",
"mock",
"will",
"be",
"this",
"property",
... | def oauth_user(self) -> OAuthUser: | [
"def",
"oauth_user",
"(",
"self",
")",
"->",
"OAuthUser",
":"
] | The OAuth user that interact in OAuth routes. | [
"The",
"OAuth",
"user",
"that",
"interact",
"in",
"OAuth",
"routes",
"."
] | [
"\"\"\"\n The OAuth user that interact in OAuth routes.\n\n In all OAuth routes test cases\n extracting of OAuth user is mocked.\n Return value of this mock will be this property.\n\n Abstract *class* attribute:\n oauth_user: ClassVar[OAuthUser] = test_user.service_name... | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
bef78787e244c657bb9004118354985f13e323c8 | artemis-analytics/fwfr | bindings/pyfwfr/tests/test_fwf.py | [
"Apache-2.0"
] | Python | ignore_numpy_warning | <not_specific> | def ignore_numpy_warning(test_func):
"""
Ignore deprecated numpy warning. Official fix from numpy is to ignore the
warning, but unittest warning settings override it and shows the warning.
"""
def do_test(self, *args, **kwargs):
with warnings.catch_warnings():
warnings.filterwarn... |
Ignore deprecated numpy warning. Official fix from numpy is to ignore the
warning, but unittest warning settings override it and shows the warning.
| Ignore deprecated numpy warning. Official fix from numpy is to ignore the
warning, but unittest warning settings override it and shows the warning. | [
"Ignore",
"deprecated",
"numpy",
"warning",
".",
"Official",
"fix",
"from",
"numpy",
"is",
"to",
"ignore",
"the",
"warning",
"but",
"unittest",
"warning",
"settings",
"override",
"it",
"and",
"shows",
"the",
"warning",
"."
] | def ignore_numpy_warning(test_func):
def do_test(self, *args, **kwargs):
with warnings.catch_warnings():
warnings.filterwarnings('ignore',
message='numpy.ufunc size changed')
test_func(self, *args, **kwargs)
return do_test | [
"def",
"ignore_numpy_warning",
"(",
"test_func",
")",
":",
"def",
"do_test",
"(",
"self",
",",
"*",
"args",
",",
"**",
"kwargs",
")",
":",
"with",
"warnings",
".",
"catch_warnings",
"(",
")",
":",
"warnings",
".",
"filterwarnings",
"(",
"'ignore'",
",",
... | Ignore deprecated numpy warning. | [
"Ignore",
"deprecated",
"numpy",
"warning",
"."
] | [
"\"\"\"\n Ignore deprecated numpy warning. Official fix from numpy is to ignore the\n warning, but unittest warning settings override it and shows the warning.\n \"\"\""
] | [
{
"param": "test_func",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "test_func",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
ecd2be6d2e9d1f3b956578e4da9671bb305800db | NuneMugurel/Efficientnet | efficientnet/model.py | [
"MIT"
] | Python | EfficientNet | <not_specific> | def EfficientNet(model_name,
dropout_connection_rate=0.2,
depth_divisor=8,
load_weights=False,
num_classes=23):
"""Instantiates the EfficientNet architecture using given scaling coefficients.
Optionally loads weights pre-trained on part of Imag... | Instantiates the EfficientNet architecture using given scaling coefficients.
Optionally loads weights pre-trained on part of ImageNet.
# Arguments
model_name: name of the model, efficientnet-b<0-8 or l2>
dropout_connection_rate: float between 0 and 1, dropout rate at mb_conv connections
... | Instantiates the EfficientNet architecture using given scaling coefficients.
Optionally loads weights pre-trained on part of ImageNet. | [
"Instantiates",
"the",
"EfficientNet",
"architecture",
"using",
"given",
"scaling",
"coefficients",
".",
"Optionally",
"loads",
"weights",
"pre",
"-",
"trained",
"on",
"part",
"of",
"ImageNet",
"."
] | def EfficientNet(model_name,
dropout_connection_rate=0.2,
depth_divisor=8,
load_weights=False,
num_classes=23):
model_params = params_dict[model_name]
width_coefficient = model_params[0]
depth_coefficient = model_params[1]
resolution = ... | [
"def",
"EfficientNet",
"(",
"model_name",
",",
"dropout_connection_rate",
"=",
"0.2",
",",
"depth_divisor",
"=",
"8",
",",
"load_weights",
"=",
"False",
",",
"num_classes",
"=",
"23",
")",
":",
"model_params",
"=",
"params_dict",
"[",
"model_name",
"]",
"width... | Instantiates the EfficientNet architecture using given scaling coefficients. | [
"Instantiates",
"the",
"EfficientNet",
"architecture",
"using",
"given",
"scaling",
"coefficients",
"."
] | [
"\"\"\"Instantiates the EfficientNet architecture using given scaling coefficients.\n Optionally loads weights pre-trained on part of ImageNet.\n # Arguments\n model_name: name of the model, efficientnet-b<0-8 or l2>\n dropout_connection_rate: float between 0 and 1, dropout rate at mb_conv conne... | [
{
"param": "model_name",
"type": null
},
{
"param": "dropout_connection_rate",
"type": null
},
{
"param": "depth_divisor",
"type": null
},
{
"param": "load_weights",
"type": null
},
{
"param": "num_classes",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "model_name",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "dropout_connection_rate",
"type": null,
"docstring": null,
... |
b9c853c5a30e7bc963a045b7ffb6798816b87d28 | MrFellox/spotdlgui | spotdlgui/core/spotdlgui/scripts/utils.py | [
"MIT"
] | Python | create_config_file | null | def create_config_file():
'''
Creates/overwrites the config file with the default settings.
'''
os.mkdir('./core/data')
with open('./core/data/config.json' 'w') as f:
json.dump(default_settings, f, indent=2) |
Creates/overwrites the config file with the default settings.
| Creates/overwrites the config file with the default settings. | [
"Creates",
"/",
"overwrites",
"the",
"config",
"file",
"with",
"the",
"default",
"settings",
"."
] | def create_config_file():
os.mkdir('./core/data')
with open('./core/data/config.json' 'w') as f:
json.dump(default_settings, f, indent=2) | [
"def",
"create_config_file",
"(",
")",
":",
"os",
".",
"mkdir",
"(",
"'./core/data'",
")",
"with",
"open",
"(",
"'./core/data/config.json'",
"'w'",
")",
"as",
"f",
":",
"json",
".",
"dump",
"(",
"default_settings",
",",
"f",
",",
"indent",
"=",
"2",
")"
... | Creates/overwrites the config file with the default settings. | [
"Creates",
"/",
"overwrites",
"the",
"config",
"file",
"with",
"the",
"default",
"settings",
"."
] | [
"'''\n Creates/overwrites the config file with the default settings.\n '''"
] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} |
b9c853c5a30e7bc963a045b7ffb6798816b87d28 | MrFellox/spotdlgui | spotdlgui/core/spotdlgui/scripts/utils.py | [
"MIT"
] | Python | change_config_value | null | def change_config_value(setting, value):
'''
Modifies the specified setting for the specified value
'''
with open('./core/data/config.json') as f:
data = json.load(f)
data[setting] = value
with open('./core/data/config.json', 'w') as f:
json.dump(data, f, indent=2) |
Modifies the specified setting for the specified value
| Modifies the specified setting for the specified value | [
"Modifies",
"the",
"specified",
"setting",
"for",
"the",
"specified",
"value"
] | def change_config_value(setting, value):
with open('./core/data/config.json') as f:
data = json.load(f)
data[setting] = value
with open('./core/data/config.json', 'w') as f:
json.dump(data, f, indent=2) | [
"def",
"change_config_value",
"(",
"setting",
",",
"value",
")",
":",
"with",
"open",
"(",
"'./core/data/config.json'",
")",
"as",
"f",
":",
"data",
"=",
"json",
".",
"load",
"(",
"f",
")",
"data",
"[",
"setting",
"]",
"=",
"value",
"with",
"open",
"("... | Modifies the specified setting for the specified value | [
"Modifies",
"the",
"specified",
"setting",
"for",
"the",
"specified",
"value"
] | [
"'''\n Modifies the specified setting for the specified value \n '''"
] | [
{
"param": "setting",
"type": null
},
{
"param": "value",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "setting",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "value",
"type": null,
"docstring": null,
"docstring_tokens... |
b9c853c5a30e7bc963a045b7ffb6798816b87d28 | MrFellox/spotdlgui | spotdlgui/core/spotdlgui/scripts/utils.py | [
"MIT"
] | Python | default_path_kivy | str | def default_path_kivy() -> str:
'''
Returns the string of the default download path for Kivy.
'''
if get_setting_value('defaultLocation') == None:
return 'None'
else:
return get_setting_value('defaultLocation') |
Returns the string of the default download path for Kivy.
| Returns the string of the default download path for Kivy. | [
"Returns",
"the",
"string",
"of",
"the",
"default",
"download",
"path",
"for",
"Kivy",
"."
] | def default_path_kivy() -> str:
if get_setting_value('defaultLocation') == None:
return 'None'
else:
return get_setting_value('defaultLocation') | [
"def",
"default_path_kivy",
"(",
")",
"->",
"str",
":",
"if",
"get_setting_value",
"(",
"'defaultLocation'",
")",
"==",
"None",
":",
"return",
"'None'",
"else",
":",
"return",
"get_setting_value",
"(",
"'defaultLocation'",
")"
] | Returns the string of the default download path for Kivy. | [
"Returns",
"the",
"string",
"of",
"the",
"default",
"download",
"path",
"for",
"Kivy",
"."
] | [
"'''\n Returns the string of the default download path for Kivy.\n '''"
] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} |
b9c853c5a30e7bc963a045b7ffb6798816b87d28 | MrFellox/spotdlgui | spotdlgui/core/spotdlgui/scripts/utils.py | [
"MIT"
] | Python | ask_for_default_path | <not_specific> | def ask_for_default_path():
'''
Asks to the user for a directory where to automatically save songs if always ask location is off.
'''
output = ''
# Using tk since it uses system's ui.
root = tk.Tk()
root.withdraw()
while output == '':
output = filedialog.askdirectory()
... |
Asks to the user for a directory where to automatically save songs if always ask location is off.
| Asks to the user for a directory where to automatically save songs if always ask location is off. | [
"Asks",
"to",
"the",
"user",
"for",
"a",
"directory",
"where",
"to",
"automatically",
"save",
"songs",
"if",
"always",
"ask",
"location",
"is",
"off",
"."
] | def ask_for_default_path():
output = ''
root = tk.Tk()
root.withdraw()
while output == '':
output = filedialog.askdirectory()
return output | [
"def",
"ask_for_default_path",
"(",
")",
":",
"output",
"=",
"''",
"root",
"=",
"tk",
".",
"Tk",
"(",
")",
"root",
".",
"withdraw",
"(",
")",
"while",
"output",
"==",
"''",
":",
"output",
"=",
"filedialog",
".",
"askdirectory",
"(",
")",
"return",
"o... | Asks to the user for a directory where to automatically save songs if always ask location is off. | [
"Asks",
"to",
"the",
"user",
"for",
"a",
"directory",
"where",
"to",
"automatically",
"save",
"songs",
"if",
"always",
"ask",
"location",
"is",
"off",
"."
] | [
"'''\n Asks to the user for a directory where to automatically save songs if always ask location is off. \n '''",
"# Using tk since it uses system's ui."
] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} |
cffefcdc26422c9e2e664037688f1a93b62906a8 | MrFellox/spotdlgui | spotdlgui/main.py | [
"MIT"
] | Python | _enter_settings | null | def _enter_settings(self):
'''
This function runs when the "Settings" option is clicked,
showing an animation to the settings screen.
'''
self.manager.current = 'optionsScreen'
self.manager.transition.direction = 'left' |
This function runs when the "Settings" option is clicked,
showing an animation to the settings screen.
| This function runs when the "Settings" option is clicked,
showing an animation to the settings screen. | [
"This",
"function",
"runs",
"when",
"the",
"\"",
"Settings",
"\"",
"option",
"is",
"clicked",
"showing",
"an",
"animation",
"to",
"the",
"settings",
"screen",
"."
] | def _enter_settings(self):
self.manager.current = 'optionsScreen'
self.manager.transition.direction = 'left' | [
"def",
"_enter_settings",
"(",
"self",
")",
":",
"self",
".",
"manager",
".",
"current",
"=",
"'optionsScreen'",
"self",
".",
"manager",
".",
"transition",
".",
"direction",
"=",
"'left'"
] | This function runs when the "Settings" option is clicked,
showing an animation to the settings screen. | [
"This",
"function",
"runs",
"when",
"the",
"\"",
"Settings",
"\"",
"option",
"is",
"clicked",
"showing",
"an",
"animation",
"to",
"the",
"settings",
"screen",
"."
] | [
"'''\n This function runs when the \"Settings\" option is clicked,\n showing an animation to the settings screen.\n '''"
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
cffefcdc26422c9e2e664037688f1a93b62906a8 | MrFellox/spotdlgui | spotdlgui/main.py | [
"MIT"
] | Python | download_song | null | def download_song(self):
'''
This function downloads the list of the song specified and shows progress of download in string.
'''
self.output_path = app_utils.get_download_path()
# Get search query from the text entry
# ! Replaced from App.get_running_app().ids['searche... |
This function downloads the list of the song specified and shows progress of download in string.
| This function downloads the list of the song specified and shows progress of download in string. | [
"This",
"function",
"downloads",
"the",
"list",
"of",
"the",
"song",
"specified",
"and",
"shows",
"progress",
"of",
"download",
"in",
"string",
"."
] | def download_song(self):
self.output_path = app_utils.get_download_path()
search_query = self.ids['searcher'].text
self.popup.change_text('Searching song(s)...')
self.song_list = parse_query(
[search_query],
'mp3',
False,
False,
... | [
"def",
"download_song",
"(",
"self",
")",
":",
"self",
".",
"output_path",
"=",
"app_utils",
".",
"get_download_path",
"(",
")",
"search_query",
"=",
"self",
".",
"ids",
"[",
"'searcher'",
"]",
".",
"text",
"self",
".",
"popup",
".",
"change_text",
"(",
... | This function downloads the list of the song specified and shows progress of download in string. | [
"This",
"function",
"downloads",
"the",
"list",
"of",
"the",
"song",
"specified",
"and",
"shows",
"progress",
"of",
"download",
"in",
"string",
"."
] | [
"'''\n This function downloads the list of the song specified and shows progress of download in string.\n '''",
"# Get search query from the text entry",
"# ! Replaced from App.get_running_app().ids['searcher'].text because we're now using screens.",
"# Parse songs",
"# Save app path",
"# Mo... | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
cffefcdc26422c9e2e664037688f1a93b62906a8 | MrFellox/spotdlgui | spotdlgui/main.py | [
"MIT"
] | Python | _on_download_press | null | def _on_download_press(self):
'''
Runs when donwload button is pressed
'''
# Start an instance of the progress popup and show it
self.popup = DownloadingPopup()
self.popup.open()
# Start download thread.
download_thread = threading.Thread(target=self.down... |
Runs when donwload button is pressed
| Runs when donwload button is pressed | [
"Runs",
"when",
"donwload",
"button",
"is",
"pressed"
] | def _on_download_press(self):
self.popup = DownloadingPopup()
self.popup.open()
download_thread = threading.Thread(target=self.download_song)
download_thread.start() | [
"def",
"_on_download_press",
"(",
"self",
")",
":",
"self",
".",
"popup",
"=",
"DownloadingPopup",
"(",
")",
"self",
".",
"popup",
".",
"open",
"(",
")",
"download_thread",
"=",
"threading",
".",
"Thread",
"(",
"target",
"=",
"self",
".",
"download_song",
... | Runs when donwload button is pressed | [
"Runs",
"when",
"donwload",
"button",
"is",
"pressed"
] | [
"'''\n Runs when donwload button is pressed\n '''",
"# Start an instance of the progress popup and show it",
"# Start download thread."
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
cffefcdc26422c9e2e664037688f1a93b62906a8 | MrFellox/spotdlgui | spotdlgui/main.py | [
"MIT"
] | Python | switch_callback | null | def switch_callback(self, instance, value):
'''
Runs everytime a switch that is linked to this callback is switched.
'''
if instance == 'askLocation':
app_utils.change_config_value('askLocation', value)
else:
pass |
Runs everytime a switch that is linked to this callback is switched.
| Runs everytime a switch that is linked to this callback is switched. | [
"Runs",
"everytime",
"a",
"switch",
"that",
"is",
"linked",
"to",
"this",
"callback",
"is",
"switched",
"."
] | def switch_callback(self, instance, value):
if instance == 'askLocation':
app_utils.change_config_value('askLocation', value)
else:
pass | [
"def",
"switch_callback",
"(",
"self",
",",
"instance",
",",
"value",
")",
":",
"if",
"instance",
"==",
"'askLocation'",
":",
"app_utils",
".",
"change_config_value",
"(",
"'askLocation'",
",",
"value",
")",
"else",
":",
"pass"
] | Runs everytime a switch that is linked to this callback is switched. | [
"Runs",
"everytime",
"a",
"switch",
"that",
"is",
"linked",
"to",
"this",
"callback",
"is",
"switched",
"."
] | [
"'''\n Runs everytime a switch that is linked to this callback is switched.\n '''"
] | [
{
"param": "self",
"type": null
},
{
"param": "instance",
"type": null
},
{
"param": "value",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "instance",
"type": null,
"docstring": null,
"docstring_tokens... |
ffabc6a7e23bc9bfeea52304fbec05d0ca6482b9 | MrFellox/spotdlgui | spotdlgui/core/spotdlgui/scripts/popups.py | [
"MIT"
] | Python | change_label_size | null | def change_label_size(self, text_len: int):
'''
Changes the size of the label so it fits on the popup.
'''
self.ids.popup_label.font_size = (self.width / text_len) + 10 |
Changes the size of the label so it fits on the popup.
| Changes the size of the label so it fits on the popup. | [
"Changes",
"the",
"size",
"of",
"the",
"label",
"so",
"it",
"fits",
"on",
"the",
"popup",
"."
] | def change_label_size(self, text_len: int):
self.ids.popup_label.font_size = (self.width / text_len) + 10 | [
"def",
"change_label_size",
"(",
"self",
",",
"text_len",
":",
"int",
")",
":",
"self",
".",
"ids",
".",
"popup_label",
".",
"font_size",
"=",
"(",
"self",
".",
"width",
"/",
"text_len",
")",
"+",
"10"
] | Changes the size of the label so it fits on the popup. | [
"Changes",
"the",
"size",
"of",
"the",
"label",
"so",
"it",
"fits",
"on",
"the",
"popup",
"."
] | [
"'''\n Changes the size of the label so it fits on the popup.\n '''"
] | [
{
"param": "self",
"type": null
},
{
"param": "text_len",
"type": "int"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "text_len",
"type": "int",
"docstring": null,
"docstring_token... |
023e57de3abc352aa4365de36ecbf4633c45c92e | graemsheppard/MonteCarlo | src/django/shared/Monte.py | [
"MIT"
] | Python | create_DataFrame | null | def create_DataFrame(self):
"""
Function that creates the DataFrame object where the stock data will be stored.
"""
self.data[self.ticker] = pdr.DataReader(self.ticker, data_source=self.data_source,
start=self.start, end=self.end)['Adj Cl... |
Function that creates the DataFrame object where the stock data will be stored.
| Function that creates the DataFrame object where the stock data will be stored. | [
"Function",
"that",
"creates",
"the",
"DataFrame",
"object",
"where",
"the",
"stock",
"data",
"will",
"be",
"stored",
"."
] | def create_DataFrame(self):
self.data[self.ticker] = pdr.DataReader(self.ticker, data_source=self.data_source,
start=self.start, end=self.end)['Adj Close'] | [
"def",
"create_DataFrame",
"(",
"self",
")",
":",
"self",
".",
"data",
"[",
"self",
".",
"ticker",
"]",
"=",
"pdr",
".",
"DataReader",
"(",
"self",
".",
"ticker",
",",
"data_source",
"=",
"self",
".",
"data_source",
",",
"start",
"=",
"self",
".",
"s... | Function that creates the DataFrame object where the stock data will be stored. | [
"Function",
"that",
"creates",
"the",
"DataFrame",
"object",
"where",
"the",
"stock",
"data",
"will",
"be",
"stored",
"."
] | [
"\"\"\"\n Function that creates the DataFrame object where the stock data will be stored.\n \"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
023e57de3abc352aa4365de36ecbf4633c45c92e | graemsheppard/MonteCarlo | src/django/shared/Monte.py | [
"MIT"
] | Python | simulate | null | def simulate(self):
"""
Function that does the necessary calculations for the simulation data.
"""
# np.random.seed(8) this can be used to seed the simulation so you can repeat results
# Initial data values needed to set up the simulations.
log_returns = np.log(1 + self... |
Function that does the necessary calculations for the simulation data.
| Function that does the necessary calculations for the simulation data. | [
"Function",
"that",
"does",
"the",
"necessary",
"calculations",
"for",
"the",
"simulation",
"data",
"."
] | def simulate(self):
log_returns = np.log(1 + self.data.pct_change())
mu = log_returns.mean()
var = log_returns.var()
drift = mu - (0.5 * var)
sigma = log_returns.std()
daily_returns = np.exp(drift.to_numpy() + sigma.to_numpy() * norm.ppf(np.random.rand(self.time_step... | [
"def",
"simulate",
"(",
"self",
")",
":",
"log_returns",
"=",
"np",
".",
"log",
"(",
"1",
"+",
"self",
".",
"data",
".",
"pct_change",
"(",
")",
")",
"mu",
"=",
"log_returns",
".",
"mean",
"(",
")",
"var",
"=",
"log_returns",
".",
"var",
"(",
")"... | Function that does the necessary calculations for the simulation data. | [
"Function",
"that",
"does",
"the",
"necessary",
"calculations",
"for",
"the",
"simulation",
"data",
"."
] | [
"\"\"\"\n Function that does the necessary calculations for the simulation data.\n \"\"\"",
"# np.random.seed(8) this can be used to seed the simulation so you can repeat results",
"# Initial data values needed to set up the simulations.",
"# percentage change between current and prior element",... | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
023e57de3abc352aa4365de36ecbf4633c45c92e | graemsheppard/MonteCarlo | src/django/shared/Monte.py | [
"MIT"
] | Python | plot_history | <not_specific> | def plot_history(self):
"""
Function that plots the history of stock prices in the time frame set by the user.
:returns: plot_history_str which is a string which contains the html for the graphical output.
:rtype: str
"""
stock_plot = self.data.plot(figsize=(self.width,... |
Function that plots the history of stock prices in the time frame set by the user.
:returns: plot_history_str which is a string which contains the html for the graphical output.
:rtype: str
| Function that plots the history of stock prices in the time frame set by the user. | [
"Function",
"that",
"plots",
"the",
"history",
"of",
"stock",
"prices",
"in",
"the",
"time",
"frame",
"set",
"by",
"the",
"user",
"."
] | def plot_history(self):
stock_plot = self.data.plot(figsize=(self.width, self.height))
stock_plot.set_xlabel('Date')
stock_plot.set_ylabel('Adjusted Closing Price')
stock_plot.set_title("Historical Adjusted Closing Prices Over Time")
history = plt.gcf()
self.history = his... | [
"def",
"plot_history",
"(",
"self",
")",
":",
"stock_plot",
"=",
"self",
".",
"data",
".",
"plot",
"(",
"figsize",
"=",
"(",
"self",
".",
"width",
",",
"self",
".",
"height",
")",
")",
"stock_plot",
".",
"set_xlabel",
"(",
"'Date'",
")",
"stock_plot",
... | Function that plots the history of stock prices in the time frame set by the user. | [
"Function",
"that",
"plots",
"the",
"history",
"of",
"stock",
"prices",
"in",
"the",
"time",
"frame",
"set",
"by",
"the",
"user",
"."
] | [
"\"\"\"\n Function that plots the history of stock prices in the time frame set by the user.\n\n :returns: plot_history_str which is a string which contains the html for the graphical output.\n :rtype: str\n \"\"\"",
"# saves figure to string of html",
"#plot_history_dict = mpld3.fig... | [
{
"param": "self",
"type": null
}
] | {
"returns": [
{
"docstring": "plot_history_str which is a string which contains the html for the graphical output.",
"docstring_tokens": [
"plot_history_str",
"which",
"is",
"a",
"string",
"which",
"contains",
"the",
"html",
... |
023e57de3abc352aa4365de36ecbf4633c45c92e | graemsheppard/MonteCarlo | src/django/shared/Monte.py | [
"MIT"
] | Python | plot_pdf | <not_specific> | def plot_pdf(self):
"""
Function that plots the distribution of simulated prices of a given time step into the future.
This histogram is fit to a Probability Density Function with the mean and standard deviation
listed in the title.
:returns: plot_pdf_str which is a string which... |
Function that plots the distribution of simulated prices of a given time step into the future.
This histogram is fit to a Probability Density Function with the mean and standard deviation
listed in the title.
:returns: plot_pdf_str which is a string which contains the html for the grap... | Function that plots the distribution of simulated prices of a given time step into the future.
This histogram is fit to a Probability Density Function with the mean and standard deviation
listed in the title. | [
"Function",
"that",
"plots",
"the",
"distribution",
"of",
"simulated",
"prices",
"of",
"a",
"given",
"time",
"step",
"into",
"the",
"future",
".",
"This",
"histogram",
"is",
"fit",
"to",
"a",
"Probability",
"Density",
"Function",
"with",
"the",
"mean",
"and"... | def plot_pdf(self):
fig = plt.figure(figsize=(self.width, self.height))
plt.hist(self.monte_sims[self.time_steps - 2], bins=10, density=True)
sim_mu, sim_sig = norm.fit(self.monte_sims[self.time_steps - 2])
xmin, xmax = plt.xlim()
x = np.linspace(xmin, xmax)
p = norm.pd... | [
"def",
"plot_pdf",
"(",
"self",
")",
":",
"fig",
"=",
"plt",
".",
"figure",
"(",
"figsize",
"=",
"(",
"self",
".",
"width",
",",
"self",
".",
"height",
")",
")",
"plt",
".",
"hist",
"(",
"self",
".",
"monte_sims",
"[",
"self",
".",
"time_steps",
... | Function that plots the distribution of simulated prices of a given time step into the future. | [
"Function",
"that",
"plots",
"the",
"distribution",
"of",
"simulated",
"prices",
"of",
"a",
"given",
"time",
"step",
"into",
"the",
"future",
"."
] | [
"\"\"\"\n Function that plots the distribution of simulated prices of a given time step into the future.\n This histogram is fit to a Probability Density Function with the mean and standard deviation\n listed in the title.\n\n :returns: plot_pdf_str which is a string which contains the h... | [
{
"param": "self",
"type": null
}
] | {
"returns": [
{
"docstring": "plot_pdf_str which is a string which contains the html for the graphical output.",
"docstring_tokens": [
"plot_pdf_str",
"which",
"is",
"a",
"string",
"which",
"contains",
"the",
"html",
"for... |
023e57de3abc352aa4365de36ecbf4633c45c92e | graemsheppard/MonteCarlo | src/django/shared/Monte.py | [
"MIT"
] | Python | plot_single | <not_specific> | def plot_single(self):
"""
Function that plots the first element in each set of simulations after a given time step.
These elements are plotted to show a single simulated projection line.
:returns: plot_single_str which is a string which contains the html for the graphical output.
... |
Function that plots the first element in each set of simulations after a given time step.
These elements are plotted to show a single simulated projection line.
:returns: plot_single_str which is a string which contains the html for the graphical output.
:rtype: str
| Function that plots the first element in each set of simulations after a given time step.
These elements are plotted to show a single simulated projection line. | [
"Function",
"that",
"plots",
"the",
"first",
"element",
"in",
"each",
"set",
"of",
"simulations",
"after",
"a",
"given",
"time",
"step",
".",
"These",
"elements",
"are",
"plotted",
"to",
"show",
"a",
"single",
"simulated",
"projection",
"line",
"."
] | def plot_single(self):
single = []
for item in self.monte_sims:
single.append(item[0])
plt.figure(figsize=(self.width, self.height))
plt.plot(single)
plt.xlabel('Days into the Future')
plt.ylabel('Adjusted Closing Price')
plt.title('Simulated Adjusted ... | [
"def",
"plot_single",
"(",
"self",
")",
":",
"single",
"=",
"[",
"]",
"for",
"item",
"in",
"self",
".",
"monte_sims",
":",
"single",
".",
"append",
"(",
"item",
"[",
"0",
"]",
")",
"plt",
".",
"figure",
"(",
"figsize",
"=",
"(",
"self",
".",
"wid... | Function that plots the first element in each set of simulations after a given time step. | [
"Function",
"that",
"plots",
"the",
"first",
"element",
"in",
"each",
"set",
"of",
"simulations",
"after",
"a",
"given",
"time",
"step",
"."
] | [
"\"\"\"\n Function that plots the first element in each set of simulations after a given time step.\n These elements are plotted to show a single simulated projection line.\n\n :returns: plot_single_str which is a string which contains the html for the graphical output.\n :rtype: str\n ... | [
{
"param": "self",
"type": null
}
] | {
"returns": [
{
"docstring": "plot_single_str which is a string which contains the html for the graphical output.",
"docstring_tokens": [
"plot_single_str",
"which",
"is",
"a",
"string",
"which",
"contains",
"the",
"html",
... |
023e57de3abc352aa4365de36ecbf4633c45c92e | graemsheppard/MonteCarlo | src/django/shared/Monte.py | [
"MIT"
] | Python | plot_multi | <not_specific> | def plot_multi(self):
"""
Function that plots all of the price simualtions at each time step into the future.
:returns: plot_multi_str which is a string which contains the html for the graphical output.
:rtype: str
"""
plt.figure(figsize=(self.width, self.height))
... |
Function that plots all of the price simualtions at each time step into the future.
:returns: plot_multi_str which is a string which contains the html for the graphical output.
:rtype: str
| Function that plots all of the price simualtions at each time step into the future. | [
"Function",
"that",
"plots",
"all",
"of",
"the",
"price",
"simualtions",
"at",
"each",
"time",
"step",
"into",
"the",
"future",
"."
] | def plot_multi(self):
plt.figure(figsize=(self.width, self.height))
plt.plot(self.monte_sims)
plt.xlabel('Days into the Future')
plt.ylabel('Adjusted Closing Price')
title = "Monte Carlo Simulations for Adjusted Closing Prices"
plt.title(title)
multi = plt.gcf()
... | [
"def",
"plot_multi",
"(",
"self",
")",
":",
"plt",
".",
"figure",
"(",
"figsize",
"=",
"(",
"self",
".",
"width",
",",
"self",
".",
"height",
")",
")",
"plt",
".",
"plot",
"(",
"self",
".",
"monte_sims",
")",
"plt",
".",
"xlabel",
"(",
"'Days into ... | Function that plots all of the price simualtions at each time step into the future. | [
"Function",
"that",
"plots",
"all",
"of",
"the",
"price",
"simualtions",
"at",
"each",
"time",
"step",
"into",
"the",
"future",
"."
] | [
"\"\"\"\n Function that plots all of the price simualtions at each time step into the future.\n\n :returns: plot_multi_str which is a string which contains the html for the graphical output.\n :rtype: str\n \"\"\"",
"# saves figure to string of html",
"#plot_multi_dict = mpld3.fig_to... | [
{
"param": "self",
"type": null
}
] | {
"returns": [
{
"docstring": "plot_multi_str which is a string which contains the html for the graphical output.",
"docstring_tokens": [
"plot_multi_str",
"which",
"is",
"a",
"string",
"which",
"contains",
"the",
"html",
... |
e136a4084eb47cc4c56929ec694a1f4a7facc58d | oalhinnawi/chatMimic | chatMimic.py | [
"MIT"
] | Python | trainOnVOD | null | def trainOnVOD(self,
vodID,
bufferFile="temp.txt",
saveOutWeights=True,
weightsOutputFile="vodWeights.hdf5",
numEpochs=10):
"""Trains text generator on given VOD ID"""
print("Scraping VOD for chat history")
... | Trains text generator on given VOD ID | Trains text generator on given VOD ID | [
"Trains",
"text",
"generator",
"on",
"given",
"VOD",
"ID"
] | def trainOnVOD(self,
vodID,
bufferFile="temp.txt",
saveOutWeights=True,
weightsOutputFile="vodWeights.hdf5",
numEpochs=10):
print("Scraping VOD for chat history")
fileObj = open(bufferFile, "w")
for co... | [
"def",
"trainOnVOD",
"(",
"self",
",",
"vodID",
",",
"bufferFile",
"=",
"\"temp.txt\"",
",",
"saveOutWeights",
"=",
"True",
",",
"weightsOutputFile",
"=",
"\"vodWeights.hdf5\"",
",",
"numEpochs",
"=",
"10",
")",
":",
"print",
"(",
"\"Scraping VOD for chat history\... | Trains text generator on given VOD ID | [
"Trains",
"text",
"generator",
"on",
"given",
"VOD",
"ID"
] | [
"\"\"\"Trains text generator on given VOD ID\"\"\"",
"# Get all chat from VOD and put it in a buffer file",
"# Train text generator on said file",
"# Save out weights if enabled"
] | [
{
"param": "self",
"type": null
},
{
"param": "vodID",
"type": null
},
{
"param": "bufferFile",
"type": null
},
{
"param": "saveOutWeights",
"type": null
},
{
"param": "weightsOutputFile",
"type": null
},
{
"param": "numEpochs",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "vodID",
"type": null,
"docstring": null,
"docstring_tokens": ... |
e136a4084eb47cc4c56929ec694a1f4a7facc58d | oalhinnawi/chatMimic | chatMimic.py | [
"MIT"
] | Python | loadVODWeights | null | def loadVODWeights(self, filePath):
"""Loads HDF5 file representing the weights for generator"""
try:
self.vodGen
except AttributeError:
print("Generator hasn't been made yet, making now")
self.vodGen = textgenrnn()
print("Loading in weights {}".format... | Loads HDF5 file representing the weights for generator | Loads HDF5 file representing the weights for generator | [
"Loads",
"HDF5",
"file",
"representing",
"the",
"weights",
"for",
"generator"
] | def loadVODWeights(self, filePath):
try:
self.vodGen
except AttributeError:
print("Generator hasn't been made yet, making now")
self.vodGen = textgenrnn()
print("Loading in weights {}".format(filePath))
self.vodGen.load(filePath) | [
"def",
"loadVODWeights",
"(",
"self",
",",
"filePath",
")",
":",
"try",
":",
"self",
".",
"vodGen",
"except",
"AttributeError",
":",
"print",
"(",
"\"Generator hasn't been made yet, making now\"",
")",
"self",
".",
"vodGen",
"=",
"textgenrnn",
"(",
")",
"print",... | Loads HDF5 file representing the weights for generator | [
"Loads",
"HDF5",
"file",
"representing",
"the",
"weights",
"for",
"generator"
] | [
"\"\"\"Loads HDF5 file representing the weights for generator\"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "filePath",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "filePath",
"type": null,
"docstring": null,
"docstring_tokens... |
e136a4084eb47cc4c56929ec694a1f4a7facc58d | oalhinnawi/chatMimic | chatMimic.py | [
"MIT"
] | Python | generateTextFromVOD | <not_specific> | def generateTextFromVOD(self):
"""Generates Text based on current weights"""
if(self.vodGen):
return self.vodGen.generate(1, return_as_list=True)[0]
else:
raise("VOD text generator not trained") | Generates Text based on current weights | Generates Text based on current weights | [
"Generates",
"Text",
"based",
"on",
"current",
"weights"
] | def generateTextFromVOD(self):
if(self.vodGen):
return self.vodGen.generate(1, return_as_list=True)[0]
else:
raise("VOD text generator not trained") | [
"def",
"generateTextFromVOD",
"(",
"self",
")",
":",
"if",
"(",
"self",
".",
"vodGen",
")",
":",
"return",
"self",
".",
"vodGen",
".",
"generate",
"(",
"1",
",",
"return_as_list",
"=",
"True",
")",
"[",
"0",
"]",
"else",
":",
"raise",
"(",
"\"VOD tex... | Generates Text based on current weights | [
"Generates",
"Text",
"based",
"on",
"current",
"weights"
] | [
"\"\"\"Generates Text based on current weights\"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
f8ad7e2af6103d97d536f837448cb3fb53ca917f | thomasvandoren/jenkins-job-builder-naginator | naginator_publisher/__init__.py | [
"Apache-2.0"
] | Python | naginator | null | def naginator(parser, xml_parent, data):
"""yaml: naginator
Automatically reschedule a build after a build failure. Requires the
Jenkins `Naginator Plugin
<https://wiki.jenkins-ci.org/display/JENKINS/Naginator+Plugin>`_
:arg int max-retries: Limits successive failed build retries. Set to 0 for
... | yaml: naginator
Automatically reschedule a build after a build failure. Requires the
Jenkins `Naginator Plugin
<https://wiki.jenkins-ci.org/display/JENKINS/Naginator+Plugin>`_
:arg int max-retries: Limits successive failed build retries. Set to 0 for
no limit. Default is 0.
:arg bool rerun-if... | naginator
Automatically reschedule a build after a build failure. Requires the
Jenkins `Naginator Plugin
`_ | [
"naginator",
"Automatically",
"reschedule",
"a",
"build",
"after",
"a",
"build",
"failure",
".",
"Requires",
"the",
"Jenkins",
"`",
"Naginator",
"Plugin",
"`",
"_"
] | def naginator(parser, xml_parent, data):
root = XML.SubElement(
xml_parent,
'com.chikli.hudson.plugin.naginator.NaginatorPublisher'
)
XML.SubElement(root, 'maxSchedule').text = str(data.get('max-retries', 0))
rerun_if_unstable = data.get('rerun-if-unstable', False)
XML.SubElement(roo... | [
"def",
"naginator",
"(",
"parser",
",",
"xml_parent",
",",
"data",
")",
":",
"root",
"=",
"XML",
".",
"SubElement",
"(",
"xml_parent",
",",
"'com.chikli.hudson.plugin.naginator.NaginatorPublisher'",
")",
"XML",
".",
"SubElement",
"(",
"root",
",",
"'maxSchedule'",... | yaml: naginator
Automatically reschedule a build after a build failure. | [
"yaml",
":",
"naginator",
"Automatically",
"reschedule",
"a",
"build",
"after",
"a",
"build",
"failure",
"."
] | [
"\"\"\"yaml: naginator\n Automatically reschedule a build after a build failure. Requires the\n Jenkins `Naginator Plugin\n <https://wiki.jenkins-ci.org/display/JENKINS/Naginator+Plugin>`_\n\n :arg int max-retries: Limits successive failed build retries. Set to 0 for\n no limit. Default is 0.\n ... | [
{
"param": "parser",
"type": null
},
{
"param": "xml_parent",
"type": null
},
{
"param": "data",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "parser",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "xml_parent",
"type": null,
"docstring": null,
"docstring_to... |
72ac11321baa1f2eb479d2a1390926f2eec48837 | Saad-K/snowflake-connector-python | ocsp_pyasn1.py | [
"Apache-2.0"
] | Python | read_cert_bundle | null | def read_cert_bundle(self, ca_bundle_file, storage=None):
"""
Reads a certificate file including certificates in PEM format
"""
if storage is None:
storage = SnowflakeOCSP.ROOT_CERTIFICATES_DICT
logger.debug('reading certificate bundle: %s', ca_bundle_file)
al... |
Reads a certificate file including certificates in PEM format
| Reads a certificate file including certificates in PEM format | [
"Reads",
"a",
"certificate",
"file",
"including",
"certificates",
"in",
"PEM",
"format"
] | def read_cert_bundle(self, ca_bundle_file, storage=None):
if storage is None:
storage = SnowflakeOCSP.ROOT_CERTIFICATES_DICT
logger.debug('reading certificate bundle: %s', ca_bundle_file)
all_certs = open(ca_bundle_file, 'rb').read()
state = 0
contents = []
fo... | [
"def",
"read_cert_bundle",
"(",
"self",
",",
"ca_bundle_file",
",",
"storage",
"=",
"None",
")",
":",
"if",
"storage",
"is",
"None",
":",
"storage",
"=",
"SnowflakeOCSP",
".",
"ROOT_CERTIFICATES_DICT",
"logger",
".",
"debug",
"(",
"'reading certificate bundle: %s'... | Reads a certificate file including certificates in PEM format | [
"Reads",
"a",
"certificate",
"file",
"including",
"certificates",
"in",
"PEM",
"format"
] | [
"\"\"\"\n Reads a certificate file including certificates in PEM format\n \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "ca_bundle_file",
"type": null
},
{
"param": "storage",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "ca_bundle_file",
"type": null,
"docstring": null,
"docstring_... |
72ac11321baa1f2eb479d2a1390926f2eec48837 | Saad-K/snowflake-connector-python | ocsp_pyasn1.py | [
"Apache-2.0"
] | Python | extract_certificate_chain | <not_specific> | def extract_certificate_chain(self, connection):
"""
Gets certificate chain and extract the key info from OpenSSL connection
"""
cert_map = OrderedDict()
logger.debug(
"# of certificates: %s",
len(connection.get_peer_cert_chain()))
for cert_openss... |
Gets certificate chain and extract the key info from OpenSSL connection
| Gets certificate chain and extract the key info from OpenSSL connection | [
"Gets",
"certificate",
"chain",
"and",
"extract",
"the",
"key",
"info",
"from",
"OpenSSL",
"connection"
] | def extract_certificate_chain(self, connection):
cert_map = OrderedDict()
logger.debug(
"# of certificates: %s",
len(connection.get_peer_cert_chain()))
for cert_openssl in connection.get_peer_cert_chain():
cert_der = dump_certificate(FILETYPE_ASN1, cert_openss... | [
"def",
"extract_certificate_chain",
"(",
"self",
",",
"connection",
")",
":",
"cert_map",
"=",
"OrderedDict",
"(",
")",
"logger",
".",
"debug",
"(",
"\"# of certificates: %s\"",
",",
"len",
"(",
"connection",
".",
"get_peer_cert_chain",
"(",
")",
")",
")",
"fo... | Gets certificate chain and extract the key info from OpenSSL connection | [
"Gets",
"certificate",
"chain",
"and",
"extract",
"the",
"key",
"info",
"from",
"OpenSSL",
"connection"
] | [
"\"\"\"\n Gets certificate chain and extract the key info from OpenSSL connection\n \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "connection",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "connection",
"type": null,
"docstring": null,
"docstring_toke... |
72ac11321baa1f2eb479d2a1390926f2eec48837 | Saad-K/snowflake-connector-python | ocsp_pyasn1.py | [
"Apache-2.0"
] | Python | create_pair_issuer_subject | <not_specific> | def create_pair_issuer_subject(self, cert_map):
"""
Creates pairs of issuer and subject certificates
"""
issuer_subject = []
for subject_der in cert_map:
cert = cert_map[subject_der]
nocheck, is_ca, ocsp_urls = self._extract_extensions(cert)
i... |
Creates pairs of issuer and subject certificates
| Creates pairs of issuer and subject certificates | [
"Creates",
"pairs",
"of",
"issuer",
"and",
"subject",
"certificates"
] | def create_pair_issuer_subject(self, cert_map):
issuer_subject = []
for subject_der in cert_map:
cert = cert_map[subject_der]
nocheck, is_ca, ocsp_urls = self._extract_extensions(cert)
if nocheck or is_ca and not ocsp_urls:
continue
issuer_... | [
"def",
"create_pair_issuer_subject",
"(",
"self",
",",
"cert_map",
")",
":",
"issuer_subject",
"=",
"[",
"]",
"for",
"subject_der",
"in",
"cert_map",
":",
"cert",
"=",
"cert_map",
"[",
"subject_der",
"]",
"nocheck",
",",
"is_ca",
",",
"ocsp_urls",
"=",
"self... | Creates pairs of issuer and subject certificates | [
"Creates",
"pairs",
"of",
"issuer",
"and",
"subject",
"certificates"
] | [
"\"\"\"\n Creates pairs of issuer and subject certificates\n \"\"\"",
"# Root certificate will not be validated",
"# but it is used to validate the subject certificate",
"# IF NO ROOT certificate is attached in the certificate chain",
"# read it from the local disk"
] | [
{
"param": "self",
"type": null
},
{
"param": "cert_map",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "cert_map",
"type": null,
"docstring": null,
"docstring_tokens... |
72ac11321baa1f2eb479d2a1390926f2eec48837 | Saad-K/snowflake-connector-python | ocsp_pyasn1.py | [
"Apache-2.0"
] | Python | _has_certs_in_ocsp_response | <not_specific> | def _has_certs_in_ocsp_response(self, certs):
"""
Check if the certificate is attached to OCSP response
"""
if SnowflakeOCSPPyasn1._get_pyasn1_version() <= 3000:
return certs is not None
else:
# behavior changed.
return certs is not None and ce... |
Check if the certificate is attached to OCSP response
| Check if the certificate is attached to OCSP response | [
"Check",
"if",
"the",
"certificate",
"is",
"attached",
"to",
"OCSP",
"response"
] | def _has_certs_in_ocsp_response(self, certs):
if SnowflakeOCSPPyasn1._get_pyasn1_version() <= 3000:
return certs is not None
else:
return certs is not None and certs.hasValue() and certs[
0].hasValue() | [
"def",
"_has_certs_in_ocsp_response",
"(",
"self",
",",
"certs",
")",
":",
"if",
"SnowflakeOCSPPyasn1",
".",
"_get_pyasn1_version",
"(",
")",
"<=",
"3000",
":",
"return",
"certs",
"is",
"not",
"None",
"else",
":",
"return",
"certs",
"is",
"not",
"None",
"and... | Check if the certificate is attached to OCSP response | [
"Check",
"if",
"the",
"certificate",
"is",
"attached",
"to",
"OCSP",
"response"
] | [
"\"\"\"\n Check if the certificate is attached to OCSP response\n \"\"\"",
"# behavior changed."
] | [
{
"param": "self",
"type": null
},
{
"param": "certs",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "certs",
"type": null,
"docstring": null,
"docstring_tokens": ... |
16453d6ddb9b8c015befa21948543dd26eccce80 | Saad-K/snowflake-connector-python | gzip_decoder.py | [
"Apache-2.0"
] | Python | decompress_raw_data | <not_specific> | def decompress_raw_data(raw_data_fd, add_bracket=True):
"""
Decompresses raw data from file like object and return
a byte array
"""
obj = zlib.decompressobj(MAGIC_NUMBER + zlib.MAX_WBITS)
writer = io.BytesIO()
if add_bracket:
writer.write(b'[')
d = raw_data_fd.read(CHUNK_SIZE)
... |
Decompresses raw data from file like object and return
a byte array
| Decompresses raw data from file like object and return
a byte array | [
"Decompresses",
"raw",
"data",
"from",
"file",
"like",
"object",
"and",
"return",
"a",
"byte",
"array"
] | def decompress_raw_data(raw_data_fd, add_bracket=True):
obj = zlib.decompressobj(MAGIC_NUMBER + zlib.MAX_WBITS)
writer = io.BytesIO()
if add_bracket:
writer.write(b'[')
d = raw_data_fd.read(CHUNK_SIZE)
while d:
writer.write(obj.decompress(d))
while obj.unused_data != b'':
... | [
"def",
"decompress_raw_data",
"(",
"raw_data_fd",
",",
"add_bracket",
"=",
"True",
")",
":",
"obj",
"=",
"zlib",
".",
"decompressobj",
"(",
"MAGIC_NUMBER",
"+",
"zlib",
".",
"MAX_WBITS",
")",
"writer",
"=",
"io",
".",
"BytesIO",
"(",
")",
"if",
"add_bracke... | Decompresses raw data from file like object and return
a byte array | [
"Decompresses",
"raw",
"data",
"from",
"file",
"like",
"object",
"and",
"return",
"a",
"byte",
"array"
] | [
"\"\"\"\n Decompresses raw data from file like object and return\n a byte array\n \"\"\""
] | [
{
"param": "raw_data_fd",
"type": null
},
{
"param": "add_bracket",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "raw_data_fd",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "add_bracket",
"type": null,
"docstring": null,
"docstr... |
16453d6ddb9b8c015befa21948543dd26eccce80 | Saad-K/snowflake-connector-python | gzip_decoder.py | [
"Apache-2.0"
] | Python | decompress_raw_data_by_zcat | <not_specific> | def decompress_raw_data_by_zcat(raw_data_fd, add_bracket=True):
"""
Experiment: Decompresses raw data from file like object and return
a byte array
"""
writer = io.BytesIO()
if add_bracket:
writer.write(b'[')
p = subprocess.Popen(["zcat"],
stdin=subprocess.PI... |
Experiment: Decompresses raw data from file like object and return
a byte array
| Decompresses raw data from file like object and return
a byte array | [
"Decompresses",
"raw",
"data",
"from",
"file",
"like",
"object",
"and",
"return",
"a",
"byte",
"array"
] | def decompress_raw_data_by_zcat(raw_data_fd, add_bracket=True):
writer = io.BytesIO()
if add_bracket:
writer.write(b'[')
p = subprocess.Popen(["zcat"],
stdin=subprocess.PIPE,
stdout=subprocess.PIPE)
writer.write(p.communicate(input=raw_data_fd.re... | [
"def",
"decompress_raw_data_by_zcat",
"(",
"raw_data_fd",
",",
"add_bracket",
"=",
"True",
")",
":",
"writer",
"=",
"io",
".",
"BytesIO",
"(",
")",
"if",
"add_bracket",
":",
"writer",
".",
"write",
"(",
"b'['",
")",
"p",
"=",
"subprocess",
".",
"Popen",
... | Experiment: Decompresses raw data from file like object and return
a byte array | [
"Experiment",
":",
"Decompresses",
"raw",
"data",
"from",
"file",
"like",
"object",
"and",
"return",
"a",
"byte",
"array"
] | [
"\"\"\"\n Experiment: Decompresses raw data from file like object and return\n a byte array\n \"\"\""
] | [
{
"param": "raw_data_fd",
"type": null
},
{
"param": "add_bracket",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "raw_data_fd",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "add_bracket",
"type": null,
"docstring": null,
"docstr... |
16453d6ddb9b8c015befa21948543dd26eccce80 | Saad-K/snowflake-connector-python | gzip_decoder.py | [
"Apache-2.0"
] | Python | decompress_raw_data_to_unicode_stream | null | def decompress_raw_data_to_unicode_stream(raw_data_fd):
"""
Decompresses a raw data in file like object and yields
a Unicode string.
"""
obj = zlib.decompressobj(MAGIC_NUMBER + zlib.MAX_WBITS)
yield u'['
d = raw_data_fd.read(CHUNK_SIZE)
while d:
yield obj.decompress(d).decode(u'u... |
Decompresses a raw data in file like object and yields
a Unicode string.
| Decompresses a raw data in file like object and yields
a Unicode string. | [
"Decompresses",
"a",
"raw",
"data",
"in",
"file",
"like",
"object",
"and",
"yields",
"a",
"Unicode",
"string",
"."
] | def decompress_raw_data_to_unicode_stream(raw_data_fd):
obj = zlib.decompressobj(MAGIC_NUMBER + zlib.MAX_WBITS)
yield u'['
d = raw_data_fd.read(CHUNK_SIZE)
while d:
yield obj.decompress(d).decode(u'utf-8')
while obj.unused_data != b'':
unused_data = obj.unused_data
... | [
"def",
"decompress_raw_data_to_unicode_stream",
"(",
"raw_data_fd",
")",
":",
"obj",
"=",
"zlib",
".",
"decompressobj",
"(",
"MAGIC_NUMBER",
"+",
"zlib",
".",
"MAX_WBITS",
")",
"yield",
"u'['",
"d",
"=",
"raw_data_fd",
".",
"read",
"(",
"CHUNK_SIZE",
")",
"whi... | Decompresses a raw data in file like object and yields
a Unicode string. | [
"Decompresses",
"a",
"raw",
"data",
"in",
"file",
"like",
"object",
"and",
"yields",
"a",
"Unicode",
"string",
"."
] | [
"\"\"\"\n Decompresses a raw data in file like object and yields\n a Unicode string.\n \"\"\""
] | [
{
"param": "raw_data_fd",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "raw_data_fd",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
8da59de07ca4858ed28c49e3341341d100c8e2fd | Saad-K/snowflake-connector-python | gcs_util.py | [
"Apache-2.0"
] | Python | create_client | <not_specific> | def create_client(stage_info, use_accelerate_endpoint=False):
"""
Creates a client object with a stage credential
:param stage_credentials: a stage credential
:param use_accelerate_endpoint: is accelerate endpoint? (inapplicable to GCS)
:return: client
"""
logger ... |
Creates a client object with a stage credential
:param stage_credentials: a stage credential
:param use_accelerate_endpoint: is accelerate endpoint? (inapplicable to GCS)
:return: client
| Creates a client object with a stage credential | [
"Creates",
"a",
"client",
"object",
"with",
"a",
"stage",
"credential"
] | def create_client(stage_info, use_accelerate_endpoint=False):
logger = getLogger(__name__)
stage_credentials = stage_info[u'creds']
security_token = stage_credentials.get(u'GCS_ACCESS_TOKEN')
if security_token:
logger.debug(u"len(GCS_ACCESS_TOKEN): %s", len(security_token))
... | [
"def",
"create_client",
"(",
"stage_info",
",",
"use_accelerate_endpoint",
"=",
"False",
")",
":",
"logger",
"=",
"getLogger",
"(",
"__name__",
")",
"stage_credentials",
"=",
"stage_info",
"[",
"u'creds'",
"]",
"security_token",
"=",
"stage_credentials",
".",
"get... | Creates a client object with a stage credential | [
"Creates",
"a",
"client",
"object",
"with",
"a",
"stage",
"credential"
] | [
"\"\"\"\n Creates a client object with a stage credential\n :param stage_credentials: a stage credential\n :param use_accelerate_endpoint: is accelerate endpoint? (inapplicable to GCS)\n :return: client\n \"\"\""
] | [
{
"param": "stage_info",
"type": null
},
{
"param": "use_accelerate_endpoint",
"type": null
}
] | {
"returns": [
{
"docstring": null,
"docstring_tokens": [
"None"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "stage_info",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": n... |
8da59de07ca4858ed28c49e3341341d100c8e2fd | Saad-K/snowflake-connector-python | gcs_util.py | [
"Apache-2.0"
] | Python | upload_file | <not_specific> | def upload_file(data_file, meta, encryption_metadata, max_concurrency):
"""
Uploads the local file to remote storage
:param data_file: file path on local system
:param meta: file meta object (contains credentials and remote location)
:param encryption_metadata: encryption metadat... |
Uploads the local file to remote storage
:param data_file: file path on local system
:param meta: file meta object (contains credentials and remote location)
:param encryption_metadata: encryption metadata to be set on object
:param max_concurrency: (inapplicable to GCS)
... | Uploads the local file to remote storage | [
"Uploads",
"the",
"local",
"file",
"to",
"remote",
"storage"
] | def upload_file(data_file, meta, encryption_metadata, max_concurrency):
logger = getLogger(__name__)
if meta.get(u'presigned_url', None):
content_encoding = ""
if meta.get(u'dst_compression_type') is not None:
content_encoding = meta[u'dst_compression_type'][u'nam... | [
"def",
"upload_file",
"(",
"data_file",
",",
"meta",
",",
"encryption_metadata",
",",
"max_concurrency",
")",
":",
"logger",
"=",
"getLogger",
"(",
"__name__",
")",
"if",
"meta",
".",
"get",
"(",
"u'presigned_url'",
",",
"None",
")",
":",
"content_encoding",
... | Uploads the local file to remote storage | [
"Uploads",
"the",
"local",
"file",
"to",
"remote",
"storage"
] | [
"\"\"\"\n Uploads the local file to remote storage\n :param data_file: file path on local system\n :param meta: file meta object (contains credentials and remote location)\n :param encryption_metadata: encryption metadata to be set on object\n :param max_concurrency: (inapplicable... | [
{
"param": "data_file",
"type": null
},
{
"param": "meta",
"type": null
},
{
"param": "encryption_metadata",
"type": null
},
{
"param": "max_concurrency",
"type": null
}
] | {
"returns": [
{
"docstring": "None, if successful. Otherwise, throws Exception.",
"docstring_tokens": [
"None",
"if",
"successful",
".",
"Otherwise",
"throws",
"Exception",
"."
],
"type": null
}
],
"raises": [],
"pa... |
8da59de07ca4858ed28c49e3341341d100c8e2fd | Saad-K/snowflake-connector-python | gcs_util.py | [
"Apache-2.0"
] | Python | _native_download_file | <not_specific> | def _native_download_file(meta, full_dst_file_name, max_concurrency):
"""
Downloads the remote object to local file
:param meta: file meta object (contains credentials and remote location)
:param full_dst_file_name: path of the local file to download to
:param max_concurrency: (i... |
Downloads the remote object to local file
:param meta: file meta object (contains credentials and remote location)
:param full_dst_file_name: path of the local file to download to
:param max_concurrency: (inapplicable to GCS)
:return: None, if successful. Otherwise, throws Excep... | Downloads the remote object to local file | [
"Downloads",
"the",
"remote",
"object",
"to",
"local",
"file"
] | def _native_download_file(meta, full_dst_file_name, max_concurrency):
logger = getLogger(__name__)
if meta.get(u'presigned_url', None):
try:
response = requests.get(meta[u'presigned_url'], stream=True)
response.raise_for_status()
with open(full... | [
"def",
"_native_download_file",
"(",
"meta",
",",
"full_dst_file_name",
",",
"max_concurrency",
")",
":",
"logger",
"=",
"getLogger",
"(",
"__name__",
")",
"if",
"meta",
".",
"get",
"(",
"u'presigned_url'",
",",
"None",
")",
":",
"try",
":",
"response",
"=",... | Downloads the remote object to local file | [
"Downloads",
"the",
"remote",
"object",
"to",
"local",
"file"
] | [
"\"\"\"\n Downloads the remote object to local file\n :param meta: file meta object (contains credentials and remote location)\n :param full_dst_file_name: path of the local file to download to\n :param max_concurrency: (inapplicable to GCS)\n :return: None, if successful. Otherwi... | [
{
"param": "meta",
"type": null
},
{
"param": "full_dst_file_name",
"type": null
},
{
"param": "max_concurrency",
"type": null
}
] | {
"returns": [
{
"docstring": "None, if successful. Otherwise, throws Exception.",
"docstring_tokens": [
"None",
"if",
"successful",
".",
"Otherwise",
"throws",
"Exception",
"."
],
"type": null
}
],
"raises": [],
"pa... |
8b81435098fe0e43454a224f0d861c57650bce4c | Saad-K/snowflake-connector-python | auth.py | [
"Apache-2.0"
] | Python | delete_temporary_credential_file | null | def delete_temporary_credential_file(
use_secure_storage_for_temporary_credential=False):
"""
Delete temporary credential file and its lock file
"""
global TEMPORARY_CREDENTIAL_FILE
if IS_LINUX or not use_secure_storage_for_temporary_credential:
try:
remove(TEMPORARY_CRED... |
Delete temporary credential file and its lock file
| Delete temporary credential file and its lock file | [
"Delete",
"temporary",
"credential",
"file",
"and",
"its",
"lock",
"file"
] | def delete_temporary_credential_file(
use_secure_storage_for_temporary_credential=False):
global TEMPORARY_CREDENTIAL_FILE
if IS_LINUX or not use_secure_storage_for_temporary_credential:
try:
remove(TEMPORARY_CREDENTIAL_FILE)
except Exception as ex:
logger.debug("... | [
"def",
"delete_temporary_credential_file",
"(",
"use_secure_storage_for_temporary_credential",
"=",
"False",
")",
":",
"global",
"TEMPORARY_CREDENTIAL_FILE",
"if",
"IS_LINUX",
"or",
"not",
"use_secure_storage_for_temporary_credential",
":",
"try",
":",
"remove",
"(",
"TEMPORA... | Delete temporary credential file and its lock file | [
"Delete",
"temporary",
"credential",
"file",
"and",
"its",
"lock",
"file"
] | [
"\"\"\"\n Delete temporary credential file and its lock file\n \"\"\""
] | [
{
"param": "use_secure_storage_for_temporary_credential",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "use_secure_storage_for_temporary_credential",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
62c9237be3177d98e7b7a8e9644d6f60657fd331 | Saad-K/snowflake-connector-python | errors.py | [
"Apache-2.0"
] | Python | default_errorhandler | null | def default_errorhandler(connection, cursor, errorclass, errorvalue):
u"""
Default error handler that raises an error
"""
raise errorclass(
msg=errorvalue.get(u'msg'),
errno=errorvalue.get(u'errno'),
sqlstate=errorvalue.get(u'sqlstate'),
sf... | u"""
Default error handler that raises an error
| u"""
Default error handler that raises an error | [
"u",
"\"",
"\"",
"\"",
"Default",
"error",
"handler",
"that",
"raises",
"an",
"error"
] | def default_errorhandler(connection, cursor, errorclass, errorvalue):
raise errorclass(
msg=errorvalue.get(u'msg'),
errno=errorvalue.get(u'errno'),
sqlstate=errorvalue.get(u'sqlstate'),
sfqid=errorvalue.get(u'sfqid'),
done_format_msg=errorvalue.get(u'd... | [
"def",
"default_errorhandler",
"(",
"connection",
",",
"cursor",
",",
"errorclass",
",",
"errorvalue",
")",
":",
"raise",
"errorclass",
"(",
"msg",
"=",
"errorvalue",
".",
"get",
"(",
"u'msg'",
")",
",",
"errno",
"=",
"errorvalue",
".",
"get",
"(",
"u'errn... | u"""
Default error handler that raises an error | [
"u",
"\"",
"\"",
"\"",
"Default",
"error",
"handler",
"that",
"raises",
"an",
"error"
] | [
"u\"\"\"\n Default error handler that raises an error\n \"\"\""
] | [
{
"param": "connection",
"type": null
},
{
"param": "cursor",
"type": null
},
{
"param": "errorclass",
"type": null
},
{
"param": "errorvalue",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "connection",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "cursor",
"type": null,
"docstring": null,
"docstring_to... |
62c9237be3177d98e7b7a8e9644d6f60657fd331 | Saad-K/snowflake-connector-python | errors.py | [
"Apache-2.0"
] | Python | errorhandler_wrapper | <not_specific> | def errorhandler_wrapper(connection, cursor, errorclass, errorvalue=None):
u"""
Error handler wrapper that calls the errorhandler method
"""
if errorvalue is None:
# no value indicates errorclass is errorobject
errorobject = errorclass
errorclass = typ... | u"""
Error handler wrapper that calls the errorhandler method
| u"""
Error handler wrapper that calls the errorhandler method | [
"u",
"\"",
"\"",
"\"",
"Error",
"handler",
"wrapper",
"that",
"calls",
"the",
"errorhandler",
"method"
] | def errorhandler_wrapper(connection, cursor, errorclass, errorvalue=None):
if errorvalue is None:
errorobject = errorclass
errorclass = type(errorobject)
errorvalue = {
u'msg': errorobject.msg,
u'errno': errorobject.errno,
u'sql... | [
"def",
"errorhandler_wrapper",
"(",
"connection",
",",
"cursor",
",",
"errorclass",
",",
"errorvalue",
"=",
"None",
")",
":",
"if",
"errorvalue",
"is",
"None",
":",
"errorobject",
"=",
"errorclass",
"errorclass",
"=",
"type",
"(",
"errorobject",
")",
"errorval... | u"""
Error handler wrapper that calls the errorhandler method | [
"u",
"\"",
"\"",
"\"",
"Error",
"handler",
"wrapper",
"that",
"calls",
"the",
"errorhandler",
"method"
] | [
"u\"\"\"\n Error handler wrapper that calls the errorhandler method\n \"\"\"",
"# no value indicates errorclass is errorobject"
] | [
{
"param": "connection",
"type": null
},
{
"param": "cursor",
"type": null
},
{
"param": "errorclass",
"type": null
},
{
"param": "errorvalue",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "connection",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "cursor",
"type": null,
"docstring": null,
"docstring_to... |
e027d0e42f2c0e59d4e59dc483583f6a85d25e79 | Saad-K/snowflake-connector-python | s3_util.py | [
"Apache-2.0"
] | Python | create_client | <not_specific> | def create_client(stage_info, use_accelerate_endpoint=False):
"""
Creates a client object with a stage credential
:param stage_credentials: a stage credential
:param use_accelerate_endpoint: is accelerate endpoint?
:return: client
"""
logger = getLogger(__name__)
... |
Creates a client object with a stage credential
:param stage_credentials: a stage credential
:param use_accelerate_endpoint: is accelerate endpoint?
:return: client
| Creates a client object with a stage credential | [
"Creates",
"a",
"client",
"object",
"with",
"a",
"stage",
"credential"
] | def create_client(stage_info, use_accelerate_endpoint=False):
logger = getLogger(__name__)
stage_credentials = stage_info[u'creds']
security_token = stage_credentials.get(u'AWS_TOKEN', None)
end_point = stage_info['endPoint']
logger.debug(u"AWS_KEY_ID: %s", stage_credentials[u'AW... | [
"def",
"create_client",
"(",
"stage_info",
",",
"use_accelerate_endpoint",
"=",
"False",
")",
":",
"logger",
"=",
"getLogger",
"(",
"__name__",
")",
"stage_credentials",
"=",
"stage_info",
"[",
"u'creds'",
"]",
"security_token",
"=",
"stage_credentials",
".",
"get... | Creates a client object with a stage credential | [
"Creates",
"a",
"client",
"object",
"with",
"a",
"stage",
"credential"
] | [
"\"\"\"\n Creates a client object with a stage credential\n :param stage_credentials: a stage credential\n :param use_accelerate_endpoint: is accelerate endpoint?\n :return: client\n \"\"\"",
"# if GS sends us an endpoint, it's likely for FIPS. Use it."
] | [
{
"param": "stage_info",
"type": null
},
{
"param": "use_accelerate_endpoint",
"type": null
}
] | {
"returns": [
{
"docstring": null,
"docstring_tokens": [
"None"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "stage_info",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": n... |
30cd214896f63b8a5b28bb988e717ee0906ad788 | Hussam-Turjman/blitzmanager | blitzmanager/logger.py | [
"BSD-3-Clause"
] | Python | progress_bar | null | def progress_bar(iteration: int, total: int, prefix='', suffix='', decimals=1, length=20, fill='█', print_end="\r"):
"""
Call in a loop to create terminal progress bar
@params:
iteration - Required : current iteration (Int)
total - Required : total iterations (Int)
prefix ... |
Call in a loop to create terminal progress bar
@params:
iteration - Required : current iteration (Int)
total - Required : total iterations (Int)
prefix - Optional : prefix string (Str)
suffix - Optional : suffix string (Str)
decimals - Optional ... | Call in a loop to create terminal progress bar | [
"Call",
"in",
"a",
"loop",
"to",
"create",
"terminal",
"progress",
"bar"
] | def progress_bar(iteration: int, total: int, prefix='', suffix='', decimals=1, length=20, fill='█', print_end="\r"):
assert isinstance(iteration, int)
assert isinstance(total, int)
percent = ("{0:." + str(decimals) + "f}").format(100 * (iteration / float(total)))
filledLength = int(length * iteration //... | [
"def",
"progress_bar",
"(",
"iteration",
":",
"int",
",",
"total",
":",
"int",
",",
"prefix",
"=",
"''",
",",
"suffix",
"=",
"''",
",",
"decimals",
"=",
"1",
",",
"length",
"=",
"20",
",",
"fill",
"=",
"'█', ",
"p",
"int_end=\"",
"\\",
"r\"):",
"",... | Call in a loop to create terminal progress bar | [
"Call",
"in",
"a",
"loop",
"to",
"create",
"terminal",
"progress",
"bar"
] | [
"\"\"\"\n Call in a loop to create terminal progress bar\n @params:\n iteration - Required : current iteration (Int)\n total - Required : total iterations (Int)\n prefix - Optional : prefix string (Str)\n suffix - Optional : suffix string (Str)\n decima... | [
{
"param": "iteration",
"type": "int"
},
{
"param": "total",
"type": "int"
},
{
"param": "prefix",
"type": null
},
{
"param": "suffix",
"type": null
},
{
"param": "decimals",
"type": null
},
{
"param": "length",
"type": null
},
{
"param": "... | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "iteration",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "total",
"type": "int",
"docstring": null,
"docstring_to... |
b7723fe62a7132bda9996aad45866fc7ce54b194 | Hussam-Turjman/blitzmanager | blitzmanager/main_manager.py | [
"BSD-3-Clause"
] | Python | arguments_parser | ArgumentsParser | def arguments_parser(self) -> ArgumentsParser:
"""
ArgumentsParser is for adding custom flags to the blitz-manager.
:return:
"""
return self.__arguments_parser |
ArgumentsParser is for adding custom flags to the blitz-manager.
:return:
| ArgumentsParser is for adding custom flags to the blitz-manager. | [
"ArgumentsParser",
"is",
"for",
"adding",
"custom",
"flags",
"to",
"the",
"blitz",
"-",
"manager",
"."
] | def arguments_parser(self) -> ArgumentsParser:
return self.__arguments_parser | [
"def",
"arguments_parser",
"(",
"self",
")",
"->",
"ArgumentsParser",
":",
"return",
"self",
".",
"__arguments_parser"
] | ArgumentsParser is for adding custom flags to the blitz-manager. | [
"ArgumentsParser",
"is",
"for",
"adding",
"custom",
"flags",
"to",
"the",
"blitz",
"-",
"manager",
"."
] | [
"\"\"\"\n ArgumentsParser is for adding custom flags to the blitz-manager.\n :return:\n \"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [
{
"docstring": null,
"docstring_tokens": [
"None"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
... |
b7723fe62a7132bda9996aad45866fc7ce54b194 | Hussam-Turjman/blitzmanager | blitzmanager/main_manager.py | [
"BSD-3-Clause"
] | Python | clear_flags | <not_specific> | def clear_flags(self):
"""
Clear all flags and their observers.
:return:
"""
self.__flags.clear()
for flag in self.__arguments_parser.flags:
delattr(self, flag)
self.__arguments_parser = ArgumentsParser(description=TOOL_DESCRIPTION)
self.__argu... |
Clear all flags and their observers.
:return:
| Clear all flags and their observers. | [
"Clear",
"all",
"flags",
"and",
"their",
"observers",
"."
] | def clear_flags(self):
self.__flags.clear()
for flag in self.__arguments_parser.flags:
delattr(self, flag)
self.__arguments_parser = ArgumentsParser(description=TOOL_DESCRIPTION)
self.__arguments_parser.flags.clear()
self.__add_default_flags()
return self | [
"def",
"clear_flags",
"(",
"self",
")",
":",
"self",
".",
"__flags",
".",
"clear",
"(",
")",
"for",
"flag",
"in",
"self",
".",
"__arguments_parser",
".",
"flags",
":",
"delattr",
"(",
"self",
",",
"flag",
")",
"self",
".",
"__arguments_parser",
"=",
"A... | Clear all flags and their observers. | [
"Clear",
"all",
"flags",
"and",
"their",
"observers",
"."
] | [
"\"\"\"\n Clear all flags and their observers.\n :return:\n \"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [
{
"docstring": null,
"docstring_tokens": [
"None"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
... |
b7723fe62a7132bda9996aad45866fc7ce54b194 | Hussam-Turjman/blitzmanager | blitzmanager/main_manager.py | [
"BSD-3-Clause"
] | Python | build_dependencies | <not_specific> | def build_dependencies(self):
"""
Build all previously added dependencies.
:return:
"""
for dep in self.__dependencies.keys():
logger.info(f"Started building : [{dep}] ..", verbose=3)
input_dir, cmake_args, delete_cache = self.__dependencies[dep]
... |
Build all previously added dependencies.
:return:
| Build all previously added dependencies. | [
"Build",
"all",
"previously",
"added",
"dependencies",
"."
] | def build_dependencies(self):
for dep in self.__dependencies.keys():
logger.info(f"Started building : [{dep}] ..", verbose=3)
input_dir, cmake_args, delete_cache = self.__dependencies[dep]
if input_dir is None and cmake_args is None:
if self.__package_manager_... | [
"def",
"build_dependencies",
"(",
"self",
")",
":",
"for",
"dep",
"in",
"self",
".",
"__dependencies",
".",
"keys",
"(",
")",
":",
"logger",
".",
"info",
"(",
"f\"Started building : [{dep}] ..\"",
",",
"verbose",
"=",
"3",
")",
"input_dir",
",",
"cmake_args"... | Build all previously added dependencies. | [
"Build",
"all",
"previously",
"added",
"dependencies",
"."
] | [
"\"\"\"\n Build all previously added dependencies.\n :return:\n \"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [
{
"docstring": null,
"docstring_tokens": [
"None"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
... |
b7723fe62a7132bda9996aad45866fc7ce54b194 | Hussam-Turjman/blitzmanager | blitzmanager/main_manager.py | [
"BSD-3-Clause"
] | Python | build_via_package_manager | <not_specific> | def build_via_package_manager(self, dependencies: List[str]):
"""
Add list of dependencies to build via the package manager.
:param dependencies:
:return:
"""
if self.__package_manager_type == SupportedManagers.NONE:
return self
for dependency in depen... |
Add list of dependencies to build via the package manager.
:param dependencies:
:return:
| Add list of dependencies to build via the package manager. | [
"Add",
"list",
"of",
"dependencies",
"to",
"build",
"via",
"the",
"package",
"manager",
"."
] | def build_via_package_manager(self, dependencies: List[str]):
if self.__package_manager_type == SupportedManagers.NONE:
return self
for dependency in dependencies:
self.__dependencies[dependency] = (None, None, None)
return self | [
"def",
"build_via_package_manager",
"(",
"self",
",",
"dependencies",
":",
"List",
"[",
"str",
"]",
")",
":",
"if",
"self",
".",
"__package_manager_type",
"==",
"SupportedManagers",
".",
"NONE",
":",
"return",
"self",
"for",
"dependency",
"in",
"dependencies",
... | Add list of dependencies to build via the package manager. | [
"Add",
"list",
"of",
"dependencies",
"to",
"build",
"via",
"the",
"package",
"manager",
"."
] | [
"\"\"\"\n Add list of dependencies to build via the package manager.\n :param dependencies:\n :return:\n \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "dependencies",
"type": "List[str]"
}
] | {
"returns": [
{
"docstring": null,
"docstring_tokens": [
"None"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
... |
f578ebe645a82eade213d06acce9eb5fdf986085 | MagicDataStructures/Trabajo01 | main.py | [
"MIT"
] | Python | is_round | <not_specific> | def is_round(x):
"""Returns True if given string is a round of chess"""
if x == '':
return False;
if x == 'O-O-O' or x == 'O-O':
return True;
if x == '1-0' or x == '0-1' or x == '0-0':
return True;
if x[-1] == '+' or x[-1] == '#':
x = x.replace('+','');
... | Returns True if given string is a round of chess | Returns True if given string is a round of chess | [
"Returns",
"True",
"if",
"given",
"string",
"is",
"a",
"round",
"of",
"chess"
] | def is_round(x):
if x == '':
return False;
if x == 'O-O-O' or x == 'O-O':
return True;
if x == '1-0' or x == '0-1' or x == '0-0':
return True;
if x[-1] == '+' or x[-1] == '#':
x = x.replace('+','');
x = x.replace('#','');
if x[-1].isupper() and is_piece_other_... | [
"def",
"is_round",
"(",
"x",
")",
":",
"if",
"x",
"==",
"''",
":",
"return",
"False",
";",
"if",
"x",
"==",
"'O-O-O'",
"or",
"x",
"==",
"'O-O'",
":",
"return",
"True",
";",
"if",
"x",
"==",
"'1-0'",
"or",
"x",
"==",
"'0-1'",
"or",
"x",
"==",
... | Returns True if given string is a round of chess | [
"Returns",
"True",
"if",
"given",
"string",
"is",
"a",
"round",
"of",
"chess"
] | [
"\"\"\"Returns True if given string is a round of chess\"\"\""
] | [
{
"param": "x",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "x",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
f578ebe645a82eade213d06acce9eb5fdf986085 | MagicDataStructures/Trabajo01 | main.py | [
"MIT"
] | Python | write_round | null | def write_round(self):
"""Prompts the user for the next moves."""
white_move = str(input("Ingresa la jugada de las blancas ")).strip();
black_move = str(input("Ingresa la jugada de las negras ")).strip();
try:
if is_round(white_move) and is_round(black_move):
... | Prompts the user for the next moves. | Prompts the user for the next moves. | [
"Prompts",
"the",
"user",
"for",
"the",
"next",
"moves",
"."
] | def write_round(self):
white_move = str(input("Ingresa la jugada de las blancas ")).strip();
black_move = str(input("Ingresa la jugada de las negras ")).strip();
try:
if is_round(white_move) and is_round(black_move):
self.game.append(white_move);
... | [
"def",
"write_round",
"(",
"self",
")",
":",
"white_move",
"=",
"str",
"(",
"input",
"(",
"\"Ingresa la jugada de las blancas \"",
")",
")",
".",
"strip",
"(",
")",
";",
"black_move",
"=",
"str",
"(",
"input",
"(",
"\"Ingresa la jugada de las negras \"",
")",
... | Prompts the user for the next moves. | [
"Prompts",
"the",
"user",
"for",
"the",
"next",
"moves",
"."
] | [
"\"\"\"Prompts the user for the next moves.\"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
f578ebe645a82eade213d06acce9eb5fdf986085 | MagicDataStructures/Trabajo01 | main.py | [
"MIT"
] | Python | display_game | null | def display_game(self):
"""Displays all the rounds up to that point."""
print('jugadas\n');
for i in range(17, int((len(self.game)/2)+1)):
print(f"{i-16}. {self.game[(2*i)-2]} {self.game[(2*i)-1]}"); | Displays all the rounds up to that point. | Displays all the rounds up to that point. | [
"Displays",
"all",
"the",
"rounds",
"up",
"to",
"that",
"point",
"."
] | def display_game(self):
print('jugadas\n');
for i in range(17, int((len(self.game)/2)+1)):
print(f"{i-16}. {self.game[(2*i)-2]} {self.game[(2*i)-1]}"); | [
"def",
"display_game",
"(",
"self",
")",
":",
"print",
"(",
"'jugadas\\n'",
")",
";",
"for",
"i",
"in",
"range",
"(",
"17",
",",
"int",
"(",
"(",
"len",
"(",
"self",
".",
"game",
")",
"/",
"2",
")",
"+",
"1",
")",
")",
":",
"print",
"(",
"f\"... | Displays all the rounds up to that point. | [
"Displays",
"all",
"the",
"rounds",
"up",
"to",
"that",
"point",
"."
] | [
"\"\"\"Displays all the rounds up to that point.\"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
f578ebe645a82eade213d06acce9eb5fdf986085 | MagicDataStructures/Trabajo01 | main.py | [
"MIT"
] | Python | modify_round | null | def modify_round(self):
"""Prompts the user to select a round to change."""
try:
ronda = int(input("Ingresa la ronda que deseas modificar "));
assert(ronda>0);
ronda += 16;
white_move = str(input("Editando posición de las blancas ")).strip();
... | Prompts the user to select a round to change. | Prompts the user to select a round to change. | [
"Prompts",
"the",
"user",
"to",
"select",
"a",
"round",
"to",
"change",
"."
] | def modify_round(self):
try:
ronda = int(input("Ingresa la ronda que deseas modificar "));
assert(ronda>0);
ronda += 16;
white_move = str(input("Editando posición de las blancas ")).strip();
black_move = str(input("Editando posición de las negras ")).s... | [
"def",
"modify_round",
"(",
"self",
")",
":",
"try",
":",
"ronda",
"=",
"int",
"(",
"input",
"(",
"\"Ingresa la ronda que deseas modificar \"",
")",
")",
";",
"assert",
"(",
"ronda",
">",
"0",
")",
";",
"ronda",
"+=",
"16",
";",
"white_move",
"=",
"str",... | Prompts the user to select a round to change. | [
"Prompts",
"the",
"user",
"to",
"select",
"a",
"round",
"to",
"change",
"."
] | [
"\"\"\"Prompts the user to select a round to change.\"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
f578ebe645a82eade213d06acce9eb5fdf986085 | MagicDataStructures/Trabajo01 | main.py | [
"MIT"
] | Python | add_round | null | def add_round(self):
"""Adds a round anywhere in the rounds."""
try:
ronda = int(input("Ingresa el número de la ronda que deseas agregar "));
assert(ronda>0);
ronda += 16;
white_move = str(input("Ingresa la jugada de las blancas ")).strip();
... | Adds a round anywhere in the rounds. | Adds a round anywhere in the rounds. | [
"Adds",
"a",
"round",
"anywhere",
"in",
"the",
"rounds",
"."
] | def add_round(self):
try:
ronda = int(input("Ingresa el número de la ronda que deseas agregar "));
assert(ronda>0);
ronda += 16;
white_move = str(input("Ingresa la jugada de las blancas ")).strip();
black_move = str(input("Ingresa la jugada de las negr... | [
"def",
"add_round",
"(",
"self",
")",
":",
"try",
":",
"ronda",
"=",
"int",
"(",
"input",
"(",
"\"Ingresa el número de la ronda que deseas agregar \")",
")",
";",
"\r",
"assert",
"(",
"ronda",
">",
"0",
")",
";",
"ronda",
"+=",
"16",
";",
"white_move",
"="... | Adds a round anywhere in the rounds. | [
"Adds",
"a",
"round",
"anywhere",
"in",
"the",
"rounds",
"."
] | [
"\"\"\"Adds a round anywhere in the rounds.\"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
75dfbfe971f9573243b913201c52849f98383088 | jay-z007/neumann-optimizer | models/optimizer/neumann.py | [
"MIT"
] | Python | step | null | def step(self, closure=None):
"""
Performs a single optimization step.
Arguments:
closure (callable, optional): A closure that reevaluates the model
and returns the loss.
"""
self.iter += 1
loss = None
if closure is not None:... |
Performs a single optimization step.
Arguments:
closure (callable, optional): A closure that reevaluates the model
and returns the loss.
| Performs a single optimization step. | [
"Performs",
"a",
"single",
"optimization",
"step",
"."
] | def step(self, closure=None):
self.iter += 1
loss = None
if closure is not None:
loss = closure()
for group in self.param_groups:
sgd_steps = group['sgd_steps']
alpha = group['alpha']
beta = group['beta']
gamma = group['gamma']... | [
"def",
"step",
"(",
"self",
",",
"closure",
"=",
"None",
")",
":",
"self",
".",
"iter",
"+=",
"1",
"loss",
"=",
"None",
"if",
"closure",
"is",
"not",
"None",
":",
"loss",
"=",
"closure",
"(",
")",
"for",
"group",
"in",
"self",
".",
"param_groups",
... | Performs a single optimization step. | [
"Performs",
"a",
"single",
"optimization",
"step",
"."
] | [
"\"\"\"\n Performs a single optimization step.\n \n Arguments:\n closure (callable, optional): A closure that reevaluates the model\n and returns the loss.\n \"\"\"",
"#checkout what's the deal with this. present in multiple pytorch optimizers",
"## update w... | [
{
"param": "self",
"type": null
},
{
"param": "closure",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "closure",
"type": null,
"docstring": "A closure that reevaluates th... |
234886016574facf1e471b32362e95e74aa0ec16 | cryptax/dextools | parseapk/parse_apk.py | [
"BSD-2-Clause"
] | Python | parse_apk | null | def parse_apk(data):
'''Parses an Android Package. This is mainly a ZIP file, but there is an APK Sig Block in addition
data = content of file
'''
for eocd in re.finditer("PK\5\6", data):
parse_eocd(data, eocd.start())
for cd in re.finditer("PK\1\2", data):
parse_cd(data, cd.start()... | Parses an Android Package. This is mainly a ZIP file, but there is an APK Sig Block in addition
data = content of file
| Parses an Android Package. This is mainly a ZIP file, but there is an APK Sig Block in addition
data = content of file | [
"Parses",
"an",
"Android",
"Package",
".",
"This",
"is",
"mainly",
"a",
"ZIP",
"file",
"but",
"there",
"is",
"an",
"APK",
"Sig",
"Block",
"in",
"addition",
"data",
"=",
"content",
"of",
"file"
] | def parse_apk(data):
for eocd in re.finditer("PK\5\6", data):
parse_eocd(data, eocd.start())
for cd in re.finditer("PK\1\2", data):
parse_cd(data, cd.start())
for lfh in re.finditer("PK\3\4", data):
parse_file(data, lfh.start())
for sb in re.finditer("APK Sig Block 42", data):
... | [
"def",
"parse_apk",
"(",
"data",
")",
":",
"for",
"eocd",
"in",
"re",
".",
"finditer",
"(",
"\"PK\\5\\6\"",
",",
"data",
")",
":",
"parse_eocd",
"(",
"data",
",",
"eocd",
".",
"start",
"(",
")",
")",
"for",
"cd",
"in",
"re",
".",
"finditer",
"(",
... | Parses an Android Package. | [
"Parses",
"an",
"Android",
"Package",
"."
] | [
"'''Parses an Android Package. This is mainly a ZIP file, but there is an APK Sig Block in addition\n data = content of file\n '''"
] | [
{
"param": "data",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "data",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
234886016574facf1e471b32362e95e74aa0ec16 | cryptax/dextools | parseapk/parse_apk.py | [
"BSD-2-Clause"
] | Python | parse_eocd | <not_specific> | def parse_eocd(data, offset):
'''Parses End of Central Directory structure in ZIP file
data = content of the entire APK
offset = offset to the beginning of EOCD
'''
print "\033[1;33;1m---------------- End of Central Directory ------------"
print "Offset: %d (0x%08x)" % (offset, offset)
eocd ... | Parses End of Central Directory structure in ZIP file
data = content of the entire APK
offset = offset to the beginning of EOCD
| Parses End of Central Directory structure in ZIP file
data = content of the entire APK
offset = offset to the beginning of EOCD | [
"Parses",
"End",
"of",
"Central",
"Directory",
"structure",
"in",
"ZIP",
"file",
"data",
"=",
"content",
"of",
"the",
"entire",
"APK",
"offset",
"=",
"offset",
"to",
"the",
"beginning",
"of",
"EOCD"
] | def parse_eocd(data, offset):
print "\033[1;33;1m---------------- End of Central Directory ------------"
print "Offset: %d (0x%08x)" % (offset, offset)
eocd = data[offset:]
signature = eocd[0:4]
disk_number = struct.unpack("<H", eocd[4:6])[0]
start_disk_number = struct.unpack("<H", eocd[6:8])[0]... | [
"def",
"parse_eocd",
"(",
"data",
",",
"offset",
")",
":",
"print",
"\"\\033[1;33;1m---------------- End of Central Directory ------------\"",
"print",
"\"Offset: %d (0x%08x)\"",
"%",
"(",
"offset",
",",
"offset",
")",
"eocd",
"=",
"data",
"[",
"offset",
":",
"]",
"... | Parses End of Central Directory structure in ZIP file
data = content of the entire APK
offset = offset to the beginning of EOCD | [
"Parses",
"End",
"of",
"Central",
"Directory",
"structure",
"in",
"ZIP",
"file",
"data",
"=",
"content",
"of",
"the",
"entire",
"APK",
"offset",
"=",
"offset",
"to",
"the",
"beginning",
"of",
"EOCD"
] | [
"'''Parses End of Central Directory structure in ZIP file\n data = content of the entire APK\n offset = offset to the beginning of EOCD\n '''",
"#print \"Tag : \", signature"
] | [
{
"param": "data",
"type": null
},
{
"param": "offset",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "data",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "offset",
"type": null,
"docstring": null,
"docstring_tokens":... |
234886016574facf1e471b32362e95e74aa0ec16 | cryptax/dextools | parseapk/parse_apk.py | [
"BSD-2-Clause"
] | Python | parse_cd | null | def parse_cd(data, offset):
'''
parses Central Directory header for ZIP file
data = content of APK
offset = offset to the beginning of CD
'''
print "\033[1;32;1m---------------- Central Directory ------------"
print "Offset: %d (0x%08x)" % (offset, offset)
cdir = data[offset:]
# par... |
parses Central Directory header for ZIP file
data = content of APK
offset = offset to the beginning of CD
| parses Central Directory header for ZIP file
data = content of APK
offset = offset to the beginning of CD | [
"parses",
"Central",
"Directory",
"header",
"for",
"ZIP",
"file",
"data",
"=",
"content",
"of",
"APK",
"offset",
"=",
"offset",
"to",
"the",
"beginning",
"of",
"CD"
] | def parse_cd(data, offset):
print "\033[1;32;1m---------------- Central Directory ------------"
print "Offset: %d (0x%08x)" % (offset, offset)
cdir = data[offset:]
signature = cdir[0:4]
version_made_by = struct.unpack("<H", cdir[4:6])[0]
print "Version made by: ", version_made_by
version_nee... | [
"def",
"parse_cd",
"(",
"data",
",",
"offset",
")",
":",
"print",
"\"\\033[1;32;1m---------------- Central Directory ------------\"",
"print",
"\"Offset: %d (0x%08x)\"",
"%",
"(",
"offset",
",",
"offset",
")",
"cdir",
"=",
"data",
"[",
"offset",
":",
"]",
"signature... | parses Central Directory header for ZIP file
data = content of APK
offset = offset to the beginning of CD | [
"parses",
"Central",
"Directory",
"header",
"for",
"ZIP",
"file",
"data",
"=",
"content",
"of",
"APK",
"offset",
"=",
"offset",
"to",
"the",
"beginning",
"of",
"CD"
] | [
"'''\n parses Central Directory header for ZIP file\n data = content of APK\n offset = offset to the beginning of CD\n '''",
"# parsing the central directory header",
"#print \"Tag: \", signature",
"#file comment",
"#After the header:"
] | [
{
"param": "data",
"type": null
},
{
"param": "offset",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "data",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "offset",
"type": null,
"docstring": null,
"docstring_tokens":... |
234886016574facf1e471b32362e95e74aa0ec16 | cryptax/dextools | parseapk/parse_apk.py | [
"BSD-2-Clause"
] | Python | parse_file | null | def parse_file(data, offset):
'''
parses Local File Header structure for ZIP file
data = content of entire APK
offset = offset to the beginning of Local File Header
'''
print "------------- Local File Header -------------------"
print "Offset: %d (0x%08x)" % (offset, offset)
lfh = data[o... |
parses Local File Header structure for ZIP file
data = content of entire APK
offset = offset to the beginning of Local File Header
| parses Local File Header structure for ZIP file
data = content of entire APK
offset = offset to the beginning of Local File Header | [
"parses",
"Local",
"File",
"Header",
"structure",
"for",
"ZIP",
"file",
"data",
"=",
"content",
"of",
"entire",
"APK",
"offset",
"=",
"offset",
"to",
"the",
"beginning",
"of",
"Local",
"File",
"Header"
] | def parse_file(data, offset):
print "------------- Local File Header -------------------"
print "Offset: %d (0x%08x)" % (offset, offset)
lfh = data[offset:]
signature = lfh[0:4]
version_needed = struct.unpack("<H", lfh[4:6])[0]
print "Version needed : ", version_needed
compressed_size = st... | [
"def",
"parse_file",
"(",
"data",
",",
"offset",
")",
":",
"print",
"\"------------- Local File Header -------------------\"",
"print",
"\"Offset: %d (0x%08x)\"",
"%",
"(",
"offset",
",",
"offset",
")",
"lfh",
"=",
"data",
"[",
"offset",
":",
"]",
"signature",
"="... | parses Local File Header structure for ZIP file
data = content of entire APK
offset = offset to the beginning of Local File Header | [
"parses",
"Local",
"File",
"Header",
"structure",
"for",
"ZIP",
"file",
"data",
"=",
"content",
"of",
"entire",
"APK",
"offset",
"=",
"offset",
"to",
"the",
"beginning",
"of",
"Local",
"File",
"Header"
] | [
"'''\n parses Local File Header structure for ZIP file\n data = content of entire APK\n offset = offset to the beginning of Local File Header\n '''",
"# file data should be placed immediately after local header"
] | [
{
"param": "data",
"type": null
},
{
"param": "offset",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "data",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "offset",
"type": null,
"docstring": null,
"docstring_tokens":... |
234886016574facf1e471b32362e95e74aa0ec16 | cryptax/dextools | parseapk/parse_apk.py | [
"BSD-2-Clause"
] | Python | parse_signing_block | null | def parse_signing_block(data, magic_offset):
'''
Parses the APK Signing block
https://source.android.com/security/apksigning/v2#apk-signing-block-format
data = content of the entire APK
magic_offset = offset of where we spotted the magic word "APK Sig Block 42"
'''
print "\033[1;34;1m-----... |
Parses the APK Signing block
https://source.android.com/security/apksigning/v2#apk-signing-block-format
data = content of the entire APK
magic_offset = offset of where we spotted the magic word "APK Sig Block 42"
|
data = content of the entire APK
magic_offset = offset of where we spotted the magic word "APK Sig Block 42" | [
"data",
"=",
"content",
"of",
"the",
"entire",
"APK",
"magic_offset",
"=",
"offset",
"of",
"where",
"we",
"spotted",
"the",
"magic",
"word",
"\"",
"APK",
"Sig",
"Block",
"42",
"\""
] | def parse_signing_block(data, magic_offset):
print "\033[1;34;1m------------- APK Signing Block -------------------"
magic = data[magic_offset:magic_offset+16]
block_size2 = struct.unpack("<Q", data[magic_offset-8:magic_offset])[0]
begin_offset = magic_offset +16 - 8 - block_size2
print "Offset: %d ... | [
"def",
"parse_signing_block",
"(",
"data",
",",
"magic_offset",
")",
":",
"print",
"\"\\033[1;34;1m------------- APK Signing Block -------------------\"",
"magic",
"=",
"data",
"[",
"magic_offset",
":",
"magic_offset",
"+",
"16",
"]",
"block_size2",
"=",
"struct",
".",
... | Parses the APK Signing block
https://source.android.com/security/apksigning/v2#apk-signing-block-format | [
"Parses",
"the",
"APK",
"Signing",
"block",
"https",
":",
"//",
"source",
".",
"android",
".",
"com",
"/",
"security",
"/",
"apksigning",
"/",
"v2#apk",
"-",
"signing",
"-",
"block",
"-",
"format"
] | [
"'''\n Parses the APK Signing block \n https://source.android.com/security/apksigning/v2#apk-signing-block-format\n\n data = content of the entire APK\n magic_offset = offset of where we spotted the magic word \"APK Sig Block 42\"\n '''",
"# we compute the beginning of the APK Signing block",
"# ... | [
{
"param": "data",
"type": null
},
{
"param": "magic_offset",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "data",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "magic_offset",
"type": null,
"docstring": null,
"docstring_to... |
234886016574facf1e471b32362e95e74aa0ec16 | cryptax/dextools | parseapk/parse_apk.py | [
"BSD-2-Clause"
] | Python | parse_public_key | <not_specific> | def parse_public_key(data, offset):
'''
parses a length prefixed public key (inside APK Signature Scheme v2 Block)
offset is the offset to the beginning of the length prefixed public key
returns: length we parsed
'''
length = struct.unpack("<L", data[offset: offset+4])[0]
print "\t\t\tSubjec... |
parses a length prefixed public key (inside APK Signature Scheme v2 Block)
offset is the offset to the beginning of the length prefixed public key
returns: length we parsed
| parses a length prefixed public key (inside APK Signature Scheme v2 Block)
offset is the offset to the beginning of the length prefixed public key
returns: length we parsed | [
"parses",
"a",
"length",
"prefixed",
"public",
"key",
"(",
"inside",
"APK",
"Signature",
"Scheme",
"v2",
"Block",
")",
"offset",
"is",
"the",
"offset",
"to",
"the",
"beginning",
"of",
"the",
"length",
"prefixed",
"public",
"key",
"returns",
":",
"length",
... | def parse_public_key(data, offset):
length = struct.unpack("<L", data[offset: offset+4])[0]
print "\t\t\tSubjectPublicKeyInfo length: ", length
return 4+length | [
"def",
"parse_public_key",
"(",
"data",
",",
"offset",
")",
":",
"length",
"=",
"struct",
".",
"unpack",
"(",
"\"<L\"",
",",
"data",
"[",
"offset",
":",
"offset",
"+",
"4",
"]",
")",
"[",
"0",
"]",
"print",
"\"\\t\\t\\tSubjectPublicKeyInfo length: \"",
","... | parses a length prefixed public key (inside APK Signature Scheme v2 Block)
offset is the offset to the beginning of the length prefixed public key
returns: length we parsed | [
"parses",
"a",
"length",
"prefixed",
"public",
"key",
"(",
"inside",
"APK",
"Signature",
"Scheme",
"v2",
"Block",
")",
"offset",
"is",
"the",
"offset",
"to",
"the",
"beginning",
"of",
"the",
"length",
"prefixed",
"public",
"key",
"returns",
":",
"length",
... | [
"'''\n parses a length prefixed public key (inside APK Signature Scheme v2 Block)\n offset is the offset to the beginning of the length prefixed public key\n returns: length we parsed\n '''",
"# public key after"
] | [
{
"param": "data",
"type": null
},
{
"param": "offset",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "data",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "offset",
"type": null,
"docstring": null,
"docstring_tokens":... |
234886016574facf1e471b32362e95e74aa0ec16 | cryptax/dextools | parseapk/parse_apk.py | [
"BSD-2-Clause"
] | Python | parse_signatures | <not_specific> | def parse_signatures(data, offset):
'''parses length prefixed sequence of signatures (inside APK Signature Scheme v2 Block)
'''
# length of sequence of signatures
total_length = struct.unpack("<L", data[offset: offset+4])[0]
print "\t\t\tTotal length of signatures: ", total_length
i = 0
... | parses length prefixed sequence of signatures (inside APK Signature Scheme v2 Block)
| parses length prefixed sequence of signatures (inside APK Signature Scheme v2 Block) | [
"parses",
"length",
"prefixed",
"sequence",
"of",
"signatures",
"(",
"inside",
"APK",
"Signature",
"Scheme",
"v2",
"Block",
")"
] | def parse_signatures(data, offset):
total_length = struct.unpack("<L", data[offset: offset+4])[0]
print "\t\t\tTotal length of signatures: ", total_length
i = 0
nb = 1
while i < (total_length + 4):
length = struct.unpack("<L", data[offset+i+4: offset+8+i])[0]
print "\t\t\tSignature s... | [
"def",
"parse_signatures",
"(",
"data",
",",
"offset",
")",
":",
"total_length",
"=",
"struct",
".",
"unpack",
"(",
"\"<L\"",
",",
"data",
"[",
"offset",
":",
"offset",
"+",
"4",
"]",
")",
"[",
"0",
"]",
"print",
"\"\\t\\t\\tTotal length of signatures: \"",
... | parses length prefixed sequence of signatures (inside APK Signature Scheme v2 Block) | [
"parses",
"length",
"prefixed",
"sequence",
"of",
"signatures",
"(",
"inside",
"APK",
"Signature",
"Scheme",
"v2",
"Block",
")"
] | [
"'''parses length prefixed sequence of signatures (inside APK Signature Scheme v2 Block)\n '''",
"# length of sequence of signatures",
"# length of signature",
"# signature algorithm id",
"# length of signature",
"# then, there is the signature"
] | [
{
"param": "data",
"type": null
},
{
"param": "offset",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "data",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "offset",
"type": null,
"docstring": null,
"docstring_tokens":... |
234886016574facf1e471b32362e95e74aa0ec16 | cryptax/dextools | parseapk/parse_apk.py | [
"BSD-2-Clause"
] | Python | parse_digest | <not_specific> | def parse_digest(data, offset):
'''parses a length prefixed digest (inside APK Signature Scheme v2 Block)
'''
length = struct.unpack("<L", data[offset: offset+4])[0]
print "\t\t\t\t\tLength of digest struct: ", length
algoid = struct.unpack("<L", data[offset+4: offset+8])[0]
print "\t\t\t\t\tDi... | parses a length prefixed digest (inside APK Signature Scheme v2 Block)
| parses a length prefixed digest (inside APK Signature Scheme v2 Block) | [
"parses",
"a",
"length",
"prefixed",
"digest",
"(",
"inside",
"APK",
"Signature",
"Scheme",
"v2",
"Block",
")"
] | def parse_digest(data, offset):
length = struct.unpack("<L", data[offset: offset+4])[0]
print "\t\t\t\t\tLength of digest struct: ", length
algoid = struct.unpack("<L", data[offset+4: offset+8])[0]
print "\t\t\t\t\tDigest algo id : %s" % (str_algo_id(algoid))
digest_len = struct.unpack("<L",... | [
"def",
"parse_digest",
"(",
"data",
",",
"offset",
")",
":",
"length",
"=",
"struct",
".",
"unpack",
"(",
"\"<L\"",
",",
"data",
"[",
"offset",
":",
"offset",
"+",
"4",
"]",
")",
"[",
"0",
"]",
"print",
"\"\\t\\t\\t\\t\\tLength of digest struct: \"",
",",
... | parses a length prefixed digest (inside APK Signature Scheme v2 Block) | [
"parses",
"a",
"length",
"prefixed",
"digest",
"(",
"inside",
"APK",
"Signature",
"Scheme",
"v2",
"Block",
")"
] | [
"'''parses a length prefixed digest (inside APK Signature Scheme v2 Block)\n '''"
] | [
{
"param": "data",
"type": null
},
{
"param": "offset",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "data",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "offset",
"type": null,
"docstring": null,
"docstring_tokens":... |
234886016574facf1e471b32362e95e74aa0ec16 | cryptax/dextools | parseapk/parse_apk.py | [
"BSD-2-Clause"
] | Python | parse_certificates | null | def parse_certificates(data, offset, length):
'''parses a sequence of certificates (inside APK Signature Scheme v2 Block)
'''
i = 0
nb = 1
while i < length:
certificate_length = struct.unpack("<L", data[offset+i: offset+i+4])[0]
print "\t\t\tCertificate #%d length=%d" % (nb, certific... | parses a sequence of certificates (inside APK Signature Scheme v2 Block)
| parses a sequence of certificates (inside APK Signature Scheme v2 Block) | [
"parses",
"a",
"sequence",
"of",
"certificates",
"(",
"inside",
"APK",
"Signature",
"Scheme",
"v2",
"Block",
")"
] | def parse_certificates(data, offset, length):
i = 0
nb = 1
while i < length:
certificate_length = struct.unpack("<L", data[offset+i: offset+i+4])[0]
print "\t\t\tCertificate #%d length=%d" % (nb, certificate_length)
certificate = data[offset+4+i:offset+4+i+certificate_length]
... | [
"def",
"parse_certificates",
"(",
"data",
",",
"offset",
",",
"length",
")",
":",
"i",
"=",
"0",
"nb",
"=",
"1",
"while",
"i",
"<",
"length",
":",
"certificate_length",
"=",
"struct",
".",
"unpack",
"(",
"\"<L\"",
",",
"data",
"[",
"offset",
"+",
"i"... | parses a sequence of certificates (inside APK Signature Scheme v2 Block) | [
"parses",
"a",
"sequence",
"of",
"certificates",
"(",
"inside",
"APK",
"Signature",
"Scheme",
"v2",
"Block",
")"
] | [
"'''parses a sequence of certificates (inside APK Signature Scheme v2 Block)\n '''"
] | [
{
"param": "data",
"type": null
},
{
"param": "offset",
"type": null
},
{
"param": "length",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "data",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "offset",
"type": null,
"docstring": null,
"docstring_tokens":... |
234886016574facf1e471b32362e95e74aa0ec16 | cryptax/dextools | parseapk/parse_apk.py | [
"BSD-2-Clause"
] | Python | parse_signed_data | <not_specific> | def parse_signed_data(data, offset):
'''parses a length prefixed signed data (inside APK Signature Scheme v2 Block)
'''
length = struct.unpack("<L", data[offset: offset+4])[0]
print "\t\t\tSigned data length=", length
# sequence of digests
total_digests_length = struct.unpack("<L", data[offset+... | parses a length prefixed signed data (inside APK Signature Scheme v2 Block)
| parses a length prefixed signed data (inside APK Signature Scheme v2 Block) | [
"parses",
"a",
"length",
"prefixed",
"signed",
"data",
"(",
"inside",
"APK",
"Signature",
"Scheme",
"v2",
"Block",
")"
] | def parse_signed_data(data, offset):
length = struct.unpack("<L", data[offset: offset+4])[0]
print "\t\t\tSigned data length=", length
total_digests_length = struct.unpack("<L", data[offset+4: offset+8])[0]
print "\t\t\t\tTotal digests length: ", total_digests_length
i = 0
nb = 1
while i < t... | [
"def",
"parse_signed_data",
"(",
"data",
",",
"offset",
")",
":",
"length",
"=",
"struct",
".",
"unpack",
"(",
"\"<L\"",
",",
"data",
"[",
"offset",
":",
"offset",
"+",
"4",
"]",
")",
"[",
"0",
"]",
"print",
"\"\\t\\t\\tSigned data length=\"",
",",
"leng... | parses a length prefixed signed data (inside APK Signature Scheme v2 Block) | [
"parses",
"a",
"length",
"prefixed",
"signed",
"data",
"(",
"inside",
"APK",
"Signature",
"Scheme",
"v2",
"Block",
")"
] | [
"'''parses a length prefixed signed data (inside APK Signature Scheme v2 Block)\n '''",
"# sequence of digests",
"# sequence of certificates",
"# sequence of attributes",
"# we are not showing the attributes"
] | [
{
"param": "data",
"type": null
},
{
"param": "offset",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "data",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "offset",
"type": null,
"docstring": null,
"docstring_tokens":... |
234886016574facf1e471b32362e95e74aa0ec16 | cryptax/dextools | parseapk/parse_apk.py | [
"BSD-2-Clause"
] | Python | parse_sigv2 | <not_specific> | def parse_sigv2(data, offset, length):
'''
offset where APK Signature Scheme v2 is stored
length of APK Signature Scheme v2 block
'''
total_signers_length = struct.unpack("<L", data[offset:offset+4])[0]
print "\t\tTotal signers length: ", total_signers_length
i = 0
nb = 1
while i < ... |
offset where APK Signature Scheme v2 is stored
length of APK Signature Scheme v2 block
| offset where APK Signature Scheme v2 is stored
length of APK Signature Scheme v2 block | [
"offset",
"where",
"APK",
"Signature",
"Scheme",
"v2",
"is",
"stored",
"length",
"of",
"APK",
"Signature",
"Scheme",
"v2",
"block"
] | def parse_sigv2(data, offset, length):
total_signers_length = struct.unpack("<L", data[offset:offset+4])[0]
print "\t\tTotal signers length: ", total_signers_length
i = 0
nb = 1
while i < total_signers_length:
signer_length = struct.unpack("<L", data[offset+i+4:offset+i+8])[0]
print ... | [
"def",
"parse_sigv2",
"(",
"data",
",",
"offset",
",",
"length",
")",
":",
"total_signers_length",
"=",
"struct",
".",
"unpack",
"(",
"\"<L\"",
",",
"data",
"[",
"offset",
":",
"offset",
"+",
"4",
"]",
")",
"[",
"0",
"]",
"print",
"\"\\t\\tTotal signers ... | offset where APK Signature Scheme v2 is stored
length of APK Signature Scheme v2 block | [
"offset",
"where",
"APK",
"Signature",
"Scheme",
"v2",
"is",
"stored",
"length",
"of",
"APK",
"Signature",
"Scheme",
"v2",
"block"
] | [
"'''\n offset where APK Signature Scheme v2 is stored\n length of APK Signature Scheme v2 block\n '''",
"# parsing each signer"
] | [
{
"param": "data",
"type": null
},
{
"param": "offset",
"type": null
},
{
"param": "length",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "data",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "offset",
"type": null,
"docstring": null,
"docstring_tokens":... |
0a5f83b88a216e12fe0a06ba8f0682df0427a2fc | octue/django-gcp | django_gcp/storage/gcloud.py | [
"MIT"
] | Python | read | <not_specific> | def read(self, num_bytes=None):
"""Read from the file-like object"""
if "r" not in self._mode:
raise AttributeError("File was not opened in read mode.")
if num_bytes is None:
num_bytes = -1
return super().read(num_bytes) | Read from the file-like object | Read from the file-like object | [
"Read",
"from",
"the",
"file",
"-",
"like",
"object"
] | def read(self, num_bytes=None):
if "r" not in self._mode:
raise AttributeError("File was not opened in read mode.")
if num_bytes is None:
num_bytes = -1
return super().read(num_bytes) | [
"def",
"read",
"(",
"self",
",",
"num_bytes",
"=",
"None",
")",
":",
"if",
"\"r\"",
"not",
"in",
"self",
".",
"_mode",
":",
"raise",
"AttributeError",
"(",
"\"File was not opened in read mode.\"",
")",
"if",
"num_bytes",
"is",
"None",
":",
"num_bytes",
"=",
... | Read from the file-like object | [
"Read",
"from",
"the",
"file",
"-",
"like",
"object"
] | [
"\"\"\"Read from the file-like object\"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "num_bytes",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "num_bytes",
"type": null,
"docstring": null,
"docstring_token... |
0a5f83b88a216e12fe0a06ba8f0682df0427a2fc | octue/django-gcp | django_gcp/storage/gcloud.py | [
"MIT"
] | Python | write | <not_specific> | def write(self, content):
"""Write to the file-like object"""
if "w" not in self._mode:
raise AttributeError("File was not opened in write mode.")
self._is_dirty = True
return super().write(to_bytes(content)) | Write to the file-like object | Write to the file-like object | [
"Write",
"to",
"the",
"file",
"-",
"like",
"object"
] | def write(self, content):
if "w" not in self._mode:
raise AttributeError("File was not opened in write mode.")
self._is_dirty = True
return super().write(to_bytes(content)) | [
"def",
"write",
"(",
"self",
",",
"content",
")",
":",
"if",
"\"w\"",
"not",
"in",
"self",
".",
"_mode",
":",
"raise",
"AttributeError",
"(",
"\"File was not opened in write mode.\"",
")",
"self",
".",
"_is_dirty",
"=",
"True",
"return",
"super",
"(",
")",
... | Write to the file-like object | [
"Write",
"to",
"the",
"file",
"-",
"like",
"object"
] | [
"\"\"\"Write to the file-like object\"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "content",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "content",
"type": null,
"docstring": null,
"docstring_tokens"... |
0a5f83b88a216e12fe0a06ba8f0682df0427a2fc | octue/django-gcp | django_gcp/storage/gcloud.py | [
"MIT"
] | Python | close | null | def close(self):
"""Close the file-like object"""
if self._file is not None:
if self._is_dirty:
blob_params = self._storage.get_object_parameters(self.name)
self.blob.upload_from_file(
self.file,
rewind=True,
... | Close the file-like object | Close the file-like object | [
"Close",
"the",
"file",
"-",
"like",
"object"
] | def close(self):
if self._file is not None:
if self._is_dirty:
blob_params = self._storage.get_object_parameters(self.name)
self.blob.upload_from_file(
self.file,
rewind=True,
content_type=self.mime_type,
... | [
"def",
"close",
"(",
"self",
")",
":",
"if",
"self",
".",
"_file",
"is",
"not",
"None",
":",
"if",
"self",
".",
"_is_dirty",
":",
"blob_params",
"=",
"self",
".",
"_storage",
".",
"get_object_parameters",
"(",
"self",
".",
"name",
")",
"self",
".",
"... | Close the file-like object | [
"Close",
"the",
"file",
"-",
"like",
"object"
] | [
"\"\"\"Close the file-like object\"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
0a5f83b88a216e12fe0a06ba8f0682df0427a2fc | octue/django-gcp | django_gcp/storage/gcloud.py | [
"MIT"
] | Python | path | null | def path(self, *args, **kwargs):
"""Get the local path of the file
This value is ALWAYS None because the path is not necessarily distinct for an object
not on the local filesystem.
This method is here for API compatibility with django's Storage class.
""" | Get the local path of the file
This value is ALWAYS None because the path is not necessarily distinct for an object
not on the local filesystem.
This method is here for API compatibility with django's Storage class.
| Get the local path of the file
This value is ALWAYS None because the path is not necessarily distinct for an object
not on the local filesystem.
This method is here for API compatibility with django's Storage class. | [
"Get",
"the",
"local",
"path",
"of",
"the",
"file",
"This",
"value",
"is",
"ALWAYS",
"None",
"because",
"the",
"path",
"is",
"not",
"necessarily",
"distinct",
"for",
"an",
"object",
"not",
"on",
"the",
"local",
"filesystem",
".",
"This",
"method",
"is",
... | def path(self, *args, **kwargs): | [
"def",
"path",
"(",
"self",
",",
"*",
"args",
",",
"**",
"kwargs",
")",
":"
] | Get the local path of the file
This value is ALWAYS None because the path is not necessarily distinct for an object
not on the local filesystem. | [
"Get",
"the",
"local",
"path",
"of",
"the",
"file",
"This",
"value",
"is",
"ALWAYS",
"None",
"because",
"the",
"path",
"is",
"not",
"necessarily",
"distinct",
"for",
"an",
"object",
"not",
"on",
"the",
"local",
"filesystem",
"."
] | [
"\"\"\"Get the local path of the file\n\n This value is ALWAYS None because the path is not necessarily distinct for an object\n not on the local filesystem.\n\n This method is here for API compatibility with django's Storage class.\n \"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
0a5f83b88a216e12fe0a06ba8f0682df0427a2fc | octue/django-gcp | django_gcp/storage/gcloud.py | [
"MIT"
] | Python | client | <not_specific> | def client(self):
"""The google-storage client for this store"""
if self._client is None:
self._client = Client(project=self.settings.project_id, credentials=self.settings.credentials)
return self._client | The google-storage client for this store | The google-storage client for this store | [
"The",
"google",
"-",
"storage",
"client",
"for",
"this",
"store"
] | def client(self):
if self._client is None:
self._client = Client(project=self.settings.project_id, credentials=self.settings.credentials)
return self._client | [
"def",
"client",
"(",
"self",
")",
":",
"if",
"self",
".",
"_client",
"is",
"None",
":",
"self",
".",
"_client",
"=",
"Client",
"(",
"project",
"=",
"self",
".",
"settings",
".",
"project_id",
",",
"credentials",
"=",
"self",
".",
"settings",
".",
"c... | The google-storage client for this store | [
"The",
"google",
"-",
"storage",
"client",
"for",
"this",
"store"
] | [
"\"\"\"The google-storage client for this store\"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
0a5f83b88a216e12fe0a06ba8f0682df0427a2fc | octue/django-gcp | django_gcp/storage/gcloud.py | [
"MIT"
] | Python | bucket | <not_specific> | def bucket(self):
"""The google-storage bucket object for this store"""
if self._bucket is None:
self._bucket = self.client.bucket(self.settings.bucket_name)
return self._bucket | The google-storage bucket object for this store | The google-storage bucket object for this store | [
"The",
"google",
"-",
"storage",
"bucket",
"object",
"for",
"this",
"store"
] | def bucket(self):
if self._bucket is None:
self._bucket = self.client.bucket(self.settings.bucket_name)
return self._bucket | [
"def",
"bucket",
"(",
"self",
")",
":",
"if",
"self",
".",
"_bucket",
"is",
"None",
":",
"self",
".",
"_bucket",
"=",
"self",
".",
"client",
".",
"bucket",
"(",
"self",
".",
"settings",
".",
"bucket_name",
")",
"return",
"self",
".",
"_bucket"
] | The google-storage bucket object for this store | [
"The",
"google",
"-",
"storage",
"bucket",
"object",
"for",
"this",
"store"
] | [
"\"\"\"The google-storage bucket object for this store\"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
0a5f83b88a216e12fe0a06ba8f0682df0427a2fc | octue/django-gcp | django_gcp/storage/gcloud.py | [
"MIT"
] | Python | url | <not_specific> | def url(self, name):
"""
Return public url or a signed url for the Blob.
This DOES NOT check for existance of Blob - that makes codes too slow
for many use cases.
"""
name = self._normalize_name(clean_name(name))
blob = self.bucket.blob(name)
blob_params =... |
Return public url or a signed url for the Blob.
This DOES NOT check for existance of Blob - that makes codes too slow
for many use cases.
| Return public url or a signed url for the Blob.
This DOES NOT check for existance of Blob - that makes codes too slow
for many use cases. | [
"Return",
"public",
"url",
"or",
"a",
"signed",
"url",
"for",
"the",
"Blob",
".",
"This",
"DOES",
"NOT",
"check",
"for",
"existance",
"of",
"Blob",
"-",
"that",
"makes",
"codes",
"too",
"slow",
"for",
"many",
"use",
"cases",
"."
] | def url(self, name):
name = self._normalize_name(clean_name(name))
blob = self.bucket.blob(name)
blob_params = self.get_object_parameters(name)
no_signed_url = (
blob_params.get("acl", self.settings.default_acl) == "publicRead" or not self.settings.querystring_auth
)
... | [
"def",
"url",
"(",
"self",
",",
"name",
")",
":",
"name",
"=",
"self",
".",
"_normalize_name",
"(",
"clean_name",
"(",
"name",
")",
")",
"blob",
"=",
"self",
".",
"bucket",
".",
"blob",
"(",
"name",
")",
"blob_params",
"=",
"self",
".",
"get_object_p... | Return public url or a signed url for the Blob. | [
"Return",
"public",
"url",
"or",
"a",
"signed",
"url",
"for",
"the",
"Blob",
"."
] | [
"\"\"\"\n Return public url or a signed url for the Blob.\n This DOES NOT check for existance of Blob - that makes codes too slow\n for many use cases.\n \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "name",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "name",
"type": null,
"docstring": null,
"docstring_tokens": [... |
fc59e2e530bbb8e0d888f08a26c20c4f1255e17c | octue/django-gcp | django_gcp/storage/settings.py | [
"MIT"
] | Python | _stores_settings | <not_specific> | def _stores_settings(self):
"""Get a complete dict of all stores defined in settings.py (media + static + extras)"""
all_stores = {
"media": getattr(django_settings, "GCP_STORAGE_MEDIA", None),
"static": getattr(django_settings, "GCP_STORAGE_STATIC", None),
**getattr(... | Get a complete dict of all stores defined in settings.py (media + static + extras) | Get a complete dict of all stores defined in settings.py (media + static + extras) | [
"Get",
"a",
"complete",
"dict",
"of",
"all",
"stores",
"defined",
"in",
"settings",
".",
"py",
"(",
"media",
"+",
"static",
"+",
"extras",
")"
] | def _stores_settings(self):
all_stores = {
"media": getattr(django_settings, "GCP_STORAGE_MEDIA", None),
"static": getattr(django_settings, "GCP_STORAGE_STATIC", None),
**getattr(django_settings, "GCP_STORAGE_EXTRA_STORES", {}),
}
return dict((k, v) for k, v i... | [
"def",
"_stores_settings",
"(",
"self",
")",
":",
"all_stores",
"=",
"{",
"\"media\"",
":",
"getattr",
"(",
"django_settings",
",",
"\"GCP_STORAGE_MEDIA\"",
",",
"None",
")",
",",
"\"static\"",
":",
"getattr",
"(",
"django_settings",
",",
"\"GCP_STORAGE_STATIC\"",... | Get a complete dict of all stores defined in settings.py (media + static + extras) | [
"Get",
"a",
"complete",
"dict",
"of",
"all",
"stores",
"defined",
"in",
"settings",
".",
"py",
"(",
"media",
"+",
"static",
"+",
"extras",
")"
] | [
"\"\"\"Get a complete dict of all stores defined in settings.py (media + static + extras)\"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
fc59e2e530bbb8e0d888f08a26c20c4f1255e17c | octue/django-gcp | django_gcp/storage/settings.py | [
"MIT"
] | Python | _store_settings | <not_specific> | def _store_settings(self):
"""Dict of store settings defined in settings.py for the current store key"""
try:
return self._stores_settings[self._store_key]
except KeyError as e:
raise ImproperlyConfigured(
f"Mismatch: specified store key '{self._store_key}... | Dict of store settings defined in settings.py for the current store key | Dict of store settings defined in settings.py for the current store key | [
"Dict",
"of",
"store",
"settings",
"defined",
"in",
"settings",
".",
"py",
"for",
"the",
"current",
"store",
"key"
] | def _store_settings(self):
try:
return self._stores_settings[self._store_key]
except KeyError as e:
raise ImproperlyConfigured(
f"Mismatch: specified store key '{self._store_key}' does not match 'media', 'static', or any store key defined in GCP_STORAGE_EXTRA_STOR... | [
"def",
"_store_settings",
"(",
"self",
")",
":",
"try",
":",
"return",
"self",
".",
"_stores_settings",
"[",
"self",
".",
"_store_key",
"]",
"except",
"KeyError",
"as",
"e",
":",
"raise",
"ImproperlyConfigured",
"(",
"f\"Mismatch: specified store key '{self._store_k... | Dict of store settings defined in settings.py for the current store key | [
"Dict",
"of",
"store",
"settings",
"defined",
"in",
"settings",
".",
"py",
"for",
"the",
"current",
"store",
"key"
] | [
"\"\"\"Dict of store settings defined in settings.py for the current store key\"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
fc59e2e530bbb8e0d888f08a26c20c4f1255e17c | octue/django-gcp | django_gcp/storage/settings.py | [
"MIT"
] | Python | _update_settings | null | def _update_settings(self):
"""Fetch settings from django configuration, merge with defaults and cache
Re-run on receiving ``setting_changed`` signal from django.
"""
# Start with the default settings
to_cache = {
**DEFAULT_GCP_SETTINGS,
**DEFAULT_GCP_ST... | Fetch settings from django configuration, merge with defaults and cache
Re-run on receiving ``setting_changed`` signal from django.
| Fetch settings from django configuration, merge with defaults and cache
Re-run on receiving ``setting_changed`` signal from django. | [
"Fetch",
"settings",
"from",
"django",
"configuration",
"merge",
"with",
"defaults",
"and",
"cache",
"Re",
"-",
"run",
"on",
"receiving",
"`",
"`",
"setting_changed",
"`",
"`",
"signal",
"from",
"django",
"."
] | def _update_settings(self):
to_cache = {
**DEFAULT_GCP_SETTINGS,
**DEFAULT_GCP_STORAGE_SETTINGS,
}
for setting_key in DEFAULT_GCP_SETTINGS.keys():
try:
to_cache[setting_key] = getattr(django_settings, f"GCP_{setting_key.upper()}")
... | [
"def",
"_update_settings",
"(",
"self",
")",
":",
"to_cache",
"=",
"{",
"**",
"DEFAULT_GCP_SETTINGS",
",",
"**",
"DEFAULT_GCP_STORAGE_SETTINGS",
",",
"}",
"for",
"setting_key",
"in",
"DEFAULT_GCP_SETTINGS",
".",
"keys",
"(",
")",
":",
"try",
":",
"to_cache",
"... | Fetch settings from django configuration, merge with defaults and cache
Re-run on receiving ``setting_changed`` signal from django. | [
"Fetch",
"settings",
"from",
"django",
"configuration",
"merge",
"with",
"defaults",
"and",
"cache",
"Re",
"-",
"run",
"on",
"receiving",
"`",
"`",
"setting_changed",
"`",
"`",
"signal",
"from",
"django",
"."
] | [
"\"\"\"Fetch settings from django configuration, merge with defaults and cache\n\n Re-run on receiving ``setting_changed`` signal from django.\n \"\"\"",
"# Start with the default settings",
"# Add GCP_ settings from settings.py (common root level settings, used by the storage module)",
"# pylin... | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
fc59e2e530bbb8e0d888f08a26c20c4f1255e17c | octue/django-gcp | django_gcp/storage/settings.py | [
"MIT"
] | Python | check | null | def check(self):
"""Check the settings on this object"""
if self.location.startswith("/"):
correct = self.location.lstrip("/\\")
raise ImproperlyConfigured(
f"'location' option in GCP_STORAGE_ cannot begin with a leading slash. Found '{self.location}'. Use '{corre... | Check the settings on this object | Check the settings on this object | [
"Check",
"the",
"settings",
"on",
"this",
"object"
] | def check(self):
if self.location.startswith("/"):
correct = self.location.lstrip("/\\")
raise ImproperlyConfigured(
f"'location' option in GCP_STORAGE_ cannot begin with a leading slash. Found '{self.location}'. Use '{correct}' instead."
) | [
"def",
"check",
"(",
"self",
")",
":",
"if",
"self",
".",
"location",
".",
"startswith",
"(",
"\"/\"",
")",
":",
"correct",
"=",
"self",
".",
"location",
".",
"lstrip",
"(",
"\"/\\\\\"",
")",
"raise",
"ImproperlyConfigured",
"(",
"f\"'location' option in GCP... | Check the settings on this object | [
"Check",
"the",
"settings",
"on",
"this",
"object"
] | [
"\"\"\"Check the settings on this object\"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
8420b54de008f4b8004f240589f2f9d9c1beab6f | octue/django-gcp | django_gcp/storage/utils.py | [
"MIT"
] | Python | safe_join | <not_specific> | def safe_join(base, *paths):
"""
A version of django.utils._os.safe_join for S3 paths.
Joins one or more path components to the base path component
intelligently. Returns a normalized version of the final path.
The final path must be located inside of the base path component
(otherwise a Value... |
A version of django.utils._os.safe_join for S3 paths.
Joins one or more path components to the base path component
intelligently. Returns a normalized version of the final path.
The final path must be located inside of the base path component
(otherwise a ValueError is raised).
Paths outside... |
The final path must be located inside of the base path component
(otherwise a ValueError is raised).
Paths outside the base path indicate a possible security
sensitive operation. | [
"The",
"final",
"path",
"must",
"be",
"located",
"inside",
"of",
"the",
"base",
"path",
"component",
"(",
"otherwise",
"a",
"ValueError",
"is",
"raised",
")",
".",
"Paths",
"outside",
"the",
"base",
"path",
"indicate",
"a",
"possible",
"security",
"sensitive... | def safe_join(base, *paths):
base_path = base
base_path = base_path.rstrip("/")
paths = [p for p in paths]
final_path = base_path + "/"
for path in paths:
_final_path = posixpath.normpath(posixpath.join(final_path, path))
if path.endswith("/") or _final_path + "/" == final_path:
... | [
"def",
"safe_join",
"(",
"base",
",",
"*",
"paths",
")",
":",
"base_path",
"=",
"base",
"base_path",
"=",
"base_path",
".",
"rstrip",
"(",
"\"/\"",
")",
"paths",
"=",
"[",
"p",
"for",
"p",
"in",
"paths",
"]",
"final_path",
"=",
"base_path",
"+",
"\"/... | A version of django.utils._os.safe_join for S3 paths. | [
"A",
"version",
"of",
"django",
".",
"utils",
".",
"_os",
".",
"safe_join",
"for",
"S3",
"paths",
"."
] | [
"\"\"\"\n A version of django.utils._os.safe_join for S3 paths.\n\n Joins one or more path components to the base path component\n intelligently. Returns a normalized version of the final path.\n\n The final path must be located inside of the base path component\n (otherwise a ValueError is raised).\... | [
{
"param": "base",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "base",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
0028aeb3d50ac04934244236f87247ad1ad5a879 | blacktorn/django-brookie | brookie/admin.py | [
"BSD-3-Clause"
] | Python | is_expired | <not_specific> | def is_expired(self):
""" Check if an invoice is expired """
now = datetime.now().date()
extra = ""
image = 'admin/img/icon-yes.svg'
days_left = (self.exp_date - now).days
if self.status == 1:
image = 'admin/img/icon-changelink.svg'
elif self.status in (2, 3):
if days_left <=... | Check if an invoice is expired | Check if an invoice is expired | [
"Check",
"if",
"an",
"invoice",
"is",
"expired"
] | def is_expired(self):
now = datetime.now().date()
extra = ""
image = 'admin/img/icon-yes.svg'
days_left = (self.exp_date - now).days
if self.status == 1:
image = 'admin/img/icon-changelink.svg'
elif self.status in (2, 3):
if days_left <= 0:
image = 'admin/img/icon-no.... | [
"def",
"is_expired",
"(",
"self",
")",
":",
"now",
"=",
"datetime",
".",
"now",
"(",
")",
".",
"date",
"(",
")",
"extra",
"=",
"\"\"",
"image",
"=",
"'admin/img/icon-yes.svg'",
"days_left",
"=",
"(",
"self",
".",
"exp_date",
"-",
"now",
")",
".",
"da... | Check if an invoice is expired | [
"Check",
"if",
"an",
"invoice",
"is",
"expired"
] | [
"\"\"\" Check if an invoice is expired \"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
0028aeb3d50ac04934244236f87247ad1ad5a879 | blacktorn/django-brookie | brookie/admin.py | [
"BSD-3-Clause"
] | Python | total_monetized | <not_specific> | def total_monetized(self):
""" Shows currency in admin, currently only euro's, pounds, sgd, sek and dollars """
if self.currency == 'euro':
return '€ %s' % euro(self.total)
elif self.currency == 'gbp':
return '£ %s' % pound(self.total)
elif self.currency == 'dollar':
r... | Shows currency in admin, currently only euro's, pounds, sgd, sek and dollars | Shows currency in admin, currently only euro's, pounds, sgd, sek and dollars | [
"Shows",
"currency",
"in",
"admin",
"currently",
"only",
"euro",
"'",
"s",
"pounds",
"sgd",
"sek",
"and",
"dollars"
] | def total_monetized(self):
if self.currency == 'euro':
return '€ %s' % euro(self.total)
elif self.currency == 'gbp':
return '£ %s' % pound(self.total)
elif self.currency == 'dollar':
return '$ %s' % pound(self.total)
if self.currency == 'sgd':
return '&d... | [
"def",
"total_monetized",
"(",
"self",
")",
":",
"if",
"self",
".",
"currency",
"==",
"'euro'",
":",
"return",
"'€ %s'",
"%",
"euro",
"(",
"self",
".",
"total",
")",
"elif",
"self",
".",
"currency",
"==",
"'gbp'",
":",
"return",
"'£ %s'",
"%",... | Shows currency in admin, currently only euro's, pounds, sgd, sek and dollars | [
"Shows",
"currency",
"in",
"admin",
"currently",
"only",
"euro",
"'",
"s",
"pounds",
"sgd",
"sek",
"and",
"dollars"
] | [
"\"\"\" Shows currency in admin, currently only euro's, pounds, sgd, sek and dollars \"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
0028aeb3d50ac04934244236f87247ad1ad5a879 | blacktorn/django-brookie | brookie/admin.py | [
"BSD-3-Clause"
] | Python | pdf_invoice | <not_specific> | def pdf_invoice(self):
""" Show link to invoice that has been sent """
filename = br_settings.BROOKIE_SAVE_PATH + '%s.pdf' % self.invoice_id
if os.path.exists(filename):
return '<a href="%(url)s">%(invoice_id)s</a>' % {'url': reverse('view-invoice', kwargs={'pk': self.pk }),
... | Show link to invoice that has been sent | Show link to invoice that has been sent | [
"Show",
"link",
"to",
"invoice",
"that",
"has",
"been",
"sent"
] | def pdf_invoice(self):
filename = br_settings.BROOKIE_SAVE_PATH + '%s.pdf' % self.invoice_id
if os.path.exists(filename):
return '<a href="%(url)s">%(invoice_id)s</a>' % {'url': reverse('view-invoice', kwargs={'pk': self.pk }),
'invoice_id': self.... | [
"def",
"pdf_invoice",
"(",
"self",
")",
":",
"filename",
"=",
"br_settings",
".",
"BROOKIE_SAVE_PATH",
"+",
"'%s.pdf'",
"%",
"self",
".",
"invoice_id",
"if",
"os",
".",
"path",
".",
"exists",
"(",
"filename",
")",
":",
"return",
"'<a href=\"%(url)s\">%(invoice... | Show link to invoice that has been sent | [
"Show",
"link",
"to",
"invoice",
"that",
"has",
"been",
"sent"
] | [
"\"\"\" Show link to invoice that has been sent \"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
aa6ba84c4c2f2ae07dccc5cbb7dddb67f3d881aa | tims/professional-services | examples/bq_file_load_benchmark/generic_benchmark_tools/benchmark_result_util.py | [
"Apache-2.0"
] | Python | insert_results_row | null | def insert_results_row(self):
"""Gathers the results of a load job into a benchmark table.
Waits until the stat of the BigQuery job is 'DONE'. Note that this may
take several minutes. Once the job stat is done, the method calls an
internal method to set the benchmark properties, and ano... | Gathers the results of a load job into a benchmark table.
Waits until the stat of the BigQuery job is 'DONE'. Note that this may
take several minutes. Once the job stat is done, the method calls an
internal method to set the benchmark properties, and another to get
a BigQuery row contai... | Gathers the results of a load job into a benchmark table.
Waits until the stat of the BigQuery job is 'DONE'. Note that this may
take several minutes. Once the job stat is done, the method calls an
internal method to set the benchmark properties, and another to get
a BigQuery row containing the benchmark properties. | [
"Gathers",
"the",
"results",
"of",
"a",
"load",
"job",
"into",
"a",
"benchmark",
"table",
".",
"Waits",
"until",
"the",
"stat",
"of",
"the",
"BigQuery",
"job",
"is",
"'",
"DONE",
"'",
".",
"Note",
"that",
"this",
"may",
"take",
"several",
"minutes",
".... | def insert_results_row(self):
job_state = self.job.state
i = 0
while job_state != 'DONE':
if i == 0:
logging.info('Job {0:s} currently in state {1:s}'.format(
self.job.job_id,
job_state,
))
loggin... | [
"def",
"insert_results_row",
"(",
"self",
")",
":",
"job_state",
"=",
"self",
".",
"job",
".",
"state",
"i",
"=",
"0",
"while",
"job_state",
"!=",
"'DONE'",
":",
"if",
"i",
"==",
"0",
":",
"logging",
".",
"info",
"(",
"'Job {0:s} currently in state {1:s}'"... | Gathers the results of a load job into a benchmark table. | [
"Gathers",
"the",
"results",
"of",
"a",
"load",
"job",
"into",
"a",
"benchmark",
"table",
"."
] | [
"\"\"\"Gathers the results of a load job into a benchmark table.\n\n Waits until the stat of the BigQuery job is 'DONE'. Note that this may\n take several minutes. Once the job stat is done, the method calls an\n internal method to set the benchmark properties, and another to get\n a Big... | [
{
"param": "self",
"type": null
}
] | {
"returns": [
{
"docstring": "A dict representing a row to be inserted into BigQuery.",
"docstring_tokens": [
"A",
"dict",
"representing",
"a",
"row",
"to",
"be",
"inserted",
"into",
"BigQuery",
"."
],
... |
2c87a0cdb78889ee6ec9e1c8439e6db3e688d4f1 | zvolsky/django-allauth | allauth/account/models.py | [
"MIT"
] | Python | change | null | def change(self, request, new_email, confirm=True):
"""
Given a new email address, change self and re-confirm.
"""
with transaction.atomic():
user_email(self.user, new_email)
self.user.save()
self.email = new_email
self.verified = False
... |
Given a new email address, change self and re-confirm.
| Given a new email address, change self and re-confirm. | [
"Given",
"a",
"new",
"email",
"address",
"change",
"self",
"and",
"re",
"-",
"confirm",
"."
] | def change(self, request, new_email, confirm=True):
with transaction.atomic():
user_email(self.user, new_email)
self.user.save()
self.email = new_email
self.verified = False
self.save()
if confirm:
self.send_confirmation(req... | [
"def",
"change",
"(",
"self",
",",
"request",
",",
"new_email",
",",
"confirm",
"=",
"True",
")",
":",
"with",
"transaction",
".",
"atomic",
"(",
")",
":",
"user_email",
"(",
"self",
".",
"user",
",",
"new_email",
")",
"self",
".",
"user",
".",
"save... | Given a new email address, change self and re-confirm. | [
"Given",
"a",
"new",
"email",
"address",
"change",
"self",
"and",
"re",
"-",
"confirm",
"."
] | [
"\"\"\"\n Given a new email address, change self and re-confirm.\n \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "request",
"type": null
},
{
"param": "new_email",
"type": null
},
{
"param": "confirm",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "request",
"type": null,
"docstring": null,
"docstring_tokens"... |
9d2923c2d5a08c4b4b9c69eb163f477b7c956990 | zvolsky/django-allauth | allauth/account/views.py | [
"MIT"
] | Python | login_on_confirm | <not_specific> | def login_on_confirm(self, confirmation):
"""
Simply logging in the user may become a security issue. If you
do not take proper care (e.g. don't purge used email
confirmations), a malicious person that got hold of the link
will be able to login over and over again and the user is... |
Simply logging in the user may become a security issue. If you
do not take proper care (e.g. don't purge used email
confirmations), a malicious person that got hold of the link
will be able to login over and over again and the user is
unable to do anything about it. Even restori... | Simply logging in the user may become a security issue. If you
do not take proper care , a malicious person that got hold of the link
will be able to login over and over again and the user is
unable to do anything about it. Even restoring their own mailbox
security will not help, as the links will still work. For
passw... | [
"Simply",
"logging",
"in",
"the",
"user",
"may",
"become",
"a",
"security",
"issue",
".",
"If",
"you",
"do",
"not",
"take",
"proper",
"care",
"a",
"malicious",
"person",
"that",
"got",
"hold",
"of",
"the",
"link",
"will",
"be",
"able",
"to",
"login",
"... | def login_on_confirm(self, confirmation):
user_pk = None
user_pk_str = get_adapter(self.request).unstash_user(self.request)
if user_pk_str:
user_pk = url_str_to_user_pk(user_pk_str)
user = confirmation.email_address.user
if user_pk == user.pk and self.request.user.is_... | [
"def",
"login_on_confirm",
"(",
"self",
",",
"confirmation",
")",
":",
"user_pk",
"=",
"None",
"user_pk_str",
"=",
"get_adapter",
"(",
"self",
".",
"request",
")",
".",
"unstash_user",
"(",
"self",
".",
"request",
")",
"if",
"user_pk_str",
":",
"user_pk",
... | Simply logging in the user may become a security issue. | [
"Simply",
"logging",
"in",
"the",
"user",
"may",
"become",
"a",
"security",
"issue",
"."
] | [
"\"\"\"\n Simply logging in the user may become a security issue. If you\n do not take proper care (e.g. don't purge used email\n confirmations), a malicious person that got hold of the link\n will be able to login over and over again and the user is\n unable to do anything about ... | [
{
"param": "self",
"type": null
},
{
"param": "confirmation",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "confirmation",
"type": null,
"docstring": null,
"docstring_to... |
020228109e981e5756c79d7ae0dcc82256c9241a | zvolsky/django-allauth | allauth/account/forms.py | [
"MIT"
] | Python | _base_signup_form_class | <not_specific> | def _base_signup_form_class():
"""
Currently, we inherit from the custom form, if any. This is all
not very elegant, though it serves a purpose:
- There are two signup forms: one for local accounts, and one for
social accounts
- Both share a common base (BaseSignupForm)
- Given the above... |
Currently, we inherit from the custom form, if any. This is all
not very elegant, though it serves a purpose:
- There are two signup forms: one for local accounts, and one for
social accounts
- Both share a common base (BaseSignupForm)
- Given the above, how to put in a custom signup form? ... | Currently, we inherit from the custom form, if any. This is all
not very elegant, though it serves a purpose.
There are two signup forms: one for local accounts, and one for
social accounts
Both share a common base (BaseSignupForm)
Given the above, how to put in a custom signup form. | [
"Currently",
"we",
"inherit",
"from",
"the",
"custom",
"form",
"if",
"any",
".",
"This",
"is",
"all",
"not",
"very",
"elegant",
"though",
"it",
"serves",
"a",
"purpose",
".",
"There",
"are",
"two",
"signup",
"forms",
":",
"one",
"for",
"local",
"accounts... | def _base_signup_form_class():
if not app_settings.SIGNUP_FORM_CLASS:
return _DummyCustomSignupForm
try:
fc_module, fc_classname = app_settings.SIGNUP_FORM_CLASS.rsplit(".", 1)
except ValueError:
raise exceptions.ImproperlyConfigured(
"%s does not point to a form" " class... | [
"def",
"_base_signup_form_class",
"(",
")",
":",
"if",
"not",
"app_settings",
".",
"SIGNUP_FORM_CLASS",
":",
"return",
"_DummyCustomSignupForm",
"try",
":",
"fc_module",
",",
"fc_classname",
"=",
"app_settings",
".",
"SIGNUP_FORM_CLASS",
".",
"rsplit",
"(",
"\".\"",... | Currently, we inherit from the custom form, if any. | [
"Currently",
"we",
"inherit",
"from",
"the",
"custom",
"form",
"if",
"any",
"."
] | [
"\"\"\"\n Currently, we inherit from the custom form, if any. This is all\n not very elegant, though it serves a purpose:\n\n - There are two signup forms: one for local accounts, and one for\n social accounts\n - Both share a common base (BaseSignupForm)\n\n - Given the above, how to put in a c... | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} |
a97ee6bc76a7c3924670794723e94e461d4d1758 | Anon-Artist/autogluon | tabular/src/autogluon/tabular/models/abstract/abstract_model.py | [
"Apache-2.0"
] | Python | _set_default_auxiliary_params | null | def _set_default_auxiliary_params(self):
"""
Sets the default aux parameters of the model.
This method should not be extended by inheriting models, instead extend _get_default_auxiliary_params.
"""
# TODO: Consider adding to get_info() output
default_auxiliary_params = se... |
Sets the default aux parameters of the model.
This method should not be extended by inheriting models, instead extend _get_default_auxiliary_params.
| Sets the default aux parameters of the model.
This method should not be extended by inheriting models, instead extend _get_default_auxiliary_params. | [
"Sets",
"the",
"default",
"aux",
"parameters",
"of",
"the",
"model",
".",
"This",
"method",
"should",
"not",
"be",
"extended",
"by",
"inheriting",
"models",
"instead",
"extend",
"_get_default_auxiliary_params",
"."
] | def _set_default_auxiliary_params(self):
default_auxiliary_params = self._get_default_auxiliary_params()
for key, value in default_auxiliary_params.items():
self._set_default_param_value(key, value, params=self.params_aux) | [
"def",
"_set_default_auxiliary_params",
"(",
"self",
")",
":",
"default_auxiliary_params",
"=",
"self",
".",
"_get_default_auxiliary_params",
"(",
")",
"for",
"key",
",",
"value",
"in",
"default_auxiliary_params",
".",
"items",
"(",
")",
":",
"self",
".",
"_set_de... | Sets the default aux parameters of the model. | [
"Sets",
"the",
"default",
"aux",
"parameters",
"of",
"the",
"model",
"."
] | [
"\"\"\"\n Sets the default aux parameters of the model.\n This method should not be extended by inheriting models, instead extend _get_default_auxiliary_params.\n \"\"\"",
"# TODO: Consider adding to get_info() output"
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
a97ee6bc76a7c3924670794723e94e461d4d1758 | Anon-Artist/autogluon | tabular/src/autogluon/tabular/models/abstract/abstract_model.py | [
"Apache-2.0"
] | Python | _get_default_auxiliary_params | dict | def _get_default_auxiliary_params(self) -> dict:
"""
Dictionary of auxiliary parameters that dictate various model-agnostic logic, such as:
Which column dtypes are filtered out of the input data, or how much memory the model is allowed to use.
"""
default_auxiliary_params = d... |
Dictionary of auxiliary parameters that dictate various model-agnostic logic, such as:
Which column dtypes are filtered out of the input data, or how much memory the model is allowed to use.
| Dictionary of auxiliary parameters that dictate various model-agnostic logic, such as:
Which column dtypes are filtered out of the input data, or how much memory the model is allowed to use. | [
"Dictionary",
"of",
"auxiliary",
"parameters",
"that",
"dictate",
"various",
"model",
"-",
"agnostic",
"logic",
"such",
"as",
":",
"Which",
"column",
"dtypes",
"are",
"filtered",
"out",
"of",
"the",
"input",
"data",
"or",
"how",
"much",
"memory",
"the",
"mod... | def _get_default_auxiliary_params(self) -> dict:
default_auxiliary_params = dict(
max_memory_usage_ratio=1.0,
max_time_limit_ratio=1.0,
max_time_limit=None,
min_time_limit=0,
ignored_type_group_special=None,
ignored_type_group_raw... | [
"def",
"_get_default_auxiliary_params",
"(",
"self",
")",
"->",
"dict",
":",
"default_auxiliary_params",
"=",
"dict",
"(",
"max_memory_usage_ratio",
"=",
"1.0",
",",
"max_time_limit_ratio",
"=",
"1.0",
",",
"max_time_limit",
"=",
"None",
",",
"min_time_limit",
"=",
... | Dictionary of auxiliary parameters that dictate various model-agnostic logic, such as:
Which column dtypes are filtered out of the input data, or how much memory the model is allowed to use. | [
"Dictionary",
"of",
"auxiliary",
"parameters",
"that",
"dictate",
"various",
"model",
"-",
"agnostic",
"logic",
"such",
"as",
":",
"Which",
"column",
"dtypes",
"are",
"filtered",
"out",
"of",
"the",
"input",
"data",
"or",
"how",
"much",
"memory",
"the",
"mod... | [
"\"\"\"\n Dictionary of auxiliary parameters that dictate various model-agnostic logic, such as:\n Which column dtypes are filtered out of the input data, or how much memory the model is allowed to use.\n \"\"\"",
"# Ratio of memory usage allowed by the model. Values > 1.0 have an increas... | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
a97ee6bc76a7c3924670794723e94e461d4d1758 | Anon-Artist/autogluon | tabular/src/autogluon/tabular/models/abstract/abstract_model.py | [
"Apache-2.0"
] | Python | _get_default_searchspace | dict | def _get_default_searchspace(self) -> dict:
"""
Get the default hyperparameter searchspace of the model.
See `autogluon.core.space` for available space classes.
Returns
-------
dict of hyperparameter search spaces.
"""
return {} |
Get the default hyperparameter searchspace of the model.
See `autogluon.core.space` for available space classes.
Returns
-------
dict of hyperparameter search spaces.
| Get the default hyperparameter searchspace of the model.
See `autogluon.core.space` for available space classes.
Returns
dict of hyperparameter search spaces. | [
"Get",
"the",
"default",
"hyperparameter",
"searchspace",
"of",
"the",
"model",
".",
"See",
"`",
"autogluon",
".",
"core",
".",
"space",
"`",
"for",
"available",
"space",
"classes",
".",
"Returns",
"dict",
"of",
"hyperparameter",
"search",
"spaces",
"."
] | def _get_default_searchspace(self) -> dict:
return {} | [
"def",
"_get_default_searchspace",
"(",
"self",
")",
"->",
"dict",
":",
"return",
"{",
"}"
] | Get the default hyperparameter searchspace of the model. | [
"Get",
"the",
"default",
"hyperparameter",
"searchspace",
"of",
"the",
"model",
"."
] | [
"\"\"\"\n Get the default hyperparameter searchspace of the model.\n See `autogluon.core.space` for available space classes.\n Returns\n -------\n dict of hyperparameter search spaces.\n \"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
a97ee6bc76a7c3924670794723e94e461d4d1758 | Anon-Artist/autogluon | tabular/src/autogluon/tabular/models/abstract/abstract_model.py | [
"Apache-2.0"
] | Python | _set_default_searchspace | null | def _set_default_searchspace(self):
""" Sets up default search space for HPO. Each hyperparameter which user did not specify is converted from
default fixed value to default search space.
"""
def_search_space = self._get_default_searchspace().copy()
# Note: when subclassing A... | Sets up default search space for HPO. Each hyperparameter which user did not specify is converted from
default fixed value to default search space.
| Sets up default search space for HPO. Each hyperparameter which user did not specify is converted from
default fixed value to default search space. | [
"Sets",
"up",
"default",
"search",
"space",
"for",
"HPO",
".",
"Each",
"hyperparameter",
"which",
"user",
"did",
"not",
"specify",
"is",
"converted",
"from",
"default",
"fixed",
"value",
"to",
"default",
"search",
"space",
"."
] | def _set_default_searchspace(self):
def_search_space = self._get_default_searchspace().copy()
for key in self.nondefault_params:
def_search_space.pop(key, None)
if self.params is not None:
self.params.update(def_search_space) | [
"def",
"_set_default_searchspace",
"(",
"self",
")",
":",
"def_search_space",
"=",
"self",
".",
"_get_default_searchspace",
"(",
")",
".",
"copy",
"(",
")",
"for",
"key",
"in",
"self",
".",
"nondefault_params",
":",
"def_search_space",
".",
"pop",
"(",
"key",
... | Sets up default search space for HPO. | [
"Sets",
"up",
"default",
"search",
"space",
"for",
"HPO",
"."
] | [
"\"\"\" Sets up default search space for HPO. Each hyperparameter which user did not specify is converted from\n default fixed value to default search space.\n \"\"\"",
"# Note: when subclassing AbstractModel, you must define or import get_default_searchspace() from the appropriate location.",
... | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
a97ee6bc76a7c3924670794723e94e461d4d1758 | Anon-Artist/autogluon | tabular/src/autogluon/tabular/models/abstract/abstract_model.py | [
"Apache-2.0"
] | Python | _preprocess | <not_specific> | def _preprocess(self, X: pd.DataFrame, **kwargs):
"""
Data transformation logic should be added here.
In bagged ensembles, preprocessing code that lives in `_preprocess` will be executed on each child model once per inference call.
If preprocessing code could produce different output dep... |
Data transformation logic should be added here.
In bagged ensembles, preprocessing code that lives in `_preprocess` will be executed on each child model once per inference call.
If preprocessing code could produce different output depending on the child model that processes the input data, then... | Data transformation logic should be added here.
In bagged ensembles, preprocessing code that lives in `_preprocess` will be executed on each child model once per inference call.
If preprocessing code could produce different output depending on the child model that processes the input data, then it must live here.
When ... | [
"Data",
"transformation",
"logic",
"should",
"be",
"added",
"here",
".",
"In",
"bagged",
"ensembles",
"preprocessing",
"code",
"that",
"lives",
"in",
"`",
"_preprocess",
"`",
"will",
"be",
"executed",
"on",
"each",
"child",
"model",
"once",
"per",
"inference",... | def _preprocess(self, X: pd.DataFrame, **kwargs):
return X | [
"def",
"_preprocess",
"(",
"self",
",",
"X",
":",
"pd",
".",
"DataFrame",
",",
"**",
"kwargs",
")",
":",
"return",
"X"
] | Data transformation logic should be added here. | [
"Data",
"transformation",
"logic",
"should",
"be",
"added",
"here",
"."
] | [
"\"\"\"\n Data transformation logic should be added here.\n In bagged ensembles, preprocessing code that lives in `_preprocess` will be executed on each child model once per inference call.\n If preprocessing code could produce different output depending on the child model that processes the in... | [
{
"param": "self",
"type": null
},
{
"param": "X",
"type": "pd.DataFrame"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "X",
"type": "pd.DataFrame",
"docstring": null,
"docstring_tok... |
a97ee6bc76a7c3924670794723e94e461d4d1758 | Anon-Artist/autogluon | tabular/src/autogluon/tabular/models/abstract/abstract_model.py | [
"Apache-2.0"
] | Python | _preprocess_nonadaptive | pd.DataFrame | def _preprocess_nonadaptive(self, X: pd.DataFrame, **kwargs) -> pd.DataFrame:
"""
Note: This method is intended for advanced users. It is usually sufficient to implement all preprocessing in `_preprocess` and leave this method untouched.
The potential benefit of implementing preprocessing in... |
Note: This method is intended for advanced users. It is usually sufficient to implement all preprocessing in `_preprocess` and leave this method untouched.
The potential benefit of implementing preprocessing in this method is an inference speedup when used in a bagged ensemble.
Data transfo... | This method is intended for advanced users. It is usually sufficient to implement all preprocessing in `_preprocess` and leave this method untouched.
The potential benefit of implementing preprocessing in this method is an inference speedup when used in a bagged ensemble.
Data transformation logic that is non-stateful ... | [
"This",
"method",
"is",
"intended",
"for",
"advanced",
"users",
".",
"It",
"is",
"usually",
"sufficient",
"to",
"implement",
"all",
"preprocessing",
"in",
"`",
"_preprocess",
"`",
"and",
"leave",
"this",
"method",
"untouched",
".",
"The",
"potential",
"benefit... | def _preprocess_nonadaptive(self, X: pd.DataFrame, **kwargs) -> pd.DataFrame:
if self.features is None:
self._preprocess_set_features(X=X)
if list(X.columns) != self.features:
X = X[self.features]
return X | [
"def",
"_preprocess_nonadaptive",
"(",
"self",
",",
"X",
":",
"pd",
".",
"DataFrame",
",",
"**",
"kwargs",
")",
"->",
"pd",
".",
"DataFrame",
":",
"if",
"self",
".",
"features",
"is",
"None",
":",
"self",
".",
"_preprocess_set_features",
"(",
"X",
"=",
... | Note: This method is intended for advanced users. | [
"Note",
":",
"This",
"method",
"is",
"intended",
"for",
"advanced",
"users",
"."
] | [
"\"\"\"\n Note: This method is intended for advanced users. It is usually sufficient to implement all preprocessing in `_preprocess` and leave this method untouched.\n The potential benefit of implementing preprocessing in this method is an inference speedup when used in a bagged ensemble.\n ... | [
{
"param": "self",
"type": null
},
{
"param": "X",
"type": "pd.DataFrame"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "X",
"type": "pd.DataFrame",
"docstring": null,
"docstring_tok... |
a97ee6bc76a7c3924670794723e94e461d4d1758 | Anon-Artist/autogluon | tabular/src/autogluon/tabular/models/abstract/abstract_model.py | [
"Apache-2.0"
] | Python | save | str | def save(self, path: str = None, verbose=True) -> str:
"""
Saves the model to disk.
Parameters
----------
path : str, default None
Path to the saved model, minus the file name.
This should generally be a directory path ending with a '/' character (or appro... |
Saves the model to disk.
Parameters
----------
path : str, default None
Path to the saved model, minus the file name.
This should generally be a directory path ending with a '/' character (or appropriate path separator value depending on OS).
If None,... | Saves the model to disk.
Parameters
path : str, default None
Path to the saved model, minus the file name.
This should generally be a directory path ending with a '/' character (or appropriate path separator value depending on OS).
If None, self.path is used.
The final model file is typically saved to path + self.mode... | [
"Saves",
"the",
"model",
"to",
"disk",
".",
"Parameters",
"path",
":",
"str",
"default",
"None",
"Path",
"to",
"the",
"saved",
"model",
"minus",
"the",
"file",
"name",
".",
"This",
"should",
"generally",
"be",
"a",
"directory",
"path",
"ending",
"with",
... | def save(self, path: str = None, verbose=True) -> str:
if path is None:
path = self.path
file_path = path + self.model_file_name
save_pkl.save(path=file_path, object=self, verbose=verbose)
return path | [
"def",
"save",
"(",
"self",
",",
"path",
":",
"str",
"=",
"None",
",",
"verbose",
"=",
"True",
")",
"->",
"str",
":",
"if",
"path",
"is",
"None",
":",
"path",
"=",
"self",
".",
"path",
"file_path",
"=",
"path",
"+",
"self",
".",
"model_file_name",
... | Saves the model to disk. | [
"Saves",
"the",
"model",
"to",
"disk",
"."
] | [
"\"\"\"\n Saves the model to disk.\n Parameters\n ----------\n path : str, default None\n Path to the saved model, minus the file name.\n This should generally be a directory path ending with a '/' character (or appropriate path separator value depending on OS).\n ... | [
{
"param": "self",
"type": null
},
{
"param": "path",
"type": "str"
},
{
"param": "verbose",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "path",
"type": "str",
"docstring": null,
"docstring_tokens": ... |
a97ee6bc76a7c3924670794723e94e461d4d1758 | Anon-Artist/autogluon | tabular/src/autogluon/tabular/models/abstract/abstract_model.py | [
"Apache-2.0"
] | Python | load | <not_specific> | def load(cls, path: str, reset_paths=True, verbose=True):
"""
Loads the model from disk to memory.
Parameters
----------
path : str
Path to the saved model, minus the file name.
This should generally be a directory path ending with a '/' character (or appr... |
Loads the model from disk to memory.
Parameters
----------
path : str
Path to the saved model, minus the file name.
This should generally be a directory path ending with a '/' character (or appropriate path separator value depending on OS).
The model ... | Loads the model from disk to memory.
Parameters
path : str
Path to the saved model, minus the file name.
This should generally be a directory path ending with a '/' character (or appropriate path separator value depending on OS).
The model file is typically located in path + cls.model_file_name.
reset_paths : bool, de... | [
"Loads",
"the",
"model",
"from",
"disk",
"to",
"memory",
".",
"Parameters",
"path",
":",
"str",
"Path",
"to",
"the",
"saved",
"model",
"minus",
"the",
"file",
"name",
".",
"This",
"should",
"generally",
"be",
"a",
"directory",
"path",
"ending",
"with",
"... | def load(cls, path: str, reset_paths=True, verbose=True):
file_path = path + cls.model_file_name
model = load_pkl.load(path=file_path, verbose=verbose)
if reset_paths:
model.set_contexts(path)
return model | [
"def",
"load",
"(",
"cls",
",",
"path",
":",
"str",
",",
"reset_paths",
"=",
"True",
",",
"verbose",
"=",
"True",
")",
":",
"file_path",
"=",
"path",
"+",
"cls",
".",
"model_file_name",
"model",
"=",
"load_pkl",
".",
"load",
"(",
"path",
"=",
"file_p... | Loads the model from disk to memory. | [
"Loads",
"the",
"model",
"from",
"disk",
"to",
"memory",
"."
] | [
"\"\"\"\n Loads the model from disk to memory.\n Parameters\n ----------\n path : str\n Path to the saved model, minus the file name.\n This should generally be a directory path ending with a '/' character (or appropriate path separator value depending on OS).\n ... | [
{
"param": "cls",
"type": null
},
{
"param": "path",
"type": "str"
},
{
"param": "reset_paths",
"type": null
},
{
"param": "verbose",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "cls",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "path",
"type": "str",
"docstring": null,
"docstring_tokens": [... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.