repo stringlengths 7 55 | path stringlengths 4 223 | func_name stringlengths 1 134 | original_string stringlengths 75 104k | language stringclasses 1
value | code stringlengths 75 104k | code_tokens listlengths 19 28.4k | docstring stringlengths 1 46.9k | docstring_tokens listlengths 1 1.97k | sha stringlengths 40 40 | url stringlengths 87 315 | partition stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|---|
asweigart/pysimplevalidate | src/pysimplevalidate/__init__.py | _validateParamsFor__validateToDateTimeFormat | def _validateParamsFor__validateToDateTimeFormat(formats, blank=False, strip=None, allowlistRegexes=None, blocklistRegexes=None, excMsg=None):
"""Raises PySimpleValidateException if the arguments are invalid. This is called by
the validateTime() function to check its arguments. This code was
refactored out ... | python | def _validateParamsFor__validateToDateTimeFormat(formats, blank=False, strip=None, allowlistRegexes=None, blocklistRegexes=None, excMsg=None):
"""Raises PySimpleValidateException if the arguments are invalid. This is called by
the validateTime() function to check its arguments. This code was
refactored out ... | [
"def",
"_validateParamsFor__validateToDateTimeFormat",
"(",
"formats",
",",
"blank",
"=",
"False",
",",
"strip",
"=",
"None",
",",
"allowlistRegexes",
"=",
"None",
",",
"blocklistRegexes",
"=",
"None",
",",
"excMsg",
"=",
"None",
")",
":",
"_validateGenericParamet... | Raises PySimpleValidateException if the arguments are invalid. This is called by
the validateTime() function to check its arguments. This code was
refactored out to a separate function so that the PyInputPlus module (or
other modules) could check their parameters' arguments for inputTime(). | [
"Raises",
"PySimpleValidateException",
"if",
"the",
"arguments",
"are",
"invalid",
".",
"This",
"is",
"called",
"by",
"the",
"validateTime",
"()",
"function",
"to",
"check",
"its",
"arguments",
".",
"This",
"code",
"was",
"refactored",
"out",
"to",
"a",
"separ... | 3ca27228abb7355d14bbf8abc225c63366379e44 | https://github.com/asweigart/pysimplevalidate/blob/3ca27228abb7355d14bbf8abc225c63366379e44/src/pysimplevalidate/__init__.py#L611-L633 | train |
asweigart/pysimplevalidate | src/pysimplevalidate/__init__.py | validateTime | def validateTime(value, blank=False, strip=None, allowlistRegexes=None, blocklistRegexes=None,
formats=('%H:%M:%S', '%H:%M', '%X'), excMsg=None):
"""Raises ValidationException if value is not a time formatted in one
of the formats formats. Returns a datetime.time object of value.
* value (... | python | def validateTime(value, blank=False, strip=None, allowlistRegexes=None, blocklistRegexes=None,
formats=('%H:%M:%S', '%H:%M', '%X'), excMsg=None):
"""Raises ValidationException if value is not a time formatted in one
of the formats formats. Returns a datetime.time object of value.
* value (... | [
"def",
"validateTime",
"(",
"value",
",",
"blank",
"=",
"False",
",",
"strip",
"=",
"None",
",",
"allowlistRegexes",
"=",
"None",
",",
"blocklistRegexes",
"=",
"None",
",",
"formats",
"=",
"(",
"'%H:%M:%S'",
",",
"'%H:%M'",
",",
"'%X'",
")",
",",
"excMsg... | Raises ValidationException if value is not a time formatted in one
of the formats formats. Returns a datetime.time object of value.
* value (str): The value being validated as a time.
* blank (bool): If True, a blank string will be accepted. Defaults to False.
* strip (bool, str, None): If None, whites... | [
"Raises",
"ValidationException",
"if",
"value",
"is",
"not",
"a",
"time",
"formatted",
"in",
"one",
"of",
"the",
"formats",
"formats",
".",
"Returns",
"a",
"datetime",
".",
"time",
"object",
"of",
"value",
"."
] | 3ca27228abb7355d14bbf8abc225c63366379e44 | https://github.com/asweigart/pysimplevalidate/blob/3ca27228abb7355d14bbf8abc225c63366379e44/src/pysimplevalidate/__init__.py#L658-L691 | train |
asweigart/pysimplevalidate | src/pysimplevalidate/__init__.py | validateDate | def validateDate(value, blank=False, strip=None, allowlistRegexes=None, blocklistRegexes=None,
formats=('%Y/%m/%d', '%y/%m/%d', '%m/%d/%Y', '%m/%d/%y', '%x'), excMsg=None):
"""Raises ValidationException if value is not a time formatted in one
of the formats formats. Returns a datetime.date obje... | python | def validateDate(value, blank=False, strip=None, allowlistRegexes=None, blocklistRegexes=None,
formats=('%Y/%m/%d', '%y/%m/%d', '%m/%d/%Y', '%m/%d/%y', '%x'), excMsg=None):
"""Raises ValidationException if value is not a time formatted in one
of the formats formats. Returns a datetime.date obje... | [
"def",
"validateDate",
"(",
"value",
",",
"blank",
"=",
"False",
",",
"strip",
"=",
"None",
",",
"allowlistRegexes",
"=",
"None",
",",
"blocklistRegexes",
"=",
"None",
",",
"formats",
"=",
"(",
"'%Y/%m/%d'",
",",
"'%y/%m/%d'",
",",
"'%m/%d/%Y'",
",",
"'%m/... | Raises ValidationException if value is not a time formatted in one
of the formats formats. Returns a datetime.date object of value.
* value (str): The value being validated as a time.
* blank (bool): If True, a blank string for value will be accepted.
* strip (bool, str, None): If None, whitespace is s... | [
"Raises",
"ValidationException",
"if",
"value",
"is",
"not",
"a",
"time",
"formatted",
"in",
"one",
"of",
"the",
"formats",
"formats",
".",
"Returns",
"a",
"datetime",
".",
"date",
"object",
"of",
"value",
"."
] | 3ca27228abb7355d14bbf8abc225c63366379e44 | https://github.com/asweigart/pysimplevalidate/blob/3ca27228abb7355d14bbf8abc225c63366379e44/src/pysimplevalidate/__init__.py#L694-L722 | train |
asweigart/pysimplevalidate | src/pysimplevalidate/__init__.py | validateDatetime | def validateDatetime(value, blank=False, strip=None, allowlistRegexes=None, blocklistRegexes=None,
formats=('%Y/%m/%d %H:%M:%S', '%y/%m/%d %H:%M:%S', '%m/%d/%Y %H:%M:%S', '%m/%d/%y %H:%M:%S', '%x %H:%M:%S',
'%Y/%m/%d %H:%M', '%y/%m/%d %H:%M', '%m/%d/%Y %H:%M', '%m/%d/%... | python | def validateDatetime(value, blank=False, strip=None, allowlistRegexes=None, blocklistRegexes=None,
formats=('%Y/%m/%d %H:%M:%S', '%y/%m/%d %H:%M:%S', '%m/%d/%Y %H:%M:%S', '%m/%d/%y %H:%M:%S', '%x %H:%M:%S',
'%Y/%m/%d %H:%M', '%y/%m/%d %H:%M', '%m/%d/%Y %H:%M', '%m/%d/%... | [
"def",
"validateDatetime",
"(",
"value",
",",
"blank",
"=",
"False",
",",
"strip",
"=",
"None",
",",
"allowlistRegexes",
"=",
"None",
",",
"blocklistRegexes",
"=",
"None",
",",
"formats",
"=",
"(",
"'%Y/%m/%d %H:%M:%S'",
",",
"'%y/%m/%d %H:%M:%S'",
",",
"'%m/%... | Raises ValidationException if value is not a datetime formatted in one
of the formats formats. Returns a datetime.datetime object of value.
* value (str): The value being validated as a datetime.
* blank (bool): If True, a blank string will be accepted. Defaults to False.
* strip (bool, str, None): If ... | [
"Raises",
"ValidationException",
"if",
"value",
"is",
"not",
"a",
"datetime",
"formatted",
"in",
"one",
"of",
"the",
"formats",
"formats",
".",
"Returns",
"a",
"datetime",
".",
"datetime",
"object",
"of",
"value",
"."
] | 3ca27228abb7355d14bbf8abc225c63366379e44 | https://github.com/asweigart/pysimplevalidate/blob/3ca27228abb7355d14bbf8abc225c63366379e44/src/pysimplevalidate/__init__.py#L725-L755 | train |
asweigart/pysimplevalidate | src/pysimplevalidate/__init__.py | validateFilename | def validateFilename(value, blank=False, strip=None, allowlistRegexes=None, blocklistRegexes=None, excMsg=None):
"""Raises ValidationException if value is not a valid filename.
Filenames can't contain \\ / : * ? " < > | or end with a space.
Returns the value argument.
Note that this validates filenames... | python | def validateFilename(value, blank=False, strip=None, allowlistRegexes=None, blocklistRegexes=None, excMsg=None):
"""Raises ValidationException if value is not a valid filename.
Filenames can't contain \\ / : * ? " < > | or end with a space.
Returns the value argument.
Note that this validates filenames... | [
"def",
"validateFilename",
"(",
"value",
",",
"blank",
"=",
"False",
",",
"strip",
"=",
"None",
",",
"allowlistRegexes",
"=",
"None",
",",
"blocklistRegexes",
"=",
"None",
",",
"excMsg",
"=",
"None",
")",
":",
"returnNow",
",",
"value",
"=",
"_prevalidatio... | Raises ValidationException if value is not a valid filename.
Filenames can't contain \\ / : * ? " < > | or end with a space.
Returns the value argument.
Note that this validates filenames, not filepaths. The / and \\ characters
are invalid for filenames.
* value (str): The value being validated as... | [
"Raises",
"ValidationException",
"if",
"value",
"is",
"not",
"a",
"valid",
"filename",
".",
"Filenames",
"can",
"t",
"contain",
"\\\\",
"/",
":",
"*",
"?",
"<",
">",
"|",
"or",
"end",
"with",
"a",
"space",
".",
"Returns",
"the",
"value",
"argument",
".... | 3ca27228abb7355d14bbf8abc225c63366379e44 | https://github.com/asweigart/pysimplevalidate/blob/3ca27228abb7355d14bbf8abc225c63366379e44/src/pysimplevalidate/__init__.py#L758-L792 | train |
asweigart/pysimplevalidate | src/pysimplevalidate/__init__.py | validateFilepath | def validateFilepath(value, blank=False, strip=None, allowlistRegexes=None, blocklistRegexes=None, excMsg=None, mustExist=False):
r"""Raises ValidationException if value is not a valid filename.
Filenames can't contain \\ / : * ? " < > |
Returns the value argument.
* value (str): The value being valida... | python | def validateFilepath(value, blank=False, strip=None, allowlistRegexes=None, blocklistRegexes=None, excMsg=None, mustExist=False):
r"""Raises ValidationException if value is not a valid filename.
Filenames can't contain \\ / : * ? " < > |
Returns the value argument.
* value (str): The value being valida... | [
"def",
"validateFilepath",
"(",
"value",
",",
"blank",
"=",
"False",
",",
"strip",
"=",
"None",
",",
"allowlistRegexes",
"=",
"None",
",",
"blocklistRegexes",
"=",
"None",
",",
"excMsg",
"=",
"None",
",",
"mustExist",
"=",
"False",
")",
":",
"returnNow",
... | r"""Raises ValidationException if value is not a valid filename.
Filenames can't contain \\ / : * ? " < > |
Returns the value argument.
* value (str): The value being validated as an IP address.
* blank (bool): If True, a blank string will be accepted. Defaults to False.
* strip (bool, str, None): ... | [
"r",
"Raises",
"ValidationException",
"if",
"value",
"is",
"not",
"a",
"valid",
"filename",
".",
"Filenames",
"can",
"t",
"contain",
"\\\\",
"/",
":",
"*",
"?",
"<",
">",
"|",
"Returns",
"the",
"value",
"argument",
"."
] | 3ca27228abb7355d14bbf8abc225c63366379e44 | https://github.com/asweigart/pysimplevalidate/blob/3ca27228abb7355d14bbf8abc225c63366379e44/src/pysimplevalidate/__init__.py#L795-L830 | train |
asweigart/pysimplevalidate | src/pysimplevalidate/__init__.py | validateIP | def validateIP(value, blank=False, strip=None, allowlistRegexes=None, blocklistRegexes=None, excMsg=None):
"""Raises ValidationException if value is not an IPv4 or IPv6 address.
Returns the value argument.
* value (str): The value being validated as an IP address.
* blank (bool): If True, a blank strin... | python | def validateIP(value, blank=False, strip=None, allowlistRegexes=None, blocklistRegexes=None, excMsg=None):
"""Raises ValidationException if value is not an IPv4 or IPv6 address.
Returns the value argument.
* value (str): The value being validated as an IP address.
* blank (bool): If True, a blank strin... | [
"def",
"validateIP",
"(",
"value",
",",
"blank",
"=",
"False",
",",
"strip",
"=",
"None",
",",
"allowlistRegexes",
"=",
"None",
",",
"blocklistRegexes",
"=",
"None",
",",
"excMsg",
"=",
"None",
")",
":",
"# Validate parameters.",
"_validateGenericParameters",
... | Raises ValidationException if value is not an IPv4 or IPv6 address.
Returns the value argument.
* value (str): The value being validated as an IP address.
* blank (bool): If True, a blank string will be accepted. Defaults to False.
* strip (bool, str, None): If None, whitespace is stripped from value. ... | [
"Raises",
"ValidationException",
"if",
"value",
"is",
"not",
"an",
"IPv4",
"or",
"IPv6",
"address",
".",
"Returns",
"the",
"value",
"argument",
"."
] | 3ca27228abb7355d14bbf8abc225c63366379e44 | https://github.com/asweigart/pysimplevalidate/blob/3ca27228abb7355d14bbf8abc225c63366379e44/src/pysimplevalidate/__init__.py#L833-L881 | train |
asweigart/pysimplevalidate | src/pysimplevalidate/__init__.py | validateRegex | def validateRegex(value, regex, flags=0, blank=False, strip=None, allowlistRegexes=None, blocklistRegexes=None, excMsg=None):
"""Raises ValidationException if value does not match the regular expression in regex.
Returns the value argument.
This is similar to calling inputStr() and using the allowlistRegex... | python | def validateRegex(value, regex, flags=0, blank=False, strip=None, allowlistRegexes=None, blocklistRegexes=None, excMsg=None):
"""Raises ValidationException if value does not match the regular expression in regex.
Returns the value argument.
This is similar to calling inputStr() and using the allowlistRegex... | [
"def",
"validateRegex",
"(",
"value",
",",
"regex",
",",
"flags",
"=",
"0",
",",
"blank",
"=",
"False",
",",
"strip",
"=",
"None",
",",
"allowlistRegexes",
"=",
"None",
",",
"blocklistRegexes",
"=",
"None",
",",
"excMsg",
"=",
"None",
")",
":",
"# Vali... | Raises ValidationException if value does not match the regular expression in regex.
Returns the value argument.
This is similar to calling inputStr() and using the allowlistRegexes
keyword argument, however, validateRegex() allows you to pass regex
flags such as re.IGNORECASE or re.VERBOSE. You can als... | [
"Raises",
"ValidationException",
"if",
"value",
"does",
"not",
"match",
"the",
"regular",
"expression",
"in",
"regex",
".",
"Returns",
"the",
"value",
"argument",
"."
] | 3ca27228abb7355d14bbf8abc225c63366379e44 | https://github.com/asweigart/pysimplevalidate/blob/3ca27228abb7355d14bbf8abc225c63366379e44/src/pysimplevalidate/__init__.py#L959-L1005 | train |
asweigart/pysimplevalidate | src/pysimplevalidate/__init__.py | validateRegexStr | def validateRegexStr(value, blank=False, strip=None, allowlistRegexes=None, blocklistRegexes=None, excMsg=None):
"""Raises ValidationException if value can't be used as a regular expression string.
Returns the value argument as a regex object.
If you want to check if a string matches a regular expression, ... | python | def validateRegexStr(value, blank=False, strip=None, allowlistRegexes=None, blocklistRegexes=None, excMsg=None):
"""Raises ValidationException if value can't be used as a regular expression string.
Returns the value argument as a regex object.
If you want to check if a string matches a regular expression, ... | [
"def",
"validateRegexStr",
"(",
"value",
",",
"blank",
"=",
"False",
",",
"strip",
"=",
"None",
",",
"allowlistRegexes",
"=",
"None",
",",
"blocklistRegexes",
"=",
"None",
",",
"excMsg",
"=",
"None",
")",
":",
"# TODO - I'd be nice to check regexes in other langua... | Raises ValidationException if value can't be used as a regular expression string.
Returns the value argument as a regex object.
If you want to check if a string matches a regular expression, call
validateRegex().
* value (str): The value being validated as a regular expression string.
* regex (str... | [
"Raises",
"ValidationException",
"if",
"value",
"can",
"t",
"be",
"used",
"as",
"a",
"regular",
"expression",
"string",
".",
"Returns",
"the",
"value",
"argument",
"as",
"a",
"regex",
"object",
"."
] | 3ca27228abb7355d14bbf8abc225c63366379e44 | https://github.com/asweigart/pysimplevalidate/blob/3ca27228abb7355d14bbf8abc225c63366379e44/src/pysimplevalidate/__init__.py#L1008-L1045 | train |
asweigart/pysimplevalidate | src/pysimplevalidate/__init__.py | validateURL | def validateURL(value, blank=False, strip=None, allowlistRegexes=None, blocklistRegexes=None, excMsg=None):
"""Raises ValidationException if value is not a URL.
Returns the value argument.
The "http" or "https" protocol part of the URL is optional.
* value (str): The value being validated as a URL.
... | python | def validateURL(value, blank=False, strip=None, allowlistRegexes=None, blocklistRegexes=None, excMsg=None):
"""Raises ValidationException if value is not a URL.
Returns the value argument.
The "http" or "https" protocol part of the URL is optional.
* value (str): The value being validated as a URL.
... | [
"def",
"validateURL",
"(",
"value",
",",
"blank",
"=",
"False",
",",
"strip",
"=",
"None",
",",
"allowlistRegexes",
"=",
"None",
",",
"blocklistRegexes",
"=",
"None",
",",
"excMsg",
"=",
"None",
")",
":",
"# Reuse the logic in validateRegex()",
"try",
":",
"... | Raises ValidationException if value is not a URL.
Returns the value argument.
The "http" or "https" protocol part of the URL is optional.
* value (str): The value being validated as a URL.
* blank (bool): If True, a blank string will be accepted. Defaults to False.
* strip (bool, str, None): If N... | [
"Raises",
"ValidationException",
"if",
"value",
"is",
"not",
"a",
"URL",
".",
"Returns",
"the",
"value",
"argument",
"."
] | 3ca27228abb7355d14bbf8abc225c63366379e44 | https://github.com/asweigart/pysimplevalidate/blob/3ca27228abb7355d14bbf8abc225c63366379e44/src/pysimplevalidate/__init__.py#L1048-L1090 | train |
asweigart/pysimplevalidate | src/pysimplevalidate/__init__.py | validateEmail | def validateEmail(value, blank=False, strip=None, allowlistRegexes=None, blocklistRegexes=None, excMsg=None):
"""Raises ValidationException if value is not an email address.
Returns the value argument.
* value (str): The value being validated as an email address.
* blank (bool): If True, a blank strin... | python | def validateEmail(value, blank=False, strip=None, allowlistRegexes=None, blocklistRegexes=None, excMsg=None):
"""Raises ValidationException if value is not an email address.
Returns the value argument.
* value (str): The value being validated as an email address.
* blank (bool): If True, a blank strin... | [
"def",
"validateEmail",
"(",
"value",
",",
"blank",
"=",
"False",
",",
"strip",
"=",
"None",
",",
"allowlistRegexes",
"=",
"None",
",",
"blocklistRegexes",
"=",
"None",
",",
"excMsg",
"=",
"None",
")",
":",
"# Reuse the logic in validateRegex()",
"try",
":",
... | Raises ValidationException if value is not an email address.
Returns the value argument.
* value (str): The value being validated as an email address.
* blank (bool): If True, a blank string will be accepted. Defaults to False.
* strip (bool, str, None): If None, whitespace is stripped from value. If ... | [
"Raises",
"ValidationException",
"if",
"value",
"is",
"not",
"an",
"email",
"address",
".",
"Returns",
"the",
"value",
"argument",
"."
] | 3ca27228abb7355d14bbf8abc225c63366379e44 | https://github.com/asweigart/pysimplevalidate/blob/3ca27228abb7355d14bbf8abc225c63366379e44/src/pysimplevalidate/__init__.py#L1093-L1119 | train |
asweigart/pysimplevalidate | src/pysimplevalidate/__init__.py | validateYesNo | def validateYesNo(value, blank=False, strip=None, allowlistRegexes=None, blocklistRegexes=None, yesVal='yes', noVal='no', caseSensitive=False, excMsg=None):
"""Raises ValidationException if value is not a yes or no response.
Returns the yesVal or noVal argument, not value.
Note that value can be any case (... | python | def validateYesNo(value, blank=False, strip=None, allowlistRegexes=None, blocklistRegexes=None, yesVal='yes', noVal='no', caseSensitive=False, excMsg=None):
"""Raises ValidationException if value is not a yes or no response.
Returns the yesVal or noVal argument, not value.
Note that value can be any case (... | [
"def",
"validateYesNo",
"(",
"value",
",",
"blank",
"=",
"False",
",",
"strip",
"=",
"None",
",",
"allowlistRegexes",
"=",
"None",
",",
"blocklistRegexes",
"=",
"None",
",",
"yesVal",
"=",
"'yes'",
",",
"noVal",
"=",
"'no'",
",",
"caseSensitive",
"=",
"F... | Raises ValidationException if value is not a yes or no response.
Returns the yesVal or noVal argument, not value.
Note that value can be any case (by default) and can also just match the
* value (str): The value being validated as an email address.
* blank (bool): If True, a blank string will be acce... | [
"Raises",
"ValidationException",
"if",
"value",
"is",
"not",
"a",
"yes",
"or",
"no",
"response",
".",
"Returns",
"the",
"yesVal",
"or",
"noVal",
"argument",
"not",
"value",
"."
] | 3ca27228abb7355d14bbf8abc225c63366379e44 | https://github.com/asweigart/pysimplevalidate/blob/3ca27228abb7355d14bbf8abc225c63366379e44/src/pysimplevalidate/__init__.py#L1122-L1180 | train |
asweigart/pysimplevalidate | src/pysimplevalidate/__init__.py | validateBool | def validateBool(value, blank=False, strip=None, allowlistRegexes=None, blocklistRegexes=None, trueVal='True', falseVal='False', caseSensitive=False, excMsg=None):
"""Raises ValidationException if value is not an email address.
Returns the yesVal or noVal argument, not value.
* value (str): The value being... | python | def validateBool(value, blank=False, strip=None, allowlistRegexes=None, blocklistRegexes=None, trueVal='True', falseVal='False', caseSensitive=False, excMsg=None):
"""Raises ValidationException if value is not an email address.
Returns the yesVal or noVal argument, not value.
* value (str): The value being... | [
"def",
"validateBool",
"(",
"value",
",",
"blank",
"=",
"False",
",",
"strip",
"=",
"None",
",",
"allowlistRegexes",
"=",
"None",
",",
"blocklistRegexes",
"=",
"None",
",",
"trueVal",
"=",
"'True'",
",",
"falseVal",
"=",
"'False'",
",",
"caseSensitive",
"=... | Raises ValidationException if value is not an email address.
Returns the yesVal or noVal argument, not value.
* value (str): The value being validated as an email address.
* blank (bool): If True, a blank string will be accepted. Defaults to False.
* strip (bool, str, None): If None, whitespace is str... | [
"Raises",
"ValidationException",
"if",
"value",
"is",
"not",
"an",
"email",
"address",
".",
"Returns",
"the",
"yesVal",
"or",
"noVal",
"argument",
"not",
"value",
"."
] | 3ca27228abb7355d14bbf8abc225c63366379e44 | https://github.com/asweigart/pysimplevalidate/blob/3ca27228abb7355d14bbf8abc225c63366379e44/src/pysimplevalidate/__init__.py#L1183-L1232 | train |
asweigart/pysimplevalidate | src/pysimplevalidate/__init__.py | validateState | def validateState(value, blank=False, strip=None, allowlistRegexes=None, blocklistRegexes=None, excMsg=None, returnStateName=False):
"""Raises ValidationException if value is not a USA state.
Returns the capitalized state abbreviation, unless returnStateName is True
in which case it returns the titlecased s... | python | def validateState(value, blank=False, strip=None, allowlistRegexes=None, blocklistRegexes=None, excMsg=None, returnStateName=False):
"""Raises ValidationException if value is not a USA state.
Returns the capitalized state abbreviation, unless returnStateName is True
in which case it returns the titlecased s... | [
"def",
"validateState",
"(",
"value",
",",
"blank",
"=",
"False",
",",
"strip",
"=",
"None",
",",
"allowlistRegexes",
"=",
"None",
",",
"blocklistRegexes",
"=",
"None",
",",
"excMsg",
"=",
"None",
",",
"returnStateName",
"=",
"False",
")",
":",
"# TODO - n... | Raises ValidationException if value is not a USA state.
Returns the capitalized state abbreviation, unless returnStateName is True
in which case it returns the titlecased state name.
* value (str): The value being validated as an email address.
* blank (bool): If True, a blank string will be accepted.... | [
"Raises",
"ValidationException",
"if",
"value",
"is",
"not",
"a",
"USA",
"state",
".",
"Returns",
"the",
"capitalized",
"state",
"abbreviation",
"unless",
"returnStateName",
"is",
"True",
"in",
"which",
"case",
"it",
"returns",
"the",
"titlecased",
"state",
"nam... | 3ca27228abb7355d14bbf8abc225c63366379e44 | https://github.com/asweigart/pysimplevalidate/blob/3ca27228abb7355d14bbf8abc225c63366379e44/src/pysimplevalidate/__init__.py#L1235-L1279 | train |
asweigart/pysimplevalidate | src/pysimplevalidate/__init__.py | validateMonth | def validateMonth(value, blank=False, strip=None, allowlistRegexes=None, blocklistRegexes=None, monthNames=ENGLISH_MONTHS, excMsg=None):
"""Raises ValidationException if value is not a month, like 'Jan' or 'March'.
Returns the titlecased month.
* value (str): The value being validated as an email address.
... | python | def validateMonth(value, blank=False, strip=None, allowlistRegexes=None, blocklistRegexes=None, monthNames=ENGLISH_MONTHS, excMsg=None):
"""Raises ValidationException if value is not a month, like 'Jan' or 'March'.
Returns the titlecased month.
* value (str): The value being validated as an email address.
... | [
"def",
"validateMonth",
"(",
"value",
",",
"blank",
"=",
"False",
",",
"strip",
"=",
"None",
",",
"allowlistRegexes",
"=",
"None",
",",
"blocklistRegexes",
"=",
"None",
",",
"monthNames",
"=",
"ENGLISH_MONTHS",
",",
"excMsg",
"=",
"None",
")",
":",
"# retu... | Raises ValidationException if value is not a month, like 'Jan' or 'March'.
Returns the titlecased month.
* value (str): The value being validated as an email address.
* blank (bool): If True, a blank string will be accepted. Defaults to False.
* strip (bool, str, None): If None, whitespace is stripped... | [
"Raises",
"ValidationException",
"if",
"value",
"is",
"not",
"a",
"month",
"like",
"Jan",
"or",
"March",
".",
"Returns",
"the",
"titlecased",
"month",
"."
] | 3ca27228abb7355d14bbf8abc225c63366379e44 | https://github.com/asweigart/pysimplevalidate/blob/3ca27228abb7355d14bbf8abc225c63366379e44/src/pysimplevalidate/__init__.py#L1294-L1338 | train |
asweigart/pysimplevalidate | src/pysimplevalidate/__init__.py | validateDayOfWeek | def validateDayOfWeek(value, blank=False, strip=None, allowlistRegexes=None, blocklistRegexes=None, dayNames=ENGLISH_DAYS_OF_WEEK, excMsg=None):
"""Raises ValidationException if value is not a day of the week, such as 'Mon' or 'Friday'.
Returns the titlecased day of the week.
* value (str): The value being... | python | def validateDayOfWeek(value, blank=False, strip=None, allowlistRegexes=None, blocklistRegexes=None, dayNames=ENGLISH_DAYS_OF_WEEK, excMsg=None):
"""Raises ValidationException if value is not a day of the week, such as 'Mon' or 'Friday'.
Returns the titlecased day of the week.
* value (str): The value being... | [
"def",
"validateDayOfWeek",
"(",
"value",
",",
"blank",
"=",
"False",
",",
"strip",
"=",
"None",
",",
"allowlistRegexes",
"=",
"None",
",",
"blocklistRegexes",
"=",
"None",
",",
"dayNames",
"=",
"ENGLISH_DAYS_OF_WEEK",
",",
"excMsg",
"=",
"None",
")",
":",
... | Raises ValidationException if value is not a day of the week, such as 'Mon' or 'Friday'.
Returns the titlecased day of the week.
* value (str): The value being validated as a day of the week.
* blank (bool): If True, a blank string will be accepted. Defaults to False.
* strip (bool, str, None): If Non... | [
"Raises",
"ValidationException",
"if",
"value",
"is",
"not",
"a",
"day",
"of",
"the",
"week",
"such",
"as",
"Mon",
"or",
"Friday",
".",
"Returns",
"the",
"titlecased",
"day",
"of",
"the",
"week",
"."
] | 3ca27228abb7355d14bbf8abc225c63366379e44 | https://github.com/asweigart/pysimplevalidate/blob/3ca27228abb7355d14bbf8abc225c63366379e44/src/pysimplevalidate/__init__.py#L1341-L1369 | train |
asweigart/pysimplevalidate | src/pysimplevalidate/__init__.py | validateDayOfMonth | def validateDayOfMonth(value, year, month, blank=False, strip=None, allowlistRegexes=None, blocklistRegexes=None, excMsg=None):
"""Raises ValidationException if value is not a day of the month, from
1 to 28, 29, 30, or 31 depending on the month and year.
Returns value.
* value (str): The value being va... | python | def validateDayOfMonth(value, year, month, blank=False, strip=None, allowlistRegexes=None, blocklistRegexes=None, excMsg=None):
"""Raises ValidationException if value is not a day of the month, from
1 to 28, 29, 30, or 31 depending on the month and year.
Returns value.
* value (str): The value being va... | [
"def",
"validateDayOfMonth",
"(",
"value",
",",
"year",
",",
"month",
",",
"blank",
"=",
"False",
",",
"strip",
"=",
"None",
",",
"allowlistRegexes",
"=",
"None",
",",
"blocklistRegexes",
"=",
"None",
",",
"excMsg",
"=",
"None",
")",
":",
"try",
":",
"... | Raises ValidationException if value is not a day of the month, from
1 to 28, 29, 30, or 31 depending on the month and year.
Returns value.
* value (str): The value being validated as existing as a numbered day in the given year and month.
* year (int): The given year.
* month (int): The given month... | [
"Raises",
"ValidationException",
"if",
"value",
"is",
"not",
"a",
"day",
"of",
"the",
"month",
"from",
"1",
"to",
"28",
"29",
"30",
"or",
"31",
"depending",
"on",
"the",
"month",
"and",
"year",
".",
"Returns",
"value",
"."
] | 3ca27228abb7355d14bbf8abc225c63366379e44 | https://github.com/asweigart/pysimplevalidate/blob/3ca27228abb7355d14bbf8abc225c63366379e44/src/pysimplevalidate/__init__.py#L1373-L1411 | train |
SavinaRoja/OpenAccess_EPUB | src/openaccess_epub/utils/logs.py | get_level | def get_level(level_string):
"""
Returns an appropriate logging level integer from a string name
"""
levels = {'debug': logging.DEBUG, 'info': logging.INFO,
'warning': logging.WARNING, 'error': logging.ERROR,
'critical': logging.CRITICAL}
try:
level = levels[level... | python | def get_level(level_string):
"""
Returns an appropriate logging level integer from a string name
"""
levels = {'debug': logging.DEBUG, 'info': logging.INFO,
'warning': logging.WARNING, 'error': logging.ERROR,
'critical': logging.CRITICAL}
try:
level = levels[level... | [
"def",
"get_level",
"(",
"level_string",
")",
":",
"levels",
"=",
"{",
"'debug'",
":",
"logging",
".",
"DEBUG",
",",
"'info'",
":",
"logging",
".",
"INFO",
",",
"'warning'",
":",
"logging",
".",
"WARNING",
",",
"'error'",
":",
"logging",
".",
"ERROR",
... | Returns an appropriate logging level integer from a string name | [
"Returns",
"an",
"appropriate",
"logging",
"level",
"integer",
"from",
"a",
"string",
"name"
] | 6b77ba30b7394fd003920e7a7957bca963a90656 | https://github.com/SavinaRoja/OpenAccess_EPUB/blob/6b77ba30b7394fd003920e7a7957bca963a90656/src/openaccess_epub/utils/logs.py#L15-L27 | train |
SavinaRoja/OpenAccess_EPUB | src/openaccess_epub/utils/logs.py | config_logging | def config_logging(no_log_file, log_to, log_level, silent, verbosity):
"""
Configures and generates a Logger object, 'openaccess_epub' based on common
parameters used for console interface script execution in OpenAccess_EPUB.
These parameters are:
no_log_file
Boolean. Disables logging t... | python | def config_logging(no_log_file, log_to, log_level, silent, verbosity):
"""
Configures and generates a Logger object, 'openaccess_epub' based on common
parameters used for console interface script execution in OpenAccess_EPUB.
These parameters are:
no_log_file
Boolean. Disables logging t... | [
"def",
"config_logging",
"(",
"no_log_file",
",",
"log_to",
",",
"log_level",
",",
"silent",
",",
"verbosity",
")",
":",
"log_level",
"=",
"get_level",
"(",
"log_level",
")",
"console_level",
"=",
"get_level",
"(",
"verbosity",
")",
"#We want to configure our open... | Configures and generates a Logger object, 'openaccess_epub' based on common
parameters used for console interface script execution in OpenAccess_EPUB.
These parameters are:
no_log_file
Boolean. Disables logging to file. If set to True, log_to and
log_level become irrelevant.
log... | [
"Configures",
"and",
"generates",
"a",
"Logger",
"object",
"openaccess_epub",
"based",
"on",
"common",
"parameters",
"used",
"for",
"console",
"interface",
"script",
"execution",
"in",
"OpenAccess_EPUB",
"."
] | 6b77ba30b7394fd003920e7a7957bca963a90656 | https://github.com/SavinaRoja/OpenAccess_EPUB/blob/6b77ba30b7394fd003920e7a7957bca963a90656/src/openaccess_epub/utils/logs.py#L38-L82 | train |
SavinaRoja/OpenAccess_EPUB | src/openaccess_epub/utils/logs.py | replace_filehandler | def replace_filehandler(logname, new_file, level=None, frmt=None):
"""
This utility function will remove a previous Logger FileHandler, if one
exists, and add a new filehandler.
Parameters:
logname
The name of the log to reconfigure, 'openaccess_epub' for example
new_file
... | python | def replace_filehandler(logname, new_file, level=None, frmt=None):
"""
This utility function will remove a previous Logger FileHandler, if one
exists, and add a new filehandler.
Parameters:
logname
The name of the log to reconfigure, 'openaccess_epub' for example
new_file
... | [
"def",
"replace_filehandler",
"(",
"logname",
",",
"new_file",
",",
"level",
"=",
"None",
",",
"frmt",
"=",
"None",
")",
":",
"#Call up the Logger to get reconfigured",
"log",
"=",
"logging",
".",
"getLogger",
"(",
"logname",
")",
"#Set up defaults and whether expli... | This utility function will remove a previous Logger FileHandler, if one
exists, and add a new filehandler.
Parameters:
logname
The name of the log to reconfigure, 'openaccess_epub' for example
new_file
The file location for the new FileHandler
level
Optional. Lev... | [
"This",
"utility",
"function",
"will",
"remove",
"a",
"previous",
"Logger",
"FileHandler",
"if",
"one",
"exists",
"and",
"add",
"a",
"new",
"filehandler",
"."
] | 6b77ba30b7394fd003920e7a7957bca963a90656 | https://github.com/SavinaRoja/OpenAccess_EPUB/blob/6b77ba30b7394fd003920e7a7957bca963a90656/src/openaccess_epub/utils/logs.py#L85-L152 | train |
MSchnei/pyprf_feature | pyprf_feature/analysis/model_creation_utils.py | rmp_pixel_deg_xys | def rmp_pixel_deg_xys(vecX, vecY, vecPrfSd, tplPngSize,
varExtXmin, varExtXmax, varExtYmin, varExtYmax):
"""Remap x, y, sigma parameters from pixel to degree.
Parameters
----------
vecX : 1D numpy array
Array with possible x parametrs in pixels
vecY : 1D numpy array
... | python | def rmp_pixel_deg_xys(vecX, vecY, vecPrfSd, tplPngSize,
varExtXmin, varExtXmax, varExtYmin, varExtYmax):
"""Remap x, y, sigma parameters from pixel to degree.
Parameters
----------
vecX : 1D numpy array
Array with possible x parametrs in pixels
vecY : 1D numpy array
... | [
"def",
"rmp_pixel_deg_xys",
"(",
"vecX",
",",
"vecY",
",",
"vecPrfSd",
",",
"tplPngSize",
",",
"varExtXmin",
",",
"varExtXmax",
",",
"varExtYmin",
",",
"varExtYmax",
")",
":",
"# Remap modelled x-positions of the pRFs:",
"vecXdgr",
"=",
"rmp_rng",
"(",
"vecX",
","... | Remap x, y, sigma parameters from pixel to degree.
Parameters
----------
vecX : 1D numpy array
Array with possible x parametrs in pixels
vecY : 1D numpy array
Array with possible y parametrs in pixels
vecPrfSd : 1D numpy array
Array with possible sd parametrs in pixels
t... | [
"Remap",
"x",
"y",
"sigma",
"parameters",
"from",
"pixel",
"to",
"degree",
"."
] | 49004ede7ae1ddee07a30afe9ce3e2776750805c | https://github.com/MSchnei/pyprf_feature/blob/49004ede7ae1ddee07a30afe9ce3e2776750805c/pyprf_feature/analysis/model_creation_utils.py#L88-L144 | train |
MSchnei/pyprf_feature | pyprf_feature/analysis/model_creation_utils.py | crt_mdl_prms | def crt_mdl_prms(tplPngSize, varNum1, varExtXmin, varExtXmax, varNum2,
varExtYmin, varExtYmax, varNumPrfSizes, varPrfStdMin,
varPrfStdMax, kwUnt='pix', kwCrd='crt'):
"""Create an array with all possible model parameter combinations
Parameters
----------
tplPngSize : t... | python | def crt_mdl_prms(tplPngSize, varNum1, varExtXmin, varExtXmax, varNum2,
varExtYmin, varExtYmax, varNumPrfSizes, varPrfStdMin,
varPrfStdMax, kwUnt='pix', kwCrd='crt'):
"""Create an array with all possible model parameter combinations
Parameters
----------
tplPngSize : t... | [
"def",
"crt_mdl_prms",
"(",
"tplPngSize",
",",
"varNum1",
",",
"varExtXmin",
",",
"varExtXmax",
",",
"varNum2",
",",
"varExtYmin",
",",
"varExtYmax",
",",
"varNumPrfSizes",
",",
"varPrfStdMin",
",",
"varPrfStdMax",
",",
"kwUnt",
"=",
"'pix'",
",",
"kwCrd",
"="... | Create an array with all possible model parameter combinations
Parameters
----------
tplPngSize : tuple, 2
Pixel dimensions of the visual space (width, height).
varNum1 : int, positive
Number of x-positions to model
varExtXmin : float
Extent of visual space from centre in ne... | [
"Create",
"an",
"array",
"with",
"all",
"possible",
"model",
"parameter",
"combinations"
] | 49004ede7ae1ddee07a30afe9ce3e2776750805c | https://github.com/MSchnei/pyprf_feature/blob/49004ede7ae1ddee07a30afe9ce3e2776750805c/pyprf_feature/analysis/model_creation_utils.py#L147-L305 | train |
MSchnei/pyprf_feature | pyprf_feature/analysis/model_creation_utils.py | crt_mdl_rsp | def crt_mdl_rsp(arySptExpInf, tplPngSize, aryMdlParams, varPar, strCrd='crt',
lgcPrint=True):
"""Create responses of 2D Gauss models to spatial conditions.
Parameters
----------
arySptExpInf : 3d numpy array, shape [n_x_pix, n_y_pix, n_conditions]
All spatial conditions stacked ... | python | def crt_mdl_rsp(arySptExpInf, tplPngSize, aryMdlParams, varPar, strCrd='crt',
lgcPrint=True):
"""Create responses of 2D Gauss models to spatial conditions.
Parameters
----------
arySptExpInf : 3d numpy array, shape [n_x_pix, n_y_pix, n_conditions]
All spatial conditions stacked ... | [
"def",
"crt_mdl_rsp",
"(",
"arySptExpInf",
",",
"tplPngSize",
",",
"aryMdlParams",
",",
"varPar",
",",
"strCrd",
"=",
"'crt'",
",",
"lgcPrint",
"=",
"True",
")",
":",
"if",
"varPar",
"==",
"1",
":",
"# if the number of cores requested by the user is equal to 1,",
... | Create responses of 2D Gauss models to spatial conditions.
Parameters
----------
arySptExpInf : 3d numpy array, shape [n_x_pix, n_y_pix, n_conditions]
All spatial conditions stacked along second axis.
tplPngSize : tuple, 2
Pixel dimensions of the visual space (width, height).
aryMdl... | [
"Create",
"responses",
"of",
"2D",
"Gauss",
"models",
"to",
"spatial",
"conditions",
"."
] | 49004ede7ae1ddee07a30afe9ce3e2776750805c | https://github.com/MSchnei/pyprf_feature/blob/49004ede7ae1ddee07a30afe9ce3e2776750805c/pyprf_feature/analysis/model_creation_utils.py#L308-L396 | train |
MSchnei/pyprf_feature | pyprf_feature/analysis/model_creation_utils.py | crt_nrl_tc | def crt_nrl_tc(aryMdlRsp, aryCnd, aryOns, aryDrt, varTr, varNumVol,
varTmpOvsmpl, lgcPrint=True):
"""Create temporally upsampled neural time courses.
Parameters
----------
aryMdlRsp : 2d numpy array, shape [n_x_pos * n_y_pos * n_sd, n_cond]
Responses of 2D Gauss models to spatial... | python | def crt_nrl_tc(aryMdlRsp, aryCnd, aryOns, aryDrt, varTr, varNumVol,
varTmpOvsmpl, lgcPrint=True):
"""Create temporally upsampled neural time courses.
Parameters
----------
aryMdlRsp : 2d numpy array, shape [n_x_pos * n_y_pos * n_sd, n_cond]
Responses of 2D Gauss models to spatial... | [
"def",
"crt_nrl_tc",
"(",
"aryMdlRsp",
",",
"aryCnd",
",",
"aryOns",
",",
"aryDrt",
",",
"varTr",
",",
"varNumVol",
",",
"varTmpOvsmpl",
",",
"lgcPrint",
"=",
"True",
")",
":",
"# adjust the input, if necessary, such that input is 2D",
"tplInpShp",
"=",
"aryMdlRsp",... | Create temporally upsampled neural time courses.
Parameters
----------
aryMdlRsp : 2d numpy array, shape [n_x_pos * n_y_pos * n_sd, n_cond]
Responses of 2D Gauss models to spatial conditions.
aryCnd : np.array
1D array with condition identifiers (every condition has its own int)
ary... | [
"Create",
"temporally",
"upsampled",
"neural",
"time",
"courses",
"."
] | 49004ede7ae1ddee07a30afe9ce3e2776750805c | https://github.com/MSchnei/pyprf_feature/blob/49004ede7ae1ddee07a30afe9ce3e2776750805c/pyprf_feature/analysis/model_creation_utils.py#L399-L476 | train |
MSchnei/pyprf_feature | pyprf_feature/analysis/model_creation_utils.py | crt_prf_tc | def crt_prf_tc(aryNrlTc, varNumVol, varTr, varTmpOvsmpl, switchHrfSet,
tplPngSize, varPar, dctPrm=None, lgcPrint=True):
"""Convolve every neural time course with HRF function.
Parameters
----------
aryNrlTc : 4d numpy array, shape [n_x_pos, n_y_pos, n_sd, n_vol]
Temporally upsamp... | python | def crt_prf_tc(aryNrlTc, varNumVol, varTr, varTmpOvsmpl, switchHrfSet,
tplPngSize, varPar, dctPrm=None, lgcPrint=True):
"""Convolve every neural time course with HRF function.
Parameters
----------
aryNrlTc : 4d numpy array, shape [n_x_pos, n_y_pos, n_sd, n_vol]
Temporally upsamp... | [
"def",
"crt_prf_tc",
"(",
"aryNrlTc",
",",
"varNumVol",
",",
"varTr",
",",
"varTmpOvsmpl",
",",
"switchHrfSet",
",",
"tplPngSize",
",",
"varPar",
",",
"dctPrm",
"=",
"None",
",",
"lgcPrint",
"=",
"True",
")",
":",
"# Create hrf time course function:",
"if",
"s... | Convolve every neural time course with HRF function.
Parameters
----------
aryNrlTc : 4d numpy array, shape [n_x_pos, n_y_pos, n_sd, n_vol]
Temporally upsampled neural time course models.
varNumVol : float, positive
Number of volumes of the (fMRI) data.
varTr : float, positive
... | [
"Convolve",
"every",
"neural",
"time",
"course",
"with",
"HRF",
"function",
"."
] | 49004ede7ae1ddee07a30afe9ce3e2776750805c | https://github.com/MSchnei/pyprf_feature/blob/49004ede7ae1ddee07a30afe9ce3e2776750805c/pyprf_feature/analysis/model_creation_utils.py#L479-L591 | train |
MSchnei/pyprf_feature | pyprf_feature/analysis/model_creation_utils.py | crt_prf_ftr_tc | def crt_prf_ftr_tc(aryMdlRsp, aryTmpExpInf, varNumVol, varTr, varTmpOvsmpl,
switchHrfSet, tplPngSize, varPar, dctPrm=None,
lgcPrint=True):
"""Create all spatial x feature prf time courses.
Parameters
----------
aryMdlRsp : 2d numpy array, shape [n_x_pos * n_y_pos *... | python | def crt_prf_ftr_tc(aryMdlRsp, aryTmpExpInf, varNumVol, varTr, varTmpOvsmpl,
switchHrfSet, tplPngSize, varPar, dctPrm=None,
lgcPrint=True):
"""Create all spatial x feature prf time courses.
Parameters
----------
aryMdlRsp : 2d numpy array, shape [n_x_pos * n_y_pos *... | [
"def",
"crt_prf_ftr_tc",
"(",
"aryMdlRsp",
",",
"aryTmpExpInf",
",",
"varNumVol",
",",
"varTr",
",",
"varTmpOvsmpl",
",",
"switchHrfSet",
",",
"tplPngSize",
",",
"varPar",
",",
"dctPrm",
"=",
"None",
",",
"lgcPrint",
"=",
"True",
")",
":",
"# Identify number o... | Create all spatial x feature prf time courses.
Parameters
----------
aryMdlRsp : 2d numpy array, shape [n_x_pos * n_y_pos * n_sd, n_cond]
Responses of 2D Gauss models to spatial conditions
aryTmpExpInf: 2d numpy array, shape [unknown, 4]
Temporal information about conditions
varNumV... | [
"Create",
"all",
"spatial",
"x",
"feature",
"prf",
"time",
"courses",
"."
] | 49004ede7ae1ddee07a30afe9ce3e2776750805c | https://github.com/MSchnei/pyprf_feature/blob/49004ede7ae1ddee07a30afe9ce3e2776750805c/pyprf_feature/analysis/model_creation_utils.py#L594-L662 | train |
MSchnei/pyprf_feature | pyprf_feature/analysis/model_creation_utils.py | fnd_unq_rws | def fnd_unq_rws(A, return_index=False, return_inverse=False):
"""Find unique rows in 2D array.
Parameters
----------
A : 2d numpy array
Array for which unique rows should be identified.
return_index : bool
Bool to decide whether I is returned.
return_inverse : bool
Bool ... | python | def fnd_unq_rws(A, return_index=False, return_inverse=False):
"""Find unique rows in 2D array.
Parameters
----------
A : 2d numpy array
Array for which unique rows should be identified.
return_index : bool
Bool to decide whether I is returned.
return_inverse : bool
Bool ... | [
"def",
"fnd_unq_rws",
"(",
"A",
",",
"return_index",
"=",
"False",
",",
"return_inverse",
"=",
"False",
")",
":",
"A",
"=",
"np",
".",
"require",
"(",
"A",
",",
"requirements",
"=",
"'C'",
")",
"assert",
"A",
".",
"ndim",
"==",
"2",
",",
"\"array mus... | Find unique rows in 2D array.
Parameters
----------
A : 2d numpy array
Array for which unique rows should be identified.
return_index : bool
Bool to decide whether I is returned.
return_inverse : bool
Bool to decide whether J is returned.
Returns
-------
B : 1d ... | [
"Find",
"unique",
"rows",
"in",
"2D",
"array",
"."
] | 49004ede7ae1ddee07a30afe9ce3e2776750805c | https://github.com/MSchnei/pyprf_feature/blob/49004ede7ae1ddee07a30afe9ce3e2776750805c/pyprf_feature/analysis/model_creation_utils.py#L665-L699 | train |
bachya/pyflunearyou | pyflunearyou/client.py | Client._request | async def _request(
self, method: str, endpoint: str, *, headers: dict = None) -> dict:
"""Make a request against air-matters.com."""
url = '{0}/{1}'.format(API_URL_SCAFFOLD, endpoint)
if not headers:
headers = {}
headers.update({
'Host': DEFAULT_HOST... | python | async def _request(
self, method: str, endpoint: str, *, headers: dict = None) -> dict:
"""Make a request against air-matters.com."""
url = '{0}/{1}'.format(API_URL_SCAFFOLD, endpoint)
if not headers:
headers = {}
headers.update({
'Host': DEFAULT_HOST... | [
"async",
"def",
"_request",
"(",
"self",
",",
"method",
":",
"str",
",",
"endpoint",
":",
"str",
",",
"*",
",",
"headers",
":",
"dict",
"=",
"None",
")",
"->",
"dict",
":",
"url",
"=",
"'{0}/{1}'",
".",
"format",
"(",
"API_URL_SCAFFOLD",
",",
"endpoi... | Make a request against air-matters.com. | [
"Make",
"a",
"request",
"against",
"air",
"-",
"matters",
".",
"com",
"."
] | 16a2f839c8df851e925e010a6b5c5708386febac | https://github.com/bachya/pyflunearyou/blob/16a2f839c8df851e925e010a6b5c5708386febac/pyflunearyou/client.py#L34-L59 | train |
olivier-m/rafter | rafter/filters.py | filter_transform_response | def filter_transform_response(get_response, params):
"""
This filter process the returned response. It does 3 things:
- If the response is a ``sanic.response.HTTPResponse`` and not a
:class:`rafter.http.Response`, return it immediately.
- If the response is not a :class:`rafter.http.Response` ins... | python | def filter_transform_response(get_response, params):
"""
This filter process the returned response. It does 3 things:
- If the response is a ``sanic.response.HTTPResponse`` and not a
:class:`rafter.http.Response`, return it immediately.
- If the response is not a :class:`rafter.http.Response` ins... | [
"def",
"filter_transform_response",
"(",
"get_response",
",",
"params",
")",
":",
"async",
"def",
"decorated_filter",
"(",
"request",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"response",
"=",
"await",
"get_response",
"(",
"request",
",",
"*",
"... | This filter process the returned response. It does 3 things:
- If the response is a ``sanic.response.HTTPResponse`` and not a
:class:`rafter.http.Response`, return it immediately.
- If the response is not a :class:`rafter.http.Response` instance,
turn it to a :class:`rafter.http.Response` instance ... | [
"This",
"filter",
"process",
"the",
"returned",
"response",
".",
"It",
"does",
"3",
"things",
":"
] | aafcf8fd019f24abcf519307c4484cc6b4697c04 | https://github.com/olivier-m/rafter/blob/aafcf8fd019f24abcf519307c4484cc6b4697c04/rafter/filters.py#L11-L38 | train |
SavinaRoja/OpenAccess_EPUB | src/openaccess_epub/article/__init__.py | Article.get_publisher | def get_publisher(self):
"""
This method defines how the Article tries to determine the publisher of
the article.
This method relies on the success of the get_DOI method to fetch the
appropriate full DOI for the article. It then takes the DOI prefix
which corresponds to ... | python | def get_publisher(self):
"""
This method defines how the Article tries to determine the publisher of
the article.
This method relies on the success of the get_DOI method to fetch the
appropriate full DOI for the article. It then takes the DOI prefix
which corresponds to ... | [
"def",
"get_publisher",
"(",
"self",
")",
":",
"#For a detailed explanation of the DOI system, visit:",
"#http://www.doi.org/hb.html",
"#The basic syntax of a DOI is this <prefix>/<suffix>",
"#The <prefix> specifies a unique DOI registrant, in our case, this",
"#should correspond to the publishe... | This method defines how the Article tries to determine the publisher of
the article.
This method relies on the success of the get_DOI method to fetch the
appropriate full DOI for the article. It then takes the DOI prefix
which corresponds to the publisher and then uses that to attempt t... | [
"This",
"method",
"defines",
"how",
"the",
"Article",
"tries",
"to",
"determine",
"the",
"publisher",
"of",
"the",
"article",
"."
] | 6b77ba30b7394fd003920e7a7957bca963a90656 | https://github.com/SavinaRoja/OpenAccess_EPUB/blob/6b77ba30b7394fd003920e7a7957bca963a90656/src/openaccess_epub/article/__init__.py#L135-L170 | train |
SavinaRoja/OpenAccess_EPUB | src/openaccess_epub/article/__init__.py | Article.get_DOI | def get_DOI(self):
"""
This method defines how the Article tries to detect the DOI.
It attempts to determine the article DOI string by DTD-appropriate
inspection of the article metadata. This method should be made as
flexible as necessary to properly collect the DOI for any XML
... | python | def get_DOI(self):
"""
This method defines how the Article tries to detect the DOI.
It attempts to determine the article DOI string by DTD-appropriate
inspection of the article metadata. This method should be made as
flexible as necessary to properly collect the DOI for any XML
... | [
"def",
"get_DOI",
"(",
"self",
")",
":",
"if",
"self",
".",
"dtd_name",
"==",
"'JPTS'",
":",
"doi",
"=",
"self",
".",
"root",
".",
"xpath",
"(",
"\"./front/article-meta/article-id[@pub-id-type='doi']\"",
")",
"if",
"doi",
":",
"return",
"doi",
"[",
"0",
"]... | This method defines how the Article tries to detect the DOI.
It attempts to determine the article DOI string by DTD-appropriate
inspection of the article metadata. This method should be made as
flexible as necessary to properly collect the DOI for any XML
publishing specification.
... | [
"This",
"method",
"defines",
"how",
"the",
"Article",
"tries",
"to",
"detect",
"the",
"DOI",
"."
] | 6b77ba30b7394fd003920e7a7957bca963a90656 | https://github.com/SavinaRoja/OpenAccess_EPUB/blob/6b77ba30b7394fd003920e7a7957bca963a90656/src/openaccess_epub/article/__init__.py#L172-L195 | train |
MSchnei/pyprf_feature | pyprf_feature/analysis/find_prf_utils_np.py | np_lst_sq | def np_lst_sq(vecMdl, aryFuncChnk):
"""Least squares fitting in numpy without cross-validation.
Notes
-----
This is just a wrapper function for np.linalg.lstsq to keep piping
consistent.
"""
aryTmpBts, vecTmpRes = np.linalg.lstsq(vecMdl,
aryFuncCh... | python | def np_lst_sq(vecMdl, aryFuncChnk):
"""Least squares fitting in numpy without cross-validation.
Notes
-----
This is just a wrapper function for np.linalg.lstsq to keep piping
consistent.
"""
aryTmpBts, vecTmpRes = np.linalg.lstsq(vecMdl,
aryFuncCh... | [
"def",
"np_lst_sq",
"(",
"vecMdl",
",",
"aryFuncChnk",
")",
":",
"aryTmpBts",
",",
"vecTmpRes",
"=",
"np",
".",
"linalg",
".",
"lstsq",
"(",
"vecMdl",
",",
"aryFuncChnk",
",",
"rcond",
"=",
"-",
"1",
")",
"[",
":",
"2",
"]",
"return",
"aryTmpBts",
",... | Least squares fitting in numpy without cross-validation.
Notes
-----
This is just a wrapper function for np.linalg.lstsq to keep piping
consistent. | [
"Least",
"squares",
"fitting",
"in",
"numpy",
"without",
"cross",
"-",
"validation",
"."
] | 49004ede7ae1ddee07a30afe9ce3e2776750805c | https://github.com/MSchnei/pyprf_feature/blob/49004ede7ae1ddee07a30afe9ce3e2776750805c/pyprf_feature/analysis/find_prf_utils_np.py#L8-L21 | train |
MSchnei/pyprf_feature | pyprf_feature/analysis/find_prf_utils_np.py | np_lst_sq_xval | def np_lst_sq_xval(vecMdl, aryFuncChnk, aryIdxTrn, aryIdxTst):
"""Least squares fitting in numpy with cross-validation.
"""
varNumXval = aryIdxTrn.shape[-1]
varNumVoxChnk = aryFuncChnk.shape[-1]
# pre-allocate ary to collect cross-validation
# error for every xval fold
aryResXval = np.emp... | python | def np_lst_sq_xval(vecMdl, aryFuncChnk, aryIdxTrn, aryIdxTst):
"""Least squares fitting in numpy with cross-validation.
"""
varNumXval = aryIdxTrn.shape[-1]
varNumVoxChnk = aryFuncChnk.shape[-1]
# pre-allocate ary to collect cross-validation
# error for every xval fold
aryResXval = np.emp... | [
"def",
"np_lst_sq_xval",
"(",
"vecMdl",
",",
"aryFuncChnk",
",",
"aryIdxTrn",
",",
"aryIdxTst",
")",
":",
"varNumXval",
"=",
"aryIdxTrn",
".",
"shape",
"[",
"-",
"1",
"]",
"varNumVoxChnk",
"=",
"aryFuncChnk",
".",
"shape",
"[",
"-",
"1",
"]",
"# pre-alloca... | Least squares fitting in numpy with cross-validation. | [
"Least",
"squares",
"fitting",
"in",
"numpy",
"with",
"cross",
"-",
"validation",
"."
] | 49004ede7ae1ddee07a30afe9ce3e2776750805c | https://github.com/MSchnei/pyprf_feature/blob/49004ede7ae1ddee07a30afe9ce3e2776750805c/pyprf_feature/analysis/find_prf_utils_np.py#L24-L64 | train |
bachya/pyflunearyou | pyflunearyou/report.py | Report._raw_user_report_data | async def _raw_user_report_data(self) -> list:
"""Return user report data (if accompanied by latitude/longitude)."""
data = await self._request('get', 'map/markers')
return [
location for location in data
if location['latitude'] and location['longitude']
] | python | async def _raw_user_report_data(self) -> list:
"""Return user report data (if accompanied by latitude/longitude)."""
data = await self._request('get', 'map/markers')
return [
location for location in data
if location['latitude'] and location['longitude']
] | [
"async",
"def",
"_raw_user_report_data",
"(",
"self",
")",
"->",
"list",
":",
"data",
"=",
"await",
"self",
".",
"_request",
"(",
"'get'",
",",
"'map/markers'",
")",
"return",
"[",
"location",
"for",
"location",
"in",
"data",
"if",
"location",
"[",
"'latit... | Return user report data (if accompanied by latitude/longitude). | [
"Return",
"user",
"report",
"data",
"(",
"if",
"accompanied",
"by",
"latitude",
"/",
"longitude",
")",
"."
] | 16a2f839c8df851e925e010a6b5c5708386febac | https://github.com/bachya/pyflunearyou/blob/16a2f839c8df851e925e010a6b5c5708386febac/pyflunearyou/report.py#L29-L35 | train |
bachya/pyflunearyou | pyflunearyou/report.py | Report._raw_state_data | async def _raw_state_data(self) -> list:
"""Return a list of states."""
data = await self._request('get', 'states')
return [
location for location in data
if location['name'] != 'United States'
] | python | async def _raw_state_data(self) -> list:
"""Return a list of states."""
data = await self._request('get', 'states')
return [
location for location in data
if location['name'] != 'United States'
] | [
"async",
"def",
"_raw_state_data",
"(",
"self",
")",
"->",
"list",
":",
"data",
"=",
"await",
"self",
".",
"_request",
"(",
"'get'",
",",
"'states'",
")",
"return",
"[",
"location",
"for",
"location",
"in",
"data",
"if",
"location",
"[",
"'name'",
"]",
... | Return a list of states. | [
"Return",
"a",
"list",
"of",
"states",
"."
] | 16a2f839c8df851e925e010a6b5c5708386febac | https://github.com/bachya/pyflunearyou/blob/16a2f839c8df851e925e010a6b5c5708386febac/pyflunearyou/report.py#L37-L43 | train |
bachya/pyflunearyou | pyflunearyou/report.py | Report.nearest_by_coordinates | async def nearest_by_coordinates(
self, latitude: float, longitude: float) -> dict:
"""Get the nearest report (with local and state info) to a lat/lon."""
# Since user data is more granular than state or CDC data, find the
# user report whose coordinates are closest to the provided
... | python | async def nearest_by_coordinates(
self, latitude: float, longitude: float) -> dict:
"""Get the nearest report (with local and state info) to a lat/lon."""
# Since user data is more granular than state or CDC data, find the
# user report whose coordinates are closest to the provided
... | [
"async",
"def",
"nearest_by_coordinates",
"(",
"self",
",",
"latitude",
":",
"float",
",",
"longitude",
":",
"float",
")",
"->",
"dict",
":",
"# Since user data is more granular than state or CDC data, find the",
"# user report whose coordinates are closest to the provided",
"#... | Get the nearest report (with local and state info) to a lat/lon. | [
"Get",
"the",
"nearest",
"report",
"(",
"with",
"local",
"and",
"state",
"info",
")",
"to",
"a",
"lat",
"/",
"lon",
"."
] | 16a2f839c8df851e925e010a6b5c5708386febac | https://github.com/bachya/pyflunearyou/blob/16a2f839c8df851e925e010a6b5c5708386febac/pyflunearyou/report.py#L45-L70 | train |
mediawiki-utilities/python-mwreverts | mwreverts/historical_dict.py | HistoricalDict.initialize | def initialize(self, maxsize, history=None):
'''size specifies the maximum amount of history to keep'''
super().__init__()
self.maxsize = int(maxsize)
self.history = deque(maxlen=self.maxsize) # Preserves order history
# If `items` are specified, then initialize with them
... | python | def initialize(self, maxsize, history=None):
'''size specifies the maximum amount of history to keep'''
super().__init__()
self.maxsize = int(maxsize)
self.history = deque(maxlen=self.maxsize) # Preserves order history
# If `items` are specified, then initialize with them
... | [
"def",
"initialize",
"(",
"self",
",",
"maxsize",
",",
"history",
"=",
"None",
")",
":",
"super",
"(",
")",
".",
"__init__",
"(",
")",
"self",
".",
"maxsize",
"=",
"int",
"(",
"maxsize",
")",
"self",
".",
"history",
"=",
"deque",
"(",
"maxlen",
"="... | size specifies the maximum amount of history to keep | [
"size",
"specifies",
"the",
"maximum",
"amount",
"of",
"history",
"to",
"keep"
] | d379ac941e14e235ad82a48bd445a3dfa6cc022e | https://github.com/mediawiki-utilities/python-mwreverts/blob/d379ac941e14e235ad82a48bd445a3dfa6cc022e/mwreverts/historical_dict.py#L13-L23 | train |
mediawiki-utilities/python-mwreverts | mwreverts/historical_dict.py | HistoricalDict.insert | def insert(self, key, value):
'''Adds a new key-value pair. Returns any discarded values.'''
# Add to history and catch expectorate
if len(self.history) == self.maxsize:
expectorate = self.history[0]
else:
expectorate = None
self.history.append((key, val... | python | def insert(self, key, value):
'''Adds a new key-value pair. Returns any discarded values.'''
# Add to history and catch expectorate
if len(self.history) == self.maxsize:
expectorate = self.history[0]
else:
expectorate = None
self.history.append((key, val... | [
"def",
"insert",
"(",
"self",
",",
"key",
",",
"value",
")",
":",
"# Add to history and catch expectorate",
"if",
"len",
"(",
"self",
".",
"history",
")",
"==",
"self",
".",
"maxsize",
":",
"expectorate",
"=",
"self",
".",
"history",
"[",
"0",
"]",
"else... | Adds a new key-value pair. Returns any discarded values. | [
"Adds",
"a",
"new",
"key",
"-",
"value",
"pair",
".",
"Returns",
"any",
"discarded",
"values",
"."
] | d379ac941e14e235ad82a48bd445a3dfa6cc022e | https://github.com/mediawiki-utilities/python-mwreverts/blob/d379ac941e14e235ad82a48bd445a3dfa6cc022e/mwreverts/historical_dict.py#L28-L52 | train |
mediawiki-utilities/python-mwreverts | mwreverts/historical_dict.py | HistoricalDict.up_to | def up_to(self, key):
'''Gets the recently inserted values up to a key'''
for okey, ovalue in reversed(self.history):
if okey == key:
break
else:
yield ovalue | python | def up_to(self, key):
'''Gets the recently inserted values up to a key'''
for okey, ovalue in reversed(self.history):
if okey == key:
break
else:
yield ovalue | [
"def",
"up_to",
"(",
"self",
",",
"key",
")",
":",
"for",
"okey",
",",
"ovalue",
"in",
"reversed",
"(",
"self",
".",
"history",
")",
":",
"if",
"okey",
"==",
"key",
":",
"break",
"else",
":",
"yield",
"ovalue"
] | Gets the recently inserted values up to a key | [
"Gets",
"the",
"recently",
"inserted",
"values",
"up",
"to",
"a",
"key"
] | d379ac941e14e235ad82a48bd445a3dfa6cc022e | https://github.com/mediawiki-utilities/python-mwreverts/blob/d379ac941e14e235ad82a48bd445a3dfa6cc022e/mwreverts/historical_dict.py#L60-L66 | train |
olivier-m/rafter | rafter/app.py | Rafter.resource | def resource(self, uri, methods=frozenset({'GET'}), **kwargs):
"""
Decorates a function to be registered as a resource route.
:param uri: path of the URL
:param methods: list or tuple of methods allowed
:param host:
:param strict_slashes:
:param stream:
:... | python | def resource(self, uri, methods=frozenset({'GET'}), **kwargs):
"""
Decorates a function to be registered as a resource route.
:param uri: path of the URL
:param methods: list or tuple of methods allowed
:param host:
:param strict_slashes:
:param stream:
:... | [
"def",
"resource",
"(",
"self",
",",
"uri",
",",
"methods",
"=",
"frozenset",
"(",
"{",
"'GET'",
"}",
")",
",",
"*",
"*",
"kwargs",
")",
":",
"def",
"decorator",
"(",
"f",
")",
":",
"if",
"kwargs",
".",
"get",
"(",
"'stream'",
")",
":",
"f",
".... | Decorates a function to be registered as a resource route.
:param uri: path of the URL
:param methods: list or tuple of methods allowed
:param host:
:param strict_slashes:
:param stream:
:param version:
:param name: user defined route name for url_for
:pa... | [
"Decorates",
"a",
"function",
"to",
"be",
"registered",
"as",
"a",
"resource",
"route",
"."
] | aafcf8fd019f24abcf519307c4484cc6b4697c04 | https://github.com/olivier-m/rafter/blob/aafcf8fd019f24abcf519307c4484cc6b4697c04/rafter/app.py#L66-L88 | train |
olivier-m/rafter | rafter/app.py | Rafter.add_resource | def add_resource(self, handler, uri, methods=frozenset({'GET'}),
**kwargs):
"""
Register a resource route.
:param handler: function or class instance
:param uri: path of the URL
:param methods: list or tuple of methods allowed
:param host:
:p... | python | def add_resource(self, handler, uri, methods=frozenset({'GET'}),
**kwargs):
"""
Register a resource route.
:param handler: function or class instance
:param uri: path of the URL
:param methods: list or tuple of methods allowed
:param host:
:p... | [
"def",
"add_resource",
"(",
"self",
",",
"handler",
",",
"uri",
",",
"methods",
"=",
"frozenset",
"(",
"{",
"'GET'",
"}",
")",
",",
"*",
"*",
"kwargs",
")",
":",
"sanic_args",
"=",
"(",
"'host'",
",",
"'strict_slashes'",
",",
"'version'",
",",
"'name'"... | Register a resource route.
:param handler: function or class instance
:param uri: path of the URL
:param methods: list or tuple of methods allowed
:param host:
:param strict_slashes:
:param version:
:param name: user defined route name for url_for
:param ... | [
"Register",
"a",
"resource",
"route",
"."
] | aafcf8fd019f24abcf519307c4484cc6b4697c04 | https://github.com/olivier-m/rafter/blob/aafcf8fd019f24abcf519307c4484cc6b4697c04/rafter/app.py#L90-L127 | train |
mediawiki-utilities/python-mwreverts | mwreverts/api.py | check | def check(session, rev_id, page_id=None, radius=defaults.RADIUS,
before=None, window=None, rvprop=None):
"""
Checks the revert status of a revision. With this method, you can
determine whether an edit is a 'reverting' edit, was 'reverted' by another
edit and/or was 'reverted_to' by another ed... | python | def check(session, rev_id, page_id=None, radius=defaults.RADIUS,
before=None, window=None, rvprop=None):
"""
Checks the revert status of a revision. With this method, you can
determine whether an edit is a 'reverting' edit, was 'reverted' by another
edit and/or was 'reverted_to' by another ed... | [
"def",
"check",
"(",
"session",
",",
"rev_id",
",",
"page_id",
"=",
"None",
",",
"radius",
"=",
"defaults",
".",
"RADIUS",
",",
"before",
"=",
"None",
",",
"window",
"=",
"None",
",",
"rvprop",
"=",
"None",
")",
":",
"rev_id",
"=",
"int",
"(",
"rev... | Checks the revert status of a revision. With this method, you can
determine whether an edit is a 'reverting' edit, was 'reverted' by another
edit and/or was 'reverted_to' by another edit.
:Parameters:
session : :class:`mwapi.Session`
An API session to make use of
rev_id : int
... | [
"Checks",
"the",
"revert",
"status",
"of",
"a",
"revision",
".",
"With",
"this",
"method",
"you",
"can",
"determine",
"whether",
"an",
"edit",
"is",
"a",
"reverting",
"edit",
"was",
"reverted",
"by",
"another",
"edit",
"and",
"/",
"or",
"was",
"reverted_to... | d379ac941e14e235ad82a48bd445a3dfa6cc022e | https://github.com/mediawiki-utilities/python-mwreverts/blob/d379ac941e14e235ad82a48bd445a3dfa6cc022e/mwreverts/api.py#L58-L163 | train |
mediawiki-utilities/python-mwreverts | mwreverts/api.py | check_deleted | def check_deleted(session, rev_id, title=None, timestamp=None,
radius=defaults.RADIUS, before=None, window=None,
rvprop=None):
"""
Checks the revert status of a deleted revision. With this method, you can
determine whether an edit is a 'reverting' edit, was 'reverted' by... | python | def check_deleted(session, rev_id, title=None, timestamp=None,
radius=defaults.RADIUS, before=None, window=None,
rvprop=None):
"""
Checks the revert status of a deleted revision. With this method, you can
determine whether an edit is a 'reverting' edit, was 'reverted' by... | [
"def",
"check_deleted",
"(",
"session",
",",
"rev_id",
",",
"title",
"=",
"None",
",",
"timestamp",
"=",
"None",
",",
"radius",
"=",
"defaults",
".",
"RADIUS",
",",
"before",
"=",
"None",
",",
"window",
"=",
"None",
",",
"rvprop",
"=",
"None",
")",
"... | Checks the revert status of a deleted revision. With this method, you can
determine whether an edit is a 'reverting' edit, was 'reverted' by another
edit and/or was 'reverted_to' by another edit.
:Parameters:
session : :class:`mwapi.Session`
An API session to make use of
rev_id... | [
"Checks",
"the",
"revert",
"status",
"of",
"a",
"deleted",
"revision",
".",
"With",
"this",
"method",
"you",
"can",
"determine",
"whether",
"an",
"edit",
"is",
"a",
"reverting",
"edit",
"was",
"reverted",
"by",
"another",
"edit",
"and",
"/",
"or",
"was",
... | d379ac941e14e235ad82a48bd445a3dfa6cc022e | https://github.com/mediawiki-utilities/python-mwreverts/blob/d379ac941e14e235ad82a48bd445a3dfa6cc022e/mwreverts/api.py#L210-L286 | train |
rcbops/osa_differ | osa_differ/osa_differ.py | get_commits | def get_commits(repo_dir, old_commit, new_commit, hide_merges=True):
"""Find all commits between two commit SHAs."""
repo = Repo(repo_dir)
commits = repo.iter_commits(rev="{0}..{1}".format(old_commit, new_commit))
if hide_merges:
return [x for x in commits if not x.summary.startswith("Merge ")]
... | python | def get_commits(repo_dir, old_commit, new_commit, hide_merges=True):
"""Find all commits between two commit SHAs."""
repo = Repo(repo_dir)
commits = repo.iter_commits(rev="{0}..{1}".format(old_commit, new_commit))
if hide_merges:
return [x for x in commits if not x.summary.startswith("Merge ")]
... | [
"def",
"get_commits",
"(",
"repo_dir",
",",
"old_commit",
",",
"new_commit",
",",
"hide_merges",
"=",
"True",
")",
":",
"repo",
"=",
"Repo",
"(",
"repo_dir",
")",
"commits",
"=",
"repo",
".",
"iter_commits",
"(",
"rev",
"=",
"\"{0}..{1}\"",
".",
"format",
... | Find all commits between two commit SHAs. | [
"Find",
"all",
"commits",
"between",
"two",
"commit",
"SHAs",
"."
] | b3452436655ba3db8cc6602390fd7fdf4ef30f01 | https://github.com/rcbops/osa_differ/blob/b3452436655ba3db8cc6602390fd7fdf4ef30f01/osa_differ/osa_differ.py#L181-L188 | train |
rcbops/osa_differ | osa_differ/osa_differ.py | get_commit_url | def get_commit_url(repo_url):
"""Determine URL to view commits for repo."""
if "github.com" in repo_url:
return repo_url[:-4] if repo_url.endswith(".git") else repo_url
if "git.openstack.org" in repo_url:
uri = '/'.join(repo_url.split('/')[-2:])
return "https://github.com/{0}".format... | python | def get_commit_url(repo_url):
"""Determine URL to view commits for repo."""
if "github.com" in repo_url:
return repo_url[:-4] if repo_url.endswith(".git") else repo_url
if "git.openstack.org" in repo_url:
uri = '/'.join(repo_url.split('/')[-2:])
return "https://github.com/{0}".format... | [
"def",
"get_commit_url",
"(",
"repo_url",
")",
":",
"if",
"\"github.com\"",
"in",
"repo_url",
":",
"return",
"repo_url",
"[",
":",
"-",
"4",
"]",
"if",
"repo_url",
".",
"endswith",
"(",
"\".git\"",
")",
"else",
"repo_url",
"if",
"\"git.openstack.org\"",
"in"... | Determine URL to view commits for repo. | [
"Determine",
"URL",
"to",
"view",
"commits",
"for",
"repo",
"."
] | b3452436655ba3db8cc6602390fd7fdf4ef30f01 | https://github.com/rcbops/osa_differ/blob/b3452436655ba3db8cc6602390fd7fdf4ef30f01/osa_differ/osa_differ.py#L191-L200 | train |
rcbops/osa_differ | osa_differ/osa_differ.py | get_projects | def get_projects(osa_repo_dir, commit):
"""Get all projects from multiple YAML files."""
# Check out the correct commit SHA from the repository
repo = Repo(osa_repo_dir)
checkout(repo, commit)
yaml_files = glob.glob(
'{0}/playbooks/defaults/repo_packages/*.yml'.format(osa_repo_dir)
)
... | python | def get_projects(osa_repo_dir, commit):
"""Get all projects from multiple YAML files."""
# Check out the correct commit SHA from the repository
repo = Repo(osa_repo_dir)
checkout(repo, commit)
yaml_files = glob.glob(
'{0}/playbooks/defaults/repo_packages/*.yml'.format(osa_repo_dir)
)
... | [
"def",
"get_projects",
"(",
"osa_repo_dir",
",",
"commit",
")",
":",
"# Check out the correct commit SHA from the repository",
"repo",
"=",
"Repo",
"(",
"osa_repo_dir",
")",
"checkout",
"(",
"repo",
",",
"commit",
")",
"yaml_files",
"=",
"glob",
".",
"glob",
"(",
... | Get all projects from multiple YAML files. | [
"Get",
"all",
"projects",
"from",
"multiple",
"YAML",
"files",
"."
] | b3452436655ba3db8cc6602390fd7fdf4ef30f01 | https://github.com/rcbops/osa_differ/blob/b3452436655ba3db8cc6602390fd7fdf4ef30f01/osa_differ/osa_differ.py#L203-L219 | train |
rcbops/osa_differ | osa_differ/osa_differ.py | checkout | def checkout(repo, ref):
"""Checkout a repoself."""
# Delete local branch if it exists, remote branch will be tracked
# automatically. This prevents stale local branches from causing problems.
# It also avoids problems with appending origin/ to refs as that doesn't
# work with tags, SHAs, and upstre... | python | def checkout(repo, ref):
"""Checkout a repoself."""
# Delete local branch if it exists, remote branch will be tracked
# automatically. This prevents stale local branches from causing problems.
# It also avoids problems with appending origin/ to refs as that doesn't
# work with tags, SHAs, and upstre... | [
"def",
"checkout",
"(",
"repo",
",",
"ref",
")",
":",
"# Delete local branch if it exists, remote branch will be tracked",
"# automatically. This prevents stale local branches from causing problems.",
"# It also avoids problems with appending origin/ to refs as that doesn't",
"# work with tags... | Checkout a repoself. | [
"Checkout",
"a",
"repoself",
"."
] | b3452436655ba3db8cc6602390fd7fdf4ef30f01 | https://github.com/rcbops/osa_differ/blob/b3452436655ba3db8cc6602390fd7fdf4ef30f01/osa_differ/osa_differ.py#L222-L245 | train |
rcbops/osa_differ | osa_differ/osa_differ.py | get_roles | def get_roles(osa_repo_dir, commit, role_requirements):
"""Read OSA role information at a particular commit."""
repo = Repo(osa_repo_dir)
checkout(repo, commit)
log.info("Looking for file {f} in repo {r}".format(r=osa_repo_dir,
f=role_requirements... | python | def get_roles(osa_repo_dir, commit, role_requirements):
"""Read OSA role information at a particular commit."""
repo = Repo(osa_repo_dir)
checkout(repo, commit)
log.info("Looking for file {f} in repo {r}".format(r=osa_repo_dir,
f=role_requirements... | [
"def",
"get_roles",
"(",
"osa_repo_dir",
",",
"commit",
",",
"role_requirements",
")",
":",
"repo",
"=",
"Repo",
"(",
"osa_repo_dir",
")",
"checkout",
"(",
"repo",
",",
"commit",
")",
"log",
".",
"info",
"(",
"\"Looking for file {f} in repo {r}\"",
".",
"forma... | Read OSA role information at a particular commit. | [
"Read",
"OSA",
"role",
"information",
"at",
"a",
"particular",
"commit",
"."
] | b3452436655ba3db8cc6602390fd7fdf4ef30f01 | https://github.com/rcbops/osa_differ/blob/b3452436655ba3db8cc6602390fd7fdf4ef30f01/osa_differ/osa_differ.py#L248-L260 | train |
rcbops/osa_differ | osa_differ/osa_differ.py | make_osa_report | def make_osa_report(repo_dir, old_commit, new_commit,
args):
"""Create initial RST report header for OpenStack-Ansible."""
update_repo(repo_dir, args.osa_repo_url, args.update)
# Are these commits valid?
validate_commits(repo_dir, [old_commit, new_commit])
# Do we have a valid ... | python | def make_osa_report(repo_dir, old_commit, new_commit,
args):
"""Create initial RST report header for OpenStack-Ansible."""
update_repo(repo_dir, args.osa_repo_url, args.update)
# Are these commits valid?
validate_commits(repo_dir, [old_commit, new_commit])
# Do we have a valid ... | [
"def",
"make_osa_report",
"(",
"repo_dir",
",",
"old_commit",
",",
"new_commit",
",",
"args",
")",
":",
"update_repo",
"(",
"repo_dir",
",",
"args",
".",
"osa_repo_url",
",",
"args",
".",
"update",
")",
"# Are these commits valid?",
"validate_commits",
"(",
"rep... | Create initial RST report header for OpenStack-Ansible. | [
"Create",
"initial",
"RST",
"report",
"header",
"for",
"OpenStack",
"-",
"Ansible",
"."
] | b3452436655ba3db8cc6602390fd7fdf4ef30f01 | https://github.com/rcbops/osa_differ/blob/b3452436655ba3db8cc6602390fd7fdf4ef30f01/osa_differ/osa_differ.py#L263-L286 | train |
rcbops/osa_differ | osa_differ/osa_differ.py | make_report | def make_report(storage_directory, old_pins, new_pins, do_update=False,
version_mappings=None):
"""Create RST report from a list of projects/roles."""
report = ""
version_mappings = version_mappings or {}
for new_pin in new_pins:
repo_name, repo_url, commit_sha = new_pin
... | python | def make_report(storage_directory, old_pins, new_pins, do_update=False,
version_mappings=None):
"""Create RST report from a list of projects/roles."""
report = ""
version_mappings = version_mappings or {}
for new_pin in new_pins:
repo_name, repo_url, commit_sha = new_pin
... | [
"def",
"make_report",
"(",
"storage_directory",
",",
"old_pins",
",",
"new_pins",
",",
"do_update",
"=",
"False",
",",
"version_mappings",
"=",
"None",
")",
":",
"report",
"=",
"\"\"",
"version_mappings",
"=",
"version_mappings",
"or",
"{",
"}",
"for",
"new_pi... | Create RST report from a list of projects/roles. | [
"Create",
"RST",
"report",
"from",
"a",
"list",
"of",
"projects",
"/",
"roles",
"."
] | b3452436655ba3db8cc6602390fd7fdf4ef30f01 | https://github.com/rcbops/osa_differ/blob/b3452436655ba3db8cc6602390fd7fdf4ef30f01/osa_differ/osa_differ.py#L289-L329 | train |
rcbops/osa_differ | osa_differ/osa_differ.py | normalize_yaml | def normalize_yaml(yaml):
"""Normalize the YAML from project and role lookups.
These are returned as a list of tuples.
"""
if isinstance(yaml, list):
# Normalize the roles YAML data
normalized_yaml = [(x['name'], x['src'], x.get('version', 'HEAD'))
for x in ya... | python | def normalize_yaml(yaml):
"""Normalize the YAML from project and role lookups.
These are returned as a list of tuples.
"""
if isinstance(yaml, list):
# Normalize the roles YAML data
normalized_yaml = [(x['name'], x['src'], x.get('version', 'HEAD'))
for x in ya... | [
"def",
"normalize_yaml",
"(",
"yaml",
")",
":",
"if",
"isinstance",
"(",
"yaml",
",",
"list",
")",
":",
"# Normalize the roles YAML data",
"normalized_yaml",
"=",
"[",
"(",
"x",
"[",
"'name'",
"]",
",",
"x",
"[",
"'src'",
"]",
",",
"x",
".",
"get",
"("... | Normalize the YAML from project and role lookups.
These are returned as a list of tuples. | [
"Normalize",
"the",
"YAML",
"from",
"project",
"and",
"role",
"lookups",
"."
] | b3452436655ba3db8cc6602390fd7fdf4ef30f01 | https://github.com/rcbops/osa_differ/blob/b3452436655ba3db8cc6602390fd7fdf4ef30f01/osa_differ/osa_differ.py#L332-L351 | train |
rcbops/osa_differ | osa_differ/osa_differ.py | post_gist | def post_gist(report_data, old_sha, new_sha):
"""Post the report to a GitHub Gist and return the URL of the gist."""
payload = {
"description": ("Changes in OpenStack-Ansible between "
"{0} and {1}".format(old_sha, new_sha)),
"public": True,
"files": {
... | python | def post_gist(report_data, old_sha, new_sha):
"""Post the report to a GitHub Gist and return the URL of the gist."""
payload = {
"description": ("Changes in OpenStack-Ansible between "
"{0} and {1}".format(old_sha, new_sha)),
"public": True,
"files": {
... | [
"def",
"post_gist",
"(",
"report_data",
",",
"old_sha",
",",
"new_sha",
")",
":",
"payload",
"=",
"{",
"\"description\"",
":",
"(",
"\"Changes in OpenStack-Ansible between \"",
"\"{0} and {1}\"",
".",
"format",
"(",
"old_sha",
",",
"new_sha",
")",
")",
",",
"\"p... | Post the report to a GitHub Gist and return the URL of the gist. | [
"Post",
"the",
"report",
"to",
"a",
"GitHub",
"Gist",
"and",
"return",
"the",
"URL",
"of",
"the",
"gist",
"."
] | b3452436655ba3db8cc6602390fd7fdf4ef30f01 | https://github.com/rcbops/osa_differ/blob/b3452436655ba3db8cc6602390fd7fdf4ef30f01/osa_differ/osa_differ.py#L361-L376 | train |
rcbops/osa_differ | osa_differ/osa_differ.py | prepare_storage_dir | def prepare_storage_dir(storage_directory):
"""Prepare the storage directory."""
storage_directory = os.path.expanduser(storage_directory)
if not os.path.exists(storage_directory):
os.mkdir(storage_directory)
return storage_directory | python | def prepare_storage_dir(storage_directory):
"""Prepare the storage directory."""
storage_directory = os.path.expanduser(storage_directory)
if not os.path.exists(storage_directory):
os.mkdir(storage_directory)
return storage_directory | [
"def",
"prepare_storage_dir",
"(",
"storage_directory",
")",
":",
"storage_directory",
"=",
"os",
".",
"path",
".",
"expanduser",
"(",
"storage_directory",
")",
"if",
"not",
"os",
".",
"path",
".",
"exists",
"(",
"storage_directory",
")",
":",
"os",
".",
"mk... | Prepare the storage directory. | [
"Prepare",
"the",
"storage",
"directory",
"."
] | b3452436655ba3db8cc6602390fd7fdf4ef30f01 | https://github.com/rcbops/osa_differ/blob/b3452436655ba3db8cc6602390fd7fdf4ef30f01/osa_differ/osa_differ.py#L399-L405 | train |
rcbops/osa_differ | osa_differ/osa_differ.py | render_template | def render_template(template_file, template_vars):
"""Render a jinja template."""
# Load our Jinja templates
template_dir = "{0}/templates".format(
os.path.dirname(os.path.abspath(__file__))
)
jinja_env = jinja2.Environment(
loader=jinja2.FileSystemLoader(template_dir),
trim_... | python | def render_template(template_file, template_vars):
"""Render a jinja template."""
# Load our Jinja templates
template_dir = "{0}/templates".format(
os.path.dirname(os.path.abspath(__file__))
)
jinja_env = jinja2.Environment(
loader=jinja2.FileSystemLoader(template_dir),
trim_... | [
"def",
"render_template",
"(",
"template_file",
",",
"template_vars",
")",
":",
"# Load our Jinja templates",
"template_dir",
"=",
"\"{0}/templates\"",
".",
"format",
"(",
"os",
".",
"path",
".",
"dirname",
"(",
"os",
".",
"path",
".",
"abspath",
"(",
"__file__"... | Render a jinja template. | [
"Render",
"a",
"jinja",
"template",
"."
] | b3452436655ba3db8cc6602390fd7fdf4ef30f01 | https://github.com/rcbops/osa_differ/blob/b3452436655ba3db8cc6602390fd7fdf4ef30f01/osa_differ/osa_differ.py#L408-L420 | train |
rcbops/osa_differ | osa_differ/osa_differ.py | repo_pull | def repo_pull(repo_dir, repo_url, fetch=False):
"""Reset repository and optionally update it."""
# Make sure the repository is reset to the master branch.
repo = Repo(repo_dir)
repo.git.clean("-df")
repo.git.reset("--hard")
repo.git.checkout("master")
repo.head.reset(index=True, working_tree... | python | def repo_pull(repo_dir, repo_url, fetch=False):
"""Reset repository and optionally update it."""
# Make sure the repository is reset to the master branch.
repo = Repo(repo_dir)
repo.git.clean("-df")
repo.git.reset("--hard")
repo.git.checkout("master")
repo.head.reset(index=True, working_tree... | [
"def",
"repo_pull",
"(",
"repo_dir",
",",
"repo_url",
",",
"fetch",
"=",
"False",
")",
":",
"# Make sure the repository is reset to the master branch.",
"repo",
"=",
"Repo",
"(",
"repo_dir",
")",
"repo",
".",
"git",
".",
"clean",
"(",
"\"-df\"",
")",
"repo",
"... | Reset repository and optionally update it. | [
"Reset",
"repository",
"and",
"optionally",
"update",
"it",
"."
] | b3452436655ba3db8cc6602390fd7fdf4ef30f01 | https://github.com/rcbops/osa_differ/blob/b3452436655ba3db8cc6602390fd7fdf4ef30f01/osa_differ/osa_differ.py#L429-L456 | train |
rcbops/osa_differ | osa_differ/osa_differ.py | update_repo | def update_repo(repo_dir, repo_url, fetch=False):
"""Clone the repo if it doesn't exist already, otherwise update it."""
repo_exists = os.path.exists(repo_dir)
if not repo_exists:
log.info("Cloning repo {}".format(repo_url))
repo = repo_clone(repo_dir, repo_url)
# Make sure the repo is ... | python | def update_repo(repo_dir, repo_url, fetch=False):
"""Clone the repo if it doesn't exist already, otherwise update it."""
repo_exists = os.path.exists(repo_dir)
if not repo_exists:
log.info("Cloning repo {}".format(repo_url))
repo = repo_clone(repo_dir, repo_url)
# Make sure the repo is ... | [
"def",
"update_repo",
"(",
"repo_dir",
",",
"repo_url",
",",
"fetch",
"=",
"False",
")",
":",
"repo_exists",
"=",
"os",
".",
"path",
".",
"exists",
"(",
"repo_dir",
")",
"if",
"not",
"repo_exists",
":",
"log",
".",
"info",
"(",
"\"Cloning repo {}\"",
"."... | Clone the repo if it doesn't exist already, otherwise update it. | [
"Clone",
"the",
"repo",
"if",
"it",
"doesn",
"t",
"exist",
"already",
"otherwise",
"update",
"it",
"."
] | b3452436655ba3db8cc6602390fd7fdf4ef30f01 | https://github.com/rcbops/osa_differ/blob/b3452436655ba3db8cc6602390fd7fdf4ef30f01/osa_differ/osa_differ.py#L459-L471 | train |
rcbops/osa_differ | osa_differ/osa_differ.py | validate_commits | def validate_commits(repo_dir, commits):
"""Test if a commit is valid for the repository."""
log.debug("Validating {c} exist in {r}".format(c=commits, r=repo_dir))
repo = Repo(repo_dir)
for commit in commits:
try:
commit = repo.commit(commit)
except Exception:
msg... | python | def validate_commits(repo_dir, commits):
"""Test if a commit is valid for the repository."""
log.debug("Validating {c} exist in {r}".format(c=commits, r=repo_dir))
repo = Repo(repo_dir)
for commit in commits:
try:
commit = repo.commit(commit)
except Exception:
msg... | [
"def",
"validate_commits",
"(",
"repo_dir",
",",
"commits",
")",
":",
"log",
".",
"debug",
"(",
"\"Validating {c} exist in {r}\"",
".",
"format",
"(",
"c",
"=",
"commits",
",",
"r",
"=",
"repo_dir",
")",
")",
"repo",
"=",
"Repo",
"(",
"repo_dir",
")",
"f... | Test if a commit is valid for the repository. | [
"Test",
"if",
"a",
"commit",
"is",
"valid",
"for",
"the",
"repository",
"."
] | b3452436655ba3db8cc6602390fd7fdf4ef30f01 | https://github.com/rcbops/osa_differ/blob/b3452436655ba3db8cc6602390fd7fdf4ef30f01/osa_differ/osa_differ.py#L474-L488 | train |
rcbops/osa_differ | osa_differ/osa_differ.py | validate_commit_range | def validate_commit_range(repo_dir, old_commit, new_commit):
"""Check if commit range is valid. Flip it if needed."""
# Are there any commits between the two commits that were provided?
try:
commits = get_commits(repo_dir, old_commit, new_commit)
except Exception:
commits = []
if len... | python | def validate_commit_range(repo_dir, old_commit, new_commit):
"""Check if commit range is valid. Flip it if needed."""
# Are there any commits between the two commits that were provided?
try:
commits = get_commits(repo_dir, old_commit, new_commit)
except Exception:
commits = []
if len... | [
"def",
"validate_commit_range",
"(",
"repo_dir",
",",
"old_commit",
",",
"new_commit",
")",
":",
"# Are there any commits between the two commits that were provided?",
"try",
":",
"commits",
"=",
"get_commits",
"(",
"repo_dir",
",",
"old_commit",
",",
"new_commit",
")",
... | Check if commit range is valid. Flip it if needed. | [
"Check",
"if",
"commit",
"range",
"is",
"valid",
".",
"Flip",
"it",
"if",
"needed",
"."
] | b3452436655ba3db8cc6602390fd7fdf4ef30f01 | https://github.com/rcbops/osa_differ/blob/b3452436655ba3db8cc6602390fd7fdf4ef30f01/osa_differ/osa_differ.py#L491-L516 | train |
rcbops/osa_differ | osa_differ/osa_differ.py | get_release_notes | def get_release_notes(osa_repo_dir, osa_old_commit, osa_new_commit):
"""Get release notes between the two revisions."""
repo = Repo(osa_repo_dir)
# Get a list of tags, sorted
tags = repo.git.tag().split('\n')
tags = sorted(tags, key=LooseVersion)
# Currently major tags are being printed after r... | python | def get_release_notes(osa_repo_dir, osa_old_commit, osa_new_commit):
"""Get release notes between the two revisions."""
repo = Repo(osa_repo_dir)
# Get a list of tags, sorted
tags = repo.git.tag().split('\n')
tags = sorted(tags, key=LooseVersion)
# Currently major tags are being printed after r... | [
"def",
"get_release_notes",
"(",
"osa_repo_dir",
",",
"osa_old_commit",
",",
"osa_new_commit",
")",
":",
"repo",
"=",
"Repo",
"(",
"osa_repo_dir",
")",
"# Get a list of tags, sorted",
"tags",
"=",
"repo",
".",
"git",
".",
"tag",
"(",
")",
".",
"split",
"(",
... | Get release notes between the two revisions. | [
"Get",
"release",
"notes",
"between",
"the",
"two",
"revisions",
"."
] | b3452436655ba3db8cc6602390fd7fdf4ef30f01 | https://github.com/rcbops/osa_differ/blob/b3452436655ba3db8cc6602390fd7fdf4ef30f01/osa_differ/osa_differ.py#L519-L614 | train |
rcbops/osa_differ | osa_differ/osa_differ.py | run_osa_differ | def run_osa_differ():
"""Start here."""
# Get our arguments from the command line
args = parse_arguments()
# Set up DEBUG logging if needed
if args.debug:
log.setLevel(logging.DEBUG)
elif args.verbose:
log.setLevel(logging.INFO)
# Create the storage directory if it doesn't ... | python | def run_osa_differ():
"""Start here."""
# Get our arguments from the command line
args = parse_arguments()
# Set up DEBUG logging if needed
if args.debug:
log.setLevel(logging.DEBUG)
elif args.verbose:
log.setLevel(logging.INFO)
# Create the storage directory if it doesn't ... | [
"def",
"run_osa_differ",
"(",
")",
":",
"# Get our arguments from the command line",
"args",
"=",
"parse_arguments",
"(",
")",
"# Set up DEBUG logging if needed",
"if",
"args",
".",
"debug",
":",
"log",
".",
"setLevel",
"(",
"logging",
".",
"DEBUG",
")",
"elif",
"... | Start here. | [
"Start",
"here",
"."
] | b3452436655ba3db8cc6602390fd7fdf4ef30f01 | https://github.com/rcbops/osa_differ/blob/b3452436655ba3db8cc6602390fd7fdf4ef30f01/osa_differ/osa_differ.py#L646-L720 | train |
SavinaRoja/OpenAccess_EPUB | src/openaccess_epub/utils/element_methods.py | append_new_text | def append_new_text(destination, text, join_str=None):
"""
This method provides the functionality of adding text appropriately
underneath the destination node. This will be either to the destination's
text attribute or to the tail attribute of the last child.
"""
if join_str is None:
joi... | python | def append_new_text(destination, text, join_str=None):
"""
This method provides the functionality of adding text appropriately
underneath the destination node. This will be either to the destination's
text attribute or to the tail attribute of the last child.
"""
if join_str is None:
joi... | [
"def",
"append_new_text",
"(",
"destination",
",",
"text",
",",
"join_str",
"=",
"None",
")",
":",
"if",
"join_str",
"is",
"None",
":",
"join_str",
"=",
"' '",
"if",
"len",
"(",
"destination",
")",
">",
"0",
":",
"# Destination has children",
"last",
"=",
... | This method provides the functionality of adding text appropriately
underneath the destination node. This will be either to the destination's
text attribute or to the tail attribute of the last child. | [
"This",
"method",
"provides",
"the",
"functionality",
"of",
"adding",
"text",
"appropriately",
"underneath",
"the",
"destination",
"node",
".",
"This",
"will",
"be",
"either",
"to",
"the",
"destination",
"s",
"text",
"attribute",
"or",
"to",
"the",
"tail",
"at... | 6b77ba30b7394fd003920e7a7957bca963a90656 | https://github.com/SavinaRoja/OpenAccess_EPUB/blob/6b77ba30b7394fd003920e7a7957bca963a90656/src/openaccess_epub/utils/element_methods.py#L24-L42 | train |
SavinaRoja/OpenAccess_EPUB | src/openaccess_epub/utils/element_methods.py | append_all_below | def append_all_below(destination, source, join_str=None):
"""
Compared to xml.dom.minidom, lxml's treatment of text as .text and .tail
attributes of elements is an oddity. It can even be a little frustrating
when one is attempting to copy everything underneath some element to
another element; one ha... | python | def append_all_below(destination, source, join_str=None):
"""
Compared to xml.dom.minidom, lxml's treatment of text as .text and .tail
attributes of elements is an oddity. It can even be a little frustrating
when one is attempting to copy everything underneath some element to
another element; one ha... | [
"def",
"append_all_below",
"(",
"destination",
",",
"source",
",",
"join_str",
"=",
"None",
")",
":",
"if",
"join_str",
"is",
"None",
":",
"join_str",
"=",
"' '",
"if",
"source",
".",
"text",
"is",
"not",
"None",
":",
"# If source has text",
"if",
"len",
... | Compared to xml.dom.minidom, lxml's treatment of text as .text and .tail
attributes of elements is an oddity. It can even be a little frustrating
when one is attempting to copy everything underneath some element to
another element; one has to write in extra code to handle the text. This
method provides ... | [
"Compared",
"to",
"xml",
".",
"dom",
".",
"minidom",
"lxml",
"s",
"treatment",
"of",
"text",
"as",
".",
"text",
"and",
".",
"tail",
"attributes",
"of",
"elements",
"is",
"an",
"oddity",
".",
"It",
"can",
"even",
"be",
"a",
"little",
"frustrating",
"whe... | 6b77ba30b7394fd003920e7a7957bca963a90656 | https://github.com/SavinaRoja/OpenAccess_EPUB/blob/6b77ba30b7394fd003920e7a7957bca963a90656/src/openaccess_epub/utils/element_methods.py#L45-L70 | train |
SavinaRoja/OpenAccess_EPUB | src/openaccess_epub/utils/element_methods.py | all_text | def all_text(element):
"""
A method for extending lxml's functionality, this will find and concatenate
all text data that exists one level immediately underneath the given
element. Unlike etree.tostring(element, method='text'), this will not
recursively walk the entire underlying tree. It merely com... | python | def all_text(element):
"""
A method for extending lxml's functionality, this will find and concatenate
all text data that exists one level immediately underneath the given
element. Unlike etree.tostring(element, method='text'), this will not
recursively walk the entire underlying tree. It merely com... | [
"def",
"all_text",
"(",
"element",
")",
":",
"if",
"element",
".",
"text",
"is",
"None",
":",
"text",
"=",
"[",
"]",
"else",
":",
"text",
"=",
"[",
"element",
".",
"text",
"]",
"tails",
"=",
"[",
"child",
".",
"tail",
"for",
"child",
"in",
"eleme... | A method for extending lxml's functionality, this will find and concatenate
all text data that exists one level immediately underneath the given
element. Unlike etree.tostring(element, method='text'), this will not
recursively walk the entire underlying tree. It merely combines the element
text attribut... | [
"A",
"method",
"for",
"extending",
"lxml",
"s",
"functionality",
"this",
"will",
"find",
"and",
"concatenate",
"all",
"text",
"data",
"that",
"exists",
"one",
"level",
"immediately",
"underneath",
"the",
"given",
"element",
".",
"Unlike",
"etree",
".",
"tostri... | 6b77ba30b7394fd003920e7a7957bca963a90656 | https://github.com/SavinaRoja/OpenAccess_EPUB/blob/6b77ba30b7394fd003920e7a7957bca963a90656/src/openaccess_epub/utils/element_methods.py#L73-L87 | train |
SavinaRoja/OpenAccess_EPUB | src/openaccess_epub/utils/element_methods.py | remove_all_attributes | def remove_all_attributes(element, exclude=None):
"""
This method will remove all attributes of any provided element.
A list of strings may be passed to the keyward-argument "exclude", which
will serve as a list of attributes which will not be removed.
"""
if exclude is None:
exclude = ... | python | def remove_all_attributes(element, exclude=None):
"""
This method will remove all attributes of any provided element.
A list of strings may be passed to the keyward-argument "exclude", which
will serve as a list of attributes which will not be removed.
"""
if exclude is None:
exclude = ... | [
"def",
"remove_all_attributes",
"(",
"element",
",",
"exclude",
"=",
"None",
")",
":",
"if",
"exclude",
"is",
"None",
":",
"exclude",
"=",
"[",
"]",
"for",
"k",
"in",
"element",
".",
"attrib",
".",
"keys",
"(",
")",
":",
"if",
"k",
"not",
"in",
"ex... | This method will remove all attributes of any provided element.
A list of strings may be passed to the keyward-argument "exclude", which
will serve as a list of attributes which will not be removed. | [
"This",
"method",
"will",
"remove",
"all",
"attributes",
"of",
"any",
"provided",
"element",
"."
] | 6b77ba30b7394fd003920e7a7957bca963a90656 | https://github.com/SavinaRoja/OpenAccess_EPUB/blob/6b77ba30b7394fd003920e7a7957bca963a90656/src/openaccess_epub/utils/element_methods.py#L90-L101 | train |
SavinaRoja/OpenAccess_EPUB | src/openaccess_epub/utils/element_methods.py | ns_format | def ns_format(element, namespaced_string):
"""
Provides a convenient method for adapting a tag or attribute name to
use lxml's format. Use this for tags like ops:switch or attributes like
xlink:href.
"""
if ':' not in namespaced_string:
print('This name contains no namespace, returning i... | python | def ns_format(element, namespaced_string):
"""
Provides a convenient method for adapting a tag or attribute name to
use lxml's format. Use this for tags like ops:switch or attributes like
xlink:href.
"""
if ':' not in namespaced_string:
print('This name contains no namespace, returning i... | [
"def",
"ns_format",
"(",
"element",
",",
"namespaced_string",
")",
":",
"if",
"':'",
"not",
"in",
"namespaced_string",
":",
"print",
"(",
"'This name contains no namespace, returning it unmodified: '",
"+",
"namespaced_string",
")",
"return",
"namespaced_string",
"namespa... | Provides a convenient method for adapting a tag or attribute name to
use lxml's format. Use this for tags like ops:switch or attributes like
xlink:href. | [
"Provides",
"a",
"convenient",
"method",
"for",
"adapting",
"a",
"tag",
"or",
"attribute",
"name",
"to",
"use",
"lxml",
"s",
"format",
".",
"Use",
"this",
"for",
"tags",
"like",
"ops",
":",
"switch",
"or",
"attributes",
"like",
"xlink",
":",
"href",
"."
... | 6b77ba30b7394fd003920e7a7957bca963a90656 | https://github.com/SavinaRoja/OpenAccess_EPUB/blob/6b77ba30b7394fd003920e7a7957bca963a90656/src/openaccess_epub/utils/element_methods.py#L136-L146 | train |
SavinaRoja/OpenAccess_EPUB | src/openaccess_epub/utils/element_methods.py | rename_attributes | def rename_attributes(element, attrs):
"""
Renames the attributes of the element. Accepts the element and a dictionary
of string values. The keys are the original names, and their values will be
the altered names. This method treats all attributes as optional and will
not fail on missing attributes.... | python | def rename_attributes(element, attrs):
"""
Renames the attributes of the element. Accepts the element and a dictionary
of string values. The keys are the original names, and their values will be
the altered names. This method treats all attributes as optional and will
not fail on missing attributes.... | [
"def",
"rename_attributes",
"(",
"element",
",",
"attrs",
")",
":",
"for",
"name",
"in",
"attrs",
".",
"keys",
"(",
")",
":",
"if",
"name",
"not",
"in",
"element",
".",
"attrib",
":",
"continue",
"else",
":",
"element",
".",
"attrib",
"[",
"attrs",
"... | Renames the attributes of the element. Accepts the element and a dictionary
of string values. The keys are the original names, and their values will be
the altered names. This method treats all attributes as optional and will
not fail on missing attributes. | [
"Renames",
"the",
"attributes",
"of",
"the",
"element",
".",
"Accepts",
"the",
"element",
"and",
"a",
"dictionary",
"of",
"string",
"values",
".",
"The",
"keys",
"are",
"the",
"original",
"names",
"and",
"their",
"values",
"will",
"be",
"the",
"altered",
"... | 6b77ba30b7394fd003920e7a7957bca963a90656 | https://github.com/SavinaRoja/OpenAccess_EPUB/blob/6b77ba30b7394fd003920e7a7957bca963a90656/src/openaccess_epub/utils/element_methods.py#L149-L160 | train |
SavinaRoja/OpenAccess_EPUB | src/openaccess_epub/utils/element_methods.py | elevate_element | def elevate_element(node, adopt_name=None, adopt_attrs=None):
"""
This method serves a specialized function. It comes up most often when
working with block level elements that may not be contained within
paragraph elements, which are presented in the source document as
inline ele... | python | def elevate_element(node, adopt_name=None, adopt_attrs=None):
"""
This method serves a specialized function. It comes up most often when
working with block level elements that may not be contained within
paragraph elements, which are presented in the source document as
inline ele... | [
"def",
"elevate_element",
"(",
"node",
",",
"adopt_name",
"=",
"None",
",",
"adopt_attrs",
"=",
"None",
")",
":",
"#These must be collected before modifying the xml",
"parent",
"=",
"node",
".",
"getparent",
"(",
")",
"grandparent",
"=",
"parent",
".",
"getparent"... | This method serves a specialized function. It comes up most often when
working with block level elements that may not be contained within
paragraph elements, which are presented in the source document as
inline elements (inside a paragraph element).
It would be inappropriate to merely i... | [
"This",
"method",
"serves",
"a",
"specialized",
"function",
".",
"It",
"comes",
"up",
"most",
"often",
"when",
"working",
"with",
"block",
"level",
"elements",
"that",
"may",
"not",
"be",
"contained",
"within",
"paragraph",
"elements",
"which",
"are",
"present... | 6b77ba30b7394fd003920e7a7957bca963a90656 | https://github.com/SavinaRoja/OpenAccess_EPUB/blob/6b77ba30b7394fd003920e7a7957bca963a90656/src/openaccess_epub/utils/element_methods.py#L163-L212 | train |
SavinaRoja/OpenAccess_EPUB | src/openaccess_epub/utils/element_methods.py | replace | def replace(old, new):
"""
A simple way to replace one element node with another.
"""
parent = old.getparent()
parent.replace(old, new) | python | def replace(old, new):
"""
A simple way to replace one element node with another.
"""
parent = old.getparent()
parent.replace(old, new) | [
"def",
"replace",
"(",
"old",
",",
"new",
")",
":",
"parent",
"=",
"old",
".",
"getparent",
"(",
")",
"parent",
".",
"replace",
"(",
"old",
",",
"new",
")"
] | A simple way to replace one element node with another. | [
"A",
"simple",
"way",
"to",
"replace",
"one",
"element",
"node",
"with",
"another",
"."
] | 6b77ba30b7394fd003920e7a7957bca963a90656 | https://github.com/SavinaRoja/OpenAccess_EPUB/blob/6b77ba30b7394fd003920e7a7957bca963a90656/src/openaccess_epub/utils/element_methods.py#L223-L228 | train |
SavinaRoja/OpenAccess_EPUB | src/openaccess_epub/utils/element_methods.py | insert_before | def insert_before(old, new):
"""
A simple way to insert a new element node before the old element node among
its siblings.
"""
parent = old.getparent()
parent.insert(parent.index(old), new) | python | def insert_before(old, new):
"""
A simple way to insert a new element node before the old element node among
its siblings.
"""
parent = old.getparent()
parent.insert(parent.index(old), new) | [
"def",
"insert_before",
"(",
"old",
",",
"new",
")",
":",
"parent",
"=",
"old",
".",
"getparent",
"(",
")",
"parent",
".",
"insert",
"(",
"parent",
".",
"index",
"(",
"old",
")",
",",
"new",
")"
] | A simple way to insert a new element node before the old element node among
its siblings. | [
"A",
"simple",
"way",
"to",
"insert",
"a",
"new",
"element",
"node",
"before",
"the",
"old",
"element",
"node",
"among",
"its",
"siblings",
"."
] | 6b77ba30b7394fd003920e7a7957bca963a90656 | https://github.com/SavinaRoja/OpenAccess_EPUB/blob/6b77ba30b7394fd003920e7a7957bca963a90656/src/openaccess_epub/utils/element_methods.py#L231-L237 | train |
SavinaRoja/OpenAccess_EPUB | src/openaccess_epub/utils/element_methods.py | comment | def comment(node):
"""
Converts the node received to a comment, in place, and will also return the
comment element.
"""
parent = node.parentNode
comment = node.ownerDocument.createComment(node.toxml())
parent.replaceChild(comment, node)
return comment | python | def comment(node):
"""
Converts the node received to a comment, in place, and will also return the
comment element.
"""
parent = node.parentNode
comment = node.ownerDocument.createComment(node.toxml())
parent.replaceChild(comment, node)
return comment | [
"def",
"comment",
"(",
"node",
")",
":",
"parent",
"=",
"node",
".",
"parentNode",
"comment",
"=",
"node",
".",
"ownerDocument",
".",
"createComment",
"(",
"node",
".",
"toxml",
"(",
")",
")",
"parent",
".",
"replaceChild",
"(",
"comment",
",",
"node",
... | Converts the node received to a comment, in place, and will also return the
comment element. | [
"Converts",
"the",
"node",
"received",
"to",
"a",
"comment",
"in",
"place",
"and",
"will",
"also",
"return",
"the",
"comment",
"element",
"."
] | 6b77ba30b7394fd003920e7a7957bca963a90656 | https://github.com/SavinaRoja/OpenAccess_EPUB/blob/6b77ba30b7394fd003920e7a7957bca963a90656/src/openaccess_epub/utils/element_methods.py#L240-L248 | train |
SavinaRoja/OpenAccess_EPUB | src/openaccess_epub/utils/element_methods.py | uncomment | def uncomment(comment):
"""
Converts the comment node received to a non-commented element, in place,
and will return the new node.
This may fail, primarily due to special characters within the comment that
the xml parser is unable to handle. If it fails, this method will log an
error and return... | python | def uncomment(comment):
"""
Converts the comment node received to a non-commented element, in place,
and will return the new node.
This may fail, primarily due to special characters within the comment that
the xml parser is unable to handle. If it fails, this method will log an
error and return... | [
"def",
"uncomment",
"(",
"comment",
")",
":",
"parent",
"=",
"comment",
".",
"parentNode",
"h",
"=",
"html",
".",
"parser",
".",
"HTMLParser",
"(",
")",
"data",
"=",
"h",
".",
"unescape",
"(",
"comment",
".",
"data",
")",
"try",
":",
"node",
"=",
"... | Converts the comment node received to a non-commented element, in place,
and will return the new node.
This may fail, primarily due to special characters within the comment that
the xml parser is unable to handle. If it fails, this method will log an
error and return None | [
"Converts",
"the",
"comment",
"node",
"received",
"to",
"a",
"non",
"-",
"commented",
"element",
"in",
"place",
"and",
"will",
"return",
"the",
"new",
"node",
"."
] | 6b77ba30b7394fd003920e7a7957bca963a90656 | https://github.com/SavinaRoja/OpenAccess_EPUB/blob/6b77ba30b7394fd003920e7a7957bca963a90656/src/openaccess_epub/utils/element_methods.py#L251-L270 | train |
SavinaRoja/OpenAccess_EPUB | src/openaccess_epub/utils/element_methods.py | serialize | def serialize(element, strip=False):
"""
A handy way to serialize an element to text.
"""
text = etree.tostring(element, method='text', encoding='utf-8')
if strip:
text = text.strip()
return str(text, encoding='utf-8') | python | def serialize(element, strip=False):
"""
A handy way to serialize an element to text.
"""
text = etree.tostring(element, method='text', encoding='utf-8')
if strip:
text = text.strip()
return str(text, encoding='utf-8') | [
"def",
"serialize",
"(",
"element",
",",
"strip",
"=",
"False",
")",
":",
"text",
"=",
"etree",
".",
"tostring",
"(",
"element",
",",
"method",
"=",
"'text'",
",",
"encoding",
"=",
"'utf-8'",
")",
"if",
"strip",
":",
"text",
"=",
"text",
".",
"strip"... | A handy way to serialize an element to text. | [
"A",
"handy",
"way",
"to",
"serialize",
"an",
"element",
"to",
"text",
"."
] | 6b77ba30b7394fd003920e7a7957bca963a90656 | https://github.com/SavinaRoja/OpenAccess_EPUB/blob/6b77ba30b7394fd003920e7a7957bca963a90656/src/openaccess_epub/utils/element_methods.py#L273-L280 | train |
MSchnei/pyprf_feature | pyprf_feature/analysis/pyprf_opt_ep.py | get_arg_parse | def get_arg_parse():
"""Parses the Command Line Arguments using argparse."""
# Create parser object:
objParser = argparse.ArgumentParser()
# Add argument to namespace -config file path:
objParser.add_argument('-config', required=True,
metavar='/path/to/config.csv',
... | python | def get_arg_parse():
"""Parses the Command Line Arguments using argparse."""
# Create parser object:
objParser = argparse.ArgumentParser()
# Add argument to namespace -config file path:
objParser.add_argument('-config', required=True,
metavar='/path/to/config.csv',
... | [
"def",
"get_arg_parse",
"(",
")",
":",
"# Create parser object:",
"objParser",
"=",
"argparse",
".",
"ArgumentParser",
"(",
")",
"# Add argument to namespace -config file path:",
"objParser",
".",
"add_argument",
"(",
"'-config'",
",",
"required",
"=",
"True",
",",
"m... | Parses the Command Line Arguments using argparse. | [
"Parses",
"the",
"Command",
"Line",
"Arguments",
"using",
"argparse",
"."
] | 49004ede7ae1ddee07a30afe9ce3e2776750805c | https://github.com/MSchnei/pyprf_feature/blob/49004ede7ae1ddee07a30afe9ce3e2776750805c/pyprf_feature/analysis/pyprf_opt_ep.py#L16-L71 | train |
MSchnei/pyprf_feature | pyprf_feature/analysis/pyprf_opt_ep.py | main | def main():
"""pyprf_opt_brute entry point."""
# Get list of input arguments (without first one, which is the path to the
# function that is called): --NOTE: This is another way of accessing
# input arguments, but since we use 'argparse' it is redundant.
# lstArgs = sys.argv[1:]
strWelcome = 'p... | python | def main():
"""pyprf_opt_brute entry point."""
# Get list of input arguments (without first one, which is the path to the
# function that is called): --NOTE: This is another way of accessing
# input arguments, but since we use 'argparse' it is redundant.
# lstArgs = sys.argv[1:]
strWelcome = 'p... | [
"def",
"main",
"(",
")",
":",
"# Get list of input arguments (without first one, which is the path to the",
"# function that is called): --NOTE: This is another way of accessing",
"# input arguments, but since we use 'argparse' it is redundant.",
"# lstArgs = sys.argv[1:]",
"strWelcome",
"=",
... | pyprf_opt_brute entry point. | [
"pyprf_opt_brute",
"entry",
"point",
"."
] | 49004ede7ae1ddee07a30afe9ce3e2776750805c | https://github.com/MSchnei/pyprf_feature/blob/49004ede7ae1ddee07a30afe9ce3e2776750805c/pyprf_feature/analysis/pyprf_opt_ep.py#L74-L171 | train |
pmacosta/pcsv | pcsv/csv_file.py | _homogenize_data_filter | def _homogenize_data_filter(dfilter):
"""
Make data filter definition consistent.
Create a tuple where first element is the row filter and the second element
is the column filter
"""
if isinstance(dfilter, tuple) and (len(dfilter) == 1):
dfilter = (dfilter[0], None)
if (dfilter is N... | python | def _homogenize_data_filter(dfilter):
"""
Make data filter definition consistent.
Create a tuple where first element is the row filter and the second element
is the column filter
"""
if isinstance(dfilter, tuple) and (len(dfilter) == 1):
dfilter = (dfilter[0], None)
if (dfilter is N... | [
"def",
"_homogenize_data_filter",
"(",
"dfilter",
")",
":",
"if",
"isinstance",
"(",
"dfilter",
",",
"tuple",
")",
"and",
"(",
"len",
"(",
"dfilter",
")",
"==",
"1",
")",
":",
"dfilter",
"=",
"(",
"dfilter",
"[",
"0",
"]",
",",
"None",
")",
"if",
"... | Make data filter definition consistent.
Create a tuple where first element is the row filter and the second element
is the column filter | [
"Make",
"data",
"filter",
"definition",
"consistent",
"."
] | cd1588c19b0cd58c38bc672e396db940f88ffbd7 | https://github.com/pmacosta/pcsv/blob/cd1588c19b0cd58c38bc672e396db940f88ffbd7/pcsv/csv_file.py#L38-L61 | train |
pmacosta/pcsv | pcsv/csv_file.py | _tofloat | def _tofloat(obj):
"""Convert to float if object is a float string."""
if "inf" in obj.lower().strip():
return obj
try:
return int(obj)
except ValueError:
try:
return float(obj)
except ValueError:
return obj | python | def _tofloat(obj):
"""Convert to float if object is a float string."""
if "inf" in obj.lower().strip():
return obj
try:
return int(obj)
except ValueError:
try:
return float(obj)
except ValueError:
return obj | [
"def",
"_tofloat",
"(",
"obj",
")",
":",
"if",
"\"inf\"",
"in",
"obj",
".",
"lower",
"(",
")",
".",
"strip",
"(",
")",
":",
"return",
"obj",
"try",
":",
"return",
"int",
"(",
"obj",
")",
"except",
"ValueError",
":",
"try",
":",
"return",
"float",
... | Convert to float if object is a float string. | [
"Convert",
"to",
"float",
"if",
"object",
"is",
"a",
"float",
"string",
"."
] | cd1588c19b0cd58c38bc672e396db940f88ffbd7 | https://github.com/pmacosta/pcsv/blob/cd1588c19b0cd58c38bc672e396db940f88ffbd7/pcsv/csv_file.py#L64-L74 | train |
pmacosta/pcsv | pcsv/csv_file.py | CsvFile._in_header | def _in_header(self, col):
"""Validate column identifier(s)."""
# pylint: disable=R1704
if not self._has_header:
# Conditionally register exceptions so that they do not appear
# in situations where has_header is always True. In this way
# they are not auto-doc... | python | def _in_header(self, col):
"""Validate column identifier(s)."""
# pylint: disable=R1704
if not self._has_header:
# Conditionally register exceptions so that they do not appear
# in situations where has_header is always True. In this way
# they are not auto-doc... | [
"def",
"_in_header",
"(",
"self",
",",
"col",
")",
":",
"# pylint: disable=R1704",
"if",
"not",
"self",
".",
"_has_header",
":",
"# Conditionally register exceptions so that they do not appear",
"# in situations where has_header is always True. In this way",
"# they are not auto-do... | Validate column identifier(s). | [
"Validate",
"column",
"identifier",
"(",
"s",
")",
"."
] | cd1588c19b0cd58c38bc672e396db940f88ffbd7 | https://github.com/pmacosta/pcsv/blob/cd1588c19b0cd58c38bc672e396db940f88ffbd7/pcsv/csv_file.py#L367-L393 | train |
pmacosta/pcsv | pcsv/csv_file.py | CsvFile._validate_frow | def _validate_frow(self, frow):
"""Validate frow argument."""
is_int = isinstance(frow, int) and (not isinstance(frow, bool))
pexdoc.exh.addai("frow", not (is_int and (frow >= 0)))
return frow | python | def _validate_frow(self, frow):
"""Validate frow argument."""
is_int = isinstance(frow, int) and (not isinstance(frow, bool))
pexdoc.exh.addai("frow", not (is_int and (frow >= 0)))
return frow | [
"def",
"_validate_frow",
"(",
"self",
",",
"frow",
")",
":",
"is_int",
"=",
"isinstance",
"(",
"frow",
",",
"int",
")",
"and",
"(",
"not",
"isinstance",
"(",
"frow",
",",
"bool",
")",
")",
"pexdoc",
".",
"exh",
".",
"addai",
"(",
"\"frow\"",
",",
"... | Validate frow argument. | [
"Validate",
"frow",
"argument",
"."
] | cd1588c19b0cd58c38bc672e396db940f88ffbd7 | https://github.com/pmacosta/pcsv/blob/cd1588c19b0cd58c38bc672e396db940f88ffbd7/pcsv/csv_file.py#L489-L493 | train |
pmacosta/pcsv | pcsv/csv_file.py | CsvFile._validate_rfilter | def _validate_rfilter(self, rfilter, letter="d"):
"""Validate that all columns in filter are in header."""
if letter == "d":
pexdoc.exh.addai(
"dfilter",
(
(not self._has_header)
and any([not isinstance(item, int) for it... | python | def _validate_rfilter(self, rfilter, letter="d"):
"""Validate that all columns in filter are in header."""
if letter == "d":
pexdoc.exh.addai(
"dfilter",
(
(not self._has_header)
and any([not isinstance(item, int) for it... | [
"def",
"_validate_rfilter",
"(",
"self",
",",
"rfilter",
",",
"letter",
"=",
"\"d\"",
")",
":",
"if",
"letter",
"==",
"\"d\"",
":",
"pexdoc",
".",
"exh",
".",
"addai",
"(",
"\"dfilter\"",
",",
"(",
"(",
"not",
"self",
".",
"_has_header",
")",
"and",
... | Validate that all columns in filter are in header. | [
"Validate",
"that",
"all",
"columns",
"in",
"filter",
"are",
"in",
"header",
"."
] | cd1588c19b0cd58c38bc672e396db940f88ffbd7 | https://github.com/pmacosta/pcsv/blob/cd1588c19b0cd58c38bc672e396db940f88ffbd7/pcsv/csv_file.py#L495-L517 | train |
pmacosta/pcsv | pcsv/csv_file.py | CsvFile.data | def data(self, filtered=False, no_empty=False):
r"""
Return (filtered) file data.
The returned object is a list, each item is a sub-list corresponding
to a row of data; each item in the sub-lists contains data
corresponding to a particular column
:param filtered: Fi... | python | def data(self, filtered=False, no_empty=False):
r"""
Return (filtered) file data.
The returned object is a list, each item is a sub-list corresponding
to a row of data; each item in the sub-lists contains data
corresponding to a particular column
:param filtered: Fi... | [
"def",
"data",
"(",
"self",
",",
"filtered",
"=",
"False",
",",
"no_empty",
"=",
"False",
")",
":",
"return",
"self",
".",
"_apply_filter",
"(",
"filtered",
",",
"no_empty",
")"
] | r"""
Return (filtered) file data.
The returned object is a list, each item is a sub-list corresponding
to a row of data; each item in the sub-lists contains data
corresponding to a particular column
:param filtered: Filtering type
:type filtered: :ref:`CsvFiltered`... | [
"r",
"Return",
"(",
"filtered",
")",
"file",
"data",
"."
] | cd1588c19b0cd58c38bc672e396db940f88ffbd7 | https://github.com/pmacosta/pcsv/blob/cd1588c19b0cd58c38bc672e396db940f88ffbd7/pcsv/csv_file.py#L565-L593 | train |
pmacosta/pcsv | pcsv/csv_file.py | CsvFile.dsort | def dsort(self, order):
r"""
Sort rows.
:param order: Sort order
:type order: :ref:`CsvColFilter`
.. [[[cog cog.out(exobj.get_sphinx_autodoc()) ]]]
.. Auto-generated exceptions documentation for
.. pcsv.csv_file.CsvFile.dsort
:raises:
* Runtim... | python | def dsort(self, order):
r"""
Sort rows.
:param order: Sort order
:type order: :ref:`CsvColFilter`
.. [[[cog cog.out(exobj.get_sphinx_autodoc()) ]]]
.. Auto-generated exceptions documentation for
.. pcsv.csv_file.CsvFile.dsort
:raises:
* Runtim... | [
"def",
"dsort",
"(",
"self",
",",
"order",
")",
":",
"# Make order conforming to a list of dictionaries",
"order",
"=",
"order",
"if",
"isinstance",
"(",
"order",
",",
"list",
")",
"else",
"[",
"order",
"]",
"norder",
"=",
"[",
"{",
"item",
":",
"\"A\"",
"... | r"""
Sort rows.
:param order: Sort order
:type order: :ref:`CsvColFilter`
.. [[[cog cog.out(exobj.get_sphinx_autodoc()) ]]]
.. Auto-generated exceptions documentation for
.. pcsv.csv_file.CsvFile.dsort
:raises:
* RuntimeError (Argument \`order\` is no... | [
"r",
"Sort",
"rows",
"."
] | cd1588c19b0cd58c38bc672e396db940f88ffbd7 | https://github.com/pmacosta/pcsv/blob/cd1588c19b0cd58c38bc672e396db940f88ffbd7/pcsv/csv_file.py#L596-L643 | train |
pmacosta/pcsv | pcsv/csv_file.py | CsvFile.header | def header(self, filtered=False):
r"""
Return data header.
When the raw (input) data is used the data header is a list of the
comma-separated values file header if the file is loaded with header
(each list item is a column header) or a list of column numbers if the
file ... | python | def header(self, filtered=False):
r"""
Return data header.
When the raw (input) data is used the data header is a list of the
comma-separated values file header if the file is loaded with header
(each list item is a column header) or a list of column numbers if the
file ... | [
"def",
"header",
"(",
"self",
",",
"filtered",
"=",
"False",
")",
":",
"return",
"(",
"self",
".",
"_header",
"if",
"(",
"not",
"filtered",
")",
"or",
"(",
"filtered",
"and",
"self",
".",
"_cfilter",
"is",
"None",
")",
"else",
"self",
".",
"_cfilter"... | r"""
Return data header.
When the raw (input) data is used the data header is a list of the
comma-separated values file header if the file is loaded with header
(each list item is a column header) or a list of column numbers if the
file is loaded without header (column zero is t... | [
"r",
"Return",
"data",
"header",
"."
] | cd1588c19b0cd58c38bc672e396db940f88ffbd7 | https://github.com/pmacosta/pcsv/blob/cd1588c19b0cd58c38bc672e396db940f88ffbd7/pcsv/csv_file.py#L646-L676 | train |
pmacosta/pcsv | pcsv/csv_file.py | CsvFile.replace | def replace(self, rdata, filtered=False):
r"""
Replace data.
:param rdata: Replacement data
:type rdata: list of lists
:param filtered: Filtering type
:type filtered: :ref:`CsvFiltered`
.. [[[cog cog.out(exobj.get_sphinx_autodoc(width=63)) ]]]
.. Auto... | python | def replace(self, rdata, filtered=False):
r"""
Replace data.
:param rdata: Replacement data
:type rdata: list of lists
:param filtered: Filtering type
:type filtered: :ref:`CsvFiltered`
.. [[[cog cog.out(exobj.get_sphinx_autodoc(width=63)) ]]]
.. Auto... | [
"def",
"replace",
"(",
"self",
",",
"rdata",
",",
"filtered",
"=",
"False",
")",
":",
"# pylint: disable=R0914",
"rdata_ex",
"=",
"pexdoc",
".",
"exh",
".",
"addai",
"(",
"\"rdata\"",
")",
"rows_ex",
"=",
"pexdoc",
".",
"exh",
".",
"addex",
"(",
"ValueEr... | r"""
Replace data.
:param rdata: Replacement data
:type rdata: list of lists
:param filtered: Filtering type
:type filtered: :ref:`CsvFiltered`
.. [[[cog cog.out(exobj.get_sphinx_autodoc(width=63)) ]]]
.. Auto-generated exceptions documentation for
..... | [
"r",
"Replace",
"data",
"."
] | cd1588c19b0cd58c38bc672e396db940f88ffbd7 | https://github.com/pmacosta/pcsv/blob/cd1588c19b0cd58c38bc672e396db940f88ffbd7/pcsv/csv_file.py#L679-L742 | train |
pmacosta/pcsv | pcsv/csv_file.py | CsvFile.write | def write(self, fname=None, filtered=False, header=True, append=False):
r"""
Write (processed) data to a specified comma-separated values (CSV) file.
:param fname: Name of the comma-separated values file to be
written. If None the file from which the data originated
... | python | def write(self, fname=None, filtered=False, header=True, append=False):
r"""
Write (processed) data to a specified comma-separated values (CSV) file.
:param fname: Name of the comma-separated values file to be
written. If None the file from which the data originated
... | [
"def",
"write",
"(",
"self",
",",
"fname",
"=",
"None",
",",
"filtered",
"=",
"False",
",",
"header",
"=",
"True",
",",
"append",
"=",
"False",
")",
":",
"# pylint: disable=R0913",
"write_ex",
"=",
"pexdoc",
".",
"exh",
".",
"addex",
"(",
"ValueError",
... | r"""
Write (processed) data to a specified comma-separated values (CSV) file.
:param fname: Name of the comma-separated values file to be
written. If None the file from which the data originated
is overwritten
:type fname: FileName_
:param f... | [
"r",
"Write",
"(",
"processed",
")",
"data",
"to",
"a",
"specified",
"comma",
"-",
"separated",
"values",
"(",
"CSV",
")",
"file",
"."
] | cd1588c19b0cd58c38bc672e396db940f88ffbd7 | https://github.com/pmacosta/pcsv/blob/cd1588c19b0cd58c38bc672e396db940f88ffbd7/pcsv/csv_file.py#L788-L849 | train |
MSchnei/pyprf_feature | pyprf_feature/analysis/model_creation_main.py | model_creation | def model_creation(dicCnfg, varRat=None, strPathHrf=None):
"""
Create or load pRF model time courses.
Parameters
----------
dicCnfg : dict
Dictionary containing config parameters.
varRat : float, default None
Ratio of size suppressive surround to size of center pRF
strPathHr... | python | def model_creation(dicCnfg, varRat=None, strPathHrf=None):
"""
Create or load pRF model time courses.
Parameters
----------
dicCnfg : dict
Dictionary containing config parameters.
varRat : float, default None
Ratio of size suppressive surround to size of center pRF
strPathHr... | [
"def",
"model_creation",
"(",
"dicCnfg",
",",
"varRat",
"=",
"None",
",",
"strPathHrf",
"=",
"None",
")",
":",
"# *************************************************************************",
"# *** Load parameters from config file",
"# Load config parameters from dictionary into names... | Create or load pRF model time courses.
Parameters
----------
dicCnfg : dict
Dictionary containing config parameters.
varRat : float, default None
Ratio of size suppressive surround to size of center pRF
strPathHrf : str or None:
Path to npy file with custom hrf parameters. I... | [
"Create",
"or",
"load",
"pRF",
"model",
"time",
"courses",
"."
] | 49004ede7ae1ddee07a30afe9ce3e2776750805c | https://github.com/MSchnei/pyprf_feature/blob/49004ede7ae1ddee07a30afe9ce3e2776750805c/pyprf_feature/analysis/model_creation_main.py#L28-L267 | train |
linkhub-sdk/popbill.py | popbill/cashbillService.py | CashbillService.registIssue | def registIssue(self, CorpNum, cashbill, Memo, UserID=None):
""" 현금영수증 즉시발행
args
CorpNum : 팝빌회원 사업자번호
cashbill : 등록할 현금영수증 object. made with Cashbill(...)
UserID : 팝빌회원 아이디
return
처리결과. consist of code and message
... | python | def registIssue(self, CorpNum, cashbill, Memo, UserID=None):
""" 현금영수증 즉시발행
args
CorpNum : 팝빌회원 사업자번호
cashbill : 등록할 현금영수증 object. made with Cashbill(...)
UserID : 팝빌회원 아이디
return
처리결과. consist of code and message
... | [
"def",
"registIssue",
"(",
"self",
",",
"CorpNum",
",",
"cashbill",
",",
"Memo",
",",
"UserID",
"=",
"None",
")",
":",
"if",
"cashbill",
"==",
"None",
":",
"raise",
"PopbillException",
"(",
"-",
"99999999",
",",
"\"현금영수증 정보가 입력되지 않았습니다.\")\r",
"",
"postData"... | 현금영수증 즉시발행
args
CorpNum : 팝빌회원 사업자번호
cashbill : 등록할 현금영수증 object. made with Cashbill(...)
UserID : 팝빌회원 아이디
return
처리결과. consist of code and message
raise
PopbillException | [
"현금영수증",
"즉시발행",
"args",
"CorpNum",
":",
"팝빌회원",
"사업자번호",
"cashbill",
":",
"등록할",
"현금영수증",
"object",
".",
"made",
"with",
"Cashbill",
"(",
"...",
")",
"UserID",
":",
"팝빌회원",
"아이디",
"return",
"처리결과",
".",
"consist",
"of",
"code",
"and",
"message",
"raise"... | 68a0dd7f7a937603318e93be321fde73c50b96cc | https://github.com/linkhub-sdk/popbill.py/blob/68a0dd7f7a937603318e93be321fde73c50b96cc/popbill/cashbillService.py#L95-L116 | train |
linkhub-sdk/popbill.py | popbill/cashbillService.py | CashbillService.register | def register(self, CorpNum, cashbill, UserID=None):
""" 현금영수증 등록
args
CorpNum : 팝빌회원 사업자번호
cashbill : 등록할 현금영수증 object. made with Cashbill(...)
UserID : 팝빌회원 아이디
return
처리결과. consist of code and message
r... | python | def register(self, CorpNum, cashbill, UserID=None):
""" 현금영수증 등록
args
CorpNum : 팝빌회원 사업자번호
cashbill : 등록할 현금영수증 object. made with Cashbill(...)
UserID : 팝빌회원 아이디
return
처리결과. consist of code and message
r... | [
"def",
"register",
"(",
"self",
",",
"CorpNum",
",",
"cashbill",
",",
"UserID",
"=",
"None",
")",
":",
"if",
"cashbill",
"==",
"None",
":",
"raise",
"PopbillException",
"(",
"-",
"99999999",
",",
"\"현금영수증 정보가 입력되지 않았습니다.\")\r",
"",
"postData",
"=",
"self",
... | 현금영수증 등록
args
CorpNum : 팝빌회원 사업자번호
cashbill : 등록할 현금영수증 object. made with Cashbill(...)
UserID : 팝빌회원 아이디
return
처리결과. consist of code and message
raise
PopbillException | [
"현금영수증",
"등록",
"args",
"CorpNum",
":",
"팝빌회원",
"사업자번호",
"cashbill",
":",
"등록할",
"현금영수증",
"object",
".",
"made",
"with",
"Cashbill",
"(",
"...",
")",
"UserID",
":",
"팝빌회원",
"아이디",
"return",
"처리결과",
".",
"consist",
"of",
"code",
"and",
"message",
"raise",
... | 68a0dd7f7a937603318e93be321fde73c50b96cc | https://github.com/linkhub-sdk/popbill.py/blob/68a0dd7f7a937603318e93be321fde73c50b96cc/popbill/cashbillService.py#L118-L134 | train |
linkhub-sdk/popbill.py | popbill/cashbillService.py | CashbillService.revokeRegistIssue | def revokeRegistIssue(self, CorpNum, mgtKey, orgConfirmNum, orgTradeDate, smssendYN=False, memo=None, UserID=None,
isPartCancel=False, cancelType=None, supplyCost=None, tax=None, serviceFee=None,
totalAmount=None):
""" 취소현금영수증 즉시발행
args
... | python | def revokeRegistIssue(self, CorpNum, mgtKey, orgConfirmNum, orgTradeDate, smssendYN=False, memo=None, UserID=None,
isPartCancel=False, cancelType=None, supplyCost=None, tax=None, serviceFee=None,
totalAmount=None):
""" 취소현금영수증 즉시발행
args
... | [
"def",
"revokeRegistIssue",
"(",
"self",
",",
"CorpNum",
",",
"mgtKey",
",",
"orgConfirmNum",
",",
"orgTradeDate",
",",
"smssendYN",
"=",
"False",
",",
"memo",
"=",
"None",
",",
"UserID",
"=",
"None",
",",
"isPartCancel",
"=",
"False",
",",
"cancelType",
"... | 취소현금영수증 즉시발행
args
CorpNum : 팝빌회원 사업자번호
mgtKey : 현금영수증 문서관리번호
orgConfirmNum : 원본현금영수증 승인번호
orgTradeDate : 원본현금영수증 거래일자
smssendYN : 발행안내문자 전송여부
memo : 메모
UserID : 팝빌회원 아이디
i... | [
"취소현금영수증",
"즉시발행",
"args",
"CorpNum",
":",
"팝빌회원",
"사업자번호",
"mgtKey",
":",
"현금영수증",
"문서관리번호",
"orgConfirmNum",
":",
"원본현금영수증",
"승인번호",
"orgTradeDate",
":",
"원본현금영수증",
"거래일자",
"smssendYN",
":",
"발행안내문자",
"전송여부",
"memo",
":",
"메모",
"UserID",
":",
"팝빌회원",
"아이디"... | 68a0dd7f7a937603318e93be321fde73c50b96cc | https://github.com/linkhub-sdk/popbill.py/blob/68a0dd7f7a937603318e93be321fde73c50b96cc/popbill/cashbillService.py#L136-L174 | train |
linkhub-sdk/popbill.py | popbill/cashbillService.py | CashbillService.update | def update(self, CorpNum, MgtKey, cashbill, UserID=None):
""" 수정
args
CorpNum : 팝빌회원 사업자번호
MgtKey : 원본 현금영수증 문서관리번호
cashbill : 수정할 현금영수증 object. made with Cashbill(...)
UserID : 팝빌회원 아이디
return
처리결과. ... | python | def update(self, CorpNum, MgtKey, cashbill, UserID=None):
""" 수정
args
CorpNum : 팝빌회원 사업자번호
MgtKey : 원본 현금영수증 문서관리번호
cashbill : 수정할 현금영수증 object. made with Cashbill(...)
UserID : 팝빌회원 아이디
return
처리결과. ... | [
"def",
"update",
"(",
"self",
",",
"CorpNum",
",",
"MgtKey",
",",
"cashbill",
",",
"UserID",
"=",
"None",
")",
":",
"if",
"MgtKey",
"==",
"None",
"or",
"MgtKey",
"==",
"\"\"",
":",
"raise",
"PopbillException",
"(",
"-",
"99999999",
",",
"\"관리번호가 입력되지 않았습... | 수정
args
CorpNum : 팝빌회원 사업자번호
MgtKey : 원본 현금영수증 문서관리번호
cashbill : 수정할 현금영수증 object. made with Cashbill(...)
UserID : 팝빌회원 아이디
return
처리결과. consist of code and message
raise
Popbill... | [
"수정",
"args",
"CorpNum",
":",
"팝빌회원",
"사업자번호",
"MgtKey",
":",
"원본",
"현금영수증",
"문서관리번호",
"cashbill",
":",
"수정할",
"현금영수증",
"object",
".",
"made",
"with",
"Cashbill",
"(",
"...",
")",
"UserID",
":",
"팝빌회원",
"아이디",
"return",
"처리결과",
".",
"consist",
"of",
"c... | 68a0dd7f7a937603318e93be321fde73c50b96cc | https://github.com/linkhub-sdk/popbill.py/blob/68a0dd7f7a937603318e93be321fde73c50b96cc/popbill/cashbillService.py#L214-L233 | train |
linkhub-sdk/popbill.py | popbill/cashbillService.py | CashbillService.issue | def issue(self, CorpNum, MgtKey, Memo=None, UserID=None):
""" 발행
args
CorpNum : 팝빌회원 사업자번호
MgtKey : 원본 현금영수증 문서관리번호
Memo : 발행 메모
UserID : 팝빌회원 아이디
return
처리결과. consist of code and message
... | python | def issue(self, CorpNum, MgtKey, Memo=None, UserID=None):
""" 발행
args
CorpNum : 팝빌회원 사업자번호
MgtKey : 원본 현금영수증 문서관리번호
Memo : 발행 메모
UserID : 팝빌회원 아이디
return
처리결과. consist of code and message
... | [
"def",
"issue",
"(",
"self",
",",
"CorpNum",
",",
"MgtKey",
",",
"Memo",
"=",
"None",
",",
"UserID",
"=",
"None",
")",
":",
"if",
"MgtKey",
"==",
"None",
"or",
"MgtKey",
"==",
"\"\"",
":",
"raise",
"PopbillException",
"(",
"-",
"99999999",
",",
"\"관리... | 발행
args
CorpNum : 팝빌회원 사업자번호
MgtKey : 원본 현금영수증 문서관리번호
Memo : 발행 메모
UserID : 팝빌회원 아이디
return
처리결과. consist of code and message
raise
PopbillException | [
"발행",
"args",
"CorpNum",
":",
"팝빌회원",
"사업자번호",
"MgtKey",
":",
"원본",
"현금영수증",
"문서관리번호",
"Memo",
":",
"발행",
"메모",
"UserID",
":",
"팝빌회원",
"아이디",
"return",
"처리결과",
".",
"consist",
"of",
"code",
"and",
"message",
"raise",
"PopbillException"
] | 68a0dd7f7a937603318e93be321fde73c50b96cc | https://github.com/linkhub-sdk/popbill.py/blob/68a0dd7f7a937603318e93be321fde73c50b96cc/popbill/cashbillService.py#L235-L259 | train |
linkhub-sdk/popbill.py | popbill/cashbillService.py | CashbillService.delete | def delete(self, CorpNum, MgtKey, UserID=None):
""" 삭제
args
CorpNum : 팝빌회원 사업자번호
MgtKey : 원본 현금영수증 문서관리번호
UserID : 팝빌회원 아이디
return
처리결과. consist of code and message
raise
PopbillException... | python | def delete(self, CorpNum, MgtKey, UserID=None):
""" 삭제
args
CorpNum : 팝빌회원 사업자번호
MgtKey : 원본 현금영수증 문서관리번호
UserID : 팝빌회원 아이디
return
처리결과. consist of code and message
raise
PopbillException... | [
"def",
"delete",
"(",
"self",
",",
"CorpNum",
",",
"MgtKey",
",",
"UserID",
"=",
"None",
")",
":",
"if",
"MgtKey",
"==",
"None",
"or",
"MgtKey",
"==",
"\"\"",
":",
"raise",
"PopbillException",
"(",
"-",
"99999999",
",",
"\"관리번호가 입력되지 않았습니다.\")\r",
"",
"r... | 삭제
args
CorpNum : 팝빌회원 사업자번호
MgtKey : 원본 현금영수증 문서관리번호
UserID : 팝빌회원 아이디
return
처리결과. consist of code and message
raise
PopbillException | [
"삭제",
"args",
"CorpNum",
":",
"팝빌회원",
"사업자번호",
"MgtKey",
":",
"원본",
"현금영수증",
"문서관리번호",
"UserID",
":",
"팝빌회원",
"아이디",
"return",
"처리결과",
".",
"consist",
"of",
"code",
"and",
"message",
"raise",
"PopbillException"
] | 68a0dd7f7a937603318e93be321fde73c50b96cc | https://github.com/linkhub-sdk/popbill.py/blob/68a0dd7f7a937603318e93be321fde73c50b96cc/popbill/cashbillService.py#L287-L302 | train |
linkhub-sdk/popbill.py | popbill/cashbillService.py | CashbillService.search | def search(self, CorpNum, DType, SDate, EDate, State, TradeType, TradeUsage, TaxationType, Page, PerPage, Order,
UserID=None, QString=None, TradeOpt=None):
""" 목록 조회
args
CorpNum : 팝빌회원 사업자번호
DType : 일자유형, R-등록일자, T-거래일자, I-발행일자 중 택 1
... | python | def search(self, CorpNum, DType, SDate, EDate, State, TradeType, TradeUsage, TaxationType, Page, PerPage, Order,
UserID=None, QString=None, TradeOpt=None):
""" 목록 조회
args
CorpNum : 팝빌회원 사업자번호
DType : 일자유형, R-등록일자, T-거래일자, I-발행일자 중 택 1
... | [
"def",
"search",
"(",
"self",
",",
"CorpNum",
",",
"DType",
",",
"SDate",
",",
"EDate",
",",
"State",
",",
"TradeType",
",",
"TradeUsage",
",",
"TaxationType",
",",
"Page",
",",
"PerPage",
",",
"Order",
",",
"UserID",
"=",
"None",
",",
"QString",
"=",
... | 목록 조회
args
CorpNum : 팝빌회원 사업자번호
DType : 일자유형, R-등록일자, T-거래일자, I-발행일자 중 택 1
SDate : 시작일자, 표시형식(yyyyMMdd)
EDate : 종료일자, 표시형식(yyyyMMdd)
State : 상태코드 배열, 2,3번째 자리에 와일드카드(*) 사용가능
TradeType : 문서형태 배열, N-일반현금영수증,... | [
"목록",
"조회",
"args",
"CorpNum",
":",
"팝빌회원",
"사업자번호",
"DType",
":",
"일자유형",
"R",
"-",
"등록일자",
"T",
"-",
"거래일자",
"I",
"-",
"발행일자",
"중",
"택",
"1",
"SDate",
":",
"시작일자",
"표시형식",
"(",
"yyyyMMdd",
")",
"EDate",
":",
"종료일자",
"표시형식",
"(",
"yyyyMMdd",
")"... | 68a0dd7f7a937603318e93be321fde73c50b96cc | https://github.com/linkhub-sdk/popbill.py/blob/68a0dd7f7a937603318e93be321fde73c50b96cc/popbill/cashbillService.py#L304-L351 | train |
linkhub-sdk/popbill.py | popbill/cashbillService.py | CashbillService.getInfo | def getInfo(self, CorpNum, MgtKey):
""" 상태/요약 정보 조회
args
CorpNum : 팝빌회원 사업자번호
MgtKey : 문서관리번호
return
문서 상태/요약 정보 object
raise
PopbillException
"""
if MgtKey == None or MgtKey == "":
... | python | def getInfo(self, CorpNum, MgtKey):
""" 상태/요약 정보 조회
args
CorpNum : 팝빌회원 사업자번호
MgtKey : 문서관리번호
return
문서 상태/요약 정보 object
raise
PopbillException
"""
if MgtKey == None or MgtKey == "":
... | [
"def",
"getInfo",
"(",
"self",
",",
"CorpNum",
",",
"MgtKey",
")",
":",
"if",
"MgtKey",
"==",
"None",
"or",
"MgtKey",
"==",
"\"\"",
":",
"raise",
"PopbillException",
"(",
"-",
"99999999",
",",
"\"관리번호가 입력되지 않았습니다.\")\r",
"",
"return",
"self",
".",
"_httpge... | 상태/요약 정보 조회
args
CorpNum : 팝빌회원 사업자번호
MgtKey : 문서관리번호
return
문서 상태/요약 정보 object
raise
PopbillException | [
"상태",
"/",
"요약",
"정보",
"조회",
"args",
"CorpNum",
":",
"팝빌회원",
"사업자번호",
"MgtKey",
":",
"문서관리번호",
"return",
"문서",
"상태",
"/",
"요약",
"정보",
"object",
"raise",
"PopbillException"
] | 68a0dd7f7a937603318e93be321fde73c50b96cc | https://github.com/linkhub-sdk/popbill.py/blob/68a0dd7f7a937603318e93be321fde73c50b96cc/popbill/cashbillService.py#L353-L367 | train |
linkhub-sdk/popbill.py | popbill/cashbillService.py | CashbillService.getInfos | def getInfos(self, CorpNum, MgtKeyList):
""" 상태정보 다량 확인, 최대 1000건
args
CorpNum : 회원 사업자 번호
MgtKeyList : 문서관리번호 목록
return
상태정보 목록 as List
raise
PopbillException
"""
if MgtKeyList == None ... | python | def getInfos(self, CorpNum, MgtKeyList):
""" 상태정보 다량 확인, 최대 1000건
args
CorpNum : 회원 사업자 번호
MgtKeyList : 문서관리번호 목록
return
상태정보 목록 as List
raise
PopbillException
"""
if MgtKeyList == None ... | [
"def",
"getInfos",
"(",
"self",
",",
"CorpNum",
",",
"MgtKeyList",
")",
":",
"if",
"MgtKeyList",
"==",
"None",
"or",
"len",
"(",
"MgtKeyList",
")",
"<",
"1",
":",
"raise",
"PopbillException",
"(",
"-",
"99999999",
",",
"\"관리번호가 입력되지 않았습니다.\")\r",
"",
"post... | 상태정보 다량 확인, 최대 1000건
args
CorpNum : 회원 사업자 번호
MgtKeyList : 문서관리번호 목록
return
상태정보 목록 as List
raise
PopbillException | [
"상태정보",
"다량",
"확인",
"최대",
"1000건",
"args",
"CorpNum",
":",
"회원",
"사업자",
"번호",
"MgtKeyList",
":",
"문서관리번호",
"목록",
"return",
"상태정보",
"목록",
"as",
"List",
"raise",
"PopbillException"
] | 68a0dd7f7a937603318e93be321fde73c50b96cc | https://github.com/linkhub-sdk/popbill.py/blob/68a0dd7f7a937603318e93be321fde73c50b96cc/popbill/cashbillService.py#L369-L384 | train |
linkhub-sdk/popbill.py | popbill/cashbillService.py | CashbillService.getDetailInfo | def getDetailInfo(self, CorpNum, MgtKey):
""" 상세정보 조회
args
CorpNum : 팝빌회원 사업자번호
MgtKey : 문서관리번호
return
문서 상세정보 object
raise
PopbillException
"""
if MgtKey == None or MgtKey == "":
... | python | def getDetailInfo(self, CorpNum, MgtKey):
""" 상세정보 조회
args
CorpNum : 팝빌회원 사업자번호
MgtKey : 문서관리번호
return
문서 상세정보 object
raise
PopbillException
"""
if MgtKey == None or MgtKey == "":
... | [
"def",
"getDetailInfo",
"(",
"self",
",",
"CorpNum",
",",
"MgtKey",
")",
":",
"if",
"MgtKey",
"==",
"None",
"or",
"MgtKey",
"==",
"\"\"",
":",
"raise",
"PopbillException",
"(",
"-",
"99999999",
",",
"\"관리번호가 입력되지 않았습니다.\")\r",
"",
"return",
"self",
".",
"_... | 상세정보 조회
args
CorpNum : 팝빌회원 사업자번호
MgtKey : 문서관리번호
return
문서 상세정보 object
raise
PopbillException | [
"상세정보",
"조회",
"args",
"CorpNum",
":",
"팝빌회원",
"사업자번호",
"MgtKey",
":",
"문서관리번호",
"return",
"문서",
"상세정보",
"object",
"raise",
"PopbillException"
] | 68a0dd7f7a937603318e93be321fde73c50b96cc | https://github.com/linkhub-sdk/popbill.py/blob/68a0dd7f7a937603318e93be321fde73c50b96cc/popbill/cashbillService.py#L386-L400 | train |
linkhub-sdk/popbill.py | popbill/cashbillService.py | CashbillService.sendEmail | def sendEmail(self, CorpNum, MgtKey, ReceiverEmail, UserID=None):
""" 알림메일 재전송
args
CorpNum : 팝빌회원 사업자번호
MgtKey : 문서관리번호
ReceiverEmail : 수신자 이메일 주소
UserID : 팝빌회원 아이디
return
처리결과. consist of code and m... | python | def sendEmail(self, CorpNum, MgtKey, ReceiverEmail, UserID=None):
""" 알림메일 재전송
args
CorpNum : 팝빌회원 사업자번호
MgtKey : 문서관리번호
ReceiverEmail : 수신자 이메일 주소
UserID : 팝빌회원 아이디
return
처리결과. consist of code and m... | [
"def",
"sendEmail",
"(",
"self",
",",
"CorpNum",
",",
"MgtKey",
",",
"ReceiverEmail",
",",
"UserID",
"=",
"None",
")",
":",
"if",
"MgtKey",
"==",
"None",
"or",
"MgtKey",
"==",
"\"\"",
":",
"raise",
"PopbillException",
"(",
"-",
"99999999",
",",
"\"관리번호가 ... | 알림메일 재전송
args
CorpNum : 팝빌회원 사업자번호
MgtKey : 문서관리번호
ReceiverEmail : 수신자 이메일 주소
UserID : 팝빌회원 아이디
return
처리결과. consist of code and message
raise
PopbillException | [
"알림메일",
"재전송",
"args",
"CorpNum",
":",
"팝빌회원",
"사업자번호",
"MgtKey",
":",
"문서관리번호",
"ReceiverEmail",
":",
"수신자",
"이메일",
"주소",
"UserID",
":",
"팝빌회원",
"아이디",
"return",
"처리결과",
".",
"consist",
"of",
"code",
"and",
"message",
"raise",
"PopbillException"
] | 68a0dd7f7a937603318e93be321fde73c50b96cc | https://github.com/linkhub-sdk/popbill.py/blob/68a0dd7f7a937603318e93be321fde73c50b96cc/popbill/cashbillService.py#L402-L422 | train |
linkhub-sdk/popbill.py | popbill/cashbillService.py | CashbillService.getLogs | def getLogs(self, CorpNum, MgtKey):
""" 문서이력 조회
args
CorpNum : 팝빌회원 사업자번호
MgtKey : 문서관리번호
return
문서 이력 목록 as List
raise
PopbillException
"""
if MgtKey == None or MgtKey == "":
... | python | def getLogs(self, CorpNum, MgtKey):
""" 문서이력 조회
args
CorpNum : 팝빌회원 사업자번호
MgtKey : 문서관리번호
return
문서 이력 목록 as List
raise
PopbillException
"""
if MgtKey == None or MgtKey == "":
... | [
"def",
"getLogs",
"(",
"self",
",",
"CorpNum",
",",
"MgtKey",
")",
":",
"if",
"MgtKey",
"==",
"None",
"or",
"MgtKey",
"==",
"\"\"",
":",
"raise",
"PopbillException",
"(",
"-",
"99999999",
",",
"\"관리번호가 입력되지 않았습니다.\")\r",
"",
"return",
"self",
".",
"_httpge... | 문서이력 조회
args
CorpNum : 팝빌회원 사업자번호
MgtKey : 문서관리번호
return
문서 이력 목록 as List
raise
PopbillException | [
"문서이력",
"조회",
"args",
"CorpNum",
":",
"팝빌회원",
"사업자번호",
"MgtKey",
":",
"문서관리번호",
"return",
"문서",
"이력",
"목록",
"as",
"List",
"raise",
"PopbillException"
] | 68a0dd7f7a937603318e93be321fde73c50b96cc | https://github.com/linkhub-sdk/popbill.py/blob/68a0dd7f7a937603318e93be321fde73c50b96cc/popbill/cashbillService.py#L477-L490 | train |
linkhub-sdk/popbill.py | popbill/cashbillService.py | CashbillService.getEPrintURL | def getEPrintURL(self, CorpNum, MgtKey, UserID=None):
""" 공급받는자용 인쇄 URL 확인
args
CorpNum : 팝빌회원 사업자번호
MgtKey : 문서관리번호
UserID : 팝빌회원 아이디
return
팝빌 URL as str
raise
PopbillException
... | python | def getEPrintURL(self, CorpNum, MgtKey, UserID=None):
""" 공급받는자용 인쇄 URL 확인
args
CorpNum : 팝빌회원 사업자번호
MgtKey : 문서관리번호
UserID : 팝빌회원 아이디
return
팝빌 URL as str
raise
PopbillException
... | [
"def",
"getEPrintURL",
"(",
"self",
",",
"CorpNum",
",",
"MgtKey",
",",
"UserID",
"=",
"None",
")",
":",
"if",
"MgtKey",
"==",
"None",
"or",
"MgtKey",
"==",
"\"\"",
":",
"raise",
"PopbillException",
"(",
"-",
"99999999",
",",
"\"관리번호가 입력되지 않았습니다.\")\r",
""... | 공급받는자용 인쇄 URL 확인
args
CorpNum : 팝빌회원 사업자번호
MgtKey : 문서관리번호
UserID : 팝빌회원 아이디
return
팝빌 URL as str
raise
PopbillException | [
"공급받는자용",
"인쇄",
"URL",
"확인",
"args",
"CorpNum",
":",
"팝빌회원",
"사업자번호",
"MgtKey",
":",
"문서관리번호",
"UserID",
":",
"팝빌회원",
"아이디",
"return",
"팝빌",
"URL",
"as",
"str",
"raise",
"PopbillException"
] | 68a0dd7f7a937603318e93be321fde73c50b96cc | https://github.com/linkhub-sdk/popbill.py/blob/68a0dd7f7a937603318e93be321fde73c50b96cc/popbill/cashbillService.py#L528-L544 | train |
linkhub-sdk/popbill.py | popbill/cashbillService.py | CashbillService.updateEmailConfig | def updateEmailConfig(self, Corpnum, EmailType, SendYN, UserID=None):
""" 알림메일 전송설정 수정
args
CorpNum : 팝빌회원 사업자번호
EmailType: 메일전송유형
SendYN: 전송여부 (True-전송, False-미전송)
UserID : 팝빌회원 아이디
return
처리결과. consi... | python | def updateEmailConfig(self, Corpnum, EmailType, SendYN, UserID=None):
""" 알림메일 전송설정 수정
args
CorpNum : 팝빌회원 사업자번호
EmailType: 메일전송유형
SendYN: 전송여부 (True-전송, False-미전송)
UserID : 팝빌회원 아이디
return
처리결과. consi... | [
"def",
"updateEmailConfig",
"(",
"self",
",",
"Corpnum",
",",
"EmailType",
",",
"SendYN",
",",
"UserID",
"=",
"None",
")",
":",
"if",
"EmailType",
"==",
"None",
"or",
"EmailType",
"==",
"''",
":",
"raise",
"PopbillException",
"(",
"-",
"99999999",
",",
"... | 알림메일 전송설정 수정
args
CorpNum : 팝빌회원 사업자번호
EmailType: 메일전송유형
SendYN: 전송여부 (True-전송, False-미전송)
UserID : 팝빌회원 아이디
return
처리결과. consist of code and message
raise
PopbillException | [
"알림메일",
"전송설정",
"수정",
"args",
"CorpNum",
":",
"팝빌회원",
"사업자번호",
"EmailType",
":",
"메일전송유형",
"SendYN",
":",
"전송여부",
"(",
"True",
"-",
"전송",
"False",
"-",
"미전송",
")",
"UserID",
":",
"팝빌회원",
"아이디",
"return",
"처리결과",
".",
"consist",
"of",
"code",
"and",
"... | 68a0dd7f7a937603318e93be321fde73c50b96cc | https://github.com/linkhub-sdk/popbill.py/blob/68a0dd7f7a937603318e93be321fde73c50b96cc/popbill/cashbillService.py#L596-L615 | train |
lvieirajr/mongorest | mongorest/resource.py | ListResourceMixin.list | def list(self, request):
"""
Returns the list of documents found on the collection
"""
pipeline = [{'$match': request.args.pop('match', {})}]
sort = request.args.pop('sort', {})
if sort:
pipeline.append({'$sort': sort})
project = request.args.pop('pr... | python | def list(self, request):
"""
Returns the list of documents found on the collection
"""
pipeline = [{'$match': request.args.pop('match', {})}]
sort = request.args.pop('sort', {})
if sort:
pipeline.append({'$sort': sort})
project = request.args.pop('pr... | [
"def",
"list",
"(",
"self",
",",
"request",
")",
":",
"pipeline",
"=",
"[",
"{",
"'$match'",
":",
"request",
".",
"args",
".",
"pop",
"(",
"'match'",
",",
"{",
"}",
")",
"}",
"]",
"sort",
"=",
"request",
".",
"args",
".",
"pop",
"(",
"'sort'",
... | Returns the list of documents found on the collection | [
"Returns",
"the",
"list",
"of",
"documents",
"found",
"on",
"the",
"collection"
] | 00f4487ded33254434bc51ff09d48c7a936bd465 | https://github.com/lvieirajr/mongorest/blob/00f4487ded33254434bc51ff09d48c7a936bd465/mongorest/resource.py#L73-L87 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.