id int32 0 252k | repo stringlengths 7 55 | path stringlengths 4 127 | func_name stringlengths 1 88 | original_string stringlengths 75 19.8k | language stringclasses 1
value | code stringlengths 75 19.8k | code_tokens list | docstring stringlengths 3 17.3k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 87 242 |
|---|---|---|---|---|---|---|---|---|---|---|---|
244,000 | etcher-be/emiz | emiz/avwx/translate.py | wind_shear | def wind_shear(shear: str, unit_alt: str = 'ft', unit_wind: str = 'kt', spoken: bool = False) -> str:
"""
Translate wind shear into a readable string
Ex: Wind shear 2000ft from 140 at 30kt
"""
if not shear or 'WS' not in shear or '/' not in shear:
return ''
shear = shear[2:].rstrip(unit... | python | def wind_shear(shear: str, unit_alt: str = 'ft', unit_wind: str = 'kt', spoken: bool = False) -> str:
"""
Translate wind shear into a readable string
Ex: Wind shear 2000ft from 140 at 30kt
"""
if not shear or 'WS' not in shear or '/' not in shear:
return ''
shear = shear[2:].rstrip(unit... | [
"def",
"wind_shear",
"(",
"shear",
":",
"str",
",",
"unit_alt",
":",
"str",
"=",
"'ft'",
",",
"unit_wind",
":",
"str",
"=",
"'kt'",
",",
"spoken",
":",
"bool",
"=",
"False",
")",
"->",
"str",
":",
"if",
"not",
"shear",
"or",
"'WS'",
"not",
"in",
... | Translate wind shear into a readable string
Ex: Wind shear 2000ft from 140 at 30kt | [
"Translate",
"wind",
"shear",
"into",
"a",
"readable",
"string"
] | 1c3e32711921d7e600e85558ffe5d337956372de | https://github.com/etcher-be/emiz/blob/1c3e32711921d7e600e85558ffe5d337956372de/emiz/avwx/translate.py#L242-L252 |
244,001 | etcher-be/emiz | emiz/avwx/translate.py | turb_ice | def turb_ice(turbice: [str], unit: str = 'ft') -> str: # type: ignore
"""
Translate the list of turbulance or icing into a readable sentence
Ex: Occasional moderate turbulence in clouds from 3000ft to 14000ft
"""
if not turbice:
return ''
# Determine turbulance or icing
if turbice[... | python | def turb_ice(turbice: [str], unit: str = 'ft') -> str: # type: ignore
"""
Translate the list of turbulance or icing into a readable sentence
Ex: Occasional moderate turbulence in clouds from 3000ft to 14000ft
"""
if not turbice:
return ''
# Determine turbulance or icing
if turbice[... | [
"def",
"turb_ice",
"(",
"turbice",
":",
"[",
"str",
"]",
",",
"unit",
":",
"str",
"=",
"'ft'",
")",
"->",
"str",
":",
"# type: ignore",
"if",
"not",
"turbice",
":",
"return",
"''",
"# Determine turbulance or icing",
"if",
"turbice",
"[",
"0",
"]",
"[",
... | Translate the list of turbulance or icing into a readable sentence
Ex: Occasional moderate turbulence in clouds from 3000ft to 14000ft | [
"Translate",
"the",
"list",
"of",
"turbulance",
"or",
"icing",
"into",
"a",
"readable",
"sentence"
] | 1c3e32711921d7e600e85558ffe5d337956372de | https://github.com/etcher-be/emiz/blob/1c3e32711921d7e600e85558ffe5d337956372de/emiz/avwx/translate.py#L255-L284 |
244,002 | etcher-be/emiz | emiz/avwx/translate.py | min_max_temp | def min_max_temp(temp: str, unit: str = 'C') -> str:
"""
Format the Min and Max temp elemets into a readable string
Ex: Maximum temperature of 23°C (73°F) at 18-15:00Z
"""
if not temp or len(temp) < 7:
return ''
if temp[:2] == 'TX':
temp_type = 'Maximum'
elif temp[:2] == 'TN... | python | def min_max_temp(temp: str, unit: str = 'C') -> str:
"""
Format the Min and Max temp elemets into a readable string
Ex: Maximum temperature of 23°C (73°F) at 18-15:00Z
"""
if not temp or len(temp) < 7:
return ''
if temp[:2] == 'TX':
temp_type = 'Maximum'
elif temp[:2] == 'TN... | [
"def",
"min_max_temp",
"(",
"temp",
":",
"str",
",",
"unit",
":",
"str",
"=",
"'C'",
")",
"->",
"str",
":",
"if",
"not",
"temp",
"or",
"len",
"(",
"temp",
")",
"<",
"7",
":",
"return",
"''",
"if",
"temp",
"[",
":",
"2",
"]",
"==",
"'TX'",
":"... | Format the Min and Max temp elemets into a readable string
Ex: Maximum temperature of 23°C (73°F) at 18-15:00Z | [
"Format",
"the",
"Min",
"and",
"Max",
"temp",
"elemets",
"into",
"a",
"readable",
"string"
] | 1c3e32711921d7e600e85558ffe5d337956372de | https://github.com/etcher-be/emiz/blob/1c3e32711921d7e600e85558ffe5d337956372de/emiz/avwx/translate.py#L287-L305 |
244,003 | etcher-be/emiz | emiz/avwx/translate.py | shared | def shared(wxdata: ReportData, units: Units) -> typing.Dict[str, str]:
"""
Translate Visibility, Altimeter, Clouds, and Other
"""
translations = {}
translations['visibility'] = visibility(wxdata.visibility, units.visibility) # type: ignore
translations['altimeter'] = altimeter(wxdata.altimeter,... | python | def shared(wxdata: ReportData, units: Units) -> typing.Dict[str, str]:
"""
Translate Visibility, Altimeter, Clouds, and Other
"""
translations = {}
translations['visibility'] = visibility(wxdata.visibility, units.visibility) # type: ignore
translations['altimeter'] = altimeter(wxdata.altimeter,... | [
"def",
"shared",
"(",
"wxdata",
":",
"ReportData",
",",
"units",
":",
"Units",
")",
"->",
"typing",
".",
"Dict",
"[",
"str",
",",
"str",
"]",
":",
"translations",
"=",
"{",
"}",
"translations",
"[",
"'visibility'",
"]",
"=",
"visibility",
"(",
"wxdata"... | Translate Visibility, Altimeter, Clouds, and Other | [
"Translate",
"Visibility",
"Altimeter",
"Clouds",
"and",
"Other"
] | 1c3e32711921d7e600e85558ffe5d337956372de | https://github.com/etcher-be/emiz/blob/1c3e32711921d7e600e85558ffe5d337956372de/emiz/avwx/translate.py#L308-L317 |
244,004 | etcher-be/emiz | emiz/avwx/translate.py | metar | def metar(wxdata: MetarData, units: Units) -> MetarTrans:
"""
Translate the results of metar.parse
Keys: Wind, Visibility, Clouds, Temperature, Dewpoint, Altimeter, Other
"""
translations = shared(wxdata, units)
translations['wind'] = wind(wxdata.wind_direction, wxdata.wind_speed,
... | python | def metar(wxdata: MetarData, units: Units) -> MetarTrans:
"""
Translate the results of metar.parse
Keys: Wind, Visibility, Clouds, Temperature, Dewpoint, Altimeter, Other
"""
translations = shared(wxdata, units)
translations['wind'] = wind(wxdata.wind_direction, wxdata.wind_speed,
... | [
"def",
"metar",
"(",
"wxdata",
":",
"MetarData",
",",
"units",
":",
"Units",
")",
"->",
"MetarTrans",
":",
"translations",
"=",
"shared",
"(",
"wxdata",
",",
"units",
")",
"translations",
"[",
"'wind'",
"]",
"=",
"wind",
"(",
"wxdata",
".",
"wind_directi... | Translate the results of metar.parse
Keys: Wind, Visibility, Clouds, Temperature, Dewpoint, Altimeter, Other | [
"Translate",
"the",
"results",
"of",
"metar",
".",
"parse"
] | 1c3e32711921d7e600e85558ffe5d337956372de | https://github.com/etcher-be/emiz/blob/1c3e32711921d7e600e85558ffe5d337956372de/emiz/avwx/translate.py#L320-L333 |
244,005 | etcher-be/emiz | emiz/avwx/translate.py | taf | def taf(wxdata: TafData, units: Units) -> TafTrans:
"""
Translate the results of taf.parse
Keys: Forecast, Min-Temp, Max-Temp
Forecast keys: Wind, Visibility, Clouds, Altimeter, Wind-Shear, Turbulance, Icing, Other
"""
translations = {'forecast': []} # type: ignore
for line in wxdata.fore... | python | def taf(wxdata: TafData, units: Units) -> TafTrans:
"""
Translate the results of taf.parse
Keys: Forecast, Min-Temp, Max-Temp
Forecast keys: Wind, Visibility, Clouds, Altimeter, Wind-Shear, Turbulance, Icing, Other
"""
translations = {'forecast': []} # type: ignore
for line in wxdata.fore... | [
"def",
"taf",
"(",
"wxdata",
":",
"TafData",
",",
"units",
":",
"Units",
")",
"->",
"TafTrans",
":",
"translations",
"=",
"{",
"'forecast'",
":",
"[",
"]",
"}",
"# type: ignore",
"for",
"line",
"in",
"wxdata",
".",
"forecast",
":",
"trans",
"=",
"share... | Translate the results of taf.parse
Keys: Forecast, Min-Temp, Max-Temp
Forecast keys: Wind, Visibility, Clouds, Altimeter, Wind-Shear, Turbulance, Icing, Other | [
"Translate",
"the",
"results",
"of",
"taf",
".",
"parse"
] | 1c3e32711921d7e600e85558ffe5d337956372de | https://github.com/etcher-be/emiz/blob/1c3e32711921d7e600e85558ffe5d337956372de/emiz/avwx/translate.py#L336-L359 |
244,006 | rameshg87/pyremotevbox | pyremotevbox/ZSI/schema.py | _get_substitute_element | def _get_substitute_element(head, elt, ps):
'''if elt matches a member of the head substitutionGroup, return
the GED typecode.
head -- ElementDeclaration typecode,
elt -- the DOM element being parsed
ps -- ParsedSoap Instance
'''
if not isinstance(head, ElementDeclaration):
return... | python | def _get_substitute_element(head, elt, ps):
'''if elt matches a member of the head substitutionGroup, return
the GED typecode.
head -- ElementDeclaration typecode,
elt -- the DOM element being parsed
ps -- ParsedSoap Instance
'''
if not isinstance(head, ElementDeclaration):
return... | [
"def",
"_get_substitute_element",
"(",
"head",
",",
"elt",
",",
"ps",
")",
":",
"if",
"not",
"isinstance",
"(",
"head",
",",
"ElementDeclaration",
")",
":",
"return",
"None",
"return",
"ElementDeclaration",
".",
"getSubstitutionElement",
"(",
"head",
",",
"elt... | if elt matches a member of the head substitutionGroup, return
the GED typecode.
head -- ElementDeclaration typecode,
elt -- the DOM element being parsed
ps -- ParsedSoap Instance | [
"if",
"elt",
"matches",
"a",
"member",
"of",
"the",
"head",
"substitutionGroup",
"return",
"the",
"GED",
"typecode",
"."
] | 123dffff27da57c8faa3ac1dd4c68b1cf4558b1a | https://github.com/rameshg87/pyremotevbox/blob/123dffff27da57c8faa3ac1dd4c68b1cf4558b1a/pyremotevbox/ZSI/schema.py#L17-L28 |
244,007 | rameshg87/pyremotevbox | pyremotevbox/ZSI/schema.py | _is_substitute_element | def _is_substitute_element(head, sub):
'''if head and sub are both GEDs, and sub declares
head as its substitutionGroup then return True.
head -- Typecode instance
sub -- Typecode instance
'''
if not isinstance(head, ElementDeclaration) or not isinstance(sub, ElementDeclaration):
retu... | python | def _is_substitute_element(head, sub):
'''if head and sub are both GEDs, and sub declares
head as its substitutionGroup then return True.
head -- Typecode instance
sub -- Typecode instance
'''
if not isinstance(head, ElementDeclaration) or not isinstance(sub, ElementDeclaration):
retu... | [
"def",
"_is_substitute_element",
"(",
"head",
",",
"sub",
")",
":",
"if",
"not",
"isinstance",
"(",
"head",
",",
"ElementDeclaration",
")",
"or",
"not",
"isinstance",
"(",
"sub",
",",
"ElementDeclaration",
")",
":",
"return",
"False",
"try",
":",
"group",
... | if head and sub are both GEDs, and sub declares
head as its substitutionGroup then return True.
head -- Typecode instance
sub -- Typecode instance | [
"if",
"head",
"and",
"sub",
"are",
"both",
"GEDs",
"and",
"sub",
"declares",
"head",
"as",
"its",
"substitutionGroup",
"then",
"return",
"True",
"."
] | 123dffff27da57c8faa3ac1dd4c68b1cf4558b1a | https://github.com/rameshg87/pyremotevbox/blob/123dffff27da57c8faa3ac1dd4c68b1cf4558b1a/pyremotevbox/ZSI/schema.py#L33-L56 |
244,008 | rameshg87/pyremotevbox | pyremotevbox/ZSI/schema.py | SchemaInstanceType.getElementDeclaration | def getElementDeclaration(cls, namespaceURI, name, isref=False, lazy=False):
'''Grab an element declaration, returns a typecode instance
representation or a typecode class definition. An element
reference has its own facets, and is local so it will not be
cached.
Parameters:
... | python | def getElementDeclaration(cls, namespaceURI, name, isref=False, lazy=False):
'''Grab an element declaration, returns a typecode instance
representation or a typecode class definition. An element
reference has its own facets, and is local so it will not be
cached.
Parameters:
... | [
"def",
"getElementDeclaration",
"(",
"cls",
",",
"namespaceURI",
",",
"name",
",",
"isref",
"=",
"False",
",",
"lazy",
"=",
"False",
")",
":",
"key",
"=",
"(",
"namespaceURI",
",",
"name",
")",
"if",
"isref",
":",
"klass",
"=",
"cls",
".",
"elements",
... | Grab an element declaration, returns a typecode instance
representation or a typecode class definition. An element
reference has its own facets, and is local so it will not be
cached.
Parameters:
namespaceURI --
name --
isref -- if element referen... | [
"Grab",
"an",
"element",
"declaration",
"returns",
"a",
"typecode",
"instance",
"representation",
"or",
"a",
"typecode",
"class",
"definition",
".",
"An",
"element",
"reference",
"has",
"its",
"own",
"facets",
"and",
"is",
"local",
"so",
"it",
"will",
"not",
... | 123dffff27da57c8faa3ac1dd4c68b1cf4558b1a | https://github.com/rameshg87/pyremotevbox/blob/123dffff27da57c8faa3ac1dd4c68b1cf4558b1a/pyremotevbox/ZSI/schema.py#L164-L189 |
244,009 | rameshg87/pyremotevbox | pyremotevbox/ZSI/schema.py | ElementDeclaration.checkSubstitute | def checkSubstitute(self, typecode):
'''If this is True, allow typecode to be substituted
for "self" typecode.
'''
if not isinstance(typecode, ElementDeclaration):
return False
try:
nsuri,ncname = typecode.substitutionGroup
except (AttributeError... | python | def checkSubstitute(self, typecode):
'''If this is True, allow typecode to be substituted
for "self" typecode.
'''
if not isinstance(typecode, ElementDeclaration):
return False
try:
nsuri,ncname = typecode.substitutionGroup
except (AttributeError... | [
"def",
"checkSubstitute",
"(",
"self",
",",
"typecode",
")",
":",
"if",
"not",
"isinstance",
"(",
"typecode",
",",
"ElementDeclaration",
")",
":",
"return",
"False",
"try",
":",
"nsuri",
",",
"ncname",
"=",
"typecode",
".",
"substitutionGroup",
"except",
"("... | If this is True, allow typecode to be substituted
for "self" typecode. | [
"If",
"this",
"is",
"True",
"allow",
"typecode",
"to",
"be",
"substituted",
"for",
"self",
"typecode",
"."
] | 123dffff27da57c8faa3ac1dd4c68b1cf4558b1a | https://github.com/rameshg87/pyremotevbox/blob/123dffff27da57c8faa3ac1dd4c68b1cf4558b1a/pyremotevbox/ZSI/schema.py#L203-L226 |
244,010 | rameshg87/pyremotevbox | pyremotevbox/ZSI/schema.py | ElementDeclaration.getSubstitutionElement | def getSubstitutionElement(self, elt, ps):
'''if elt matches a member of the head substitutionGroup, return
the GED typecode representation of the member.
head -- ElementDeclaration typecode,
elt -- the DOM element being parsed
ps -- ParsedSoap instance
'''
nsu... | python | def getSubstitutionElement(self, elt, ps):
'''if elt matches a member of the head substitutionGroup, return
the GED typecode representation of the member.
head -- ElementDeclaration typecode,
elt -- the DOM element being parsed
ps -- ParsedSoap instance
'''
nsu... | [
"def",
"getSubstitutionElement",
"(",
"self",
",",
"elt",
",",
"ps",
")",
":",
"nsuri",
",",
"ncname",
"=",
"_get_element_nsuri_name",
"(",
"elt",
")",
"typecode",
"=",
"GED",
"(",
"nsuri",
",",
"ncname",
")",
"if",
"typecode",
"is",
"None",
":",
"return... | if elt matches a member of the head substitutionGroup, return
the GED typecode representation of the member.
head -- ElementDeclaration typecode,
elt -- the DOM element being parsed
ps -- ParsedSoap instance | [
"if",
"elt",
"matches",
"a",
"member",
"of",
"the",
"head",
"substitutionGroup",
"return",
"the",
"GED",
"typecode",
"representation",
"of",
"the",
"member",
"."
] | 123dffff27da57c8faa3ac1dd4c68b1cf4558b1a | https://github.com/rameshg87/pyremotevbox/blob/123dffff27da57c8faa3ac1dd4c68b1cf4558b1a/pyremotevbox/ZSI/schema.py#L228-L250 |
244,011 | rameshg87/pyremotevbox | pyremotevbox/ZSI/schema.py | _GetPyobjWrapper.RegisterBuiltin | def RegisterBuiltin(cls, arg):
'''register a builtin, create a new wrapper.
'''
if arg in cls.types_dict:
raise RuntimeError, '%s already registered' %arg
class _Wrapper(arg):
'Wrapper for builtin %s\n%s' %(arg, cls.__doc__)
_Wrapper.__name__ = '_%sWrapper... | python | def RegisterBuiltin(cls, arg):
'''register a builtin, create a new wrapper.
'''
if arg in cls.types_dict:
raise RuntimeError, '%s already registered' %arg
class _Wrapper(arg):
'Wrapper for builtin %s\n%s' %(arg, cls.__doc__)
_Wrapper.__name__ = '_%sWrapper... | [
"def",
"RegisterBuiltin",
"(",
"cls",
",",
"arg",
")",
":",
"if",
"arg",
"in",
"cls",
".",
"types_dict",
":",
"raise",
"RuntimeError",
",",
"'%s already registered'",
"%",
"arg",
"class",
"_Wrapper",
"(",
"arg",
")",
":",
"'Wrapper for builtin %s\\n%s'",
"%",
... | register a builtin, create a new wrapper. | [
"register",
"a",
"builtin",
"create",
"a",
"new",
"wrapper",
"."
] | 123dffff27da57c8faa3ac1dd4c68b1cf4558b1a | https://github.com/rameshg87/pyremotevbox/blob/123dffff27da57c8faa3ac1dd4c68b1cf4558b1a/pyremotevbox/ZSI/schema.py#L376-L384 |
244,012 | rameshg87/pyremotevbox | pyremotevbox/ZSI/schema.py | _GetPyobjWrapper.RegisterAnyElement | def RegisterAnyElement(cls):
'''If find registered TypeCode instance, add Wrapper class
to TypeCode class serialmap and Re-RegisterType. Provides
Any serialzation of any instances of the Wrapper.
'''
for k,v in cls.types_dict.items():
what = Any.serialmap.get(k)
... | python | def RegisterAnyElement(cls):
'''If find registered TypeCode instance, add Wrapper class
to TypeCode class serialmap and Re-RegisterType. Provides
Any serialzation of any instances of the Wrapper.
'''
for k,v in cls.types_dict.items():
what = Any.serialmap.get(k)
... | [
"def",
"RegisterAnyElement",
"(",
"cls",
")",
":",
"for",
"k",
",",
"v",
"in",
"cls",
".",
"types_dict",
".",
"items",
"(",
")",
":",
"what",
"=",
"Any",
".",
"serialmap",
".",
"get",
"(",
"k",
")",
"if",
"what",
"is",
"None",
":",
"continue",
"i... | If find registered TypeCode instance, add Wrapper class
to TypeCode class serialmap and Re-RegisterType. Provides
Any serialzation of any instances of the Wrapper. | [
"If",
"find",
"registered",
"TypeCode",
"instance",
"add",
"Wrapper",
"class",
"to",
"TypeCode",
"class",
"serialmap",
"and",
"Re",
"-",
"RegisterType",
".",
"Provides",
"Any",
"serialzation",
"of",
"any",
"instances",
"of",
"the",
"Wrapper",
"."
] | 123dffff27da57c8faa3ac1dd4c68b1cf4558b1a | https://github.com/rameshg87/pyremotevbox/blob/123dffff27da57c8faa3ac1dd4c68b1cf4558b1a/pyremotevbox/ZSI/schema.py#L387-L397 |
244,013 | rmetcalf9/baseapp_for_restapi_backend_with_swagger | baseapp_for_restapi_backend_with_swagger/FlaskRestSubclass.py | FlaskRestSubclass.render_doc | def render_doc(self):
'''Override this method to customize the documentation page'''
if self._doc_view:
return self._doc_view()
elif not self._doc:
self.abort(self.bc_HTTPStatus_NOT_FOUND)
res = render_template('swagger-ui.html', title=self.title, specs_url=self.specs_url)
res = res.repl... | python | def render_doc(self):
'''Override this method to customize the documentation page'''
if self._doc_view:
return self._doc_view()
elif not self._doc:
self.abort(self.bc_HTTPStatus_NOT_FOUND)
res = render_template('swagger-ui.html', title=self.title, specs_url=self.specs_url)
res = res.repl... | [
"def",
"render_doc",
"(",
"self",
")",
":",
"if",
"self",
".",
"_doc_view",
":",
"return",
"self",
".",
"_doc_view",
"(",
")",
"elif",
"not",
"self",
".",
"_doc",
":",
"self",
".",
"abort",
"(",
"self",
".",
"bc_HTTPStatus_NOT_FOUND",
")",
"res",
"=",
... | Override this method to customize the documentation page | [
"Override",
"this",
"method",
"to",
"customize",
"the",
"documentation",
"page"
] | c7c797cf810929cdb044215b63bdf9e5024f46e4 | https://github.com/rmetcalf9/baseapp_for_restapi_backend_with_swagger/blob/c7c797cf810929cdb044215b63bdf9e5024f46e4/baseapp_for_restapi_backend_with_swagger/FlaskRestSubclass.py#L122-L144 |
244,014 | SergeySatskiy/cdm-gc-plugin | cdmplugins/gc/configdlg.py | GCPluginConfigDialog.__createLayout | def __createLayout(self):
"""Creates the dialog layout"""
self.resize(450, 150)
self.setSizeGripEnabled(True)
verticalLayout = QVBoxLayout(self)
whereGroupbox = QGroupBox(self)
whereGroupbox.setTitle("Garbage collector message destination")
sizePolicy = QSizePol... | python | def __createLayout(self):
"""Creates the dialog layout"""
self.resize(450, 150)
self.setSizeGripEnabled(True)
verticalLayout = QVBoxLayout(self)
whereGroupbox = QGroupBox(self)
whereGroupbox.setTitle("Garbage collector message destination")
sizePolicy = QSizePol... | [
"def",
"__createLayout",
"(",
"self",
")",
":",
"self",
".",
"resize",
"(",
"450",
",",
"150",
")",
"self",
".",
"setSizeGripEnabled",
"(",
"True",
")",
"verticalLayout",
"=",
"QVBoxLayout",
"(",
"self",
")",
"whereGroupbox",
"=",
"QGroupBox",
"(",
"self",... | Creates the dialog layout | [
"Creates",
"the",
"dialog",
"layout"
] | f6dd59d5dc80d3f8f5ca5bcf49bad86c88be38df | https://github.com/SergeySatskiy/cdm-gc-plugin/blob/f6dd59d5dc80d3f8f5ca5bcf49bad86c88be38df/cdmplugins/gc/configdlg.py#L50-L87 |
244,015 | SergeySatskiy/cdm-gc-plugin | cdmplugins/gc/configdlg.py | GCPluginConfigDialog.getCheckedOption | def getCheckedOption(self):
"""Returns what destination is selected"""
if self.__silentRButton.isChecked():
return GCPluginConfigDialog.SILENT
if self.__statusbarRButton.isChecked():
return GCPluginConfigDialog.STATUS_BAR
return GCPluginConfigDialog.LOG | python | def getCheckedOption(self):
"""Returns what destination is selected"""
if self.__silentRButton.isChecked():
return GCPluginConfigDialog.SILENT
if self.__statusbarRButton.isChecked():
return GCPluginConfigDialog.STATUS_BAR
return GCPluginConfigDialog.LOG | [
"def",
"getCheckedOption",
"(",
"self",
")",
":",
"if",
"self",
".",
"__silentRButton",
".",
"isChecked",
"(",
")",
":",
"return",
"GCPluginConfigDialog",
".",
"SILENT",
"if",
"self",
".",
"__statusbarRButton",
".",
"isChecked",
"(",
")",
":",
"return",
"GCP... | Returns what destination is selected | [
"Returns",
"what",
"destination",
"is",
"selected"
] | f6dd59d5dc80d3f8f5ca5bcf49bad86c88be38df | https://github.com/SergeySatskiy/cdm-gc-plugin/blob/f6dd59d5dc80d3f8f5ca5bcf49bad86c88be38df/cdmplugins/gc/configdlg.py#L89-L95 |
244,016 | carlosp420/dataset-creator | dataset_creator/utils.py | get_seq | def get_seq(seq_record, codon_positions, aminoacids=False, degenerate=None):
"""
Checks parameters such as codon_positions, aminoacids... to return the
required sequence as string.
Parameters:
seq_record (SeqRecordExpanded object):
codon_positions (str):
aminoacids (boolean):
... | python | def get_seq(seq_record, codon_positions, aminoacids=False, degenerate=None):
"""
Checks parameters such as codon_positions, aminoacids... to return the
required sequence as string.
Parameters:
seq_record (SeqRecordExpanded object):
codon_positions (str):
aminoacids (boolean):
... | [
"def",
"get_seq",
"(",
"seq_record",
",",
"codon_positions",
",",
"aminoacids",
"=",
"False",
",",
"degenerate",
"=",
"None",
")",
":",
"Sequence",
"=",
"namedtuple",
"(",
"'Sequence'",
",",
"[",
"'seq'",
",",
"'warning'",
"]",
")",
"if",
"codon_positions",
... | Checks parameters such as codon_positions, aminoacids... to return the
required sequence as string.
Parameters:
seq_record (SeqRecordExpanded object):
codon_positions (str):
aminoacids (boolean):
Returns:
Namedtuple containing ``seq (str)`` and ``warning (str)``. | [
"Checks",
"parameters",
"such",
"as",
"codon_positions",
"aminoacids",
"...",
"to",
"return",
"the",
"required",
"sequence",
"as",
"string",
"."
] | ea27340b145cb566a36c1836ff42263f1b2003a0 | https://github.com/carlosp420/dataset-creator/blob/ea27340b145cb566a36c1836ff42263f1b2003a0/dataset_creator/utils.py#L17-L56 |
244,017 | carlosp420/dataset-creator | dataset_creator/utils.py | convert_nexus_to_format | def convert_nexus_to_format(dataset_as_nexus, dataset_format):
"""
Converts nexus format to Phylip and Fasta using Biopython tools.
:param dataset_as_nexus:
:param dataset_format:
:return:
"""
fake_handle = StringIO(dataset_as_nexus)
nexus_al = AlignIO.parse(fake_handle, 'nexus')
tm... | python | def convert_nexus_to_format(dataset_as_nexus, dataset_format):
"""
Converts nexus format to Phylip and Fasta using Biopython tools.
:param dataset_as_nexus:
:param dataset_format:
:return:
"""
fake_handle = StringIO(dataset_as_nexus)
nexus_al = AlignIO.parse(fake_handle, 'nexus')
tm... | [
"def",
"convert_nexus_to_format",
"(",
"dataset_as_nexus",
",",
"dataset_format",
")",
":",
"fake_handle",
"=",
"StringIO",
"(",
"dataset_as_nexus",
")",
"nexus_al",
"=",
"AlignIO",
".",
"parse",
"(",
"fake_handle",
",",
"'nexus'",
")",
"tmp_file",
"=",
"make_rand... | Converts nexus format to Phylip and Fasta using Biopython tools.
:param dataset_as_nexus:
:param dataset_format:
:return: | [
"Converts",
"nexus",
"format",
"to",
"Phylip",
"and",
"Fasta",
"using",
"Biopython",
"tools",
"."
] | ea27340b145cb566a36c1836ff42263f1b2003a0 | https://github.com/carlosp420/dataset-creator/blob/ea27340b145cb566a36c1836ff42263f1b2003a0/dataset_creator/utils.py#L59-L72 |
244,018 | tonyseek/html5lib-truncation | html5lib_truncation/utils.py | truncate_sentence | def truncate_sentence(text, max_chars, break_words=False, padding=0):
"""Truncates a sentence.
:param max_chars: The maximum characters of truncated sentence.
:param break_words: If you wish to truncate given sentence strictly even
if it breaks a word, set it to ``True``. It default... | python | def truncate_sentence(text, max_chars, break_words=False, padding=0):
"""Truncates a sentence.
:param max_chars: The maximum characters of truncated sentence.
:param break_words: If you wish to truncate given sentence strictly even
if it breaks a word, set it to ``True``. It default... | [
"def",
"truncate_sentence",
"(",
"text",
",",
"max_chars",
",",
"break_words",
"=",
"False",
",",
"padding",
"=",
"0",
")",
":",
"if",
"break_words",
":",
"return",
"text",
"[",
":",
"-",
"abs",
"(",
"max_chars",
"-",
"len",
"(",
"text",
")",
")",
"-... | Truncates a sentence.
:param max_chars: The maximum characters of truncated sentence.
:param break_words: If you wish to truncate given sentence strictly even
if it breaks a word, set it to ``True``. It defaults
to ``False`` which means truncating given sentence
... | [
"Truncates",
"a",
"sentence",
"."
] | b5551e345e583d04dbdf6b97dc2a43a266eec8d6 | https://github.com/tonyseek/html5lib-truncation/blob/b5551e345e583d04dbdf6b97dc2a43a266eec8d6/html5lib_truncation/utils.py#L4-L29 |
244,019 | quasipedia/swaggery | examples/async/async.py | AlwaysWin.always_win | def always_win(cls, request) -> [(200, 'Ok', String)]:
'''Perform an always succeeding task.'''
task_id = uuid4().hex.upper()[:5]
log.info('Starting always OK task {}'.format(task_id))
for i in range(randint(0, MAX_LOOP_DURATION)):
yield
log.info('Finished always OK t... | python | def always_win(cls, request) -> [(200, 'Ok', String)]:
'''Perform an always succeeding task.'''
task_id = uuid4().hex.upper()[:5]
log.info('Starting always OK task {}'.format(task_id))
for i in range(randint(0, MAX_LOOP_DURATION)):
yield
log.info('Finished always OK t... | [
"def",
"always_win",
"(",
"cls",
",",
"request",
")",
"->",
"[",
"(",
"200",
",",
"'Ok'",
",",
"String",
")",
"]",
":",
"task_id",
"=",
"uuid4",
"(",
")",
".",
"hex",
".",
"upper",
"(",
")",
"[",
":",
"5",
"]",
"log",
".",
"info",
"(",
"'Star... | Perform an always succeeding task. | [
"Perform",
"an",
"always",
"succeeding",
"task",
"."
] | 89a2e1b2bebbc511c781c9e63972f65aef73cc2f | https://github.com/quasipedia/swaggery/blob/89a2e1b2bebbc511c781c9e63972f65aef73cc2f/examples/async/async.py#L49-L57 |
244,020 | quasipedia/swaggery | examples/async/async.py | AlwaysFail.always_fail | def always_fail(cls, request) -> [
(200, 'Ok', String),
(406, 'Not Acceptable', Void)]:
'''Perform an always failing task.'''
task_id = uuid4().hex.upper()[:5]
log.info('Starting always FAILING task {}'.format(task_id))
for i in range(randint(0, MAX_LOOP_DURATION)... | python | def always_fail(cls, request) -> [
(200, 'Ok', String),
(406, 'Not Acceptable', Void)]:
'''Perform an always failing task.'''
task_id = uuid4().hex.upper()[:5]
log.info('Starting always FAILING task {}'.format(task_id))
for i in range(randint(0, MAX_LOOP_DURATION)... | [
"def",
"always_fail",
"(",
"cls",
",",
"request",
")",
"->",
"[",
"(",
"200",
",",
"'Ok'",
",",
"String",
")",
",",
"(",
"406",
",",
"'Not Acceptable'",
",",
"Void",
")",
"]",
":",
"task_id",
"=",
"uuid4",
"(",
")",
".",
"hex",
".",
"upper",
"(",... | Perform an always failing task. | [
"Perform",
"an",
"always",
"failing",
"task",
"."
] | 89a2e1b2bebbc511c781c9e63972f65aef73cc2f | https://github.com/quasipedia/swaggery/blob/89a2e1b2bebbc511c781c9e63972f65aef73cc2f/examples/async/async.py#L68-L77 |
244,021 | quasipedia/swaggery | examples/async/async.py | Fibonacci.fibonacci | def fibonacci(cls, request,
limit: (Ptypes.path,
Integer('Upper limit of the series'))) -> [
(200, 'Ok', FibonacciFragment)]:
'''Return Fibonacci sequence whose last number is <= limit.'''
def fibonacci_generator():
last_two = (0, 1)
... | python | def fibonacci(cls, request,
limit: (Ptypes.path,
Integer('Upper limit of the series'))) -> [
(200, 'Ok', FibonacciFragment)]:
'''Return Fibonacci sequence whose last number is <= limit.'''
def fibonacci_generator():
last_two = (0, 1)
... | [
"def",
"fibonacci",
"(",
"cls",
",",
"request",
",",
"limit",
":",
"(",
"Ptypes",
".",
"path",
",",
"Integer",
"(",
"'Upper limit of the series'",
")",
")",
")",
"->",
"[",
"(",
"200",
",",
"'Ok'",
",",
"FibonacciFragment",
")",
"]",
":",
"def",
"fibon... | Return Fibonacci sequence whose last number is <= limit. | [
"Return",
"Fibonacci",
"sequence",
"whose",
"last",
"number",
"is",
"<",
"=",
"limit",
"."
] | 89a2e1b2bebbc511c781c9e63972f65aef73cc2f | https://github.com/quasipedia/swaggery/blob/89a2e1b2bebbc511c781c9e63972f65aef73cc2f/examples/async/async.py#L106-L119 |
244,022 | quasipedia/swaggery | examples/async/async.py | QueryEcho.query_echo | def query_echo(cls, request,
foo: (Ptypes.query, String('A query parameter'))) -> [
(200, 'Ok', String)]:
'''Echo the query parameter.'''
log.info('Echoing query param, value is: {}'.format(foo))
for i in range(randint(0, MAX_LOOP_DURATION)):
yield
... | python | def query_echo(cls, request,
foo: (Ptypes.query, String('A query parameter'))) -> [
(200, 'Ok', String)]:
'''Echo the query parameter.'''
log.info('Echoing query param, value is: {}'.format(foo))
for i in range(randint(0, MAX_LOOP_DURATION)):
yield
... | [
"def",
"query_echo",
"(",
"cls",
",",
"request",
",",
"foo",
":",
"(",
"Ptypes",
".",
"query",
",",
"String",
"(",
"'A query parameter'",
")",
")",
")",
"->",
"[",
"(",
"200",
",",
"'Ok'",
",",
"String",
")",
"]",
":",
"log",
".",
"info",
"(",
"'... | Echo the query parameter. | [
"Echo",
"the",
"query",
"parameter",
"."
] | 89a2e1b2bebbc511c781c9e63972f65aef73cc2f | https://github.com/quasipedia/swaggery/blob/89a2e1b2bebbc511c781c9e63972f65aef73cc2f/examples/async/async.py#L130-L138 |
244,023 | quasipedia/swaggery | examples/async/async.py | BodyEcho.body_echo | def body_echo(cls, request,
foo: (Ptypes.body, String('A body parameter'))) -> [
(200, 'Ok', String)]:
'''Echo the body parameter.'''
log.info('Echoing body param, value is: {}'.format(foo))
for i in range(randint(0, MAX_LOOP_DURATION)):
yield
ms... | python | def body_echo(cls, request,
foo: (Ptypes.body, String('A body parameter'))) -> [
(200, 'Ok', String)]:
'''Echo the body parameter.'''
log.info('Echoing body param, value is: {}'.format(foo))
for i in range(randint(0, MAX_LOOP_DURATION)):
yield
ms... | [
"def",
"body_echo",
"(",
"cls",
",",
"request",
",",
"foo",
":",
"(",
"Ptypes",
".",
"body",
",",
"String",
"(",
"'A body parameter'",
")",
")",
")",
"->",
"[",
"(",
"200",
",",
"'Ok'",
",",
"String",
")",
"]",
":",
"log",
".",
"info",
"(",
"'Ech... | Echo the body parameter. | [
"Echo",
"the",
"body",
"parameter",
"."
] | 89a2e1b2bebbc511c781c9e63972f65aef73cc2f | https://github.com/quasipedia/swaggery/blob/89a2e1b2bebbc511c781c9e63972f65aef73cc2f/examples/async/async.py#L149-L157 |
244,024 | quasipedia/swaggery | examples/async/async.py | HeaderEcho.header_echo | def header_echo(cls, request,
api_key: (Ptypes.header, String('API key'))) -> [
(200, 'Ok', String)]:
'''Echo the header parameter.'''
log.info('Echoing header param, value is: {}'.format(api_key))
for i in range(randint(0, MAX_LOOP_DURATION)):
yield
... | python | def header_echo(cls, request,
api_key: (Ptypes.header, String('API key'))) -> [
(200, 'Ok', String)]:
'''Echo the header parameter.'''
log.info('Echoing header param, value is: {}'.format(api_key))
for i in range(randint(0, MAX_LOOP_DURATION)):
yield
... | [
"def",
"header_echo",
"(",
"cls",
",",
"request",
",",
"api_key",
":",
"(",
"Ptypes",
".",
"header",
",",
"String",
"(",
"'API key'",
")",
")",
")",
"->",
"[",
"(",
"200",
",",
"'Ok'",
",",
"String",
")",
"]",
":",
"log",
".",
"info",
"(",
"'Echo... | Echo the header parameter. | [
"Echo",
"the",
"header",
"parameter",
"."
] | 89a2e1b2bebbc511c781c9e63972f65aef73cc2f | https://github.com/quasipedia/swaggery/blob/89a2e1b2bebbc511c781c9e63972f65aef73cc2f/examples/async/async.py#L168-L176 |
244,025 | quasipedia/swaggery | examples/async/async.py | FormEcho.form_echo | def form_echo(cls, request,
foo: (Ptypes.form, String('A form parameter'))) -> [
(200, 'Ok', String)]:
'''Echo the form parameter.'''
log.info('Echoing form param, value is: {}'.format(foo))
for i in range(randint(0, MAX_LOOP_DURATION)):
yield
ms... | python | def form_echo(cls, request,
foo: (Ptypes.form, String('A form parameter'))) -> [
(200, 'Ok', String)]:
'''Echo the form parameter.'''
log.info('Echoing form param, value is: {}'.format(foo))
for i in range(randint(0, MAX_LOOP_DURATION)):
yield
ms... | [
"def",
"form_echo",
"(",
"cls",
",",
"request",
",",
"foo",
":",
"(",
"Ptypes",
".",
"form",
",",
"String",
"(",
"'A form parameter'",
")",
")",
")",
"->",
"[",
"(",
"200",
",",
"'Ok'",
",",
"String",
")",
"]",
":",
"log",
".",
"info",
"(",
"'Ech... | Echo the form parameter. | [
"Echo",
"the",
"form",
"parameter",
"."
] | 89a2e1b2bebbc511c781c9e63972f65aef73cc2f | https://github.com/quasipedia/swaggery/blob/89a2e1b2bebbc511c781c9e63972f65aef73cc2f/examples/async/async.py#L187-L195 |
244,026 | christophercrouzet/nani | nani.py | resolve | def resolve(data_type, name=None, listify_default=False):
"""Retrieve the properties for a given data type.
This is the main routine where most of the work is done. It converts
Nani's data types into properties that can be used to define a new NumPy
array and to wrap it into a view object.
Use :fu... | python | def resolve(data_type, name=None, listify_default=False):
"""Retrieve the properties for a given data type.
This is the main routine where most of the work is done. It converts
Nani's data types into properties that can be used to define a new NumPy
array and to wrap it into a view object.
Use :fu... | [
"def",
"resolve",
"(",
"data_type",
",",
"name",
"=",
"None",
",",
"listify_default",
"=",
"False",
")",
":",
"data_type",
"=",
"_consolidate",
"(",
"data_type",
")",
"return",
"Nani",
"(",
"dtype",
"=",
"numpy",
".",
"dtype",
"(",
"_resolve_dtype",
"(",
... | Retrieve the properties for a given data type.
This is the main routine where most of the work is done. It converts
Nani's data types into properties that can be used to define a new NumPy
array and to wrap it into a view object.
Use :func:`validate` to check if the input data type is well-formed.
... | [
"Retrieve",
"the",
"properties",
"for",
"a",
"given",
"data",
"type",
"."
] | 296ae50c0cdcfd3ed0cba23a4d2edea0d124bcb1 | https://github.com/christophercrouzet/nani/blob/296ae50c0cdcfd3ed0cba23a4d2edea0d124bcb1/nani.py#L619-L669 |
244,027 | christophercrouzet/nani | nani.py | _consolidate | def _consolidate(data_type):
"""Enforce the structure of the data type.
Specifically, ensure that if a field is defined as a generic tuple, then it
will be converted into an instance of `Field`.
"""
if isinstance(data_type, _ATOMIC):
out = data_type
elif isinstance(data_type, Array):
... | python | def _consolidate(data_type):
"""Enforce the structure of the data type.
Specifically, ensure that if a field is defined as a generic tuple, then it
will be converted into an instance of `Field`.
"""
if isinstance(data_type, _ATOMIC):
out = data_type
elif isinstance(data_type, Array):
... | [
"def",
"_consolidate",
"(",
"data_type",
")",
":",
"if",
"isinstance",
"(",
"data_type",
",",
"_ATOMIC",
")",
":",
"out",
"=",
"data_type",
"elif",
"isinstance",
"(",
"data_type",
",",
"Array",
")",
":",
"element_type",
"=",
"_consolidate",
"(",
"data_type",... | Enforce the structure of the data type.
Specifically, ensure that if a field is defined as a generic tuple, then it
will be converted into an instance of `Field`. | [
"Enforce",
"the",
"structure",
"of",
"the",
"data",
"type",
"."
] | 296ae50c0cdcfd3ed0cba23a4d2edea0d124bcb1 | https://github.com/christophercrouzet/nani/blob/296ae50c0cdcfd3ed0cba23a4d2edea0d124bcb1/nani.py#L888-L907 |
244,028 | christophercrouzet/nani | nani.py | _resolve_dtype | def _resolve_dtype(data_type):
"""Retrieve the corresponding NumPy's `dtype` for a given data type."""
if isinstance(data_type, _FIXED_ATOMIC):
out = _get_atomic_dtype(data_type)
elif isinstance(data_type, _FLEXIBLE_ATOMIC):
out = (_get_atomic_dtype(data_type), data_type.length)
elif isi... | python | def _resolve_dtype(data_type):
"""Retrieve the corresponding NumPy's `dtype` for a given data type."""
if isinstance(data_type, _FIXED_ATOMIC):
out = _get_atomic_dtype(data_type)
elif isinstance(data_type, _FLEXIBLE_ATOMIC):
out = (_get_atomic_dtype(data_type), data_type.length)
elif isi... | [
"def",
"_resolve_dtype",
"(",
"data_type",
")",
":",
"if",
"isinstance",
"(",
"data_type",
",",
"_FIXED_ATOMIC",
")",
":",
"out",
"=",
"_get_atomic_dtype",
"(",
"data_type",
")",
"elif",
"isinstance",
"(",
"data_type",
",",
"_FLEXIBLE_ATOMIC",
")",
":",
"out",... | Retrieve the corresponding NumPy's `dtype` for a given data type. | [
"Retrieve",
"the",
"corresponding",
"NumPy",
"s",
"dtype",
"for",
"a",
"given",
"data",
"type",
"."
] | 296ae50c0cdcfd3ed0cba23a4d2edea0d124bcb1 | https://github.com/christophercrouzet/nani/blob/296ae50c0cdcfd3ed0cba23a4d2edea0d124bcb1/nani.py#L910-L929 |
244,029 | christophercrouzet/nani | nani.py | _resolve_default | def _resolve_default(data_type, listify=False):
"""Retrieve the default value for a given data type."""
if isinstance(data_type, _ATOMIC):
# A Python's object type needs to be left as is instead of being
# wrapped into a NumPy type.
out = (data_type.default if isinstance(data_type, Objec... | python | def _resolve_default(data_type, listify=False):
"""Retrieve the default value for a given data type."""
if isinstance(data_type, _ATOMIC):
# A Python's object type needs to be left as is instead of being
# wrapped into a NumPy type.
out = (data_type.default if isinstance(data_type, Objec... | [
"def",
"_resolve_default",
"(",
"data_type",
",",
"listify",
"=",
"False",
")",
":",
"if",
"isinstance",
"(",
"data_type",
",",
"_ATOMIC",
")",
":",
"# A Python's object type needs to be left as is instead of being",
"# wrapped into a NumPy type.",
"out",
"=",
"(",
"dat... | Retrieve the default value for a given data type. | [
"Retrieve",
"the",
"default",
"value",
"for",
"a",
"given",
"data",
"type",
"."
] | 296ae50c0cdcfd3ed0cba23a4d2edea0d124bcb1 | https://github.com/christophercrouzet/nani/blob/296ae50c0cdcfd3ed0cba23a4d2edea0d124bcb1/nani.py#L932-L961 |
244,030 | christophercrouzet/nani | nani.py | _resolve_view | def _resolve_view(data_type):
"""Retrieve the view for a given data type.
Only one view class is returned, that is the one representing the root data
type, but more class objects might be dynamically created if the input
data type has nested elements, such as for the `Array` and `Structure`
types.
... | python | def _resolve_view(data_type):
"""Retrieve the view for a given data type.
Only one view class is returned, that is the one representing the root data
type, but more class objects might be dynamically created if the input
data type has nested elements, such as for the `Array` and `Structure`
types.
... | [
"def",
"_resolve_view",
"(",
"data_type",
")",
":",
"view",
"=",
"getattr",
"(",
"data_type",
",",
"'view'",
",",
"None",
")",
"if",
"view",
"is",
"not",
"None",
":",
"return",
"view",
"if",
"isinstance",
"(",
"data_type",
",",
"_ATOMIC",
")",
":",
"ou... | Retrieve the view for a given data type.
Only one view class is returned, that is the one representing the root data
type, but more class objects might be dynamically created if the input
data type has nested elements, such as for the `Array` and `Structure`
types.
The default behaviour of dynamic... | [
"Retrieve",
"the",
"view",
"for",
"a",
"given",
"data",
"type",
"."
] | 296ae50c0cdcfd3ed0cba23a4d2edea0d124bcb1 | https://github.com/christophercrouzet/nani/blob/296ae50c0cdcfd3ed0cba23a4d2edea0d124bcb1/nani.py#L964-L986 |
244,031 | christophercrouzet/nani | nani.py | _define_array_view | def _define_array_view(data_type):
"""Define a new view object for a `Array` type."""
element_type = data_type.element_type
element_view = _resolve_view(element_type)
if element_view is None:
mixins = (_DirectArrayViewMixin,)
attributes = _get_mixin_attributes(mixins)
elif isinstance... | python | def _define_array_view(data_type):
"""Define a new view object for a `Array` type."""
element_type = data_type.element_type
element_view = _resolve_view(element_type)
if element_view is None:
mixins = (_DirectArrayViewMixin,)
attributes = _get_mixin_attributes(mixins)
elif isinstance... | [
"def",
"_define_array_view",
"(",
"data_type",
")",
":",
"element_type",
"=",
"data_type",
".",
"element_type",
"element_view",
"=",
"_resolve_view",
"(",
"element_type",
")",
"if",
"element_view",
"is",
"None",
":",
"mixins",
"=",
"(",
"_DirectArrayViewMixin",
",... | Define a new view object for a `Array` type. | [
"Define",
"a",
"new",
"view",
"object",
"for",
"a",
"Array",
"type",
"."
] | 296ae50c0cdcfd3ed0cba23a4d2edea0d124bcb1 | https://github.com/christophercrouzet/nani/blob/296ae50c0cdcfd3ed0cba23a4d2edea0d124bcb1/nani.py#L989-L1010 |
244,032 | christophercrouzet/nani | nani.py | _define_structure_view | def _define_structure_view(data_type):
"""Define a new view object for a `Structure` type."""
def define_getter(field_index, field_type, field_view):
if field_view is None:
def getter(self):
return self._data[field_index]
elif isinstance(field_type, _ATOMIC):
... | python | def _define_structure_view(data_type):
"""Define a new view object for a `Structure` type."""
def define_getter(field_index, field_type, field_view):
if field_view is None:
def getter(self):
return self._data[field_index]
elif isinstance(field_type, _ATOMIC):
... | [
"def",
"_define_structure_view",
"(",
"data_type",
")",
":",
"def",
"define_getter",
"(",
"field_index",
",",
"field_type",
",",
"field_view",
")",
":",
"if",
"field_view",
"is",
"None",
":",
"def",
"getter",
"(",
"self",
")",
":",
"return",
"self",
".",
"... | Define a new view object for a `Structure` type. | [
"Define",
"a",
"new",
"view",
"object",
"for",
"a",
"Structure",
"type",
"."
] | 296ae50c0cdcfd3ed0cba23a4d2edea0d124bcb1 | https://github.com/christophercrouzet/nani/blob/296ae50c0cdcfd3ed0cba23a4d2edea0d124bcb1/nani.py#L1013-L1048 |
244,033 | christophercrouzet/nani | nani.py | _get_mixin_attributes | def _get_mixin_attributes(mixins):
"""Retrieve the attributes for a given set of mixin classes.
The attributes of each mixin class are being merged into a single
dictionary.
"""
return {attribute: mixin.__dict__[attribute]
for mixin in mixins
for attribute in _MIXIN_ATTRIBUT... | python | def _get_mixin_attributes(mixins):
"""Retrieve the attributes for a given set of mixin classes.
The attributes of each mixin class are being merged into a single
dictionary.
"""
return {attribute: mixin.__dict__[attribute]
for mixin in mixins
for attribute in _MIXIN_ATTRIBUT... | [
"def",
"_get_mixin_attributes",
"(",
"mixins",
")",
":",
"return",
"{",
"attribute",
":",
"mixin",
".",
"__dict__",
"[",
"attribute",
"]",
"for",
"mixin",
"in",
"mixins",
"for",
"attribute",
"in",
"_MIXIN_ATTRIBUTES",
"[",
"mixin",
"]",
"}"
] | Retrieve the attributes for a given set of mixin classes.
The attributes of each mixin class are being merged into a single
dictionary. | [
"Retrieve",
"the",
"attributes",
"for",
"a",
"given",
"set",
"of",
"mixin",
"classes",
"."
] | 296ae50c0cdcfd3ed0cba23a4d2edea0d124bcb1 | https://github.com/christophercrouzet/nani/blob/296ae50c0cdcfd3ed0cba23a4d2edea0d124bcb1/nani.py#L1051-L1059 |
244,034 | christophercrouzet/nani | nani.py | _get_atomic_dtype | def _get_atomic_dtype(data_type):
"""Retrieve the NumPy's `dtype` for a given atomic data type."""
atomic_type = getattr(data_type, 'type', None)
if atomic_type is not None:
return atomic_type
return _PREDEFINED_ATOMIC_NUMPY_TYPES[_find_base_type(data_type)] | python | def _get_atomic_dtype(data_type):
"""Retrieve the NumPy's `dtype` for a given atomic data type."""
atomic_type = getattr(data_type, 'type', None)
if atomic_type is not None:
return atomic_type
return _PREDEFINED_ATOMIC_NUMPY_TYPES[_find_base_type(data_type)] | [
"def",
"_get_atomic_dtype",
"(",
"data_type",
")",
":",
"atomic_type",
"=",
"getattr",
"(",
"data_type",
",",
"'type'",
",",
"None",
")",
"if",
"atomic_type",
"is",
"not",
"None",
":",
"return",
"atomic_type",
"return",
"_PREDEFINED_ATOMIC_NUMPY_TYPES",
"[",
"_f... | Retrieve the NumPy's `dtype` for a given atomic data type. | [
"Retrieve",
"the",
"NumPy",
"s",
"dtype",
"for",
"a",
"given",
"atomic",
"data",
"type",
"."
] | 296ae50c0cdcfd3ed0cba23a4d2edea0d124bcb1 | https://github.com/christophercrouzet/nani/blob/296ae50c0cdcfd3ed0cba23a4d2edea0d124bcb1/nani.py#L1062-L1068 |
244,035 | christophercrouzet/nani | nani.py | _find_base_type | def _find_base_type(data_type):
"""Find the Nani's base type for a given data type.
This is useful when Nani's data types were subclassed and the original type
is required.
"""
bases = type(data_type).__mro__
for base in bases:
if base in _ALL:
return base
return None | python | def _find_base_type(data_type):
"""Find the Nani's base type for a given data type.
This is useful when Nani's data types were subclassed and the original type
is required.
"""
bases = type(data_type).__mro__
for base in bases:
if base in _ALL:
return base
return None | [
"def",
"_find_base_type",
"(",
"data_type",
")",
":",
"bases",
"=",
"type",
"(",
"data_type",
")",
".",
"__mro__",
"for",
"base",
"in",
"bases",
":",
"if",
"base",
"in",
"_ALL",
":",
"return",
"base",
"return",
"None"
] | Find the Nani's base type for a given data type.
This is useful when Nani's data types were subclassed and the original type
is required. | [
"Find",
"the",
"Nani",
"s",
"base",
"type",
"for",
"a",
"given",
"data",
"type",
"."
] | 296ae50c0cdcfd3ed0cba23a4d2edea0d124bcb1 | https://github.com/christophercrouzet/nani/blob/296ae50c0cdcfd3ed0cba23a4d2edea0d124bcb1/nani.py#L1071-L1082 |
244,036 | christophercrouzet/nani | nani.py | _find_duplicates | def _find_duplicates(seq):
"""Find the duplicate elements from a sequence."""
seen = set()
return [element for element in seq
if seq.count(element) > 1
and element not in seen and seen.add(element) is None] | python | def _find_duplicates(seq):
"""Find the duplicate elements from a sequence."""
seen = set()
return [element for element in seq
if seq.count(element) > 1
and element not in seen and seen.add(element) is None] | [
"def",
"_find_duplicates",
"(",
"seq",
")",
":",
"seen",
"=",
"set",
"(",
")",
"return",
"[",
"element",
"for",
"element",
"in",
"seq",
"if",
"seq",
".",
"count",
"(",
"element",
")",
">",
"1",
"and",
"element",
"not",
"in",
"seen",
"and",
"seen",
... | Find the duplicate elements from a sequence. | [
"Find",
"the",
"duplicate",
"elements",
"from",
"a",
"sequence",
"."
] | 296ae50c0cdcfd3ed0cba23a4d2edea0d124bcb1 | https://github.com/christophercrouzet/nani/blob/296ae50c0cdcfd3ed0cba23a4d2edea0d124bcb1/nani.py#L1085-L1090 |
244,037 | christophercrouzet/nani | nani.py | _format_type | def _format_type(cls):
"""Format a type name for printing."""
if cls.__module__ == _BUILTIN_MODULE:
return cls.__name__
else:
return '%s.%s' % (cls.__module__, cls.__name__) | python | def _format_type(cls):
"""Format a type name for printing."""
if cls.__module__ == _BUILTIN_MODULE:
return cls.__name__
else:
return '%s.%s' % (cls.__module__, cls.__name__) | [
"def",
"_format_type",
"(",
"cls",
")",
":",
"if",
"cls",
".",
"__module__",
"==",
"_BUILTIN_MODULE",
":",
"return",
"cls",
".",
"__name__",
"else",
":",
"return",
"'%s.%s'",
"%",
"(",
"cls",
".",
"__module__",
",",
"cls",
".",
"__name__",
")"
] | Format a type name for printing. | [
"Format",
"a",
"type",
"name",
"for",
"printing",
"."
] | 296ae50c0cdcfd3ed0cba23a4d2edea0d124bcb1 | https://github.com/christophercrouzet/nani/blob/296ae50c0cdcfd3ed0cba23a4d2edea0d124bcb1/nani.py#L1093-L1098 |
244,038 | christophercrouzet/nani | nani.py | _format_element | def _format_element(element, count, index, last_separator):
"""Format an element from a sequence.
This only prepends a separator for the last element and wraps each element
with single quotes.
"""
return ("%s'%s'" % (last_separator, element)
if count > 1 and index == count - 1
... | python | def _format_element(element, count, index, last_separator):
"""Format an element from a sequence.
This only prepends a separator for the last element and wraps each element
with single quotes.
"""
return ("%s'%s'" % (last_separator, element)
if count > 1 and index == count - 1
... | [
"def",
"_format_element",
"(",
"element",
",",
"count",
",",
"index",
",",
"last_separator",
")",
":",
"return",
"(",
"\"%s'%s'\"",
"%",
"(",
"last_separator",
",",
"element",
")",
"if",
"count",
">",
"1",
"and",
"index",
"==",
"count",
"-",
"1",
"else",... | Format an element from a sequence.
This only prepends a separator for the last element and wraps each element
with single quotes. | [
"Format",
"an",
"element",
"from",
"a",
"sequence",
"."
] | 296ae50c0cdcfd3ed0cba23a4d2edea0d124bcb1 | https://github.com/christophercrouzet/nani/blob/296ae50c0cdcfd3ed0cba23a4d2edea0d124bcb1/nani.py#L1101-L1109 |
244,039 | christophercrouzet/nani | nani.py | _join_sequence | def _join_sequence(seq, last_separator=''):
"""Join a sequence into a string."""
count = len(seq)
return ', '.join(_format_element(element, count, i, last_separator)
for i, element in enumerate(seq)) | python | def _join_sequence(seq, last_separator=''):
"""Join a sequence into a string."""
count = len(seq)
return ', '.join(_format_element(element, count, i, last_separator)
for i, element in enumerate(seq)) | [
"def",
"_join_sequence",
"(",
"seq",
",",
"last_separator",
"=",
"''",
")",
":",
"count",
"=",
"len",
"(",
"seq",
")",
"return",
"', '",
".",
"join",
"(",
"_format_element",
"(",
"element",
",",
"count",
",",
"i",
",",
"last_separator",
")",
"for",
"i"... | Join a sequence into a string. | [
"Join",
"a",
"sequence",
"into",
"a",
"string",
"."
] | 296ae50c0cdcfd3ed0cba23a4d2edea0d124bcb1 | https://github.com/christophercrouzet/nani/blob/296ae50c0cdcfd3ed0cba23a4d2edea0d124bcb1/nani.py#L1112-L1116 |
244,040 | christophercrouzet/nani | nani.py | _join_types | def _join_types(seq, last_separator=''):
"""Join class object names into a string."""
class_names = [_format_type(cls) for cls in seq]
return _join_sequence(class_names, last_separator) | python | def _join_types(seq, last_separator=''):
"""Join class object names into a string."""
class_names = [_format_type(cls) for cls in seq]
return _join_sequence(class_names, last_separator) | [
"def",
"_join_types",
"(",
"seq",
",",
"last_separator",
"=",
"''",
")",
":",
"class_names",
"=",
"[",
"_format_type",
"(",
"cls",
")",
"for",
"cls",
"in",
"seq",
"]",
"return",
"_join_sequence",
"(",
"class_names",
",",
"last_separator",
")"
] | Join class object names into a string. | [
"Join",
"class",
"object",
"names",
"into",
"a",
"string",
"."
] | 296ae50c0cdcfd3ed0cba23a4d2edea0d124bcb1 | https://github.com/christophercrouzet/nani/blob/296ae50c0cdcfd3ed0cba23a4d2edea0d124bcb1/nani.py#L1119-L1122 |
244,041 | lambdalisue/maidenhair | src/maidenhair/loaders/base.py | slice_columns | def slice_columns(x, using=None):
"""
Slice a numpy array to make columns
Parameters
----------
x : ndarray
A numpy array instance
using : list of integer or slice instance or None, optional
A list of index or slice instance
Returns
-------
ndarray
A list of... | python | def slice_columns(x, using=None):
"""
Slice a numpy array to make columns
Parameters
----------
x : ndarray
A numpy array instance
using : list of integer or slice instance or None, optional
A list of index or slice instance
Returns
-------
ndarray
A list of... | [
"def",
"slice_columns",
"(",
"x",
",",
"using",
"=",
"None",
")",
":",
"if",
"using",
"is",
"None",
":",
"using",
"=",
"range",
"(",
"0",
",",
"len",
"(",
"x",
"[",
"0",
"]",
")",
")",
"return",
"[",
"x",
"[",
":",
",",
"s",
"]",
"for",
"s"... | Slice a numpy array to make columns
Parameters
----------
x : ndarray
A numpy array instance
using : list of integer or slice instance or None, optional
A list of index or slice instance
Returns
-------
ndarray
A list of numpy array columns sliced | [
"Slice",
"a",
"numpy",
"array",
"to",
"make",
"columns"
] | d5095c1087d1f4d71cc57410492151d2803a9f0d | https://github.com/lambdalisue/maidenhair/blob/d5095c1087d1f4d71cc57410492151d2803a9f0d/src/maidenhair/loaders/base.py#L156-L175 |
244,042 | lambdalisue/maidenhair | src/maidenhair/loaders/base.py | unite_dataset | def unite_dataset(dataset, basecolumn=0):
"""
Unite dataset into a single data
Parameters
----------
dataset : list of ndarray
A data list of a column list of a numpy arrays
basecolumn : integer, optional
An index of base column.
All data will be trimmed based on the ord... | python | def unite_dataset(dataset, basecolumn=0):
"""
Unite dataset into a single data
Parameters
----------
dataset : list of ndarray
A data list of a column list of a numpy arrays
basecolumn : integer, optional
An index of base column.
All data will be trimmed based on the ord... | [
"def",
"unite_dataset",
"(",
"dataset",
",",
"basecolumn",
"=",
"0",
")",
":",
"ndata",
"=",
"[",
"None",
"]",
"*",
"len",
"(",
"dataset",
"[",
"0",
"]",
")",
"for",
"pdata",
"in",
"dataset",
":",
"# select basecolumn",
"bnx",
"=",
"ndata",
"[",
"bas... | Unite dataset into a single data
Parameters
----------
dataset : list of ndarray
A data list of a column list of a numpy arrays
basecolumn : integer, optional
An index of base column.
All data will be trimmed based on the order of this column when the
number of samples a... | [
"Unite",
"dataset",
"into",
"a",
"single",
"data"
] | d5095c1087d1f4d71cc57410492151d2803a9f0d | https://github.com/lambdalisue/maidenhair/blob/d5095c1087d1f4d71cc57410492151d2803a9f0d/src/maidenhair/loaders/base.py#L177-L222 |
244,043 | lambdalisue/maidenhair | src/maidenhair/loaders/base.py | BaseLoader.load | def load(self, filename, using=None, parser=None, **kwargs):
"""
Load data from file using a specified parser.
Return value will be separated or sliced into a column list
Parameters
----------
filename : string
A data file path
using : list of intege... | python | def load(self, filename, using=None, parser=None, **kwargs):
"""
Load data from file using a specified parser.
Return value will be separated or sliced into a column list
Parameters
----------
filename : string
A data file path
using : list of intege... | [
"def",
"load",
"(",
"self",
",",
"filename",
",",
"using",
"=",
"None",
",",
"parser",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"using",
"=",
"using",
"or",
"self",
".",
"using",
"parser",
"=",
"parser",
"or",
"self",
".",
"parser",
"if",
... | Load data from file using a specified parser.
Return value will be separated or sliced into a column list
Parameters
----------
filename : string
A data file path
using : list of integer, slice instance, or None, optional
A list of index or slice instanc... | [
"Load",
"data",
"from",
"file",
"using",
"a",
"specified",
"parser",
"."
] | d5095c1087d1f4d71cc57410492151d2803a9f0d | https://github.com/lambdalisue/maidenhair/blob/d5095c1087d1f4d71cc57410492151d2803a9f0d/src/maidenhair/loaders/base.py#L40-L72 |
244,044 | lambdalisue/django-roughpages | src/roughpages/backends/auth.py | AuthTemplateFilenameBackend.prepare_filenames | def prepare_filenames(self, normalized_url, request):
"""
Prepare template filename list based on the user authenticated state
If user is authenticated user, it use '_authenticated' as a suffix.
Otherwise it use '_anonymous' as a suffix to produce the template
filename list. The... | python | def prepare_filenames(self, normalized_url, request):
"""
Prepare template filename list based on the user authenticated state
If user is authenticated user, it use '_authenticated' as a suffix.
Otherwise it use '_anonymous' as a suffix to produce the template
filename list. The... | [
"def",
"prepare_filenames",
"(",
"self",
",",
"normalized_url",
",",
"request",
")",
":",
"filenames",
"=",
"[",
"normalized_url",
"]",
"if",
"request",
".",
"user",
".",
"is_authenticated",
"(",
")",
":",
"filenames",
".",
"insert",
"(",
"0",
",",
"normal... | Prepare template filename list based on the user authenticated state
If user is authenticated user, it use '_authenticated' as a suffix.
Otherwise it use '_anonymous' as a suffix to produce the template
filename list. The list include original filename at the end of the
list.
A... | [
"Prepare",
"template",
"filename",
"list",
"based",
"on",
"the",
"user",
"authenticated",
"state"
] | f6a2724ece729c5deced2c2546d172561ef785ec | https://github.com/lambdalisue/django-roughpages/blob/f6a2724ece729c5deced2c2546d172561ef785ec/src/roughpages/backends/auth.py#L16-L70 |
244,045 | rameshg87/pyremotevbox | pyremotevbox/ZSI/wstools/WSDLTools.py | WSDLReader.loadFromStream | def loadFromStream(self, stream, name=None):
"""Return a WSDL instance loaded from a stream object."""
document = DOM.loadDocument(stream)
wsdl = WSDL()
if name:
wsdl.location = name
elif hasattr(stream, 'name'):
wsdl.location = stream.name
wsdl.lo... | python | def loadFromStream(self, stream, name=None):
"""Return a WSDL instance loaded from a stream object."""
document = DOM.loadDocument(stream)
wsdl = WSDL()
if name:
wsdl.location = name
elif hasattr(stream, 'name'):
wsdl.location = stream.name
wsdl.lo... | [
"def",
"loadFromStream",
"(",
"self",
",",
"stream",
",",
"name",
"=",
"None",
")",
":",
"document",
"=",
"DOM",
".",
"loadDocument",
"(",
"stream",
")",
"wsdl",
"=",
"WSDL",
"(",
")",
"if",
"name",
":",
"wsdl",
".",
"location",
"=",
"name",
"elif",
... | Return a WSDL instance loaded from a stream object. | [
"Return",
"a",
"WSDL",
"instance",
"loaded",
"from",
"a",
"stream",
"object",
"."
] | 123dffff27da57c8faa3ac1dd4c68b1cf4558b1a | https://github.com/rameshg87/pyremotevbox/blob/123dffff27da57c8faa3ac1dd4c68b1cf4558b1a/pyremotevbox/ZSI/wstools/WSDLTools.py#L26-L35 |
244,046 | rameshg87/pyremotevbox | pyremotevbox/ZSI/wstools/WSDLTools.py | WSDLReader.loadFromURL | def loadFromURL(self, url):
"""Return a WSDL instance loaded from the given url."""
document = DOM.loadFromURL(url)
wsdl = WSDL()
wsdl.location = url
wsdl.load(document)
return wsdl | python | def loadFromURL(self, url):
"""Return a WSDL instance loaded from the given url."""
document = DOM.loadFromURL(url)
wsdl = WSDL()
wsdl.location = url
wsdl.load(document)
return wsdl | [
"def",
"loadFromURL",
"(",
"self",
",",
"url",
")",
":",
"document",
"=",
"DOM",
".",
"loadFromURL",
"(",
"url",
")",
"wsdl",
"=",
"WSDL",
"(",
")",
"wsdl",
".",
"location",
"=",
"url",
"wsdl",
".",
"load",
"(",
"document",
")",
"return",
"wsdl"
] | Return a WSDL instance loaded from the given url. | [
"Return",
"a",
"WSDL",
"instance",
"loaded",
"from",
"the",
"given",
"url",
"."
] | 123dffff27da57c8faa3ac1dd4c68b1cf4558b1a | https://github.com/rameshg87/pyremotevbox/blob/123dffff27da57c8faa3ac1dd4c68b1cf4558b1a/pyremotevbox/ZSI/wstools/WSDLTools.py#L37-L43 |
244,047 | rameshg87/pyremotevbox | pyremotevbox/ZSI/wstools/WSDLTools.py | WSDLReader.loadFromFile | def loadFromFile(self, filename):
"""Return a WSDL instance loaded from the given file."""
file = open(filename, 'rb')
try:
wsdl = self.loadFromStream(file)
finally:
file.close()
return wsdl | python | def loadFromFile(self, filename):
"""Return a WSDL instance loaded from the given file."""
file = open(filename, 'rb')
try:
wsdl = self.loadFromStream(file)
finally:
file.close()
return wsdl | [
"def",
"loadFromFile",
"(",
"self",
",",
"filename",
")",
":",
"file",
"=",
"open",
"(",
"filename",
",",
"'rb'",
")",
"try",
":",
"wsdl",
"=",
"self",
".",
"loadFromStream",
"(",
"file",
")",
"finally",
":",
"file",
".",
"close",
"(",
")",
"return",... | Return a WSDL instance loaded from the given file. | [
"Return",
"a",
"WSDL",
"instance",
"loaded",
"from",
"the",
"given",
"file",
"."
] | 123dffff27da57c8faa3ac1dd4c68b1cf4558b1a | https://github.com/rameshg87/pyremotevbox/blob/123dffff27da57c8faa3ac1dd4c68b1cf4558b1a/pyremotevbox/ZSI/wstools/WSDLTools.py#L49-L56 |
244,048 | rameshg87/pyremotevbox | pyremotevbox/ZSI/wstools/WSDLTools.py | WSDL.toDom | def toDom(self):
""" Generate a DOM representation of the WSDL instance.
Not dealing with generating XML Schema, thus the targetNamespace
of all XML Schema elements or types used by WSDL message parts
needs to be specified via import information items.
"""
namespaceURI =... | python | def toDom(self):
""" Generate a DOM representation of the WSDL instance.
Not dealing with generating XML Schema, thus the targetNamespace
of all XML Schema elements or types used by WSDL message parts
needs to be specified via import information items.
"""
namespaceURI =... | [
"def",
"toDom",
"(",
"self",
")",
":",
"namespaceURI",
"=",
"DOM",
".",
"GetWSDLUri",
"(",
"self",
".",
"version",
")",
"self",
".",
"document",
"=",
"DOM",
".",
"createDocument",
"(",
"namespaceURI",
",",
"'wsdl:definitions'",
")",
"# Set up a couple prefixes... | Generate a DOM representation of the WSDL instance.
Not dealing with generating XML Schema, thus the targetNamespace
of all XML Schema elements or types used by WSDL message parts
needs to be specified via import information items. | [
"Generate",
"a",
"DOM",
"representation",
"of",
"the",
"WSDL",
"instance",
".",
"Not",
"dealing",
"with",
"generating",
"XML",
"Schema",
"thus",
"the",
"targetNamespace",
"of",
"all",
"XML",
"Schema",
"elements",
"or",
"types",
"used",
"by",
"WSDL",
"message",... | 123dffff27da57c8faa3ac1dd4c68b1cf4558b1a | https://github.com/rameshg87/pyremotevbox/blob/123dffff27da57c8faa3ac1dd4c68b1cf4558b1a/pyremotevbox/ZSI/wstools/WSDLTools.py#L133-L167 |
244,049 | rameshg87/pyremotevbox | pyremotevbox/ZSI/wstools/WSDLTools.py | Element.getWSDL | def getWSDL(self):
"""Return the WSDL object that contains this information item."""
parent = self
while 1:
# skip any collections
if isinstance(parent, WSDL):
return parent
try: parent = parent.parent()
except: break
... | python | def getWSDL(self):
"""Return the WSDL object that contains this information item."""
parent = self
while 1:
# skip any collections
if isinstance(parent, WSDL):
return parent
try: parent = parent.parent()
except: break
... | [
"def",
"getWSDL",
"(",
"self",
")",
":",
"parent",
"=",
"self",
"while",
"1",
":",
"# skip any collections",
"if",
"isinstance",
"(",
"parent",
",",
"WSDL",
")",
":",
"return",
"parent",
"try",
":",
"parent",
"=",
"parent",
".",
"parent",
"(",
")",
"ex... | Return the WSDL object that contains this information item. | [
"Return",
"the",
"WSDL",
"object",
"that",
"contains",
"this",
"information",
"item",
"."
] | 123dffff27da57c8faa3ac1dd4c68b1cf4558b1a | https://github.com/rameshg87/pyremotevbox/blob/123dffff27da57c8faa3ac1dd4c68b1cf4558b1a/pyremotevbox/ZSI/wstools/WSDLTools.py#L383-L393 |
244,050 | rameshg87/pyremotevbox | pyremotevbox/ZSI/wstools/WSDLTools.py | Port.getBinding | def getBinding(self):
"""Return the Binding object that is referenced by this port."""
wsdl = self.getService().getWSDL()
return wsdl.bindings[self.binding] | python | def getBinding(self):
"""Return the Binding object that is referenced by this port."""
wsdl = self.getService().getWSDL()
return wsdl.bindings[self.binding] | [
"def",
"getBinding",
"(",
"self",
")",
":",
"wsdl",
"=",
"self",
".",
"getService",
"(",
")",
".",
"getWSDL",
"(",
")",
"return",
"wsdl",
".",
"bindings",
"[",
"self",
".",
"binding",
"]"
] | Return the Binding object that is referenced by this port. | [
"Return",
"the",
"Binding",
"object",
"that",
"is",
"referenced",
"by",
"this",
"port",
"."
] | 123dffff27da57c8faa3ac1dd4c68b1cf4558b1a | https://github.com/rameshg87/pyremotevbox/blob/123dffff27da57c8faa3ac1dd4c68b1cf4558b1a/pyremotevbox/ZSI/wstools/WSDLTools.py#L1097-L1100 |
244,051 | rameshg87/pyremotevbox | pyremotevbox/ZSI/wstools/WSDLTools.py | Port.getPortType | def getPortType(self):
"""Return the PortType object that is referenced by this port."""
wsdl = self.getService().getWSDL()
binding = wsdl.bindings[self.binding]
return wsdl.portTypes[binding.type] | python | def getPortType(self):
"""Return the PortType object that is referenced by this port."""
wsdl = self.getService().getWSDL()
binding = wsdl.bindings[self.binding]
return wsdl.portTypes[binding.type] | [
"def",
"getPortType",
"(",
"self",
")",
":",
"wsdl",
"=",
"self",
".",
"getService",
"(",
")",
".",
"getWSDL",
"(",
")",
"binding",
"=",
"wsdl",
".",
"bindings",
"[",
"self",
".",
"binding",
"]",
"return",
"wsdl",
".",
"portTypes",
"[",
"binding",
".... | Return the PortType object that is referenced by this port. | [
"Return",
"the",
"PortType",
"object",
"that",
"is",
"referenced",
"by",
"this",
"port",
"."
] | 123dffff27da57c8faa3ac1dd4c68b1cf4558b1a | https://github.com/rameshg87/pyremotevbox/blob/123dffff27da57c8faa3ac1dd4c68b1cf4558b1a/pyremotevbox/ZSI/wstools/WSDLTools.py#L1102-L1106 |
244,052 | rameshg87/pyremotevbox | pyremotevbox/ZSI/wstools/WSDLTools.py | Port.getAddressBinding | def getAddressBinding(self):
"""A convenience method to obtain the extension element used
as the address binding for the port."""
for item in self.extensions:
if isinstance(item, SoapAddressBinding) or \
isinstance(item, HttpAddressBinding):
return i... | python | def getAddressBinding(self):
"""A convenience method to obtain the extension element used
as the address binding for the port."""
for item in self.extensions:
if isinstance(item, SoapAddressBinding) or \
isinstance(item, HttpAddressBinding):
return i... | [
"def",
"getAddressBinding",
"(",
"self",
")",
":",
"for",
"item",
"in",
"self",
".",
"extensions",
":",
"if",
"isinstance",
"(",
"item",
",",
"SoapAddressBinding",
")",
"or",
"isinstance",
"(",
"item",
",",
"HttpAddressBinding",
")",
":",
"return",
"item",
... | A convenience method to obtain the extension element used
as the address binding for the port. | [
"A",
"convenience",
"method",
"to",
"obtain",
"the",
"extension",
"element",
"used",
"as",
"the",
"address",
"binding",
"for",
"the",
"port",
"."
] | 123dffff27da57c8faa3ac1dd4c68b1cf4558b1a | https://github.com/rameshg87/pyremotevbox/blob/123dffff27da57c8faa3ac1dd4c68b1cf4558b1a/pyremotevbox/ZSI/wstools/WSDLTools.py#L1108-L1117 |
244,053 | rameshg87/pyremotevbox | pyremotevbox/ZSI/wstools/WSDLTools.py | SOAPCallInfo.addInParameter | def addInParameter(self, name, type, namespace=None, element_type=0):
"""Add an input parameter description to the call info."""
parameter = ParameterInfo(name, type, namespace, element_type)
self.inparams.append(parameter)
return parameter | python | def addInParameter(self, name, type, namespace=None, element_type=0):
"""Add an input parameter description to the call info."""
parameter = ParameterInfo(name, type, namespace, element_type)
self.inparams.append(parameter)
return parameter | [
"def",
"addInParameter",
"(",
"self",
",",
"name",
",",
"type",
",",
"namespace",
"=",
"None",
",",
"element_type",
"=",
"0",
")",
":",
"parameter",
"=",
"ParameterInfo",
"(",
"name",
",",
"type",
",",
"namespace",
",",
"element_type",
")",
"self",
".",
... | Add an input parameter description to the call info. | [
"Add",
"an",
"input",
"parameter",
"description",
"to",
"the",
"call",
"info",
"."
] | 123dffff27da57c8faa3ac1dd4c68b1cf4558b1a | https://github.com/rameshg87/pyremotevbox/blob/123dffff27da57c8faa3ac1dd4c68b1cf4558b1a/pyremotevbox/ZSI/wstools/WSDLTools.py#L1467-L1471 |
244,054 | rameshg87/pyremotevbox | pyremotevbox/ZSI/wstools/WSDLTools.py | SOAPCallInfo.addOutParameter | def addOutParameter(self, name, type, namespace=None, element_type=0):
"""Add an output parameter description to the call info."""
parameter = ParameterInfo(name, type, namespace, element_type)
self.outparams.append(parameter)
return parameter | python | def addOutParameter(self, name, type, namespace=None, element_type=0):
"""Add an output parameter description to the call info."""
parameter = ParameterInfo(name, type, namespace, element_type)
self.outparams.append(parameter)
return parameter | [
"def",
"addOutParameter",
"(",
"self",
",",
"name",
",",
"type",
",",
"namespace",
"=",
"None",
",",
"element_type",
"=",
"0",
")",
":",
"parameter",
"=",
"ParameterInfo",
"(",
"name",
",",
"type",
",",
"namespace",
",",
"element_type",
")",
"self",
".",... | Add an output parameter description to the call info. | [
"Add",
"an",
"output",
"parameter",
"description",
"to",
"the",
"call",
"info",
"."
] | 123dffff27da57c8faa3ac1dd4c68b1cf4558b1a | https://github.com/rameshg87/pyremotevbox/blob/123dffff27da57c8faa3ac1dd4c68b1cf4558b1a/pyremotevbox/ZSI/wstools/WSDLTools.py#L1473-L1477 |
244,055 | rameshg87/pyremotevbox | pyremotevbox/ZSI/wstools/WSDLTools.py | SOAPCallInfo.setReturnParameter | def setReturnParameter(self, name, type, namespace=None, element_type=0):
"""Set the return parameter description for the call info."""
parameter = ParameterInfo(name, type, namespace, element_type)
self.retval = parameter
return parameter | python | def setReturnParameter(self, name, type, namespace=None, element_type=0):
"""Set the return parameter description for the call info."""
parameter = ParameterInfo(name, type, namespace, element_type)
self.retval = parameter
return parameter | [
"def",
"setReturnParameter",
"(",
"self",
",",
"name",
",",
"type",
",",
"namespace",
"=",
"None",
",",
"element_type",
"=",
"0",
")",
":",
"parameter",
"=",
"ParameterInfo",
"(",
"name",
",",
"type",
",",
"namespace",
",",
"element_type",
")",
"self",
"... | Set the return parameter description for the call info. | [
"Set",
"the",
"return",
"parameter",
"description",
"for",
"the",
"call",
"info",
"."
] | 123dffff27da57c8faa3ac1dd4c68b1cf4558b1a | https://github.com/rameshg87/pyremotevbox/blob/123dffff27da57c8faa3ac1dd4c68b1cf4558b1a/pyremotevbox/ZSI/wstools/WSDLTools.py#L1479-L1483 |
244,056 | rameshg87/pyremotevbox | pyremotevbox/ZSI/wstools/WSDLTools.py | SOAPCallInfo.addInHeaderInfo | def addInHeaderInfo(self, name, type, namespace, element_type=0,
mustUnderstand=0):
"""Add an input SOAP header description to the call info."""
headerinfo = HeaderInfo(name, type, namespace, element_type)
if mustUnderstand:
headerinfo.mustUnderstand = 1
... | python | def addInHeaderInfo(self, name, type, namespace, element_type=0,
mustUnderstand=0):
"""Add an input SOAP header description to the call info."""
headerinfo = HeaderInfo(name, type, namespace, element_type)
if mustUnderstand:
headerinfo.mustUnderstand = 1
... | [
"def",
"addInHeaderInfo",
"(",
"self",
",",
"name",
",",
"type",
",",
"namespace",
",",
"element_type",
"=",
"0",
",",
"mustUnderstand",
"=",
"0",
")",
":",
"headerinfo",
"=",
"HeaderInfo",
"(",
"name",
",",
"type",
",",
"namespace",
",",
"element_type",
... | Add an input SOAP header description to the call info. | [
"Add",
"an",
"input",
"SOAP",
"header",
"description",
"to",
"the",
"call",
"info",
"."
] | 123dffff27da57c8faa3ac1dd4c68b1cf4558b1a | https://github.com/rameshg87/pyremotevbox/blob/123dffff27da57c8faa3ac1dd4c68b1cf4558b1a/pyremotevbox/ZSI/wstools/WSDLTools.py#L1485-L1492 |
244,057 | rameshg87/pyremotevbox | pyremotevbox/ZSI/wstools/WSDLTools.py | SOAPCallInfo.addOutHeaderInfo | def addOutHeaderInfo(self, name, type, namespace, element_type=0,
mustUnderstand=0):
"""Add an output SOAP header description to the call info."""
headerinfo = HeaderInfo(name, type, namespace, element_type)
if mustUnderstand:
headerinfo.mustUnderstand = 1
... | python | def addOutHeaderInfo(self, name, type, namespace, element_type=0,
mustUnderstand=0):
"""Add an output SOAP header description to the call info."""
headerinfo = HeaderInfo(name, type, namespace, element_type)
if mustUnderstand:
headerinfo.mustUnderstand = 1
... | [
"def",
"addOutHeaderInfo",
"(",
"self",
",",
"name",
",",
"type",
",",
"namespace",
",",
"element_type",
"=",
"0",
",",
"mustUnderstand",
"=",
"0",
")",
":",
"headerinfo",
"=",
"HeaderInfo",
"(",
"name",
",",
"type",
",",
"namespace",
",",
"element_type",
... | Add an output SOAP header description to the call info. | [
"Add",
"an",
"output",
"SOAP",
"header",
"description",
"to",
"the",
"call",
"info",
"."
] | 123dffff27da57c8faa3ac1dd4c68b1cf4558b1a | https://github.com/rameshg87/pyremotevbox/blob/123dffff27da57c8faa3ac1dd4c68b1cf4558b1a/pyremotevbox/ZSI/wstools/WSDLTools.py#L1494-L1501 |
244,058 | padfoot27/merlin | venv/lib/python2.7/site-packages/setuptools/dist.py | check_requirements | def check_requirements(dist, attr, value):
"""Verify that install_requires is a valid requirements list"""
try:
list(pkg_resources.parse_requirements(value))
except (TypeError,ValueError):
raise DistutilsSetupError(
"%r must be a string or list of strings "
"containin... | python | def check_requirements(dist, attr, value):
"""Verify that install_requires is a valid requirements list"""
try:
list(pkg_resources.parse_requirements(value))
except (TypeError,ValueError):
raise DistutilsSetupError(
"%r must be a string or list of strings "
"containin... | [
"def",
"check_requirements",
"(",
"dist",
",",
"attr",
",",
"value",
")",
":",
"try",
":",
"list",
"(",
"pkg_resources",
".",
"parse_requirements",
"(",
"value",
")",
")",
"except",
"(",
"TypeError",
",",
"ValueError",
")",
":",
"raise",
"DistutilsSetupError... | Verify that install_requires is a valid requirements list | [
"Verify",
"that",
"install_requires",
"is",
"a",
"valid",
"requirements",
"list"
] | c317505c5eca0e774fcf8b8c7f08801479a5099a | https://github.com/padfoot27/merlin/blob/c317505c5eca0e774fcf8b8c7f08801479a5099a/venv/lib/python2.7/site-packages/setuptools/dist.py#L121-L129 |
244,059 | pudo-attic/loadkit | loadkit/types/table.py | Table.store | def store(self):
""" Create a context manager to store records in the cleaned
table. """
output = tempfile.NamedTemporaryFile(suffix='.json')
try:
def write(o):
line = json.dumps(o, default=json_default)
return output.write(line + '\n')
... | python | def store(self):
""" Create a context manager to store records in the cleaned
table. """
output = tempfile.NamedTemporaryFile(suffix='.json')
try:
def write(o):
line = json.dumps(o, default=json_default)
return output.write(line + '\n')
... | [
"def",
"store",
"(",
"self",
")",
":",
"output",
"=",
"tempfile",
".",
"NamedTemporaryFile",
"(",
"suffix",
"=",
"'.json'",
")",
"try",
":",
"def",
"write",
"(",
"o",
")",
":",
"line",
"=",
"json",
".",
"dumps",
"(",
"o",
",",
"default",
"=",
"json... | Create a context manager to store records in the cleaned
table. | [
"Create",
"a",
"context",
"manager",
"to",
"store",
"records",
"in",
"the",
"cleaned",
"table",
"."
] | 1fb17e69e2ffaf3dac4f40b574c3b7afb2198b7c | https://github.com/pudo-attic/loadkit/blob/1fb17e69e2ffaf3dac4f40b574c3b7afb2198b7c/loadkit/types/table.py#L21-L40 |
244,060 | pudo-attic/loadkit | loadkit/types/table.py | Table.records | def records(self):
""" Get each record that has been stored in the table. """
output = tempfile.NamedTemporaryFile(suffix='.json')
try:
log.info("Loading table from (%s)...", self._obj)
shutil.copyfileobj(self.fh(), output)
output.seek(0)
for line... | python | def records(self):
""" Get each record that has been stored in the table. """
output = tempfile.NamedTemporaryFile(suffix='.json')
try:
log.info("Loading table from (%s)...", self._obj)
shutil.copyfileobj(self.fh(), output)
output.seek(0)
for line... | [
"def",
"records",
"(",
"self",
")",
":",
"output",
"=",
"tempfile",
".",
"NamedTemporaryFile",
"(",
"suffix",
"=",
"'.json'",
")",
"try",
":",
"log",
".",
"info",
"(",
"\"Loading table from (%s)...\"",
",",
"self",
".",
"_obj",
")",
"shutil",
".",
"copyfil... | Get each record that has been stored in the table. | [
"Get",
"each",
"record",
"that",
"has",
"been",
"stored",
"in",
"the",
"table",
"."
] | 1fb17e69e2ffaf3dac4f40b574c3b7afb2198b7c | https://github.com/pudo-attic/loadkit/blob/1fb17e69e2ffaf3dac4f40b574c3b7afb2198b7c/loadkit/types/table.py#L42-L57 |
244,061 | radjkarl/fancyTools | fancytools/pystructure/GetCallablesInPackage.py | GetCallablesInPackage._cleanRecursive | def _cleanRecursive(self, subSelf):
"""
Delete all NestedOrderedDict that haven't any entries.
"""
for key, item in list(subSelf.items()):
if self.isNestedDict(item):
if not item:
subSelf.pop(key)
else:
s... | python | def _cleanRecursive(self, subSelf):
"""
Delete all NestedOrderedDict that haven't any entries.
"""
for key, item in list(subSelf.items()):
if self.isNestedDict(item):
if not item:
subSelf.pop(key)
else:
s... | [
"def",
"_cleanRecursive",
"(",
"self",
",",
"subSelf",
")",
":",
"for",
"key",
",",
"item",
"in",
"list",
"(",
"subSelf",
".",
"items",
"(",
")",
")",
":",
"if",
"self",
".",
"isNestedDict",
"(",
"item",
")",
":",
"if",
"not",
"item",
":",
"subSelf... | Delete all NestedOrderedDict that haven't any entries. | [
"Delete",
"all",
"NestedOrderedDict",
"that",
"haven",
"t",
"any",
"entries",
"."
] | 4c4d961003dc4ed6e46429a0c24f7e2bb52caa8b | https://github.com/radjkarl/fancyTools/blob/4c4d961003dc4ed6e46429a0c24f7e2bb52caa8b/fancytools/pystructure/GetCallablesInPackage.py#L67-L76 |
244,062 | radjkarl/fancyTools | fancytools/pystructure/GetCallablesInPackage.py | GetCallablesInPackage.belongsToModule | def belongsToModule(obj, module):
"""Returns True is an object belongs to a module."""
return obj.__module__ == module.__name__ or obj.__module__.startswith(
module.__name__) | python | def belongsToModule(obj, module):
"""Returns True is an object belongs to a module."""
return obj.__module__ == module.__name__ or obj.__module__.startswith(
module.__name__) | [
"def",
"belongsToModule",
"(",
"obj",
",",
"module",
")",
":",
"return",
"obj",
".",
"__module__",
"==",
"module",
".",
"__name__",
"or",
"obj",
".",
"__module__",
".",
"startswith",
"(",
"module",
".",
"__name__",
")"
] | Returns True is an object belongs to a module. | [
"Returns",
"True",
"is",
"an",
"object",
"belongs",
"to",
"a",
"module",
"."
] | 4c4d961003dc4ed6e46429a0c24f7e2bb52caa8b | https://github.com/radjkarl/fancyTools/blob/4c4d961003dc4ed6e46429a0c24f7e2bb52caa8b/fancytools/pystructure/GetCallablesInPackage.py#L125-L128 |
244,063 | erwan-lemonnier/dynamodb-object-store | dynadbobjectstore.py | ObjectStore.create_table | def create_table(self):
"""Create the DynamoDB table used by this ObjectStore, only if it does
not already exists.
"""
all_tables = self.aws_conn.list_tables()['TableNames']
if self.table_name in all_tables:
log.info("Table %s already exists" % self.table_name)
... | python | def create_table(self):
"""Create the DynamoDB table used by this ObjectStore, only if it does
not already exists.
"""
all_tables = self.aws_conn.list_tables()['TableNames']
if self.table_name in all_tables:
log.info("Table %s already exists" % self.table_name)
... | [
"def",
"create_table",
"(",
"self",
")",
":",
"all_tables",
"=",
"self",
".",
"aws_conn",
".",
"list_tables",
"(",
")",
"[",
"'TableNames'",
"]",
"if",
"self",
".",
"table_name",
"in",
"all_tables",
":",
"log",
".",
"info",
"(",
"\"Table %s already exists\""... | Create the DynamoDB table used by this ObjectStore, only if it does
not already exists. | [
"Create",
"the",
"DynamoDB",
"table",
"used",
"by",
"this",
"ObjectStore",
"only",
"if",
"it",
"does",
"not",
"already",
"exists",
"."
] | fd0eee1912bc9c2139541a41928ee08efb4270f8 | https://github.com/erwan-lemonnier/dynamodb-object-store/blob/fd0eee1912bc9c2139541a41928ee08efb4270f8/dynadbobjectstore.py#L28-L50 |
244,064 | erwan-lemonnier/dynamodb-object-store | dynadbobjectstore.py | ObjectStore.put | def put(self, key, value, overwrite=True):
"""Marshall the python object given as 'value' into a string, using the
to_string marshalling method passed in the constructor, and store it in
the DynamoDB table under key 'key'.
"""
self._get_table()
s = self.to_string(value)
... | python | def put(self, key, value, overwrite=True):
"""Marshall the python object given as 'value' into a string, using the
to_string marshalling method passed in the constructor, and store it in
the DynamoDB table under key 'key'.
"""
self._get_table()
s = self.to_string(value)
... | [
"def",
"put",
"(",
"self",
",",
"key",
",",
"value",
",",
"overwrite",
"=",
"True",
")",
":",
"self",
".",
"_get_table",
"(",
")",
"s",
"=",
"self",
".",
"to_string",
"(",
"value",
")",
"log",
".",
"debug",
"(",
"\"Storing in key '%s' the object: '%s'\""... | Marshall the python object given as 'value' into a string, using the
to_string marshalling method passed in the constructor, and store it in
the DynamoDB table under key 'key'. | [
"Marshall",
"the",
"python",
"object",
"given",
"as",
"value",
"into",
"a",
"string",
"using",
"the",
"to_string",
"marshalling",
"method",
"passed",
"in",
"the",
"constructor",
"and",
"store",
"it",
"in",
"the",
"DynamoDB",
"table",
"under",
"key",
"key",
"... | fd0eee1912bc9c2139541a41928ee08efb4270f8 | https://github.com/erwan-lemonnier/dynamodb-object-store/blob/fd0eee1912bc9c2139541a41928ee08efb4270f8/dynadbobjectstore.py#L56-L70 |
244,065 | erwan-lemonnier/dynamodb-object-store | dynadbobjectstore.py | ObjectStore.get | def get(self, key):
"""Get the string representation of the object stored in DynamoDB under this key,
convert it back to an object using the 'from_string' unmarshalling method passed
in the constructor and return the object. Return None if no object found.
"""
self._get_table()
... | python | def get(self, key):
"""Get the string representation of the object stored in DynamoDB under this key,
convert it back to an object using the 'from_string' unmarshalling method passed
in the constructor and return the object. Return None if no object found.
"""
self._get_table()
... | [
"def",
"get",
"(",
"self",
",",
"key",
")",
":",
"self",
".",
"_get_table",
"(",
")",
"s",
"=",
"self",
".",
"table",
".",
"get_item",
"(",
"key",
"=",
"key",
")",
"log",
".",
"debug",
"(",
"\"Retrieved from key '%s' the object: '%s'\"",
"%",
"(",
"key... | Get the string representation of the object stored in DynamoDB under this key,
convert it back to an object using the 'from_string' unmarshalling method passed
in the constructor and return the object. Return None if no object found. | [
"Get",
"the",
"string",
"representation",
"of",
"the",
"object",
"stored",
"in",
"DynamoDB",
"under",
"this",
"key",
"convert",
"it",
"back",
"to",
"an",
"object",
"using",
"the",
"from_string",
"unmarshalling",
"method",
"passed",
"in",
"the",
"constructor",
... | fd0eee1912bc9c2139541a41928ee08efb4270f8 | https://github.com/erwan-lemonnier/dynamodb-object-store/blob/fd0eee1912bc9c2139541a41928ee08efb4270f8/dynadbobjectstore.py#L72-L80 |
244,066 | erwan-lemonnier/dynamodb-object-store | dynadbobjectstore.py | ObjectStore.delete | def delete(self, key):
"""If this key exists, delete it"""
self._get_table()
self.table.delete_item(key=key)
log.debug("Deleted item at key '%s'" % (key)) | python | def delete(self, key):
"""If this key exists, delete it"""
self._get_table()
self.table.delete_item(key=key)
log.debug("Deleted item at key '%s'" % (key)) | [
"def",
"delete",
"(",
"self",
",",
"key",
")",
":",
"self",
".",
"_get_table",
"(",
")",
"self",
".",
"table",
".",
"delete_item",
"(",
"key",
"=",
"key",
")",
"log",
".",
"debug",
"(",
"\"Deleted item at key '%s'\"",
"%",
"(",
"key",
")",
")"
] | If this key exists, delete it | [
"If",
"this",
"key",
"exists",
"delete",
"it"
] | fd0eee1912bc9c2139541a41928ee08efb4270f8 | https://github.com/erwan-lemonnier/dynamodb-object-store/blob/fd0eee1912bc9c2139541a41928ee08efb4270f8/dynadbobjectstore.py#L82-L86 |
244,067 | yunojuno/python-env-utils | env_utils/utils.py | _get_env | def _get_env(key, default=None, coerce=lambda x: x, required=False):
"""
Return env var coerced into a type other than string.
This function extends the standard os.getenv function to enable
the coercion of values into data types other than string (all env
vars are strings by default).
Args:
... | python | def _get_env(key, default=None, coerce=lambda x: x, required=False):
"""
Return env var coerced into a type other than string.
This function extends the standard os.getenv function to enable
the coercion of values into data types other than string (all env
vars are strings by default).
Args:
... | [
"def",
"_get_env",
"(",
"key",
",",
"default",
"=",
"None",
",",
"coerce",
"=",
"lambda",
"x",
":",
"x",
",",
"required",
"=",
"False",
")",
":",
"try",
":",
"value",
"=",
"os",
".",
"environ",
"[",
"key",
"]",
"except",
"KeyError",
":",
"if",
"r... | Return env var coerced into a type other than string.
This function extends the standard os.getenv function to enable
the coercion of values into data types other than string (all env
vars are strings by default).
Args:
key: string, the name of the env var to look up
Kwargs:
defau... | [
"Return",
"env",
"var",
"coerced",
"into",
"a",
"type",
"other",
"than",
"string",
"."
] | 7f3b5635f93322759856644901221955908e7e99 | https://github.com/yunojuno/python-env-utils/blob/7f3b5635f93322759856644901221955908e7e99/env_utils/utils.py#L27-L60 |
244,068 | yunojuno/python-env-utils | env_utils/utils.py | get_env | def get_env(key, *default, **kwargs):
"""
Return env var.
This is the parent function of all other get_foo functions,
and is responsible for unpacking args/kwargs into the values
that _get_env expects (it is the root function that actually
interacts with environ).
Args:
key: string... | python | def get_env(key, *default, **kwargs):
"""
Return env var.
This is the parent function of all other get_foo functions,
and is responsible for unpacking args/kwargs into the values
that _get_env expects (it is the root function that actually
interacts with environ).
Args:
key: string... | [
"def",
"get_env",
"(",
"key",
",",
"*",
"default",
",",
"*",
"*",
"kwargs",
")",
":",
"assert",
"len",
"(",
"default",
")",
"in",
"(",
"0",
",",
"1",
")",
",",
"\"Too many args supplied.\"",
"func",
"=",
"kwargs",
".",
"get",
"(",
"'coerce'",
",",
... | Return env var.
This is the parent function of all other get_foo functions,
and is responsible for unpacking args/kwargs into the values
that _get_env expects (it is the root function that actually
interacts with environ).
Args:
key: string, the env var name to look up.
default: (o... | [
"Return",
"env",
"var",
"."
] | 7f3b5635f93322759856644901221955908e7e99 | https://github.com/yunojuno/python-env-utils/blob/7f3b5635f93322759856644901221955908e7e99/env_utils/utils.py#L94-L123 |
244,069 | yunojuno/python-env-utils | env_utils/utils.py | get_list | def get_list(key, *default, **kwargs):
"""Return env var as a list."""
separator = kwargs.get('separator', ' ')
return get_env(key, *default, coerce=lambda x: x.split(separator)) | python | def get_list(key, *default, **kwargs):
"""Return env var as a list."""
separator = kwargs.get('separator', ' ')
return get_env(key, *default, coerce=lambda x: x.split(separator)) | [
"def",
"get_list",
"(",
"key",
",",
"*",
"default",
",",
"*",
"*",
"kwargs",
")",
":",
"separator",
"=",
"kwargs",
".",
"get",
"(",
"'separator'",
",",
"' '",
")",
"return",
"get_env",
"(",
"key",
",",
"*",
"default",
",",
"coerce",
"=",
"lambda",
... | Return env var as a list. | [
"Return",
"env",
"var",
"as",
"a",
"list",
"."
] | 7f3b5635f93322759856644901221955908e7e99 | https://github.com/yunojuno/python-env-utils/blob/7f3b5635f93322759856644901221955908e7e99/env_utils/utils.py#L146-L149 |
244,070 | dossier/dossier.models | dossier/models/etl/ads.py | row_to_content_obj | def row_to_content_obj(key_row):
'''Returns ``FeatureCollection`` given an HBase artifact row.
Note that the FC returned has a Unicode feature ``artifact_id``
set to the row's key.
'''
key, row = key_row
cid = mk_content_id(key.encode('utf-8'))
response = row.get('response', {})
other_... | python | def row_to_content_obj(key_row):
'''Returns ``FeatureCollection`` given an HBase artifact row.
Note that the FC returned has a Unicode feature ``artifact_id``
set to the row's key.
'''
key, row = key_row
cid = mk_content_id(key.encode('utf-8'))
response = row.get('response', {})
other_... | [
"def",
"row_to_content_obj",
"(",
"key_row",
")",
":",
"key",
",",
"row",
"=",
"key_row",
"cid",
"=",
"mk_content_id",
"(",
"key",
".",
"encode",
"(",
"'utf-8'",
")",
")",
"response",
"=",
"row",
".",
"get",
"(",
"'response'",
",",
"{",
"}",
")",
"ot... | Returns ``FeatureCollection`` given an HBase artifact row.
Note that the FC returned has a Unicode feature ``artifact_id``
set to the row's key. | [
"Returns",
"FeatureCollection",
"given",
"an",
"HBase",
"artifact",
"row",
"."
] | c9e282f690eab72963926329efe1600709e48b13 | https://github.com/dossier/dossier.models/blob/c9e282f690eab72963926329efe1600709e48b13/dossier/models/etl/ads.py#L58-L83 |
244,071 | rameshg87/pyremotevbox | pyremotevbox/ZSI/TCtimes.py | _dict_to_tuple | def _dict_to_tuple(d):
'''Convert a dictionary to a time tuple. Depends on key values in the
regexp pattern!
'''
# TODO: Adding a ms field to struct_time tuples is problematic
# since they don't have this field. Should use datetime
# which has a microseconds field, else no ms.. When mapp... | python | def _dict_to_tuple(d):
'''Convert a dictionary to a time tuple. Depends on key values in the
regexp pattern!
'''
# TODO: Adding a ms field to struct_time tuples is problematic
# since they don't have this field. Should use datetime
# which has a microseconds field, else no ms.. When mapp... | [
"def",
"_dict_to_tuple",
"(",
"d",
")",
":",
"# TODO: Adding a ms field to struct_time tuples is problematic ",
"# since they don't have this field. Should use datetime",
"# which has a microseconds field, else no ms.. When mapping struct_time ",
"# to gDateTime the last 3 fields are irrelevant,... | Convert a dictionary to a time tuple. Depends on key values in the
regexp pattern! | [
"Convert",
"a",
"dictionary",
"to",
"a",
"time",
"tuple",
".",
"Depends",
"on",
"key",
"values",
"in",
"the",
"regexp",
"pattern!"
] | 123dffff27da57c8faa3ac1dd4c68b1cf4558b1a | https://github.com/rameshg87/pyremotevbox/blob/123dffff27da57c8faa3ac1dd4c68b1cf4558b1a/pyremotevbox/ZSI/TCtimes.py#L79-L135 |
244,072 | rameshg87/pyremotevbox | pyremotevbox/ZSI/TCtimes.py | _localtimezone.dst | def dst(self, dt):
"""datetime -> DST offset in minutes east of UTC."""
tt = _localtime(_mktime((dt.year, dt.month, dt.day,
dt.hour, dt.minute, dt.second, dt.weekday(), 0, -1)))
if tt.tm_isdst > 0: return _dstdiff
return _zero | python | def dst(self, dt):
"""datetime -> DST offset in minutes east of UTC."""
tt = _localtime(_mktime((dt.year, dt.month, dt.day,
dt.hour, dt.minute, dt.second, dt.weekday(), 0, -1)))
if tt.tm_isdst > 0: return _dstdiff
return _zero | [
"def",
"dst",
"(",
"self",
",",
"dt",
")",
":",
"tt",
"=",
"_localtime",
"(",
"_mktime",
"(",
"(",
"dt",
".",
"year",
",",
"dt",
".",
"month",
",",
"dt",
".",
"day",
",",
"dt",
".",
"hour",
",",
"dt",
".",
"minute",
",",
"dt",
".",
"second",
... | datetime -> DST offset in minutes east of UTC. | [
"datetime",
"-",
">",
"DST",
"offset",
"in",
"minutes",
"east",
"of",
"UTC",
"."
] | 123dffff27da57c8faa3ac1dd4c68b1cf4558b1a | https://github.com/rameshg87/pyremotevbox/blob/123dffff27da57c8faa3ac1dd4c68b1cf4558b1a/pyremotevbox/ZSI/TCtimes.py#L30-L35 |
244,073 | rameshg87/pyremotevbox | pyremotevbox/ZSI/TCtimes.py | _localtimezone.tzname | def tzname(self, dt):
"""datetime -> string name of time zone."""
tt = _localtime(_mktime((dt.year, dt.month, dt.day,
dt.hour, dt.minute, dt.second, dt.weekday(), 0, -1)))
return _time.tzname[tt.tm_isdst > 0] | python | def tzname(self, dt):
"""datetime -> string name of time zone."""
tt = _localtime(_mktime((dt.year, dt.month, dt.day,
dt.hour, dt.minute, dt.second, dt.weekday(), 0, -1)))
return _time.tzname[tt.tm_isdst > 0] | [
"def",
"tzname",
"(",
"self",
",",
"dt",
")",
":",
"tt",
"=",
"_localtime",
"(",
"_mktime",
"(",
"(",
"dt",
".",
"year",
",",
"dt",
".",
"month",
",",
"dt",
".",
"day",
",",
"dt",
".",
"hour",
",",
"dt",
".",
"minute",
",",
"dt",
".",
"second... | datetime -> string name of time zone. | [
"datetime",
"-",
">",
"string",
"name",
"of",
"time",
"zone",
"."
] | 123dffff27da57c8faa3ac1dd4c68b1cf4558b1a | https://github.com/rameshg87/pyremotevbox/blob/123dffff27da57c8faa3ac1dd4c68b1cf4558b1a/pyremotevbox/ZSI/TCtimes.py#L40-L44 |
244,074 | glue-viz/echo | echo/core.py | add_callback | def add_callback(instance, prop, callback, echo_old=False, priority=0):
"""
Attach a callback function to a property in an instance
Parameters
----------
instance
The instance to add the callback to
prop : str
Name of callback property in `instance`
callback : func
T... | python | def add_callback(instance, prop, callback, echo_old=False, priority=0):
"""
Attach a callback function to a property in an instance
Parameters
----------
instance
The instance to add the callback to
prop : str
Name of callback property in `instance`
callback : func
T... | [
"def",
"add_callback",
"(",
"instance",
",",
"prop",
",",
"callback",
",",
"echo_old",
"=",
"False",
",",
"priority",
"=",
"0",
")",
":",
"p",
"=",
"getattr",
"(",
"type",
"(",
"instance",
")",
",",
"prop",
")",
"if",
"not",
"isinstance",
"(",
"p",
... | Attach a callback function to a property in an instance
Parameters
----------
instance
The instance to add the callback to
prop : str
Name of callback property in `instance`
callback : func
The callback function to add
echo_old : bool, optional
If `True`, the cal... | [
"Attach",
"a",
"callback",
"function",
"to",
"a",
"property",
"in",
"an",
"instance"
] | 6ad54cc5e869de27c34e8716f2619ddc640f08fe | https://github.com/glue-viz/echo/blob/6ad54cc5e869de27c34e8716f2619ddc640f08fe/echo/core.py#L334-L372 |
244,075 | glue-viz/echo | echo/core.py | remove_callback | def remove_callback(instance, prop, callback):
"""
Remove a callback function from a property in an instance
Parameters
----------
instance
The instance to detach the callback from
prop : str
Name of callback property in `instance`
callback : func
The callback functi... | python | def remove_callback(instance, prop, callback):
"""
Remove a callback function from a property in an instance
Parameters
----------
instance
The instance to detach the callback from
prop : str
Name of callback property in `instance`
callback : func
The callback functi... | [
"def",
"remove_callback",
"(",
"instance",
",",
"prop",
",",
"callback",
")",
":",
"p",
"=",
"getattr",
"(",
"type",
"(",
"instance",
")",
",",
"prop",
")",
"if",
"not",
"isinstance",
"(",
"p",
",",
"CallbackProperty",
")",
":",
"raise",
"TypeError",
"... | Remove a callback function from a property in an instance
Parameters
----------
instance
The instance to detach the callback from
prop : str
Name of callback property in `instance`
callback : func
The callback function to remove | [
"Remove",
"a",
"callback",
"function",
"from",
"a",
"property",
"in",
"an",
"instance"
] | 6ad54cc5e869de27c34e8716f2619ddc640f08fe | https://github.com/glue-viz/echo/blob/6ad54cc5e869de27c34e8716f2619ddc640f08fe/echo/core.py#L375-L391 |
244,076 | glue-viz/echo | echo/core.py | callback_property | def callback_property(getter):
"""
A decorator to build a CallbackProperty.
This is used by wrapping a getter method, similar to the use of @property::
class Foo(object):
@callback_property
def x(self):
return self._x
@x.setter
def ... | python | def callback_property(getter):
"""
A decorator to build a CallbackProperty.
This is used by wrapping a getter method, similar to the use of @property::
class Foo(object):
@callback_property
def x(self):
return self._x
@x.setter
def ... | [
"def",
"callback_property",
"(",
"getter",
")",
":",
"cb",
"=",
"CallbackProperty",
"(",
"getter",
"=",
"getter",
")",
"cb",
".",
"__doc__",
"=",
"getter",
".",
"__doc__",
"return",
"cb"
] | A decorator to build a CallbackProperty.
This is used by wrapping a getter method, similar to the use of @property::
class Foo(object):
@callback_property
def x(self):
return self._x
@x.setter
def x(self, value):
self._x = v... | [
"A",
"decorator",
"to",
"build",
"a",
"CallbackProperty",
"."
] | 6ad54cc5e869de27c34e8716f2619ddc640f08fe | https://github.com/glue-viz/echo/blob/6ad54cc5e869de27c34e8716f2619ddc640f08fe/echo/core.py#L394-L418 |
244,077 | glue-viz/echo | echo/core.py | ignore_callback | def ignore_callback(instance, *props):
"""
Temporarily ignore any callbacks from one or more callback properties
This is a context manager. Within the context block, no callbacks will be
issued. In contrast with :func:`~echo.delay_callback`, no callbakcs will be
called on exiting the context manage... | python | def ignore_callback(instance, *props):
"""
Temporarily ignore any callbacks from one or more callback properties
This is a context manager. Within the context block, no callbacks will be
issued. In contrast with :func:`~echo.delay_callback`, no callbakcs will be
called on exiting the context manage... | [
"def",
"ignore_callback",
"(",
"instance",
",",
"*",
"props",
")",
":",
"for",
"prop",
"in",
"props",
":",
"p",
"=",
"getattr",
"(",
"type",
"(",
"instance",
")",
",",
"prop",
")",
"if",
"not",
"isinstance",
"(",
"p",
",",
"CallbackProperty",
")",
":... | Temporarily ignore any callbacks from one or more callback properties
This is a context manager. Within the context block, no callbacks will be
issued. In contrast with :func:`~echo.delay_callback`, no callbakcs will be
called on exiting the context manager
Parameters
----------
instance
... | [
"Temporarily",
"ignore",
"any",
"callbacks",
"from",
"one",
"or",
"more",
"callback",
"properties"
] | 6ad54cc5e869de27c34e8716f2619ddc640f08fe | https://github.com/glue-viz/echo/blob/6ad54cc5e869de27c34e8716f2619ddc640f08fe/echo/core.py#L511-L555 |
244,078 | glue-viz/echo | echo/core.py | CallbackProperty.notify | def notify(self, instance, old, new):
"""
Call all callback functions with the current value
Each callback will either be called using
callback(new) or callback(old, new) depending
on whether ``echo_old`` was set to `True` when calling
:func:`~echo.add_callback`
... | python | def notify(self, instance, old, new):
"""
Call all callback functions with the current value
Each callback will either be called using
callback(new) or callback(old, new) depending
on whether ``echo_old`` was set to `True` when calling
:func:`~echo.add_callback`
... | [
"def",
"notify",
"(",
"self",
",",
"instance",
",",
"old",
",",
"new",
")",
":",
"if",
"self",
".",
"_disabled",
".",
"get",
"(",
"instance",
",",
"False",
")",
":",
"return",
"for",
"cback",
"in",
"self",
".",
"_callbacks",
".",
"get",
"(",
"insta... | Call all callback functions with the current value
Each callback will either be called using
callback(new) or callback(old, new) depending
on whether ``echo_old`` was set to `True` when calling
:func:`~echo.add_callback`
Parameters
----------
instance
... | [
"Call",
"all",
"callback",
"functions",
"with",
"the",
"current",
"value"
] | 6ad54cc5e869de27c34e8716f2619ddc640f08fe | https://github.com/glue-viz/echo/blob/6ad54cc5e869de27c34e8716f2619ddc640f08fe/echo/core.py#L97-L120 |
244,079 | glue-viz/echo | echo/core.py | CallbackProperty.add_callback | def add_callback(self, instance, func, echo_old=False, priority=0):
"""
Add a callback to a specific instance that manages this property
Parameters
----------
instance
The instance to add the callback to
func : func
The callback function to add
... | python | def add_callback(self, instance, func, echo_old=False, priority=0):
"""
Add a callback to a specific instance that manages this property
Parameters
----------
instance
The instance to add the callback to
func : func
The callback function to add
... | [
"def",
"add_callback",
"(",
"self",
",",
"instance",
",",
"func",
",",
"echo_old",
"=",
"False",
",",
"priority",
"=",
"0",
")",
":",
"if",
"echo_old",
":",
"self",
".",
"_2arg_callbacks",
".",
"setdefault",
"(",
"instance",
",",
"CallbackContainer",
"(",
... | Add a callback to a specific instance that manages this property
Parameters
----------
instance
The instance to add the callback to
func : func
The callback function to add
echo_old : bool, optional
If `True`, the callback function will be inv... | [
"Add",
"a",
"callback",
"to",
"a",
"specific",
"instance",
"that",
"manages",
"this",
"property"
] | 6ad54cc5e869de27c34e8716f2619ddc640f08fe | https://github.com/glue-viz/echo/blob/6ad54cc5e869de27c34e8716f2619ddc640f08fe/echo/core.py#L134-L156 |
244,080 | glue-viz/echo | echo/core.py | HasCallbackProperties.add_callback | def add_callback(self, name, callback, echo_old=False, priority=0):
"""
Add a callback that gets triggered when a callback property of the
class changes.
Parameters
----------
name : str
The instance to add the callback to.
callback : func
... | python | def add_callback(self, name, callback, echo_old=False, priority=0):
"""
Add a callback that gets triggered when a callback property of the
class changes.
Parameters
----------
name : str
The instance to add the callback to.
callback : func
... | [
"def",
"add_callback",
"(",
"self",
",",
"name",
",",
"callback",
",",
"echo_old",
"=",
"False",
",",
"priority",
"=",
"0",
")",
":",
"if",
"self",
".",
"is_callback_property",
"(",
"name",
")",
":",
"prop",
"=",
"getattr",
"(",
"type",
"(",
"self",
... | Add a callback that gets triggered when a callback property of the
class changes.
Parameters
----------
name : str
The instance to add the callback to.
callback : func
The callback function to add
echo_old : bool, optional
If `True`, t... | [
"Add",
"a",
"callback",
"that",
"gets",
"triggered",
"when",
"a",
"callback",
"property",
"of",
"the",
"class",
"changes",
"."
] | 6ad54cc5e869de27c34e8716f2619ddc640f08fe | https://github.com/glue-viz/echo/blob/6ad54cc5e869de27c34e8716f2619ddc640f08fe/echo/core.py#L245-L268 |
244,081 | glue-viz/echo | echo/core.py | HasCallbackProperties.iter_callback_properties | def iter_callback_properties(self):
"""
Iterator to loop over all callback properties.
"""
for name in dir(self):
if self.is_callback_property(name):
yield name, getattr(type(self), name) | python | def iter_callback_properties(self):
"""
Iterator to loop over all callback properties.
"""
for name in dir(self):
if self.is_callback_property(name):
yield name, getattr(type(self), name) | [
"def",
"iter_callback_properties",
"(",
"self",
")",
":",
"for",
"name",
"in",
"dir",
"(",
"self",
")",
":",
"if",
"self",
".",
"is_callback_property",
"(",
"name",
")",
":",
"yield",
"name",
",",
"getattr",
"(",
"type",
"(",
"self",
")",
",",
"name",
... | Iterator to loop over all callback properties. | [
"Iterator",
"to",
"loop",
"over",
"all",
"callback",
"properties",
"."
] | 6ad54cc5e869de27c34e8716f2619ddc640f08fe | https://github.com/glue-viz/echo/blob/6ad54cc5e869de27c34e8716f2619ddc640f08fe/echo/core.py#L325-L331 |
244,082 | cmutel/constructive_geometries | constructive_geometries/cg.py | has_gis | def has_gis(wrapped, instance, args, kwargs):
"""Skip function execution if there are no presamples"""
if gis:
return wrapped(*args, **kwargs)
else:
warn(MISSING_GIS) | python | def has_gis(wrapped, instance, args, kwargs):
"""Skip function execution if there are no presamples"""
if gis:
return wrapped(*args, **kwargs)
else:
warn(MISSING_GIS) | [
"def",
"has_gis",
"(",
"wrapped",
",",
"instance",
",",
"args",
",",
"kwargs",
")",
":",
"if",
"gis",
":",
"return",
"wrapped",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
"else",
":",
"warn",
"(",
"MISSING_GIS",
")"
] | Skip function execution if there are no presamples | [
"Skip",
"function",
"execution",
"if",
"there",
"are",
"no",
"presamples"
] | d38d7e8d5bf943a6499f3000004f1953af5970de | https://github.com/cmutel/constructive_geometries/blob/d38d7e8d5bf943a6499f3000004f1953af5970de/constructive_geometries/cg.py#L22-L27 |
244,083 | cmutel/constructive_geometries | constructive_geometries/cg.py | sha256 | def sha256(filepath, blocksize=65536):
"""Generate SHA 256 hash for file at `filepath`"""
hasher = hashlib.sha256()
fo = open(filepath, 'rb')
buf = fo.read(blocksize)
while len(buf) > 0:
hasher.update(buf)
buf = fo.read(blocksize)
return hasher.hexdigest() | python | def sha256(filepath, blocksize=65536):
"""Generate SHA 256 hash for file at `filepath`"""
hasher = hashlib.sha256()
fo = open(filepath, 'rb')
buf = fo.read(blocksize)
while len(buf) > 0:
hasher.update(buf)
buf = fo.read(blocksize)
return hasher.hexdigest() | [
"def",
"sha256",
"(",
"filepath",
",",
"blocksize",
"=",
"65536",
")",
":",
"hasher",
"=",
"hashlib",
".",
"sha256",
"(",
")",
"fo",
"=",
"open",
"(",
"filepath",
",",
"'rb'",
")",
"buf",
"=",
"fo",
".",
"read",
"(",
"blocksize",
")",
"while",
"len... | Generate SHA 256 hash for file at `filepath` | [
"Generate",
"SHA",
"256",
"hash",
"for",
"file",
"at",
"filepath"
] | d38d7e8d5bf943a6499f3000004f1953af5970de | https://github.com/cmutel/constructive_geometries/blob/d38d7e8d5bf943a6499f3000004f1953af5970de/constructive_geometries/cg.py#L33-L41 |
244,084 | cmutel/constructive_geometries | constructive_geometries/cg.py | ConstructiveGeometries.check_data | def check_data(self):
"""Check that definitions file is present, and that faces file is readable."""
assert os.path.exists(self.data_fp)
if gis:
with fiona.drivers():
with fiona.open(self.faces_fp) as src:
assert src.meta
gpkg_hash = json.... | python | def check_data(self):
"""Check that definitions file is present, and that faces file is readable."""
assert os.path.exists(self.data_fp)
if gis:
with fiona.drivers():
with fiona.open(self.faces_fp) as src:
assert src.meta
gpkg_hash = json.... | [
"def",
"check_data",
"(",
"self",
")",
":",
"assert",
"os",
".",
"path",
".",
"exists",
"(",
"self",
".",
"data_fp",
")",
"if",
"gis",
":",
"with",
"fiona",
".",
"drivers",
"(",
")",
":",
"with",
"fiona",
".",
"open",
"(",
"self",
".",
"faces_fp",
... | Check that definitions file is present, and that faces file is readable. | [
"Check",
"that",
"definitions",
"file",
"is",
"present",
"and",
"that",
"faces",
"file",
"is",
"readable",
"."
] | d38d7e8d5bf943a6499f3000004f1953af5970de | https://github.com/cmutel/constructive_geometries/blob/d38d7e8d5bf943a6499f3000004f1953af5970de/constructive_geometries/cg.py#L73-L82 |
244,085 | cmutel/constructive_geometries | constructive_geometries/cg.py | ConstructiveGeometries.load_definitions | def load_definitions(self):
"""Load mapping of country names to face ids"""
self.data = dict(json.load(open(self.data_fp))['data'])
self.all_faces = set(self.data.pop("__all__"))
self.locations = set(self.data.keys()) | python | def load_definitions(self):
"""Load mapping of country names to face ids"""
self.data = dict(json.load(open(self.data_fp))['data'])
self.all_faces = set(self.data.pop("__all__"))
self.locations = set(self.data.keys()) | [
"def",
"load_definitions",
"(",
"self",
")",
":",
"self",
".",
"data",
"=",
"dict",
"(",
"json",
".",
"load",
"(",
"open",
"(",
"self",
".",
"data_fp",
")",
")",
"[",
"'data'",
"]",
")",
"self",
".",
"all_faces",
"=",
"set",
"(",
"self",
".",
"da... | Load mapping of country names to face ids | [
"Load",
"mapping",
"of",
"country",
"names",
"to",
"face",
"ids"
] | d38d7e8d5bf943a6499f3000004f1953af5970de | https://github.com/cmutel/constructive_geometries/blob/d38d7e8d5bf943a6499f3000004f1953af5970de/constructive_geometries/cg.py#L84-L88 |
244,086 | cmutel/constructive_geometries | constructive_geometries/cg.py | ConstructiveGeometries.construct_rest_of_world | def construct_rest_of_world(self, excluded, name=None, fp=None, geom=True):
"""Construct rest-of-world geometry and optionally write to filepath ``fp``.
Excludes faces in location list ``excluded``. ``excluded`` must be an iterable of location strings (not face ids)."""
for location in excluded... | python | def construct_rest_of_world(self, excluded, name=None, fp=None, geom=True):
"""Construct rest-of-world geometry and optionally write to filepath ``fp``.
Excludes faces in location list ``excluded``. ``excluded`` must be an iterable of location strings (not face ids)."""
for location in excluded... | [
"def",
"construct_rest_of_world",
"(",
"self",
",",
"excluded",
",",
"name",
"=",
"None",
",",
"fp",
"=",
"None",
",",
"geom",
"=",
"True",
")",
":",
"for",
"location",
"in",
"excluded",
":",
"assert",
"location",
"in",
"self",
".",
"locations",
",",
"... | Construct rest-of-world geometry and optionally write to filepath ``fp``.
Excludes faces in location list ``excluded``. ``excluded`` must be an iterable of location strings (not face ids). | [
"Construct",
"rest",
"-",
"of",
"-",
"world",
"geometry",
"and",
"optionally",
"write",
"to",
"filepath",
"fp",
"."
] | d38d7e8d5bf943a6499f3000004f1953af5970de | https://github.com/cmutel/constructive_geometries/blob/d38d7e8d5bf943a6499f3000004f1953af5970de/constructive_geometries/cg.py#L90-L111 |
244,087 | cmutel/constructive_geometries | constructive_geometries/cg.py | ConstructiveGeometries.construct_rest_of_worlds | def construct_rest_of_worlds(self, excluded, fp=None, use_mp=True, simplify=True):
"""Construct many rest-of-world geometries and optionally write to filepath ``fp``.
``excluded`` must be a **dictionary** of {"rest-of-world label": ["names", "of", "excluded", "locations"]}``."""
geoms = {}
... | python | def construct_rest_of_worlds(self, excluded, fp=None, use_mp=True, simplify=True):
"""Construct many rest-of-world geometries and optionally write to filepath ``fp``.
``excluded`` must be a **dictionary** of {"rest-of-world label": ["names", "of", "excluded", "locations"]}``."""
geoms = {}
... | [
"def",
"construct_rest_of_worlds",
"(",
"self",
",",
"excluded",
",",
"fp",
"=",
"None",
",",
"use_mp",
"=",
"True",
",",
"simplify",
"=",
"True",
")",
":",
"geoms",
"=",
"{",
"}",
"raw_data",
"=",
"[",
"]",
"for",
"key",
"in",
"sorted",
"(",
"exclud... | Construct many rest-of-world geometries and optionally write to filepath ``fp``.
``excluded`` must be a **dictionary** of {"rest-of-world label": ["names", "of", "excluded", "locations"]}``. | [
"Construct",
"many",
"rest",
"-",
"of",
"-",
"world",
"geometries",
"and",
"optionally",
"write",
"to",
"filepath",
"fp",
"."
] | d38d7e8d5bf943a6499f3000004f1953af5970de | https://github.com/cmutel/constructive_geometries/blob/d38d7e8d5bf943a6499f3000004f1953af5970de/constructive_geometries/cg.py#L114-L141 |
244,088 | cmutel/constructive_geometries | constructive_geometries/cg.py | ConstructiveGeometries.construct_rest_of_worlds_mapping | def construct_rest_of_worlds_mapping(self, excluded, fp=None):
"""Construct topo mapping file for ``excluded``.
``excluded`` must be a **dictionary** of {"rest-of-world label": ["names", "of", "excluded", "locations"]}``.
Topo mapping has the data format:
.. code-block:: python
... | python | def construct_rest_of_worlds_mapping(self, excluded, fp=None):
"""Construct topo mapping file for ``excluded``.
``excluded`` must be a **dictionary** of {"rest-of-world label": ["names", "of", "excluded", "locations"]}``.
Topo mapping has the data format:
.. code-block:: python
... | [
"def",
"construct_rest_of_worlds_mapping",
"(",
"self",
",",
"excluded",
",",
"fp",
"=",
"None",
")",
":",
"metadata",
"=",
"{",
"'filename'",
":",
"'faces.gpkg'",
",",
"'field'",
":",
"'id'",
",",
"'sha256'",
":",
"sha256",
"(",
"self",
".",
"faces_fp",
"... | Construct topo mapping file for ``excluded``.
``excluded`` must be a **dictionary** of {"rest-of-world label": ["names", "of", "excluded", "locations"]}``.
Topo mapping has the data format:
.. code-block:: python
{
'data': [
['location label', ... | [
"Construct",
"topo",
"mapping",
"file",
"for",
"excluded",
"."
] | d38d7e8d5bf943a6499f3000004f1953af5970de | https://github.com/cmutel/constructive_geometries/blob/d38d7e8d5bf943a6499f3000004f1953af5970de/constructive_geometries/cg.py#L143-L182 |
244,089 | cmutel/constructive_geometries | constructive_geometries/cg.py | ConstructiveGeometries.construct_difference | def construct_difference(self, parent, excluded, name=None, fp=None):
"""Construct geometry from ``parent`` without the regions in ``excluded`` and optionally write to filepath ``fp``.
``excluded`` must be an iterable of location strings (not face ids)."""
assert parent in self.locations, "Can'... | python | def construct_difference(self, parent, excluded, name=None, fp=None):
"""Construct geometry from ``parent`` without the regions in ``excluded`` and optionally write to filepath ``fp``.
``excluded`` must be an iterable of location strings (not face ids)."""
assert parent in self.locations, "Can'... | [
"def",
"construct_difference",
"(",
"self",
",",
"parent",
",",
"excluded",
",",
"name",
"=",
"None",
",",
"fp",
"=",
"None",
")",
":",
"assert",
"parent",
"in",
"self",
".",
"locations",
",",
"\"Can't find location {}\"",
".",
"format",
"(",
"parent",
")"... | Construct geometry from ``parent`` without the regions in ``excluded`` and optionally write to filepath ``fp``.
``excluded`` must be an iterable of location strings (not face ids). | [
"Construct",
"geometry",
"from",
"parent",
"without",
"the",
"regions",
"in",
"excluded",
"and",
"optionally",
"write",
"to",
"filepath",
"fp",
"."
] | d38d7e8d5bf943a6499f3000004f1953af5970de | https://github.com/cmutel/constructive_geometries/blob/d38d7e8d5bf943a6499f3000004f1953af5970de/constructive_geometries/cg.py#L185-L200 |
244,090 | cmutel/constructive_geometries | constructive_geometries/cg.py | ConstructiveGeometries.write_geoms_to_file | def write_geoms_to_file(self, fp, geoms, names=None):
"""Write unioned geometries ``geoms`` to filepath ``fp``. Optionally use ``names`` in name field."""
if fp[-5:] != '.gpkg':
fp = fp + '.gpkg'
if names is not None:
assert len(geoms) == len(names), "Inconsistent length ... | python | def write_geoms_to_file(self, fp, geoms, names=None):
"""Write unioned geometries ``geoms`` to filepath ``fp``. Optionally use ``names`` in name field."""
if fp[-5:] != '.gpkg':
fp = fp + '.gpkg'
if names is not None:
assert len(geoms) == len(names), "Inconsistent length ... | [
"def",
"write_geoms_to_file",
"(",
"self",
",",
"fp",
",",
"geoms",
",",
"names",
"=",
"None",
")",
":",
"if",
"fp",
"[",
"-",
"5",
":",
"]",
"!=",
"'.gpkg'",
":",
"fp",
"=",
"fp",
"+",
"'.gpkg'",
"if",
"names",
"is",
"not",
"None",
":",
"assert"... | Write unioned geometries ``geoms`` to filepath ``fp``. Optionally use ``names`` in name field. | [
"Write",
"unioned",
"geometries",
"geoms",
"to",
"filepath",
"fp",
".",
"Optionally",
"use",
"names",
"in",
"name",
"field",
"."
] | d38d7e8d5bf943a6499f3000004f1953af5970de | https://github.com/cmutel/constructive_geometries/blob/d38d7e8d5bf943a6499f3000004f1953af5970de/constructive_geometries/cg.py#L203-L223 |
244,091 | edeposit/edeposit.amqp.ftp | src/edeposit/amqp/ftp/decoders/parser_csv.py | decode | def decode(data):
"""
Handles decoding of the CSV `data`.
Args:
data (str): Data which will be decoded.
Returns:
dict: Dictionary with decoded data.
"""
# try to guess dialect of the csv file
dialect = None
try:
dialect = csv.Sniffer().sniff(data)
except Exc... | python | def decode(data):
"""
Handles decoding of the CSV `data`.
Args:
data (str): Data which will be decoded.
Returns:
dict: Dictionary with decoded data.
"""
# try to guess dialect of the csv file
dialect = None
try:
dialect = csv.Sniffer().sniff(data)
except Exc... | [
"def",
"decode",
"(",
"data",
")",
":",
"# try to guess dialect of the csv file",
"dialect",
"=",
"None",
"try",
":",
"dialect",
"=",
"csv",
".",
"Sniffer",
"(",
")",
".",
"sniff",
"(",
"data",
")",
"except",
"Exception",
":",
"pass",
"# parse data with csv pa... | Handles decoding of the CSV `data`.
Args:
data (str): Data which will be decoded.
Returns:
dict: Dictionary with decoded data. | [
"Handles",
"decoding",
"of",
"the",
"CSV",
"data",
"."
] | fcdcbffb6e5d194e1bb4f85f0b8eaa9dbb08aa71 | https://github.com/edeposit/edeposit.amqp.ftp/blob/fcdcbffb6e5d194e1bb4f85f0b8eaa9dbb08aa71/src/edeposit/amqp/ftp/decoders/parser_csv.py#L45-L94 |
244,092 | laco/python-scotty | scotty/__init__.py | cli | def cli(ctx, config, quiet):
"""AWS ECS Docker Deployment Tool"""
ctx.obj = {}
ctx.obj['config'] = load_config(config.read()) # yaml.load(config.read())
ctx.obj['quiet'] = quiet
log(ctx, ' * ' + rnd_scotty_quote() + ' * ') | python | def cli(ctx, config, quiet):
"""AWS ECS Docker Deployment Tool"""
ctx.obj = {}
ctx.obj['config'] = load_config(config.read()) # yaml.load(config.read())
ctx.obj['quiet'] = quiet
log(ctx, ' * ' + rnd_scotty_quote() + ' * ') | [
"def",
"cli",
"(",
"ctx",
",",
"config",
",",
"quiet",
")",
":",
"ctx",
".",
"obj",
"=",
"{",
"}",
"ctx",
".",
"obj",
"[",
"'config'",
"]",
"=",
"load_config",
"(",
"config",
".",
"read",
"(",
")",
")",
"# yaml.load(config.read())",
"ctx",
".",
"ob... | AWS ECS Docker Deployment Tool | [
"AWS",
"ECS",
"Docker",
"Deployment",
"Tool"
] | b8d1925db881adaf06ce3c532ab3a61835dce6a8 | https://github.com/laco/python-scotty/blob/b8d1925db881adaf06ce3c532ab3a61835dce6a8/scotty/__init__.py#L12-L17 |
244,093 | yunojuno-archive/python-errordite | errordite/handlers.py | ErrorditeHandler.emit | def emit(self, record):
"""
Sends exception info to Errordite.
This handler will ignore the log level, and look for an exception
within the record (as recored.exc_info) or current stack frame
(sys.exc_info()). If it finds neither, it will simply return without
doing anyt... | python | def emit(self, record):
"""
Sends exception info to Errordite.
This handler will ignore the log level, and look for an exception
within the record (as recored.exc_info) or current stack frame
(sys.exc_info()). If it finds neither, it will simply return without
doing anyt... | [
"def",
"emit",
"(",
"self",
",",
"record",
")",
":",
"if",
"not",
"self",
".",
"token",
":",
"raise",
"Exception",
"(",
"\"Missing Errordite service token.\"",
")",
"if",
"record",
".",
"levelname",
"==",
"'EXCEPTION'",
":",
"exc_info",
"=",
"record",
".",
... | Sends exception info to Errordite.
This handler will ignore the log level, and look for an exception
within the record (as recored.exc_info) or current stack frame
(sys.exc_info()). If it finds neither, it will simply return without
doing anything. | [
"Sends",
"exception",
"info",
"to",
"Errordite",
"."
] | 320585f6e29043b3fea11304e0f1dde3ea3a19da | https://github.com/yunojuno-archive/python-errordite/blob/320585f6e29043b3fea11304e0f1dde3ea3a19da/errordite/handlers.py#L49-L104 |
244,094 | callowayproject/Transmogrify | transmogrify/contrib/django/templatetags/transmogrifiers.py | resolve | def resolve(var, context):
"""
Resolve the variable, or return the value passed to it in the first place
"""
try:
return var.resolve(context)
except template.VariableDoesNotExist:
return var.var | python | def resolve(var, context):
"""
Resolve the variable, or return the value passed to it in the first place
"""
try:
return var.resolve(context)
except template.VariableDoesNotExist:
return var.var | [
"def",
"resolve",
"(",
"var",
",",
"context",
")",
":",
"try",
":",
"return",
"var",
".",
"resolve",
"(",
"context",
")",
"except",
"template",
".",
"VariableDoesNotExist",
":",
"return",
"var",
".",
"var"
] | Resolve the variable, or return the value passed to it in the first place | [
"Resolve",
"the",
"variable",
"or",
"return",
"the",
"value",
"passed",
"to",
"it",
"in",
"the",
"first",
"place"
] | f1f891b8b923b3a1ede5eac7f60531c1c472379e | https://github.com/callowayproject/Transmogrify/blob/f1f891b8b923b3a1ede5eac7f60531c1c472379e/transmogrify/contrib/django/templatetags/transmogrifiers.py#L22-L29 |
244,095 | etcher-be/emiz | emiz/avwx/__init__.py | Metar.update | def update(self, report: str = None) -> bool:
"""Updates raw, data, and translations by fetching and parsing the METAR report
Returns True is a new report is available, else False
"""
if report is not None:
self.raw = report
else:
raw = self.service.fetch... | python | def update(self, report: str = None) -> bool:
"""Updates raw, data, and translations by fetching and parsing the METAR report
Returns True is a new report is available, else False
"""
if report is not None:
self.raw = report
else:
raw = self.service.fetch... | [
"def",
"update",
"(",
"self",
",",
"report",
":",
"str",
"=",
"None",
")",
"->",
"bool",
":",
"if",
"report",
"is",
"not",
"None",
":",
"self",
".",
"raw",
"=",
"report",
"else",
":",
"raw",
"=",
"self",
".",
"service",
".",
"fetch",
"(",
"self",... | Updates raw, data, and translations by fetching and parsing the METAR report
Returns True is a new report is available, else False | [
"Updates",
"raw",
"data",
"and",
"translations",
"by",
"fetching",
"and",
"parsing",
"the",
"METAR",
"report"
] | 1c3e32711921d7e600e85558ffe5d337956372de | https://github.com/etcher-be/emiz/blob/1c3e32711921d7e600e85558ffe5d337956372de/emiz/avwx/__init__.py#L88-L103 |
244,096 | etcher-be/emiz | emiz/avwx/__init__.py | Metar.summary | def summary(self) -> str:
"""
Condensed report summary created from translations
"""
if not self.translations:
self.update()
return summary.metar(self.translations) | python | def summary(self) -> str:
"""
Condensed report summary created from translations
"""
if not self.translations:
self.update()
return summary.metar(self.translations) | [
"def",
"summary",
"(",
"self",
")",
"->",
"str",
":",
"if",
"not",
"self",
".",
"translations",
":",
"self",
".",
"update",
"(",
")",
"return",
"summary",
".",
"metar",
"(",
"self",
".",
"translations",
")"
] | Condensed report summary created from translations | [
"Condensed",
"report",
"summary",
"created",
"from",
"translations"
] | 1c3e32711921d7e600e85558ffe5d337956372de | https://github.com/etcher-be/emiz/blob/1c3e32711921d7e600e85558ffe5d337956372de/emiz/avwx/__init__.py#L106-L112 |
244,097 | etcher-be/emiz | emiz/avwx/__init__.py | Taf.summary | def summary(self): # type: ignore
"""
Condensed summary for each forecast created from translations
"""
if not self.translations:
self.update()
return [summary.taf(trans) for trans in self.translations.forecast] | python | def summary(self): # type: ignore
"""
Condensed summary for each forecast created from translations
"""
if not self.translations:
self.update()
return [summary.taf(trans) for trans in self.translations.forecast] | [
"def",
"summary",
"(",
"self",
")",
":",
"# type: ignore",
"if",
"not",
"self",
".",
"translations",
":",
"self",
".",
"update",
"(",
")",
"return",
"[",
"summary",
".",
"taf",
"(",
"trans",
")",
"for",
"trans",
"in",
"self",
".",
"translations",
".",
... | Condensed summary for each forecast created from translations | [
"Condensed",
"summary",
"for",
"each",
"forecast",
"created",
"from",
"translations"
] | 1c3e32711921d7e600e85558ffe5d337956372de | https://github.com/etcher-be/emiz/blob/1c3e32711921d7e600e85558ffe5d337956372de/emiz/avwx/__init__.py#L148-L154 |
244,098 | jmoiron/gaspar | gaspar/consumers.py | Consumer.start | def start(self):
"""Start the consumer. This starts a listen loop on a zmq.PULL socket,
calling ``self.handle`` on each incoming request and pushing the response
on a zmq.PUSH socket back to the producer."""
if not self.initialized:
raise Exception("Consumer not initialized ... | python | def start(self):
"""Start the consumer. This starts a listen loop on a zmq.PULL socket,
calling ``self.handle`` on each incoming request and pushing the response
on a zmq.PUSH socket back to the producer."""
if not self.initialized:
raise Exception("Consumer not initialized ... | [
"def",
"start",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"initialized",
":",
"raise",
"Exception",
"(",
"\"Consumer not initialized (no Producer).\"",
")",
"producer",
"=",
"self",
".",
"producer",
"context",
"=",
"zmq",
".",
"_Context",
"(",
")",
"s... | Start the consumer. This starts a listen loop on a zmq.PULL socket,
calling ``self.handle`` on each incoming request and pushing the response
on a zmq.PUSH socket back to the producer. | [
"Start",
"the",
"consumer",
".",
"This",
"starts",
"a",
"listen",
"loop",
"on",
"a",
"zmq",
".",
"PULL",
"socket",
"calling",
"self",
".",
"handle",
"on",
"each",
"incoming",
"request",
"and",
"pushing",
"the",
"response",
"on",
"a",
"zmq",
".",
"PUSH",
... | cc9d7403a4d86382b10a7e96c6d0a020cc5e1b12 | https://github.com/jmoiron/gaspar/blob/cc9d7403a4d86382b10a7e96c6d0a020cc5e1b12/gaspar/consumers.py#L29-L42 |
244,099 | jmoiron/gaspar | gaspar/consumers.py | Consumer.listen | def listen(self):
"""Listen forever on the zmq.PULL socket."""
while True:
message = self.pull.recv()
logger.debug("received message of length %d" % len(message))
uuid, message = message[:32], message[32:]
response = uuid + self.handle(message)
... | python | def listen(self):
"""Listen forever on the zmq.PULL socket."""
while True:
message = self.pull.recv()
logger.debug("received message of length %d" % len(message))
uuid, message = message[:32], message[32:]
response = uuid + self.handle(message)
... | [
"def",
"listen",
"(",
"self",
")",
":",
"while",
"True",
":",
"message",
"=",
"self",
".",
"pull",
".",
"recv",
"(",
")",
"logger",
".",
"debug",
"(",
"\"received message of length %d\"",
"%",
"len",
"(",
"message",
")",
")",
"uuid",
",",
"message",
"=... | Listen forever on the zmq.PULL socket. | [
"Listen",
"forever",
"on",
"the",
"zmq",
".",
"PULL",
"socket",
"."
] | cc9d7403a4d86382b10a7e96c6d0a020cc5e1b12 | https://github.com/jmoiron/gaspar/blob/cc9d7403a4d86382b10a7e96c6d0a020cc5e1b12/gaspar/consumers.py#L44-L51 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.