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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
b8f8720d7db1eaeb1721fb62566ed95bd6bf9c05 | chriszs/warn-transformer | warn_transformer/transformers/nj.py | [
"Apache-2.0"
] | Python | transform_jobs | typing.Optional[int] | def transform_jobs(self, value: str) -> typing.Optional[int]:
"""Transform a raw jobs number into an integer.
Args:
value (str): A raw jobs number provided by the source
Returns: An integer number ready for consolidation. Or, if the value is invalid, a None.
"""
# C... | Transform a raw jobs number into an integer.
Args:
value (str): A raw jobs number provided by the source
Returns: An integer number ready for consolidation. Or, if the value is invalid, a None.
| Transform a raw jobs number into an integer. | [
"Transform",
"a",
"raw",
"jobs",
"number",
"into",
"an",
"integer",
"."
] | def transform_jobs(self, value: str) -> typing.Optional[int]:
value = value.replace("*", "")
return super().transform_jobs(value) | [
"def",
"transform_jobs",
"(",
"self",
",",
"value",
":",
"str",
")",
"->",
"typing",
".",
"Optional",
"[",
"int",
"]",
":",
"value",
"=",
"value",
".",
"replace",
"(",
"\"*\"",
",",
"\"\"",
")",
"return",
"super",
"(",
")",
".",
"transform_jobs",
"("... | Transform a raw jobs number into an integer. | [
"Transform",
"a",
"raw",
"jobs",
"number",
"into",
"an",
"integer",
"."
] | [
"\"\"\"Transform a raw jobs number into an integer.\n\n Args:\n value (str): A raw jobs number provided by the source\n\n Returns: An integer number ready for consolidation. Or, if the value is invalid, a None.\n \"\"\"",
"# Cut the asterisk they sometimes use",
"# Do the normal ... | [
{
"param": "self",
"type": null
},
{
"param": "value",
"type": "str"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "value",
"type": "str",
"docstring": "A raw jobs number provided by ... |
41926b563b21853f33056240757040f227f2d931 | chriszs/warn-transformer | warn_transformer/transformers/ct.py | [
"Apache-2.0"
] | Python | transform_date | typing.Optional[str] | def transform_date(self, value: str) -> typing.Optional[str]:
"""Transform a raw date string into a date object.
Args:
value (str): The raw date string provided by the source
Returns: A date object ready for consolidation. Or, if the date string is invalid, a None.
"""
... | Transform a raw date string into a date object.
Args:
value (str): The raw date string provided by the source
Returns: A date object ready for consolidation. Or, if the date string is invalid, a None.
| Transform a raw date string into a date object. | [
"Transform",
"a",
"raw",
"date",
"string",
"into",
"a",
"date",
"object",
"."
] | def transform_date(self, value: str) -> typing.Optional[str]:
try:
dt = self.date_corrections[value]
if dt:
return str(dt.date())
else:
assert dt is None
return dt
except KeyError:
pass
value = value.... | [
"def",
"transform_date",
"(",
"self",
",",
"value",
":",
"str",
")",
"->",
"typing",
".",
"Optional",
"[",
"str",
"]",
":",
"try",
":",
"dt",
"=",
"self",
".",
"date_corrections",
"[",
"value",
"]",
"if",
"dt",
":",
"return",
"str",
"(",
"dt",
".",... | Transform a raw date string into a date object. | [
"Transform",
"a",
"raw",
"date",
"string",
"into",
"a",
"date",
"object",
"."
] | [
"\"\"\"Transform a raw date string into a date object.\n\n Args:\n value (str): The raw date string provided by the source\n\n Returns: A date object ready for consolidation. Or, if the date string is invalid, a None.\n \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "value",
"type": "str"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "value",
"type": "str",
"docstring": "The raw date string provided b... |
41926b563b21853f33056240757040f227f2d931 | chriszs/warn-transformer | warn_transformer/transformers/ct.py | [
"Apache-2.0"
] | Python | check_if_closure | typing.Optional[bool] | def check_if_closure(self, row: typing.Dict) -> typing.Optional[bool]:
"""Determine whether a row is a closure or not.
Args:
row (dict): The raw row of data.
Returns: A boolean or null
"""
return "yes" in row["closing"].lower() or None | Determine whether a row is a closure or not.
Args:
row (dict): The raw row of data.
Returns: A boolean or null
| Determine whether a row is a closure or not. | [
"Determine",
"whether",
"a",
"row",
"is",
"a",
"closure",
"or",
"not",
"."
] | def check_if_closure(self, row: typing.Dict) -> typing.Optional[bool]:
return "yes" in row["closing"].lower() or None | [
"def",
"check_if_closure",
"(",
"self",
",",
"row",
":",
"typing",
".",
"Dict",
")",
"->",
"typing",
".",
"Optional",
"[",
"bool",
"]",
":",
"return",
"\"yes\"",
"in",
"row",
"[",
"\"closing\"",
"]",
".",
"lower",
"(",
")",
"or",
"None"
] | Determine whether a row is a closure or not. | [
"Determine",
"whether",
"a",
"row",
"is",
"a",
"closure",
"or",
"not",
"."
] | [
"\"\"\"Determine whether a row is a closure or not.\n\n Args:\n row (dict): The raw row of data.\n\n Returns: A boolean or null\n \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "row",
"type": "typing.Dict"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "row",
"type": "typing.Dict",
"docstring": "The raw row of data.",
... |
6e7daa2390f6b7daae63ac24745013b38e91c440 | chriszs/warn-transformer | warn_transformer/transformers/ne.py | [
"Apache-2.0"
] | Python | check_if_closure | typing.Optional[bool] | def check_if_closure(self, row: typing.Dict) -> typing.Optional[bool]:
"""Determine whether a row is a closure or not.
Args:
row (dict): The raw row of data.
Returns: A boolean or null
"""
return "closure" in row["Type"].lower() or None | Determine whether a row is a closure or not.
Args:
row (dict): The raw row of data.
Returns: A boolean or null
| Determine whether a row is a closure or not. | [
"Determine",
"whether",
"a",
"row",
"is",
"a",
"closure",
"or",
"not",
"."
] | def check_if_closure(self, row: typing.Dict) -> typing.Optional[bool]:
return "closure" in row["Type"].lower() or None | [
"def",
"check_if_closure",
"(",
"self",
",",
"row",
":",
"typing",
".",
"Dict",
")",
"->",
"typing",
".",
"Optional",
"[",
"bool",
"]",
":",
"return",
"\"closure\"",
"in",
"row",
"[",
"\"Type\"",
"]",
".",
"lower",
"(",
")",
"or",
"None"
] | Determine whether a row is a closure or not. | [
"Determine",
"whether",
"a",
"row",
"is",
"a",
"closure",
"or",
"not",
"."
] | [
"\"\"\"Determine whether a row is a closure or not.\n\n Args:\n row (dict): The raw row of data.\n\n Returns: A boolean or null\n \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "row",
"type": "typing.Dict"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "row",
"type": "typing.Dict",
"docstring": "The raw row of data.",
... |
faa3d4ac59f91dc04addef71b28fa59b0097a958 | chriszs/warn-transformer | warn_transformer/transformers/fl.py | [
"Apache-2.0"
] | Python | transform_date | typing.Optional[str] | def transform_date(self, value: str) -> typing.Optional[str]:
"""Transform a raw date string into a date object.
Args:
value (str): The raw date string provided by the source
Returns: A date object ready for consolidation. Or, if the date string is invalid, a None.
"""
... | Transform a raw date string into a date object.
Args:
value (str): The raw date string provided by the source
Returns: A date object ready for consolidation. Or, if the date string is invalid, a None.
| Transform a raw date string into a date object. | [
"Transform",
"a",
"raw",
"date",
"string",
"into",
"a",
"date",
"object",
"."
] | def transform_date(self, value: str) -> typing.Optional[str]:
try:
return super().transform_date(value)
except Exception:
value = value.replace("\n", "").strip()
value = value.split(" thru")[0].strip()
value = value.split("thru")[0].strip()
ret... | [
"def",
"transform_date",
"(",
"self",
",",
"value",
":",
"str",
")",
"->",
"typing",
".",
"Optional",
"[",
"str",
"]",
":",
"try",
":",
"return",
"super",
"(",
")",
".",
"transform_date",
"(",
"value",
")",
"except",
"Exception",
":",
"value",
"=",
"... | Transform a raw date string into a date object. | [
"Transform",
"a",
"raw",
"date",
"string",
"into",
"a",
"date",
"object",
"."
] | [
"\"\"\"Transform a raw date string into a date object.\n\n Args:\n value (str): The raw date string provided by the source\n\n Returns: A date object ready for consolidation. Or, if the date string is invalid, a None.\n \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "value",
"type": "str"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "value",
"type": "str",
"docstring": "The raw date string provided b... |
faa3d4ac59f91dc04addef71b28fa59b0097a958 | chriszs/warn-transformer | warn_transformer/transformers/fl.py | [
"Apache-2.0"
] | Python | transform_company | str | def transform_company(self, value: str) -> str:
"""Transform a raw company name.
Args:
value (str): The raw company string provided by the source
Returns: A string object ready for consolidation.
"""
return value.split("\n")[0].strip() | Transform a raw company name.
Args:
value (str): The raw company string provided by the source
Returns: A string object ready for consolidation.
| Transform a raw company name. | [
"Transform",
"a",
"raw",
"company",
"name",
"."
] | def transform_company(self, value: str) -> str:
return value.split("\n")[0].strip() | [
"def",
"transform_company",
"(",
"self",
",",
"value",
":",
"str",
")",
"->",
"str",
":",
"return",
"value",
".",
"split",
"(",
"\"\\n\"",
")",
"[",
"0",
"]",
".",
"strip",
"(",
")"
] | Transform a raw company name. | [
"Transform",
"a",
"raw",
"company",
"name",
"."
] | [
"\"\"\"Transform a raw company name.\n\n Args:\n value (str): The raw company string provided by the source\n\n Returns: A string object ready for consolidation.\n \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "value",
"type": "str"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "value",
"type": "str",
"docstring": "The raw company string provide... |
1903cc3eecd36054eed8682d76b0a1dbdc45ce2e | chriszs/warn-transformer | warn_transformer/transformers/ak.py | [
"Apache-2.0"
] | Python | transform_date | typing.Optional[str] | def transform_date(self, value: str) -> typing.Optional[str]:
"""Transform a raw date string into a date object.
Args:
value (str): The raw date string provided by the source
Returns: A date object ready for consolidation. Or, if the date string is invalid, a None.
"""
... | Transform a raw date string into a date object.
Args:
value (str): The raw date string provided by the source
Returns: A date object ready for consolidation. Or, if the date string is invalid, a None.
| Transform a raw date string into a date object. | [
"Transform",
"a",
"raw",
"date",
"string",
"into",
"a",
"date",
"object",
"."
] | def transform_date(self, value: str) -> typing.Optional[str]:
try:
dt = self.date_corrections[value]
if dt:
return str(dt.date())
else:
assert dt is None
return dt
except KeyError:
pass
value = value.... | [
"def",
"transform_date",
"(",
"self",
",",
"value",
":",
"str",
")",
"->",
"typing",
".",
"Optional",
"[",
"str",
"]",
":",
"try",
":",
"dt",
"=",
"self",
".",
"date_corrections",
"[",
"value",
"]",
"if",
"dt",
":",
"return",
"str",
"(",
"dt",
".",... | Transform a raw date string into a date object. | [
"Transform",
"a",
"raw",
"date",
"string",
"into",
"a",
"date",
"object",
"."
] | [
"\"\"\"Transform a raw date string into a date object.\n\n Args:\n value (str): The raw date string provided by the source\n\n Returns: A date object ready for consolidation. Or, if the date string is invalid, a None.\n \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "value",
"type": "str"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "value",
"type": "str",
"docstring": "The raw date string provided b... |
1903cc3eecd36054eed8682d76b0a1dbdc45ce2e | chriszs/warn-transformer | warn_transformer/transformers/ak.py | [
"Apache-2.0"
] | Python | check_if_temporary | typing.Optional[bool] | def check_if_temporary(self, row: typing.Dict) -> typing.Optional[bool]:
"""Determine whether a row is a temporary or not.
Args:
row (dict): The raw row of data.
Returns: A boolean or null
"""
return "temporary" in row["Notes"].lower() or None | Determine whether a row is a temporary or not.
Args:
row (dict): The raw row of data.
Returns: A boolean or null
| Determine whether a row is a temporary or not. | [
"Determine",
"whether",
"a",
"row",
"is",
"a",
"temporary",
"or",
"not",
"."
] | def check_if_temporary(self, row: typing.Dict) -> typing.Optional[bool]:
return "temporary" in row["Notes"].lower() or None | [
"def",
"check_if_temporary",
"(",
"self",
",",
"row",
":",
"typing",
".",
"Dict",
")",
"->",
"typing",
".",
"Optional",
"[",
"bool",
"]",
":",
"return",
"\"temporary\"",
"in",
"row",
"[",
"\"Notes\"",
"]",
".",
"lower",
"(",
")",
"or",
"None"
] | Determine whether a row is a temporary or not. | [
"Determine",
"whether",
"a",
"row",
"is",
"a",
"temporary",
"or",
"not",
"."
] | [
"\"\"\"Determine whether a row is a temporary or not.\n\n Args:\n row (dict): The raw row of data.\n\n Returns: A boolean or null\n \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "row",
"type": "typing.Dict"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "row",
"type": "typing.Dict",
"docstring": "The raw row of data.",
... |
1903cc3eecd36054eed8682d76b0a1dbdc45ce2e | chriszs/warn-transformer | warn_transformer/transformers/ak.py | [
"Apache-2.0"
] | Python | check_if_closure | typing.Optional[bool] | def check_if_closure(self, row: typing.Dict) -> typing.Optional[bool]:
"""Determine whether a row is a closure or not.
Args:
row (dict): The raw row of data.
Returns: A boolean or null
"""
return "closure" in row["Notes"].lower() or None | Determine whether a row is a closure or not.
Args:
row (dict): The raw row of data.
Returns: A boolean or null
| Determine whether a row is a closure or not. | [
"Determine",
"whether",
"a",
"row",
"is",
"a",
"closure",
"or",
"not",
"."
] | def check_if_closure(self, row: typing.Dict) -> typing.Optional[bool]:
return "closure" in row["Notes"].lower() or None | [
"def",
"check_if_closure",
"(",
"self",
",",
"row",
":",
"typing",
".",
"Dict",
")",
"->",
"typing",
".",
"Optional",
"[",
"bool",
"]",
":",
"return",
"\"closure\"",
"in",
"row",
"[",
"\"Notes\"",
"]",
".",
"lower",
"(",
")",
"or",
"None"
] | Determine whether a row is a closure or not. | [
"Determine",
"whether",
"a",
"row",
"is",
"a",
"closure",
"or",
"not",
"."
] | [
"\"\"\"Determine whether a row is a closure or not.\n\n Args:\n row (dict): The raw row of data.\n\n Returns: A boolean or null\n \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "row",
"type": "typing.Dict"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "row",
"type": "typing.Dict",
"docstring": "The raw row of data.",
... |
c8778cce0735e758107e53aacf15fb97c08deff8 | chriszs/warn-transformer | warn_transformer/transformers/va.py | [
"Apache-2.0"
] | Python | check_if_closure | typing.Optional[bool] | def check_if_closure(self, row: typing.Dict) -> typing.Optional[bool]:
"""Determine whether a row is a closure or not.
Args:
row (dict): The raw row of data.
Returns: A boolean or null
"""
return "yes" in row["Closure"].lower() or None | Determine whether a row is a closure or not.
Args:
row (dict): The raw row of data.
Returns: A boolean or null
| Determine whether a row is a closure or not. | [
"Determine",
"whether",
"a",
"row",
"is",
"a",
"closure",
"or",
"not",
"."
] | def check_if_closure(self, row: typing.Dict) -> typing.Optional[bool]:
return "yes" in row["Closure"].lower() or None | [
"def",
"check_if_closure",
"(",
"self",
",",
"row",
":",
"typing",
".",
"Dict",
")",
"->",
"typing",
".",
"Optional",
"[",
"bool",
"]",
":",
"return",
"\"yes\"",
"in",
"row",
"[",
"\"Closure\"",
"]",
".",
"lower",
"(",
")",
"or",
"None"
] | Determine whether a row is a closure or not. | [
"Determine",
"whether",
"a",
"row",
"is",
"a",
"closure",
"or",
"not",
"."
] | [
"\"\"\"Determine whether a row is a closure or not.\n\n Args:\n row (dict): The raw row of data.\n\n Returns: A boolean or null\n \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "row",
"type": "typing.Dict"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "row",
"type": "typing.Dict",
"docstring": "The raw row of data.",
... |
601e75119c3172d5e7390a3e7660b4531a91c59a | chriszs/warn-transformer | warn_transformer/transformers/wa.py | [
"Apache-2.0"
] | Python | check_if_temporary | typing.Optional[bool] | def check_if_temporary(self, row: typing.Dict) -> typing.Optional[bool]:
"""Determine whether a row is a temporary or not.
Args:
row (dict): The raw row of data.
Returns: A boolean or null
"""
return row["Type of Layoff"].lower() == "temporary" | Determine whether a row is a temporary or not.
Args:
row (dict): The raw row of data.
Returns: A boolean or null
| Determine whether a row is a temporary or not. | [
"Determine",
"whether",
"a",
"row",
"is",
"a",
"temporary",
"or",
"not",
"."
] | def check_if_temporary(self, row: typing.Dict) -> typing.Optional[bool]:
return row["Type of Layoff"].lower() == "temporary" | [
"def",
"check_if_temporary",
"(",
"self",
",",
"row",
":",
"typing",
".",
"Dict",
")",
"->",
"typing",
".",
"Optional",
"[",
"bool",
"]",
":",
"return",
"row",
"[",
"\"Type of Layoff\"",
"]",
".",
"lower",
"(",
")",
"==",
"\"temporary\""
] | Determine whether a row is a temporary or not. | [
"Determine",
"whether",
"a",
"row",
"is",
"a",
"temporary",
"or",
"not",
"."
] | [
"\"\"\"Determine whether a row is a temporary or not.\n\n Args:\n row (dict): The raw row of data.\n\n Returns: A boolean or null\n \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "row",
"type": "typing.Dict"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "row",
"type": "typing.Dict",
"docstring": "The raw row of data.",
... |
601e75119c3172d5e7390a3e7660b4531a91c59a | chriszs/warn-transformer | warn_transformer/transformers/wa.py | [
"Apache-2.0"
] | Python | check_if_closure | typing.Optional[bool] | def check_if_closure(self, row: typing.Dict) -> typing.Optional[bool]:
"""Determine whether a row is a closure or not.
Args:
row (dict): The raw row of data.
Returns: A boolean or null
"""
temporary = row["Type of Layoff"].lower() == "temporary"
if temporary... | Determine whether a row is a closure or not.
Args:
row (dict): The raw row of data.
Returns: A boolean or null
| Determine whether a row is a closure or not. | [
"Determine",
"whether",
"a",
"row",
"is",
"a",
"closure",
"or",
"not",
"."
] | def check_if_closure(self, row: typing.Dict) -> typing.Optional[bool]:
temporary = row["Type of Layoff"].lower() == "temporary"
if temporary:
return False
return row["Closure Layoff"].lower() == "closure" | [
"def",
"check_if_closure",
"(",
"self",
",",
"row",
":",
"typing",
".",
"Dict",
")",
"->",
"typing",
".",
"Optional",
"[",
"bool",
"]",
":",
"temporary",
"=",
"row",
"[",
"\"Type of Layoff\"",
"]",
".",
"lower",
"(",
")",
"==",
"\"temporary\"",
"if",
"... | Determine whether a row is a closure or not. | [
"Determine",
"whether",
"a",
"row",
"is",
"a",
"closure",
"or",
"not",
"."
] | [
"\"\"\"Determine whether a row is a closure or not.\n\n Args:\n row (dict): The raw row of data.\n\n Returns: A boolean or null\n \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "row",
"type": "typing.Dict"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "row",
"type": "typing.Dict",
"docstring": "The raw row of data.",
... |
b53ed0d647cf3377816b4bb5b410e6fea8b95cbe | chriszs/warn-transformer | warn_transformer/transformers/la.py | [
"Apache-2.0"
] | Python | transform_date | typing.Optional[str] | def transform_date(self, value: str) -> typing.Optional[str]:
"""Transform a raw date string into a date object.
Args:
value (str): The raw date string provided by the source
Returns: A date object ready for consolidation. Or, if the date string is invalid, a None.
"""
... | Transform a raw date string into a date object.
Args:
value (str): The raw date string provided by the source
Returns: A date object ready for consolidation. Or, if the date string is invalid, a None.
| Transform a raw date string into a date object. | [
"Transform",
"a",
"raw",
"date",
"string",
"into",
"a",
"date",
"object",
"."
] | def transform_date(self, value: str) -> typing.Optional[str]:
try:
dt = self.date_corrections[value]
if dt:
return str(dt.date())
else:
assert dt is None
return dt
except KeyError:
pass
value = value.... | [
"def",
"transform_date",
"(",
"self",
",",
"value",
":",
"str",
")",
"->",
"typing",
".",
"Optional",
"[",
"str",
"]",
":",
"try",
":",
"dt",
"=",
"self",
".",
"date_corrections",
"[",
"value",
"]",
"if",
"dt",
":",
"return",
"str",
"(",
"dt",
".",... | Transform a raw date string into a date object. | [
"Transform",
"a",
"raw",
"date",
"string",
"into",
"a",
"date",
"object",
"."
] | [
"\"\"\"Transform a raw date string into a date object.\n\n Args:\n value (str): The raw date string provided by the source\n\n Returns: A date object ready for consolidation. Or, if the date string is invalid, a None.\n \"\"\"",
"# Try corrections before we edit the string",
"# A... | [
{
"param": "self",
"type": null
},
{
"param": "value",
"type": "str"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "value",
"type": "str",
"docstring": "The raw date string provided b... |
d44b8f076a4589441caddae91b34966190f7ef23 | chriszs/warn-transformer | warn_transformer/transformers/in.py | [
"Apache-2.0"
] | Python | prep_row_list | typing.List[typing.Dict] | def prep_row_list(
self, row_list: typing.List[typing.Dict]
) -> typing.List[typing.Dict]:
"""Make necessary transformations to the raw row list prior to transformation.
Args:
row_list (list): A list of raw rows of data from the source.
Returns: The row list minus empty... | Make necessary transformations to the raw row list prior to transformation.
Args:
row_list (list): A list of raw rows of data from the source.
Returns: The row list minus empty records
| Make necessary transformations to the raw row list prior to transformation. | [
"Make",
"necessary",
"transformations",
"to",
"the",
"raw",
"row",
"list",
"prior",
"to",
"transformation",
"."
] | def prep_row_list(
self, row_list: typing.List[typing.Dict]
) -> typing.List[typing.Dict]:
row_list = super().prep_row_list(row_list)
return [r for r in row_list if r["Affected Workers"] != "N/A"] | [
"def",
"prep_row_list",
"(",
"self",
",",
"row_list",
":",
"typing",
".",
"List",
"[",
"typing",
".",
"Dict",
"]",
")",
"->",
"typing",
".",
"List",
"[",
"typing",
".",
"Dict",
"]",
":",
"row_list",
"=",
"super",
"(",
")",
".",
"prep_row_list",
"(",
... | Make necessary transformations to the raw row list prior to transformation. | [
"Make",
"necessary",
"transformations",
"to",
"the",
"raw",
"row",
"list",
"prior",
"to",
"transformation",
"."
] | [
"\"\"\"Make necessary transformations to the raw row list prior to transformation.\n\n Args:\n row_list (list): A list of raw rows of data from the source.\n\n Returns: The row list minus empty records\n \"\"\"",
"# Do the standard stuff",
"# Cut rows with data-free revisions"
] | [
{
"param": "self",
"type": null
},
{
"param": "row_list",
"type": "typing.List[typing.Dict]"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "row_list",
"type": "typing.List[typing.Dict]",
"docstring": "A list... |
d44b8f076a4589441caddae91b34966190f7ef23 | chriszs/warn-transformer | warn_transformer/transformers/in.py | [
"Apache-2.0"
] | Python | transform_date | typing.Optional[str] | def transform_date(self, value: str) -> typing.Optional[str]:
"""Transform a raw date string into a date object.
Args:
value (str): The raw date string provided by the source
Returns: A date object ready for consolidation. Or, if the date string is invalid, a None.
"""
... | Transform a raw date string into a date object.
Args:
value (str): The raw date string provided by the source
Returns: A date object ready for consolidation. Or, if the date string is invalid, a None.
| Transform a raw date string into a date object. | [
"Transform",
"a",
"raw",
"date",
"string",
"into",
"a",
"date",
"object",
"."
] | def transform_date(self, value: str) -> typing.Optional[str]:
try:
dt = self.date_corrections[value]
if dt:
return str(dt.date())
else:
assert dt is None
return dt
except KeyError:
pass
value = value.... | [
"def",
"transform_date",
"(",
"self",
",",
"value",
":",
"str",
")",
"->",
"typing",
".",
"Optional",
"[",
"str",
"]",
":",
"try",
":",
"dt",
"=",
"self",
".",
"date_corrections",
"[",
"value",
"]",
"if",
"dt",
":",
"return",
"str",
"(",
"dt",
".",... | Transform a raw date string into a date object. | [
"Transform",
"a",
"raw",
"date",
"string",
"into",
"a",
"date",
"object",
"."
] | [
"\"\"\"Transform a raw date string into a date object.\n\n Args:\n value (str): The raw date string provided by the source\n\n Returns: A date object ready for consolidation. Or, if the date string is invalid, a None.\n \"\"\"",
"# Try corrections before we edit the string",
"# A... | [
{
"param": "self",
"type": null
},
{
"param": "value",
"type": "str"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "value",
"type": "str",
"docstring": "The raw date string provided b... |
d44b8f076a4589441caddae91b34966190f7ef23 | chriszs/warn-transformer | warn_transformer/transformers/in.py | [
"Apache-2.0"
] | Python | check_if_closure | typing.Optional[bool] | def check_if_closure(self, row: typing.Dict) -> typing.Optional[bool]:
"""Determine whether a row is a closure or not.
Args:
row (dict): The raw row of data.
Returns: A boolean or null
"""
whitelist = ["CL", "CL -Relocating", "LO and CL", "LO/CL", "PENDING CL"]
... | Determine whether a row is a closure or not.
Args:
row (dict): The raw row of data.
Returns: A boolean or null
| Determine whether a row is a closure or not. | [
"Determine",
"whether",
"a",
"row",
"is",
"a",
"closure",
"or",
"not",
"."
] | def check_if_closure(self, row: typing.Dict) -> typing.Optional[bool]:
whitelist = ["CL", "CL -Relocating", "LO and CL", "LO/CL", "PENDING CL"]
return row["Notice Type"] in whitelist or None | [
"def",
"check_if_closure",
"(",
"self",
",",
"row",
":",
"typing",
".",
"Dict",
")",
"->",
"typing",
".",
"Optional",
"[",
"bool",
"]",
":",
"whitelist",
"=",
"[",
"\"CL\"",
",",
"\"CL -Relocating\"",
",",
"\"LO and CL\"",
",",
"\"LO/CL\"",
",",
"\"PENDING... | Determine whether a row is a closure or not. | [
"Determine",
"whether",
"a",
"row",
"is",
"a",
"closure",
"or",
"not",
"."
] | [
"\"\"\"Determine whether a row is a closure or not.\n\n Args:\n row (dict): The raw row of data.\n\n Returns: A boolean or null\n \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "row",
"type": "typing.Dict"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "row",
"type": "typing.Dict",
"docstring": "The raw row of data.",
... |
79efabc7d8775efe9ce11c0b29f75a0f0a7c929e | chriszs/warn-transformer | warn_transformer/transformers/tn.py | [
"Apache-2.0"
] | Python | transform_date | typing.Optional[str] | def transform_date(self, value: str) -> typing.Optional[str]:
"""Transform a raw date string into a date object.
Args:
value (str): The raw date string provided by the source
Returns: A date object ready for consolidation. Or, if the date string is invalid, a None.
"""
... | Transform a raw date string into a date object.
Args:
value (str): The raw date string provided by the source
Returns: A date object ready for consolidation. Or, if the date string is invalid, a None.
| Transform a raw date string into a date object. | [
"Transform",
"a",
"raw",
"date",
"string",
"into",
"a",
"date",
"object",
"."
] | def transform_date(self, value: str) -> typing.Optional[str]:
try:
return super().transform_date(value)
except Exception:
value = value.strip().split(" and ")[0].strip()
value = value.strip().split(" to ")[0].strip()
value = value.strip().split(" through "... | [
"def",
"transform_date",
"(",
"self",
",",
"value",
":",
"str",
")",
"->",
"typing",
".",
"Optional",
"[",
"str",
"]",
":",
"try",
":",
"return",
"super",
"(",
")",
".",
"transform_date",
"(",
"value",
")",
"except",
"Exception",
":",
"value",
"=",
"... | Transform a raw date string into a date object. | [
"Transform",
"a",
"raw",
"date",
"string",
"into",
"a",
"date",
"object",
"."
] | [
"\"\"\"Transform a raw date string into a date object.\n\n Args:\n value (str): The raw date string provided by the source\n\n Returns: A date object ready for consolidation. Or, if the date string is invalid, a None.\n \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "value",
"type": "str"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "value",
"type": "str",
"docstring": "The raw date string provided b... |
1816df22e2326c122855c4d8637e59511f7d8209 | geem-lab/overreact | overreact/_cli.py | [
"MIT"
] | Python | _prepare_simulation | <not_specific> | def _prepare_simulation(scheme, k, concentrations):
"""
Help prepare some data before the simulation.
Raises
------
ValueError
If concentrations are invalid or inconsistent with the scheme.
"""
free_y0 = {}
fixed_y0 = {}
for spec in concentrations:
fields = spec.spli... |
Help prepare some data before the simulation.
Raises
------
ValueError
If concentrations are invalid or inconsistent with the scheme.
| Help prepare some data before the simulation.
Raises
ValueError
If concentrations are invalid or inconsistent with the scheme. | [
"Help",
"prepare",
"some",
"data",
"before",
"the",
"simulation",
".",
"Raises",
"ValueError",
"If",
"concentrations",
"are",
"invalid",
"or",
"inconsistent",
"with",
"the",
"scheme",
"."
] | def _prepare_simulation(scheme, k, concentrations):
free_y0 = {}
fixed_y0 = {}
for spec in concentrations:
fields = spec.split(":", 1)
name, quantity = fields[0].strip(), fields[1].strip()
if quantity.startswith("!"):
d = fixed_y0
quantity = quantity[1:]
... | [
"def",
"_prepare_simulation",
"(",
"scheme",
",",
"k",
",",
"concentrations",
")",
":",
"free_y0",
"=",
"{",
"}",
"fixed_y0",
"=",
"{",
"}",
"for",
"spec",
"in",
"concentrations",
":",
"fields",
"=",
"spec",
".",
"split",
"(",
"\":\"",
",",
"1",
")",
... | Help prepare some data before the simulation. | [
"Help",
"prepare",
"some",
"data",
"before",
"the",
"simulation",
"."
] | [
"\"\"\"\n Help prepare some data before the simulation.\n\n Raises\n ------\n ValueError\n If concentrations are invalid or inconsistent with the scheme.\n \"\"\"",
"# TODO(schneiderfelipe): log stuff related to get_fixed_scheme"
] | [
{
"param": "scheme",
"type": null
},
{
"param": "k",
"type": null
},
{
"param": "concentrations",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "scheme",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "k",
"type": null,
"docstring": null,
"docstring_tokens": []... |
68a195ed68571684bc83a21efc0f802a03a11379 | geem-lab/overreact | overreact/tunnel.py | [
"MIT"
] | Python | f | <not_specific> | def f(eps, with_exp=True):
"""Transmission function multiplied or not by the Boltzmann weight."""
a1 = F * np.sqrt((eps + v1) / u)
a2 = F * np.sqrt((eps + v2) / u)
qplus = np.cosh(two_pi * (a1 + a2))
qminus = np.cosh(two_pi * (a1 - a2))
p = (qplus - qminus) / (D + qplus... | Transmission function multiplied or not by the Boltzmann weight. | Transmission function multiplied or not by the Boltzmann weight. | [
"Transmission",
"function",
"multiplied",
"or",
"not",
"by",
"the",
"Boltzmann",
"weight",
"."
] | def f(eps, with_exp=True):
a1 = F * np.sqrt((eps + v1) / u)
a2 = F * np.sqrt((eps + v2) / u)
qplus = np.cosh(two_pi * (a1 + a2))
qminus = np.cosh(two_pi * (a1 - a2))
p = (qplus - qminus) / (D + qplus)
if with_exp:
return p * np.exp(-eps)
return p | [
"def",
"f",
"(",
"eps",
",",
"with_exp",
"=",
"True",
")",
":",
"a1",
"=",
"F",
"*",
"np",
".",
"sqrt",
"(",
"(",
"eps",
"+",
"v1",
")",
"/",
"u",
")",
"a2",
"=",
"F",
"*",
"np",
".",
"sqrt",
"(",
"(",
"eps",
"+",
"v2",
")",
"/",
"u",
... | Transmission function multiplied or not by the Boltzmann weight. | [
"Transmission",
"function",
"multiplied",
"or",
"not",
"by",
"the",
"Boltzmann",
"weight",
"."
] | [
"\"\"\"Transmission function multiplied or not by the Boltzmann weight.\"\"\""
] | [
{
"param": "eps",
"type": null
},
{
"param": "with_exp",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "eps",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "with_exp",
"type": null,
"docstring": null,
"docstring_tokens"... |
b96380ac504f399383c96533d2a5ca1907146470 | geem-lab/overreact | overreact/_misc.py | [
"MIT"
] | Python | _is_prime | <not_specific> | def _is_prime(num):
"""Check if num is prime."""
for i in range(2, int(np.sqrt(num)) + 1):
if (num % i) == 0:
return False
return True | Check if num is prime. | Check if num is prime. | [
"Check",
"if",
"num",
"is",
"prime",
"."
] | def _is_prime(num):
for i in range(2, int(np.sqrt(num)) + 1):
if (num % i) == 0:
return False
return True | [
"def",
"_is_prime",
"(",
"num",
")",
":",
"for",
"i",
"in",
"range",
"(",
"2",
",",
"int",
"(",
"np",
".",
"sqrt",
"(",
"num",
")",
")",
"+",
"1",
")",
":",
"if",
"(",
"num",
"%",
"i",
")",
"==",
"0",
":",
"return",
"False",
"return",
"True... | Check if num is prime. | [
"Check",
"if",
"num",
"is",
"prime",
"."
] | [
"\"\"\"Check if num is prime.\"\"\""
] | [
{
"param": "num",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "num",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
b97ec298c8ff91d586149ee09440f12d1e25f9f0 | geem-lab/overreact | overreact/thermo/_gas.py | [
"MIT"
] | Python | calc_elec_energy | <not_specific> | def calc_elec_energy(energy=0.0, degeneracy=1, temperature=298.15):
"""Calculate electronic energy.
This eventually adds a correction based on accessible excited states, but
simply return the ground state energy if only information on the ground
state is given.
Parameters
----------
energy... | Calculate electronic energy.
This eventually adds a correction based on accessible excited states, but
simply return the ground state energy if only information on the ground
state is given.
Parameters
----------
energy : array-like, optional
Energies for different states, in J/mol.
... | Calculate electronic energy.
This eventually adds a correction based on accessible excited states, but
simply return the ground state energy if only information on the ground
state is given.
Parameters
energy : array-like, optional
Energies for different states, in J/mol.
degeneracy : array-like, optional
Degeneracie... | [
"Calculate",
"electronic",
"energy",
".",
"This",
"eventually",
"adds",
"a",
"correction",
"based",
"on",
"accessible",
"excited",
"states",
"but",
"simply",
"return",
"the",
"ground",
"state",
"energy",
"if",
"only",
"information",
"on",
"the",
"ground",
"state... | def calc_elec_energy(energy=0.0, degeneracy=1, temperature=298.15):
temperature = np.asarray(temperature)
min_energy = np.asarray(energy).min()
if np.isclose(temperature, 0.0):
logger.warning("assuming ground state as electronic energy at zero temperature")
return min_energy
energy = ene... | [
"def",
"calc_elec_energy",
"(",
"energy",
"=",
"0.0",
",",
"degeneracy",
"=",
"1",
",",
"temperature",
"=",
"298.15",
")",
":",
"temperature",
"=",
"np",
".",
"asarray",
"(",
"temperature",
")",
"min_energy",
"=",
"np",
".",
"asarray",
"(",
"energy",
")"... | Calculate electronic energy. | [
"Calculate",
"electronic",
"energy",
"."
] | [
"\"\"\"Calculate electronic energy.\n\n This eventually adds a correction based on accessible excited states, but\n simply return the ground state energy if only information on the ground\n state is given.\n\n Parameters\n ----------\n energy : array-like, optional\n Energies for different ... | [
{
"param": "energy",
"type": null
},
{
"param": "degeneracy",
"type": null
},
{
"param": "temperature",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "energy",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "degeneracy",
"type": null,
"docstring": null,
"docstring_to... |
b97ec298c8ff91d586149ee09440f12d1e25f9f0 | geem-lab/overreact | overreact/thermo/_gas.py | [
"MIT"
] | Python | _vibrational_temperature | <not_specific> | def _vibrational_temperature(vibfreqs=None):
r"""Calculate vibrational temperatures.
This function returns vibrational temperatures associated with all positive
frequency magnitudes. This function ignores negative frequencies.
Parameters
----------
vibfreqs : array-like
Frequency magni... | r"""Calculate vibrational temperatures.
This function returns vibrational temperatures associated with all positive
frequency magnitudes. This function ignores negative frequencies.
Parameters
----------
vibfreqs : array-like
Frequency magnitudes in cm-1.
Returns
-------
array... | r"""Calculate vibrational temperatures.
This function returns vibrational temperatures associated with all positive
frequency magnitudes. This function ignores negative frequencies.
Parameters
vibfreqs : array-like
Frequency magnitudes in cm-1.
Returns
array-like
Examples
This function uses `_check_vibfreqs` an... | [
"r",
"\"",
"\"",
"\"",
"Calculate",
"vibrational",
"temperatures",
".",
"This",
"function",
"returns",
"vibrational",
"temperatures",
"associated",
"with",
"all",
"positive",
"frequency",
"magnitudes",
".",
"This",
"function",
"ignores",
"negative",
"frequencies",
"... | def _vibrational_temperature(vibfreqs=None):
nu = _check_vibfreqs(vibfreqs) * constants.c / constants.centi
vibrational_temperatures = constants.h * nu / constants.k
logger.debug(f"vibrational temperatures = {vibrational_temperatures} K")
return vibrational_temperatures | [
"def",
"_vibrational_temperature",
"(",
"vibfreqs",
"=",
"None",
")",
":",
"nu",
"=",
"_check_vibfreqs",
"(",
"vibfreqs",
")",
"*",
"constants",
".",
"c",
"/",
"constants",
".",
"centi",
"vibrational_temperatures",
"=",
"constants",
".",
"h",
"*",
"nu",
"/",... | r"""Calculate vibrational temperatures. | [
"r",
"\"",
"\"",
"\"",
"Calculate",
"vibrational",
"temperatures",
"."
] | [
"r\"\"\"Calculate vibrational temperatures.\n\n This function returns vibrational temperatures associated with all positive\n frequency magnitudes. This function ignores negative frequencies.\n\n Parameters\n ----------\n vibfreqs : array-like\n Frequency magnitudes in cm-1.\n\n Returns\n ... | [
{
"param": "vibfreqs",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "vibfreqs",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
b97ec298c8ff91d586149ee09440f12d1e25f9f0 | geem-lab/overreact | overreact/thermo/_gas.py | [
"MIT"
] | Python | _check_vibfreqs | <not_specific> | def _check_vibfreqs(vibfreqs=None, cutoff=-50.0):
"""Check vibrational frequencies and return them.
This is mostly a helper to `_vibrational_temperature` and
`_head_gordon_damping`.
Parameters
----------
vibfreqs : array-like
Frequency magnitudes in cm-1.
cutoff : float
Ima... | Check vibrational frequencies and return them.
This is mostly a helper to `_vibrational_temperature` and
`_head_gordon_damping`.
Parameters
----------
vibfreqs : array-like
Frequency magnitudes in cm-1.
cutoff : float
Imaginary frequencies smaller (in magnitude) than this value... | Check vibrational frequencies and return them.
This is mostly a helper to `_vibrational_temperature` and
`_head_gordon_damping`.
Parameters
vibfreqs : array-like
Frequency magnitudes in cm-1.
cutoff : float
Imaginary frequencies smaller (in magnitude) than this value will be
inverted (sign flipped).
Returns
array-l... | [
"Check",
"vibrational",
"frequencies",
"and",
"return",
"them",
".",
"This",
"is",
"mostly",
"a",
"helper",
"to",
"`",
"_vibrational_temperature",
"`",
"and",
"`",
"_head_gordon_damping",
"`",
".",
"Parameters",
"vibfreqs",
":",
"array",
"-",
"like",
"Frequency"... | def _check_vibfreqs(vibfreqs=None, cutoff=-50.0):
if vibfreqs is None:
return np.array([])
vibfreqs = np.atleast_1d(vibfreqs)
return np.abs(vibfreqs[vibfreqs > cutoff]) | [
"def",
"_check_vibfreqs",
"(",
"vibfreqs",
"=",
"None",
",",
"cutoff",
"=",
"-",
"50.0",
")",
":",
"if",
"vibfreqs",
"is",
"None",
":",
"return",
"np",
".",
"array",
"(",
"[",
"]",
")",
"vibfreqs",
"=",
"np",
".",
"atleast_1d",
"(",
"vibfreqs",
")",
... | Check vibrational frequencies and return them. | [
"Check",
"vibrational",
"frequencies",
"and",
"return",
"them",
"."
] | [
"\"\"\"Check vibrational frequencies and return them.\n\n This is mostly a helper to `_vibrational_temperature` and\n `_head_gordon_damping`.\n\n Parameters\n ----------\n vibfreqs : array-like\n Frequency magnitudes in cm-1.\n cutoff : float\n Imaginary frequencies smaller (in magni... | [
{
"param": "vibfreqs",
"type": null
},
{
"param": "cutoff",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "vibfreqs",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "cutoff",
"type": null,
"docstring": null,
"docstring_toke... |
ab83c9d0cb3e21c504d0104b2fb8c057e58e55da | geem-lab/overreact | overreact/_constants.py | [
"MIT"
] | Python | _vdw_radius | <not_specific> | def _vdw_radius(atomno):
"""Select reasonable estimates for the van der Waals radii.
This is a helper for `vdw_radius`.
"""
radius = _vdw_radius_crc[atomno - 1]
if radius is None:
return 2.0
return radius * centi | Select reasonable estimates for the van der Waals radii.
This is a helper for `vdw_radius`.
| Select reasonable estimates for the van der Waals radii.
This is a helper for `vdw_radius`. | [
"Select",
"reasonable",
"estimates",
"for",
"the",
"van",
"der",
"Waals",
"radii",
".",
"This",
"is",
"a",
"helper",
"for",
"`",
"vdw_radius",
"`",
"."
] | def _vdw_radius(atomno):
radius = _vdw_radius_crc[atomno - 1]
if radius is None:
return 2.0
return radius * centi | [
"def",
"_vdw_radius",
"(",
"atomno",
")",
":",
"radius",
"=",
"_vdw_radius_crc",
"[",
"atomno",
"-",
"1",
"]",
"if",
"radius",
"is",
"None",
":",
"return",
"2.0",
"return",
"radius",
"*",
"centi"
] | Select reasonable estimates for the van der Waals radii. | [
"Select",
"reasonable",
"estimates",
"for",
"the",
"van",
"der",
"Waals",
"radii",
"."
] | [
"\"\"\"Select reasonable estimates for the van der Waals radii.\n\n This is a helper for `vdw_radius`.\n \"\"\""
] | [
{
"param": "atomno",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "atomno",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
e608371b56e00fe18718a8d52bcee2f600779fab | geem-lab/overreact | overreact/thermo/__init__.py | [
"MIT"
] | Python | equilibrium_constant | <not_specific> | def equilibrium_constant(
delta_freeenergy: Union[float, np.ndarray],
delta_moles: Optional[Union[int, np.ndarray]] = None,
temperature: Union[float, np.ndarray] = 298.15,
pressure: float = constants.atm,
volume: Optional[float] = None,
):
r"""Calculate an equilibrium constant from a reaction [G... | r"""Calculate an equilibrium constant from a reaction [Gibbs free energy](https://en.wikipedia.org/wiki/Gibbs_free_energy).
This function uses the usual `relationship between reaction Gibbs energy
and equilibrium constant
<https://en.wikipedia.org/wiki/Equilibrium_constant>`_:
.. math::
K(T) =... | r"""Calculate an equilibrium constant from a reaction [Gibbs free energy].
This function uses the usual `relationship between reaction Gibbs energy
and equilibrium constant
`_.
If `delta_moles` is given, the above will be multiplied by a term | [
"r",
"\"",
"\"",
"\"",
"Calculate",
"an",
"equilibrium",
"constant",
"from",
"a",
"reaction",
"[",
"Gibbs",
"free",
"energy",
"]",
".",
"This",
"function",
"uses",
"the",
"usual",
"`",
"relationship",
"between",
"reaction",
"Gibbs",
"energy",
"and",
"equilib... | def equilibrium_constant(
delta_freeenergy: Union[float, np.ndarray],
delta_moles: Optional[Union[int, np.ndarray]] = None,
temperature: Union[float, np.ndarray] = 298.15,
pressure: float = constants.atm,
volume: Optional[float] = None,
):
temperature = np.asarray(temperature)
equilibrium_co... | [
"def",
"equilibrium_constant",
"(",
"delta_freeenergy",
":",
"Union",
"[",
"float",
",",
"np",
".",
"ndarray",
"]",
",",
"delta_moles",
":",
"Optional",
"[",
"Union",
"[",
"int",
",",
"np",
".",
"ndarray",
"]",
"]",
"=",
"None",
",",
"temperature",
":",
... | r"""Calculate an equilibrium constant from a reaction [Gibbs free energy](https://en.wikipedia.org/wiki/Gibbs_free_energy). | [
"r",
"\"",
"\"",
"\"",
"Calculate",
"an",
"equilibrium",
"constant",
"from",
"a",
"reaction",
"[",
"Gibbs",
"free",
"energy",
"]",
"(",
"https",
":",
"//",
"en",
".",
"wikipedia",
".",
"org",
"/",
"wiki",
"/",
"Gibbs_free_energy",
")",
"."
] | [
"r\"\"\"Calculate an equilibrium constant from a reaction [Gibbs free energy](https://en.wikipedia.org/wiki/Gibbs_free_energy).\n\n This function uses the usual `relationship between reaction Gibbs energy\n and equilibrium constant\n <https://en.wikipedia.org/wiki/Equilibrium_constant>`_:\n\n .. math::\... | [
{
"param": "delta_freeenergy",
"type": "Union[float, np.ndarray]"
},
{
"param": "delta_moles",
"type": "Optional[Union[int, np.ndarray]]"
},
{
"param": "temperature",
"type": "Union[float, np.ndarray]"
},
{
"param": "pressure",
"type": "float"
},
{
"param": "volum... | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "delta_freeenergy",
"type": "Union[float, np.ndarray]",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "delta_moles",
"type": "Optional[Union[i... |
0aad33c83e02ca3c9feb5218fc25db9835307563 | geem-lab/overreact | overreact/coords.py | [
"MIT"
] | Python | _find_point_group_spheric | <not_specific> | def _find_point_group_spheric(
atomcoords, groups, axes, rotor_class, proper_axes=None, rtol=0.0, atol=1.0e-2
):
"""Find point group for spheric tops.
Point groups searched for are: Td, Oh, Ih.
I might eventually search for T, Th, O in the future.
See find_point_group for information on parameters... | Find point group for spheric tops.
Point groups searched for are: Td, Oh, Ih.
I might eventually search for T, Th, O in the future.
See find_point_group for information on parameters and return values.
| Find point group for spheric tops.
Point groups searched for are: Td, Oh, Ih.
I might eventually search for T, Th, O in the future.
See find_point_group for information on parameters and return values. | [
"Find",
"point",
"group",
"for",
"spheric",
"tops",
".",
"Point",
"groups",
"searched",
"for",
"are",
":",
"Td",
"Oh",
"Ih",
".",
"I",
"might",
"eventually",
"search",
"for",
"T",
"Th",
"O",
"in",
"the",
"future",
".",
"See",
"find_point_group",
"for",
... | def _find_point_group_spheric(
atomcoords, groups, axes, rotor_class, proper_axes=None, rtol=0.0, atol=1.0e-2
):
if not _has_inversion_center(atomcoords, groups, rtol=rtol, atol=atol):
return "Td"
if proper_axes is None:
proper_axes = _get_proper_axes(
atomcoords, groups, axes, r... | [
"def",
"_find_point_group_spheric",
"(",
"atomcoords",
",",
"groups",
",",
"axes",
",",
"rotor_class",
",",
"proper_axes",
"=",
"None",
",",
"rtol",
"=",
"0.0",
",",
"atol",
"=",
"1.0e-2",
")",
":",
"if",
"not",
"_has_inversion_center",
"(",
"atomcoords",
",... | Find point group for spheric tops. | [
"Find",
"point",
"group",
"for",
"spheric",
"tops",
"."
] | [
"\"\"\"Find point group for spheric tops.\n\n Point groups searched for are: Td, Oh, Ih.\n I might eventually search for T, Th, O in the future.\n\n See find_point_group for information on parameters and return values.\n \"\"\"",
"# see https://www.chem.uci.edu/~lawm/9-28.pdf for more about high",
"... | [
{
"param": "atomcoords",
"type": null
},
{
"param": "groups",
"type": null
},
{
"param": "axes",
"type": null
},
{
"param": "rotor_class",
"type": null
},
{
"param": "proper_axes",
"type": null
},
{
"param": "rtol",
"type": null
},
{
"param... | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "atomcoords",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "groups",
"type": null,
"docstring": null,
"docstring_to... |
0aad33c83e02ca3c9feb5218fc25db9835307563 | geem-lab/overreact | overreact/coords.py | [
"MIT"
] | Python | _find_point_group_symmetric_dihedral | <not_specific> | def _find_point_group_symmetric_dihedral(
atomcoords, groups, axes, rotor_class, proper_axes=None, rtol=0.0, atol=1.0e-2
):
"""Find a dihedral point group for symmetric tops.
Point groups searched for are: Dn, Dnh, Dnd.
See find_point_group for information on parameters and return values.
"""
... | Find a dihedral point group for symmetric tops.
Point groups searched for are: Dn, Dnh, Dnd.
See find_point_group for information on parameters and return values.
| Find a dihedral point group for symmetric tops.
Point groups searched for are: Dn, Dnh, Dnd.
See find_point_group for information on parameters and return values. | [
"Find",
"a",
"dihedral",
"point",
"group",
"for",
"symmetric",
"tops",
".",
"Point",
"groups",
"searched",
"for",
"are",
":",
"Dn",
"Dnh",
"Dnd",
".",
"See",
"find_point_group",
"for",
"information",
"on",
"parameters",
"and",
"return",
"values",
"."
] | def _find_point_group_symmetric_dihedral(
atomcoords, groups, axes, rotor_class, proper_axes=None, rtol=0.0, atol=1.0e-2
):
if proper_axes is None:
proper_axes = _get_proper_axes(
atomcoords, groups, axes, rotor_class, rtol=rtol, atol=atol
)
mirror_axes = _get_mirror_planes(
... | [
"def",
"_find_point_group_symmetric_dihedral",
"(",
"atomcoords",
",",
"groups",
",",
"axes",
",",
"rotor_class",
",",
"proper_axes",
"=",
"None",
",",
"rtol",
"=",
"0.0",
",",
"atol",
"=",
"1.0e-2",
")",
":",
"if",
"proper_axes",
"is",
"None",
":",
"proper_... | Find a dihedral point group for symmetric tops. | [
"Find",
"a",
"dihedral",
"point",
"group",
"for",
"symmetric",
"tops",
"."
] | [
"\"\"\"Find a dihedral point group for symmetric tops.\n\n Point groups searched for are: Dn, Dnh, Dnd.\n\n See find_point_group for information on parameters and return values.\n \"\"\"",
"# all vertical mirror planes are dihedral for Dnd point groups"
] | [
{
"param": "atomcoords",
"type": null
},
{
"param": "groups",
"type": null
},
{
"param": "axes",
"type": null
},
{
"param": "rotor_class",
"type": null
},
{
"param": "proper_axes",
"type": null
},
{
"param": "rtol",
"type": null
},
{
"param... | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "atomcoords",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "groups",
"type": null,
"docstring": null,
"docstring_to... |
0aad33c83e02ca3c9feb5218fc25db9835307563 | geem-lab/overreact | overreact/coords.py | [
"MIT"
] | Python | _find_point_group_symmetric_nondihedral | <not_specific> | def _find_point_group_symmetric_nondihedral(
atomcoords, groups, axes, rotor_class, proper_axes=None, rtol=0.0, atol=1.0e-2
):
"""Find a nondihedral point group for symmetric tops.
Point groups searched for are: Cn, Cnh, Cnv, Sn.
See find_point_group for information on parameters and return values.
... | Find a nondihedral point group for symmetric tops.
Point groups searched for are: Cn, Cnh, Cnv, Sn.
See find_point_group for information on parameters and return values.
| Find a nondihedral point group for symmetric tops.
Point groups searched for are: Cn, Cnh, Cnv, Sn.
See find_point_group for information on parameters and return values. | [
"Find",
"a",
"nondihedral",
"point",
"group",
"for",
"symmetric",
"tops",
".",
"Point",
"groups",
"searched",
"for",
"are",
":",
"Cn",
"Cnh",
"Cnv",
"Sn",
".",
"See",
"find_point_group",
"for",
"information",
"on",
"parameters",
"and",
"return",
"values",
".... | def _find_point_group_symmetric_nondihedral(
atomcoords, groups, axes, rotor_class, proper_axes=None, rtol=0.0, atol=1.0e-2
):
if proper_axes is None:
proper_axes = _get_proper_axes(
atomcoords, groups, axes, rotor_class, rtol=rtol, atol=atol
)
mirror_axes = _get_mirror_planes(
... | [
"def",
"_find_point_group_symmetric_nondihedral",
"(",
"atomcoords",
",",
"groups",
",",
"axes",
",",
"rotor_class",
",",
"proper_axes",
"=",
"None",
",",
"rtol",
"=",
"0.0",
",",
"atol",
"=",
"1.0e-2",
")",
":",
"if",
"proper_axes",
"is",
"None",
":",
"prop... | Find a nondihedral point group for symmetric tops. | [
"Find",
"a",
"nondihedral",
"point",
"group",
"for",
"symmetric",
"tops",
"."
] | [
"\"\"\"Find a nondihedral point group for symmetric tops.\n\n Point groups searched for are: Cn, Cnh, Cnv, Sn.\n\n See find_point_group for information on parameters and return values.\n \"\"\""
] | [
{
"param": "atomcoords",
"type": null
},
{
"param": "groups",
"type": null
},
{
"param": "axes",
"type": null
},
{
"param": "rotor_class",
"type": null
},
{
"param": "proper_axes",
"type": null
},
{
"param": "rtol",
"type": null
},
{
"param... | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "atomcoords",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "groups",
"type": null,
"docstring": null,
"docstring_to... |
0aad33c83e02ca3c9feb5218fc25db9835307563 | geem-lab/overreact | overreact/coords.py | [
"MIT"
] | Python | _get_proper_axes | <not_specific> | def _get_proper_axes(
atomcoords, groups, axes, rotor_class, rtol=0.0, atol=1.0e-2, slack=0.735
):
"""Get proper symmetry axes and their orders.
Parameters
----------
atomcoords : array-like
Atomic coordinates centered at the center of mass.
groups : sequence of sequence of int
... | Get proper symmetry axes and their orders.
Parameters
----------
atomcoords : array-like
Atomic coordinates centered at the center of mass.
groups : sequence of sequence of int
Groups of symmetry equivalent atoms, in ascending order of size.
axes : array-like
Normalized prin... | Get proper symmetry axes and their orders.
Parameters
atomcoords : array-like
Atomic coordinates centered at the center of mass.
groups : sequence of sequence of int
Groups of symmetry equivalent atoms, in ascending order of size.
axes : array-like
Normalized principal axes of inertia.
rotor_class : tuple of str
Rigid... | [
"Get",
"proper",
"symmetry",
"axes",
"and",
"their",
"orders",
".",
"Parameters",
"atomcoords",
":",
"array",
"-",
"like",
"Atomic",
"coordinates",
"centered",
"at",
"the",
"center",
"of",
"mass",
".",
"groups",
":",
"sequence",
"of",
"sequence",
"of",
"int"... | def _get_proper_axes(
atomcoords, groups, axes, rotor_class, rtol=0.0, atol=1.0e-2, slack=0.735
):
rtol, atol = slack * rtol, slack * atol
if rotor_class[1] == "atomic" or len(atomcoords) == 1:
return list()
axes = np.asarray(axes)
atomcoords = np.asarray(atomcoords)
orders = _guess_orde... | [
"def",
"_get_proper_axes",
"(",
"atomcoords",
",",
"groups",
",",
"axes",
",",
"rotor_class",
",",
"rtol",
"=",
"0.0",
",",
"atol",
"=",
"1.0e-2",
",",
"slack",
"=",
"0.735",
")",
":",
"rtol",
",",
"atol",
"=",
"slack",
"*",
"rtol",
",",
"slack",
"*"... | Get proper symmetry axes and their orders. | [
"Get",
"proper",
"symmetry",
"axes",
"and",
"their",
"orders",
"."
] | [
"\"\"\"Get proper symmetry axes and their orders.\n\n Parameters\n ----------\n atomcoords : array-like\n Atomic coordinates centered at the center of mass.\n groups : sequence of sequence of int\n Groups of symmetry equivalent atoms, in ascending order of size.\n axes : array-like\n ... | [
{
"param": "atomcoords",
"type": null
},
{
"param": "groups",
"type": null
},
{
"param": "axes",
"type": null
},
{
"param": "rotor_class",
"type": null
},
{
"param": "rtol",
"type": null
},
{
"param": "atol",
"type": null
},
{
"param": "sla... | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "atomcoords",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "groups",
"type": null,
"docstring": null,
"docstring_to... |
0aad33c83e02ca3c9feb5218fc25db9835307563 | geem-lab/overreact | overreact/coords.py | [
"MIT"
] | Python | _guess_orders | <not_specific> | def _guess_orders(groups, rotor_class):
"""Guess possible group orders based on groups.
The guess consists of the numbers two to n, where n is the number of
elements in the largest group. For cubic groups, n is taken to be at most
five. The trivial order one is never guessed.
Parameters
------... | Guess possible group orders based on groups.
The guess consists of the numbers two to n, where n is the number of
elements in the largest group. For cubic groups, n is taken to be at most
five. The trivial order one is never guessed.
Parameters
----------
groups : sequence of sequence of int
... | Guess possible group orders based on groups.
The guess consists of the numbers two to n, where n is the number of
elements in the largest group. For cubic groups, n is taken to be at most
five. The trivial order one is never guessed.
Parameters
groups : sequence of sequence of int
Groups of symmetry equivalent atoms,... | [
"Guess",
"possible",
"group",
"orders",
"based",
"on",
"groups",
".",
"The",
"guess",
"consists",
"of",
"the",
"numbers",
"two",
"to",
"n",
"where",
"n",
"is",
"the",
"number",
"of",
"elements",
"in",
"the",
"largest",
"group",
".",
"For",
"cubic",
"grou... | def _guess_orders(groups, rotor_class):
max_order = len(groups[-1])
if rotor_class[0] == "spheric":
max_order = min(max_order, 5)
return range(2, max_order + 1) | [
"def",
"_guess_orders",
"(",
"groups",
",",
"rotor_class",
")",
":",
"max_order",
"=",
"len",
"(",
"groups",
"[",
"-",
"1",
"]",
")",
"if",
"rotor_class",
"[",
"0",
"]",
"==",
"\"spheric\"",
":",
"max_order",
"=",
"min",
"(",
"max_order",
",",
"5",
"... | Guess possible group orders based on groups. | [
"Guess",
"possible",
"group",
"orders",
"based",
"on",
"groups",
"."
] | [
"\"\"\"Guess possible group orders based on groups.\n\n The guess consists of the numbers two to n, where n is the number of\n elements in the largest group. For cubic groups, n is taken to be at most\n five. The trivial order one is never guessed.\n\n Parameters\n ----------\n groups : sequence o... | [
{
"param": "groups",
"type": null
},
{
"param": "rotor_class",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "groups",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "rotor_class",
"type": null,
"docstring": null,
"docstring_t... |
0aad33c83e02ca3c9feb5218fc25db9835307563 | geem-lab/overreact | overreact/coords.py | [
"MIT"
] | Python | _update_improper_axes | <not_specific> | def _update_improper_axes(
n, ax, axes, atomcoords, groups, rtol, atol, normalize=False # found axes
):
"""Update axes with ax and return it.
Helper function for _get_improper_axes.
"""
if normalize:
norm = np.linalg.norm(ax)
if np.isclose(norm, 0.0, rtol=rtol, atol=atol):
... | Update axes with ax and return it.
Helper function for _get_improper_axes.
| Update axes with ax and return it.
Helper function for _get_improper_axes. | [
"Update",
"axes",
"with",
"ax",
"and",
"return",
"it",
".",
"Helper",
"function",
"for",
"_get_improper_axes",
"."
] | def _update_improper_axes(
n, ax, axes, atomcoords, groups, rtol, atol, normalize=False
):
if normalize:
norm = np.linalg.norm(ax)
if np.isclose(norm, 0.0, rtol=rtol, atol=atol):
return axes
ax = ax / norm
for order in [2 * n, n]:
if all(
_is_symmetr... | [
"def",
"_update_improper_axes",
"(",
"n",
",",
"ax",
",",
"axes",
",",
"atomcoords",
",",
"groups",
",",
"rtol",
",",
"atol",
",",
"normalize",
"=",
"False",
")",
":",
"if",
"normalize",
":",
"norm",
"=",
"np",
".",
"linalg",
".",
"norm",
"(",
"ax",
... | Update axes with ax and return it. | [
"Update",
"axes",
"with",
"ax",
"and",
"return",
"it",
"."
] | [
"# found axes",
"\"\"\"Update axes with ax and return it.\n\n Helper function for _get_improper_axes.\n \"\"\""
] | [
{
"param": "n",
"type": null
},
{
"param": "ax",
"type": null
},
{
"param": "axes",
"type": null
},
{
"param": "atomcoords",
"type": null
},
{
"param": "groups",
"type": null
},
{
"param": "rtol",
"type": null
},
{
"param": "atol",
"typ... | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "n",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "ax",
"type": null,
"docstring": null,
"docstring_tokens": [],
... |
0aad33c83e02ca3c9feb5218fc25db9835307563 | geem-lab/overreact | overreact/coords.py | [
"MIT"
] | Python | _get_improper_axes | <not_specific> | def _get_improper_axes(
atomcoords,
groups,
axes,
rotor_class,
proper_axes=None,
rtol=0.0,
atol=1.0e-2,
slack=1.888,
):
"""Get improper symmetry axes and their orders.
Parameters
----------
atomcoords : array-like
Atomic coordinates centered at the center of mass... | Get improper symmetry axes and their orders.
Parameters
----------
atomcoords : array-like
Atomic coordinates centered at the center of mass.
groups : sequence of sequence of int
Groups of symmetry equivalent atoms, in ascending order of size.
axes : array-like
Normalized pr... | Get improper symmetry axes and their orders.
Parameters
atomcoords : array-like
Atomic coordinates centered at the center of mass.
groups : sequence of sequence of int
Groups of symmetry equivalent atoms, in ascending order of size.
axes : array-like
Normalized principal axes of inertia.
rotor_class : tuple of str
Rig... | [
"Get",
"improper",
"symmetry",
"axes",
"and",
"their",
"orders",
".",
"Parameters",
"atomcoords",
":",
"array",
"-",
"like",
"Atomic",
"coordinates",
"centered",
"at",
"the",
"center",
"of",
"mass",
".",
"groups",
":",
"sequence",
"of",
"sequence",
"of",
"in... | def _get_improper_axes(
atomcoords,
groups,
axes,
rotor_class,
proper_axes=None,
rtol=0.0,
atol=1.0e-2,
slack=1.888,
):
rtol, atol = slack * rtol, slack * atol
if rotor_class[1] == "atomic" or len(atomcoords) == 1:
return list()
axes = np.asarray(axes)
atomcoords ... | [
"def",
"_get_improper_axes",
"(",
"atomcoords",
",",
"groups",
",",
"axes",
",",
"rotor_class",
",",
"proper_axes",
"=",
"None",
",",
"rtol",
"=",
"0.0",
",",
"atol",
"=",
"1.0e-2",
",",
"slack",
"=",
"1.888",
",",
")",
":",
"rtol",
",",
"atol",
"=",
... | Get improper symmetry axes and their orders. | [
"Get",
"improper",
"symmetry",
"axes",
"and",
"their",
"orders",
"."
] | [
"\"\"\"Get improper symmetry axes and their orders.\n\n Parameters\n ----------\n atomcoords : array-like\n Atomic coordinates centered at the center of mass.\n groups : sequence of sequence of int\n Groups of symmetry equivalent atoms, in ascending order of size.\n axes : array-like\n ... | [
{
"param": "atomcoords",
"type": null
},
{
"param": "groups",
"type": null
},
{
"param": "axes",
"type": null
},
{
"param": "rotor_class",
"type": null
},
{
"param": "proper_axes",
"type": null
},
{
"param": "rtol",
"type": null
},
{
"param... | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "atomcoords",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "groups",
"type": null,
"docstring": null,
"docstring_to... |
0aad33c83e02ca3c9feb5218fc25db9835307563 | geem-lab/overreact | overreact/coords.py | [
"MIT"
] | Python | _update_mirror_axes | <not_specific> | def _update_mirror_axes(
ax,
axes, # found axes
atomcoords,
groups,
rtol,
atol,
proper_axes,
nondeg_axes=None,
normalize=False,
):
"""Update axes with ax and return it.
Helper function for _get_mirror_planes.
"""
if nondeg_axes is None:
nondeg_axes = list()
... | Update axes with ax and return it.
Helper function for _get_mirror_planes.
| Update axes with ax and return it.
Helper function for _get_mirror_planes. | [
"Update",
"axes",
"with",
"ax",
"and",
"return",
"it",
".",
"Helper",
"function",
"for",
"_get_mirror_planes",
"."
] | def _update_mirror_axes(
ax,
axes,
atomcoords,
groups,
rtol,
atol,
proper_axes,
nondeg_axes=None,
normalize=False,
):
if nondeg_axes is None:
nondeg_axes = list()
if normalize:
norm = np.linalg.norm(ax)
if np.isclose(norm, 0.0, rtol=rtol, atol=atol):... | [
"def",
"_update_mirror_axes",
"(",
"ax",
",",
"axes",
",",
"atomcoords",
",",
"groups",
",",
"rtol",
",",
"atol",
",",
"proper_axes",
",",
"nondeg_axes",
"=",
"None",
",",
"normalize",
"=",
"False",
",",
")",
":",
"if",
"nondeg_axes",
"is",
"None",
":",
... | Update axes with ax and return it. | [
"Update",
"axes",
"with",
"ax",
"and",
"return",
"it",
"."
] | [
"# found axes",
"\"\"\"Update axes with ax and return it.\n\n Helper function for _get_mirror_planes.\n \"\"\""
] | [
{
"param": "ax",
"type": null
},
{
"param": "axes",
"type": null
},
{
"param": "atomcoords",
"type": null
},
{
"param": "groups",
"type": null
},
{
"param": "rtol",
"type": null
},
{
"param": "atol",
"type": null
},
{
"param": "proper_axes"... | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "ax",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "axes",
"type": null,
"docstring": null,
"docstring_tokens": [],... |
0aad33c83e02ca3c9feb5218fc25db9835307563 | geem-lab/overreact | overreact/coords.py | [
"MIT"
] | Python | _has_inversion_center | <not_specific> | def _has_inversion_center(atomcoords, groups, rtol=0.0, atol=1.0e-2, slack=1.888):
"""Check whether the molecule has an inversion center.
Parameters
----------
atomcoords : array-like
Atomic coordinates centered at the center of mass.
groups : sequence of sequence of int
Groups of s... | Check whether the molecule has an inversion center.
Parameters
----------
atomcoords : array-like
Atomic coordinates centered at the center of mass.
groups : sequence of sequence of int
Groups of symmetry equivalent atoms, in ascending order of size.
rtol : float, optional
T... | Check whether the molecule has an inversion center.
Parameters
atomcoords : array-like
Atomic coordinates centered at the center of mass.
groups : sequence of sequence of int
Groups of symmetry equivalent atoms, in ascending order of size.
rtol : float, optional
The relative tolerance parameter .
atol : float, optiona... | [
"Check",
"whether",
"the",
"molecule",
"has",
"an",
"inversion",
"center",
".",
"Parameters",
"atomcoords",
":",
"array",
"-",
"like",
"Atomic",
"coordinates",
"centered",
"at",
"the",
"center",
"of",
"mass",
".",
"groups",
":",
"sequence",
"of",
"sequence",
... | def _has_inversion_center(atomcoords, groups, rtol=0.0, atol=1.0e-2, slack=1.888):
rtol, atol = slack * rtol, slack * atol
atomcoords = np.asarray(atomcoords)
return all(
_is_symmetric(atomcoords[group], _operation("i"), rtol=rtol, atol=atol)
for group in groups[::-1]
) | [
"def",
"_has_inversion_center",
"(",
"atomcoords",
",",
"groups",
",",
"rtol",
"=",
"0.0",
",",
"atol",
"=",
"1.0e-2",
",",
"slack",
"=",
"1.888",
")",
":",
"rtol",
",",
"atol",
"=",
"slack",
"*",
"rtol",
",",
"slack",
"*",
"atol",
"atomcoords",
"=",
... | Check whether the molecule has an inversion center. | [
"Check",
"whether",
"the",
"molecule",
"has",
"an",
"inversion",
"center",
"."
] | [
"\"\"\"Check whether the molecule has an inversion center.\n\n Parameters\n ----------\n atomcoords : array-like\n Atomic coordinates centered at the center of mass.\n groups : sequence of sequence of int\n Groups of symmetry equivalent atoms, in ascending order of size.\n rtol : float,... | [
{
"param": "atomcoords",
"type": null
},
{
"param": "groups",
"type": null
},
{
"param": "rtol",
"type": null
},
{
"param": "atol",
"type": null
},
{
"param": "slack",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "atomcoords",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "groups",
"type": null,
"docstring": null,
"docstring_to... |
e40a146bbefd5aeb54ab727fe678d0e18001ba77 | agold/svgchart | lib/shapes/Text.py | [
"Apache-2.0"
] | Python | fitToWidth | null | def fitToWidth(self, width=0.0):
"""Fits shape to given width maintaining scale.
@param width: The width to fit to
"""
if width <= 0:
raise ValueError("width must be greater than 0")
scalingFactor = 1.0 - ((self.width - float(width)) / self.width)
self.fontsize *= scalingFactor | Fits shape to given width maintaining scale.
@param width: The width to fit to
| Fits shape to given width maintaining scale. | [
"Fits",
"shape",
"to",
"given",
"width",
"maintaining",
"scale",
"."
] | def fitToWidth(self, width=0.0):
if width <= 0:
raise ValueError("width must be greater than 0")
scalingFactor = 1.0 - ((self.width - float(width)) / self.width)
self.fontsize *= scalingFactor | [
"def",
"fitToWidth",
"(",
"self",
",",
"width",
"=",
"0.0",
")",
":",
"if",
"width",
"<=",
"0",
":",
"raise",
"ValueError",
"(",
"\"width must be greater than 0\"",
")",
"scalingFactor",
"=",
"1.0",
"-",
"(",
"(",
"self",
".",
"width",
"-",
"float",
"(",... | Fits shape to given width maintaining scale. | [
"Fits",
"shape",
"to",
"given",
"width",
"maintaining",
"scale",
"."
] | [
"\"\"\"Fits shape to given width maintaining scale.\n\n\t\t@param width: The width to fit to\n\t\t\"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "width",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "width",
"type": null,
"docstring": "The width to fit to",
"do... |
e40a146bbefd5aeb54ab727fe678d0e18001ba77 | agold/svgchart | lib/shapes/Text.py | [
"Apache-2.0"
] | Python | fitToHeight | null | def fitToHeight(self, height=0.0):
"""Fits shape to given height maintaining scale.
@param height: The height to fit to
"""
if height <= 0:
raise ValueError("height must be greater than 0")
scalingFactor = 1.0 - ((self.height - float(height)) / self.height)
self.fontsize *= scalingFactor | Fits shape to given height maintaining scale.
@param height: The height to fit to
| Fits shape to given height maintaining scale. | [
"Fits",
"shape",
"to",
"given",
"height",
"maintaining",
"scale",
"."
] | def fitToHeight(self, height=0.0):
if height <= 0:
raise ValueError("height must be greater than 0")
scalingFactor = 1.0 - ((self.height - float(height)) / self.height)
self.fontsize *= scalingFactor | [
"def",
"fitToHeight",
"(",
"self",
",",
"height",
"=",
"0.0",
")",
":",
"if",
"height",
"<=",
"0",
":",
"raise",
"ValueError",
"(",
"\"height must be greater than 0\"",
")",
"scalingFactor",
"=",
"1.0",
"-",
"(",
"(",
"self",
".",
"height",
"-",
"float",
... | Fits shape to given height maintaining scale. | [
"Fits",
"shape",
"to",
"given",
"height",
"maintaining",
"scale",
"."
] | [
"\"\"\"Fits shape to given height maintaining scale.\n\n\t\t@param height: The height to fit to\n\t\t\"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "height",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "height",
"type": null,
"docstring": "The height to fit to",
"... |
e40a146bbefd5aeb54ab727fe678d0e18001ba77 | agold/svgchart | lib/shapes/Text.py | [
"Apache-2.0"
] | Python | translateTo | null | def translateTo(self, coord=Coordinate()):
"""Translates the text to the given coordinate.
@param coord: The new coordinate to translate to
@type coord: Coordinate
"""
oldx, oldy = self.position
self.translate(x=coord.x - oldx, y=coord.y - oldy) | Translates the text to the given coordinate.
@param coord: The new coordinate to translate to
@type coord: Coordinate
| Translates the text to the given coordinate. | [
"Translates",
"the",
"text",
"to",
"the",
"given",
"coordinate",
"."
] | def translateTo(self, coord=Coordinate()):
oldx, oldy = self.position
self.translate(x=coord.x - oldx, y=coord.y - oldy) | [
"def",
"translateTo",
"(",
"self",
",",
"coord",
"=",
"Coordinate",
"(",
")",
")",
":",
"oldx",
",",
"oldy",
"=",
"self",
".",
"position",
"self",
".",
"translate",
"(",
"x",
"=",
"coord",
".",
"x",
"-",
"oldx",
",",
"y",
"=",
"coord",
".",
"y",
... | Translates the text to the given coordinate. | [
"Translates",
"the",
"text",
"to",
"the",
"given",
"coordinate",
"."
] | [
"\"\"\"Translates the text to the given coordinate.\n\n\t\t@param coord: The new coordinate to translate to\n\t\t@type coord: Coordinate\n\t\t\"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "coord",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "coord",
"type": null,
"docstring": "The new coordinate to translate... |
e40a146bbefd5aeb54ab727fe678d0e18001ba77 | agold/svgchart | lib/shapes/Text.py | [
"Apache-2.0"
] | Python | translate | null | def translate(self, x=0.0, y=0.0):
"""Translates the text by the given amounts.
@param x: The amount to translate in the x-direction
@param y: The amount to translate in the y-direction
"""
oldx, oldy = self.position
self.position = Coordinate(oldx + x, oldy + y) | Translates the text by the given amounts.
@param x: The amount to translate in the x-direction
@param y: The amount to translate in the y-direction
| Translates the text by the given amounts. | [
"Translates",
"the",
"text",
"by",
"the",
"given",
"amounts",
"."
] | def translate(self, x=0.0, y=0.0):
oldx, oldy = self.position
self.position = Coordinate(oldx + x, oldy + y) | [
"def",
"translate",
"(",
"self",
",",
"x",
"=",
"0.0",
",",
"y",
"=",
"0.0",
")",
":",
"oldx",
",",
"oldy",
"=",
"self",
".",
"position",
"self",
".",
"position",
"=",
"Coordinate",
"(",
"oldx",
"+",
"x",
",",
"oldy",
"+",
"y",
")"
] | Translates the text by the given amounts. | [
"Translates",
"the",
"text",
"by",
"the",
"given",
"amounts",
"."
] | [
"\"\"\"Translates the text by the given amounts.\n\n\t\t@param x: The amount to translate in the x-direction\n\t\t@param y: The amount to translate in the y-direction\n\t\t\"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "x",
"type": null
},
{
"param": "y",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "x",
"type": null,
"docstring": "The amount to translate in the x-di... |
e40a146bbefd5aeb54ab727fe678d0e18001ba77 | agold/svgchart | lib/shapes/Text.py | [
"Apache-2.0"
] | Python | svg | <not_specific> | def svg(self):
"""Returns the SVG representation as an XML fragment."""
self.attrs['x'] = self.position.x
self.attrs['y'] = self.position.y
return Shape.svg(self) | Returns the SVG representation as an XML fragment. | Returns the SVG representation as an XML fragment. | [
"Returns",
"the",
"SVG",
"representation",
"as",
"an",
"XML",
"fragment",
"."
] | def svg(self):
self.attrs['x'] = self.position.x
self.attrs['y'] = self.position.y
return Shape.svg(self) | [
"def",
"svg",
"(",
"self",
")",
":",
"self",
".",
"attrs",
"[",
"'x'",
"]",
"=",
"self",
".",
"position",
".",
"x",
"self",
".",
"attrs",
"[",
"'y'",
"]",
"=",
"self",
".",
"position",
".",
"y",
"return",
"Shape",
".",
"svg",
"(",
"self",
")"
] | Returns the SVG representation as an XML fragment. | [
"Returns",
"the",
"SVG",
"representation",
"as",
"an",
"XML",
"fragment",
"."
] | [
"\"\"\"Returns the SVG representation as an XML fragment.\"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
7ffec567158316779081f7692e4851a0eca43b21 | agold/svgchart | chartserver.py | [
"Apache-2.0"
] | Python | addXml | null | def addXml(root,path,value):
"""Adds an XML node or attribute to a tree of Elements.
@param root: The root of the tree of Elements
@param path: The path to the node or attribute. /elem/elem, /elem@attr, /elem@style$sty, etc.
@param value: The value to be stored at path. May be inner text, attribute value, or style ... | Adds an XML node or attribute to a tree of Elements.
@param root: The root of the tree of Elements
@param path: The path to the node or attribute. /elem/elem, /elem@attr, /elem@style$sty, etc.
@param value: The value to be stored at path. May be inner text, attribute value, or style value depending on path.
| Adds an XML node or attribute to a tree of Elements. | [
"Adds",
"an",
"XML",
"node",
"or",
"attribute",
"to",
"a",
"tree",
"of",
"Elements",
"."
] | def addXml(root,path,value):
if (value != ""):
elem = root
while path.startswith('/'):
parts = re.split('([/@$])',path[1:],1)
if (len(parts) > 2):
path = parts[1] + parts[2]
else:
path = ""
for child in list(elem):
if (child.tag == parts[0]):
break
if (len(elem) > 0 and child.tag ==... | [
"def",
"addXml",
"(",
"root",
",",
"path",
",",
"value",
")",
":",
"if",
"(",
"value",
"!=",
"\"\"",
")",
":",
"elem",
"=",
"root",
"while",
"path",
".",
"startswith",
"(",
"'/'",
")",
":",
"parts",
"=",
"re",
".",
"split",
"(",
"'([/@$])'",
",",... | Adds an XML node or attribute to a tree of Elements. | [
"Adds",
"an",
"XML",
"node",
"or",
"attribute",
"to",
"a",
"tree",
"of",
"Elements",
"."
] | [
"\"\"\"Adds an XML node or attribute to a tree of Elements.\n\t@param root: The root of the tree of Elements\n\t@param path: The path to the node or attribute. /elem/elem, /elem@attr, /elem@style$sty, etc.\n\t@param value: The value to be stored at path. May be inner text, attribute value, or style value depending ... | [
{
"param": "root",
"type": null
},
{
"param": "path",
"type": null
},
{
"param": "value",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "root",
"type": null,
"docstring": "The root of the tree of Elements",
"docstring_tokens": [
"The",
"root",
"of",
"the",
"tree",
"of",
"Elements"
],
"default":... |
7ffec567158316779081f7692e4851a0eca43b21 | agold/svgchart | chartserver.py | [
"Apache-2.0"
] | Python | csvLineToXmlValue | <not_specific> | def csvLineToXmlValue(line):
"""Converts a CSV line to an XML data point.
@param line: CSV line containing x and y coordinates
"""
line = line.strip()
coords = line.split(',')
if (len(coords) >= 2):
coords[0] = coords[0].strip("\" \t\r\n")
coords[1] = coords[1].strip("\" \t\r\n")
return "<value x='" + coord... | Converts a CSV line to an XML data point.
@param line: CSV line containing x and y coordinates
| Converts a CSV line to an XML data point. | [
"Converts",
"a",
"CSV",
"line",
"to",
"an",
"XML",
"data",
"point",
"."
] | def csvLineToXmlValue(line):
line = line.strip()
coords = line.split(',')
if (len(coords) >= 2):
coords[0] = coords[0].strip("\" \t\r\n")
coords[1] = coords[1].strip("\" \t\r\n")
return "<value x='" + coords[0] + "' y='" + coords[1] + "' />"
else:
return "" | [
"def",
"csvLineToXmlValue",
"(",
"line",
")",
":",
"line",
"=",
"line",
".",
"strip",
"(",
")",
"coords",
"=",
"line",
".",
"split",
"(",
"','",
")",
"if",
"(",
"len",
"(",
"coords",
")",
">=",
"2",
")",
":",
"coords",
"[",
"0",
"]",
"=",
"coor... | Converts a CSV line to an XML data point. | [
"Converts",
"a",
"CSV",
"line",
"to",
"an",
"XML",
"data",
"point",
"."
] | [
"\"\"\"Converts a CSV line to an XML data point.\n\t@param line: CSV line containing x and y coordinates\n\t\"\"\""
] | [
{
"param": "line",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "line",
"type": null,
"docstring": "CSV line containing x and y coordinates",
"docstring_tokens": [
"CSV",
"line",
"containing",
"x",
"and",
"y",
"coordinates"
],
... |
7ffec567158316779081f7692e4851a0eca43b21 | agold/svgchart | chartserver.py | [
"Apache-2.0"
] | Python | csvToXmlData | null | def csvToXmlData(infiles,outfile):
"""Converts one or more CSV input files to a single XML data file.
@param infiles: List of CSV input files
@param outfile: File to write XML output to. Should be empty.
"""
outfile.write("<?xml version='1.0' encoding='UTF-8' ?>")
outfile.write("<data>")
i = 1
for infile in inf... | Converts one or more CSV input files to a single XML data file.
@param infiles: List of CSV input files
@param outfile: File to write XML output to. Should be empty.
| Converts one or more CSV input files to a single XML data file. | [
"Converts",
"one",
"or",
"more",
"CSV",
"input",
"files",
"to",
"a",
"single",
"XML",
"data",
"file",
"."
] | def csvToXmlData(infiles,outfile):
outfile.write("<?xml version='1.0' encoding='UTF-8' ?>")
outfile.write("<data>")
i = 1
for infile in infiles:
outfile.write("<set id='set" + str(i) + "'>")
i += 1
for line in infile:
outfile.write(csvLineToXmlValue(line))
outfile.write("</set>")
outfile.write("</data>"... | [
"def",
"csvToXmlData",
"(",
"infiles",
",",
"outfile",
")",
":",
"outfile",
".",
"write",
"(",
"\"<?xml version='1.0' encoding='UTF-8' ?>\"",
")",
"outfile",
".",
"write",
"(",
"\"<data>\"",
")",
"i",
"=",
"1",
"for",
"infile",
"in",
"infiles",
":",
"outfile",... | Converts one or more CSV input files to a single XML data file. | [
"Converts",
"one",
"or",
"more",
"CSV",
"input",
"files",
"to",
"a",
"single",
"XML",
"data",
"file",
"."
] | [
"\"\"\"Converts one or more CSV input files to a single XML data file.\n\t@param infiles: List of CSV input files\n\t@param outfile: File to write XML output to. Should be empty.\n\t\"\"\""
] | [
{
"param": "infiles",
"type": null
},
{
"param": "outfile",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "infiles",
"type": null,
"docstring": "List of CSV input files",
"docstring_tokens": [
"List",
"of",
"CSV",
"input",
"files"
],
"default": null,
"is_optional": false
... |
7ffec567158316779081f7692e4851a0eca43b21 | agold/svgchart | chartserver.py | [
"Apache-2.0"
] | Python | combineXmlData | null | def combineXmlData(infiles,outfile):
"""Converts XML data input files into a single XML data file.
@param infiles: List of XML data input files
@param outfile: File to write XML output to. Should be empty.
"""
outfile.write("<?xml version='1.0' encoding='UTF-8' ?>")
outfile.write("<data>")
for infile in infiles:... | Converts XML data input files into a single XML data file.
@param infiles: List of XML data input files
@param outfile: File to write XML output to. Should be empty.
| Converts XML data input files into a single XML data file. | [
"Converts",
"XML",
"data",
"input",
"files",
"into",
"a",
"single",
"XML",
"data",
"file",
"."
] | def combineXmlData(infiles,outfile):
outfile.write("<?xml version='1.0' encoding='UTF-8' ?>")
outfile.write("<data>")
for infile in infiles:
text = infile.read()
match = re.search(r'<data(?: [^>]+)? *>(.*)<\/data>',text,re.DOTALL)
if (match):
outfile.write(match.group(1))
outfile.write("</data>") | [
"def",
"combineXmlData",
"(",
"infiles",
",",
"outfile",
")",
":",
"outfile",
".",
"write",
"(",
"\"<?xml version='1.0' encoding='UTF-8' ?>\"",
")",
"outfile",
".",
"write",
"(",
"\"<data>\"",
")",
"for",
"infile",
"in",
"infiles",
":",
"text",
"=",
"infile",
... | Converts XML data input files into a single XML data file. | [
"Converts",
"XML",
"data",
"input",
"files",
"into",
"a",
"single",
"XML",
"data",
"file",
"."
] | [
"\"\"\"Converts XML data input files into a single XML data file.\n\t@param infiles: List of XML data input files\n\t@param outfile: File to write XML output to. Should be empty.\n\t\"\"\""
] | [
{
"param": "infiles",
"type": null
},
{
"param": "outfile",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "infiles",
"type": null,
"docstring": "List of XML data input files",
"docstring_tokens": [
"List",
"of",
"XML",
"data",
"input",
"files"
],
"default": null,
"is... |
7ffec567158316779081f7692e4851a0eca43b21 | agold/svgchart | chartserver.py | [
"Apache-2.0"
] | Python | builtinScripts | null | def builtinScripts(scriptnames,outfile):
"""Generates XML script file for specified built-in scripts.
@param scriptnames: List of names of built-in scripts to include.
@param outfile: File to write XML output to. Should be empty.
"""
outfile.write("<?xml version='1.0' encoding='UTF-8' ?>")
outfile.write("<scripts... | Generates XML script file for specified built-in scripts.
@param scriptnames: List of names of built-in scripts to include.
@param outfile: File to write XML output to. Should be empty.
| Generates XML script file for specified built-in scripts. | [
"Generates",
"XML",
"script",
"file",
"for",
"specified",
"built",
"-",
"in",
"scripts",
"."
] | def builtinScripts(scriptnames,outfile):
outfile.write("<?xml version='1.0' encoding='UTF-8' ?>")
outfile.write("<scripts>")
i = 1
for scriptname in scriptnames:
outfile.write("<script id='script" + str(i) + "' file='scripts/" + scriptname + ".js' />")
outfile.write("</scripts>") | [
"def",
"builtinScripts",
"(",
"scriptnames",
",",
"outfile",
")",
":",
"outfile",
".",
"write",
"(",
"\"<?xml version='1.0' encoding='UTF-8' ?>\"",
")",
"outfile",
".",
"write",
"(",
"\"<scripts>\"",
")",
"i",
"=",
"1",
"for",
"scriptname",
"in",
"scriptnames",
... | Generates XML script file for specified built-in scripts. | [
"Generates",
"XML",
"script",
"file",
"for",
"specified",
"built",
"-",
"in",
"scripts",
"."
] | [
"\"\"\"Generates XML script file for specified built-in scripts.\n\t@param scriptnames: List of names of built-in scripts to include.\n\t@param outfile: File to write XML output to. Should be empty.\n\t\"\"\""
] | [
{
"param": "scriptnames",
"type": null
},
{
"param": "outfile",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "scriptnames",
"type": null,
"docstring": "List of names of built-in scripts to include.",
"docstring_tokens": [
"List",
"of",
"names",
"of",
"built",
"-",
"in",
"... |
7ffec567158316779081f7692e4851a0eca43b21 | agold/svgchart | chartserver.py | [
"Apache-2.0"
] | Python | do_POST | null | def do_POST(self):
"""Handles a POST request, which is assumed to be from the GUI."""
form = cgi.FieldStorage(fp=self.rfile,headers=self.headers,
environ={'REQUEST_METHOD':'POST','CONTENT_TYPE':self.headers['Content-Type']})
outfiles = dict()
for key in ['outfile_settings','outfile_data','outfile_scrip... | Handles a POST request, which is assumed to be from the GUI. | Handles a POST request, which is assumed to be from the GUI. | [
"Handles",
"a",
"POST",
"request",
"which",
"is",
"assumed",
"to",
"be",
"from",
"the",
"GUI",
"."
] | def do_POST(self):
form = cgi.FieldStorage(fp=self.rfile,headers=self.headers,
environ={'REQUEST_METHOD':'POST','CONTENT_TYPE':self.headers['Content-Type']})
outfiles = dict()
for key in ['outfile_settings','outfile_data','outfile_scripts']:
outfiles[key[8:]] = "genxml/" + form.getfirst(key)
sroot = ... | [
"def",
"do_POST",
"(",
"self",
")",
":",
"form",
"=",
"cgi",
".",
"FieldStorage",
"(",
"fp",
"=",
"self",
".",
"rfile",
",",
"headers",
"=",
"self",
".",
"headers",
",",
"environ",
"=",
"{",
"'REQUEST_METHOD'",
":",
"'POST'",
",",
"'CONTENT_TYPE'",
":"... | Handles a POST request, which is assumed to be from the GUI. | [
"Handles",
"a",
"POST",
"request",
"which",
"is",
"assumed",
"to",
"be",
"from",
"the",
"GUI",
"."
] | [
"\"\"\"Handles a POST request, which is assumed to be from the GUI.\"\"\"",
"# Settings",
"# Data",
"# Scripts"
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
2f0121e5906c056847fcd36196b93ce22e659dce | agold/svgchart | lib/shapes/Ellipse.py | [
"Apache-2.0"
] | Python | fitToWidth | null | def fitToWidth(self, width=0.0):
"""Fits shape to given width maintaining scale.
@param width: The width to fit to
"""
if width <= 0:
raise ValueError("width must be greater than 0")
# Maintain scale. Divide by 2 since it's a radius
scalingFactor = 1.0 - ((self.rx - float(width)) / self.rx)
self.rx ... | Fits shape to given width maintaining scale.
@param width: The width to fit to
| Fits shape to given width maintaining scale. | [
"Fits",
"shape",
"to",
"given",
"width",
"maintaining",
"scale",
"."
] | def fitToWidth(self, width=0.0):
if width <= 0:
raise ValueError("width must be greater than 0")
scalingFactor = 1.0 - ((self.rx - float(width)) / self.rx)
self.rx = width / 2.0
self.ry = (self.ry * scalingFactor) / 2.0 | [
"def",
"fitToWidth",
"(",
"self",
",",
"width",
"=",
"0.0",
")",
":",
"if",
"width",
"<=",
"0",
":",
"raise",
"ValueError",
"(",
"\"width must be greater than 0\"",
")",
"scalingFactor",
"=",
"1.0",
"-",
"(",
"(",
"self",
".",
"rx",
"-",
"float",
"(",
... | Fits shape to given width maintaining scale. | [
"Fits",
"shape",
"to",
"given",
"width",
"maintaining",
"scale",
"."
] | [
"\"\"\"Fits shape to given width maintaining scale.\n\n\t\t@param width: The width to fit to\n\t\t\"\"\"",
"# Maintain scale. Divide by 2 since it's a radius"
] | [
{
"param": "self",
"type": null
},
{
"param": "width",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "width",
"type": null,
"docstring": "The width to fit to",
"do... |
2f0121e5906c056847fcd36196b93ce22e659dce | agold/svgchart | lib/shapes/Ellipse.py | [
"Apache-2.0"
] | Python | fitToHeight | null | def fitToHeight(self, height=0.0):
"""Fits shape to given height maintaining scale.
@param height: The height to fit to
"""
if height <= 0:
raise ValueError("height must be greater than 0")
# Maintain scale. Divide by 2 since it's a radius
scalingFactor = 1.0 - ((self.ry - float(height)) / self.ry)
... | Fits shape to given height maintaining scale.
@param height: The height to fit to
| Fits shape to given height maintaining scale. | [
"Fits",
"shape",
"to",
"given",
"height",
"maintaining",
"scale",
"."
] | def fitToHeight(self, height=0.0):
if height <= 0:
raise ValueError("height must be greater than 0")
scalingFactor = 1.0 - ((self.ry - float(height)) / self.ry)
self.rx = (self.rx * scalingFactor) / 2.0
self.ry = height / 2.0 | [
"def",
"fitToHeight",
"(",
"self",
",",
"height",
"=",
"0.0",
")",
":",
"if",
"height",
"<=",
"0",
":",
"raise",
"ValueError",
"(",
"\"height must be greater than 0\"",
")",
"scalingFactor",
"=",
"1.0",
"-",
"(",
"(",
"self",
".",
"ry",
"-",
"float",
"("... | Fits shape to given height maintaining scale. | [
"Fits",
"shape",
"to",
"given",
"height",
"maintaining",
"scale",
"."
] | [
"\"\"\"Fits shape to given height maintaining scale.\n\n\t\t@param height: The height to fit to\n\t\t\"\"\"",
"# Maintain scale. Divide by 2 since it's a radius"
] | [
{
"param": "self",
"type": null
},
{
"param": "height",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "height",
"type": null,
"docstring": "The height to fit to",
"... |
2f0121e5906c056847fcd36196b93ce22e659dce | agold/svgchart | lib/shapes/Ellipse.py | [
"Apache-2.0"
] | Python | translateTo | null | def translateTo(self, coord=Coordinate()):
"""Translates the ellipse to the given coordinate.
@param coord: The new coordinate to translate to
@type coord: Coordinate
"""
oldx, oldy = self.center
self.translate(x=coord.x - oldx + self.rx, y=coord.y - oldy + self.ry) | Translates the ellipse to the given coordinate.
@param coord: The new coordinate to translate to
@type coord: Coordinate
| Translates the ellipse to the given coordinate. | [
"Translates",
"the",
"ellipse",
"to",
"the",
"given",
"coordinate",
"."
] | def translateTo(self, coord=Coordinate()):
oldx, oldy = self.center
self.translate(x=coord.x - oldx + self.rx, y=coord.y - oldy + self.ry) | [
"def",
"translateTo",
"(",
"self",
",",
"coord",
"=",
"Coordinate",
"(",
")",
")",
":",
"oldx",
",",
"oldy",
"=",
"self",
".",
"center",
"self",
".",
"translate",
"(",
"x",
"=",
"coord",
".",
"x",
"-",
"oldx",
"+",
"self",
".",
"rx",
",",
"y",
... | Translates the ellipse to the given coordinate. | [
"Translates",
"the",
"ellipse",
"to",
"the",
"given",
"coordinate",
"."
] | [
"\"\"\"Translates the ellipse to the given coordinate.\n\n\t\t@param coord: The new coordinate to translate to\n\t\t@type coord: Coordinate\n\t\t\"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "coord",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "coord",
"type": null,
"docstring": "The new coordinate to translate... |
2f0121e5906c056847fcd36196b93ce22e659dce | agold/svgchart | lib/shapes/Ellipse.py | [
"Apache-2.0"
] | Python | translate | null | def translate(self, x=0.0, y=0.0):
"""Translates the ellipse by the given amounts.
@param x: The amount to translate in the x-direction
@param y: The amount to translate in the y-direction
"""
oldx, oldy = self.center
self.center = Coordinate(oldx + x, oldy + y) | Translates the ellipse by the given amounts.
@param x: The amount to translate in the x-direction
@param y: The amount to translate in the y-direction
| Translates the ellipse by the given amounts. | [
"Translates",
"the",
"ellipse",
"by",
"the",
"given",
"amounts",
"."
] | def translate(self, x=0.0, y=0.0):
oldx, oldy = self.center
self.center = Coordinate(oldx + x, oldy + y) | [
"def",
"translate",
"(",
"self",
",",
"x",
"=",
"0.0",
",",
"y",
"=",
"0.0",
")",
":",
"oldx",
",",
"oldy",
"=",
"self",
".",
"center",
"self",
".",
"center",
"=",
"Coordinate",
"(",
"oldx",
"+",
"x",
",",
"oldy",
"+",
"y",
")"
] | Translates the ellipse by the given amounts. | [
"Translates",
"the",
"ellipse",
"by",
"the",
"given",
"amounts",
"."
] | [
"\"\"\"Translates the ellipse by the given amounts.\n\n\t\t@param x: The amount to translate in the x-direction\n\t\t@param y: The amount to translate in the y-direction\n\t\t\"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "x",
"type": null
},
{
"param": "y",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "x",
"type": null,
"docstring": "The amount to translate in the x-di... |
2f0121e5906c056847fcd36196b93ce22e659dce | agold/svgchart | lib/shapes/Ellipse.py | [
"Apache-2.0"
] | Python | svg | <not_specific> | def svg(self):
"""Returns the SVG representation as an XML fragment."""
self.attrs['cx'] = self.center.x
self.attrs['cy'] = self.center.y
self.attrs['rx'] = self.rx
self.attrs['ry'] = self.ry
return Shape.svg(self) | Returns the SVG representation as an XML fragment. | Returns the SVG representation as an XML fragment. | [
"Returns",
"the",
"SVG",
"representation",
"as",
"an",
"XML",
"fragment",
"."
] | def svg(self):
self.attrs['cx'] = self.center.x
self.attrs['cy'] = self.center.y
self.attrs['rx'] = self.rx
self.attrs['ry'] = self.ry
return Shape.svg(self) | [
"def",
"svg",
"(",
"self",
")",
":",
"self",
".",
"attrs",
"[",
"'cx'",
"]",
"=",
"self",
".",
"center",
".",
"x",
"self",
".",
"attrs",
"[",
"'cy'",
"]",
"=",
"self",
".",
"center",
".",
"y",
"self",
".",
"attrs",
"[",
"'rx'",
"]",
"=",
"sel... | Returns the SVG representation as an XML fragment. | [
"Returns",
"the",
"SVG",
"representation",
"as",
"an",
"XML",
"fragment",
"."
] | [
"\"\"\"Returns the SVG representation as an XML fragment.\"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
6b16df15b30b501dc453810e89ca1ea28f053c10 | agold/svgchart | lib/generators/Generator.py | [
"Apache-2.0"
] | Python | CSSString | <not_specific> | def CSSString(self):
"""Collects all of the style strings."""
cssstrings = []
for key in self.styles:
styles = self.styles[key]
stylestrings = []
for stylekey in styles:
stylestrings.append(': '.join([stylekey, styles[stylekey]]))
stylestring = '; '.join(stylestrings)
cssstrings.append('{key} ... | Collects all of the style strings. | Collects all of the style strings. | [
"Collects",
"all",
"of",
"the",
"style",
"strings",
"."
] | def CSSString(self):
cssstrings = []
for key in self.styles:
styles = self.styles[key]
stylestrings = []
for stylekey in styles:
stylestrings.append(': '.join([stylekey, styles[stylekey]]))
stylestring = '; '.join(stylestrings)
cssstrings.append('{key} {{ {style}; }}'.format(key=key, style=styles... | [
"def",
"CSSString",
"(",
"self",
")",
":",
"cssstrings",
"=",
"[",
"]",
"for",
"key",
"in",
"self",
".",
"styles",
":",
"styles",
"=",
"self",
".",
"styles",
"[",
"key",
"]",
"stylestrings",
"=",
"[",
"]",
"for",
"stylekey",
"in",
"styles",
":",
"s... | Collects all of the style strings. | [
"Collects",
"all",
"of",
"the",
"style",
"strings",
"."
] | [
"\"\"\"Collects all of the style strings.\"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
6b16df15b30b501dc453810e89ca1ea28f053c10 | agold/svgchart | lib/generators/Generator.py | [
"Apache-2.0"
] | Python | addStyleToClass | null | def addStyleToClass(self, classname=u'', style=u''):
"""Applies a style to a given class name.
@param classname: The classname to apply to
@param style: The style string
"""
classes = []
for oneclass in classname.split():
valid = re.match(r'^-?[_a-zA-Z]+[_a-zA-Z0-9-]*$', oneclass)
if valid:
clas... | Applies a style to a given class name.
@param classname: The classname to apply to
@param style: The style string
| Applies a style to a given class name. | [
"Applies",
"a",
"style",
"to",
"a",
"given",
"class",
"name",
"."
] | def addStyleToClass(self, classname=u'', style=u''):
classes = []
for oneclass in classname.split():
valid = re.match(r'^-?[_a-zA-Z]+[_a-zA-Z0-9-]*$', oneclass)
if valid:
classes.append('.' + oneclass)
self.styles[', '.join(classes)] = self.parseStyle(style) | [
"def",
"addStyleToClass",
"(",
"self",
",",
"classname",
"=",
"u''",
",",
"style",
"=",
"u''",
")",
":",
"classes",
"=",
"[",
"]",
"for",
"oneclass",
"in",
"classname",
".",
"split",
"(",
")",
":",
"valid",
"=",
"re",
".",
"match",
"(",
"r'^-?[_a-zA-... | Applies a style to a given class name. | [
"Applies",
"a",
"style",
"to",
"a",
"given",
"class",
"name",
"."
] | [
"\"\"\"Applies a style to a given class name.\n\n\t\t@param classname: The classname to apply to\n\t\t@param style: The style string\n\t\t\"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "classname",
"type": null
},
{
"param": "style",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "classname",
"type": null,
"docstring": "The classname to apply to",... |
6b16df15b30b501dc453810e89ca1ea28f053c10 | agold/svgchart | lib/generators/Generator.py | [
"Apache-2.0"
] | Python | addStyleToId | null | def addStyleToId(self, id=u'', style=u''):
"""Applies a style to a given ID tag.
@param id: The ID to apply to
@param style: The style string
"""
valid = re.match(r'^[a-zA-Z][-a-zA-Z0-9_:\.]*$', id)
if valid:
self.styles['#' + id] = self.parseStyle(style) | Applies a style to a given ID tag.
@param id: The ID to apply to
@param style: The style string
| Applies a style to a given ID tag. | [
"Applies",
"a",
"style",
"to",
"a",
"given",
"ID",
"tag",
"."
] | def addStyleToId(self, id=u'', style=u''):
valid = re.match(r'^[a-zA-Z][-a-zA-Z0-9_:\.]*$', id)
if valid:
self.styles['#' + id] = self.parseStyle(style) | [
"def",
"addStyleToId",
"(",
"self",
",",
"id",
"=",
"u''",
",",
"style",
"=",
"u''",
")",
":",
"valid",
"=",
"re",
".",
"match",
"(",
"r'^[a-zA-Z][-a-zA-Z0-9_:\\.]*$'",
",",
"id",
")",
"if",
"valid",
":",
"self",
".",
"styles",
"[",
"'#'",
"+",
"id",... | Applies a style to a given ID tag. | [
"Applies",
"a",
"style",
"to",
"a",
"given",
"ID",
"tag",
"."
] | [
"\"\"\"Applies a style to a given ID tag.\n\n\t\t@param id: The ID to apply to\n\t\t@param style: The style string\n\t\t\"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "id",
"type": null
},
{
"param": "style",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "id",
"type": null,
"docstring": "The ID to apply to",
"docstr... |
6b16df15b30b501dc453810e89ca1ea28f053c10 | agold/svgchart | lib/generators/Generator.py | [
"Apache-2.0"
] | Python | addStyleToTag | null | def addStyleToTag(self, tag, style):
"""Applies a style to a given tag name.
@param tag: The tag name to apply to
@param style: The style string
"""
valid = re.match(r'^[a-zA-Z_:][-a-zA-Z0-9_:\.]*$', tag)
if valid:
self.styles[tag] = self.parseStyle(style) | Applies a style to a given tag name.
@param tag: The tag name to apply to
@param style: The style string
| Applies a style to a given tag name. | [
"Applies",
"a",
"style",
"to",
"a",
"given",
"tag",
"name",
"."
] | def addStyleToTag(self, tag, style):
valid = re.match(r'^[a-zA-Z_:][-a-zA-Z0-9_:\.]*$', tag)
if valid:
self.styles[tag] = self.parseStyle(style) | [
"def",
"addStyleToTag",
"(",
"self",
",",
"tag",
",",
"style",
")",
":",
"valid",
"=",
"re",
".",
"match",
"(",
"r'^[a-zA-Z_:][-a-zA-Z0-9_:\\.]*$'",
",",
"tag",
")",
"if",
"valid",
":",
"self",
".",
"styles",
"[",
"tag",
"]",
"=",
"self",
".",
"parseSt... | Applies a style to a given tag name. | [
"Applies",
"a",
"style",
"to",
"a",
"given",
"tag",
"name",
"."
] | [
"\"\"\"Applies a style to a given tag name.\n\n\t\t@param tag: The tag name to apply to\n\t\t@param style: The style string\n\t\t\"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "tag",
"type": null
},
{
"param": "style",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "tag",
"type": null,
"docstring": "The tag name to apply to",
... |
6b16df15b30b501dc453810e89ca1ea28f053c10 | agold/svgchart | lib/generators/Generator.py | [
"Apache-2.0"
] | Python | parseStyle | <not_specific> | def parseStyle(self, style=''):
"""Parses a style string into its constituent key:value pairs.
@param style: The style string to parse
"""
styles = style.split(';')
styledict = {}
for pair in styles:
if len(pair) > 0:
key, value = pair.split(':')
styledict[key.strip()] = value.strip()
return... | Parses a style string into its constituent key:value pairs.
@param style: The style string to parse
| Parses a style string into its constituent key:value pairs. | [
"Parses",
"a",
"style",
"string",
"into",
"its",
"constituent",
"key",
":",
"value",
"pairs",
"."
] | def parseStyle(self, style=''):
styles = style.split(';')
styledict = {}
for pair in styles:
if len(pair) > 0:
key, value = pair.split(':')
styledict[key.strip()] = value.strip()
return styledict | [
"def",
"parseStyle",
"(",
"self",
",",
"style",
"=",
"''",
")",
":",
"styles",
"=",
"style",
".",
"split",
"(",
"';'",
")",
"styledict",
"=",
"{",
"}",
"for",
"pair",
"in",
"styles",
":",
"if",
"len",
"(",
"pair",
")",
">",
"0",
":",
"key",
","... | Parses a style string into its constituent key:value pairs. | [
"Parses",
"a",
"style",
"string",
"into",
"its",
"constituent",
"key",
":",
"value",
"pairs",
"."
] | [
"\"\"\"Parses a style string into its constituent key:value pairs.\n\n\t\t@param style: The style string to parse\n\t\t\"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "style",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "style",
"type": null,
"docstring": "The style string to parse",
... |
6b16df15b30b501dc453810e89ca1ea28f053c10 | agold/svgchart | lib/generators/Generator.py | [
"Apache-2.0"
] | Python | valueToCoord | <not_specific> | def valueToCoord(self, x, y):
"""Returns a Coordinate from the given x and y values.
@param x: The x value
@param y: The y value
"""
return Coordinate(self.getXAxis().valueToCoord(x),
self.getYAxis().valueToCoord(y)) | Returns a Coordinate from the given x and y values.
@param x: The x value
@param y: The y value
| Returns a Coordinate from the given x and y values. | [
"Returns",
"a",
"Coordinate",
"from",
"the",
"given",
"x",
"and",
"y",
"values",
"."
] | def valueToCoord(self, x, y):
return Coordinate(self.getXAxis().valueToCoord(x),
self.getYAxis().valueToCoord(y)) | [
"def",
"valueToCoord",
"(",
"self",
",",
"x",
",",
"y",
")",
":",
"return",
"Coordinate",
"(",
"self",
".",
"getXAxis",
"(",
")",
".",
"valueToCoord",
"(",
"x",
")",
",",
"self",
".",
"getYAxis",
"(",
")",
".",
"valueToCoord",
"(",
"y",
")",
")"
] | Returns a Coordinate from the given x and y values. | [
"Returns",
"a",
"Coordinate",
"from",
"the",
"given",
"x",
"and",
"y",
"values",
"."
] | [
"\"\"\"Returns a Coordinate from the given x and y values.\n\n\t\t@param x: The x value\n\t\t@param y: The y value\n\t\t\"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "x",
"type": null
},
{
"param": "y",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "x",
"type": null,
"docstring": "The x value",
"docstring_toke... |
a4efd7778108f6828fc4801f52401bee846e02bf | agold/svgchart | lib/shapes/Line.py | [
"Apache-2.0"
] | Python | svg | <not_specific> | def svg(self):
"""Returns the SVG representation as an XML fragment."""
self.attrs['x1'] = self.start.x
self.attrs['y1'] = self.start.y
self.attrs['x2'] = self.end.x
self.attrs['y2'] = self.end.y
return Shape.svg(self) | Returns the SVG representation as an XML fragment. | Returns the SVG representation as an XML fragment. | [
"Returns",
"the",
"SVG",
"representation",
"as",
"an",
"XML",
"fragment",
"."
] | def svg(self):
self.attrs['x1'] = self.start.x
self.attrs['y1'] = self.start.y
self.attrs['x2'] = self.end.x
self.attrs['y2'] = self.end.y
return Shape.svg(self) | [
"def",
"svg",
"(",
"self",
")",
":",
"self",
".",
"attrs",
"[",
"'x1'",
"]",
"=",
"self",
".",
"start",
".",
"x",
"self",
".",
"attrs",
"[",
"'y1'",
"]",
"=",
"self",
".",
"start",
".",
"y",
"self",
".",
"attrs",
"[",
"'x2'",
"]",
"=",
"self"... | Returns the SVG representation as an XML fragment. | [
"Returns",
"the",
"SVG",
"representation",
"as",
"an",
"XML",
"fragment",
"."
] | [
"\"\"\"Returns the SVG representation as an XML fragment.\"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
c35b0819c66c7cecd1e0bbbdb9db459e6d445c69 | agold/svgchart | lib/elements/Axis.py | [
"Apache-2.0"
] | Python | valueToCoord | <not_specific> | def valueToCoord(self, value):
"""Returns the coordinate from a value along the axis.
@param value: A value along the axis
"""
return self.start + (self.end - self.start) * (value - self.min) / (self.max - self.min) | Returns the coordinate from a value along the axis.
@param value: A value along the axis
| Returns the coordinate from a value along the axis. | [
"Returns",
"the",
"coordinate",
"from",
"a",
"value",
"along",
"the",
"axis",
"."
] | def valueToCoord(self, value):
return self.start + (self.end - self.start) * (value - self.min) / (self.max - self.min) | [
"def",
"valueToCoord",
"(",
"self",
",",
"value",
")",
":",
"return",
"self",
".",
"start",
"+",
"(",
"self",
".",
"end",
"-",
"self",
".",
"start",
")",
"*",
"(",
"value",
"-",
"self",
".",
"min",
")",
"/",
"(",
"self",
".",
"max",
"-",
"self"... | Returns the coordinate from a value along the axis. | [
"Returns",
"the",
"coordinate",
"from",
"a",
"value",
"along",
"the",
"axis",
"."
] | [
"\"\"\"Returns the coordinate from a value along the axis.\n\n\t\t@param value: A value along the axis\n\t\t\"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "value",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "value",
"type": null,
"docstring": "A value along the axis",
... |
c35b0819c66c7cecd1e0bbbdb9db459e6d445c69 | agold/svgchart | lib/elements/Axis.py | [
"Apache-2.0"
] | Python | tickValues | <not_specific> | def tickValues(self):
"""Returns a sorted list of the values at all tick marks."""
values = self.majorValues() + self.minorValues()
values.sort()
return values | Returns a sorted list of the values at all tick marks. | Returns a sorted list of the values at all tick marks. | [
"Returns",
"a",
"sorted",
"list",
"of",
"the",
"values",
"at",
"all",
"tick",
"marks",
"."
] | def tickValues(self):
values = self.majorValues() + self.minorValues()
values.sort()
return values | [
"def",
"tickValues",
"(",
"self",
")",
":",
"values",
"=",
"self",
".",
"majorValues",
"(",
")",
"+",
"self",
".",
"minorValues",
"(",
")",
"values",
".",
"sort",
"(",
")",
"return",
"values"
] | Returns a sorted list of the values at all tick marks. | [
"Returns",
"a",
"sorted",
"list",
"of",
"the",
"values",
"at",
"all",
"tick",
"marks",
"."
] | [
"\"\"\"Returns a sorted list of the values at all tick marks.\"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
c35b0819c66c7cecd1e0bbbdb9db459e6d445c69 | agold/svgchart | lib/elements/Axis.py | [
"Apache-2.0"
] | Python | ticks | <not_specific> | def ticks(self):
"""Returns a list of dictionaries of the tick values and coordinates.
The dictionaries are in the format {'value': value, 'coord', coordinate}
"""
ticklist = []
majors = self.majorValues()
for value, coord in zip(self.minorValues(), self.minorTicks()):
if value not in majors:
tic... | Returns a list of dictionaries of the tick values and coordinates.
The dictionaries are in the format {'value': value, 'coord', coordinate}
| Returns a list of dictionaries of the tick values and coordinates.
The dictionaries are in the format {'value': value, 'coord', coordinate} | [
"Returns",
"a",
"list",
"of",
"dictionaries",
"of",
"the",
"tick",
"values",
"and",
"coordinates",
".",
"The",
"dictionaries",
"are",
"in",
"the",
"format",
"{",
"'",
"value",
"'",
":",
"value",
"'",
"coord",
"'",
"coordinate",
"}"
] | def ticks(self):
ticklist = []
majors = self.majorValues()
for value, coord in zip(self.minorValues(), self.minorTicks()):
if value not in majors:
ticklist.append({'value': value, 'coord': coord, 'type': 'minor'})
for value, coord in zip(majors, self.majorTicks()):
ticklist.append({'value': value, 'co... | [
"def",
"ticks",
"(",
"self",
")",
":",
"ticklist",
"=",
"[",
"]",
"majors",
"=",
"self",
".",
"majorValues",
"(",
")",
"for",
"value",
",",
"coord",
"in",
"zip",
"(",
"self",
".",
"minorValues",
"(",
")",
",",
"self",
".",
"minorTicks",
"(",
")",
... | Returns a list of dictionaries of the tick values and coordinates. | [
"Returns",
"a",
"list",
"of",
"dictionaries",
"of",
"the",
"tick",
"values",
"and",
"coordinates",
"."
] | [
"\"\"\"Returns a list of dictionaries of the tick values and coordinates.\n\n\t\tThe dictionaries are in the format {'value': value, 'coord', coordinate}\n\t\t\"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
8c3b70264a9f35c2532cbd0ffdc2fa4ecb16e603 | agold/svgchart | lib/shapes/Square.py | [
"Apache-2.0"
] | Python | size | <not_specific> | def size(self):
"""Returns the size of the square."""
# It's a square. Width and height are the same
return self.width | Returns the size of the square. | Returns the size of the square. | [
"Returns",
"the",
"size",
"of",
"the",
"square",
"."
] | def size(self):
return self.width | [
"def",
"size",
"(",
"self",
")",
":",
"return",
"self",
".",
"width"
] | Returns the size of the square. | [
"Returns",
"the",
"size",
"of",
"the",
"square",
"."
] | [
"\"\"\"Returns the size of the square.\"\"\"",
"# It's a square. Width and height 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": []
} |
dfd82fba42bf5946d700f57ec69a4da899dd37cd | agold/svgchart | lib/shapes/Shape.py | [
"Apache-2.0"
] | Python | fit | null | def fit(self, width=0.0, height=0.0):
"""Fits shape to given width and height maintaining scale.
@param width: the width to fit to
@param height: the height to fit to
"""
if width <= 0 and height <= 0:
raise ValueError("width or height must be greater than 0")
if height < width and height > 0 or width... | Fits shape to given width and height maintaining scale.
@param width: the width to fit to
@param height: the height to fit to
| Fits shape to given width and height maintaining scale. | [
"Fits",
"shape",
"to",
"given",
"width",
"and",
"height",
"maintaining",
"scale",
"."
] | def fit(self, width=0.0, height=0.0):
if width <= 0 and height <= 0:
raise ValueError("width or height must be greater than 0")
if height < width and height > 0 or width <= 0:
self.fitToHeight(height)
else:
self.fitToWidth(width) | [
"def",
"fit",
"(",
"self",
",",
"width",
"=",
"0.0",
",",
"height",
"=",
"0.0",
")",
":",
"if",
"width",
"<=",
"0",
"and",
"height",
"<=",
"0",
":",
"raise",
"ValueError",
"(",
"\"width or height must be greater than 0\"",
")",
"if",
"height",
"<",
"widt... | Fits shape to given width and height maintaining scale. | [
"Fits",
"shape",
"to",
"given",
"width",
"and",
"height",
"maintaining",
"scale",
"."
] | [
"\"\"\"Fits shape to given width and height maintaining scale.\n\n\t\t@param width: the width to fit to\n\t\t@param height: the height to fit to\n\t\t\"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "width",
"type": null
},
{
"param": "height",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "width",
"type": null,
"docstring": "the width to fit to",
"do... |
dfd82fba42bf5946d700f57ec69a4da899dd37cd | agold/svgchart | lib/shapes/Shape.py | [
"Apache-2.0"
] | Python | svg | <not_specific> | def svg(self):
"""Returns the SVG representation as an XML fragment."""
if isinstance(self.classes, basestring):
classes = (self.classes,)
else:
classes = self.classes
svgattrs = {}
if self.id is not None:
svgattrs["id"] = self.id
if classes is not None:
svgattrs["class"] = u' '.join(classes)
... | Returns the SVG representation as an XML fragment. | Returns the SVG representation as an XML fragment. | [
"Returns",
"the",
"SVG",
"representation",
"as",
"an",
"XML",
"fragment",
"."
] | def svg(self):
if isinstance(self.classes, basestring):
classes = (self.classes,)
else:
classes = self.classes
svgattrs = {}
if self.id is not None:
svgattrs["id"] = self.id
if classes is not None:
svgattrs["class"] = u' '.join(classes)
for key in self.attrs.keys():
try:
svgattrs[key] = u... | [
"def",
"svg",
"(",
"self",
")",
":",
"if",
"isinstance",
"(",
"self",
".",
"classes",
",",
"basestring",
")",
":",
"classes",
"=",
"(",
"self",
".",
"classes",
",",
")",
"else",
":",
"classes",
"=",
"self",
".",
"classes",
"svgattrs",
"=",
"{",
"}"... | Returns the SVG representation as an XML fragment. | [
"Returns",
"the",
"SVG",
"representation",
"as",
"an",
"XML",
"fragment",
"."
] | [
"\"\"\"Returns the SVG representation as an XML fragment.\"\"\"",
"# Attemt to format as float with given precision",
"# Now try the __str__",
"# CDATA has to be added as a comment due to a",
"# particularly dirty hack required by the output layer"
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
7b98a163c6820e2888a6553d17606a865da467e6 | agold/svgchart | lib/elements/YAxis.py | [
"Apache-2.0"
] | Python | valueToCoord | <not_specific> | def valueToCoord(self, value):
"""Returns the coordinate from a value along the axis.
@param value: A value along the axis
"""
return self.end + (self.start - self.end) * (value - self.min) / (self.max - self.min) | Returns the coordinate from a value along the axis.
@param value: A value along the axis
| Returns the coordinate from a value along the axis. | [
"Returns",
"the",
"coordinate",
"from",
"a",
"value",
"along",
"the",
"axis",
"."
] | def valueToCoord(self, value):
return self.end + (self.start - self.end) * (value - self.min) / (self.max - self.min) | [
"def",
"valueToCoord",
"(",
"self",
",",
"value",
")",
":",
"return",
"self",
".",
"end",
"+",
"(",
"self",
".",
"start",
"-",
"self",
".",
"end",
")",
"*",
"(",
"value",
"-",
"self",
".",
"min",
")",
"/",
"(",
"self",
".",
"max",
"-",
"self",
... | Returns the coordinate from a value along the axis. | [
"Returns",
"the",
"coordinate",
"from",
"a",
"value",
"along",
"the",
"axis",
"."
] | [
"\"\"\"Returns the coordinate from a value along the axis.\n\n\t\t@param value: A value along the axis\n\t\t\"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "value",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "value",
"type": null,
"docstring": "A value along the axis",
... |
cbbca2c53c87ae663a65bb65aa24ac4cb3495f88 | agold/svgchart | lib/shapes/Circle.py | [
"Apache-2.0"
] | Python | svg | <not_specific> | def svg(self):
"""Returns the SVG representation as an XML fragment."""
self.attrs['cx'] = self.center.x
self.attrs['cy'] = self.center.y
self.attrs['r'] = self.radius
return Shape.svg(self) | Returns the SVG representation as an XML fragment. | Returns the SVG representation as an XML fragment. | [
"Returns",
"the",
"SVG",
"representation",
"as",
"an",
"XML",
"fragment",
"."
] | def svg(self):
self.attrs['cx'] = self.center.x
self.attrs['cy'] = self.center.y
self.attrs['r'] = self.radius
return Shape.svg(self) | [
"def",
"svg",
"(",
"self",
")",
":",
"self",
".",
"attrs",
"[",
"'cx'",
"]",
"=",
"self",
".",
"center",
".",
"x",
"self",
".",
"attrs",
"[",
"'cy'",
"]",
"=",
"self",
".",
"center",
".",
"y",
"self",
".",
"attrs",
"[",
"'r'",
"]",
"=",
"self... | Returns the SVG representation as an XML fragment. | [
"Returns",
"the",
"SVG",
"representation",
"as",
"an",
"XML",
"fragment",
"."
] | [
"\"\"\"Returns the SVG representation as an XML fragment.\"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
2343bc9adfccdac1fbd6c6318a7e4711c79224fc | agold/svgchart | lib/gui/form.py | [
"Apache-2.0"
] | Python | header | null | def header(f):
"""Writes the opening section of the GUI.
@param f: File to write to
"""
f.write("""
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>SVGChart GUI</title>
""")
style(f)
tabScript(f)
f.write("""
</head>
<body on... | Writes the opening section of the GUI.
@param f: File to write to
| Writes the opening section of the GUI. | [
"Writes",
"the",
"opening",
"section",
"of",
"the",
"GUI",
"."
] | def header(f):
f.write("""
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>SVGChart GUI</title>
""")
style(f)
tabScript(f)
f.write("""
</head>
<body onload='init_tabs()'>
""") | [
"def",
"header",
"(",
"f",
")",
":",
"f",
".",
"write",
"(",
"\"\"\"\n\t<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\">\n\t\t<html>\n\t\t<head>\n\t\t\t<title>SVGChart GUI</title>\n\t\"\"\"",
")",
"style",
"(",
"f",
")",
"tabS... | Writes the opening section of the GUI. | [
"Writes",
"the",
"opening",
"section",
"of",
"the",
"GUI",
"."
] | [
"\"\"\"Writes the opening section of the GUI.\n\t@param f: File to write to\n\t\"\"\""
] | [
{
"param": "f",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "f",
"type": null,
"docstring": "File to write to",
"docstring_tokens": [
"File",
"to",
"write",
"to"
],
"default": null,
"is_optional": false
}
],
"outlier_params": [],... |
2343bc9adfccdac1fbd6c6318a7e4711c79224fc | agold/svgchart | lib/gui/form.py | [
"Apache-2.0"
] | Python | style | null | def style(f):
"""Writes the CSS style section of the GUI.
@param f: File to write to
"""
f.write("<style type='text/css'>")
with open('lib/gui/style.css','r') as stylesheet:
f.write(stylesheet.read())
f.write("</style>") | Writes the CSS style section of the GUI.
@param f: File to write to
| Writes the CSS style section of the GUI. | [
"Writes",
"the",
"CSS",
"style",
"section",
"of",
"the",
"GUI",
"."
] | def style(f):
f.write("<style type='text/css'>")
with open('lib/gui/style.css','r') as stylesheet:
f.write(stylesheet.read())
f.write("</style>") | [
"def",
"style",
"(",
"f",
")",
":",
"f",
".",
"write",
"(",
"\"<style type='text/css'>\"",
")",
"with",
"open",
"(",
"'lib/gui/style.css'",
",",
"'r'",
")",
"as",
"stylesheet",
":",
"f",
".",
"write",
"(",
"stylesheet",
".",
"read",
"(",
")",
")",
"f",... | Writes the CSS style section of the GUI. | [
"Writes",
"the",
"CSS",
"style",
"section",
"of",
"the",
"GUI",
"."
] | [
"\"\"\"Writes the CSS style section of the GUI.\n\t@param f: File to write to\n\t\"\"\""
] | [
{
"param": "f",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "f",
"type": null,
"docstring": "File to write to",
"docstring_tokens": [
"File",
"to",
"write",
"to"
],
"default": null,
"is_optional": false
}
],
"outlier_params": [],... |
2343bc9adfccdac1fbd6c6318a7e4711c79224fc | agold/svgchart | lib/gui/form.py | [
"Apache-2.0"
] | Python | tabScript | null | def tabScript(f):
"""Writes the tabbing script for the GUI.
@param f: File to write to
"""
openScript(f)
f.write("""
if (!Array.indexOf) {
Array.prototype.indexOf = function (obj) {
for (var i = 0;i < this.length;i++)
if (this[i] == obj)
return i;
return -1;
}
}
var colors = new Arra... | Writes the tabbing script for the GUI.
@param f: File to write to
| Writes the tabbing script for the GUI. | [
"Writes",
"the",
"tabbing",
"script",
"for",
"the",
"GUI",
"."
] | def tabScript(f):
openScript(f)
f.write("""
if (!Array.indexOf) {
Array.prototype.indexOf = function (obj) {
for (var i = 0;i < this.length;i++)
if (this[i] == obj)
return i;
return -1;
}
}
var colors = new Array()
var tabs = new Array()
var pages = new Array()
function init_tabs(... | [
"def",
"tabScript",
"(",
"f",
")",
":",
"openScript",
"(",
"f",
")",
"f",
".",
"write",
"(",
"\"\"\"\n\t\tif (!Array.indexOf) {\n\t\t\tArray.prototype.indexOf = function (obj) {\n\t\t\t\tfor (var i = 0;i < this.length;i++)\n\t\t\t\t\tif (this[i] == obj)\n\t\t\t\t\t\treturn i;\n\t\t\t\tre... | Writes the tabbing script for the GUI. | [
"Writes",
"the",
"tabbing",
"script",
"for",
"the",
"GUI",
"."
] | [
"\"\"\"Writes the tabbing script for the GUI.\n\t@param f: File to write to\n\t\"\"\""
] | [
{
"param": "f",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "f",
"type": null,
"docstring": "File to write to",
"docstring_tokens": [
"File",
"to",
"write",
"to"
],
"default": null,
"is_optional": false
}
],
"outlier_params": [],... |
2343bc9adfccdac1fbd6c6318a7e4711c79224fc | agold/svgchart | lib/gui/form.py | [
"Apache-2.0"
] | Python | initColors | null | def initColors(f,colors):
"""Writes a script section to initialize the tab colors for the GUI.
@param f: File to write to
@param colors: List of color names
"""
openScript(f)
for color in colors:
f.write("colors.push('" + color + "')\n")
closeScript(f) | Writes a script section to initialize the tab colors for the GUI.
@param f: File to write to
@param colors: List of color names
| Writes a script section to initialize the tab colors for the GUI. | [
"Writes",
"a",
"script",
"section",
"to",
"initialize",
"the",
"tab",
"colors",
"for",
"the",
"GUI",
"."
] | def initColors(f,colors):
openScript(f)
for color in colors:
f.write("colors.push('" + color + "')\n")
closeScript(f) | [
"def",
"initColors",
"(",
"f",
",",
"colors",
")",
":",
"openScript",
"(",
"f",
")",
"for",
"color",
"in",
"colors",
":",
"f",
".",
"write",
"(",
"\"colors.push('\"",
"+",
"color",
"+",
"\"')\\n\"",
")",
"closeScript",
"(",
"f",
")"
] | Writes a script section to initialize the tab colors for the GUI. | [
"Writes",
"a",
"script",
"section",
"to",
"initialize",
"the",
"tab",
"colors",
"for",
"the",
"GUI",
"."
] | [
"\"\"\"Writes a script section to initialize the tab colors for the GUI.\n\t@param f: File to write to\n\t@param colors: List of color names\n\t\"\"\""
] | [
{
"param": "f",
"type": null
},
{
"param": "colors",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "f",
"type": null,
"docstring": "File to write to",
"docstring_tokens": [
"File",
"to",
"write",
"to"
],
"default": null,
"is_optional": false
},
{
"identifier": "... |
2343bc9adfccdac1fbd6c6318a7e4711c79224fc | agold/svgchart | lib/gui/form.py | [
"Apache-2.0"
] | Python | initTabs | null | def initTabs(f,labels):
"""Initializes the tabs for the GUI.
@param f: File to write to
@param labels: List of tab labels
"""
for label in labels:
f.write("<span id='" + label + "tab' onclick='select_tab(this)'>" + label.capitalize() + "</span>")
openScript(f)
f.write("tabs.push(document.getElementById('" + ... | Initializes the tabs for the GUI.
@param f: File to write to
@param labels: List of tab labels
| Initializes the tabs for the GUI. | [
"Initializes",
"the",
"tabs",
"for",
"the",
"GUI",
"."
] | def initTabs(f,labels):
for label in labels:
f.write("<span id='" + label + "tab' onclick='select_tab(this)'>" + label.capitalize() + "</span>")
openScript(f)
f.write("tabs.push(document.getElementById('" + label + "tab'))")
closeScript(f) | [
"def",
"initTabs",
"(",
"f",
",",
"labels",
")",
":",
"for",
"label",
"in",
"labels",
":",
"f",
".",
"write",
"(",
"\"<span id='\"",
"+",
"label",
"+",
"\"tab' onclick='select_tab(this)'>\"",
"+",
"label",
".",
"capitalize",
"(",
")",
"+",
"\"</span>\"",
"... | Initializes the tabs for the GUI. | [
"Initializes",
"the",
"tabs",
"for",
"the",
"GUI",
"."
] | [
"\"\"\"Initializes the tabs for the GUI.\n\t@param f: File to write to\n\t@param labels: List of tab labels\n\t\"\"\""
] | [
{
"param": "f",
"type": null
},
{
"param": "labels",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "f",
"type": null,
"docstring": "File to write to",
"docstring_tokens": [
"File",
"to",
"write",
"to"
],
"default": null,
"is_optional": false
},
{
"identifier": "... |
2343bc9adfccdac1fbd6c6318a7e4711c79224fc | agold/svgchart | lib/gui/form.py | [
"Apache-2.0"
] | Python | openForm | null | def openForm(f):
"""Initializes the form for the GUI.
@param f: File to write to
"""
f.write("<form enctype='multipart/form-data' action='.' method='post' style='display:inline;'>") | Initializes the form for the GUI.
@param f: File to write to
| Initializes the form for the GUI. | [
"Initializes",
"the",
"form",
"for",
"the",
"GUI",
"."
] | def openForm(f):
f.write("<form enctype='multipart/form-data' action='.' method='post' style='display:inline;'>") | [
"def",
"openForm",
"(",
"f",
")",
":",
"f",
".",
"write",
"(",
"\"<form enctype='multipart/form-data' action='.' method='post' style='display:inline;'>\"",
")"
] | Initializes the form for the GUI. | [
"Initializes",
"the",
"form",
"for",
"the",
"GUI",
"."
] | [
"\"\"\"Initializes the form for the GUI.\n\t@param f: File to write to\n\t\"\"\""
] | [
{
"param": "f",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "f",
"type": null,
"docstring": "File to write to",
"docstring_tokens": [
"File",
"to",
"write",
"to"
],
"default": null,
"is_optional": false
}
],
"outlier_params": [],... |
2343bc9adfccdac1fbd6c6318a7e4711c79224fc | agold/svgchart | lib/gui/form.py | [
"Apache-2.0"
] | Python | dataPage | null | def dataPage(f):
"""Writes the data page for the GUI.
@param f: File to write to
"""
openPage(f,'data')
f.write("""
File Format:<br />
<input type="radio" name="data_file_type" value="csv" checked="checked" /> CSV<br />
<input type="radio" name="data_file_type" value="xml" /> XML<br />
<br />
File:
<in... | Writes the data page for the GUI.
@param f: File to write to
| Writes the data page for the GUI. | [
"Writes",
"the",
"data",
"page",
"for",
"the",
"GUI",
"."
] | def dataPage(f):
openPage(f,'data')
f.write("""
File Format:<br />
<input type="radio" name="data_file_type" value="csv" checked="checked" /> CSV<br />
<input type="radio" name="data_file_type" value="xml" /> XML<br />
<br />
File:
<input type="file" name="data_files" multiple="multiple" /><br />
<br />... | [
"def",
"dataPage",
"(",
"f",
")",
":",
"openPage",
"(",
"f",
",",
"'data'",
")",
"f",
".",
"write",
"(",
"\"\"\"\n\t\tFile Format:<br />\n\t\t<input type=\"radio\" name=\"data_file_type\" value=\"csv\" checked=\"checked\" /> CSV<br />\n\t\t<input type=\"radio\" name=\"data_file_type\... | Writes the data page for the GUI. | [
"Writes",
"the",
"data",
"page",
"for",
"the",
"GUI",
"."
] | [
"\"\"\"Writes the data page for the GUI.\n\t@param f: File to write to\n\t\"\"\""
] | [
{
"param": "f",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "f",
"type": null,
"docstring": "File to write to",
"docstring_tokens": [
"File",
"to",
"write",
"to"
],
"default": null,
"is_optional": false
}
],
"outlier_params": [],... |
2343bc9adfccdac1fbd6c6318a7e4711c79224fc | agold/svgchart | lib/gui/form.py | [
"Apache-2.0"
] | Python | scriptsPage | null | def scriptsPage(f):
"""Writes the scripts page for the GUI.
@param f: File to write to
"""
openPage(f,'scripts')
f.write("""
Select built-in scripts:<br />
<input type='checkbox' name='script_tooltips' /> Tooltips<br />
<input type='checkbox' name='script_panandzoom' /> Pan and Zoom<br />
""")
closePage(f,... | Writes the scripts page for the GUI.
@param f: File to write to
| Writes the scripts page for the GUI. | [
"Writes",
"the",
"scripts",
"page",
"for",
"the",
"GUI",
"."
] | def scriptsPage(f):
openPage(f,'scripts')
f.write("""
Select built-in scripts:<br />
<input type='checkbox' name='script_tooltips' /> Tooltips<br />
<input type='checkbox' name='script_panandzoom' /> Pan and Zoom<br />
""")
closePage(f,'scripts') | [
"def",
"scriptsPage",
"(",
"f",
")",
":",
"openPage",
"(",
"f",
",",
"'scripts'",
")",
"f",
".",
"write",
"(",
"\"\"\"\n\t\tSelect built-in scripts:<br />\n\t\t<input type='checkbox' name='script_tooltips' /> Tooltips<br />\n\t\t<input type='checkbox' name='script_panandzoom' /> Pan ... | Writes the scripts page for the GUI. | [
"Writes",
"the",
"scripts",
"page",
"for",
"the",
"GUI",
"."
] | [
"\"\"\"Writes the scripts page for the GUI.\n\t@param f: File to write to\n\t\"\"\""
] | [
{
"param": "f",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "f",
"type": null,
"docstring": "File to write to",
"docstring_tokens": [
"File",
"to",
"write",
"to"
],
"default": null,
"is_optional": false
}
],
"outlier_params": [],... |
2343bc9adfccdac1fbd6c6318a7e4711c79224fc | agold/svgchart | lib/gui/form.py | [
"Apache-2.0"
] | Python | submissionPage | null | def submissionPage(f):
"""Writes the submission page for the GUI.
@param f: File to write to
"""
openPage(f,'submission')
f.write("""
Please specify output file names for the settings, data and scripts used to generate the chart.
These will remain in the svgchart/genxml/ directory after chart generation so that ... | Writes the submission page for the GUI.
@param f: File to write to
| Writes the submission page for the GUI. | [
"Writes",
"the",
"submission",
"page",
"for",
"the",
"GUI",
"."
] | def submissionPage(f):
openPage(f,'submission')
f.write("""
Please specify output file names for the settings, data and scripts used to generate the chart.
These will remain in the svgchart/genxml/ directory after chart generation so that you may use
them in the future to generate this chart or modify them to prod... | [
"def",
"submissionPage",
"(",
"f",
")",
":",
"openPage",
"(",
"f",
",",
"'submission'",
")",
"f",
".",
"write",
"(",
"\"\"\"\n\tPlease specify output file names for the settings, data and scripts used to generate the chart.\n\tThese will remain in the svgchart/genxml/ directory after... | Writes the submission page for the GUI. | [
"Writes",
"the",
"submission",
"page",
"for",
"the",
"GUI",
"."
] | [
"\"\"\"Writes the submission page for the GUI.\n\t@param f: File to write to\n\t\"\"\""
] | [
{
"param": "f",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "f",
"type": null,
"docstring": "File to write to",
"docstring_tokens": [
"File",
"to",
"write",
"to"
],
"default": null,
"is_optional": false
}
],
"outlier_params": [],... |
2343bc9adfccdac1fbd6c6318a7e4711c79224fc | agold/svgchart | lib/gui/form.py | [
"Apache-2.0"
] | Python | openPage | null | def openPage(f,label):
"""Initializes a tabbed page section.
@param f: File to write to
@param label: Label for the page
"""
f.write("<div id='" + label + "page'>") | Initializes a tabbed page section.
@param f: File to write to
@param label: Label for the page
| Initializes a tabbed page section. | [
"Initializes",
"a",
"tabbed",
"page",
"section",
"."
] | def openPage(f,label):
f.write("<div id='" + label + "page'>") | [
"def",
"openPage",
"(",
"f",
",",
"label",
")",
":",
"f",
".",
"write",
"(",
"\"<div id='\"",
"+",
"label",
"+",
"\"page'>\"",
")"
] | Initializes a tabbed page section. | [
"Initializes",
"a",
"tabbed",
"page",
"section",
"."
] | [
"\"\"\"Initializes a tabbed page section.\n\t@param f: File to write to\n\t@param label: Label for the page\n\t\"\"\""
] | [
{
"param": "f",
"type": null
},
{
"param": "label",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "f",
"type": null,
"docstring": "File to write to",
"docstring_tokens": [
"File",
"to",
"write",
"to"
],
"default": null,
"is_optional": false
},
{
"identifier": "... |
2343bc9adfccdac1fbd6c6318a7e4711c79224fc | agold/svgchart | lib/gui/form.py | [
"Apache-2.0"
] | Python | closePage | null | def closePage(f,label):
"""Closes a tabbed page section.
@param f: File to write to
@param label: Label for the page
"""
f.write("</div>")
openScript(f)
f.write("pages.push(document.getElementById('" + label + "page'))")
closeScript(f) | Closes a tabbed page section.
@param f: File to write to
@param label: Label for the page
| Closes a tabbed page section. | [
"Closes",
"a",
"tabbed",
"page",
"section",
"."
] | def closePage(f,label):
f.write("</div>")
openScript(f)
f.write("pages.push(document.getElementById('" + label + "page'))")
closeScript(f) | [
"def",
"closePage",
"(",
"f",
",",
"label",
")",
":",
"f",
".",
"write",
"(",
"\"</div>\"",
")",
"openScript",
"(",
"f",
")",
"f",
".",
"write",
"(",
"\"pages.push(document.getElementById('\"",
"+",
"label",
"+",
"\"page'))\"",
")",
"closeScript",
"(",
"f"... | Closes a tabbed page section. | [
"Closes",
"a",
"tabbed",
"page",
"section",
"."
] | [
"\"\"\"Closes a tabbed page section.\n\t@param f: File to write to\n\t@param label: Label for the page\n\t\"\"\""
] | [
{
"param": "f",
"type": null
},
{
"param": "label",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "f",
"type": null,
"docstring": "File to write to",
"docstring_tokens": [
"File",
"to",
"write",
"to"
],
"default": null,
"is_optional": false
},
{
"identifier": "... |
2343bc9adfccdac1fbd6c6318a7e4711c79224fc | agold/svgchart | lib/gui/form.py | [
"Apache-2.0"
] | Python | closeForm | null | def closeForm(f):
"""Closes the form for the GUI.
@param f: File to write to
"""
f.write("</form>") | Closes the form for the GUI.
@param f: File to write to
| Closes the form for the GUI. | [
"Closes",
"the",
"form",
"for",
"the",
"GUI",
"."
] | def closeForm(f):
f.write("</form>") | [
"def",
"closeForm",
"(",
"f",
")",
":",
"f",
".",
"write",
"(",
"\"</form>\"",
")"
] | Closes the form for the GUI. | [
"Closes",
"the",
"form",
"for",
"the",
"GUI",
"."
] | [
"\"\"\"Closes the form for the GUI.\n\t@param f: File to write to\n\t\"\"\""
] | [
{
"param": "f",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "f",
"type": null,
"docstring": "File to write to",
"docstring_tokens": [
"File",
"to",
"write",
"to"
],
"default": null,
"is_optional": false
}
],
"outlier_params": [],... |
2343bc9adfccdac1fbd6c6318a7e4711c79224fc | agold/svgchart | lib/gui/form.py | [
"Apache-2.0"
] | Python | footer | null | def footer(f):
"""Writes the closing section of the GUI.
@param f: File to write to
"""
f.write("""
</body>
</html>
""") | Writes the closing section of the GUI.
@param f: File to write to
| Writes the closing section of the GUI. | [
"Writes",
"the",
"closing",
"section",
"of",
"the",
"GUI",
"."
] | def footer(f):
f.write("""
</body>
</html>
""") | [
"def",
"footer",
"(",
"f",
")",
":",
"f",
".",
"write",
"(",
"\"\"\"\n</body>\n</html>\n\t\"\"\"",
")"
] | Writes the closing section of the GUI. | [
"Writes",
"the",
"closing",
"section",
"of",
"the",
"GUI",
"."
] | [
"\"\"\"Writes the closing section of the GUI.\n\t@param f: File to write to\n\t\"\"\""
] | [
{
"param": "f",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "f",
"type": null,
"docstring": "File to write to",
"docstring_tokens": [
"File",
"to",
"write",
"to"
],
"default": null,
"is_optional": false
}
],
"outlier_params": [],... |
9432db5327f7ece62775268cde03df4401aa5579 | agold/svgchart | lib/shapes/ShapeGroup.py | [
"Apache-2.0"
] | Python | width | <not_specific> | def width(self):
"""The width of the entire group."""
maxcoord = None
maxwidth = None
mincoord = self.shapes[0].position.x
for shape in self.shapes:
if float(shape.position.x) < mincoord:
mincoord = float(shape.position.x)
if float(shape.position.x) >= maxcoord:
maxcoord = float(shape.position... | The width of the entire group. | The width of the entire group. | [
"The",
"width",
"of",
"the",
"entire",
"group",
"."
] | def width(self):
maxcoord = None
maxwidth = None
mincoord = self.shapes[0].position.x
for shape in self.shapes:
if float(shape.position.x) < mincoord:
mincoord = float(shape.position.x)
if float(shape.position.x) >= maxcoord:
maxcoord = float(shape.position.x)
if float(shape.width) > maxwidth:... | [
"def",
"width",
"(",
"self",
")",
":",
"maxcoord",
"=",
"None",
"maxwidth",
"=",
"None",
"mincoord",
"=",
"self",
".",
"shapes",
"[",
"0",
"]",
".",
"position",
".",
"x",
"for",
"shape",
"in",
"self",
".",
"shapes",
":",
"if",
"float",
"(",
"shape"... | The width of the entire group. | [
"The",
"width",
"of",
"the",
"entire",
"group",
"."
] | [
"\"\"\"The width of the entire group.\"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
9432db5327f7ece62775268cde03df4401aa5579 | agold/svgchart | lib/shapes/ShapeGroup.py | [
"Apache-2.0"
] | Python | height | <not_specific> | def height(self):
"""The height of the entire group."""
maxcoord = None
maxheight = None
mincoord = self.shapes[0].position.y
for shape in self.shapes:
if float(shape.position.y) < mincoord:
mincoord = float(shape.position.y)
if float(shape.position.y) >= maxcoord:
maxcoord = float(shape.posit... | The height of the entire group. | The height of the entire group. | [
"The",
"height",
"of",
"the",
"entire",
"group",
"."
] | def height(self):
maxcoord = None
maxheight = None
mincoord = self.shapes[0].position.y
for shape in self.shapes:
if float(shape.position.y) < mincoord:
mincoord = float(shape.position.y)
if float(shape.position.y) >= maxcoord:
maxcoord = float(shape.position.y)
if float(shape.height) > maxhei... | [
"def",
"height",
"(",
"self",
")",
":",
"maxcoord",
"=",
"None",
"maxheight",
"=",
"None",
"mincoord",
"=",
"self",
".",
"shapes",
"[",
"0",
"]",
".",
"position",
".",
"y",
"for",
"shape",
"in",
"self",
".",
"shapes",
":",
"if",
"float",
"(",
"shap... | The height of the entire group. | [
"The",
"height",
"of",
"the",
"entire",
"group",
"."
] | [
"\"\"\"The height of the entire group.\"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
9432db5327f7ece62775268cde03df4401aa5579 | agold/svgchart | lib/shapes/ShapeGroup.py | [
"Apache-2.0"
] | Python | position | <not_specific> | def position(self):
"""The top-left coordinate of the group."""
x = min([self.shapes[i].position.x for i in xrange(len(self.shapes))])
y = min([self.shapes[i].position.y for i in xrange(len(self.shapes))])
return Coordinate(x, y) | The top-left coordinate of the group. | The top-left coordinate of the group. | [
"The",
"top",
"-",
"left",
"coordinate",
"of",
"the",
"group",
"."
] | def position(self):
x = min([self.shapes[i].position.x for i in xrange(len(self.shapes))])
y = min([self.shapes[i].position.y for i in xrange(len(self.shapes))])
return Coordinate(x, y) | [
"def",
"position",
"(",
"self",
")",
":",
"x",
"=",
"min",
"(",
"[",
"self",
".",
"shapes",
"[",
"i",
"]",
".",
"position",
".",
"x",
"for",
"i",
"in",
"xrange",
"(",
"len",
"(",
"self",
".",
"shapes",
")",
")",
"]",
")",
"y",
"=",
"min",
"... | The top-left coordinate of the group. | [
"The",
"top",
"-",
"left",
"coordinate",
"of",
"the",
"group",
"."
] | [
"\"\"\"The top-left coordinate of the group.\"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
9432db5327f7ece62775268cde03df4401aa5579 | agold/svgchart | lib/shapes/ShapeGroup.py | [
"Apache-2.0"
] | Python | fitToWidth | null | def fitToWidth(self, width=0.0):
"""Fits shape to given width maintaining scale.
@param width: The width to fit to
"""
scalingfactor = 1.0 - ((self.width - float(width)) / self.width)
for shape in self.shapes:
distx = shape.position.x - self.position.x
disty = shape.position.y - self.position.y
sha... | Fits shape to given width maintaining scale.
@param width: The width to fit to
| Fits shape to given width maintaining scale. | [
"Fits",
"shape",
"to",
"given",
"width",
"maintaining",
"scale",
"."
] | def fitToWidth(self, width=0.0):
scalingfactor = 1.0 - ((self.width - float(width)) / self.width)
for shape in self.shapes:
distx = shape.position.x - self.position.x
disty = shape.position.y - self.position.y
shape.fitToWidth(shape.width * scalingfactor)
shape.translate(-distx * (1.0 - scalingfactor), ... | [
"def",
"fitToWidth",
"(",
"self",
",",
"width",
"=",
"0.0",
")",
":",
"scalingfactor",
"=",
"1.0",
"-",
"(",
"(",
"self",
".",
"width",
"-",
"float",
"(",
"width",
")",
")",
"/",
"self",
".",
"width",
")",
"for",
"shape",
"in",
"self",
".",
"shap... | Fits shape to given width maintaining scale. | [
"Fits",
"shape",
"to",
"given",
"width",
"maintaining",
"scale",
"."
] | [
"\"\"\"Fits shape to given width maintaining scale.\n\n\t\t@param width: The width to fit to\n\t\t\"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "width",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "width",
"type": null,
"docstring": "The width to fit to",
"do... |
9432db5327f7ece62775268cde03df4401aa5579 | agold/svgchart | lib/shapes/ShapeGroup.py | [
"Apache-2.0"
] | Python | fitToHeight | null | def fitToHeight(self, height=0.0):
"""Fits shape to given height maintaining scale.
@param height: The height to fit to
"""
scalingfactor = 1.0 - ((self.height - float(height)) / self.height)
for shape in self.shapes:
distx = shape.position.x - self.position.x
disty = shape.position.y - self.position.... | Fits shape to given height maintaining scale.
@param height: The height to fit to
| Fits shape to given height maintaining scale. | [
"Fits",
"shape",
"to",
"given",
"height",
"maintaining",
"scale",
"."
] | def fitToHeight(self, height=0.0):
scalingfactor = 1.0 - ((self.height - float(height)) / self.height)
for shape in self.shapes:
distx = shape.position.x - self.position.x
disty = shape.position.y - self.position.y
shape.fitToHeight(shape.height * scalingfactor)
shape.translate(-distx * (1.0 - scalingfa... | [
"def",
"fitToHeight",
"(",
"self",
",",
"height",
"=",
"0.0",
")",
":",
"scalingfactor",
"=",
"1.0",
"-",
"(",
"(",
"self",
".",
"height",
"-",
"float",
"(",
"height",
")",
")",
"/",
"self",
".",
"height",
")",
"for",
"shape",
"in",
"self",
".",
... | Fits shape to given height maintaining scale. | [
"Fits",
"shape",
"to",
"given",
"height",
"maintaining",
"scale",
"."
] | [
"\"\"\"Fits shape to given height maintaining scale.\n\n\t\t@param height: The height to fit to\n\t\t\"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "height",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "height",
"type": null,
"docstring": "The height to fit to",
"... |
9432db5327f7ece62775268cde03df4401aa5579 | agold/svgchart | lib/shapes/ShapeGroup.py | [
"Apache-2.0"
] | Python | translateTo | null | def translateTo(self, coord=Coordinate()):
"""Translates the group to the given coordinate.
@param coord: The new coordinate to translate to
@type coord: Coordinate
"""
oldx, oldy = self.position
self.translate(coord.x - oldx, coord.y - oldy) | Translates the group to the given coordinate.
@param coord: The new coordinate to translate to
@type coord: Coordinate
| Translates the group to the given coordinate. | [
"Translates",
"the",
"group",
"to",
"the",
"given",
"coordinate",
"."
] | def translateTo(self, coord=Coordinate()):
oldx, oldy = self.position
self.translate(coord.x - oldx, coord.y - oldy) | [
"def",
"translateTo",
"(",
"self",
",",
"coord",
"=",
"Coordinate",
"(",
")",
")",
":",
"oldx",
",",
"oldy",
"=",
"self",
".",
"position",
"self",
".",
"translate",
"(",
"coord",
".",
"x",
"-",
"oldx",
",",
"coord",
".",
"y",
"-",
"oldy",
")"
] | Translates the group to the given coordinate. | [
"Translates",
"the",
"group",
"to",
"the",
"given",
"coordinate",
"."
] | [
"\"\"\"Translates the group to the given coordinate.\n\n\t\t@param coord: The new coordinate to translate to\n\t\t@type coord: Coordinate\n\t\t\"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "coord",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "coord",
"type": null,
"docstring": "The new coordinate to translate... |
9432db5327f7ece62775268cde03df4401aa5579 | agold/svgchart | lib/shapes/ShapeGroup.py | [
"Apache-2.0"
] | Python | translate | null | def translate(self, x=0.0, y=0.0):
"""Translates the group by the given amounts.
@param x: The amount to translate in the x-direction
@param y: The amount to translate in the y-direction
"""
for shape in self.shapes:
shape.translate(x, y) | Translates the group by the given amounts.
@param x: The amount to translate in the x-direction
@param y: The amount to translate in the y-direction
| Translates the group by the given amounts. | [
"Translates",
"the",
"group",
"by",
"the",
"given",
"amounts",
"."
] | def translate(self, x=0.0, y=0.0):
for shape in self.shapes:
shape.translate(x, y) | [
"def",
"translate",
"(",
"self",
",",
"x",
"=",
"0.0",
",",
"y",
"=",
"0.0",
")",
":",
"for",
"shape",
"in",
"self",
".",
"shapes",
":",
"shape",
".",
"translate",
"(",
"x",
",",
"y",
")"
] | Translates the group by the given amounts. | [
"Translates",
"the",
"group",
"by",
"the",
"given",
"amounts",
"."
] | [
"\"\"\"Translates the group by the given amounts.\n\n\t\t@param x: The amount to translate in the x-direction\n\t\t@param y: The amount to translate in the y-direction\n\t\t\"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "x",
"type": null
},
{
"param": "y",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "x",
"type": null,
"docstring": "The amount to translate in the x-di... |
9432db5327f7ece62775268cde03df4401aa5579 | agold/svgchart | lib/shapes/ShapeGroup.py | [
"Apache-2.0"
] | Python | svg | <not_specific> | def svg(self):
"""Returns the SVG representation as an XML fragment."""
shapes = []
for shape in self.shapes:
try:
shapes.append(shape.svg())
except AttributeError:
raise
self.subelements = shapes
return Shape.svg(self) | Returns the SVG representation as an XML fragment. | Returns the SVG representation as an XML fragment. | [
"Returns",
"the",
"SVG",
"representation",
"as",
"an",
"XML",
"fragment",
"."
] | def svg(self):
shapes = []
for shape in self.shapes:
try:
shapes.append(shape.svg())
except AttributeError:
raise
self.subelements = shapes
return Shape.svg(self) | [
"def",
"svg",
"(",
"self",
")",
":",
"shapes",
"=",
"[",
"]",
"for",
"shape",
"in",
"self",
".",
"shapes",
":",
"try",
":",
"shapes",
".",
"append",
"(",
"shape",
".",
"svg",
"(",
")",
")",
"except",
"AttributeError",
":",
"raise",
"self",
".",
"... | Returns the SVG representation as an XML fragment. | [
"Returns",
"the",
"SVG",
"representation",
"as",
"an",
"XML",
"fragment",
"."
] | [
"\"\"\"Returns the SVG representation as an XML fragment.\"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
a873282f91314c8b6e50d073c7be9de5d28fb4c6 | agold/svgchart | lib/shapes/Path.py | [
"Apache-2.0"
] | Python | width | <not_specific> | def width(self):
"""The width of the path."""
xcoords = [self.coordinates[i].x for i in xrange(len(self.coordinates))]
return float(max(xcoords)) - float(min(xcoords)) | The width of the path. | The width of the path. | [
"The",
"width",
"of",
"the",
"path",
"."
] | def width(self):
xcoords = [self.coordinates[i].x for i in xrange(len(self.coordinates))]
return float(max(xcoords)) - float(min(xcoords)) | [
"def",
"width",
"(",
"self",
")",
":",
"xcoords",
"=",
"[",
"self",
".",
"coordinates",
"[",
"i",
"]",
".",
"x",
"for",
"i",
"in",
"xrange",
"(",
"len",
"(",
"self",
".",
"coordinates",
")",
")",
"]",
"return",
"float",
"(",
"max",
"(",
"xcoords"... | The width of the path. | [
"The",
"width",
"of",
"the",
"path",
"."
] | [
"\"\"\"The width of the path.\"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
a873282f91314c8b6e50d073c7be9de5d28fb4c6 | agold/svgchart | lib/shapes/Path.py | [
"Apache-2.0"
] | Python | height | <not_specific> | def height(self):
"""The height of the path."""
ycoords = [self.coordinates[i].y for i in xrange(len(self.coordinates))]
return float(max(ycoords)) - float(min(ycoords)) | The height of the path. | The height of the path. | [
"The",
"height",
"of",
"the",
"path",
"."
] | def height(self):
ycoords = [self.coordinates[i].y for i in xrange(len(self.coordinates))]
return float(max(ycoords)) - float(min(ycoords)) | [
"def",
"height",
"(",
"self",
")",
":",
"ycoords",
"=",
"[",
"self",
".",
"coordinates",
"[",
"i",
"]",
".",
"y",
"for",
"i",
"in",
"xrange",
"(",
"len",
"(",
"self",
".",
"coordinates",
")",
")",
"]",
"return",
"float",
"(",
"max",
"(",
"ycoords... | The height of the path. | [
"The",
"height",
"of",
"the",
"path",
"."
] | [
"\"\"\"The height of the path.\"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
a873282f91314c8b6e50d073c7be9de5d28fb4c6 | agold/svgchart | lib/shapes/Path.py | [
"Apache-2.0"
] | Python | position | <not_specific> | def position(self):
"""The top-left coodinate of the path."""
x = min([self.coordinates[i].x for i in xrange(len(self.coordinates))])
y = min([self.coordinates[i].y for i in xrange(len(self.coordinates))])
return Coordinate(x, y) | The top-left coodinate of the path. | The top-left coodinate of the path. | [
"The",
"top",
"-",
"left",
"coodinate",
"of",
"the",
"path",
"."
] | def position(self):
x = min([self.coordinates[i].x for i in xrange(len(self.coordinates))])
y = min([self.coordinates[i].y for i in xrange(len(self.coordinates))])
return Coordinate(x, y) | [
"def",
"position",
"(",
"self",
")",
":",
"x",
"=",
"min",
"(",
"[",
"self",
".",
"coordinates",
"[",
"i",
"]",
".",
"x",
"for",
"i",
"in",
"xrange",
"(",
"len",
"(",
"self",
".",
"coordinates",
")",
")",
"]",
")",
"y",
"=",
"min",
"(",
"[",
... | The top-left coodinate of the path. | [
"The",
"top",
"-",
"left",
"coodinate",
"of",
"the",
"path",
"."
] | [
"\"\"\"The top-left coodinate of the path.\"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
a873282f91314c8b6e50d073c7be9de5d28fb4c6 | agold/svgchart | lib/shapes/Path.py | [
"Apache-2.0"
] | Python | pathString | <not_specific> | def pathString(self):
"""Returns the SVG coordinate list as a string."""
pathList = [u'M',
u'{coord.x:.{fp:d}f},{coord.y:.{fp:d}f}'.format(
fp=self.precision, coord=self.coordinates[0])]
for coord in self.coordinates[1:]:
pathList += [ u'L',
u'{coord.x:.{fp:d}f},{coord.y:.{fp:d}f}'.format(
... | Returns the SVG coordinate list as a string. | Returns the SVG coordinate list as a string. | [
"Returns",
"the",
"SVG",
"coordinate",
"list",
"as",
"a",
"string",
"."
] | def pathString(self):
pathList = [u'M',
u'{coord.x:.{fp:d}f},{coord.y:.{fp:d}f}'.format(
fp=self.precision, coord=self.coordinates[0])]
for coord in self.coordinates[1:]:
pathList += [ u'L',
u'{coord.x:.{fp:d}f},{coord.y:.{fp:d}f}'.format(
fp=self.precision, coord=coord)]
return u' '.... | [
"def",
"pathString",
"(",
"self",
")",
":",
"pathList",
"=",
"[",
"u'M'",
",",
"u'{coord.x:.{fp:d}f},{coord.y:.{fp:d}f}'",
".",
"format",
"(",
"fp",
"=",
"self",
".",
"precision",
",",
"coord",
"=",
"self",
".",
"coordinates",
"[",
"0",
"]",
")",
"]",
"f... | Returns the SVG coordinate list as a string. | [
"Returns",
"the",
"SVG",
"coordinate",
"list",
"as",
"a",
"string",
"."
] | [
"\"\"\"Returns the SVG coordinate list as a string.\"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
a873282f91314c8b6e50d073c7be9de5d28fb4c6 | agold/svgchart | lib/shapes/Path.py | [
"Apache-2.0"
] | Python | fitToWidth | null | def fitToWidth(self, width=0.0):
"""Scales the path to fit in the given width.
@param width: The width to scale to
"""
x, y = self.position
ratio = width / self.width
newcoords = []
for coord in self.coordinates:
newx = x + (coord.x - x) * ratio
newy = y + (coord.y - y) * ratio
newcoords.append... | Scales the path to fit in the given width.
@param width: The width to scale to
| Scales the path to fit in the given width. | [
"Scales",
"the",
"path",
"to",
"fit",
"in",
"the",
"given",
"width",
"."
] | def fitToWidth(self, width=0.0):
x, y = self.position
ratio = width / self.width
newcoords = []
for coord in self.coordinates:
newx = x + (coord.x - x) * ratio
newy = y + (coord.y - y) * ratio
newcoords.append(Coordinate(newx, newy))
self.coordinates = tuple(newcoords) | [
"def",
"fitToWidth",
"(",
"self",
",",
"width",
"=",
"0.0",
")",
":",
"x",
",",
"y",
"=",
"self",
".",
"position",
"ratio",
"=",
"width",
"/",
"self",
".",
"width",
"newcoords",
"=",
"[",
"]",
"for",
"coord",
"in",
"self",
".",
"coordinates",
":",
... | Scales the path to fit in the given width. | [
"Scales",
"the",
"path",
"to",
"fit",
"in",
"the",
"given",
"width",
"."
] | [
"\"\"\"Scales the path to fit in the given width.\n\n\t\t@param width: The width to scale to\n\t\t\"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "width",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "width",
"type": null,
"docstring": "The width to scale to",
"... |
a873282f91314c8b6e50d073c7be9de5d28fb4c6 | agold/svgchart | lib/shapes/Path.py | [
"Apache-2.0"
] | Python | fitToHeight | null | def fitToHeight(self, height=0.0):
"""Scales the path to fit in the given height.
@param height: The height to scale to
"""
x, y = self.position
ratio = height / self.height
newcoords = []
for coord in self.coordinates:
newx = x + (coord.x - x) * ratio
newy = y + (coord.y - y) * ratio
newcoords... | Scales the path to fit in the given height.
@param height: The height to scale to
| Scales the path to fit in the given height. | [
"Scales",
"the",
"path",
"to",
"fit",
"in",
"the",
"given",
"height",
"."
] | def fitToHeight(self, height=0.0):
x, y = self.position
ratio = height / self.height
newcoords = []
for coord in self.coordinates:
newx = x + (coord.x - x) * ratio
newy = y + (coord.y - y) * ratio
newcoords.append(Coordinate(newx, newy))
self.coordinates = tuple(newcoords) | [
"def",
"fitToHeight",
"(",
"self",
",",
"height",
"=",
"0.0",
")",
":",
"x",
",",
"y",
"=",
"self",
".",
"position",
"ratio",
"=",
"height",
"/",
"self",
".",
"height",
"newcoords",
"=",
"[",
"]",
"for",
"coord",
"in",
"self",
".",
"coordinates",
"... | Scales the path to fit in the given height. | [
"Scales",
"the",
"path",
"to",
"fit",
"in",
"the",
"given",
"height",
"."
] | [
"\"\"\"Scales the path to fit in the given height.\n\n\t\t@param height: The height to scale to\n\t\t\"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "height",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "height",
"type": null,
"docstring": "The height to scale to",
... |
a873282f91314c8b6e50d073c7be9de5d28fb4c6 | agold/svgchart | lib/shapes/Path.py | [
"Apache-2.0"
] | Python | translateTo | null | def translateTo(self, coord=Coordinate()):
"""Translates the path to the given coordinate.
@param coord: The new coordinate to translate to
@type coord: Coordinate
"""
x = min([self.coordinates[i].x for i in xrange(len(self.coordinates))])
y = min([self.coordinates[i].y for i in xrange(len(self.coordinate... | Translates the path to the given coordinate.
@param coord: The new coordinate to translate to
@type coord: Coordinate
| Translates the path to the given coordinate. | [
"Translates",
"the",
"path",
"to",
"the",
"given",
"coordinate",
"."
] | def translateTo(self, coord=Coordinate()):
x = min([self.coordinates[i].x for i in xrange(len(self.coordinates))])
y = min([self.coordinates[i].y for i in xrange(len(self.coordinates))])
self.translate(x=coord.x - x, y=coord.y - y) | [
"def",
"translateTo",
"(",
"self",
",",
"coord",
"=",
"Coordinate",
"(",
")",
")",
":",
"x",
"=",
"min",
"(",
"[",
"self",
".",
"coordinates",
"[",
"i",
"]",
".",
"x",
"for",
"i",
"in",
"xrange",
"(",
"len",
"(",
"self",
".",
"coordinates",
")",
... | Translates the path to the given coordinate. | [
"Translates",
"the",
"path",
"to",
"the",
"given",
"coordinate",
"."
] | [
"\"\"\"Translates the path to the given coordinate.\n\n\t\t@param coord: The new coordinate to translate to\n\t\t@type coord: Coordinate\n\t\t\"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "coord",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "coord",
"type": null,
"docstring": "The new coordinate to translate... |
a873282f91314c8b6e50d073c7be9de5d28fb4c6 | agold/svgchart | lib/shapes/Path.py | [
"Apache-2.0"
] | Python | translate | null | def translate(self, x=0.0, y=0.0):
"""Translates the path by the given amounts.
@param x: The amount to translate in the x-direction
@param y: The amount to translate in the y-direction
"""
newcoords = []
for oldx, oldy in self.coordinates:
newcoords.append(Coordinate(x + oldx, y + oldy))
self.coordi... | Translates the path by the given amounts.
@param x: The amount to translate in the x-direction
@param y: The amount to translate in the y-direction
| Translates the path by the given amounts. | [
"Translates",
"the",
"path",
"by",
"the",
"given",
"amounts",
"."
] | def translate(self, x=0.0, y=0.0):
newcoords = []
for oldx, oldy in self.coordinates:
newcoords.append(Coordinate(x + oldx, y + oldy))
self.coordinates = tuple(newcoords) | [
"def",
"translate",
"(",
"self",
",",
"x",
"=",
"0.0",
",",
"y",
"=",
"0.0",
")",
":",
"newcoords",
"=",
"[",
"]",
"for",
"oldx",
",",
"oldy",
"in",
"self",
".",
"coordinates",
":",
"newcoords",
".",
"append",
"(",
"Coordinate",
"(",
"x",
"+",
"o... | Translates the path by the given amounts. | [
"Translates",
"the",
"path",
"by",
"the",
"given",
"amounts",
"."
] | [
"\"\"\"Translates the path by the given amounts.\n\n\t\t@param x: The amount to translate in the x-direction\n\t\t@param y: The amount to translate in the y-direction\n\t\t\"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "x",
"type": null
},
{
"param": "y",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "x",
"type": null,
"docstring": "The amount to translate in the x-di... |
a873282f91314c8b6e50d073c7be9de5d28fb4c6 | agold/svgchart | lib/shapes/Path.py | [
"Apache-2.0"
] | Python | svg | <not_specific> | def svg(self):
"""Returns the SVG representation as an XML fragment."""
self.attrs['d'] = self.pathString()
return Shape.svg(self) | Returns the SVG representation as an XML fragment. | Returns the SVG representation as an XML fragment. | [
"Returns",
"the",
"SVG",
"representation",
"as",
"an",
"XML",
"fragment",
"."
] | def svg(self):
self.attrs['d'] = self.pathString()
return Shape.svg(self) | [
"def",
"svg",
"(",
"self",
")",
":",
"self",
".",
"attrs",
"[",
"'d'",
"]",
"=",
"self",
".",
"pathString",
"(",
")",
"return",
"Shape",
".",
"svg",
"(",
"self",
")"
] | Returns the SVG representation as an XML fragment. | [
"Returns",
"the",
"SVG",
"representation",
"as",
"an",
"XML",
"fragment",
"."
] | [
"\"\"\"Returns the SVG representation as an XML fragment.\"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
ecba013a24fdd8976e08dc2aa7c4abac7c8535ad | agold/svgchart | lib/parse/ParsedInput.py | [
"Apache-2.0"
] | Python | parseXml | <not_specific> | def parseXml(xml,dest = None):
"""Parses an XML string into an IndexedDict tree.
@param xml: The XML string
@param dest: Target IndexedDict; if nonempty, it will be extended
"""
if (dest == None):
dest = IndexedDict()
elem = ETree.fromstring(xml)
parseTree(dest,elem)
return dest | Parses an XML string into an IndexedDict tree.
@param xml: The XML string
@param dest: Target IndexedDict; if nonempty, it will be extended
| Parses an XML string into an IndexedDict tree. | [
"Parses",
"an",
"XML",
"string",
"into",
"an",
"IndexedDict",
"tree",
"."
] | def parseXml(xml,dest = None):
if (dest == None):
dest = IndexedDict()
elem = ETree.fromstring(xml)
parseTree(dest,elem)
return dest | [
"def",
"parseXml",
"(",
"xml",
",",
"dest",
"=",
"None",
")",
":",
"if",
"(",
"dest",
"==",
"None",
")",
":",
"dest",
"=",
"IndexedDict",
"(",
")",
"elem",
"=",
"ETree",
".",
"fromstring",
"(",
"xml",
")",
"parseTree",
"(",
"dest",
",",
"elem",
"... | Parses an XML string into an IndexedDict tree. | [
"Parses",
"an",
"XML",
"string",
"into",
"an",
"IndexedDict",
"tree",
"."
] | [
"\"\"\"Parses an XML string into an IndexedDict tree.\n\t@param xml: The XML string\n\t@param dest: Target IndexedDict; if nonempty, it will be extended\n\t\"\"\""
] | [
{
"param": "xml",
"type": null
},
{
"param": "dest",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "xml",
"type": null,
"docstring": "The XML string",
"docstring_tokens": [
"The",
"XML",
"string"
],
"default": null,
"is_optional": false
},
{
"identifier": "dest",
... |
ecba013a24fdd8976e08dc2aa7c4abac7c8535ad | agold/svgchart | lib/parse/ParsedInput.py | [
"Apache-2.0"
] | Python | parseTree | null | def parseTree(dest,elem):
"""Parses a tree of Elements into an IndexedDict tree.
@param dest: Target IndexedDict; if nonempty, it will be extended
@param elem: Root of the tree of Elements to be parsed
"""
attrib = dict(elem.items())
for key in attrib:
dest[key] = attrib[key]
if (elem.text and elem.text.strip... | Parses a tree of Elements into an IndexedDict tree.
@param dest: Target IndexedDict; if nonempty, it will be extended
@param elem: Root of the tree of Elements to be parsed
| Parses a tree of Elements into an IndexedDict tree. | [
"Parses",
"a",
"tree",
"of",
"Elements",
"into",
"an",
"IndexedDict",
"tree",
"."
] | def parseTree(dest,elem):
attrib = dict(elem.items())
for key in attrib:
dest[key] = attrib[key]
if (elem.text and elem.text.strip()):
dest.text = elem.text.strip()
else:
dest.text = None
append = ('append' in attrib and attrib['append'] == 'append')
tagcount = dict()
for child in list(elem):
if (child.t... | [
"def",
"parseTree",
"(",
"dest",
",",
"elem",
")",
":",
"attrib",
"=",
"dict",
"(",
"elem",
".",
"items",
"(",
")",
")",
"for",
"key",
"in",
"attrib",
":",
"dest",
"[",
"key",
"]",
"=",
"attrib",
"[",
"key",
"]",
"if",
"(",
"elem",
".",
"text",... | Parses a tree of Elements into an IndexedDict tree. | [
"Parses",
"a",
"tree",
"of",
"Elements",
"into",
"an",
"IndexedDict",
"tree",
"."
] | [
"\"\"\"Parses a tree of Elements into an IndexedDict tree.\n\t@param dest: Target IndexedDict; if nonempty, it will be extended\n\t@param elem: Root of the tree of Elements to be parsed\n\t\"\"\""
] | [
{
"param": "dest",
"type": null
},
{
"param": "elem",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "dest",
"type": null,
"docstring": "Target IndexedDict; if nonempty, it will be extended",
"docstring_tokens": [
"Target",
"IndexedDict",
";",
"if",
"nonempty",
"it",
"wil... |
cf2f9ff42aad8c64907547bcd674b7e8592add45 | agold/svgchart | lib/input/InputSet.py | [
"Apache-2.0"
] | Python | input | null | def input(self,string = u''):
"""Processes string and extracts the first pertinent section as
a new entry in textlist.
@param string: String containing material to be searched for pertinent information
"""
match = re.search(r'<'+self.tagName+r'(?: [^>]+)? *(?:\/>|>.*<\/'+self.tagName+r'>)',string,re.DOTALL)
... | Processes string and extracts the first pertinent section as
a new entry in textlist.
@param string: String containing material to be searched for pertinent information
| Processes string and extracts the first pertinent section as
a new entry in textlist. | [
"Processes",
"string",
"and",
"extracts",
"the",
"first",
"pertinent",
"section",
"as",
"a",
"new",
"entry",
"in",
"textlist",
"."
] | def input(self,string = u''):
match = re.search(r'<'+self.tagName+r'(?: [^>]+)? *(?:\/>|>.*<\/'+self.tagName+r'>)',string,re.DOTALL)
if (match):
self.textlist.append(match.group()) | [
"def",
"input",
"(",
"self",
",",
"string",
"=",
"u''",
")",
":",
"match",
"=",
"re",
".",
"search",
"(",
"r'<'",
"+",
"self",
".",
"tagName",
"+",
"r'(?: [^>]+)? *(?:\\/>|>.*<\\/'",
"+",
"self",
".",
"tagName",
"+",
"r'>)'",
",",
"string",
",",
"re",
... | Processes string and extracts the first pertinent section as
a new entry in textlist. | [
"Processes",
"string",
"and",
"extracts",
"the",
"first",
"pertinent",
"section",
"as",
"a",
"new",
"entry",
"in",
"textlist",
"."
] | [
"\"\"\"Processes string and extracts the first pertinent section as\n\t\ta new entry in textlist.\n\n\t\t@param string: String containing material to be searched for pertinent information\n\t\t\"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "string",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "string",
"type": null,
"docstring": "String containing material to ... |
475c457f59a7aaab7e329321871339a0d39d32be | dyedgreen/schroedinger | numerov/root.py | [
"MIT"
] | Python | bracket | <not_specific> | def bracket(f, lower, upper, accuracy=1e-10, max_iteration=1<<10):
"""Find root of function within bracket limits.
@param f callable (function of form f(x) = 0)
@param lower float (initial lower bound)
@parma upper float (initial upper bound)
@param accuracy float (d... | Find root of function within bracket limits.
@param f callable (function of form f(x) = 0)
@param lower float (initial lower bound)
@parma upper float (initial upper bound)
@param accuracy float (desired accuracy, default is 2^-5)
@param max_iteration int (defau... | Find root of function within bracket limits.
@return float or False | [
"Find",
"root",
"of",
"function",
"within",
"bracket",
"limits",
".",
"@return",
"float",
"or",
"False"
] | def bracket(f, lower, upper, accuracy=1e-10, max_iteration=1<<10):
v_upper = 0.
v_lower = 0.
midpoint = 0.
count = 0
while count < max_iteration:
count += 1
v_upper = f(upper)
v_lower = f(lower)
midpoint = lower + (upper-lower) / 2
v_midpoint = f(midpoint)
if v_midpoint * v_upper < 0:
... | [
"def",
"bracket",
"(",
"f",
",",
"lower",
",",
"upper",
",",
"accuracy",
"=",
"1e-10",
",",
"max_iteration",
"=",
"1",
"<<",
"10",
")",
":",
"v_upper",
"=",
"0.",
"v_lower",
"=",
"0.",
"midpoint",
"=",
"0.",
"count",
"=",
"0",
"while",
"count",
"<"... | Find root of function within bracket limits. | [
"Find",
"root",
"of",
"function",
"within",
"bracket",
"limits",
"."
] | [
"\"\"\"Find root of function within bracket limits.\n\n @param f callable (function of form f(x) = 0)\n @param lower float (initial lower bound)\n @parma upper float (initial upper bound)\n @param accuracy float (desired accuracy, default is 2^-5)\n @param max_iteratio... | [
{
"param": "f",
"type": null
},
{
"param": "lower",
"type": null
},
{
"param": "upper",
"type": null
},
{
"param": "accuracy",
"type": null
},
{
"param": "max_iteration",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "f",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "lower",
"type": null,
"docstring": null,
"docstring_tokens": [],... |
d488d92fccf497a9766388d27c34f039b5c6b10a | dyedgreen/schroedinger | numerov/units.py | [
"MIT"
] | Python | scaleE | <not_specific> | def scaleE(E, m):
"""Scale an energy value into a nice range
@param E float (energy value in Joules)
@param m float (mass of particle involved)
@return float
"""
return E * gammaSquared(m) | Scale an energy value into a nice range
@param E float (energy value in Joules)
@param m float (mass of particle involved)
@return float
| Scale an energy value into a nice range
@param E float (energy value in Joules)
@param m float (mass of particle involved)
@return float | [
"Scale",
"an",
"energy",
"value",
"into",
"a",
"nice",
"range",
"@param",
"E",
"float",
"(",
"energy",
"value",
"in",
"Joules",
")",
"@param",
"m",
"float",
"(",
"mass",
"of",
"particle",
"involved",
")",
"@return",
"float"
] | def scaleE(E, m):
return E * gammaSquared(m) | [
"def",
"scaleE",
"(",
"E",
",",
"m",
")",
":",
"return",
"E",
"*",
"gammaSquared",
"(",
"m",
")"
] | Scale an energy value into a nice range
@param E float (energy value in Joules)
@param m float (mass of particle involved) | [
"Scale",
"an",
"energy",
"value",
"into",
"a",
"nice",
"range",
"@param",
"E",
"float",
"(",
"energy",
"value",
"in",
"Joules",
")",
"@param",
"m",
"float",
"(",
"mass",
"of",
"particle",
"involved",
")"
] | [
"\"\"\"Scale an energy value into a nice range\n\n @param E float (energy value in Joules)\n @param m float (mass of particle involved)\n\n @return float\n \"\"\""
] | [
{
"param": "E",
"type": null
},
{
"param": "m",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "E",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "m",
"type": null,
"docstring": null,
"docstring_tokens": [],
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.