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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
f58f0819a653619fc7f825807046e9ed22784e59 | priyankabanda2202/lale | lale/search/schema2search_space.py | [
"Apache-2.0"
] | Python | op_to_search_space | SearchSpace | def op_to_search_space(
op: PlannedOperator, pgo: Optional[PGO] = None, data_schema={}
) -> SearchSpace:
"""Given an operator, this method compiles its schemas into a SearchSpace"""
search_space = SearchSpaceOperatorVisitor.run(op, pgo=pgo, data_schema=data_schema)
if should_print_search_space("true", ... | Given an operator, this method compiles its schemas into a SearchSpace | Given an operator, this method compiles its schemas into a SearchSpace | [
"Given",
"an",
"operator",
"this",
"method",
"compiles",
"its",
"schemas",
"into",
"a",
"SearchSpace"
] | def op_to_search_space(
op: PlannedOperator, pgo: Optional[PGO] = None, data_schema={}
) -> SearchSpace:
search_space = SearchSpaceOperatorVisitor.run(op, pgo=pgo, data_schema=data_schema)
if should_print_search_space("true", "all", "search_space"):
name = op.name()
if not name:
... | [
"def",
"op_to_search_space",
"(",
"op",
":",
"PlannedOperator",
",",
"pgo",
":",
"Optional",
"[",
"PGO",
"]",
"=",
"None",
",",
"data_schema",
"=",
"{",
"}",
")",
"->",
"SearchSpace",
":",
"search_space",
"=",
"SearchSpaceOperatorVisitor",
".",
"run",
"(",
... | Given an operator, this method compiles its schemas into a SearchSpace | [
"Given",
"an",
"operator",
"this",
"method",
"compiles",
"its",
"schemas",
"into",
"a",
"SearchSpace"
] | [
"\"\"\"Given an operator, this method compiles its schemas into a SearchSpace\"\"\""
] | [
{
"param": "op",
"type": "PlannedOperator"
},
{
"param": "pgo",
"type": "Optional[PGO]"
},
{
"param": "data_schema",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "op",
"type": "PlannedOperator",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "pgo",
"type": "Optional[PGO]",
"docstring": null,
... |
f58f0819a653619fc7f825807046e9ed22784e59 | priyankabanda2202/lale | lale/search/schema2search_space.py | [
"Apache-2.0"
] | Python | add_sub_space | <not_specific> | def add_sub_space(space, k, v):
"""Given a search space and a "key",
if the defined subschema does not exist,
set it to be the constant v space
"""
# TODO!
# I should parse __ and such and walk down the schema
if isinstance(space, SearchSpaceObject):
if k not in space.keys:
... | Given a search space and a "key",
if the defined subschema does not exist,
set it to be the constant v space
| Given a search space and a "key",
if the defined subschema does not exist,
set it to be the constant v space | [
"Given",
"a",
"search",
"space",
"and",
"a",
"\"",
"key",
"\"",
"if",
"the",
"defined",
"subschema",
"does",
"not",
"exist",
"set",
"it",
"to",
"be",
"the",
"constant",
"v",
"space"
] | def add_sub_space(space, k, v):
if isinstance(space, SearchSpaceObject):
if k not in space.keys:
space.keys.append(k)
space.choices = (c + (SearchSpaceConstant(v),) for c in space.choices)
return | [
"def",
"add_sub_space",
"(",
"space",
",",
"k",
",",
"v",
")",
":",
"if",
"isinstance",
"(",
"space",
",",
"SearchSpaceObject",
")",
":",
"if",
"k",
"not",
"in",
"space",
".",
"keys",
":",
"space",
".",
"keys",
".",
"append",
"(",
"k",
")",
"space"... | Given a search space and a "key",
if the defined subschema does not exist,
set it to be the constant v space | [
"Given",
"a",
"search",
"space",
"and",
"a",
"\"",
"key",
"\"",
"if",
"the",
"defined",
"subschema",
"does",
"not",
"exist",
"set",
"it",
"to",
"be",
"the",
"constant",
"v",
"space"
] | [
"\"\"\"Given a search space and a \"key\",\n if the defined subschema does not exist,\n set it to be the constant v space\n \"\"\"",
"# TODO!",
"# I should parse __ and such and walk down the schema"
] | [
{
"param": "space",
"type": null
},
{
"param": "k",
"type": null
},
{
"param": "v",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "space",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "k",
"type": null,
"docstring": null,
"docstring_tokens": [],... |
cf736b095426ec2d9e238927415a58e3ca8739e5 | priyankabanda2202/lale | lale/search/lale_grid_search_cv.py | [
"Apache-2.0"
] | Python | SearchSpaceNumberToGSValues | List[GSValue] | def SearchSpaceNumberToGSValues(
key: str, hp: SearchSpaceNumber, num_samples: Optional[int] = None
) -> List[GSValue]:
"""Returns either a list of values intended to be sampled uniformly"""
samples: int
if num_samples is None:
samples = DEFAULT_SAMPLES_PER_DISTRIBUTION
else:
samples... | Returns either a list of values intended to be sampled uniformly | Returns either a list of values intended to be sampled uniformly | [
"Returns",
"either",
"a",
"list",
"of",
"values",
"intended",
"to",
"be",
"sampled",
"uniformly"
] | def SearchSpaceNumberToGSValues(
key: str, hp: SearchSpaceNumber, num_samples: Optional[int] = None
) -> List[GSValue]:
samples: int
if num_samples is None:
samples = DEFAULT_SAMPLES_PER_DISTRIBUTION
else:
samples = num_samples
if hp.pgo is not None:
ret = list(hp.pgo.samples... | [
"def",
"SearchSpaceNumberToGSValues",
"(",
"key",
":",
"str",
",",
"hp",
":",
"SearchSpaceNumber",
",",
"num_samples",
":",
"Optional",
"[",
"int",
"]",
"=",
"None",
")",
"->",
"List",
"[",
"GSValue",
"]",
":",
"samples",
":",
"int",
"if",
"num_samples",
... | Returns either a list of values intended to be sampled uniformly | [
"Returns",
"either",
"a",
"list",
"of",
"values",
"intended",
"to",
"be",
"sampled",
"uniformly"
] | [
"\"\"\"Returns either a list of values intended to be sampled uniformly\"\"\"",
"# Add preliminary support for PGO",
"# if we are not doing PGO",
"# always use the default as one of the samples",
"# TODO: ensure that the default is valid according to the schema"
] | [
{
"param": "key",
"type": "str"
},
{
"param": "hp",
"type": "SearchSpaceNumber"
},
{
"param": "num_samples",
"type": "Optional[int]"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "key",
"type": "str",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "hp",
"type": "SearchSpaceNumber",
"docstring": null,
"docstri... |
acdf0610a65efd0f889c4f553b4bc57fc67ef916 | priyankabanda2202/lale | lale/search/PGO.py | [
"Apache-2.0"
] | Python | freqsAsIntegerValues | Iterator[Tuple[Defaultable[int], int]] | def freqsAsIntegerValues(
freqs: Iterable[Tuple[Any, int]],
inclusive_min: Optional[float] = None,
inclusive_max: Optional[float] = None,
) -> Iterator[Tuple[Defaultable[int], int]]:
"""maps the str values to integers, and skips anything that does not look like an integer"""
for v, f in freqs:
... | maps the str values to integers, and skips anything that does not look like an integer | maps the str values to integers, and skips anything that does not look like an integer | [
"maps",
"the",
"str",
"values",
"to",
"integers",
"and",
"skips",
"anything",
"that",
"does",
"not",
"look",
"like",
"an",
"integer"
] | def freqsAsIntegerValues(
freqs: Iterable[Tuple[Any, int]],
inclusive_min: Optional[float] = None,
inclusive_max: Optional[float] = None,
) -> Iterator[Tuple[Defaultable[int], int]]:
for v, f in freqs:
try:
if v == DEFAULT_STR:
yield _default_value, f
... | [
"def",
"freqsAsIntegerValues",
"(",
"freqs",
":",
"Iterable",
"[",
"Tuple",
"[",
"Any",
",",
"int",
"]",
"]",
",",
"inclusive_min",
":",
"Optional",
"[",
"float",
"]",
"=",
"None",
",",
"inclusive_max",
":",
"Optional",
"[",
"float",
"]",
"=",
"None",
... | maps the str values to integers, and skips anything that does not look like an integer | [
"maps",
"the",
"str",
"values",
"to",
"integers",
"and",
"skips",
"anything",
"that",
"does",
"not",
"look",
"like",
"an",
"integer"
] | [
"\"\"\"maps the str values to integers, and skips anything that does not look like an integer\"\"\""
] | [
{
"param": "freqs",
"type": "Iterable[Tuple[Any, int]]"
},
{
"param": "inclusive_min",
"type": "Optional[float]"
},
{
"param": "inclusive_max",
"type": "Optional[float]"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "freqs",
"type": "Iterable[Tuple[Any, int]]",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "inclusive_min",
"type": "Optional[float]",
... |
acdf0610a65efd0f889c4f553b4bc57fc67ef916 | priyankabanda2202/lale | lale/search/PGO.py | [
"Apache-2.0"
] | Python | freqsAsFloatValues | Iterator[Tuple[Defaultable[float], int]] | def freqsAsFloatValues(
freqs: Iterable[Tuple[Any, int]],
inclusive_min: Optional[float] = None,
inclusive_max: Optional[float] = None,
) -> Iterator[Tuple[Defaultable[float], int]]:
"""maps the str values to integers, and skips anything that does not look like an integer"""
for v, f in freqs:
... | maps the str values to integers, and skips anything that does not look like an integer | maps the str values to integers, and skips anything that does not look like an integer | [
"maps",
"the",
"str",
"values",
"to",
"integers",
"and",
"skips",
"anything",
"that",
"does",
"not",
"look",
"like",
"an",
"integer"
] | def freqsAsFloatValues(
freqs: Iterable[Tuple[Any, int]],
inclusive_min: Optional[float] = None,
inclusive_max: Optional[float] = None,
) -> Iterator[Tuple[Defaultable[float], int]]:
for v, f in freqs:
try:
if v == DEFAULT_STR:
yield _default_value, f
... | [
"def",
"freqsAsFloatValues",
"(",
"freqs",
":",
"Iterable",
"[",
"Tuple",
"[",
"Any",
",",
"int",
"]",
"]",
",",
"inclusive_min",
":",
"Optional",
"[",
"float",
"]",
"=",
"None",
",",
"inclusive_max",
":",
"Optional",
"[",
"float",
"]",
"=",
"None",
",... | maps the str values to integers, and skips anything that does not look like an integer | [
"maps",
"the",
"str",
"values",
"to",
"integers",
"and",
"skips",
"anything",
"that",
"does",
"not",
"look",
"like",
"an",
"integer"
] | [
"\"\"\"maps the str values to integers, and skips anything that does not look like an integer\"\"\""
] | [
{
"param": "freqs",
"type": "Iterable[Tuple[Any, int]]"
},
{
"param": "inclusive_min",
"type": "Optional[float]"
},
{
"param": "inclusive_max",
"type": "Optional[float]"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "freqs",
"type": "Iterable[Tuple[Any, int]]",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "inclusive_min",
"type": "Optional[float]",
... |
acdf0610a65efd0f889c4f553b4bc57fc67ef916 | priyankabanda2202/lale | lale/search/PGO.py | [
"Apache-2.0"
] | Python | freqsAsEnumValues | Iterator[Tuple[Defaultable[Any], int]] | def freqsAsEnumValues(
freqs: Iterable[Tuple[Any, int]], values: List[Any]
) -> Iterator[Tuple[Defaultable[Any], int]]:
"""only keeps things that match the string representation of values in the enumeration.
converts from the string to the value as represented in the enumeration.
"""
def as_str(v) ... | only keeps things that match the string representation of values in the enumeration.
converts from the string to the value as represented in the enumeration.
| only keeps things that match the string representation of values in the enumeration.
converts from the string to the value as represented in the enumeration. | [
"only",
"keeps",
"things",
"that",
"match",
"the",
"string",
"representation",
"of",
"values",
"in",
"the",
"enumeration",
".",
"converts",
"from",
"the",
"string",
"to",
"the",
"value",
"as",
"represented",
"in",
"the",
"enumeration",
"."
] | def freqsAsEnumValues(
freqs: Iterable[Tuple[Any, int]], values: List[Any]
) -> Iterator[Tuple[Defaultable[Any], int]]:
def as_str(v) -> str:
if v is None:
return "none"
elif v is True:
return "true"
elif v is False:
return "false"
else:
... | [
"def",
"freqsAsEnumValues",
"(",
"freqs",
":",
"Iterable",
"[",
"Tuple",
"[",
"Any",
",",
"int",
"]",
"]",
",",
"values",
":",
"List",
"[",
"Any",
"]",
")",
"->",
"Iterator",
"[",
"Tuple",
"[",
"Defaultable",
"[",
"Any",
"]",
",",
"int",
"]",
"]",
... | only keeps things that match the string representation of values in the enumeration. | [
"only",
"keeps",
"things",
"that",
"match",
"the",
"string",
"representation",
"of",
"values",
"in",
"the",
"enumeration",
"."
] | [
"\"\"\"only keeps things that match the string representation of values in the enumeration.\n converts from the string to the value as represented in the enumeration.\n \"\"\"",
"\"\"\"There are some quirks in how the PGO files\n encodes values relative to python's str method\n \"\"\""
] | [
{
"param": "freqs",
"type": "Iterable[Tuple[Any, int]]"
},
{
"param": "values",
"type": "List[Any]"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "freqs",
"type": "Iterable[Tuple[Any, int]]",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "values",
"type": "List[Any]",
"docstring": ... |
acdf0610a65efd0f889c4f553b4bc57fc67ef916 | priyankabanda2202/lale | lale/search/PGO.py | [
"Apache-2.0"
] | Python | as_str | str | def as_str(v) -> str:
"""There are some quirks in how the PGO files
encodes values relative to python's str method
"""
if v is None:
return "none"
elif v is True:
return "true"
elif v is False:
return "false"
else:
r... | There are some quirks in how the PGO files
encodes values relative to python's str method
| There are some quirks in how the PGO files
encodes values relative to python's str method | [
"There",
"are",
"some",
"quirks",
"in",
"how",
"the",
"PGO",
"files",
"encodes",
"values",
"relative",
"to",
"python",
"'",
"s",
"str",
"method"
] | def as_str(v) -> str:
if v is None:
return "none"
elif v is True:
return "true"
elif v is False:
return "false"
else:
return str(v) | [
"def",
"as_str",
"(",
"v",
")",
"->",
"str",
":",
"if",
"v",
"is",
"None",
":",
"return",
"\"none\"",
"elif",
"v",
"is",
"True",
":",
"return",
"\"true\"",
"elif",
"v",
"is",
"False",
":",
"return",
"\"false\"",
"else",
":",
"return",
"str",
"(",
"... | There are some quirks in how the PGO files
encodes values relative to python's str method | [
"There",
"are",
"some",
"quirks",
"in",
"how",
"the",
"PGO",
"files",
"encodes",
"values",
"relative",
"to",
"python",
"'",
"s",
"str",
"method"
] | [
"\"\"\"There are some quirks in how the PGO files\n encodes values relative to python's str method\n \"\"\""
] | [
{
"param": "v",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "v",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
70d551d1f143d596fb94099331271277b5ec9e02 | priyankabanda2202/lale | lale/lib/lale/concat_features.py | [
"Apache-2.0"
] | Python | transform_schema | <not_specific> | def transform_schema(self, s_X):
"""Used internally by Lale for type-checking downstream operators."""
min_cols, max_cols, elem_schema = 0, 0, None
def add_ranges(min_a, max_a, min_b, max_b):
min_ab = min_a + min_b
if max_a == "unbounded" or max_b == "unbounded":
... | Used internally by Lale for type-checking downstream operators. | Used internally by Lale for type-checking downstream operators. | [
"Used",
"internally",
"by",
"Lale",
"for",
"type",
"-",
"checking",
"downstream",
"operators",
"."
] | def transform_schema(self, s_X):
min_cols, max_cols, elem_schema = 0, 0, None
def add_ranges(min_a, max_a, min_b, max_b):
min_ab = min_a + min_b
if max_a == "unbounded" or max_b == "unbounded":
max_ab = "unbounded"
else:
max_ab = max_a ... | [
"def",
"transform_schema",
"(",
"self",
",",
"s_X",
")",
":",
"min_cols",
",",
"max_cols",
",",
"elem_schema",
"=",
"0",
",",
"0",
",",
"None",
"def",
"add_ranges",
"(",
"min_a",
",",
"max_a",
",",
"min_b",
",",
"max_b",
")",
":",
"min_ab",
"=",
"min... | Used internally by Lale for type-checking downstream operators. | [
"Used",
"internally",
"by",
"Lale",
"for",
"type",
"-",
"checking",
"downstream",
"operators",
"."
] | [
"\"\"\"Used internally by Lale for type-checking downstream operators.\"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "s_X",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "s_X",
"type": null,
"docstring": null,
"docstring_tokens": []... |
dafb27667976aa175766840b30d69cdf9c38e793 | priyankabanda2202/lale | lale/search/search_space.py | [
"Apache-2.0"
] | Python | default | Optional[Any] | def default(self) -> Optional[Any]:
"""Return an optional default value, if None.
if not None, the default value should be in the
search space
"""
return self._default | Return an optional default value, if None.
if not None, the default value should be in the
search space
| Return an optional default value, if None.
if not None, the default value should be in the
search space | [
"Return",
"an",
"optional",
"default",
"value",
"if",
"None",
".",
"if",
"not",
"None",
"the",
"default",
"value",
"should",
"be",
"in",
"the",
"search",
"space"
] | def default(self) -> Optional[Any]:
return self._default | [
"def",
"default",
"(",
"self",
")",
"->",
"Optional",
"[",
"Any",
"]",
":",
"return",
"self",
".",
"_default"
] | Return an optional default value, if None. | [
"Return",
"an",
"optional",
"default",
"value",
"if",
"None",
"."
] | [
"\"\"\"Return an optional default value, if None.\n if not None, the default value should be in the\n search space\n \"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
dafb27667976aa175766840b30d69cdf9c38e793 | priyankabanda2202/lale | lale/search/search_space.py | [
"Apache-2.0"
] | Python | str_with_focus | Union[str, Any] | def str_with_focus(
self, path: Optional[List["SearchSpace"]] = None, default: Any = None
) -> Union[str, Any]:
"""Given a path list, returns a string for the focused path.
If the path is None, returns everything, without focus.
If the path does not start with self, returns None
... | Given a path list, returns a string for the focused path.
If the path is None, returns everything, without focus.
If the path does not start with self, returns None
| Given a path list, returns a string for the focused path.
If the path is None, returns everything, without focus.
If the path does not start with self, returns None | [
"Given",
"a",
"path",
"list",
"returns",
"a",
"string",
"for",
"the",
"focused",
"path",
".",
"If",
"the",
"path",
"is",
"None",
"returns",
"everything",
"without",
"focus",
".",
"If",
"the",
"path",
"does",
"not",
"start",
"with",
"self",
"returns",
"No... | def str_with_focus(
self, path: Optional[List["SearchSpace"]] = None, default: Any = None
) -> Union[str, Any]:
if path is None:
return self._focused_str(path=None)
elif path and path[0] is self:
return self._focused_str(path=path[1:])
else:
return... | [
"def",
"str_with_focus",
"(",
"self",
",",
"path",
":",
"Optional",
"[",
"List",
"[",
"\"SearchSpace\"",
"]",
"]",
"=",
"None",
",",
"default",
":",
"Any",
"=",
"None",
")",
"->",
"Union",
"[",
"str",
",",
"Any",
"]",
":",
"if",
"path",
"is",
"None... | Given a path list, returns a string for the focused path. | [
"Given",
"a",
"path",
"list",
"returns",
"a",
"string",
"for",
"the",
"focused",
"path",
"."
] | [
"\"\"\"Given a path list, returns a string for the focused path.\n If the path is None, returns everything, without focus.\n If the path does not start with self, returns None\n \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "path",
"type": "Optional[List[\"SearchSpace\"]]"
},
{
"param": "default",
"type": "Any"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "path",
"type": "Optional[List[\"SearchSpace\"]]",
"docstring": null... |
dafb27667976aa175766840b30d69cdf9c38e793 | priyankabanda2202/lale | lale/search/search_space.py | [
"Apache-2.0"
] | Python | _focused_str | str | def _focused_str(self, path: Optional[List["SearchSpace"]] = None) -> str:
"""Given the continuation path list, returns a string for the focused path.
If the path is None, returns everything, without focus.
Otherwise, the path is for children
"""
pass | Given the continuation path list, returns a string for the focused path.
If the path is None, returns everything, without focus.
Otherwise, the path is for children
| Given the continuation path list, returns a string for the focused path.
If the path is None, returns everything, without focus.
Otherwise, the path is for children | [
"Given",
"the",
"continuation",
"path",
"list",
"returns",
"a",
"string",
"for",
"the",
"focused",
"path",
".",
"If",
"the",
"path",
"is",
"None",
"returns",
"everything",
"without",
"focus",
".",
"Otherwise",
"the",
"path",
"is",
"for",
"children"
] | def _focused_str(self, path: Optional[List["SearchSpace"]] = None) -> str:
pass | [
"def",
"_focused_str",
"(",
"self",
",",
"path",
":",
"Optional",
"[",
"List",
"[",
"\"SearchSpace\"",
"]",
"]",
"=",
"None",
")",
"->",
"str",
":",
"pass"
] | Given the continuation path list, returns a string for the focused path. | [
"Given",
"the",
"continuation",
"path",
"list",
"returns",
"a",
"string",
"for",
"the",
"focused",
"path",
"."
] | [
"\"\"\"Given the continuation path list, returns a string for the focused path.\n If the path is None, returns everything, without focus.\n Otherwise, the path is for children\n \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "path",
"type": "Optional[List[\"SearchSpace\"]]"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "path",
"type": "Optional[List[\"SearchSpace\"]]",
"docstring": null... |
eced2d5f69ef044028d083a5bff95eb475473b88 | priyankabanda2202/lale | lale/lib/autoai_libs/util.py | [
"Apache-2.0"
] | Python | wrap_pipeline_segments | <not_specific> | def wrap_pipeline_segments(orig_pipeline):
"""Wrap segments of the pipeline to mark them for pretty_print() and visualize().
If the pipeline does not look like it came from AutoAI, just return it
unchanged. Otherwise, find the NumpyPermuteArray operator. Everything
before that operator is preprocessing... | Wrap segments of the pipeline to mark them for pretty_print() and visualize().
If the pipeline does not look like it came from AutoAI, just return it
unchanged. Otherwise, find the NumpyPermuteArray operator. Everything
before that operator is preprocessing. Everything after
NumpyPermuteArray but befor... | Wrap segments of the pipeline to mark them for pretty_print() and visualize().
If the pipeline does not look like it came from AutoAI, just return it
unchanged. Otherwise, find the NumpyPermuteArray operator. Everything
before that operator is preprocessing. Everything after
NumpyPermuteArray but before the final estim... | [
"Wrap",
"segments",
"of",
"the",
"pipeline",
"to",
"mark",
"them",
"for",
"pretty_print",
"()",
"and",
"visualize",
"()",
".",
"If",
"the",
"pipeline",
"does",
"not",
"look",
"like",
"it",
"came",
"from",
"AutoAI",
"just",
"return",
"it",
"unchanged",
".",... | def wrap_pipeline_segments(orig_pipeline):
from lale.lib.autoai_libs.numpy_permute_array import NumpyPermuteArray
if len(orig_pipeline.steps()) <= 2:
return orig_pipeline
estimator = orig_pipeline.get_last()
prep = orig_pipeline.remove_last()
cognito = None
PREP_END = NumpyPermuteArray.c... | [
"def",
"wrap_pipeline_segments",
"(",
"orig_pipeline",
")",
":",
"from",
"lale",
".",
"lib",
".",
"autoai_libs",
".",
"numpy_permute_array",
"import",
"NumpyPermuteArray",
"if",
"len",
"(",
"orig_pipeline",
".",
"steps",
"(",
")",
")",
"<=",
"2",
":",
"return"... | Wrap segments of the pipeline to mark them for pretty_print() and visualize(). | [
"Wrap",
"segments",
"of",
"the",
"pipeline",
"to",
"mark",
"them",
"for",
"pretty_print",
"()",
"and",
"visualize",
"()",
"."
] | [
"\"\"\"Wrap segments of the pipeline to mark them for pretty_print() and visualize().\n\n If the pipeline does not look like it came from AutoAI, just return it\n unchanged. Otherwise, find the NumpyPermuteArray operator. Everything\n before that operator is preprocessing. Everything after\n NumpyPermut... | [
{
"param": "orig_pipeline",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "orig_pipeline",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
566aa7efb4530b0f654c60c0dda406a3c46fda94 | priyankabanda2202/lale | lale/lib/lale/project.py | [
"Apache-2.0"
] | Python | transform_schema | <not_specific> | def transform_schema(self, s_X):
"""Used internally by Lale for type-checking downstream operators."""
if is_schema(s_X):
if hasattr(self, "_fit_columns"):
return self._transform_schema_fit_columns(s_X)
keep_cols = self._hyperparams["columns"]
drop_col... | Used internally by Lale for type-checking downstream operators. | Used internally by Lale for type-checking downstream operators. | [
"Used",
"internally",
"by",
"Lale",
"for",
"type",
"-",
"checking",
"downstream",
"operators",
"."
] | def transform_schema(self, s_X):
if is_schema(s_X):
if hasattr(self, "_fit_columns"):
return self._transform_schema_fit_columns(s_X)
keep_cols = self._hyperparams["columns"]
drop_cols = self._hyperparams["drop_columns"]
if (keep_cols is None or is_... | [
"def",
"transform_schema",
"(",
"self",
",",
"s_X",
")",
":",
"if",
"is_schema",
"(",
"s_X",
")",
":",
"if",
"hasattr",
"(",
"self",
",",
"\"_fit_columns\"",
")",
":",
"return",
"self",
".",
"_transform_schema_fit_columns",
"(",
"s_X",
")",
"keep_cols",
"=... | Used internally by Lale for type-checking downstream operators. | [
"Used",
"internally",
"by",
"Lale",
"for",
"type",
"-",
"checking",
"downstream",
"operators",
"."
] | [
"\"\"\"Used internally by Lale for type-checking downstream operators.\"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "s_X",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "s_X",
"type": null,
"docstring": null,
"docstring_tokens": []... |
cc73b60f86613554437c699179079e72dab8ea0f | priyankabanda2202/lale | lale/grammar.py | [
"Apache-2.0"
] | Python | _with_params | Operator | def _with_params(self, try_mutate: bool, **impl_params) -> Operator:
"""
This method updates the parameters of the operator. NonTerminals do not support
in-place mutation
"""
known_keys = set(["name"])
if impl_params:
new_keys = set(impl_params.keys())
... |
This method updates the parameters of the operator. NonTerminals do not support
in-place mutation
| This method updates the parameters of the operator. NonTerminals do not support
in-place mutation | [
"This",
"method",
"updates",
"the",
"parameters",
"of",
"the",
"operator",
".",
"NonTerminals",
"do",
"not",
"support",
"in",
"-",
"place",
"mutation"
] | def _with_params(self, try_mutate: bool, **impl_params) -> Operator:
known_keys = set(["name"])
if impl_params:
new_keys = set(impl_params.keys())
if not new_keys.issubset(known_keys):
unknowns = {k: v for k, v in impl_params.items() if k not in known_keys}
... | [
"def",
"_with_params",
"(",
"self",
",",
"try_mutate",
":",
"bool",
",",
"**",
"impl_params",
")",
"->",
"Operator",
":",
"known_keys",
"=",
"set",
"(",
"[",
"\"name\"",
"]",
")",
"if",
"impl_params",
":",
"new_keys",
"=",
"set",
"(",
"impl_params",
".",... | This method updates the parameters of the operator. | [
"This",
"method",
"updates",
"the",
"parameters",
"of",
"the",
"operator",
"."
] | [
"\"\"\"\n This method updates the parameters of the operator. NonTerminals do not support\n in-place mutation\n \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "try_mutate",
"type": "bool"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "try_mutate",
"type": "bool",
"docstring": null,
"docstring_to... |
cc73b60f86613554437c699179079e72dab8ea0f | priyankabanda2202/lale | lale/grammar.py | [
"Apache-2.0"
] | Python | _with_params | Operator | def _with_params(self, try_mutate: bool, **impl_params) -> Operator:
"""
This method updates the parameters of the operator.
If try_mutate is set, it will attempt to update the operator in place
this may not always be possible
"""
# TODO implement support
# from t... |
This method updates the parameters of the operator.
If try_mutate is set, it will attempt to update the operator in place
this may not always be possible
| This method updates the parameters of the operator.
If try_mutate is set, it will attempt to update the operator in place
this may not always be possible | [
"This",
"method",
"updates",
"the",
"parameters",
"of",
"the",
"operator",
".",
"If",
"try_mutate",
"is",
"set",
"it",
"will",
"attempt",
"to",
"update",
"the",
"operator",
"in",
"place",
"this",
"may",
"not",
"always",
"be",
"possible"
] | def _with_params(self, try_mutate: bool, **impl_params) -> Operator:
raise NotImplementedError("setting Grammar parameters is not yet supported") | [
"def",
"_with_params",
"(",
"self",
",",
"try_mutate",
":",
"bool",
",",
"**",
"impl_params",
")",
"->",
"Operator",
":",
"raise",
"NotImplementedError",
"(",
"\"setting Grammar parameters is not yet supported\"",
")"
] | This method updates the parameters of the operator. | [
"This",
"method",
"updates",
"the",
"parameters",
"of",
"the",
"operator",
"."
] | [
"\"\"\"\n This method updates the parameters of the operator.\n If try_mutate is set, it will attempt to update the operator in place\n this may not always be possible\n \"\"\"",
"# TODO implement support",
"# from this point of view, Grammar is just a higher order operator"
] | [
{
"param": "self",
"type": null
},
{
"param": "try_mutate",
"type": "bool"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "try_mutate",
"type": "bool",
"docstring": null,
"docstring_to... |
0ab3f105a5f7bcdf558386b386fae0dfdd8a3998 | priyankabanda2202/lale | lale/datasets/multitable/fetch_datasets.py | [
"Apache-2.0"
] | Python | fetch_go_sales_dataset | <not_specific> | def fetch_go_sales_dataset(datatype="pandas"):
"""
Fetches the Go_Sales dataset from IBM's Watson's ML samples.
It contains information about daily sales, methods, retailers
and products of a company in form of 5 CSV files.
This method downloads and stores these 5 CSV files under the
'lale/lale... |
Fetches the Go_Sales dataset from IBM's Watson's ML samples.
It contains information about daily sales, methods, retailers
and products of a company in form of 5 CSV files.
This method downloads and stores these 5 CSV files under the
'lale/lale/datasets/multitable/go_sales_data' directory. It creat... | Fetches the Go_Sales dataset from IBM's Watson's ML samples.
It contains information about daily sales, methods, retailers
and products of a company in form of 5 CSV files.
This method downloads and stores these 5 CSV files under the
'lale/lale/datasets/multitable/go_sales_data' directory. It creates
this directory by ... | [
"Fetches",
"the",
"Go_Sales",
"dataset",
"from",
"IBM",
"'",
"s",
"Watson",
"'",
"s",
"ML",
"samples",
".",
"It",
"contains",
"information",
"about",
"daily",
"sales",
"methods",
"retailers",
"and",
"products",
"of",
"a",
"company",
"in",
"form",
"of",
"5"... | def fetch_go_sales_dataset(datatype="pandas"):
download_data_dir = os.path.join(os.path.dirname(__file__), "go_sales_data")
base_url = "https://github.com/IBM/watson-machine-learning-samples/raw/master/cloud/data/go_sales/"
filenames = [
"go_1k.csv",
"go_daily_sales.csv",
"go_methods... | [
"def",
"fetch_go_sales_dataset",
"(",
"datatype",
"=",
"\"pandas\"",
")",
":",
"download_data_dir",
"=",
"os",
".",
"path",
".",
"join",
"(",
"os",
".",
"path",
".",
"dirname",
"(",
"__file__",
")",
",",
"\"go_sales_data\"",
")",
"base_url",
"=",
"\"https://... | Fetches the Go_Sales dataset from IBM's Watson's ML samples. | [
"Fetches",
"the",
"Go_Sales",
"dataset",
"from",
"IBM",
"'",
"s",
"Watson",
"'",
"s",
"ML",
"samples",
"."
] | [
"\"\"\"\n Fetches the Go_Sales dataset from IBM's Watson's ML samples.\n It contains information about daily sales, methods, retailers\n and products of a company in form of 5 CSV files.\n This method downloads and stores these 5 CSV files under the\n 'lale/lale/datasets/multitable/go_sales_data' dir... | [
{
"param": "datatype",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "datatype",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
0ab3f105a5f7bcdf558386b386fae0dfdd8a3998 | priyankabanda2202/lale | lale/datasets/multitable/fetch_datasets.py | [
"Apache-2.0"
] | Python | fetch_imdb_dataset | <not_specific> | def fetch_imdb_dataset(datatype="pandas"):
"""
Fetches the IMDB movie dataset from Relational Dataset Repo.
It contains information about directors, actors, roles
and genres of multiple movies in form of 7 CSV files.
This method downloads and stores these 7 CSV files under the
'lale/lale/datase... |
Fetches the IMDB movie dataset from Relational Dataset Repo.
It contains information about directors, actors, roles
and genres of multiple movies in form of 7 CSV files.
This method downloads and stores these 7 CSV files under the
'lale/lale/datasets/multitable/imdb_data' directory. It creates
... | Fetches the IMDB movie dataset from Relational Dataset Repo.
It contains information about directors, actors, roles
and genres of multiple movies in form of 7 CSV files.
This method downloads and stores these 7 CSV files under the
'lale/lale/datasets/multitable/imdb_data' directory. It creates
this directory by itself ... | [
"Fetches",
"the",
"IMDB",
"movie",
"dataset",
"from",
"Relational",
"Dataset",
"Repo",
".",
"It",
"contains",
"information",
"about",
"directors",
"actors",
"roles",
"and",
"genres",
"of",
"multiple",
"movies",
"in",
"form",
"of",
"7",
"CSV",
"files",
".",
"... | def fetch_imdb_dataset(datatype="pandas"):
download_data_dir = os.path.join(os.path.dirname(__file__), "imdb_data")
imdb_list = []
if not os.path.exists(download_data_dir):
raise ValueError(
"IMDB dataset not found at {}. Please download it using lalegpl repository.".format(
... | [
"def",
"fetch_imdb_dataset",
"(",
"datatype",
"=",
"\"pandas\"",
")",
":",
"download_data_dir",
"=",
"os",
".",
"path",
".",
"join",
"(",
"os",
".",
"path",
".",
"dirname",
"(",
"__file__",
")",
",",
"\"imdb_data\"",
")",
"imdb_list",
"=",
"[",
"]",
"if"... | Fetches the IMDB movie dataset from Relational Dataset Repo. | [
"Fetches",
"the",
"IMDB",
"movie",
"dataset",
"from",
"Relational",
"Dataset",
"Repo",
"."
] | [
"\"\"\"\n Fetches the IMDB movie dataset from Relational Dataset Repo.\n It contains information about directors, actors, roles\n and genres of multiple movies in form of 7 CSV files.\n This method downloads and stores these 7 CSV files under the\n 'lale/lale/datasets/multitable/imdb_data' directory.... | [
{
"param": "datatype",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "datatype",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
eccd418a5f2d51ecbe524eea4321abba6175ed38 | priyankabanda2202/lale | lale/schema_simplifier.py | [
"Apache-2.0"
] | Python | liftAllOf | Iterable[JsonSchema] | def liftAllOf(schemas: List[JsonSchema]) -> Iterable[JsonSchema]:
"""Given a list of schemas, if any of them are
allOf schemas, lift them out to the top level
"""
for sch in schemas:
schs2 = toAllOfList(sch)
for s in schs2:
yield s | Given a list of schemas, if any of them are
allOf schemas, lift them out to the top level
| Given a list of schemas, if any of them are
allOf schemas, lift them out to the top level | [
"Given",
"a",
"list",
"of",
"schemas",
"if",
"any",
"of",
"them",
"are",
"allOf",
"schemas",
"lift",
"them",
"out",
"to",
"the",
"top",
"level"
] | def liftAllOf(schemas: List[JsonSchema]) -> Iterable[JsonSchema]:
for sch in schemas:
schs2 = toAllOfList(sch)
for s in schs2:
yield s | [
"def",
"liftAllOf",
"(",
"schemas",
":",
"List",
"[",
"JsonSchema",
"]",
")",
"->",
"Iterable",
"[",
"JsonSchema",
"]",
":",
"for",
"sch",
"in",
"schemas",
":",
"schs2",
"=",
"toAllOfList",
"(",
"sch",
")",
"for",
"s",
"in",
"schs2",
":",
"yield",
"s... | Given a list of schemas, if any of them are
allOf schemas, lift them out to the top level | [
"Given",
"a",
"list",
"of",
"schemas",
"if",
"any",
"of",
"them",
"are",
"allOf",
"schemas",
"lift",
"them",
"out",
"to",
"the",
"top",
"level"
] | [
"\"\"\"Given a list of schemas, if any of them are\n allOf schemas, lift them out to the top level\n \"\"\""
] | [
{
"param": "schemas",
"type": "List[JsonSchema]"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "schemas",
"type": "List[JsonSchema]",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
eccd418a5f2d51ecbe524eea4321abba6175ed38 | priyankabanda2202/lale | lale/schema_simplifier.py | [
"Apache-2.0"
] | Python | liftAnyOf | Iterable[JsonSchema] | def liftAnyOf(schemas: List[JsonSchema]) -> Iterable[JsonSchema]:
"""Given a list of schemas, if any of them are
anyOf schemas, lift them out to the top level
"""
for sch in schemas:
schs2 = toAnyOfList(sch)
for s in schs2:
yield s | Given a list of schemas, if any of them are
anyOf schemas, lift them out to the top level
| Given a list of schemas, if any of them are
anyOf schemas, lift them out to the top level | [
"Given",
"a",
"list",
"of",
"schemas",
"if",
"any",
"of",
"them",
"are",
"anyOf",
"schemas",
"lift",
"them",
"out",
"to",
"the",
"top",
"level"
] | def liftAnyOf(schemas: List[JsonSchema]) -> Iterable[JsonSchema]:
for sch in schemas:
schs2 = toAnyOfList(sch)
for s in schs2:
yield s | [
"def",
"liftAnyOf",
"(",
"schemas",
":",
"List",
"[",
"JsonSchema",
"]",
")",
"->",
"Iterable",
"[",
"JsonSchema",
"]",
":",
"for",
"sch",
"in",
"schemas",
":",
"schs2",
"=",
"toAnyOfList",
"(",
"sch",
")",
"for",
"s",
"in",
"schs2",
":",
"yield",
"s... | Given a list of schemas, if any of them are
anyOf schemas, lift them out to the top level | [
"Given",
"a",
"list",
"of",
"schemas",
"if",
"any",
"of",
"them",
"are",
"anyOf",
"schemas",
"lift",
"them",
"out",
"to",
"the",
"top",
"level"
] | [
"\"\"\"Given a list of schemas, if any of them are\n anyOf schemas, lift them out to the top level\n \"\"\""
] | [
{
"param": "schemas",
"type": "List[JsonSchema]"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "schemas",
"type": "List[JsonSchema]",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
eccd418a5f2d51ecbe524eea4321abba6175ed38 | priyankabanda2202/lale | lale/schema_simplifier.py | [
"Apache-2.0"
] | Python | enumValues | set_with_str_for_keys[Any] | def enumValues(
es: set_with_str_for_keys[Any], s: JsonSchema
) -> set_with_str_for_keys[Any]:
"""Given an enumeration set and a schema, return all the consistent values of the enumeration."""
# TODO: actually check. This should call the json schema validator
ret = list()
for e in es:
try:
... | Given an enumeration set and a schema, return all the consistent values of the enumeration. | Given an enumeration set and a schema, return all the consistent values of the enumeration. | [
"Given",
"an",
"enumeration",
"set",
"and",
"a",
"schema",
"return",
"all",
"the",
"consistent",
"values",
"of",
"the",
"enumeration",
"."
] | def enumValues(
es: set_with_str_for_keys[Any], s: JsonSchema
) -> set_with_str_for_keys[Any]:
ret = list()
for e in es:
try:
always_validate_schema(e, s)
ret.append(e)
except jsonschema.ValidationError:
logger.debug(
f"enumValues: {e} remo... | [
"def",
"enumValues",
"(",
"es",
":",
"set_with_str_for_keys",
"[",
"Any",
"]",
",",
"s",
":",
"JsonSchema",
")",
"->",
"set_with_str_for_keys",
"[",
"Any",
"]",
":",
"ret",
"=",
"list",
"(",
")",
"for",
"e",
"in",
"es",
":",
"try",
":",
"always_validat... | Given an enumeration set and a schema, return all the consistent values of the enumeration. | [
"Given",
"an",
"enumeration",
"set",
"and",
"a",
"schema",
"return",
"all",
"the",
"consistent",
"values",
"of",
"the",
"enumeration",
"."
] | [
"\"\"\"Given an enumeration set and a schema, return all the consistent values of the enumeration.\"\"\"",
"# TODO: actually check. This should call the json schema validator"
] | [
{
"param": "es",
"type": "set_with_str_for_keys[Any]"
},
{
"param": "s",
"type": "JsonSchema"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "es",
"type": "set_with_str_for_keys[Any]",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "s",
"type": "JsonSchema",
"docstring": null,
... |
eccd418a5f2d51ecbe524eea4321abba6175ed38 | priyankabanda2202/lale | lale/schema_simplifier.py | [
"Apache-2.0"
] | Python | simplifyNot_ | JsonSchema | def simplifyNot_(
schema: JsonSchema, floatAny: bool, alreadySimplified: bool = False
) -> JsonSchema:
"""alreadySimplified=true implies that schema has already been simplified"""
if "not" in schema:
# if there is a not/not, we can just skip it
ret = simplify(schema["not"], floatAny)
... | alreadySimplified=true implies that schema has already been simplified | alreadySimplified=true implies that schema has already been simplified | [
"alreadySimplified",
"=",
"true",
"implies",
"that",
"schema",
"has",
"already",
"been",
"simplified"
] | def simplifyNot_(
schema: JsonSchema, floatAny: bool, alreadySimplified: bool = False
) -> JsonSchema:
if "not" in schema:
ret = simplify(schema["not"], floatAny)
return ret
elif "anyOf" in schema:
anys = schema["anyOf"]
alls = [{"not": s} for s in anys]
ret = simplif... | [
"def",
"simplifyNot_",
"(",
"schema",
":",
"JsonSchema",
",",
"floatAny",
":",
"bool",
",",
"alreadySimplified",
":",
"bool",
"=",
"False",
")",
"->",
"JsonSchema",
":",
"if",
"\"not\"",
"in",
"schema",
":",
"ret",
"=",
"simplify",
"(",
"schema",
"[",
"\... | alreadySimplified=true implies that schema has already been simplified | [
"alreadySimplified",
"=",
"true",
"implies",
"that",
"schema",
"has",
"already",
"been",
"simplified"
] | [
"\"\"\"alreadySimplified=true implies that schema has already been simplified\"\"\"",
"# if there is a not/not, we can just skip it",
"# it is possible that the result of calling simplify",
"# resulted in something that we can push 'not' down into",
"# so we call ourselves, being careful to avoid an infinit... | [
{
"param": "schema",
"type": "JsonSchema"
},
{
"param": "floatAny",
"type": "bool"
},
{
"param": "alreadySimplified",
"type": "bool"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "schema",
"type": "JsonSchema",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "floatAny",
"type": "bool",
"docstring": null,
"docs... |
eccd418a5f2d51ecbe524eea4321abba6175ed38 | priyankabanda2202/lale | lale/schema_simplifier.py | [
"Apache-2.0"
] | Python | simplify | JsonSchema | def simplify(schema: JsonSchema, floatAny: bool) -> JsonSchema:
"""Tries to simplify a schema into an equivalent but
more compact/simpler one. If floatAny if true, then
the only anyOf in the return value will be at the top level.
Using this option may cause a combinatorial blowup in the size
of the... | Tries to simplify a schema into an equivalent but
more compact/simpler one. If floatAny if true, then
the only anyOf in the return value will be at the top level.
Using this option may cause a combinatorial blowup in the size
of the schema
| Tries to simplify a schema into an equivalent but
more compact/simpler one. If floatAny if true, then
the only anyOf in the return value will be at the top level.
Using this option may cause a combinatorial blowup in the size
of the schema | [
"Tries",
"to",
"simplify",
"a",
"schema",
"into",
"an",
"equivalent",
"but",
"more",
"compact",
"/",
"simpler",
"one",
".",
"If",
"floatAny",
"if",
"true",
"then",
"the",
"only",
"anyOf",
"in",
"the",
"return",
"value",
"will",
"be",
"at",
"the",
"top",
... | def simplify(schema: JsonSchema, floatAny: bool) -> JsonSchema:
if is_true_schema(schema):
return STrue
if is_false_schema(schema):
return SFalse
if "enum" in schema:
return schema
if "allOf" in schema:
ret = simplifyAll(schema["allOf"], floatAny)
return ret
e... | [
"def",
"simplify",
"(",
"schema",
":",
"JsonSchema",
",",
"floatAny",
":",
"bool",
")",
"->",
"JsonSchema",
":",
"if",
"is_true_schema",
"(",
"schema",
")",
":",
"return",
"STrue",
"if",
"is_false_schema",
"(",
"schema",
")",
":",
"return",
"SFalse",
"if",... | Tries to simplify a schema into an equivalent but
more compact/simpler one. | [
"Tries",
"to",
"simplify",
"a",
"schema",
"into",
"an",
"equivalent",
"but",
"more",
"compact",
"/",
"simpler",
"one",
"."
] | [
"\"\"\"Tries to simplify a schema into an equivalent but\n more compact/simpler one. If floatAny if true, then\n the only anyOf in the return value will be at the top level.\n Using this option may cause a combinatorial blowup in the size\n of the schema\n \"\"\"",
"# TODO: simplify the schemas by... | [
{
"param": "schema",
"type": "JsonSchema"
},
{
"param": "floatAny",
"type": "bool"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "schema",
"type": "JsonSchema",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "floatAny",
"type": "bool",
"docstring": null,
"docs... |
eccd418a5f2d51ecbe524eea4321abba6175ed38 | priyankabanda2202/lale | lale/schema_simplifier.py | [
"Apache-2.0"
] | Python | findRelevantFields | Optional[Set[str]] | def findRelevantFields(schema: JsonSchema) -> Optional[Set[str]]:
"""Either returns the relevant fields for the schema, or None if there was none specified"""
if "allOf" in schema:
fields_list: List[Optional[Set[str]]] = [
findRelevantFields(s) for s in schema["allOf"]
]
real... | Either returns the relevant fields for the schema, or None if there was none specified | Either returns the relevant fields for the schema, or None if there was none specified | [
"Either",
"returns",
"the",
"relevant",
"fields",
"for",
"the",
"schema",
"or",
"None",
"if",
"there",
"was",
"none",
"specified"
] | def findRelevantFields(schema: JsonSchema) -> Optional[Set[str]]:
if "allOf" in schema:
fields_list: List[Optional[Set[str]]] = [
findRelevantFields(s) for s in schema["allOf"]
]
real_fields_list: List[Set[str]] = [f for f in fields_list if f is not None]
if real_fields_l... | [
"def",
"findRelevantFields",
"(",
"schema",
":",
"JsonSchema",
")",
"->",
"Optional",
"[",
"Set",
"[",
"str",
"]",
"]",
":",
"if",
"\"allOf\"",
"in",
"schema",
":",
"fields_list",
":",
"List",
"[",
"Optional",
"[",
"Set",
"[",
"str",
"]",
"]",
"]",
"... | Either returns the relevant fields for the schema, or None if there was none specified | [
"Either",
"returns",
"the",
"relevant",
"fields",
"for",
"the",
"schema",
"or",
"None",
"if",
"there",
"was",
"none",
"specified"
] | [
"\"\"\"Either returns the relevant fields for the schema, or None if there was none specified\"\"\"",
"# does not handle nested objects and nested relevant fields well"
] | [
{
"param": "schema",
"type": "JsonSchema"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "schema",
"type": "JsonSchema",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
c04066cdbcbba0723bdf5cc0984f2c7bc4dfd4ad | mgoldey/asrtoolkit-draft | asrtoolkit/data_structures/corpus.py | [
"Apache-2.0"
] | Python | validate | <not_specific> | def validate(self):
" validate exemplar object by constraining that the filenames before the extension are the same "
valid = True
audio_filename = ".".join(self.audio_file.location.split(".")[:-1])
transcript_filename = ".".join(self.transcript_file.location.split(".")[:-1])
if audio_filename != t... | validate exemplar object by constraining that the filenames before the extension are the same | validate exemplar object by constraining that the filenames before the extension are the same | [
"validate",
"exemplar",
"object",
"by",
"constraining",
"that",
"the",
"filenames",
"before",
"the",
"extension",
"are",
"the",
"same"
] | def validate(self):
valid = True
audio_filename = ".".join(self.audio_file.location.split(".")[:-1])
transcript_filename = ".".join(self.transcript_file.location.split(".")[:-1])
if audio_filename != transcript_filename:
print(
"Mismatch between audio and transcript filename - please check... | [
"def",
"validate",
"(",
"self",
")",
":",
"valid",
"=",
"True",
"audio_filename",
"=",
"\".\"",
".",
"join",
"(",
"self",
".",
"audio_file",
".",
"location",
".",
"split",
"(",
"\".\"",
")",
"[",
":",
"-",
"1",
"]",
")",
"transcript_filename",
"=",
"... | validate exemplar object by constraining that the filenames before the extension are the same | [
"validate",
"exemplar",
"object",
"by",
"constraining",
"that",
"the",
"filenames",
"before",
"the",
"extension",
"are",
"the",
"same"
] | [
"\" validate exemplar object by constraining that the filenames before the extension are the same \""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
c04066cdbcbba0723bdf5cc0984f2c7bc4dfd4ad | mgoldey/asrtoolkit-draft | asrtoolkit/data_structures/corpus.py | [
"Apache-2.0"
] | Python | prepare_for_training | null | def prepare_for_training(self, target=None):
"""
Run validation and audio file preparation steps
"""
# write corpus back in place if no target
target = self.location if target is None else target
# clean up
basename = lambda file_name: file_name.split("/")[-1]
executor = ThreadPoolE... |
Run validation and audio file preparation steps
| Run validation and audio file preparation steps | [
"Run",
"validation",
"and",
"audio",
"file",
"preparation",
"steps"
] | def prepare_for_training(self, target=None):
target = self.location if target is None else target
basename = lambda file_name: file_name.split("/")[-1]
executor = ThreadPoolExecutor()
futures = [
executor.submit(partial(_.audio_file.prepare_for_training, target + "/" + basename(_.audio_file.locati... | [
"def",
"prepare_for_training",
"(",
"self",
",",
"target",
"=",
"None",
")",
":",
"target",
"=",
"self",
".",
"location",
"if",
"target",
"is",
"None",
"else",
"target",
"basename",
"=",
"lambda",
"file_name",
":",
"file_name",
".",
"split",
"(",
"\"/\"",
... | Run validation and audio file preparation steps | [
"Run",
"validation",
"and",
"audio",
"file",
"preparation",
"steps"
] | [
"\"\"\"\n Run validation and audio file preparation steps\n \"\"\"",
"# write corpus back in place if no target",
"# clean up",
"# process audio files concurrently for speed",
"# trigger conversion and gather results"
] | [
{
"param": "self",
"type": null
},
{
"param": "target",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "target",
"type": null,
"docstring": null,
"docstring_tokens":... |
c9569f3b29def282bbf46d79743c3e83a59232ba | mgoldey/asrtoolkit-draft | asrtoolkit/degrade_audio_file.py | [
"Apache-2.0"
] | Python | main | null | def main():
"""
Degrade all audio files given as arguments (in place by default)
"""
for file_name in sys.argv[1:]:
degrade_audio(file_name) |
Degrade all audio files given as arguments (in place by default)
| Degrade all audio files given as arguments (in place by default) | [
"Degrade",
"all",
"audio",
"files",
"given",
"as",
"arguments",
"(",
"in",
"place",
"by",
"default",
")"
] | def main():
for file_name in sys.argv[1:]:
degrade_audio(file_name) | [
"def",
"main",
"(",
")",
":",
"for",
"file_name",
"in",
"sys",
".",
"argv",
"[",
"1",
":",
"]",
":",
"degrade_audio",
"(",
"file_name",
")"
] | Degrade all audio files given as arguments (in place by default) | [
"Degrade",
"all",
"audio",
"files",
"given",
"as",
"arguments",
"(",
"in",
"place",
"by",
"default",
")"
] | [
"\"\"\"\n Degrade all audio files given as arguments (in place by default)\n \"\"\""
] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} |
42cfa63b0648d1a2cbbd049117a77820a8da4752 | mgoldey/asrtoolkit-draft | asrtoolkit/data_handlers/stm.py | [
"Apache-2.0"
] | Python | format_segment | <not_specific> | def format_segment(seg):
"""
Formats a segment assuming it's an instance of class segment with elements
audiofile, channel, speaker, start and stop times, label, and text
"""
return " ".join(seg.__dict__[_] for _ in ('audiofile', 'channel', 'speaker', 'start', 'stop', 'label', 'text')) |
Formats a segment assuming it's an instance of class segment with elements
audiofile, channel, speaker, start and stop times, label, and text
| Formats a segment assuming it's an instance of class segment with elements
audiofile, channel, speaker, start and stop times, label, and text | [
"Formats",
"a",
"segment",
"assuming",
"it",
"'",
"s",
"an",
"instance",
"of",
"class",
"segment",
"with",
"elements",
"audiofile",
"channel",
"speaker",
"start",
"and",
"stop",
"times",
"label",
"and",
"text"
] | def format_segment(seg):
return " ".join(seg.__dict__[_] for _ in ('audiofile', 'channel', 'speaker', 'start', 'stop', 'label', 'text')) | [
"def",
"format_segment",
"(",
"seg",
")",
":",
"return",
"\" \"",
".",
"join",
"(",
"seg",
".",
"__dict__",
"[",
"_",
"]",
"for",
"_",
"in",
"(",
"'audiofile'",
",",
"'channel'",
",",
"'speaker'",
",",
"'start'",
",",
"'stop'",
",",
"'label'",
",",
"... | Formats a segment assuming it's an instance of class segment with elements
audiofile, channel, speaker, start and stop times, label, and text | [
"Formats",
"a",
"segment",
"assuming",
"it",
"'",
"s",
"an",
"instance",
"of",
"class",
"segment",
"with",
"elements",
"audiofile",
"channel",
"speaker",
"start",
"and",
"stop",
"times",
"label",
"and",
"text"
] | [
"\"\"\"\n Formats a segment assuming it's an instance of class segment with elements\n audiofile, channel, speaker, start and stop times, label, and text\n \"\"\""
] | [
{
"param": "seg",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "seg",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
42cfa63b0648d1a2cbbd049117a77820a8da4752 | mgoldey/asrtoolkit-draft | asrtoolkit/data_handlers/stm.py | [
"Apache-2.0"
] | Python | parse_line | <not_specific> | def parse_line(line):
" parse a single line of an stm file"
data = line.strip().split()
seg = None
if len(data) > 6:
audiofile, channel, speaker, start, stop, label = data[:6]
text = " ".join(data[6:])
seg = segment(
{
'audiofile': audiofile,
'channel': channel,
'spea... | parse a single line of an stm file | parse a single line of an stm file | [
"parse",
"a",
"single",
"line",
"of",
"an",
"stm",
"file"
] | def parse_line(line):
data = line.strip().split()
seg = None
if len(data) > 6:
audiofile, channel, speaker, start, stop, label = data[:6]
text = " ".join(data[6:])
seg = segment(
{
'audiofile': audiofile,
'channel': channel,
'speaker': speaker,
'start': start,
... | [
"def",
"parse_line",
"(",
"line",
")",
":",
"data",
"=",
"line",
".",
"strip",
"(",
")",
".",
"split",
"(",
")",
"seg",
"=",
"None",
"if",
"len",
"(",
"data",
")",
">",
"6",
":",
"audiofile",
",",
"channel",
",",
"speaker",
",",
"start",
",",
"... | parse a single line of an stm file | [
"parse",
"a",
"single",
"line",
"of",
"an",
"stm",
"file"
] | [
"\" parse a single line of an stm file\""
] | [
{
"param": "line",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "line",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
42cfa63b0648d1a2cbbd049117a77820a8da4752 | mgoldey/asrtoolkit-draft | asrtoolkit/data_handlers/stm.py | [
"Apache-2.0"
] | Python | read_file | <not_specific> | def read_file(file_name):
"""
Reads an STM file, skipping any gap lines
"""
segments = []
with open(file_name, encoding="utf-8") as f:
for line in f:
seg = parse_line(line)
if seg is not None:
segments.append(seg)
return segments |
Reads an STM file, skipping any gap lines
| Reads an STM file, skipping any gap lines | [
"Reads",
"an",
"STM",
"file",
"skipping",
"any",
"gap",
"lines"
] | def read_file(file_name):
segments = []
with open(file_name, encoding="utf-8") as f:
for line in f:
seg = parse_line(line)
if seg is not None:
segments.append(seg)
return segments | [
"def",
"read_file",
"(",
"file_name",
")",
":",
"segments",
"=",
"[",
"]",
"with",
"open",
"(",
"file_name",
",",
"encoding",
"=",
"\"utf-8\"",
")",
"as",
"f",
":",
"for",
"line",
"in",
"f",
":",
"seg",
"=",
"parse_line",
"(",
"line",
")",
"if",
"s... | Reads an STM file, skipping any gap lines | [
"Reads",
"an",
"STM",
"file",
"skipping",
"any",
"gap",
"lines"
] | [
"\"\"\"\n Reads an STM file, skipping any gap lines\n \"\"\""
] | [
{
"param": "file_name",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "file_name",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
5cee1cc018894b52ee0909c4dc70853ca0288b9d | mgoldey/asrtoolkit-draft | asrtoolkit/data_handlers/txt.py | [
"Apache-2.0"
] | Python | format_segment | <not_specific> | def format_segment(seg):
"""
Formats a segment assuming it's an instance of class segment with text element
"""
return seg.text |
Formats a segment assuming it's an instance of class segment with text element
| Formats a segment assuming it's an instance of class segment with text element | [
"Formats",
"a",
"segment",
"assuming",
"it",
"'",
"s",
"an",
"instance",
"of",
"class",
"segment",
"with",
"text",
"element"
] | def format_segment(seg):
return seg.text | [
"def",
"format_segment",
"(",
"seg",
")",
":",
"return",
"seg",
".",
"text"
] | Formats a segment assuming it's an instance of class segment with text element | [
"Formats",
"a",
"segment",
"assuming",
"it",
"'",
"s",
"an",
"instance",
"of",
"class",
"segment",
"with",
"text",
"element"
] | [
"\"\"\"\n Formats a segment assuming it's an instance of class segment with text element\n \"\"\""
] | [
{
"param": "seg",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "seg",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
eed6603e9c00598d77927595d0a84b2c0928448a | mgoldey/asrtoolkit-draft | asrtoolkit/data_structures/time_aligned_text.py | [
"Apache-2.0"
] | Python | read | null | def read(self, file_name):
""" Read a file using class-specific read function """
self.file_extension = file_name.split(".")[-1]
self.location = file_name
data_handler = importlib.import_module("asrtoolkit.data_handlers.{:}".format(self.file_extension))
self.segments = data_handler.read_file(file_na... | Read a file using class-specific read function | Read a file using class-specific read function | [
"Read",
"a",
"file",
"using",
"class",
"-",
"specific",
"read",
"function"
] | def read(self, file_name):
self.file_extension = file_name.split(".")[-1]
self.location = file_name
data_handler = importlib.import_module("asrtoolkit.data_handlers.{:}".format(self.file_extension))
self.segments = data_handler.read_file(file_name) | [
"def",
"read",
"(",
"self",
",",
"file_name",
")",
":",
"self",
".",
"file_extension",
"=",
"file_name",
".",
"split",
"(",
"\".\"",
")",
"[",
"-",
"1",
"]",
"self",
".",
"location",
"=",
"file_name",
"data_handler",
"=",
"importlib",
".",
"import_module... | Read a file using class-specific read function | [
"Read",
"a",
"file",
"using",
"class",
"-",
"specific",
"read",
"function"
] | [
"\"\"\" Read a file using class-specific read function \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "file_name",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "file_name",
"type": null,
"docstring": null,
"docstring_token... |
179ba77231549d149a2bdc2b1ea58081acf7334c | mgoldey/asrtoolkit-draft | asrtoolkit/data_structures/audio_file.py | [
"Apache-2.0"
] | Python | cut_utterance | null | def cut_utterance(source_audio_file, target_audio_file, start_time, end_time, sample_rate=16000):
"""
source_audio_file: str, path to file
target_audio_file: str, path to file
start_time: float or str
end_time: float or str
sample_rate: int, default 16000; audio sample rate in Hz
uses sox seg... |
source_audio_file: str, path to file
target_audio_file: str, path to file
start_time: float or str
end_time: float or str
sample_rate: int, default 16000; audio sample rate in Hz
uses sox segment source_audio_file to create target_audio_file that contains audio from start_time to end_time
... | str, path to file
target_audio_file: str, path to file
start_time: float or str
end_time: float or str
sample_rate: int, default 16000; audio sample rate in Hz
uses sox segment source_audio_file to create target_audio_file that contains audio from start_time to end_time
with audio sample rate set to sample_rate | [
"str",
"path",
"to",
"file",
"target_audio_file",
":",
"str",
"path",
"to",
"file",
"start_time",
":",
"float",
"or",
"str",
"end_time",
":",
"float",
"or",
"str",
"sample_rate",
":",
"int",
"default",
"16000",
";",
"audio",
"sample",
"rate",
"in",
"Hz",
... | def cut_utterance(source_audio_file, target_audio_file, start_time, end_time, sample_rate=16000):
subprocess.call(
[
"sox {} -r {} -b 16 -c 1 {} trim {} ={}"
.format(source_audio_file, str(sample_rate), target_audio_file, str(start_time), str(end_time))
],
shell=True
) | [
"def",
"cut_utterance",
"(",
"source_audio_file",
",",
"target_audio_file",
",",
"start_time",
",",
"end_time",
",",
"sample_rate",
"=",
"16000",
")",
":",
"subprocess",
".",
"call",
"(",
"[",
"\"sox {} -r {} -b 16 -c 1 {} trim {} ={}\"",
".",
"format",
"(",
"source... | source_audio_file: str, path to file
target_audio_file: str, path to file
start_time: float or str
end_time: float or str
sample_rate: int, default 16000; audio sample rate in Hz | [
"source_audio_file",
":",
"str",
"path",
"to",
"file",
"target_audio_file",
":",
"str",
"path",
"to",
"file",
"start_time",
":",
"float",
"or",
"str",
"end_time",
":",
"float",
"or",
"str",
"sample_rate",
":",
"int",
"default",
"16000",
";",
"audio",
"sample... | [
"\"\"\"\n source_audio_file: str, path to file\n target_audio_file: str, path to file\n start_time: float or str\n end_time: float or str\n sample_rate: int, default 16000; audio sample rate in Hz\n\n uses sox segment source_audio_file to create target_audio_file that contains audio from start_tim... | [
{
"param": "source_audio_file",
"type": null
},
{
"param": "target_audio_file",
"type": null
},
{
"param": "start_time",
"type": null
},
{
"param": "end_time",
"type": null
},
{
"param": "sample_rate",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "source_audio_file",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "target_audio_file",
"type": null,
"docstring": null,
... |
179ba77231549d149a2bdc2b1ea58081acf7334c | mgoldey/asrtoolkit-draft | asrtoolkit/data_structures/audio_file.py | [
"Apache-2.0"
] | Python | degrade_audio | null | def degrade_audio(source_audio_file, target_audio_file=None):
"""
Degrades audio to typical G711 level. Useful if models need to target this audio quality.
"""
target_audio_file = source_audio_file if target_audio_file is None else target_audio_file
# degrade to 8k
tmp1 = ".".join(source_audio_file.spli... |
Degrades audio to typical G711 level. Useful if models need to target this audio quality.
| Degrades audio to typical G711 level. Useful if models need to target this audio quality. | [
"Degrades",
"audio",
"to",
"typical",
"G711",
"level",
".",
"Useful",
"if",
"models",
"need",
"to",
"target",
"this",
"audio",
"quality",
"."
] | def degrade_audio(source_audio_file, target_audio_file=None):
target_audio_file = source_audio_file if target_audio_file is None else target_audio_file
tmp1 = ".".join(source_audio_file.split(".")[:-1]) + "_tmp1.wav"
subprocess.call(["sox {} -r 8000 -e a-law {}".format(source_audio_file, tmp1)], shell=True)
tmp... | [
"def",
"degrade_audio",
"(",
"source_audio_file",
",",
"target_audio_file",
"=",
"None",
")",
":",
"target_audio_file",
"=",
"source_audio_file",
"if",
"target_audio_file",
"is",
"None",
"else",
"target_audio_file",
"tmp1",
"=",
"\".\"",
".",
"join",
"(",
"source_au... | Degrades audio to typical G711 level. | [
"Degrades",
"audio",
"to",
"typical",
"G711",
"level",
"."
] | [
"\"\"\"\n Degrades audio to typical G711 level. Useful if models need to target this audio quality.\n \"\"\"",
"# degrade to 8k",
"# convert to u-law",
"# upgrade to 16k a-law signed"
] | [
{
"param": "source_audio_file",
"type": null
},
{
"param": "target_audio_file",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "source_audio_file",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "target_audio_file",
"type": null,
"docstring": null,
... |
179ba77231549d149a2bdc2b1ea58081acf7334c | mgoldey/asrtoolkit-draft | asrtoolkit/data_structures/audio_file.py | [
"Apache-2.0"
] | Python | prepare_for_training | <not_specific> | def prepare_for_training(self, file_name):
"""
Converts to single channel (from channel 1) 16k audio file in SPH file format
"""
if file_name.split(".")[-1] != 'sph':
print("Forcing training data to use SPH file format")
file_name = ".".join(file_name.split(".")[-1]) + ".sph"
file_nam... |
Converts to single channel (from channel 1) 16k audio file in SPH file format
| Converts to single channel (from channel 1) 16k audio file in SPH file format | [
"Converts",
"to",
"single",
"channel",
"(",
"from",
"channel",
"1",
")",
"16k",
"audio",
"file",
"in",
"SPH",
"file",
"format"
] | def prepare_for_training(self, file_name):
if file_name.split(".")[-1] != 'sph':
print("Forcing training data to use SPH file format")
file_name = ".".join(file_name.split(".")[-1]) + ".sph"
file_name = sanitize_hyphens(file_name)
subprocess.call(["sox {} {} rate 16k remix 1".format(self.locatio... | [
"def",
"prepare_for_training",
"(",
"self",
",",
"file_name",
")",
":",
"if",
"file_name",
".",
"split",
"(",
"\".\"",
")",
"[",
"-",
"1",
"]",
"!=",
"'sph'",
":",
"print",
"(",
"\"Forcing training data to use SPH file format\"",
")",
"file_name",
"=",
"\".\""... | Converts to single channel (from channel 1) 16k audio file in SPH file format | [
"Converts",
"to",
"single",
"channel",
"(",
"from",
"channel",
"1",
")",
"16k",
"audio",
"file",
"in",
"SPH",
"file",
"format"
] | [
"\"\"\"\n Converts to single channel (from channel 1) 16k audio file in SPH file format\n \"\"\"",
"# return new object"
] | [
{
"param": "self",
"type": null
},
{
"param": "file_name",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "file_name",
"type": null,
"docstring": null,
"docstring_token... |
e9327b17f8255616bad77d9f2786d44ba97f615b | mgoldey/asrtoolkit-draft | asrtoolkit/data_structures/segment.py | [
"Apache-2.0"
] | Python | std_float | <not_specific> | def std_float(number, num_decimals=2):
"""
Print a number to string with n digits after the decimal point (default = 2)
"""
return "{0:.{1:}f}".format(float(number), num_decimals) |
Print a number to string with n digits after the decimal point (default = 2)
| Print a number to string with n digits after the decimal point (default = 2) | [
"Print",
"a",
"number",
"to",
"string",
"with",
"n",
"digits",
"after",
"the",
"decimal",
"point",
"(",
"default",
"=",
"2",
")"
] | def std_float(number, num_decimals=2):
return "{0:.{1:}f}".format(float(number), num_decimals) | [
"def",
"std_float",
"(",
"number",
",",
"num_decimals",
"=",
"2",
")",
":",
"return",
"\"{0:.{1:}f}\"",
".",
"format",
"(",
"float",
"(",
"number",
")",
",",
"num_decimals",
")"
] | Print a number to string with n digits after the decimal point (default = 2) | [
"Print",
"a",
"number",
"to",
"string",
"with",
"n",
"digits",
"after",
"the",
"decimal",
"point",
"(",
"default",
"=",
"2",
")"
] | [
"\"\"\"\n Print a number to string with n digits after the decimal point (default = 2)\n \"\"\""
] | [
{
"param": "number",
"type": null
},
{
"param": "num_decimals",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "number",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "num_decimals",
"type": null,
"docstring": null,
"docstring_... |
e9327b17f8255616bad77d9f2786d44ba97f615b | mgoldey/asrtoolkit-draft | asrtoolkit/data_structures/segment.py | [
"Apache-2.0"
] | Python | seconds_to_timestamp | <not_specific> | def seconds_to_timestamp(seconds):
"""
Convert from seconds to a timestamp
"""
minutes, secondss = divmod(float(seconds), 60)
hours, minutes = divmod(minutes, 60)
return "%02d:%02d:%06.3f" % (hours, minutes, seconds) |
Convert from seconds to a timestamp
| Convert from seconds to a timestamp | [
"Convert",
"from",
"seconds",
"to",
"a",
"timestamp"
] | def seconds_to_timestamp(seconds):
minutes, secondss = divmod(float(seconds), 60)
hours, minutes = divmod(minutes, 60)
return "%02d:%02d:%06.3f" % (hours, minutes, seconds) | [
"def",
"seconds_to_timestamp",
"(",
"seconds",
")",
":",
"minutes",
",",
"secondss",
"=",
"divmod",
"(",
"float",
"(",
"seconds",
")",
",",
"60",
")",
"hours",
",",
"minutes",
"=",
"divmod",
"(",
"minutes",
",",
"60",
")",
"return",
"\"%02d:%02d:%06.3f\"",... | Convert from seconds to a timestamp | [
"Convert",
"from",
"seconds",
"to",
"a",
"timestamp"
] | [
"\"\"\"\n Convert from seconds to a timestamp\n \"\"\""
] | [
{
"param": "seconds",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "seconds",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
e9327b17f8255616bad77d9f2786d44ba97f615b | mgoldey/asrtoolkit-draft | asrtoolkit/data_structures/segment.py | [
"Apache-2.0"
] | Python | clean_float | <not_specific> | def clean_float(input_float):
"""
Return float in seconds (even if it was a timestamp originally)
"""
return timestamp_to_seconds(input_float) if ":" in input_float else std_float(input_float) |
Return float in seconds (even if it was a timestamp originally)
| Return float in seconds (even if it was a timestamp originally) | [
"Return",
"float",
"in",
"seconds",
"(",
"even",
"if",
"it",
"was",
"a",
"timestamp",
"originally",
")"
] | def clean_float(input_float):
return timestamp_to_seconds(input_float) if ":" in input_float else std_float(input_float) | [
"def",
"clean_float",
"(",
"input_float",
")",
":",
"return",
"timestamp_to_seconds",
"(",
"input_float",
")",
"if",
"\":\"",
"in",
"input_float",
"else",
"std_float",
"(",
"input_float",
")"
] | Return float in seconds (even if it was a timestamp originally) | [
"Return",
"float",
"in",
"seconds",
"(",
"even",
"if",
"it",
"was",
"a",
"timestamp",
"originally",
")"
] | [
"\"\"\"\n Return float in seconds (even if it was a timestamp originally)\n \"\"\""
] | [
{
"param": "input_float",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "input_float",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
e9327b17f8255616bad77d9f2786d44ba97f615b | mgoldey/asrtoolkit-draft | asrtoolkit/data_structures/segment.py | [
"Apache-2.0"
] | Python | validate | <not_specific> | def validate(self):
"""
Checks for common failure cases for if a line is valid or not
"""
valid = self.speaker != "inter_segment_gap" and \
self.text and \
self.text != "ignore_time_segment_in_scoring" and \
self.label in ["<o,f0,male>", "<o,f0,female>"]
try:
self.start = ... |
Checks for common failure cases for if a line is valid or not
| Checks for common failure cases for if a line is valid or not | [
"Checks",
"for",
"common",
"failure",
"cases",
"for",
"if",
"a",
"line",
"is",
"valid",
"or",
"not"
] | def validate(self):
valid = self.speaker != "inter_segment_gap" and \
self.text and \
self.text != "ignore_time_segment_in_scoring" and \
self.label in ["<o,f0,male>", "<o,f0,female>"]
try:
self.start = clean_float(self.start)
self.stop = clean_float(self.stop)
except Exception... | [
"def",
"validate",
"(",
"self",
")",
":",
"valid",
"=",
"self",
".",
"speaker",
"!=",
"\"inter_segment_gap\"",
"and",
"self",
".",
"text",
"and",
"self",
".",
"text",
"!=",
"\"ignore_time_segment_in_scoring\"",
"and",
"self",
".",
"label",
"in",
"[",
"\"<o,f... | Checks for common failure cases for if a line is valid or not | [
"Checks",
"for",
"common",
"failure",
"cases",
"for",
"if",
"a",
"line",
"is",
"valid",
"or",
"not"
] | [
"\"\"\"\n Checks for common failure cases for if a line is valid or not\n \"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
38971407014217aede0bfa25cb836f4a0a0c2112 | mgoldey/asrtoolkit-draft | asrtoolkit/clean_formatting.py | [
"Apache-2.0"
] | Python | clean_up | <not_specific> | def clean_up(input_line):
"""
Apply all text cleaning operations to input line
"""
for char_to_replace in [',', '*', '&']:
input_line = input_line.replace(char_to_replace, '')
for pat in rematch:
input_line = re.sub(rematch[pat][0], rematch[pat][1], input_line)
for char_to_replace in [',', '*', ... |
Apply all text cleaning operations to input line
| Apply all text cleaning operations to input line | [
"Apply",
"all",
"text",
"cleaning",
"operations",
"to",
"input",
"line"
] | def clean_up(input_line):
for char_to_replace in [',', '*', '&']:
input_line = input_line.replace(char_to_replace, '')
for pat in rematch:
input_line = re.sub(rematch[pat][0], rematch[pat][1], input_line)
for char_to_replace in [',', '*', '&', '.', '-']:
input_line = input_line.replace(char_to_replace... | [
"def",
"clean_up",
"(",
"input_line",
")",
":",
"for",
"char_to_replace",
"in",
"[",
"','",
",",
"'*'",
",",
"'&'",
"]",
":",
"input_line",
"=",
"input_line",
".",
"replace",
"(",
"char_to_replace",
",",
"''",
")",
"for",
"pat",
"in",
"rematch",
":",
"... | Apply all text cleaning operations to input line | [
"Apply",
"all",
"text",
"cleaning",
"operations",
"to",
"input",
"line"
] | [
"\"\"\"\n Apply all text cleaning operations to input line\n \"\"\"",
"# check for double spacing"
] | [
{
"param": "input_line",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "input_line",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
38971407014217aede0bfa25cb836f4a0a0c2112 | mgoldey/asrtoolkit-draft | asrtoolkit/clean_formatting.py | [
"Apache-2.0"
] | Python | main | null | def main():
"""
Either run tests or clean formatting for files, depending on # of arguments
"""
if len(sys.argv) == 1:
import doctest
doctest.testmod()
for file_name in sys.argv[1:]:
extension = file_name.split(".")[-1]
if extension != 'txt':
print("File does not end in .txt - please ... |
Either run tests or clean formatting for files, depending on # of arguments
| Either run tests or clean formatting for files, depending on # of arguments | [
"Either",
"run",
"tests",
"or",
"clean",
"formatting",
"for",
"files",
"depending",
"on",
"#",
"of",
"arguments"
] | def main():
if len(sys.argv) == 1:
import doctest
doctest.testmod()
for file_name in sys.argv[1:]:
extension = file_name.split(".")[-1]
if extension != 'txt':
print("File does not end in .txt - please only use this for cleaning txt files")
continue
with open(file_name, 'r', encoding=... | [
"def",
"main",
"(",
")",
":",
"if",
"len",
"(",
"sys",
".",
"argv",
")",
"==",
"1",
":",
"import",
"doctest",
"doctest",
".",
"testmod",
"(",
")",
"for",
"file_name",
"in",
"sys",
".",
"argv",
"[",
"1",
":",
"]",
":",
"extension",
"=",
"file_name... | Either run tests or clean formatting for files, depending on # of arguments | [
"Either",
"run",
"tests",
"or",
"clean",
"formatting",
"for",
"files",
"depending",
"on",
"#",
"of",
"arguments"
] | [
"\"\"\"\n Either run tests or clean formatting for files, depending on # of arguments\n \"\"\""
] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} |
4f6235249b189dc2dbc215bca7ebef71ddcc2342 | mgoldey/asrtoolkit-draft | asrtoolkit/file_utils/sanitize_hyphens.py | [
"Apache-2.0"
] | Python | sanitize_hyphens | <not_specific> | def sanitize_hyphens(file_name):
"""
Replace hyphens with underscores if present in file name
"""
if "-" in file_name.split("/")[-1]:
print(
"Replacing hyphens with underscores in SPH file output- check to make sure your audio files and transcript files match"
)
file_name = "/".join(file_nam... |
Replace hyphens with underscores if present in file name
| Replace hyphens with underscores if present in file name | [
"Replace",
"hyphens",
"with",
"underscores",
"if",
"present",
"in",
"file",
"name"
] | def sanitize_hyphens(file_name):
if "-" in file_name.split("/")[-1]:
print(
"Replacing hyphens with underscores in SPH file output- check to make sure your audio files and transcript files match"
)
file_name = "/".join(file_name.split("/")[:-1]) + file_name.split("/")[-1].replace("-", "_")
return ... | [
"def",
"sanitize_hyphens",
"(",
"file_name",
")",
":",
"if",
"\"-\"",
"in",
"file_name",
".",
"split",
"(",
"\"/\"",
")",
"[",
"-",
"1",
"]",
":",
"print",
"(",
"\"Replacing hyphens with underscores in SPH file output- check to make sure your audio files and transcript fi... | Replace hyphens with underscores if present in file name | [
"Replace",
"hyphens",
"with",
"underscores",
"if",
"present",
"in",
"file",
"name"
] | [
"\"\"\"\n Replace hyphens with underscores if present in file name\n \"\"\""
] | [
{
"param": "file_name",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "file_name",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
a618b6ddf4730e0a38b9e04b07523b0ff1110ceb | dti-research/ur_rt_communicator | ur/ur_communicator.py | [
"BSD-3-Clause"
] | Python | recv_handler | <not_specific> | def recv_handler(self):
"""Receives and stores sensory packets from the UR.
Waits for packets to arrive from UR-robot through `socket.recv` call,
checks for any delay in transmission.
This method also handles re-establishing of a lost connection.
Raises:
IOError, Va... | Receives and stores sensory packets from the UR.
Waits for packets to arrive from UR-robot through `socket.recv` call,
checks for any delay in transmission.
This method also handles re-establishing of a lost connection.
Raises:
IOError, ValueError - data convertion errors.
... | Receives and stores sensory packets from the UR.
Waits for packets to arrive from UR-robot through `socket.recv` call,
checks for any delay in transmission.
This method also handles re-establishing of a lost connection.
| [
"Receives",
"and",
"stores",
"sensory",
"packets",
"from",
"the",
"UR",
".",
"Waits",
"for",
"packets",
"to",
"arrive",
"from",
"UR",
"-",
"robot",
"through",
"`",
"socket",
".",
"recv",
"`",
"call",
"checks",
"for",
"any",
"delay",
"in",
"transmission",
... | def recv_handler(self):
try:
REALTIME_COMM_PACKET = ur_utils.get_rt_packet_def(
self._firmware_version)
data = self._sock.recv(
ur_utils.get_rt_packet_size(self._firmware_version))
self._recv_time = time.time()
data = data.ljust(R... | [
"def",
"recv_handler",
"(",
"self",
")",
":",
"try",
":",
"REALTIME_COMM_PACKET",
"=",
"ur_utils",
".",
"get_rt_packet_def",
"(",
"self",
".",
"_firmware_version",
")",
"data",
"=",
"self",
".",
"_sock",
".",
"recv",
"(",
"ur_utils",
".",
"get_rt_packet_size",... | Receives and stores sensory packets from the UR. | [
"Receives",
"and",
"stores",
"sensory",
"packets",
"from",
"the",
"UR",
"."
] | [
"\"\"\"Receives and stores sensory packets from the UR.\n\n Waits for packets to arrive from UR-robot through `socket.recv` call,\n checks for any delay in transmission.\n This method also handles re-establishing of a lost connection.\n\n Raises:\n IOError, ValueError - data c... | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
a618b6ddf4730e0a38b9e04b07523b0ff1110ceb | dti-research/ur_rt_communicator | ur/ur_communicator.py | [
"BSD-3-Clause"
] | Python | pre_check | <not_specific> | def pre_check(self, data):
"""Checks time and completeness of packet reception.
Args:
data: a numpy array with sensory information received from UR5
"""
REALTIME_COMM_PACKET = ur_utils.get_rt_packet_def(
self._firmware_version)
if self._recv_time > self... | Checks time and completeness of packet reception.
Args:
data: a numpy array with sensory information received from UR5
| Checks time and completeness of packet reception. | [
"Checks",
"time",
"and",
"completeness",
"of",
"packet",
"reception",
"."
] | def pre_check(self, data):
REALTIME_COMM_PACKET = ur_utils.get_rt_packet_def(
self._firmware_version)
if self._recv_time > self._prev_recv_time + 1.1 / 125:
logging.debug(
'{}: Hiccup of {:.2f}ms overhead between UR packets)'.format(
self._recv... | [
"def",
"pre_check",
"(",
"self",
",",
"data",
")",
":",
"REALTIME_COMM_PACKET",
"=",
"ur_utils",
".",
"get_rt_packet_def",
"(",
"self",
".",
"_firmware_version",
")",
"if",
"self",
".",
"_recv_time",
">",
"self",
".",
"_prev_recv_time",
"+",
"1.1",
"/",
"125... | Checks time and completeness of packet reception. | [
"Checks",
"time",
"and",
"completeness",
"of",
"packet",
"reception",
"."
] | [
"\"\"\"Checks time and completeness of packet reception.\n\n Args:\n data: a numpy array with sensory information received from UR5\n \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "data",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "data",
"type": null,
"docstring": "a numpy array with sensory infor... |
a618b6ddf4730e0a38b9e04b07523b0ff1110ceb | dti-research/ur_rt_communicator | ur/ur_communicator.py | [
"BSD-3-Clause"
] | Python | make_connection | <not_specific> | def make_connection(host, port, disable_nagle_algorithm):
"""Establishes a TCP/IP socket connection with a UR5 controller.
Args:
host: a string specifying UR5 Controller IP address
port: a string specifying UR5 Controller port
disable_nagle_algorithm: a boolean speci... | Establishes a TCP/IP socket connection with a UR5 controller.
Args:
host: a string specifying UR5 Controller IP address
port: a string specifying UR5 Controller port
disable_nagle_algorithm: a boolean specifying whether to
disable nagle algorithm
Ret... | Establishes a TCP/IP socket connection with a UR5 controller. | [
"Establishes",
"a",
"TCP",
"/",
"IP",
"socket",
"connection",
"with",
"a",
"UR5",
"controller",
"."
] | def make_connection(host, port, disable_nagle_algorithm):
sock = None
for res in socket.getaddrinfo(host,
port,
socket.AF_UNSPEC,
socket.SOCK_STREAM):
afam, socktype, proto, cano... | [
"def",
"make_connection",
"(",
"host",
",",
"port",
",",
"disable_nagle_algorithm",
")",
":",
"sock",
"=",
"None",
"for",
"res",
"in",
"socket",
".",
"getaddrinfo",
"(",
"host",
",",
"port",
",",
"socket",
".",
"AF_UNSPEC",
",",
"socket",
".",
"SOCK_STREAM... | Establishes a TCP/IP socket connection with a UR5 controller. | [
"Establishes",
"a",
"TCP",
"/",
"IP",
"socket",
"connection",
"with",
"a",
"UR5",
"controller",
"."
] | [
"\"\"\"Establishes a TCP/IP socket connection with a UR5 controller.\n\n Args:\n host: a string specifying UR5 Controller IP address\n port: a string specifying UR5 Controller port\n disable_nagle_algorithm: a boolean specifying whether to\n disable nagle algor... | [
{
"param": "host",
"type": null
},
{
"param": "port",
"type": null
},
{
"param": "disable_nagle_algorithm",
"type": null
}
] | {
"returns": [
{
"docstring": "None or TCP socket connected to UR5 device.",
"docstring_tokens": [
"None",
"or",
"TCP",
"socket",
"connected",
"to",
"UR5",
"device",
"."
],
"type": null
}
],
"raises": [],
"pa... |
07d8099f9cfe612824ab341b3560be4e368ddceb | francois-a/pandas-plink | pandas_plink/_read.py | [
"MIT"
] | Python | read_plink1_bin | <not_specific> | def read_plink1_bin(bed, bim=None, fam=None, verbose=True):
"""
Read PLINK 1 binary files [1]_ into a data array.
A PLINK 1 binary file set consists of three files:
- BED: containing the genotype.
- BIM: containing variant information.
- FAM: containing sample information.
The user might ... |
Read PLINK 1 binary files [1]_ into a data array.
A PLINK 1 binary file set consists of three files:
- BED: containing the genotype.
- BIM: containing variant information.
- FAM: containing sample information.
The user might provide a single file path to a BED file, from which this function
... | Read PLINK 1 binary files [1]_ into a data array.
A PLINK 1 binary file set consists of three files.
containing the genotype.
BIM: containing variant information.
FAM: containing sample information.
The user might provide a single file path to a BED file, from which this function
will try to infer the file path of th... | [
"Read",
"PLINK",
"1",
"binary",
"files",
"[",
"1",
"]",
"_",
"into",
"a",
"data",
"array",
".",
"A",
"PLINK",
"1",
"binary",
"file",
"set",
"consists",
"of",
"three",
"files",
".",
"containing",
"the",
"genotype",
".",
"BIM",
":",
"containing",
"varian... | def read_plink1_bin(bed, bim=None, fam=None, verbose=True):
from numpy import int64, float64
from tqdm import tqdm
from xarray import DataArray
import pandas as pd
import dask.array as da
bed_files = sorted(glob(bed))
if len(bed_files) == 0:
raise ValueError("No BED file has been fou... | [
"def",
"read_plink1_bin",
"(",
"bed",
",",
"bim",
"=",
"None",
",",
"fam",
"=",
"None",
",",
"verbose",
"=",
"True",
")",
":",
"from",
"numpy",
"import",
"int64",
",",
"float64",
"from",
"tqdm",
"import",
"tqdm",
"from",
"xarray",
"import",
"DataArray",
... | Read PLINK 1 binary files [1]_ into a data array. | [
"Read",
"PLINK",
"1",
"binary",
"files",
"[",
"1",
"]",
"_",
"into",
"a",
"data",
"array",
"."
] | [
"\"\"\"\n Read PLINK 1 binary files [1]_ into a data array.\n\n A PLINK 1 binary file set consists of three files:\n\n - BED: containing the genotype.\n - BIM: containing variant information.\n - FAM: containing sample information.\n\n The user might provide a single file path to a BED file, from ... | [
{
"param": "bed",
"type": null
},
{
"param": "bim",
"type": null
},
{
"param": "fam",
"type": null
},
{
"param": "verbose",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "bed",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "bim",
"type": null,
"docstring": null,
"docstring_tokens": [],... |
3c196f901f2b4c79395684d9a3faf0128e693030 | RackiSebastian/jina | jina/peapods/runtimes/asyncio/http/__init__.py | [
"Apache-2.0"
] | Python | async_setup | <not_specific> | async def async_setup(self):
"""
The async method setup the runtime.
Setup the uvicorn server.
"""
with ImportExtensions(required=True):
from uvicorn import Config, Server
class UviServer(Server):
"""The uvicorn server."""
async def ... |
The async method setup the runtime.
Setup the uvicorn server.
| The async method setup the runtime.
Setup the uvicorn server. | [
"The",
"async",
"method",
"setup",
"the",
"runtime",
".",
"Setup",
"the",
"uvicorn",
"server",
"."
] | async def async_setup(self):
with ImportExtensions(required=True):
from uvicorn import Config, Server
class UviServer(Server):
async def setup(self, sockets=None):
config = self.config
if not config.loaded:
config.load()
... | [
"async",
"def",
"async_setup",
"(",
"self",
")",
":",
"with",
"ImportExtensions",
"(",
"required",
"=",
"True",
")",
":",
"from",
"uvicorn",
"import",
"Config",
",",
"Server",
"class",
"UviServer",
"(",
"Server",
")",
":",
"\"\"\"The uvicorn server.\"\"\"",
"a... | The async method setup the runtime. | [
"The",
"async",
"method",
"setup",
"the",
"runtime",
"."
] | [
"\"\"\"\n The async method setup the runtime.\n\n Setup the uvicorn server.\n \"\"\"",
"\"\"\"The uvicorn server.\"\"\"",
"\"\"\"\n Setup uvicorn server.\n\n :param sockets: sockets of server.\n \"\"\"",
"\"\"\"\n Start the serve... | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
f5a20499bd901ddb7ab25b6e3e090680aa9870c2 | RackiSebastian/jina | jina/parsers/peapods/runtimes/remote.py | [
"Apache-2.0"
] | Python | mixin_remote_parser | null | def mixin_remote_parser(parser):
"""Add the options for remote expose
:param parser: the parser
"""
gp = add_arg_group(parser, title='Expose')
gp.add_argument(
'--host',
type=str,
default=__default_host__,
help=f'The host address of the runtime, by default it is {__d... | Add the options for remote expose
:param parser: the parser
| Add the options for remote expose | [
"Add",
"the",
"options",
"for",
"remote",
"expose"
] | def mixin_remote_parser(parser):
gp = add_arg_group(parser, title='Expose')
gp.add_argument(
'--host',
type=str,
default=__default_host__,
help=f'The host address of the runtime, by default it is {__default_host__}.',
)
gp.add_argument(
'--port-expose',
ty... | [
"def",
"mixin_remote_parser",
"(",
"parser",
")",
":",
"gp",
"=",
"add_arg_group",
"(",
"parser",
",",
"title",
"=",
"'Expose'",
")",
"gp",
".",
"add_argument",
"(",
"'--host'",
",",
"type",
"=",
"str",
",",
"default",
"=",
"__default_host__",
",",
"help",... | Add the options for remote expose | [
"Add",
"the",
"options",
"for",
"remote",
"expose"
] | [
"\"\"\"Add the options for remote expose\n :param parser: the parser\n \"\"\""
] | [
{
"param": "parser",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "parser",
"type": null,
"docstring": null,
"docstring_tokens": [
"None"
],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
9d4fb85ebac00cd8f37e99ef0e47ee948cf4c76f | jlevy44/JoshuaTree2 | CNSAnalysis/OldScripts/workWithMAF.py | [
"MIT"
] | Python | parseConfigFindPath | <not_specific> | def parseConfigFindPath(stringFind,configFile):
"""findPath will find path of associated specified string or info from config file"""
for line in configFile:
if stringFind in line: # if find string specified, return pathname or info
configFile.seek(0)
return line.split()[-1].stri... | findPath will find path of associated specified string or info from config file | findPath will find path of associated specified string or info from config file | [
"findPath",
"will",
"find",
"path",
"of",
"associated",
"specified",
"string",
"or",
"info",
"from",
"config",
"file"
] | def parseConfigFindPath(stringFind,configFile):
for line in configFile:
if stringFind in line:
configFile.seek(0)
return line.split()[-1].strip('\n') | [
"def",
"parseConfigFindPath",
"(",
"stringFind",
",",
"configFile",
")",
":",
"for",
"line",
"in",
"configFile",
":",
"if",
"stringFind",
"in",
"line",
":",
"configFile",
".",
"seek",
"(",
"0",
")",
"return",
"line",
".",
"split",
"(",
")",
"[",
"-",
"... | findPath will find path of associated specified string or info from config file | [
"findPath",
"will",
"find",
"path",
"of",
"associated",
"specified",
"string",
"or",
"info",
"from",
"config",
"file"
] | [
"\"\"\"findPath will find path of associated specified string or info from config file\"\"\"",
"# if find string specified, return pathname or info"
] | [
{
"param": "stringFind",
"type": null
},
{
"param": "configFile",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "stringFind",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "configFile",
"type": null,
"docstring": null,
"docstrin... |
9d4fb85ebac00cd8f37e99ef0e47ee948cf4c76f | jlevy44/JoshuaTree2 | CNSAnalysis/OldScripts/workWithMAF.py | [
"MIT"
] | Python | findBadCharPosition | <not_specific> | def findBadCharPosition(strSeq):
"""for each MAF sequence, output maximum number of valid characters in a row, exclude duplicates/lowercase/N/softmask <- invalid
only accept sequence in analysis if at least 15 valid characters in a row"""
#minVal = np.min(np.vectorize(lambda y: turnSixteen(y))(np.vectorize(... | for each MAF sequence, output maximum number of valid characters in a row, exclude duplicates/lowercase/N/softmask <- invalid
only accept sequence in analysis if at least 15 valid characters in a row | for each MAF sequence, output maximum number of valid characters in a row, exclude duplicates/lowercase/N/softmask <- invalid
only accept sequence in analysis if at least 15 valid characters in a row | [
"for",
"each",
"MAF",
"sequence",
"output",
"maximum",
"number",
"of",
"valid",
"characters",
"in",
"a",
"row",
"exclude",
"duplicates",
"/",
"lowercase",
"/",
"N",
"/",
"softmask",
"<",
"-",
"invalid",
"only",
"accept",
"sequence",
"in",
"analysis",
"if",
... | def findBadCharPosition(strSeq):
if 'a' in strSeq or 'c' in strSeq or 'N' in strSeq or 'g' in strSeq or 't' in strSeq:
return np.max(np.vectorize(lambda x: len(x))(np.array(strSeq.replace('a','N').replace('c','N').replace('t','N').replace('g','N').strip('-').split('N'))))
else:
return 16 | [
"def",
"findBadCharPosition",
"(",
"strSeq",
")",
":",
"\"\"\"\n if minVal == -1:\n return 16\n else:\n return minVal\n \"\"\"",
"if",
"'a'",
"in",
"strSeq",
"or",
"'c'",
"in",
"strSeq",
"or",
"'N'",
"in",
"strSeq",
"or",
"'g'",
"in",
"strSeq",
"o... | for each MAF sequence, output maximum number of valid characters in a row, exclude duplicates/lowercase/N/softmask <- invalid
only accept sequence in analysis if at least 15 valid characters in a row | [
"for",
"each",
"MAF",
"sequence",
"output",
"maximum",
"number",
"of",
"valid",
"characters",
"in",
"a",
"row",
"exclude",
"duplicates",
"/",
"lowercase",
"/",
"N",
"/",
"softmask",
"<",
"-",
"invalid",
"only",
"accept",
"sequence",
"in",
"analysis",
"if",
... | [
"\"\"\"for each MAF sequence, output maximum number of valid characters in a row, exclude duplicates/lowercase/N/softmask <- invalid\n only accept sequence in analysis if at least 15 valid characters in a row\"\"\"",
"#minVal = np.min(np.vectorize(lambda y: turnSixteen(y))(np.vectorize(lambda x: strSeq.find(x)... | [
{
"param": "strSeq",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "strSeq",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
769d7ef650b65a3c4b7730786c4c93192ef37f20 | jlevy44/JoshuaTree2 | CNSAnalysis/AdditionalAnalyses/calculateXYZ.py | [
"MIT"
] | Python | parseConfigFindList | <not_specific> | def parseConfigFindList(stringFind,configFile):
"""parseConfigFindList inputs a particular string to find and read file after and a configuration file object
outputs list of relevant filenames"""
read = 0
listOfItems = []
for line in configFile:
if line:
if read == 1:
... | parseConfigFindList inputs a particular string to find and read file after and a configuration file object
outputs list of relevant filenames | parseConfigFindList inputs a particular string to find and read file after and a configuration file object
outputs list of relevant filenames | [
"parseConfigFindList",
"inputs",
"a",
"particular",
"string",
"to",
"find",
"and",
"read",
"file",
"after",
"and",
"a",
"configuration",
"file",
"object",
"outputs",
"list",
"of",
"relevant",
"filenames"
] | def parseConfigFindList(stringFind,configFile):
read = 0
listOfItems = []
for line in configFile:
if line:
if read == 1:
if 'Stop' in line:
configFile.seek(0)
break
listOfItems.append(line.strip('\n'))
i... | [
"def",
"parseConfigFindList",
"(",
"stringFind",
",",
"configFile",
")",
":",
"read",
"=",
"0",
"listOfItems",
"=",
"[",
"]",
"for",
"line",
"in",
"configFile",
":",
"if",
"line",
":",
"if",
"read",
"==",
"1",
":",
"if",
"'Stop'",
"in",
"line",
":",
... | parseConfigFindList inputs a particular string to find and read file after and a configuration file object
outputs list of relevant filenames | [
"parseConfigFindList",
"inputs",
"a",
"particular",
"string",
"to",
"find",
"and",
"read",
"file",
"after",
"and",
"a",
"configuration",
"file",
"object",
"outputs",
"list",
"of",
"relevant",
"filenames"
] | [
"\"\"\"parseConfigFindList inputs a particular string to find and read file after and a configuration file object\n outputs list of relevant filenames\"\"\"",
"# exit the function and return the list of files or list information",
"# if find string specified, begin reading lines"
] | [
{
"param": "stringFind",
"type": null
},
{
"param": "configFile",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "stringFind",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "configFile",
"type": null,
"docstring": null,
"docstrin... |
769d7ef650b65a3c4b7730786c4c93192ef37f20 | jlevy44/JoshuaTree2 | CNSAnalysis/AdditionalAnalyses/calculateXYZ.py | [
"MIT"
] | Python | parseConfigFindPath | <not_specific> | def parseConfigFindPath(stringFind,configFile):
"""findPath will find path of associated specified string or info from config file"""
for line in configFile:
if stringFind in line: # if find string specified, return pathname or info
configFile.seek(0)
return line.split()[-1].stri... | findPath will find path of associated specified string or info from config file | findPath will find path of associated specified string or info from config file | [
"findPath",
"will",
"find",
"path",
"of",
"associated",
"specified",
"string",
"or",
"info",
"from",
"config",
"file"
] | def parseConfigFindPath(stringFind,configFile):
for line in configFile:
if stringFind in line:
configFile.seek(0)
return line.split()[-1].strip('\n')
configFile.seek(0) | [
"def",
"parseConfigFindPath",
"(",
"stringFind",
",",
"configFile",
")",
":",
"for",
"line",
"in",
"configFile",
":",
"if",
"stringFind",
"in",
"line",
":",
"configFile",
".",
"seek",
"(",
"0",
")",
"return",
"line",
".",
"split",
"(",
")",
"[",
"-",
"... | findPath will find path of associated specified string or info from config file | [
"findPath",
"will",
"find",
"path",
"of",
"associated",
"specified",
"string",
"or",
"info",
"from",
"config",
"file"
] | [
"\"\"\"findPath will find path of associated specified string or info from config file\"\"\"",
"# if find string specified, return pathname or info"
] | [
{
"param": "stringFind",
"type": null
},
{
"param": "configFile",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "stringFind",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "configFile",
"type": null,
"docstring": null,
"docstrin... |
f3f408434ca72bf3ca1481b498df42a1c2de44fe | jlevy44/JoshuaTree2 | CNSAnalysis/CNS_commandline.py | [
"MIT"
] | Python | CNS_RetentionvsGeneticDistance | null | def CNS_RetentionvsGeneticDistance(CNS_bed, reference_species, tree_file, species_file):
"""Reference should be CNS bed species"""
import plotly.graph_objs as go
import plotly.offline as py
import matplotlib.pyplot as plt
from collections import defaultdict
from scipy import stats
tree_mat =... | Reference should be CNS bed species | Reference should be CNS bed species | [
"Reference",
"should",
"be",
"CNS",
"bed",
"species"
] | def CNS_RetentionvsGeneticDistance(CNS_bed, reference_species, tree_file, species_file):
import plotly.graph_objs as go
import plotly.offline as py
import matplotlib.pyplot as plt
from collections import defaultdict
from scipy import stats
tree_mat = tree2matrix(tree_file)
species = tree_mat... | [
"def",
"CNS_RetentionvsGeneticDistance",
"(",
"CNS_bed",
",",
"reference_species",
",",
"tree_file",
",",
"species_file",
")",
":",
"import",
"plotly",
".",
"graph_objs",
"as",
"go",
"import",
"plotly",
".",
"offline",
"as",
"py",
"import",
"matplotlib",
".",
"p... | Reference should be CNS bed species | [
"Reference",
"should",
"be",
"CNS",
"bed",
"species"
] | [
"\"\"\"Reference should be CNS bed species\"\"\"",
"#genetic_distances = tree_mat[reference_species]",
"#FIXME binarize CNS matrix",
"#FIXME debug",
"#FIXME fix local PCA",
"# FIXME finish, add tests for independence between genetic distance and retention, check if polyploid reduction in retention",
"# ... | [
{
"param": "CNS_bed",
"type": null
},
{
"param": "reference_species",
"type": null
},
{
"param": "tree_file",
"type": null
},
{
"param": "species_file",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "CNS_bed",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "reference_species",
"type": null,
"docstring": null,
"docs... |
f3f408434ca72bf3ca1481b498df42a1c2de44fe | jlevy44/JoshuaTree2 | CNSAnalysis/CNS_commandline.py | [
"MIT"
] | Python | annotate_snps | null | def annotate_snps(vcf_in,genome_name,fasta_in,gff_in,vcf_out):
"""Goal is to find synonymous and non-synonymous regions of SNPs"""
# format gff in
#subprocess.call('grep -v "#" %s | sort -k1,1 -k2,2n -k3,3n -t$\'\t\' | bgzip -c > %s.gz && tabix -p gff %s.gz'%(gff_in,gff_in,gff_in),shell=True)
snp_eff_li... | Goal is to find synonymous and non-synonymous regions of SNPs | Goal is to find synonymous and non-synonymous regions of SNPs | [
"Goal",
"is",
"to",
"find",
"synonymous",
"and",
"non",
"-",
"synonymous",
"regions",
"of",
"SNPs"
] | def annotate_snps(vcf_in,genome_name,fasta_in,gff_in,vcf_out):
snp_eff_line = next(path for path in sys.path if 'conda/' in path and '/lib/' in path).split('/lib/')[0]+'/share/snpeff-4.3.1r-0/snpEff.config'
subprocess.call('scp %s . && mkdir -p ./data/%s'%(snp_eff_line,genome_name),shell=True)
with open('sn... | [
"def",
"annotate_snps",
"(",
"vcf_in",
",",
"genome_name",
",",
"fasta_in",
",",
"gff_in",
",",
"vcf_out",
")",
":",
"snp_eff_line",
"=",
"next",
"(",
"path",
"for",
"path",
"in",
"sys",
".",
"path",
"if",
"'conda/'",
"in",
"path",
"and",
"'/lib/'",
"in"... | Goal is to find synonymous and non-synonymous regions of SNPs | [
"Goal",
"is",
"to",
"find",
"synonymous",
"and",
"non",
"-",
"synonymous",
"regions",
"of",
"SNPs"
] | [
"\"\"\"Goal is to find synonymous and non-synonymous regions of SNPs\"\"\"",
"# format gff in",
"#subprocess.call('grep -v \"#\" %s | sort -k1,1 -k2,2n -k3,3n -t$\\'\\t\\' | bgzip -c > %s.gz && tabix -p gff %s.gz'%(gff_in,gff_in,gff_in),shell=True)"
] | [
{
"param": "vcf_in",
"type": null
},
{
"param": "genome_name",
"type": null
},
{
"param": "fasta_in",
"type": null
},
{
"param": "gff_in",
"type": null
},
{
"param": "vcf_out",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "vcf_in",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "genome_name",
"type": null,
"docstring": null,
"docstring_t... |
1d91ac3b21ab1014aa2637931037ec84d9e4dd90 | jlevy44/JoshuaTree2 | JoshuaTree2.py | [
"MIT"
] | Python | generate_synteny_structure | null | def generate_synteny_structure(self,synteny_path):
"""Take anchor file or synteny file and searches for starting and ending genes for each syntenic block"""
if self.synteny_file.endswith('.unout'):
self.unout2structure(self.q_genome, self.s_genome)
elif self.synteny_file.endswith('.l... | Take anchor file or synteny file and searches for starting and ending genes for each syntenic block | Take anchor file or synteny file and searches for starting and ending genes for each syntenic block | [
"Take",
"anchor",
"file",
"or",
"synteny",
"file",
"and",
"searches",
"for",
"starting",
"and",
"ending",
"genes",
"for",
"each",
"syntenic",
"block"
] | def generate_synteny_structure(self,synteny_path):
if self.synteny_file.endswith('.unout'):
self.unout2structure(self.q_genome, self.s_genome)
elif self.synteny_file.endswith('.lifted.anchors'):
self.anchor2structure(self.q_genome, self.s_genome)
elif self.synteny_file.en... | [
"def",
"generate_synteny_structure",
"(",
"self",
",",
"synteny_path",
")",
":",
"if",
"self",
".",
"synteny_file",
".",
"endswith",
"(",
"'.unout'",
")",
":",
"self",
".",
"unout2structure",
"(",
"self",
".",
"q_genome",
",",
"self",
".",
"s_genome",
")",
... | Take anchor file or synteny file and searches for starting and ending genes for each syntenic block | [
"Take",
"anchor",
"file",
"or",
"synteny",
"file",
"and",
"searches",
"for",
"starting",
"and",
"ending",
"genes",
"for",
"each",
"syntenic",
"block"
] | [
"\"\"\"Take anchor file or synteny file and searches for starting and ending genes for each syntenic block\"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "synteny_path",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "synteny_path",
"type": null,
"docstring": null,
"docstring_to... |
1d91ac3b21ab1014aa2637931037ec84d9e4dd90 | jlevy44/JoshuaTree2 | JoshuaTree2.py | [
"MIT"
] | Python | maf2vcf | null | def maf2vcf(self, maf_filter_config, species, reference_species, reference_species_fai, vcf_out, change_coordinates = True):
"""Run on a merged maf file first by using merger."""
reference_species_chromosomes = dict(zip(os.popen("awk '{print $1}' %s"%reference_species_fai).read().splitlines(),map(int,os... | Run on a merged maf file first by using merger. | Run on a merged maf file first by using merger. | [
"Run",
"on",
"a",
"merged",
"maf",
"file",
"first",
"by",
"using",
"merger",
"."
] | def maf2vcf(self, maf_filter_config, species, reference_species, reference_species_fai, vcf_out, change_coordinates = True):
reference_species_chromosomes = dict(zip(os.popen("awk '{print $1}' %s"%reference_species_fai).read().splitlines(),map(int,os.popen("awk '{print $2}' %s"%reference_species_fai).read().spl... | [
"def",
"maf2vcf",
"(",
"self",
",",
"maf_filter_config",
",",
"species",
",",
"reference_species",
",",
"reference_species_fai",
",",
"vcf_out",
",",
"change_coordinates",
"=",
"True",
")",
":",
"reference_species_chromosomes",
"=",
"dict",
"(",
"zip",
"(",
"os",
... | Run on a merged maf file first by using merger. | [
"Run",
"on",
"a",
"merged",
"maf",
"file",
"first",
"by",
"using",
"merger",
"."
] | [
"\"\"\"Run on a merged maf file first by using merger.\"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "maf_filter_config",
"type": null
},
{
"param": "species",
"type": null
},
{
"param": "reference_species",
"type": null
},
{
"param": "reference_species_fai",
"type": null
},
{
"param": "vcf_out",
"type... | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "maf_filter_config",
"type": null,
"docstring": null,
"docstri... |
1d91ac3b21ab1014aa2637931037ec84d9e4dd90 | jlevy44/JoshuaTree2 | JoshuaTree2.py | [
"MIT"
] | Python | run_synteny_pipeline | <not_specific> | def run_synteny_pipeline(query_prot_id,fasta_path,synteny_path,gff_path, bed_path, gene_info, fasta_out_dir, bps_threshold, loci_threshold, circos, circos_inputs, circos_outputs):
"""Stitch together many pairwise syntenic blocks into multiple species syntenic blocks and output as fasta files for a multiple sequence... | Stitch together many pairwise syntenic blocks into multiple species syntenic blocks and output as fasta files for a multiple sequence alignment. If synteny files are not supplied, conduct pairwise synteny between all included strains. | Stitch together many pairwise syntenic blocks into multiple species syntenic blocks and output as fasta files for a multiple sequence alignment. If synteny files are not supplied, conduct pairwise synteny between all included strains. | [
"Stitch",
"together",
"many",
"pairwise",
"syntenic",
"blocks",
"into",
"multiple",
"species",
"syntenic",
"blocks",
"and",
"output",
"as",
"fasta",
"files",
"for",
"a",
"multiple",
"sequence",
"alignment",
".",
"If",
"synteny",
"files",
"are",
"not",
"supplied"... | def run_synteny_pipeline(query_prot_id,fasta_path,synteny_path,gff_path, bed_path, gene_info, fasta_out_dir, bps_threshold, loci_threshold, circos, circos_inputs, circos_outputs):
query_protID = query_prot_id
fasta_files = {fasta.split('_')[-2] : fasta for fasta in glob.glob(fasta_path+'/*.fa')+glob.glob(fasta_... | [
"def",
"run_synteny_pipeline",
"(",
"query_prot_id",
",",
"fasta_path",
",",
"synteny_path",
",",
"gff_path",
",",
"bed_path",
",",
"gene_info",
",",
"fasta_out_dir",
",",
"bps_threshold",
",",
"loci_threshold",
",",
"circos",
",",
"circos_inputs",
",",
"circos_outp... | Stitch together many pairwise syntenic blocks into multiple species syntenic blocks and output as fasta files for a multiple sequence alignment. | [
"Stitch",
"together",
"many",
"pairwise",
"syntenic",
"blocks",
"into",
"multiple",
"species",
"syntenic",
"blocks",
"and",
"output",
"as",
"fasta",
"files",
"for",
"a",
"multiple",
"sequence",
"alignment",
"."
] | [
"\"\"\"Stitch together many pairwise syntenic blocks into multiple species syntenic blocks and output as fasta files for a multiple sequence alignment. If synteny files are not supplied, conduct pairwise synteny between all included strains.\"\"\"",
"# fixme for now... in future, implement -global option so all s... | [
{
"param": "query_prot_id",
"type": null
},
{
"param": "fasta_path",
"type": null
},
{
"param": "synteny_path",
"type": null
},
{
"param": "gff_path",
"type": null
},
{
"param": "bed_path",
"type": null
},
{
"param": "gene_info",
"type": null
},
... | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "query_prot_id",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "fasta_path",
"type": null,
"docstring": null,
"docst... |
1d91ac3b21ab1014aa2637931037ec84d9e4dd90 | jlevy44/JoshuaTree2 | JoshuaTree2.py | [
"MIT"
] | Python | extract_syntenic_blocks | null | def extract_syntenic_blocks(fasta_1, fasta_2, gff_1, gff_2, link_file, gene_info, loci_threshold, work_dir):
"""Run pairwise circos in local directory."""
work_dir += '/'
genome1 = Genome(fasta_file=fasta_1, bed_file=work_dir+gff_1.split('.')[-2]+'.bed', protID=gff_1.split('.')[-2], gff_file=gff_1, gene_inf... | Run pairwise circos in local directory. | Run pairwise circos in local directory. | [
"Run",
"pairwise",
"circos",
"in",
"local",
"directory",
"."
] | def extract_syntenic_blocks(fasta_1, fasta_2, gff_1, gff_2, link_file, gene_info, loci_threshold, work_dir):
work_dir += '/'
genome1 = Genome(fasta_file=fasta_1, bed_file=work_dir+gff_1.split('.')[-2]+'.bed', protID=gff_1.split('.')[-2], gff_file=gff_1, gene_info=gene_info)
genome2 = Genome(fasta_file=fasta... | [
"def",
"extract_syntenic_blocks",
"(",
"fasta_1",
",",
"fasta_2",
",",
"gff_1",
",",
"gff_2",
",",
"link_file",
",",
"gene_info",
",",
"loci_threshold",
",",
"work_dir",
")",
":",
"work_dir",
"+=",
"'/'",
"genome1",
"=",
"Genome",
"(",
"fasta_file",
"=",
"fa... | Run pairwise circos in local directory. | [
"Run",
"pairwise",
"circos",
"in",
"local",
"directory",
"."
] | [
"\"\"\"Run pairwise circos in local directory.\"\"\""
] | [
{
"param": "fasta_1",
"type": null
},
{
"param": "fasta_2",
"type": null
},
{
"param": "gff_1",
"type": null
},
{
"param": "gff_2",
"type": null
},
{
"param": "link_file",
"type": null
},
{
"param": "gene_info",
"type": null
},
{
"param": "... | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "fasta_1",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "fasta_2",
"type": null,
"docstring": null,
"docstring_toke... |
1d91ac3b21ab1014aa2637931037ec84d9e4dd90 | jlevy44/JoshuaTree2 | JoshuaTree2.py | [
"MIT"
] | Python | pairwise_circos | null | def pairwise_circos(fasta_1, fasta_2, gff_1, gff_2, link_file, chrom_file1, chrom_file2, gene_info, loci_threshold, n_chromosomes, work_dir, variable_thickness, thickness_factor, bundle_links, link_gap, switch_lines, no_output_circos):
"""Run pairwise circos in local directory."""
work_dir += '/'
genome1 = ... | Run pairwise circos in local directory. | Run pairwise circos in local directory. | [
"Run",
"pairwise",
"circos",
"in",
"local",
"directory",
"."
] | def pairwise_circos(fasta_1, fasta_2, gff_1, gff_2, link_file, chrom_file1, chrom_file2, gene_info, loci_threshold, n_chromosomes, work_dir, variable_thickness, thickness_factor, bundle_links, link_gap, switch_lines, no_output_circos):
work_dir += '/'
genome1 = Genome(fasta_file=fasta_1, bed_file=work_dir+gff_1... | [
"def",
"pairwise_circos",
"(",
"fasta_1",
",",
"fasta_2",
",",
"gff_1",
",",
"gff_2",
",",
"link_file",
",",
"chrom_file1",
",",
"chrom_file2",
",",
"gene_info",
",",
"loci_threshold",
",",
"n_chromosomes",
",",
"work_dir",
",",
"variable_thickness",
",",
"thick... | Run pairwise circos in local directory. | [
"Run",
"pairwise",
"circos",
"in",
"local",
"directory",
"."
] | [
"\"\"\"Run pairwise circos in local directory.\"\"\""
] | [
{
"param": "fasta_1",
"type": null
},
{
"param": "fasta_2",
"type": null
},
{
"param": "gff_1",
"type": null
},
{
"param": "gff_2",
"type": null
},
{
"param": "link_file",
"type": null
},
{
"param": "chrom_file1",
"type": null
},
{
"param":... | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "fasta_1",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "fasta_2",
"type": null,
"docstring": null,
"docstring_toke... |
1d91ac3b21ab1014aa2637931037ec84d9e4dd90 | jlevy44/JoshuaTree2 | JoshuaTree2.py | [
"MIT"
] | Python | circos_dropper | <not_specific> | def circos_dropper(fasta_path, gff_path, synteny_path, bed_path, circos_inputs, circos_outputs, loci_threshold,gene_info, n_cpus):
"""Visualize many pairwise synteny results. If synteny files are not supplied, conduct pairwise synteny between all included strains."""
fasta_files = {fasta.split('_')[-2] : fasta ... | Visualize many pairwise synteny results. If synteny files are not supplied, conduct pairwise synteny between all included strains. | Visualize many pairwise synteny results. If synteny files are not supplied, conduct pairwise synteny between all included strains. | [
"Visualize",
"many",
"pairwise",
"synteny",
"results",
".",
"If",
"synteny",
"files",
"are",
"not",
"supplied",
"conduct",
"pairwise",
"synteny",
"between",
"all",
"included",
"strains",
"."
] | def circos_dropper(fasta_path, gff_path, synteny_path, bed_path, circos_inputs, circos_outputs, loci_threshold,gene_info, n_cpus):
fasta_files = {fasta.split('_')[-2] : fasta for fasta in glob.glob(fasta_path+'/*.fa')+glob.glob(fasta_path+'/*.fasta')}
gff_files = {gff.split('.')[-2] : gff for gff in glob.glob(g... | [
"def",
"circos_dropper",
"(",
"fasta_path",
",",
"gff_path",
",",
"synteny_path",
",",
"bed_path",
",",
"circos_inputs",
",",
"circos_outputs",
",",
"loci_threshold",
",",
"gene_info",
",",
"n_cpus",
")",
":",
"fasta_files",
"=",
"{",
"fasta",
".",
"split",
"(... | Visualize many pairwise synteny results. | [
"Visualize",
"many",
"pairwise",
"synteny",
"results",
"."
] | [
"\"\"\"Visualize many pairwise synteny results. If synteny files are not supplied, conduct pairwise synteny between all included strains.\"\"\"",
"#print remaining_synteny",
"#p = mp.ProcessingPool(ncpus=n_cpus)",
"#p.daemon = True",
"#r = p.amap(generate_CDS,list(set(reduce(lambda x,y: list(x)+list(y),rema... | [
{
"param": "fasta_path",
"type": null
},
{
"param": "gff_path",
"type": null
},
{
"param": "synteny_path",
"type": null
},
{
"param": "bed_path",
"type": null
},
{
"param": "circos_inputs",
"type": null
},
{
"param": "circos_outputs",
"type": null
... | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "fasta_path",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "gff_path",
"type": null,
"docstring": null,
"docstring_... |
1d91ac3b21ab1014aa2637931037ec84d9e4dd90 | jlevy44/JoshuaTree2 | JoshuaTree2.py | [
"MIT"
] | Python | run_cactus | null | def run_cactus(fasta_output_path,cactus_run_directory,cactus_softlink, n_cpus, hal2maf_softlink, nickname_file, fasta_path, submission_system, shifter): #fixme get rid of '' and add to command line tool
"""Run multiple sequence alignment via Progressive Cactus on multiple species synteny blocks and export as maf fi... | Run multiple sequence alignment via Progressive Cactus on multiple species synteny blocks and export as maf files. Try to run softlink_cactus beforehand, else use official cactus paths instead of softlinks. | Run multiple sequence alignment via Progressive Cactus on multiple species synteny blocks and export as maf files. Try to run softlink_cactus beforehand, else use official cactus paths instead of softlinks. | [
"Run",
"multiple",
"sequence",
"alignment",
"via",
"Progressive",
"Cactus",
"on",
"multiple",
"species",
"synteny",
"blocks",
"and",
"export",
"as",
"maf",
"files",
".",
"Try",
"to",
"run",
"softlink_cactus",
"beforehand",
"else",
"use",
"official",
"cactus",
"p... | def run_cactus(fasta_output_path,cactus_run_directory,cactus_softlink, n_cpus, hal2maf_softlink, nickname_file, fasta_path, submission_system, shifter):
cactus_run_obj = CactusRun(fasta_output_path,cactus_run_directory,cactus_softlink, nickname_file, fasta_path)
cactus_run_obj.write_fastas_seqfile()
cactus... | [
"def",
"run_cactus",
"(",
"fasta_output_path",
",",
"cactus_run_directory",
",",
"cactus_softlink",
",",
"n_cpus",
",",
"hal2maf_softlink",
",",
"nickname_file",
",",
"fasta_path",
",",
"submission_system",
",",
"shifter",
")",
":",
"cactus_run_obj",
"=",
"CactusRun",... | Run multiple sequence alignment via Progressive Cactus on multiple species synteny blocks and export as maf files. | [
"Run",
"multiple",
"sequence",
"alignment",
"via",
"Progressive",
"Cactus",
"on",
"multiple",
"species",
"synteny",
"blocks",
"and",
"export",
"as",
"maf",
"files",
"."
] | [
"#fixme get rid of '' and add to command line tool",
"\"\"\"Run multiple sequence alignment via Progressive Cactus on multiple species synteny blocks and export as maf files. Try to run softlink_cactus beforehand, else use official cactus paths instead of softlinks.\"\"\""
] | [
{
"param": "fasta_output_path",
"type": null
},
{
"param": "cactus_run_directory",
"type": null
},
{
"param": "cactus_softlink",
"type": null
},
{
"param": "n_cpus",
"type": null
},
{
"param": "hal2maf_softlink",
"type": null
},
{
"param": "nickname_fi... | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "fasta_output_path",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "cactus_run_directory",
"type": null,
"docstring": null... |
1d91ac3b21ab1014aa2637931037ec84d9e4dd90 | jlevy44/JoshuaTree2 | JoshuaTree2.py | [
"MIT"
] | Python | softlink_cactus | null | def softlink_cactus(cactus_distribution_dir,softlink_cactus_name, softlink_hal2maf_name):
"""Softlink cactus distribution's cactus bash script, virtual environment, and hal2maf program. Useful if installed Cactus to particular directory and want to save time in referencing that directory when running cactus."""
... | Softlink cactus distribution's cactus bash script, virtual environment, and hal2maf program. Useful if installed Cactus to particular directory and want to save time in referencing that directory when running cactus. | Softlink cactus distribution's cactus bash script, virtual environment, and hal2maf program. Useful if installed Cactus to particular directory and want to save time in referencing that directory when running cactus. | [
"Softlink",
"cactus",
"distribution",
"'",
"s",
"cactus",
"bash",
"script",
"virtual",
"environment",
"and",
"hal2maf",
"program",
".",
"Useful",
"if",
"installed",
"Cactus",
"to",
"particular",
"directory",
"and",
"want",
"to",
"save",
"time",
"in",
"referencin... | def softlink_cactus(cactus_distribution_dir,softlink_cactus_name, softlink_hal2maf_name):
subprocess.call('ln -s %s %s'%(os.path.abspath(cactus_distribution_dir),softlink_cactus_name),shell=True)
subprocess.call('ln -s %s %s'%(os.path.abspath(cactus_distribution_dir+'/submodules/hal/bin/hal2mafMP.py'),softlink_... | [
"def",
"softlink_cactus",
"(",
"cactus_distribution_dir",
",",
"softlink_cactus_name",
",",
"softlink_hal2maf_name",
")",
":",
"subprocess",
".",
"call",
"(",
"'ln -s %s %s'",
"%",
"(",
"os",
".",
"path",
".",
"abspath",
"(",
"cactus_distribution_dir",
")",
",",
"... | Softlink cactus distribution's cactus bash script, virtual environment, and hal2maf program. | [
"Softlink",
"cactus",
"distribution",
"'",
"s",
"cactus",
"bash",
"script",
"virtual",
"environment",
"and",
"hal2maf",
"program",
"."
] | [
"\"\"\"Softlink cactus distribution's cactus bash script, virtual environment, and hal2maf program. Useful if installed Cactus to particular directory and want to save time in referencing that directory when running cactus.\"\"\"",
"#subprocess.call('ln -s %s %s'%(os.path.abspath(cactus_distribution_dir+'/bin/run... | [
{
"param": "cactus_distribution_dir",
"type": null
},
{
"param": "softlink_cactus_name",
"type": null
},
{
"param": "softlink_hal2maf_name",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "cactus_distribution_dir",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "softlink_cactus_name",
"type": null,
"docstring"... |
1d91ac3b21ab1014aa2637931037ec84d9e4dd90 | jlevy44/JoshuaTree2 | JoshuaTree2.py | [
"MIT"
] | Python | install_cactus | null | def install_cactus(install_path):
"""Install the Cactus distribution and hal tools.""" # fixme, make sure hal tools works
os.chdir(install_path)
conda_env = os.popen('echo $CONDA_PREFIX').read().split('/')[-1]
subprocess.call('git config --global --add http.sslVersion tlsv1.2\ngit clone git://github.com... | Install the Cactus distribution and hal tools. | Install the Cactus distribution and hal tools. | [
"Install",
"the",
"Cactus",
"distribution",
"and",
"hal",
"tools",
"."
] | def install_cactus(install_path):
os.chdir(install_path)
conda_env = os.popen('echo $CONDA_PREFIX').read().split('/')[-1]
subprocess.call('git config --global --add http.sslVersion tlsv1.2\ngit clone git://github.com/glennhickey/progressiveCactus.git\ncd progressiveCactus\ngit pull\ngit submodule update --i... | [
"def",
"install_cactus",
"(",
"install_path",
")",
":",
"os",
".",
"chdir",
"(",
"install_path",
")",
"conda_env",
"=",
"os",
".",
"popen",
"(",
"'echo $CONDA_PREFIX'",
")",
".",
"read",
"(",
")",
".",
"split",
"(",
"'/'",
")",
"[",
"-",
"1",
"]",
"s... | Install the Cactus distribution and hal tools. | [
"Install",
"the",
"Cactus",
"distribution",
"and",
"hal",
"tools",
"."
] | [
"\"\"\"Install the Cactus distribution and hal tools.\"\"\"",
"# fixme, make sure hal tools works",
"# source deactivate\\n \\nsource activate %s\\n'%conda_env"
] | [
{
"param": "install_path",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "install_path",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
e46fb0f46d7b9a12bfc46c4effa3fb7387790ccd | jlevy44/JoshuaTree2 | CNSAnalysis/CNSAnalysisv1.py | [
"MIT"
] | Python | findBadCharPosition | <not_specific> | def findBadCharPosition(strSeq):
"""for each MAF sequence, output maximum number of valid characters in a row, exclude duplicates/lowercase/N/softmask <- invalid
only accept sequence in analysis if at least 15 valid characters in a row"""
#minVal = np.min(np.vectorize(lambda y: turnSixteen(y))(np.vectorize(... | for each MAF sequence, output maximum number of valid characters in a row, exclude duplicates/lowercase/N/softmask <- invalid
only accept sequence in analysis if at least 15 valid characters in a row | for each MAF sequence, output maximum number of valid characters in a row, exclude duplicates/lowercase/N/softmask <- invalid
only accept sequence in analysis if at least 15 valid characters in a row | [
"for",
"each",
"MAF",
"sequence",
"output",
"maximum",
"number",
"of",
"valid",
"characters",
"in",
"a",
"row",
"exclude",
"duplicates",
"/",
"lowercase",
"/",
"N",
"/",
"softmask",
"<",
"-",
"invalid",
"only",
"accept",
"sequence",
"in",
"analysis",
"if",
... | def findBadCharPosition(strSeq):
if 'a' in strSeq or 'c' in strSeq or 'n' in strSeq or 'N' in strSeq or 'g' in strSeq or 't' in strSeq:
return np.max(np.vectorize(lambda x: len(x))(np.array(strSeq.replace('a','N').replace('c','N').replace('t','N').replace('g','N').replace('n','N').strip('-').split('N'))))
... | [
"def",
"findBadCharPosition",
"(",
"strSeq",
")",
":",
"if",
"'a'",
"in",
"strSeq",
"or",
"'c'",
"in",
"strSeq",
"or",
"'n'",
"in",
"strSeq",
"or",
"'N'",
"in",
"strSeq",
"or",
"'g'",
"in",
"strSeq",
"or",
"'t'",
"in",
"strSeq",
":",
"return",
"np",
... | for each MAF sequence, output maximum number of valid characters in a row, exclude duplicates/lowercase/N/softmask <- invalid
only accept sequence in analysis if at least 15 valid characters in a row | [
"for",
"each",
"MAF",
"sequence",
"output",
"maximum",
"number",
"of",
"valid",
"characters",
"in",
"a",
"row",
"exclude",
"duplicates",
"/",
"lowercase",
"/",
"N",
"/",
"softmask",
"<",
"-",
"invalid",
"only",
"accept",
"sequence",
"in",
"analysis",
"if",
... | [
"\"\"\"for each MAF sequence, output maximum number of valid characters in a row, exclude duplicates/lowercase/N/softmask <- invalid\n only accept sequence in analysis if at least 15 valid characters in a row\"\"\"",
"#minVal = np.min(np.vectorize(lambda y: turnSixteen(y))(np.vectorize(lambda x: strSeq.find(x)... | [
{
"param": "strSeq",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "strSeq",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
a5d02577aed95e546ac5a22b70bb9a5fa8b85021 | jlevy44/JoshuaTree2 | ScaffoldingTool.py | [
"MIT"
] | Python | scaffold_assemblies | null | def scaffold_assemblies(scaffolding_inputs_dir,scaffolding_outputs_dir, new_genome_name, weights_file, primary_proteome_id):
"""Scaffold assemblies based on synteny to references."""
cwd = os.getcwd()
scaffolding_bin = os.path.abspath('scaffolding_tool_bin')+'/'
scaffolding_inputs_dir = os.path.abspath(... | Scaffold assemblies based on synteny to references. | Scaffold assemblies based on synteny to references. | [
"Scaffold",
"assemblies",
"based",
"on",
"synteny",
"to",
"references",
"."
] | def scaffold_assemblies(scaffolding_inputs_dir,scaffolding_outputs_dir, new_genome_name, weights_file, primary_proteome_id):
cwd = os.getcwd()
scaffolding_bin = os.path.abspath('scaffolding_tool_bin')+'/'
scaffolding_inputs_dir = os.path.abspath(scaffolding_inputs_dir)
scaffolding_outputs_dir = os.path.... | [
"def",
"scaffold_assemblies",
"(",
"scaffolding_inputs_dir",
",",
"scaffolding_outputs_dir",
",",
"new_genome_name",
",",
"weights_file",
",",
"primary_proteome_id",
")",
":",
"cwd",
"=",
"os",
".",
"getcwd",
"(",
")",
"scaffolding_bin",
"=",
"os",
".",
"path",
".... | Scaffold assemblies based on synteny to references. | [
"Scaffold",
"assemblies",
"based",
"on",
"synteny",
"to",
"references",
"."
] | [
"\"\"\"Scaffold assemblies based on synteny to references.\"\"\"",
"# add build references and weights file",
"# fixme write nextflow config",
"\"\"\"writeSh = params.write_sh.asType(Integer);\nbuildRef = params.build_ref.asType(Integer);\nversion = params.version;\nCDS = params.cds;\nCDSFasta = params.cds_fa... | [
{
"param": "scaffolding_inputs_dir",
"type": null
},
{
"param": "scaffolding_outputs_dir",
"type": null
},
{
"param": "new_genome_name",
"type": null
},
{
"param": "weights_file",
"type": null
},
{
"param": "primary_proteome_id",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "scaffolding_inputs_dir",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "scaffolding_outputs_dir",
"type": null,
"docstrin... |
d6f81235aed34b3462786e76d4c06ee7d7258865 | tomgrosvenor/IntroToPython | Polling/pollAnalysis.py | [
"Unlicense"
] | Python | poll_analysis | <not_specific> | def poll_analysis(pollCsvFile=None):
"""This function performs poll analysis on the data contained in a passed CSV file."""
# Check that a file was passed
if pollCsvFile == None:
return []
# Initialize a candidates dictionary.
theCandidates = dict()
# Create an instance of ReadCsv fo... | This function performs poll analysis on the data contained in a passed CSV file. | This function performs poll analysis on the data contained in a passed CSV file. | [
"This",
"function",
"performs",
"poll",
"analysis",
"on",
"the",
"data",
"contained",
"in",
"a",
"passed",
"CSV",
"file",
"."
] | def poll_analysis(pollCsvFile=None):
if pollCsvFile == None:
return []
theCandidates = dict()
electionData = ReadCsv(pollCsvFile)
if len(electionData.next_row()) == 0:
print(f"\nHeader row not found in CSV file {pollCsvFile}\n")
return []
row = electionData.next_row()
if... | [
"def",
"poll_analysis",
"(",
"pollCsvFile",
"=",
"None",
")",
":",
"if",
"pollCsvFile",
"==",
"None",
":",
"return",
"[",
"]",
"theCandidates",
"=",
"dict",
"(",
")",
"electionData",
"=",
"ReadCsv",
"(",
"pollCsvFile",
")",
"if",
"len",
"(",
"electionData"... | This function performs poll analysis on the data contained in a passed CSV file. | [
"This",
"function",
"performs",
"poll",
"analysis",
"on",
"the",
"data",
"contained",
"in",
"a",
"passed",
"CSV",
"file",
"."
] | [
"\"\"\"This function performs poll analysis on the data contained in a passed CSV file.\"\"\"",
"# Check that a file was passed",
"# Initialize a candidates dictionary.",
"# Create an instance of ReadCsv for reading the election CSV file",
"# Ignore the header row",
"# Read the first row of data.",
"# S... | [
{
"param": "pollCsvFile",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "pollCsvFile",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
b3df928ae5c1c3c92751e6ec442d550062816e2d | tomgrosvenor/IntroToPython | Banking/bankAnalysis.py | [
"Unlicense"
] | Python | bank_analysis | <not_specific> | def bank_analysis(bankCsvFile=None):
"""This function performs bank analysis on the data contained in a passed CSV file."""
# Check that a file was passed
if bankCsvFile == None:
return []
# Initialize variables used for bank analysis.
greatestIncMonth = greatestDecMonth = 'Undef'
t... | This function performs bank analysis on the data contained in a passed CSV file. | This function performs bank analysis on the data contained in a passed CSV file. | [
"This",
"function",
"performs",
"bank",
"analysis",
"on",
"the",
"data",
"contained",
"in",
"a",
"passed",
"CSV",
"file",
"."
] | def bank_analysis(bankCsvFile=None):
if bankCsvFile == None:
return []
greatestIncMonth = greatestDecMonth = 'Undef'
totalMonths = totalPandL = greatestInc = \
cumChanges = greatestDec = 0
bankData = ReadCsv(bankCsvFile)
if len(bankData.next_row()) == 0:
print(f"... | [
"def",
"bank_analysis",
"(",
"bankCsvFile",
"=",
"None",
")",
":",
"if",
"bankCsvFile",
"==",
"None",
":",
"return",
"[",
"]",
"greatestIncMonth",
"=",
"greatestDecMonth",
"=",
"'Undef'",
"totalMonths",
"=",
"totalPandL",
"=",
"greatestInc",
"=",
"cumChanges",
... | This function performs bank analysis on the data contained in a passed CSV file. | [
"This",
"function",
"performs",
"bank",
"analysis",
"on",
"the",
"data",
"contained",
"in",
"a",
"passed",
"CSV",
"file",
"."
] | [
"\"\"\"This function performs bank analysis on the data contained in a passed CSV file.\"\"\"",
"# Check that a file was passed",
"# Initialize variables used for bank analysis.",
"# Create an instance of ReadCsv for reading the bank CSV file",
"# Ignore the header row",
"# Read the first row of data.",
... | [
{
"param": "bankCsvFile",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "bankCsvFile",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
b4fa5f7709ef5747433e5f834474299e99a85785 | tomgrosvenor/IntroToPython | displayStrs.py | [
"Unlicense"
] | Python | display_strs | null | def display_strs(strings, outFile=None):
"""Print the List of strings to the terminal; optionally to outFile."""
# Print the List of strings to the terminal window
for outStr in strings:
print(outStr, end='')
print()
# If an outFile is passed, open it and write the strings to it
if ou... | Print the List of strings to the terminal; optionally to outFile. | Print the List of strings to the terminal; optionally to outFile. | [
"Print",
"the",
"List",
"of",
"strings",
"to",
"the",
"terminal",
";",
"optionally",
"to",
"outFile",
"."
] | def display_strs(strings, outFile=None):
for outStr in strings:
print(outStr, end='')
print()
if outFile != None:
try:
with open(outFile, 'w') as outFile:
for outStr in strings:
outFile.write(outStr)
except:
print(f"\nOutput... | [
"def",
"display_strs",
"(",
"strings",
",",
"outFile",
"=",
"None",
")",
":",
"for",
"outStr",
"in",
"strings",
":",
"print",
"(",
"outStr",
",",
"end",
"=",
"''",
")",
"print",
"(",
")",
"if",
"outFile",
"!=",
"None",
":",
"try",
":",
"with",
"ope... | Print the List of strings to the terminal; optionally to outFile. | [
"Print",
"the",
"List",
"of",
"strings",
"to",
"the",
"terminal",
";",
"optionally",
"to",
"outFile",
"."
] | [
"\"\"\"Print the List of strings to the terminal; optionally to outFile.\"\"\"",
"# Print the List of strings to the terminal window",
"# If an outFile is passed, open it and write the strings to it",
"# Open the output file and write the strings to it"
] | [
{
"param": "strings",
"type": null
},
{
"param": "outFile",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "strings",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "outFile",
"type": null,
"docstring": null,
"docstring_toke... |
46d39eb6b93435b227e3e97d8b1c109334a96d44 | varunjammula/WorldOnRails | leaderboard/leaderboard/autoagents/dummy_agent.py | [
"MIT"
] | Python | sensors | <not_specific> | def sensors(self):
"""
Define the sensor suite required by the agent
:return: a list containing the required sensors in the following format:
[
{'type': 'sensor.camera.rgb', 'x': 0.7, 'y': -0.4, 'z': 1.60, 'roll': 0.0, 'pitch': 0.0, 'yaw': 0.0,
'width'... |
Define the sensor suite required by the agent
:return: a list containing the required sensors in the following format:
[
{'type': 'sensor.camera.rgb', 'x': 0.7, 'y': -0.4, 'z': 1.60, 'roll': 0.0, 'pitch': 0.0, 'yaw': 0.0,
'width': 300, 'height': 200, 'fov': 1... | Define the sensor suite required by the agent | [
"Define",
"the",
"sensor",
"suite",
"required",
"by",
"the",
"agent"
] | def sensors(self):
sensors = [
{'type': 'sensor.camera.rgb', 'x': 0.7, 'y': 0.0, 'z': 1.60, 'roll': 0.0, 'pitch': 0.0, 'yaw': 0.0,
'width': 800, 'height': 600, 'fov': 100, 'id': 'Center'},
{'type': 'sensor.camera.rgb', 'x': 0.7, 'y': -0.4, 'z': 1.60, 'roll': 0.0, 'pitch': 0.... | [
"def",
"sensors",
"(",
"self",
")",
":",
"sensors",
"=",
"[",
"{",
"'type'",
":",
"'sensor.camera.rgb'",
",",
"'x'",
":",
"0.7",
",",
"'y'",
":",
"0.0",
",",
"'z'",
":",
"1.60",
",",
"'roll'",
":",
"0.0",
",",
"'pitch'",
":",
"0.0",
",",
"'yaw'",
... | Define the sensor suite required by the agent | [
"Define",
"the",
"sensor",
"suite",
"required",
"by",
"the",
"agent"
] | [
"\"\"\"\n Define the sensor suite required by the agent\n\n :return: a list containing the required sensors in the following format:\n\n [\n {'type': 'sensor.camera.rgb', 'x': 0.7, 'y': -0.4, 'z': 1.60, 'roll': 0.0, 'pitch': 0.0, 'yaw': 0.0,\n 'width': 300, 'heig... | [
{
"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
... |
46d39eb6b93435b227e3e97d8b1c109334a96d44 | varunjammula/WorldOnRails | leaderboard/leaderboard/autoagents/dummy_agent.py | [
"MIT"
] | Python | run_step | <not_specific> | def run_step(self, input_data, timestamp):
"""
Execute one step of navigation.
"""
print("=====================>")
for key, val in input_data.items():
if hasattr(val[1], 'shape'):
shape = val[1].shape
print("[{} -- {:06d}] with shape {}... |
Execute one step of navigation.
| Execute one step of navigation. | [
"Execute",
"one",
"step",
"of",
"navigation",
"."
] | def run_step(self, input_data, timestamp):
print("=====================>")
for key, val in input_data.items():
if hasattr(val[1], 'shape'):
shape = val[1].shape
print("[{} -- {:06d}] with shape {}".format(key, val[0], shape))
else:
... | [
"def",
"run_step",
"(",
"self",
",",
"input_data",
",",
"timestamp",
")",
":",
"print",
"(",
"\"=====================>\"",
")",
"for",
"key",
",",
"val",
"in",
"input_data",
".",
"items",
"(",
")",
":",
"if",
"hasattr",
"(",
"val",
"[",
"1",
"]",
",",
... | Execute one step of navigation. | [
"Execute",
"one",
"step",
"of",
"navigation",
"."
] | [
"\"\"\"\n Execute one step of navigation.\n \"\"\"",
"# DO SOMETHING SMART",
"# RETURN CONTROL"
] | [
{
"param": "self",
"type": null
},
{
"param": "input_data",
"type": null
},
{
"param": "timestamp",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "input_data",
"type": null,
"docstring": null,
"docstring_toke... |
9b2ed4cbeb05360875b4b3afdac762de4655448f | varunjammula/WorldOnRails | leaderboard/scripts/set_new_scenarios.py | [
"MIT"
] | Python | apart_enough | null | def apart_enough(world, _waypoint, scenario_waypoint):
"""
Uses the same condition as in route_scenario to see if they will
be differentiated
"""
TRIGGER_THRESHOLD = 4.0
TRIGGER_ANGLE_THRESHOLD = 10
dx = float(_waypoint["x"]) - scenario_waypoint.transform.location.x
dy = float(_waypoint... |
Uses the same condition as in route_scenario to see if they will
be differentiated
| Uses the same condition as in route_scenario to see if they will
be differentiated | [
"Uses",
"the",
"same",
"condition",
"as",
"in",
"route_scenario",
"to",
"see",
"if",
"they",
"will",
"be",
"differentiated"
] | def apart_enough(world, _waypoint, scenario_waypoint):
TRIGGER_THRESHOLD = 4.0
TRIGGER_ANGLE_THRESHOLD = 10
dx = float(_waypoint["x"]) - scenario_waypoint.transform.location.x
dy = float(_waypoint["y"]) - scenario_waypoint.transform.location.y
distance = math.sqrt(dx * dx + dy * dy)
dyaw = float... | [
"def",
"apart_enough",
"(",
"world",
",",
"_waypoint",
",",
"scenario_waypoint",
")",
":",
"TRIGGER_THRESHOLD",
"=",
"4.0",
"TRIGGER_ANGLE_THRESHOLD",
"=",
"10",
"dx",
"=",
"float",
"(",
"_waypoint",
"[",
"\"x\"",
"]",
")",
"-",
"scenario_waypoint",
".",
"tran... | Uses the same condition as in route_scenario to see if they will
be differentiated | [
"Uses",
"the",
"same",
"condition",
"as",
"in",
"route_scenario",
"to",
"see",
"if",
"they",
"will",
"be",
"differentiated"
] | [
"\"\"\"\n Uses the same condition as in route_scenario to see if they will\n be differentiated\n \"\"\"",
"# if distance < TRIGGER_THRESHOLD:"
] | [
{
"param": "world",
"type": null
},
{
"param": "_waypoint",
"type": null
},
{
"param": "scenario_waypoint",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "world",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "_waypoint",
"type": null,
"docstring": null,
"docstring_toke... |
9b2ed4cbeb05360875b4b3afdac762de4655448f | varunjammula/WorldOnRails | leaderboard/scripts/set_new_scenarios.py | [
"MIT"
] | Python | save_from_wp | null | def save_from_wp(endpoint, wp):
"""
Creates a mini json with the data from the scenario location.
used to copy paste it to the .json
"""
with open(endpoint, mode='w') as fd:
entry = {}
transform = {
"x": str(round(wp.transform.location.x, 2)),
"y": str(round(... |
Creates a mini json with the data from the scenario location.
used to copy paste it to the .json
| Creates a mini json with the data from the scenario location.
used to copy paste it to the .json | [
"Creates",
"a",
"mini",
"json",
"with",
"the",
"data",
"from",
"the",
"scenario",
"location",
".",
"used",
"to",
"copy",
"paste",
"it",
"to",
"the",
".",
"json"
] | def save_from_wp(endpoint, wp):
with open(endpoint, mode='w') as fd:
entry = {}
transform = {
"x": str(round(wp.transform.location.x, 2)),
"y": str(round(wp.transform.location.y, 2)),
"z": "1.0",
"yaw": str(round(wp.transform.rotation.yaw, 0)),
... | [
"def",
"save_from_wp",
"(",
"endpoint",
",",
"wp",
")",
":",
"with",
"open",
"(",
"endpoint",
",",
"mode",
"=",
"'w'",
")",
"as",
"fd",
":",
"entry",
"=",
"{",
"}",
"transform",
"=",
"{",
"\"x\"",
":",
"str",
"(",
"round",
"(",
"wp",
".",
"transf... | Creates a mini json with the data from the scenario location. | [
"Creates",
"a",
"mini",
"json",
"with",
"the",
"data",
"from",
"the",
"scenario",
"location",
"."
] | [
"\"\"\"\n Creates a mini json with the data from the scenario location.\n used to copy paste it to the .json\n \"\"\""
] | [
{
"param": "endpoint",
"type": null
},
{
"param": "wp",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "endpoint",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "wp",
"type": null,
"docstring": null,
"docstring_tokens":... |
9b2ed4cbeb05360875b4b3afdac762de4655448f | varunjammula/WorldOnRails | leaderboard/scripts/set_new_scenarios.py | [
"MIT"
] | Python | save_from_dict | null | def save_from_dict(endpoint, wp):
"""
Creates a mini json with the data from the scenario waypoint.
used to copy paste it to the .json
"""
with open(endpoint, mode='w') as fd:
entry = {}
transform = {
"x": str(round(float(wp["x"]), 2)),
"y": str(round(float(w... |
Creates a mini json with the data from the scenario waypoint.
used to copy paste it to the .json
| Creates a mini json with the data from the scenario waypoint.
used to copy paste it to the .json | [
"Creates",
"a",
"mini",
"json",
"with",
"the",
"data",
"from",
"the",
"scenario",
"waypoint",
".",
"used",
"to",
"copy",
"paste",
"it",
"to",
"the",
".",
"json"
] | def save_from_dict(endpoint, wp):
with open(endpoint, mode='w') as fd:
entry = {}
transform = {
"x": str(round(float(wp["x"]), 2)),
"y": str(round(float(wp["y"]), 2)),
"z": "1.0",
"yaw": str(round(float(wp["yaw"]), 0)),
"pitch": str(round(f... | [
"def",
"save_from_dict",
"(",
"endpoint",
",",
"wp",
")",
":",
"with",
"open",
"(",
"endpoint",
",",
"mode",
"=",
"'w'",
")",
"as",
"fd",
":",
"entry",
"=",
"{",
"}",
"transform",
"=",
"{",
"\"x\"",
":",
"str",
"(",
"round",
"(",
"float",
"(",
"w... | Creates a mini json with the data from the scenario waypoint. | [
"Creates",
"a",
"mini",
"json",
"with",
"the",
"data",
"from",
"the",
"scenario",
"waypoint",
"."
] | [
"\"\"\"\n Creates a mini json with the data from the scenario waypoint.\n used to copy paste it to the .json\n \"\"\""
] | [
{
"param": "endpoint",
"type": null
},
{
"param": "wp",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "endpoint",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "wp",
"type": null,
"docstring": null,
"docstring_tokens":... |
9b2ed4cbeb05360875b4b3afdac762de4655448f | varunjammula/WorldOnRails | leaderboard/scripts/set_new_scenarios.py | [
"MIT"
] | Python | draw_scenarios | null | def draw_scenarios(world, scenarios, args):
"""
Draws all the points related to args.scenarios
"""
z = 3
if scenarios["scenario_type"] in args.scenarios:
number = float(scenarios["scenario_type"][8:])
color = SCENARIO_COLOR[scenarios["scenario_type"]][0]
event_list = scenar... |
Draws all the points related to args.scenarios
| Draws all the points related to args.scenarios | [
"Draws",
"all",
"the",
"points",
"related",
"to",
"args",
".",
"scenarios"
] | def draw_scenarios(world, scenarios, args):
z = 3
if scenarios["scenario_type"] in args.scenarios:
number = float(scenarios["scenario_type"][8:])
color = SCENARIO_COLOR[scenarios["scenario_type"]][0]
event_list = scenarios["available_event_configurations"]
for i in range(len(even... | [
"def",
"draw_scenarios",
"(",
"world",
",",
"scenarios",
",",
"args",
")",
":",
"z",
"=",
"3",
"if",
"scenarios",
"[",
"\"scenario_type\"",
"]",
"in",
"args",
".",
"scenarios",
":",
"number",
"=",
"float",
"(",
"scenarios",
"[",
"\"scenario_type\"",
"]",
... | Draws all the points related to args.scenarios | [
"Draws",
"all",
"the",
"points",
"related",
"to",
"args",
".",
"scenarios"
] | [
"\"\"\"\n Draws all the points related to args.scenarios\n \"\"\"",
"# trigger point of this scenario"
] | [
{
"param": "world",
"type": null
},
{
"param": "scenarios",
"type": null
},
{
"param": "args",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "world",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "scenarios",
"type": null,
"docstring": null,
"docstring_toke... |
9b2ed4cbeb05360875b4b3afdac762de4655448f | varunjammula/WorldOnRails | leaderboard/scripts/set_new_scenarios.py | [
"MIT"
] | Python | modify_junction_scenarios | null | def modify_junction_scenarios(world, scenarios, args):
"""
Used to move scenario trigger points:
1) a certain distance to the front (follows the lane)
2) a certain distance to the back (does not follow the lane)
"""
if scenarios["scenario_type"] in args.scenarios:
event_list = s... |
Used to move scenario trigger points:
1) a certain distance to the front (follows the lane)
2) a certain distance to the back (does not follow the lane)
| Used to move scenario trigger points:
1) a certain distance to the front (follows the lane)
2) a certain distance to the back (does not follow the lane) | [
"Used",
"to",
"move",
"scenario",
"trigger",
"points",
":",
"1",
")",
"a",
"certain",
"distance",
"to",
"the",
"front",
"(",
"follows",
"the",
"lane",
")",
"2",
")",
"a",
"certain",
"distance",
"to",
"the",
"back",
"(",
"does",
"not",
"follow",
"the",
... | def modify_junction_scenarios(world, scenarios, args):
if scenarios["scenario_type"] in args.scenarios:
event_list = scenarios["available_event_configurations"]
for i in range(len(event_list)):
event = event_list[i]
_waypoint = event['transform']
location = carl... | [
"def",
"modify_junction_scenarios",
"(",
"world",
",",
"scenarios",
",",
"args",
")",
":",
"if",
"scenarios",
"[",
"\"scenario_type\"",
"]",
"in",
"args",
".",
"scenarios",
":",
"event_list",
"=",
"scenarios",
"[",
"\"available_event_configurations\"",
"]",
"for",... | Used to move scenario trigger points:
1) a certain distance to the front (follows the lane)
2) a certain distance to the back (does not follow the lane) | [
"Used",
"to",
"move",
"scenario",
"trigger",
"points",
":",
"1",
")",
"a",
"certain",
"distance",
"to",
"the",
"front",
"(",
"follows",
"the",
"lane",
")",
"2",
")",
"a",
"certain",
"distance",
"to",
"the",
"back",
"(",
"does",
"not",
"follow",
"the",
... | [
"\"\"\"\n Used to move scenario trigger points:\n 1) a certain distance to the front (follows the lane)\n 2) a certain distance to the back (does not follow the lane)\n \"\"\"",
"# trigger point of this scenario",
"# # Case 1)",
"# DISTANCE = 10",
"# new_waypoint = world.get_map().get_wa... | [
{
"param": "world",
"type": null
},
{
"param": "scenarios",
"type": null
},
{
"param": "args",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "world",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "scenarios",
"type": null,
"docstring": null,
"docstring_toke... |
9b2ed4cbeb05360875b4b3afdac762de4655448f | varunjammula/WorldOnRails | leaderboard/scripts/set_new_scenarios.py | [
"MIT"
] | Python | main | null | def main():
"""
Used to help with the visualization of the scenario trigger points, as well as its
modifications.
--town: Selects the town
--scenario: The scenario that will be printed. Use the number of the scenarios 1 2 3 ...
--modify: Used to modify the trigger_points of the given... |
Used to help with the visualization of the scenario trigger points, as well as its
modifications.
--town: Selects the town
--scenario: The scenario that will be printed. Use the number of the scenarios 1 2 3 ...
--modify: Used to modify the trigger_points of the given scenario in args.s... | Used to help with the visualization of the scenario trigger points, as well as its
modifications.
town: Selects the town
scenario: The scenario that will be printed. Use the number of the scenarios 1 2 3
modify: Used to modify the trigger_points of the given scenario in args.scenarios.
debug is auto-enabled here. It wi... | [
"Used",
"to",
"help",
"with",
"the",
"visualization",
"of",
"the",
"scenario",
"trigger",
"points",
"as",
"well",
"as",
"its",
"modifications",
".",
"town",
":",
"Selects",
"the",
"town",
"scenario",
":",
"The",
"scenario",
"that",
"will",
"be",
"printed",
... | def main():
parser = argparse.ArgumentParser(formatter_class=RawTextHelpFormatter)
parser.add_argument('--town', default='Town08')
parser.add_argument('--debug', action='store_true')
parser.add_argument('--reload', action='store_true')
parser.add_argument('--inipoint', default="")
parser.add_arg... | [
"def",
"main",
"(",
")",
":",
"parser",
"=",
"argparse",
".",
"ArgumentParser",
"(",
"formatter_class",
"=",
"RawTextHelpFormatter",
")",
"parser",
".",
"add_argument",
"(",
"'--town'",
",",
"default",
"=",
"'Town08'",
")",
"parser",
".",
"add_argument",
"(",
... | Used to help with the visualization of the scenario trigger points, as well as its
modifications. | [
"Used",
"to",
"help",
"with",
"the",
"visualization",
"of",
"the",
"scenario",
"trigger",
"points",
"as",
"well",
"as",
"its",
"modifications",
"."
] | [
"\"\"\"\n Used to help with the visualization of the scenario trigger points, as well as its\n modifications.\n --town: Selects the town\n --scenario: The scenario that will be printed. Use the number of the scenarios 1 2 3 ...\n --modify: Used to modify the trigger_points of the given sc... | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} |
742dff2182880f3712230635b187747136844c18 | varunjammula/WorldOnRails | leaderboard/leaderboard/autoagents/human_agent.py | [
"MIT"
] | Python | sensors | <not_specific> | def sensors(self):
"""
Define the sensor suite required by the agent
:return: a list containing the required sensors in the following format:
[
{'type': 'sensor.camera.rgb', 'x': 0.7, 'y': -0.4, 'z': 1.60, 'roll': 0.0, 'pitch': 0.0, 'yaw': 0.0,
'width'... |
Define the sensor suite required by the agent
:return: a list containing the required sensors in the following format:
[
{'type': 'sensor.camera.rgb', 'x': 0.7, 'y': -0.4, 'z': 1.60, 'roll': 0.0, 'pitch': 0.0, 'yaw': 0.0,
'width': 300, 'height': 200, 'fov': 1... | Define the sensor suite required by the agent | [
"Define",
"the",
"sensor",
"suite",
"required",
"by",
"the",
"agent"
] | def sensors(self):
sensors = [
{'type': 'sensor.camera.rgb', 'x': 0.7, 'y': 0.0, 'z': 1.60, 'roll': 0.0, 'pitch': 0.0, 'yaw': 0.0,
'width': 800, 'height': 600, 'fov': 100, 'id': 'Center'},
{'type': 'sensor.speedometer', 'reading_frequency': 20, 'id': 'speed'},
]
... | [
"def",
"sensors",
"(",
"self",
")",
":",
"sensors",
"=",
"[",
"{",
"'type'",
":",
"'sensor.camera.rgb'",
",",
"'x'",
":",
"0.7",
",",
"'y'",
":",
"0.0",
",",
"'z'",
":",
"1.60",
",",
"'roll'",
":",
"0.0",
",",
"'pitch'",
":",
"0.0",
",",
"'yaw'",
... | Define the sensor suite required by the agent | [
"Define",
"the",
"sensor",
"suite",
"required",
"by",
"the",
"agent"
] | [
"\"\"\"\n Define the sensor suite required by the agent\n\n :return: a list containing the required sensors in the following format:\n\n [\n {'type': 'sensor.camera.rgb', 'x': 0.7, 'y': -0.4, 'z': 1.60, 'roll': 0.0, 'pitch': 0.0, 'yaw': 0.0,\n 'width': 300, 'heig... | [
{
"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
... |
742dff2182880f3712230635b187747136844c18 | varunjammula/WorldOnRails | leaderboard/leaderboard/autoagents/human_agent.py | [
"MIT"
] | Python | run_step | <not_specific> | def run_step(self, input_data, timestamp):
"""
Execute one step of navigation.
"""
self.agent_engaged = True
self._hic.run_interface(input_data)
control = self._controller.parse_events(timestamp - self._prev_timestamp)
self._prev_timestamp = timestamp
re... |
Execute one step of navigation.
| Execute one step of navigation. | [
"Execute",
"one",
"step",
"of",
"navigation",
"."
] | def run_step(self, input_data, timestamp):
self.agent_engaged = True
self._hic.run_interface(input_data)
control = self._controller.parse_events(timestamp - self._prev_timestamp)
self._prev_timestamp = timestamp
return control | [
"def",
"run_step",
"(",
"self",
",",
"input_data",
",",
"timestamp",
")",
":",
"self",
".",
"agent_engaged",
"=",
"True",
"self",
".",
"_hic",
".",
"run_interface",
"(",
"input_data",
")",
"control",
"=",
"self",
".",
"_controller",
".",
"parse_events",
"(... | Execute one step of navigation. | [
"Execute",
"one",
"step",
"of",
"navigation",
"."
] | [
"\"\"\"\n Execute one step of navigation.\n \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "input_data",
"type": null
},
{
"param": "timestamp",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "input_data",
"type": null,
"docstring": null,
"docstring_toke... |
742dff2182880f3712230635b187747136844c18 | varunjammula/WorldOnRails | leaderboard/leaderboard/autoagents/human_agent.py | [
"MIT"
] | Python | parse_events | <not_specific> | def parse_events(self, timestamp):
"""
Parse the keyboard events and set the vehicle controls accordingly
"""
# Move the vehicle
if self._mode == "playback":
self._parse_json_control()
else:
self._parse_vehicle_keys(pygame.key.get_pressed(), timest... |
Parse the keyboard events and set the vehicle controls accordingly
| Parse the keyboard events and set the vehicle controls accordingly | [
"Parse",
"the",
"keyboard",
"events",
"and",
"set",
"the",
"vehicle",
"controls",
"accordingly"
] | def parse_events(self, timestamp):
if self._mode == "playback":
self._parse_json_control()
else:
self._parse_vehicle_keys(pygame.key.get_pressed(), timestamp*1000)
if self._mode == "log":
self._record_control()
return self._control | [
"def",
"parse_events",
"(",
"self",
",",
"timestamp",
")",
":",
"if",
"self",
".",
"_mode",
"==",
"\"playback\"",
":",
"self",
".",
"_parse_json_control",
"(",
")",
"else",
":",
"self",
".",
"_parse_vehicle_keys",
"(",
"pygame",
".",
"key",
".",
"get_press... | Parse the keyboard events and set the vehicle controls accordingly | [
"Parse",
"the",
"keyboard",
"events",
"and",
"set",
"the",
"vehicle",
"controls",
"accordingly"
] | [
"\"\"\"\n Parse the keyboard events and set the vehicle controls accordingly\n \"\"\"",
"# Move the vehicle",
"# Record the control"
] | [
{
"param": "self",
"type": null
},
{
"param": "timestamp",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "timestamp",
"type": null,
"docstring": null,
"docstring_token... |
742dff2182880f3712230635b187747136844c18 | varunjammula/WorldOnRails | leaderboard/leaderboard/autoagents/human_agent.py | [
"MIT"
] | Python | _parse_vehicle_keys | <not_specific> | def _parse_vehicle_keys(self, keys, milliseconds):
"""
Calculate new vehicle controls based on input keys
"""
for event in pygame.event.get():
if event.type == pygame.QUIT:
return
elif event.type == pygame.KEYUP:
if event.key == K... |
Calculate new vehicle controls based on input keys
| Calculate new vehicle controls based on input keys | [
"Calculate",
"new",
"vehicle",
"controls",
"based",
"on",
"input",
"keys"
] | def _parse_vehicle_keys(self, keys, milliseconds):
for event in pygame.event.get():
if event.type == pygame.QUIT:
return
elif event.type == pygame.KEYUP:
if event.key == K_q:
self._control.gear = 1 if self._control.reverse else -1
... | [
"def",
"_parse_vehicle_keys",
"(",
"self",
",",
"keys",
",",
"milliseconds",
")",
":",
"for",
"event",
"in",
"pygame",
".",
"event",
".",
"get",
"(",
")",
":",
"if",
"event",
".",
"type",
"==",
"pygame",
".",
"QUIT",
":",
"return",
"elif",
"event",
"... | Calculate new vehicle controls based on input keys | [
"Calculate",
"new",
"vehicle",
"controls",
"based",
"on",
"input",
"keys"
] | [
"\"\"\"\n Calculate new vehicle controls based on input keys\n \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "keys",
"type": null
},
{
"param": "milliseconds",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "keys",
"type": null,
"docstring": null,
"docstring_tokens": [... |
c414d4db5fe7bc863479b321b3f9a33a9979b687 | varunjammula/WorldOnRails | leaderboard/leaderboard/leaderboard_evaluator.py | [
"MIT"
] | Python | _signal_handler | null | def _signal_handler(self, signum, frame):
"""
Terminate scenario ticking when receiving a signal interrupt
"""
if self._agent_watchdog and not self._agent_watchdog.get_status():
raise RuntimeError("Timeout: Agent took too long to setup")
elif self.manager:
... |
Terminate scenario ticking when receiving a signal interrupt
| Terminate scenario ticking when receiving a signal interrupt | [
"Terminate",
"scenario",
"ticking",
"when",
"receiving",
"a",
"signal",
"interrupt"
] | def _signal_handler(self, signum, frame):
if self._agent_watchdog and not self._agent_watchdog.get_status():
raise RuntimeError("Timeout: Agent took too long to setup")
elif self.manager:
self.manager.signal_handler(signum, frame) | [
"def",
"_signal_handler",
"(",
"self",
",",
"signum",
",",
"frame",
")",
":",
"if",
"self",
".",
"_agent_watchdog",
"and",
"not",
"self",
".",
"_agent_watchdog",
".",
"get_status",
"(",
")",
":",
"raise",
"RuntimeError",
"(",
"\"Timeout: Agent took too long to s... | Terminate scenario ticking when receiving a signal interrupt | [
"Terminate",
"scenario",
"ticking",
"when",
"receiving",
"a",
"signal",
"interrupt"
] | [
"\"\"\"\n Terminate scenario ticking when receiving a signal interrupt\n \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "signum",
"type": null
},
{
"param": "frame",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "signum",
"type": null,
"docstring": null,
"docstring_tokens":... |
c414d4db5fe7bc863479b321b3f9a33a9979b687 | varunjammula/WorldOnRails | leaderboard/leaderboard/leaderboard_evaluator.py | [
"MIT"
] | Python | _prepare_ego_vehicles | null | def _prepare_ego_vehicles(self, ego_vehicles, wait_for_ego_vehicles=False):
"""
Spawn or update the ego vehicles
"""
if not wait_for_ego_vehicles:
for vehicle in ego_vehicles:
self.ego_vehicles.append(CarlaDataProvider.request_new_actor(vehicle.model,
... |
Spawn or update the ego vehicles
| Spawn or update the ego vehicles | [
"Spawn",
"or",
"update",
"the",
"ego",
"vehicles"
] | def _prepare_ego_vehicles(self, ego_vehicles, wait_for_ego_vehicles=False):
if not wait_for_ego_vehicles:
for vehicle in ego_vehicles:
self.ego_vehicles.append(CarlaDataProvider.request_new_actor(vehicle.model,
... | [
"def",
"_prepare_ego_vehicles",
"(",
"self",
",",
"ego_vehicles",
",",
"wait_for_ego_vehicles",
"=",
"False",
")",
":",
"if",
"not",
"wait_for_ego_vehicles",
":",
"for",
"vehicle",
"in",
"ego_vehicles",
":",
"self",
".",
"ego_vehicles",
".",
"append",
"(",
"Carl... | Spawn or update the ego vehicles | [
"Spawn",
"or",
"update",
"the",
"ego",
"vehicles"
] | [
"\"\"\"\n Spawn or update the ego vehicles\n \"\"\"",
"# sync state"
] | [
{
"param": "self",
"type": null
},
{
"param": "ego_vehicles",
"type": null
},
{
"param": "wait_for_ego_vehicles",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "ego_vehicles",
"type": null,
"docstring": null,
"docstring_to... |
c414d4db5fe7bc863479b321b3f9a33a9979b687 | varunjammula/WorldOnRails | leaderboard/leaderboard/leaderboard_evaluator.py | [
"MIT"
] | Python | _load_and_wait_for_world | null | def _load_and_wait_for_world(self, args, town, ego_vehicles=None):
"""
Load a new CARLA world and provide data to CarlaDataProvider
"""
self.world = self.client.load_world(town)
settings = self.world.get_settings()
settings.fixed_delta_seconds = 1.0 / self.frame_rate
... |
Load a new CARLA world and provide data to CarlaDataProvider
| Load a new CARLA world and provide data to CarlaDataProvider | [
"Load",
"a",
"new",
"CARLA",
"world",
"and",
"provide",
"data",
"to",
"CarlaDataProvider"
] | def _load_and_wait_for_world(self, args, town, ego_vehicles=None):
self.world = self.client.load_world(town)
settings = self.world.get_settings()
settings.fixed_delta_seconds = 1.0 / self.frame_rate
settings.synchronous_mode = True
self.world.apply_settings(settings)
self... | [
"def",
"_load_and_wait_for_world",
"(",
"self",
",",
"args",
",",
"town",
",",
"ego_vehicles",
"=",
"None",
")",
":",
"self",
".",
"world",
"=",
"self",
".",
"client",
".",
"load_world",
"(",
"town",
")",
"settings",
"=",
"self",
".",
"world",
".",
"ge... | Load a new CARLA world and provide data to CarlaDataProvider | [
"Load",
"a",
"new",
"CARLA",
"world",
"and",
"provide",
"data",
"to",
"CarlaDataProvider"
] | [
"\"\"\"\n Load a new CARLA world and provide data to CarlaDataProvider\n \"\"\"",
"# Wait for the world to be ready"
] | [
{
"param": "self",
"type": null
},
{
"param": "args",
"type": null
},
{
"param": "town",
"type": null
},
{
"param": "ego_vehicles",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "args",
"type": null,
"docstring": null,
"docstring_tokens": [... |
c414d4db5fe7bc863479b321b3f9a33a9979b687 | varunjammula/WorldOnRails | leaderboard/leaderboard/leaderboard_evaluator.py | [
"MIT"
] | Python | _register_statistics | null | def _register_statistics(self, config, checkpoint, entry_status, crash_message=""):
"""
Computes and saved the simulation statistics
"""
# register statistics
current_stats_record = self.statistics_manager.compute_route_statistics(
config,
self.manager.sce... |
Computes and saved the simulation statistics
| Computes and saved the simulation statistics | [
"Computes",
"and",
"saved",
"the",
"simulation",
"statistics"
] | def _register_statistics(self, config, checkpoint, entry_status, crash_message=""):
current_stats_record = self.statistics_manager.compute_route_statistics(
config,
self.manager.scenario_duration_system,
self.manager.scenario_duration_game,
crash_message
)... | [
"def",
"_register_statistics",
"(",
"self",
",",
"config",
",",
"checkpoint",
",",
"entry_status",
",",
"crash_message",
"=",
"\"\"",
")",
":",
"current_stats_record",
"=",
"self",
".",
"statistics_manager",
".",
"compute_route_statistics",
"(",
"config",
",",
"se... | Computes and saved the simulation statistics | [
"Computes",
"and",
"saved",
"the",
"simulation",
"statistics"
] | [
"\"\"\"\n Computes and saved the simulation statistics\n \"\"\"",
"# register statistics"
] | [
{
"param": "self",
"type": null
},
{
"param": "config",
"type": null
},
{
"param": "checkpoint",
"type": null
},
{
"param": "entry_status",
"type": null
},
{
"param": "crash_message",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "config",
"type": null,
"docstring": null,
"docstring_tokens":... |
c414d4db5fe7bc863479b321b3f9a33a9979b687 | varunjammula/WorldOnRails | leaderboard/leaderboard/leaderboard_evaluator.py | [
"MIT"
] | Python | _load_and_run_scenario | <not_specific> | def _load_and_run_scenario(self, args, config):
"""
Load and run the scenario given by config.
Depending on what code fails, the simulation will either stop the route and
continue from the next one, or report a crash and stop.
"""
crash_message = ""
entry_status ... |
Load and run the scenario given by config.
Depending on what code fails, the simulation will either stop the route and
continue from the next one, or report a crash and stop.
| Load and run the scenario given by config.
Depending on what code fails, the simulation will either stop the route and
continue from the next one, or report a crash and stop. | [
"Load",
"and",
"run",
"the",
"scenario",
"given",
"by",
"config",
".",
"Depending",
"on",
"what",
"code",
"fails",
"the",
"simulation",
"will",
"either",
"stop",
"the",
"route",
"and",
"continue",
"from",
"the",
"next",
"one",
"or",
"report",
"a",
"crash",... | def _load_and_run_scenario(self, args, config):
crash_message = ""
entry_status = "Started"
print("\n\033[1m========= Preparing {} (repetition {}) =========".format(config.name, config.repetition_index))
print("> Setting up the agent\033[0m")
self.statistics_manager.set_route(con... | [
"def",
"_load_and_run_scenario",
"(",
"self",
",",
"args",
",",
"config",
")",
":",
"crash_message",
"=",
"\"\"",
"entry_status",
"=",
"\"Started\"",
"print",
"(",
"\"\\n\\033[1m========= Preparing {} (repetition {}) =========\"",
".",
"format",
"(",
"config",
".",
"n... | Load and run the scenario given by config. | [
"Load",
"and",
"run",
"the",
"scenario",
"given",
"by",
"config",
"."
] | [
"\"\"\"\n Load and run the scenario given by config.\n\n Depending on what code fails, the simulation will either stop the route and\n continue from the next one, or report a crash and stop.\n \"\"\"",
"# Prepare the statistics of the route",
"# Set up the user's agent, and the timer... | [
{
"param": "self",
"type": null
},
{
"param": "args",
"type": null
},
{
"param": "config",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "args",
"type": null,
"docstring": null,
"docstring_tokens": [... |
801a239507b6416d24771aecde09ebd644cd12c5 | varunjammula/WorldOnRails | leaderboard/leaderboard/scenarios/master_scenario.py | [
"MIT"
] | Python | _create_behavior | <not_specific> | def _create_behavior(self):
"""
Basic behavior do nothing, i.e. Idle
"""
# Build behavior tree
sequence = py_trees.composites.Sequence("MasterScenario")
idle_behavior = Idle()
sequence.add_child(idle_behavior)
return sequence |
Basic behavior do nothing, i.e. Idle
| Basic behavior do nothing, i.e. Idle | [
"Basic",
"behavior",
"do",
"nothing",
"i",
".",
"e",
".",
"Idle"
] | def _create_behavior(self):
sequence = py_trees.composites.Sequence("MasterScenario")
idle_behavior = Idle()
sequence.add_child(idle_behavior)
return sequence | [
"def",
"_create_behavior",
"(",
"self",
")",
":",
"sequence",
"=",
"py_trees",
".",
"composites",
".",
"Sequence",
"(",
"\"MasterScenario\"",
")",
"idle_behavior",
"=",
"Idle",
"(",
")",
"sequence",
".",
"add_child",
"(",
"idle_behavior",
")",
"return",
"seque... | Basic behavior do nothing, i.e. | [
"Basic",
"behavior",
"do",
"nothing",
"i",
".",
"e",
"."
] | [
"\"\"\"\n Basic behavior do nothing, i.e. Idle\n \"\"\"",
"# Build behavior tree"
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
bf5b459bf035fe417619c5a98c7179e866bd1892 | varunjammula/WorldOnRails | leaderboard/leaderboard/scenarios/nocrash_train_scenario.py | [
"MIT"
] | Python | initialise | null | def initialise(self):
"""
Set current time to current CARLA time
"""
self._current_time = GameTime.get_time() |
Set current time to current CARLA time
| Set current time to current CARLA time | [
"Set",
"current",
"time",
"to",
"current",
"CARLA",
"time"
] | def initialise(self):
self._current_time = GameTime.get_time() | [
"def",
"initialise",
"(",
"self",
")",
":",
"self",
".",
"_current_time",
"=",
"GameTime",
".",
"get_time",
"(",
")"
] | Set current time to current CARLA time | [
"Set",
"current",
"time",
"to",
"current",
"CARLA",
"time"
] | [
"\"\"\"\n Set current time to current CARLA time\n \"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
75ceb906f923ccc48016b44cf51297fd496aa954 | varunjammula/WorldOnRails | leaderboard/leaderboard/autoagents/ros_agent.py | [
"MIT"
] | Python | on_vehicle_control | null | def on_vehicle_control(self, data):
"""
callback if a new vehicle control command is received
"""
cmd = carla.VehicleControl()
cmd.throttle = data.throttle
cmd.steer = data.steer
cmd.brake = data.brake
cmd.hand_brake = data.hand_brake
cmd.reverse =... |
callback if a new vehicle control command is received
| callback if a new vehicle control command is received | [
"callback",
"if",
"a",
"new",
"vehicle",
"control",
"command",
"is",
"received"
] | def on_vehicle_control(self, data):
cmd = carla.VehicleControl()
cmd.throttle = data.throttle
cmd.steer = data.steer
cmd.brake = data.brake
cmd.hand_brake = data.hand_brake
cmd.reverse = data.reverse
cmd.gear = data.gear
cmd.manual_gear_shift = data.manual... | [
"def",
"on_vehicle_control",
"(",
"self",
",",
"data",
")",
":",
"cmd",
"=",
"carla",
".",
"VehicleControl",
"(",
")",
"cmd",
".",
"throttle",
"=",
"data",
".",
"throttle",
"cmd",
".",
"steer",
"=",
"data",
".",
"steer",
"cmd",
".",
"brake",
"=",
"da... | callback if a new vehicle control command is received | [
"callback",
"if",
"a",
"new",
"vehicle",
"control",
"command",
"is",
"received"
] | [
"\"\"\"\n callback if a new vehicle control command is received\n \"\"\"",
"# After the first vehicle control is sent out, it is possible to use the stepping mode"
] | [
{
"param": "self",
"type": null
},
{
"param": "data",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "data",
"type": null,
"docstring": null,
"docstring_tokens": [... |
75ceb906f923ccc48016b44cf51297fd496aa954 | varunjammula/WorldOnRails | leaderboard/leaderboard/autoagents/ros_agent.py | [
"MIT"
] | Python | build_camera_info | <not_specific> | def build_camera_info(self, attributes): # pylint: disable=no-self-use
"""
Private function to compute camera info
camera info doesn't change over time
"""
camera_info = CameraInfo()
# store info without header
camera_info.header = None
camera_info.width... |
Private function to compute camera info
camera info doesn't change over time
| Private function to compute camera info
camera info doesn't change over time | [
"Private",
"function",
"to",
"compute",
"camera",
"info",
"camera",
"info",
"doesn",
"'",
"t",
"change",
"over",
"time"
] | def build_camera_info(self, attributes):
camera_info = CameraInfo()
camera_info.header = None
camera_info.width = int(attributes['width'])
camera_info.height = int(attributes['height'])
camera_info.distortion_model = 'plumb_bob'
cx = camera_info.width / 2.0
cy =... | [
"def",
"build_camera_info",
"(",
"self",
",",
"attributes",
")",
":",
"camera_info",
"=",
"CameraInfo",
"(",
")",
"camera_info",
".",
"header",
"=",
"None",
"camera_info",
".",
"width",
"=",
"int",
"(",
"attributes",
"[",
"'width'",
"]",
")",
"camera_info",
... | Private function to compute camera info
camera info doesn't change over time | [
"Private",
"function",
"to",
"compute",
"camera",
"info",
"camera",
"info",
"doesn",
"'",
"t",
"change",
"over",
"time"
] | [
"# pylint: disable=no-self-use",
"\"\"\"\n Private function to compute camera info\n\n camera info doesn't change over time\n \"\"\"",
"# store info without header"
] | [
{
"param": "self",
"type": null
},
{
"param": "attributes",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "attributes",
"type": null,
"docstring": null,
"docstring_toke... |
75ceb906f923ccc48016b44cf51297fd496aa954 | varunjammula/WorldOnRails | leaderboard/leaderboard/autoagents/ros_agent.py | [
"MIT"
] | Python | use_stepping_mode | <not_specific> | def use_stepping_mode(self): # pylint: disable=no-self-use
"""
Overload this function to use stepping mode!
"""
return False |
Overload this function to use stepping mode!
| Overload this function to use stepping mode! | [
"Overload",
"this",
"function",
"to",
"use",
"stepping",
"mode!"
] | def use_stepping_mode(self):
return False | [
"def",
"use_stepping_mode",
"(",
"self",
")",
":",
"return",
"False"
] | Overload this function to use stepping mode! | [
"Overload",
"this",
"function",
"to",
"use",
"stepping",
"mode!"
] | [
"# pylint: disable=no-self-use",
"\"\"\"\n Overload this function to use stepping mode!\n \"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
75ceb906f923ccc48016b44cf51297fd496aa954 | varunjammula/WorldOnRails | leaderboard/leaderboard/autoagents/ros_agent.py | [
"MIT"
] | Python | run_step | <not_specific> | def run_step(self, input_data, timestamp):
"""
Execute one step of navigation.
"""
self.vehicle_control_event.clear()
self.timestamp = timestamp
self.clock_publisher.publish(Clock(rospy.Time.from_sec(timestamp)))
# check if stack is still running
if self.... |
Execute one step of navigation.
| Execute one step of navigation. | [
"Execute",
"one",
"step",
"of",
"navigation",
"."
] | def run_step(self, input_data, timestamp):
self.vehicle_control_event.clear()
self.timestamp = timestamp
self.clock_publisher.publish(Clock(rospy.Time.from_sec(timestamp)))
if self.stack_process and self.stack_process.poll() is not None:
raise RuntimeError("Stack exited with:... | [
"def",
"run_step",
"(",
"self",
",",
"input_data",
",",
"timestamp",
")",
":",
"self",
".",
"vehicle_control_event",
".",
"clear",
"(",
")",
"self",
".",
"timestamp",
"=",
"timestamp",
"self",
".",
"clock_publisher",
".",
"publish",
"(",
"Clock",
"(",
"ros... | Execute one step of navigation. | [
"Execute",
"one",
"step",
"of",
"navigation",
"."
] | [
"\"\"\"\n Execute one step of navigation.\n \"\"\"",
"# check if stack is still running",
"# publish global plan to ROS once",
"# publish data of all sensors",
"# if the stepping mode is not used or active, there is no need to wait here"
] | [
{
"param": "self",
"type": null
},
{
"param": "input_data",
"type": null
},
{
"param": "timestamp",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "input_data",
"type": null,
"docstring": null,
"docstring_toke... |
28162516d3030b60f890852a0ffa66c58f4a82e6 | varunjammula/WorldOnRails | leaderboard/leaderboard/scenarios/scenario_manager.py | [
"MIT"
] | Python | run_scenario | null | def run_scenario(self):
"""
Trigger the start of the scenario and wait for it to finish/fail
"""
self.start_system_time = time.time()
self.start_game_time = GameTime.get_time()
self._watchdog.start()
self._running = True
while self._running:
... |
Trigger the start of the scenario and wait for it to finish/fail
| Trigger the start of the scenario and wait for it to finish/fail | [
"Trigger",
"the",
"start",
"of",
"the",
"scenario",
"and",
"wait",
"for",
"it",
"to",
"finish",
"/",
"fail"
] | def run_scenario(self):
self.start_system_time = time.time()
self.start_game_time = GameTime.get_time()
self._watchdog.start()
self._running = True
while self._running:
timestamp = None
world = CarlaDataProvider.get_world()
if world:
... | [
"def",
"run_scenario",
"(",
"self",
")",
":",
"self",
".",
"start_system_time",
"=",
"time",
".",
"time",
"(",
")",
"self",
".",
"start_game_time",
"=",
"GameTime",
".",
"get_time",
"(",
")",
"self",
".",
"_watchdog",
".",
"start",
"(",
")",
"self",
".... | Trigger the start of the scenario and wait for it to finish/fail | [
"Trigger",
"the",
"start",
"of",
"the",
"scenario",
"and",
"wait",
"for",
"it",
"to",
"finish",
"/",
"fail"
] | [
"\"\"\"\n Trigger the start of the scenario and wait for it to finish/fail\n \"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
28162516d3030b60f890852a0ffa66c58f4a82e6 | varunjammula/WorldOnRails | leaderboard/leaderboard/scenarios/scenario_manager.py | [
"MIT"
] | Python | _tick_scenario | null | def _tick_scenario(self, timestamp):
"""
Run next tick of scenario and the agent and tick the world.
"""
if self._timestamp_last_run < timestamp.elapsed_seconds and self._running:
self._timestamp_last_run = timestamp.elapsed_seconds
self._watchdog.update()
... |
Run next tick of scenario and the agent and tick the world.
| Run next tick of scenario and the agent and tick the world. | [
"Run",
"next",
"tick",
"of",
"scenario",
"and",
"the",
"agent",
"and",
"tick",
"the",
"world",
"."
] | def _tick_scenario(self, timestamp):
if self._timestamp_last_run < timestamp.elapsed_seconds and self._running:
self._timestamp_last_run = timestamp.elapsed_seconds
self._watchdog.update()
GameTime.on_carla_tick(timestamp)
CarlaDataProvider.on_carla_tick()
... | [
"def",
"_tick_scenario",
"(",
"self",
",",
"timestamp",
")",
":",
"if",
"self",
".",
"_timestamp_last_run",
"<",
"timestamp",
".",
"elapsed_seconds",
"and",
"self",
".",
"_running",
":",
"self",
".",
"_timestamp_last_run",
"=",
"timestamp",
".",
"elapsed_seconds... | Run next tick of scenario and the agent and tick the world. | [
"Run",
"next",
"tick",
"of",
"scenario",
"and",
"the",
"agent",
"and",
"tick",
"the",
"world",
"."
] | [
"\"\"\"\n Run next tick of scenario and the agent and tick the world.\n \"\"\"",
"# Update game time and actor information",
"# Special exception inside the agent that isn't caused by the agent",
"# Tick scenario"
] | [
{
"param": "self",
"type": null
},
{
"param": "timestamp",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "timestamp",
"type": null,
"docstring": null,
"docstring_token... |
936d20016c9e3978f2342c80fb2cd3bc5aa1fe03 | varunjammula/WorldOnRails | leaderboard/leaderboard/nocrash_evaluator.py | [
"MIT"
] | Python | _load_and_wait_for_world | null | def _load_and_wait_for_world(self, args):
"""
Load a new CARLA world and provide data to CarlaDataProvider
"""
self.world = self.client.load_world(args.town)
settings = self.world.get_settings()
settings.fixed_delta_seconds = 1.0 / self.frame_rate
settings.synchr... |
Load a new CARLA world and provide data to CarlaDataProvider
| Load a new CARLA world and provide data to CarlaDataProvider | [
"Load",
"a",
"new",
"CARLA",
"world",
"and",
"provide",
"data",
"to",
"CarlaDataProvider"
] | def _load_and_wait_for_world(self, args):
self.world = self.client.load_world(args.town)
settings = self.world.get_settings()
settings.fixed_delta_seconds = 1.0 / self.frame_rate
settings.synchronous_mode = True
self.world.apply_settings(settings)
self.world.reset_all_tra... | [
"def",
"_load_and_wait_for_world",
"(",
"self",
",",
"args",
")",
":",
"self",
".",
"world",
"=",
"self",
".",
"client",
".",
"load_world",
"(",
"args",
".",
"town",
")",
"settings",
"=",
"self",
".",
"world",
".",
"get_settings",
"(",
")",
"settings",
... | Load a new CARLA world and provide data to CarlaDataProvider | [
"Load",
"a",
"new",
"CARLA",
"world",
"and",
"provide",
"data",
"to",
"CarlaDataProvider"
] | [
"\"\"\"\n Load a new CARLA world and provide data to CarlaDataProvider\n \"\"\"",
"# Wait for the world to be ready"
] | [
{
"param": "self",
"type": null
},
{
"param": "args",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "args",
"type": null,
"docstring": null,
"docstring_tokens": [... |
936d20016c9e3978f2342c80fb2cd3bc5aa1fe03 | varunjammula/WorldOnRails | leaderboard/leaderboard/nocrash_evaluator.py | [
"MIT"
] | Python | _load_and_run_scenario | <not_specific> | def _load_and_run_scenario(self, args, route, weather_idx, traffic_idx):
"""
Load and run the scenario given by config.
Depending on what code fails, the simulation will either stop the route and
continue from the next one, or report a crash and stop.
"""
crash_message =... |
Load and run the scenario given by config.
Depending on what code fails, the simulation will either stop the route and
continue from the next one, or report a crash and stop.
| Load and run the scenario given by config.
Depending on what code fails, the simulation will either stop the route and
continue from the next one, or report a crash and stop. | [
"Load",
"and",
"run",
"the",
"scenario",
"given",
"by",
"config",
".",
"Depending",
"on",
"what",
"code",
"fails",
"the",
"simulation",
"will",
"either",
"stop",
"the",
"route",
"and",
"continue",
"from",
"the",
"next",
"one",
"or",
"report",
"a",
"crash",... | def _load_and_run_scenario(self, args, route, weather_idx, traffic_idx):
crash_message = ""
entry_status = "Started"
start_idx, target_idx = route
traffic_lvl = ['Empty', 'Regular', 'Dense'][traffic_idx]
print("\n\033[1m========= Preparing {} {}: {} to {}, weather {} =========".f... | [
"def",
"_load_and_run_scenario",
"(",
"self",
",",
"args",
",",
"route",
",",
"weather_idx",
",",
"traffic_idx",
")",
":",
"crash_message",
"=",
"\"\"",
"entry_status",
"=",
"\"Started\"",
"start_idx",
",",
"target_idx",
"=",
"route",
"traffic_lvl",
"=",
"[",
... | Load and run the scenario given by config. | [
"Load",
"and",
"run",
"the",
"scenario",
"given",
"by",
"config",
"."
] | [
"\"\"\"\n Load and run the scenario given by config.\n\n Depending on what code fails, the simulation will either stop the route and\n continue from the next one, or report a crash and stop.\n \"\"\"",
"# Set up the user's agent, and the timer to avoid freezing the simulation",
"# Ch... | [
{
"param": "self",
"type": null
},
{
"param": "args",
"type": null
},
{
"param": "route",
"type": null
},
{
"param": "weather_idx",
"type": null
},
{
"param": "traffic_idx",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "args",
"type": null,
"docstring": null,
"docstring_tokens": [... |
6e6080e5ffe3822d1ae304e5444b98d441d8fba4 | varunjammula/WorldOnRails | leaderboard/leaderboard/utils/route_manipulation.py | [
"MIT"
] | Python | downsample_route | <not_specific> | def downsample_route(route, sample_factor):
"""
Downsample the route by some factor.
:param route: the trajectory , has to contain the waypoints and the road options
:param sample_factor: Maximum distance between samples
:return: returns the ids of the final route that can
"""
ids_to_sample... |
Downsample the route by some factor.
:param route: the trajectory , has to contain the waypoints and the road options
:param sample_factor: Maximum distance between samples
:return: returns the ids of the final route that can
| Downsample the route by some factor. | [
"Downsample",
"the",
"route",
"by",
"some",
"factor",
"."
] | def downsample_route(route, sample_factor):
ids_to_sample = []
prev_option = None
dist = 0
for i, point in enumerate(route):
curr_option = point[1]
if curr_option in (RoadOption.CHANGELANELEFT, RoadOption.CHANGELANERIGHT):
ids_to_sample.append(i)
dist = 0
... | [
"def",
"downsample_route",
"(",
"route",
",",
"sample_factor",
")",
":",
"ids_to_sample",
"=",
"[",
"]",
"prev_option",
"=",
"None",
"dist",
"=",
"0",
"for",
"i",
",",
"point",
"in",
"enumerate",
"(",
"route",
")",
":",
"curr_option",
"=",
"point",
"[",
... | Downsample the route by some factor. | [
"Downsample",
"the",
"route",
"by",
"some",
"factor",
"."
] | [
"\"\"\"\n Downsample the route by some factor.\n :param route: the trajectory , has to contain the waypoints and the road options\n :param sample_factor: Maximum distance between samples\n :return: returns the ids of the final route that can\n \"\"\"",
"# Lane changing",
"# When road option chang... | [
{
"param": "route",
"type": null
},
{
"param": "sample_factor",
"type": null
}
] | {
"returns": [
{
"docstring": "returns the ids of the final route that can",
"docstring_tokens": [
"returns",
"the",
"ids",
"of",
"the",
"final",
"route",
"that",
"can"
],
"type": null
}
],
"raises": [],
"par... |
396c830a7b0dcf56f4f5029b7ef6f60835b877da | varunjammula/WorldOnRails | leaderboard/leaderboard/scenarios/train_scenario.py | [
"MIT"
] | Python | _scenario_sampling | <not_specific> | def _scenario_sampling(self, potential_scenarios_definitions, random_seed=0):
"""
The function used to sample the scenarios that are going to happen for this route.
"""
# fix the random seed for reproducibility
# rgn = random.RandomState(random_seed)
def position_sample... |
The function used to sample the scenarios that are going to happen for this route.
| The function used to sample the scenarios that are going to happen for this route. | [
"The",
"function",
"used",
"to",
"sample",
"the",
"scenarios",
"that",
"are",
"going",
"to",
"happen",
"for",
"this",
"route",
"."
] | def _scenario_sampling(self, potential_scenarios_definitions, random_seed=0):
def position_sampled(scenario_choice, sampled_scenarios):
for existent_scenario in sampled_scenarios:
if compare_scenarios(scenario_choice, existent_scenario):
return True
re... | [
"def",
"_scenario_sampling",
"(",
"self",
",",
"potential_scenarios_definitions",
",",
"random_seed",
"=",
"0",
")",
":",
"def",
"position_sampled",
"(",
"scenario_choice",
",",
"sampled_scenarios",
")",
":",
"\"\"\"\n Check if a position was already sampled, i.e. ... | The function used to sample the scenarios that are going to happen for this route. | [
"The",
"function",
"used",
"to",
"sample",
"the",
"scenarios",
"that",
"are",
"going",
"to",
"happen",
"for",
"this",
"route",
"."
] | [
"\"\"\"\n The function used to sample the scenarios that are going to happen for this route.\n \"\"\"",
"# fix the random seed for reproducibility",
"# rgn = random.RandomState(random_seed)",
"\"\"\"\n Check if a position was already sampled, i.e. used for another scenario\n ... | [
{
"param": "self",
"type": null
},
{
"param": "potential_scenarios_definitions",
"type": null
},
{
"param": "random_seed",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "potential_scenarios_definitions",
"type": null,
"docstring": null,
... |
396c830a7b0dcf56f4f5029b7ef6f60835b877da | varunjammula/WorldOnRails | leaderboard/leaderboard/scenarios/train_scenario.py | [
"MIT"
] | Python | _build_scenario_instances | <not_specific> | def _build_scenario_instances(self, world, ego_vehicle, scenario_definitions,
scenarios_per_tick=5, timeout=300, debug_mode=False):
"""
Based on the parsed route and possible scenarios, build all the scenario classes.
"""
scenario_instance_vec = []
... |
Based on the parsed route and possible scenarios, build all the scenario classes.
| Based on the parsed route and possible scenarios, build all the scenario classes. | [
"Based",
"on",
"the",
"parsed",
"route",
"and",
"possible",
"scenarios",
"build",
"all",
"the",
"scenario",
"classes",
"."
] | def _build_scenario_instances(self, world, ego_vehicle, scenario_definitions,
scenarios_per_tick=5, timeout=300, debug_mode=False):
scenario_instance_vec = []
if debug_mode:
for scenario in scenario_definitions:
loc = carla.Location(scenario[... | [
"def",
"_build_scenario_instances",
"(",
"self",
",",
"world",
",",
"ego_vehicle",
",",
"scenario_definitions",
",",
"scenarios_per_tick",
"=",
"5",
",",
"timeout",
"=",
"300",
",",
"debug_mode",
"=",
"False",
")",
":",
"scenario_instance_vec",
"=",
"[",
"]",
... | Based on the parsed route and possible scenarios, build all the scenario classes. | [
"Based",
"on",
"the",
"parsed",
"route",
"and",
"possible",
"scenarios",
"build",
"all",
"the",
"scenario",
"classes",
"."
] | [
"\"\"\"\n Based on the parsed route and possible scenarios, build all the scenario classes.\n \"\"\"",
"# Get the class possibilities for this scenario number",
"# Create the other actors that are going to appear",
"# Create an actor configuration for the ego-vehicle trigger position",
"# Do a... | [
{
"param": "self",
"type": null
},
{
"param": "world",
"type": null
},
{
"param": "ego_vehicle",
"type": null
},
{
"param": "scenario_definitions",
"type": null
},
{
"param": "scenarios_per_tick",
"type": null
},
{
"param": "timeout",
"type": null
... | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "world",
"type": null,
"docstring": null,
"docstring_tokens": ... |
3263a2536867bea9c35f1abef799c6e4f07b281c | varunjammula/WorldOnRails | leaderboard/leaderboard/scenarios/nocrash_eval_scenario.py | [
"MIT"
] | Python | _initialize_actors | null | def _initialize_actors(self, config):
"""
Set other_actors to the superset of all scenario actors
"""
# Create the background activity of the route
car_amounts = {
'Town01': [0,20,100],
'Town02': [0,15,70],
}
ped_amounts = {
... |
Set other_actors to the superset of all scenario actors
| Set other_actors to the superset of all scenario actors | [
"Set",
"other_actors",
"to",
"the",
"superset",
"of",
"all",
"scenario",
"actors"
] | def _initialize_actors(self, config):
car_amounts = {
'Town01': [0,20,100],
'Town02': [0,15,70],
}
ped_amounts = {
'Town01': [0,50,200],
'Town02': [0,50,150],
}
car_amount = car_amounts[self.town_name][self.traffic_idx]
ped_... | [
"def",
"_initialize_actors",
"(",
"self",
",",
"config",
")",
":",
"car_amounts",
"=",
"{",
"'Town01'",
":",
"[",
"0",
",",
"20",
",",
"100",
"]",
",",
"'Town02'",
":",
"[",
"0",
",",
"15",
",",
"70",
"]",
",",
"}",
"ped_amounts",
"=",
"{",
"'Tow... | Set other_actors to the superset of all scenario actors | [
"Set",
"other_actors",
"to",
"the",
"superset",
"of",
"all",
"scenario",
"actors"
] | [
"\"\"\"\n Set other_actors to the superset of all scenario actors\n \"\"\"",
"# Create the background activity of the route"
] | [
{
"param": "self",
"type": null
},
{
"param": "config",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "config",
"type": null,
"docstring": null,
"docstring_tokens":... |
3263a2536867bea9c35f1abef799c6e4f07b281c | varunjammula/WorldOnRails | leaderboard/leaderboard/scenarios/nocrash_eval_scenario.py | [
"MIT"
] | Python | _setup_scenario_end | null | def _setup_scenario_end(self, config):
"""
This function adds and additional behavior to the scenario, which is triggered
after it has ended.
The function can be overloaded by a user implementation inside the user-defined scenario class.
"""
pass |
This function adds and additional behavior to the scenario, which is triggered
after it has ended.
The function can be overloaded by a user implementation inside the user-defined scenario class.
| This function adds and additional behavior to the scenario, which is triggered
after it has ended.
The function can be overloaded by a user implementation inside the user-defined scenario class. | [
"This",
"function",
"adds",
"and",
"additional",
"behavior",
"to",
"the",
"scenario",
"which",
"is",
"triggered",
"after",
"it",
"has",
"ended",
".",
"The",
"function",
"can",
"be",
"overloaded",
"by",
"a",
"user",
"implementation",
"inside",
"the",
"user",
... | def _setup_scenario_end(self, config):
pass | [
"def",
"_setup_scenario_end",
"(",
"self",
",",
"config",
")",
":",
"pass"
] | This function adds and additional behavior to the scenario, which is triggered
after it has ended. | [
"This",
"function",
"adds",
"and",
"additional",
"behavior",
"to",
"the",
"scenario",
"which",
"is",
"triggered",
"after",
"it",
"has",
"ended",
"."
] | [
"\"\"\"\n This function adds and additional behavior to the scenario, which is triggered\n after it has ended.\n\n The function can be overloaded by a user implementation inside the user-defined scenario class.\n \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "config",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "config",
"type": null,
"docstring": null,
"docstring_tokens":... |
a3718cc629a4b5f7be65aa4d9628652d8e042e40 | varunjammula/WorldOnRails | leaderboard/leaderboard/scenarios/scenarioatomics/atomic_criteria.py | [
"MIT"
] | Python | _set_event_message | null | def _set_event_message(event, location):
"""
Sets the message of the event
"""
event.set_message('Agent got blocked at (x={}, y={}, z={})'.format(round(location.x, 3),
round(location.y, 3),
... |
Sets the message of the event
| Sets the message of the event | [
"Sets",
"the",
"message",
"of",
"the",
"event"
] | def _set_event_message(event, location):
event.set_message('Agent got blocked at (x={}, y={}, z={})'.format(round(location.x, 3),
round(location.y, 3),
ro... | [
"def",
"_set_event_message",
"(",
"event",
",",
"location",
")",
":",
"event",
".",
"set_message",
"(",
"'Agent got blocked at (x={}, y={}, z={})'",
".",
"format",
"(",
"round",
"(",
"location",
".",
"x",
",",
"3",
")",
",",
"round",
"(",
"location",
".",
"y... | Sets the message of the event | [
"Sets",
"the",
"message",
"of",
"the",
"event"
] | [
"\"\"\"\n Sets the message of the event\n \"\"\""
] | [
{
"param": "event",
"type": null
},
{
"param": "location",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "event",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "location",
"type": null,
"docstring": null,
"docstring_token... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.