repo stringlengths 7 55 | path stringlengths 4 223 | func_name stringlengths 1 134 | original_string stringlengths 75 104k | language stringclasses 1
value | code stringlengths 75 104k | code_tokens listlengths 19 28.4k | docstring stringlengths 1 46.9k | docstring_tokens listlengths 1 1.97k | sha stringlengths 40 40 | url stringlengths 87 315 | partition stringclasses 3
values | summary stringlengths 4 350 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
tehmaze/natural | natural/phone.py | imsi | def imsi(number):
'''
Printable International Mobile Subscriber Identity (IMSI) numbers. Mind
that there is no validation done on the actual correctness of the MCC/MNC.
If you wish to validate IMSI numbers, take a look at `python-stdnum`_.
:param number: string or int
>>> print(imsi(2042312345... | python | def imsi(number):
'''
Printable International Mobile Subscriber Identity (IMSI) numbers. Mind
that there is no validation done on the actual correctness of the MCC/MNC.
If you wish to validate IMSI numbers, take a look at `python-stdnum`_.
:param number: string or int
>>> print(imsi(2042312345... | [
"def",
"imsi",
"(",
"number",
")",
":",
"number",
"=",
"to_decimal",
"(",
"number",
")",
"groups",
"=",
"(",
"number",
"[",
":",
"3",
"]",
",",
"number",
"[",
"3",
":",
"5",
"]",
",",
"number",
"[",
"5",
":",
"]",
")",
"return",
"u'-'",
".",
... | Printable International Mobile Subscriber Identity (IMSI) numbers. Mind
that there is no validation done on the actual correctness of the MCC/MNC.
If you wish to validate IMSI numbers, take a look at `python-stdnum`_.
:param number: string or int
>>> print(imsi(2042312345))
204-23-12345
.. _p... | [
"Printable",
"International",
"Mobile",
"Subscriber",
"Identity",
"(",
"IMSI",
")",
"numbers",
".",
"Mind",
"that",
"there",
"is",
"no",
"validation",
"done",
"on",
"the",
"actual",
"correctness",
"of",
"the",
"MCC",
"/",
"MNC",
".",
"If",
"you",
"wish",
"... | d7a1fc9de712f9bcf68884a80826a7977df356fb | https://github.com/tehmaze/natural/blob/d7a1fc9de712f9bcf68884a80826a7977df356fb/natural/phone.py#L171-L186 | train | Printable International Mobile Subscriber Identity numbers. |
tehmaze/natural | natural/phone.py | meid | def meid(number, separator=u' '):
'''
Printable Mobile Equipment Identifier (MEID) number.
>>> print(meid(123456789012345678))
1B 69B4BA 630F34 6
>>> print(meid('1B69B4BA630F34'))
1B 69B4BA 630F34 6
'''
if isinstance(number, six.string_types):
number = re.sub(r'[\s-]', '', numb... | python | def meid(number, separator=u' '):
'''
Printable Mobile Equipment Identifier (MEID) number.
>>> print(meid(123456789012345678))
1B 69B4BA 630F34 6
>>> print(meid('1B69B4BA630F34'))
1B 69B4BA 630F34 6
'''
if isinstance(number, six.string_types):
number = re.sub(r'[\s-]', '', numb... | [
"def",
"meid",
"(",
"number",
",",
"separator",
"=",
"u' '",
")",
":",
"if",
"isinstance",
"(",
"number",
",",
"six",
".",
"string_types",
")",
":",
"number",
"=",
"re",
".",
"sub",
"(",
"r'[\\s-]'",
",",
"''",
",",
"number",
")",
"try",
":",
"numb... | Printable Mobile Equipment Identifier (MEID) number.
>>> print(meid(123456789012345678))
1B 69B4BA 630F34 6
>>> print(meid('1B69B4BA630F34'))
1B 69B4BA 630F34 6 | [
"Printable",
"Mobile",
"Equipment",
"Identifier",
"(",
"MEID",
")",
"number",
"."
] | d7a1fc9de712f9bcf68884a80826a7977df356fb | https://github.com/tehmaze/natural/blob/d7a1fc9de712f9bcf68884a80826a7977df356fb/natural/phone.py#L189-L231 | train | Return a string representation of a Mobile Equipment Identifier number. |
tehmaze/natural | natural/phone.py | pesn | def pesn(number, separator=u''):
'''
Printable Pseudo Electronic Serial Number.
:param number: hexadecimal string
>>> print(pesn('1B69B4BA630F34E'))
805F9EF7
'''
number = re.sub(r'[\s-]', '', meid(number))
serial = hashlib.sha1(unhexlify(number[:14]))
return separator.join(['80', ... | python | def pesn(number, separator=u''):
'''
Printable Pseudo Electronic Serial Number.
:param number: hexadecimal string
>>> print(pesn('1B69B4BA630F34E'))
805F9EF7
'''
number = re.sub(r'[\s-]', '', meid(number))
serial = hashlib.sha1(unhexlify(number[:14]))
return separator.join(['80', ... | [
"def",
"pesn",
"(",
"number",
",",
"separator",
"=",
"u''",
")",
":",
"number",
"=",
"re",
".",
"sub",
"(",
"r'[\\s-]'",
",",
"''",
",",
"meid",
"(",
"number",
")",
")",
"serial",
"=",
"hashlib",
".",
"sha1",
"(",
"unhexlify",
"(",
"number",
"[",
... | Printable Pseudo Electronic Serial Number.
:param number: hexadecimal string
>>> print(pesn('1B69B4BA630F34E'))
805F9EF7 | [
"Printable",
"Pseudo",
"Electronic",
"Serial",
"Number",
"."
] | d7a1fc9de712f9bcf68884a80826a7977df356fb | https://github.com/tehmaze/natural/blob/d7a1fc9de712f9bcf68884a80826a7977df356fb/natural/phone.py#L234-L246 | train | Printable Pseudo Electronic Serial Number. |
tehmaze/natural | natural/size.py | filesize | def filesize(value, format='decimal', digits=2):
'''
Convert a file size into natural readable format. Multiple formats are
supported.
:param value: size
:param format: default ``decimal``, choices ``binary``, ``decimal`` or
``gnu``
:param digits: default ``2``
>>> print... | python | def filesize(value, format='decimal', digits=2):
'''
Convert a file size into natural readable format. Multiple formats are
supported.
:param value: size
:param format: default ``decimal``, choices ``binary``, ``decimal`` or
``gnu``
:param digits: default ``2``
>>> print... | [
"def",
"filesize",
"(",
"value",
",",
"format",
"=",
"'decimal'",
",",
"digits",
"=",
"2",
")",
":",
"if",
"format",
"not",
"in",
"FILESIZE_SUFFIX",
":",
"raise",
"TypeError",
"base",
"=",
"FILESIZE_BASE",
"[",
"format",
"]",
"size",
"=",
"int",
"(",
"... | Convert a file size into natural readable format. Multiple formats are
supported.
:param value: size
:param format: default ``decimal``, choices ``binary``, ``decimal`` or
``gnu``
:param digits: default ``2``
>>> print(filesize(123))
123.00 B
>>> print(filesize(123456))
... | [
"Convert",
"a",
"file",
"size",
"into",
"natural",
"readable",
"format",
".",
"Multiple",
"formats",
"are",
"supported",
"."
] | d7a1fc9de712f9bcf68884a80826a7977df356fb | https://github.com/tehmaze/natural/blob/d7a1fc9de712f9bcf68884a80826a7977df356fb/natural/size.py#L12-L51 | train | Convert a file size into natural readable format. Multiple formats are not supported. |
rmst/chi | chi/experiment.py | experiment | def experiment(f=None, local_dependencies=None, start_chiboard=True, default_logdir=""):
"""
Decorator that transforms the decorated function into a chi.Experiment
:param start_chiboard:
:param f:
:param local_dependencies:
:return:
"""
if not f:
return lambda f: experiment(f, local_dependencies, st... | python | def experiment(f=None, local_dependencies=None, start_chiboard=True, default_logdir=""):
"""
Decorator that transforms the decorated function into a chi.Experiment
:param start_chiboard:
:param f:
:param local_dependencies:
:return:
"""
if not f:
return lambda f: experiment(f, local_dependencies, st... | [
"def",
"experiment",
"(",
"f",
"=",
"None",
",",
"local_dependencies",
"=",
"None",
",",
"start_chiboard",
"=",
"True",
",",
"default_logdir",
"=",
"\"\"",
")",
":",
"if",
"not",
"f",
":",
"return",
"lambda",
"f",
":",
"experiment",
"(",
"f",
",",
"loc... | Decorator that transforms the decorated function into a chi.Experiment
:param start_chiboard:
:param f:
:param local_dependencies:
:return: | [
"Decorator",
"that",
"transforms",
"the",
"decorated",
"function",
"into",
"a",
"chi",
".",
"Experiment",
":",
"param",
"start_chiboard",
":",
":",
"param",
"f",
":",
":",
"param",
"local_dependencies",
":",
":",
"return",
":"
] | b9205127f3736eb6ebbf6bb2960c4bbb747142b7 | https://github.com/rmst/chi/blob/b9205127f3736eb6ebbf6bb2960c4bbb747142b7/chi/experiment.py#L16-L31 | train | Decorator that transforms a function into a chi. Experiment
or chi. Experiment
|
CiscoUcs/UcsPythonSDK | src/UcsSdk/utils/helper.py | create_dn_in_filter | def create_dn_in_filter(filter_class, filter_value, helper):
""" Creates filter object for given class name, and DN values."""
in_filter = FilterFilter()
in_filter.AddChild(create_dn_wcard_filter(filter_class, filter_value))
return in_filter | python | def create_dn_in_filter(filter_class, filter_value, helper):
""" Creates filter object for given class name, and DN values."""
in_filter = FilterFilter()
in_filter.AddChild(create_dn_wcard_filter(filter_class, filter_value))
return in_filter | [
"def",
"create_dn_in_filter",
"(",
"filter_class",
",",
"filter_value",
",",
"helper",
")",
":",
"in_filter",
"=",
"FilterFilter",
"(",
")",
"in_filter",
".",
"AddChild",
"(",
"create_dn_wcard_filter",
"(",
"filter_class",
",",
"filter_value",
")",
")",
"return",
... | Creates filter object for given class name, and DN values. | [
"Creates",
"filter",
"object",
"for",
"given",
"class",
"name",
"and",
"DN",
"values",
"."
] | bf6b07d6abeacb922c92b198352eda4eb9e4629b | https://github.com/CiscoUcs/UcsPythonSDK/blob/bf6b07d6abeacb922c92b198352eda4eb9e4629b/src/UcsSdk/utils/helper.py#L24-L28 | train | Creates a filter object for given class name and DN values. |
CiscoUcs/UcsPythonSDK | src/UcsSdk/utils/helper.py | create_dn_wcard_filter | def create_dn_wcard_filter(filter_class, filter_value):
""" Creates wild card filter object for given class name, and values.
:param filter_class: class name
:param filter_value: filter property value
:return WcardFilter: WcardFilter object
"""
wcard_filter = WcardFilter()
wcard_filter.Cla... | python | def create_dn_wcard_filter(filter_class, filter_value):
""" Creates wild card filter object for given class name, and values.
:param filter_class: class name
:param filter_value: filter property value
:return WcardFilter: WcardFilter object
"""
wcard_filter = WcardFilter()
wcard_filter.Cla... | [
"def",
"create_dn_wcard_filter",
"(",
"filter_class",
",",
"filter_value",
")",
":",
"wcard_filter",
"=",
"WcardFilter",
"(",
")",
"wcard_filter",
".",
"Class",
"=",
"filter_class",
"wcard_filter",
".",
"Property",
"=",
"\"dn\"",
"wcard_filter",
".",
"Value",
"=",... | Creates wild card filter object for given class name, and values.
:param filter_class: class name
:param filter_value: filter property value
:return WcardFilter: WcardFilter object | [
"Creates",
"wild",
"card",
"filter",
"object",
"for",
"given",
"class",
"name",
"and",
"values",
".",
":",
"param",
"filter_class",
":",
"class",
"name",
":",
"param",
"filter_value",
":",
"filter",
"property",
"value",
":",
"return",
"WcardFilter",
":",
"Wc... | bf6b07d6abeacb922c92b198352eda4eb9e4629b | https://github.com/CiscoUcs/UcsPythonSDK/blob/bf6b07d6abeacb922c92b198352eda4eb9e4629b/src/UcsSdk/utils/helper.py#L31-L41 | train | Creates a wild card filter object for given class name and value. |
CiscoUcs/UcsPythonSDK | src/UcsSdk/utils/helper.py | generate_ucsm_handle | def generate_ucsm_handle(hostname, username, password):
""" Creates UCS Manager handle object and establishes a session with
UCS Manager.
:param hostname: UCS Manager hostname or IP-address
:param username: Username to login to UCS Manager
:param password: Login user password
:rais... | python | def generate_ucsm_handle(hostname, username, password):
""" Creates UCS Manager handle object and establishes a session with
UCS Manager.
:param hostname: UCS Manager hostname or IP-address
:param username: Username to login to UCS Manager
:param password: Login user password
:rais... | [
"def",
"generate_ucsm_handle",
"(",
"hostname",
",",
"username",
",",
"password",
")",
":",
"ucs_handle",
"=",
"UcsHandle",
"(",
")",
"try",
":",
"success",
"=",
"ucs_handle",
".",
"Login",
"(",
"hostname",
",",
"username",
",",
"password",
")",
"except",
... | Creates UCS Manager handle object and establishes a session with
UCS Manager.
:param hostname: UCS Manager hostname or IP-address
:param username: Username to login to UCS Manager
:param password: Login user password
:raises UcsConnectionError: In case of error. | [
"Creates",
"UCS",
"Manager",
"handle",
"object",
"and",
"establishes",
"a",
"session",
"with",
"UCS",
"Manager",
".",
":",
"param",
"hostname",
":",
"UCS",
"Manager",
"hostname",
"or",
"IP",
"-",
"address",
":",
"param",
"username",
":",
"Username",
"to",
... | bf6b07d6abeacb922c92b198352eda4eb9e4629b | https://github.com/CiscoUcs/UcsPythonSDK/blob/bf6b07d6abeacb922c92b198352eda4eb9e4629b/src/UcsSdk/utils/helper.py#L44-L58 | train | Creates a UCS Manager handle object and establishes a session with
UCS Manager. |
CiscoUcs/UcsPythonSDK | src/UcsSdk/utils/helper.py | get_managed_object | def get_managed_object(handle, class_id, params, inMo=None, in_heir=False,
dump=False):
"""Get the specified MO from UCS Manager.
:param managed_object: MO classid
:in_filter: input filter value
:returns: Managed Object
:raises: UcsException in case of failure... | python | def get_managed_object(handle, class_id, params, inMo=None, in_heir=False,
dump=False):
"""Get the specified MO from UCS Manager.
:param managed_object: MO classid
:in_filter: input filter value
:returns: Managed Object
:raises: UcsException in case of failure... | [
"def",
"get_managed_object",
"(",
"handle",
",",
"class_id",
",",
"params",
",",
"inMo",
"=",
"None",
",",
"in_heir",
"=",
"False",
",",
"dump",
"=",
"False",
")",
":",
"return",
"handle",
".",
"GetManagedObject",
"(",
"inMo",
",",
"class_id",
",",
"para... | Get the specified MO from UCS Manager.
:param managed_object: MO classid
:in_filter: input filter value
:returns: Managed Object
:raises: UcsException in case of failure. | [
"Get",
"the",
"specified",
"MO",
"from",
"UCS",
"Manager",
"."
] | bf6b07d6abeacb922c92b198352eda4eb9e4629b | https://github.com/CiscoUcs/UcsPythonSDK/blob/bf6b07d6abeacb922c92b198352eda4eb9e4629b/src/UcsSdk/utils/helper.py#L61-L72 | train | Get the specified MO from UCS Manager. |
CiscoUcs/UcsPythonSDK | src/UcsSdk/utils/helper.py | config_managed_object | def config_managed_object(p_dn, p_class_id, class_id,
mo_config, mo_dn, handle=None, delete=True):
"""Configure the specified MO in UCS Manager.
:param uuid: MO config
:param p_dn: parent MO DN
:param p_class_id: parent MO class ID
:param class_id: MO class... | python | def config_managed_object(p_dn, p_class_id, class_id,
mo_config, mo_dn, handle=None, delete=True):
"""Configure the specified MO in UCS Manager.
:param uuid: MO config
:param p_dn: parent MO DN
:param p_class_id: parent MO class ID
:param class_id: MO class... | [
"def",
"config_managed_object",
"(",
"p_dn",
",",
"p_class_id",
",",
"class_id",
",",
"mo_config",
",",
"mo_dn",
",",
"handle",
"=",
"None",
",",
"delete",
"=",
"True",
")",
":",
"if",
"handle",
"is",
"None",
":",
"handle",
"=",
"self",
".",
"handle",
... | Configure the specified MO in UCS Manager.
:param uuid: MO config
:param p_dn: parent MO DN
:param p_class_id: parent MO class ID
:param class_id: MO class ID
:param MO configuration: MO config
:param mo_dn: MO DN value
:param handle: optional UCS Manager handle ... | [
"Configure",
"the",
"specified",
"MO",
"in",
"UCS",
"Manager",
"."
] | bf6b07d6abeacb922c92b198352eda4eb9e4629b | https://github.com/CiscoUcs/UcsPythonSDK/blob/bf6b07d6abeacb922c92b198352eda4eb9e4629b/src/UcsSdk/utils/helper.py#L83-L109 | train | Configure the specified MO in UCS Manager. |
jaraco/jaraco.mongodb | jaraco/mongodb/query.py | project | def project(*args, **kwargs):
"""
Build a projection for MongoDB.
Due to https://jira.mongodb.org/browse/SERVER-3156, until MongoDB 2.6,
the values must be integers and not boolean.
>>> project(a=True) == {'a': 1}
True
Once MongoDB 2.6 is released, replace use of this function with a simp... | python | def project(*args, **kwargs):
"""
Build a projection for MongoDB.
Due to https://jira.mongodb.org/browse/SERVER-3156, until MongoDB 2.6,
the values must be integers and not boolean.
>>> project(a=True) == {'a': 1}
True
Once MongoDB 2.6 is released, replace use of this function with a simp... | [
"def",
"project",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"projection",
"=",
"dict",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
"return",
"{",
"key",
":",
"int",
"(",
"value",
")",
"for",
"key",
",",
"value",
"in",
"six",
".",... | Build a projection for MongoDB.
Due to https://jira.mongodb.org/browse/SERVER-3156, until MongoDB 2.6,
the values must be integers and not boolean.
>>> project(a=True) == {'a': 1}
True
Once MongoDB 2.6 is released, replace use of this function with a simple
dict. | [
"Build",
"a",
"projection",
"for",
"MongoDB",
"."
] | 280f17894941f4babf2e97db033dbb1fd2b9f705 | https://github.com/jaraco/jaraco.mongodb/blob/280f17894941f4babf2e97db033dbb1fd2b9f705/jaraco/mongodb/query.py#L6-L20 | train | Build a projection for the
|
jaraco/jaraco.mongodb | jaraco/mongodb/query.py | upsert_and_fetch | def upsert_and_fetch(coll, doc, **kwargs):
"""
Fetch exactly one matching document or upsert
the document if not found, returning the matching
or upserted document.
See https://jira.mongodb.org/browse/SERVER-28434
describing the condition where MongoDB is uninterested in
providing an upsert... | python | def upsert_and_fetch(coll, doc, **kwargs):
"""
Fetch exactly one matching document or upsert
the document if not found, returning the matching
or upserted document.
See https://jira.mongodb.org/browse/SERVER-28434
describing the condition where MongoDB is uninterested in
providing an upsert... | [
"def",
"upsert_and_fetch",
"(",
"coll",
",",
"doc",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"coll",
".",
"find_one_and_update",
"(",
"doc",
",",
"{",
"\"$setOnInsert\"",
":",
"doc",
"}",
",",
"upsert",
"=",
"True",
",",
"return_document",
"=",
"pymo... | Fetch exactly one matching document or upsert
the document if not found, returning the matching
or upserted document.
See https://jira.mongodb.org/browse/SERVER-28434
describing the condition where MongoDB is uninterested in
providing an upsert and fetch behavior.
>>> instance = getfixture('mo... | [
"Fetch",
"exactly",
"one",
"matching",
"document",
"or",
"upsert",
"the",
"document",
"if",
"not",
"found",
"returning",
"the",
"matching",
"or",
"upserted",
"document",
"."
] | 280f17894941f4babf2e97db033dbb1fd2b9f705 | https://github.com/jaraco/jaraco.mongodb/blob/280f17894941f4babf2e97db033dbb1fd2b9f705/jaraco/mongodb/query.py#L39-L64 | train | Fetch exactly one matching document or upsert
the document if not found returning the matching
or upserted document. |
Danielhiversen/pySwitchmate | switchmate/__init__.py | Switchmate.update | def update(self, retry=2) -> None:
"""Synchronize state with switch."""
try:
_LOGGER.debug("Updating device state.")
key = ON_KEY if not self._flip_on_off else OFF_KEY
self.state = self._device.readCharacteristic(HANDLE) == key
except (bluepy.btle.BTLEExceptio... | python | def update(self, retry=2) -> None:
"""Synchronize state with switch."""
try:
_LOGGER.debug("Updating device state.")
key = ON_KEY if not self._flip_on_off else OFF_KEY
self.state = self._device.readCharacteristic(HANDLE) == key
except (bluepy.btle.BTLEExceptio... | [
"def",
"update",
"(",
"self",
",",
"retry",
"=",
"2",
")",
"->",
"None",
":",
"try",
":",
"_LOGGER",
".",
"debug",
"(",
"\"Updating device state.\"",
")",
"key",
"=",
"ON_KEY",
"if",
"not",
"self",
".",
"_flip_on_off",
"else",
"OFF_KEY",
"self",
".",
"... | Synchronize state with switch. | [
"Synchronize",
"state",
"with",
"switch",
"."
] | 9563345d35d7dcc0b920b1939eea9a7897223221 | https://github.com/Danielhiversen/pySwitchmate/blob/9563345d35d7dcc0b920b1939eea9a7897223221/switchmate/__init__.py#L56-L69 | train | Synchronize state with switch. |
yeraydiazdiaz/lunr.py | lunr/match_data.py | MatchData.combine | def combine(self, other):
"""An instance of lunr.MatchData will be created for every term that
matches a document.
However only one instance is required in a lunr.Index~Result. This
method combines metadata from another instance of MatchData with this
object's metadata.
... | python | def combine(self, other):
"""An instance of lunr.MatchData will be created for every term that
matches a document.
However only one instance is required in a lunr.Index~Result. This
method combines metadata from another instance of MatchData with this
object's metadata.
... | [
"def",
"combine",
"(",
"self",
",",
"other",
")",
":",
"for",
"term",
"in",
"other",
".",
"metadata",
".",
"keys",
"(",
")",
":",
"if",
"term",
"not",
"in",
"self",
".",
"metadata",
":",
"self",
".",
"metadata",
"[",
"term",
"]",
"=",
"{",
"}",
... | An instance of lunr.MatchData will be created for every term that
matches a document.
However only one instance is required in a lunr.Index~Result. This
method combines metadata from another instance of MatchData with this
object's metadata. | [
"An",
"instance",
"of",
"lunr",
".",
"MatchData",
"will",
"be",
"created",
"for",
"every",
"term",
"that",
"matches",
"a",
"document",
"."
] | 28ec3f6d4888295eed730211ee9617aa488d6ba3 | https://github.com/yeraydiazdiaz/lunr.py/blob/28ec3f6d4888295eed730211ee9617aa488d6ba3/lunr/match_data.py#L25-L51 | train | This method combines the metadata from another object into this object. |
yeraydiazdiaz/lunr.py | lunr/match_data.py | MatchData.add | def add(self, term, field, metadata):
"""Add metadata for a term/field pair to this instance of match data"""
if term not in self.metadata:
self.metadata[term] = {field: metadata}
return
if field not in self.metadata[term]:
self.metadata[term][field] = metada... | python | def add(self, term, field, metadata):
"""Add metadata for a term/field pair to this instance of match data"""
if term not in self.metadata:
self.metadata[term] = {field: metadata}
return
if field not in self.metadata[term]:
self.metadata[term][field] = metada... | [
"def",
"add",
"(",
"self",
",",
"term",
",",
"field",
",",
"metadata",
")",
":",
"if",
"term",
"not",
"in",
"self",
".",
"metadata",
":",
"self",
".",
"metadata",
"[",
"term",
"]",
"=",
"{",
"field",
":",
"metadata",
"}",
"return",
"if",
"field",
... | Add metadata for a term/field pair to this instance of match data | [
"Add",
"metadata",
"for",
"a",
"term",
"/",
"field",
"pair",
"to",
"this",
"instance",
"of",
"match",
"data"
] | 28ec3f6d4888295eed730211ee9617aa488d6ba3 | https://github.com/yeraydiazdiaz/lunr.py/blob/28ec3f6d4888295eed730211ee9617aa488d6ba3/lunr/match_data.py#L53-L67 | train | Add metadata for a term / field pair to this instance of match data |
CiscoUcs/UcsPythonSDK | src/UcsSdk/utils/power.py | UcsPower.get_power_state | def get_power_state(self):
"""Get current power state of this node
:param node: Ironic node one of :class:`ironic.db.models.Node`
:raises: InvalidParameterValue if required Ucs parameters are
missing
:raises: UcsOperationError: on an error from Ucs.
:ret... | python | def get_power_state(self):
"""Get current power state of this node
:param node: Ironic node one of :class:`ironic.db.models.Node`
:raises: InvalidParameterValue if required Ucs parameters are
missing
:raises: UcsOperationError: on an error from Ucs.
:ret... | [
"def",
"get_power_state",
"(",
"self",
")",
":",
"rn_array",
"=",
"[",
"self",
".",
"helper",
".",
"service_profile",
",",
"ManagedObject",
"(",
"NamingId",
".",
"LS_POWER",
")",
".",
"MakeRn",
"(",
")",
"]",
"try",
":",
"ls_power",
"=",
"ucs_helper",
".... | Get current power state of this node
:param node: Ironic node one of :class:`ironic.db.models.Node`
:raises: InvalidParameterValue if required Ucs parameters are
missing
:raises: UcsOperationError: on an error from Ucs.
:returns: Power state of the given node | [
"Get",
"current",
"power",
"state",
"of",
"this",
"node"
] | bf6b07d6abeacb922c92b198352eda4eb9e4629b | https://github.com/CiscoUcs/UcsPythonSDK/blob/bf6b07d6abeacb922c92b198352eda4eb9e4629b/src/UcsSdk/utils/power.py#L30-L52 | train | Get current power state of the given node. |
CiscoUcs/UcsPythonSDK | src/UcsSdk/utils/power.py | UcsPower.set_power_state | def set_power_state(self, desired_state):
"""Set power state of this node
:param node: Ironic node one of :class:`ironic.db.models.Node`
:raises: InvalidParameterValue if required seamicro parameters are
missing.
:raises: UcsOperationError on an error from U... | python | def set_power_state(self, desired_state):
"""Set power state of this node
:param node: Ironic node one of :class:`ironic.db.models.Node`
:raises: InvalidParameterValue if required seamicro parameters are
missing.
:raises: UcsOperationError on an error from U... | [
"def",
"set_power_state",
"(",
"self",
",",
"desired_state",
")",
":",
"rn_array",
"=",
"[",
"self",
".",
"helper",
".",
"service_profile",
",",
"ManagedObject",
"(",
"NamingId",
".",
"LS_POWER",
")",
".",
"MakeRn",
"(",
")",
"]",
"try",
":",
"ls_power",
... | Set power state of this node
:param node: Ironic node one of :class:`ironic.db.models.Node`
:raises: InvalidParameterValue if required seamicro parameters are
missing.
:raises: UcsOperationError on an error from UcsHandle Client.
:returns: Power state of... | [
"Set",
"power",
"state",
"of",
"this",
"node"
] | bf6b07d6abeacb922c92b198352eda4eb9e4629b | https://github.com/CiscoUcs/UcsPythonSDK/blob/bf6b07d6abeacb922c92b198352eda4eb9e4629b/src/UcsSdk/utils/power.py#L54-L88 | train | Set the power state of the given node. |
CiscoUcs/UcsPythonSDK | src/UcsSdk/utils/power.py | UcsPower.reboot | def reboot(self):
"""Hard reset the power of this node.
"""
if self.get_power_state() == LsPower.CONST_STATE_DOWN:
self.set_power_state(LsPower.CONST_STATE_UP)
else:
self.set_power_state(LsPower.CONST_STATE_HARD_RESET_IMMEDIATE) | python | def reboot(self):
"""Hard reset the power of this node.
"""
if self.get_power_state() == LsPower.CONST_STATE_DOWN:
self.set_power_state(LsPower.CONST_STATE_UP)
else:
self.set_power_state(LsPower.CONST_STATE_HARD_RESET_IMMEDIATE) | [
"def",
"reboot",
"(",
"self",
")",
":",
"if",
"self",
".",
"get_power_state",
"(",
")",
"==",
"LsPower",
".",
"CONST_STATE_DOWN",
":",
"self",
".",
"set_power_state",
"(",
"LsPower",
".",
"CONST_STATE_UP",
")",
"else",
":",
"self",
".",
"set_power_state",
... | Hard reset the power of this node. | [
"Hard",
"reset",
"the",
"power",
"of",
"this",
"node",
"."
] | bf6b07d6abeacb922c92b198352eda4eb9e4629b | https://github.com/CiscoUcs/UcsPythonSDK/blob/bf6b07d6abeacb922c92b198352eda4eb9e4629b/src/UcsSdk/utils/power.py#L90-L96 | train | Hard reset the power of this node. |
jaraco/jaraco.mongodb | jaraco/mongodb/helper.py | connect | def connect(uri, factory=pymongo.MongoClient):
"""
Use the factory to establish a connection to uri.
"""
warnings.warn(
"do not use. Just call MongoClient directly.", DeprecationWarning)
return factory(uri) | python | def connect(uri, factory=pymongo.MongoClient):
"""
Use the factory to establish a connection to uri.
"""
warnings.warn(
"do not use. Just call MongoClient directly.", DeprecationWarning)
return factory(uri) | [
"def",
"connect",
"(",
"uri",
",",
"factory",
"=",
"pymongo",
".",
"MongoClient",
")",
":",
"warnings",
".",
"warn",
"(",
"\"do not use. Just call MongoClient directly.\"",
",",
"DeprecationWarning",
")",
"return",
"factory",
"(",
"uri",
")"
] | Use the factory to establish a connection to uri. | [
"Use",
"the",
"factory",
"to",
"establish",
"a",
"connection",
"to",
"uri",
"."
] | 280f17894941f4babf2e97db033dbb1fd2b9f705 | https://github.com/jaraco/jaraco.mongodb/blob/280f17894941f4babf2e97db033dbb1fd2b9f705/jaraco/mongodb/helper.py#L18-L24 | train | Connect to a resource. |
jaraco/jaraco.mongodb | jaraco/mongodb/helper.py | connect_db | def connect_db(
uri, default_db_name=None, factory=pymongo.MongoClient):
"""
Use pymongo to parse a uri (possibly including database name) into
a connected database object.
This serves as a convenience function for the common use case where one
wishes to get the Database object and is less ... | python | def connect_db(
uri, default_db_name=None, factory=pymongo.MongoClient):
"""
Use pymongo to parse a uri (possibly including database name) into
a connected database object.
This serves as a convenience function for the common use case where one
wishes to get the Database object and is less ... | [
"def",
"connect_db",
"(",
"uri",
",",
"default_db_name",
"=",
"None",
",",
"factory",
"=",
"pymongo",
".",
"MongoClient",
")",
":",
"uri_p",
"=",
"pymongo",
".",
"uri_parser",
".",
"parse_uri",
"(",
"uri",
")",
"client",
"=",
"factory",
"(",
"uri",
")",
... | Use pymongo to parse a uri (possibly including database name) into
a connected database object.
This serves as a convenience function for the common use case where one
wishes to get the Database object and is less concerned about the
intermediate MongoClient object that pymongo creates (though the
... | [
"Use",
"pymongo",
"to",
"parse",
"a",
"uri",
"(",
"possibly",
"including",
"database",
"name",
")",
"into",
"a",
"connected",
"database",
"object",
"."
] | 280f17894941f4babf2e97db033dbb1fd2b9f705 | https://github.com/jaraco/jaraco.mongodb/blob/280f17894941f4babf2e97db033dbb1fd2b9f705/jaraco/mongodb/helper.py#L27-L59 | train | Connect to a connected database. |
jaraco/jaraco.mongodb | jaraco/mongodb/helper.py | connect_gridfs | def connect_gridfs(uri, db=None):
"""
Construct a GridFS instance for a MongoDB URI.
"""
return gridfs.GridFS(
db or connect_db(uri),
collection=get_collection(uri) or 'fs',
) | python | def connect_gridfs(uri, db=None):
"""
Construct a GridFS instance for a MongoDB URI.
"""
return gridfs.GridFS(
db or connect_db(uri),
collection=get_collection(uri) or 'fs',
) | [
"def",
"connect_gridfs",
"(",
"uri",
",",
"db",
"=",
"None",
")",
":",
"return",
"gridfs",
".",
"GridFS",
"(",
"db",
"or",
"connect_db",
"(",
"uri",
")",
",",
"collection",
"=",
"get_collection",
"(",
"uri",
")",
"or",
"'fs'",
",",
")"
] | Construct a GridFS instance for a MongoDB URI. | [
"Construct",
"a",
"GridFS",
"instance",
"for",
"a",
"MongoDB",
"URI",
"."
] | 280f17894941f4babf2e97db033dbb1fd2b9f705 | https://github.com/jaraco/jaraco.mongodb/blob/280f17894941f4babf2e97db033dbb1fd2b9f705/jaraco/mongodb/helper.py#L66-L73 | train | Construct a GridFS instance for a MongoDB URI. |
CiscoUcs/UcsPythonSDK | src/UcsSdk/UcsHandle_Edit.py | CompareManagedObject | def CompareManagedObject(referenceObject, differenceObject, excludeDifferent=YesOrNo.FALSE, includeEqual=YesOrNo.FALSE,
noVersionFilter=YesOrNo.FALSE, includeOperational=YesOrNo.FALSE, xlateOrg=None, xlateMap=None):
"""
Compares managed objects.
- referenceObject specifies objects used as a reference f... | python | def CompareManagedObject(referenceObject, differenceObject, excludeDifferent=YesOrNo.FALSE, includeEqual=YesOrNo.FALSE,
noVersionFilter=YesOrNo.FALSE, includeOperational=YesOrNo.FALSE, xlateOrg=None, xlateMap=None):
"""
Compares managed objects.
- referenceObject specifies objects used as a reference f... | [
"def",
"CompareManagedObject",
"(",
"referenceObject",
",",
"differenceObject",
",",
"excludeDifferent",
"=",
"YesOrNo",
".",
"FALSE",
",",
"includeEqual",
"=",
"YesOrNo",
".",
"FALSE",
",",
"noVersionFilter",
"=",
"YesOrNo",
".",
"FALSE",
",",
"includeOperational",... | Compares managed objects.
- referenceObject specifies objects used as a reference for comparison.
- differenceObject specifies objects that are compared to the reference objects.
- excludeDifferent, if set as True then displays only the properties of compared objects that are equal.
- includeEqual, set... | [
"Compares",
"managed",
"objects",
"."
] | bf6b07d6abeacb922c92b198352eda4eb9e4629b | https://github.com/CiscoUcs/UcsPythonSDK/blob/bf6b07d6abeacb922c92b198352eda4eb9e4629b/src/UcsSdk/UcsHandle_Edit.py#L2631-L2739 | train | Compares two managed objects. |
CiscoUcs/UcsPythonSDK | src/UcsSdk/UcsHandle_Edit.py | Compare | def Compare(fromMo, toMo, diff):
""" Internal method to support CompareManagedObject functionality. """
from UcsBase import UcsUtils
if (fromMo.classId != toMo.classId):
return CompareStatus.TypesDifferent
for prop in UcsUtils.GetUcsPropertyMetaAttributeList(str(fromMo.classId)):
propMeta = UcsUtils.IsPropert... | python | def Compare(fromMo, toMo, diff):
""" Internal method to support CompareManagedObject functionality. """
from UcsBase import UcsUtils
if (fromMo.classId != toMo.classId):
return CompareStatus.TypesDifferent
for prop in UcsUtils.GetUcsPropertyMetaAttributeList(str(fromMo.classId)):
propMeta = UcsUtils.IsPropert... | [
"def",
"Compare",
"(",
"fromMo",
",",
"toMo",
",",
"diff",
")",
":",
"from",
"UcsBase",
"import",
"UcsUtils",
"if",
"(",
"fromMo",
".",
"classId",
"!=",
"toMo",
".",
"classId",
")",
":",
"return",
"CompareStatus",
".",
"TypesDifferent",
"for",
"prop",
"i... | Internal method to support CompareManagedObject functionality. | [
"Internal",
"method",
"to",
"support",
"CompareManagedObject",
"functionality",
"."
] | bf6b07d6abeacb922c92b198352eda4eb9e4629b | https://github.com/CiscoUcs/UcsPythonSDK/blob/bf6b07d6abeacb922c92b198352eda4eb9e4629b/src/UcsSdk/UcsHandle_Edit.py#L2742-L2761 | train | Internal method to support CompareManagedObject functionality. |
CiscoUcs/UcsPythonSDK | src/UcsSdk/UcsHandle_Edit.py | TranslateManagedObject | def TranslateManagedObject(mObj, xlateOrg, xlateMap):
""" Method used to translate a managedobject. This method is used in CompareManagedObject. """
from UcsBase import UcsUtils, WriteUcsWarning
from Mos import OrgOrg
xMO = mObj.Clone()
xMO.SetHandle(mObj.GetHandle())
if (xlateOrg != None):
matchObj = re.match... | python | def TranslateManagedObject(mObj, xlateOrg, xlateMap):
""" Method used to translate a managedobject. This method is used in CompareManagedObject. """
from UcsBase import UcsUtils, WriteUcsWarning
from Mos import OrgOrg
xMO = mObj.Clone()
xMO.SetHandle(mObj.GetHandle())
if (xlateOrg != None):
matchObj = re.match... | [
"def",
"TranslateManagedObject",
"(",
"mObj",
",",
"xlateOrg",
",",
"xlateMap",
")",
":",
"from",
"UcsBase",
"import",
"UcsUtils",
",",
"WriteUcsWarning",
"from",
"Mos",
"import",
"OrgOrg",
"xMO",
"=",
"mObj",
".",
"Clone",
"(",
")",
"xMO",
".",
"SetHandle",... | Method used to translate a managedobject. This method is used in CompareManagedObject. | [
"Method",
"used",
"to",
"translate",
"a",
"managedobject",
".",
"This",
"method",
"is",
"used",
"in",
"CompareManagedObject",
"."
] | bf6b07d6abeacb922c92b198352eda4eb9e4629b | https://github.com/CiscoUcs/UcsPythonSDK/blob/bf6b07d6abeacb922c92b198352eda4eb9e4629b/src/UcsSdk/UcsHandle_Edit.py#L2764-L2822 | train | This method translates a managedobject into a new object. |
CiscoUcs/UcsPythonSDK | src/UcsSdk/UcsHandle_Edit.py | ExportUcsSession | def ExportUcsSession(filePath, key, merge=YesOrNo.FALSE):
"""
Stores the credential of currently logged in UCS in current session to a file. Password will be stored in encrypted format using key.
- filePath specifies the path of the credential file.
- key specifies any string used for secure encryption.
... | python | def ExportUcsSession(filePath, key, merge=YesOrNo.FALSE):
"""
Stores the credential of currently logged in UCS in current session to a file. Password will be stored in encrypted format using key.
- filePath specifies the path of the credential file.
- key specifies any string used for secure encryption.
... | [
"def",
"ExportUcsSession",
"(",
"filePath",
",",
"key",
",",
"merge",
"=",
"YesOrNo",
".",
"FALSE",
")",
":",
"from",
"UcsBase",
"import",
"UcsUtils",
",",
"WriteUcsWarning",
",",
"UcsValidationException",
"# from p3 import p3_encrypt, p3_decrypt",
"if",
"filePath",
... | Stores the credential of currently logged in UCS in current session to a file. Password will be stored in encrypted format using key.
- filePath specifies the path of the credential file.
- key specifies any string used for secure encryption.
- merge should be set as False unless user wants to append the e... | [
"Stores",
"the",
"credential",
"of",
"currently",
"logged",
"in",
"UCS",
"in",
"current",
"session",
"to",
"a",
"file",
".",
"Password",
"will",
"be",
"stored",
"in",
"encrypted",
"format",
"using",
"key",
"."
] | bf6b07d6abeacb922c92b198352eda4eb9e4629b | https://github.com/CiscoUcs/UcsPythonSDK/blob/bf6b07d6abeacb922c92b198352eda4eb9e4629b/src/UcsSdk/UcsHandle_Edit.py#L2849-L2947 | train | Export the current credential of currently logged in UCS in current session to a file. |
CiscoUcs/UcsPythonSDK | src/UcsSdk/UcsHandle_Edit.py | ImportUcsSession | def ImportUcsSession(filePath, key):
"""
This operation will do a login to each UCS which is present in credential file.
- filePath specifies the path of the credential file.
- key specifies string used for secure encryption while ExportUcsSession operation.
"""
from UcsBase import UcsUtils, WriteUcs... | python | def ImportUcsSession(filePath, key):
"""
This operation will do a login to each UCS which is present in credential file.
- filePath specifies the path of the credential file.
- key specifies string used for secure encryption while ExportUcsSession operation.
"""
from UcsBase import UcsUtils, WriteUcs... | [
"def",
"ImportUcsSession",
"(",
"filePath",
",",
"key",
")",
":",
"from",
"UcsBase",
"import",
"UcsUtils",
",",
"WriteUcsWarning",
",",
"UcsValidationException",
"# from p3 import p3_encrypt, p3_decrypt",
"if",
"filePath",
"is",
"None",
":",
"raise",
"UcsValidationExcep... | This operation will do a login to each UCS which is present in credential file.
- filePath specifies the path of the credential file.
- key specifies string used for secure encryption while ExportUcsSession operation. | [
"This",
"operation",
"will",
"do",
"a",
"login",
"to",
"each",
"UCS",
"which",
"is",
"present",
"in",
"credential",
"file",
"."
] | bf6b07d6abeacb922c92b198352eda4eb9e4629b | https://github.com/CiscoUcs/UcsPythonSDK/blob/bf6b07d6abeacb922c92b198352eda4eb9e4629b/src/UcsSdk/UcsHandle_Edit.py#L2950-L3026 | train | This operation will import a UCS session from a file. |
CiscoUcs/UcsPythonSDK | src/UcsSdk/UcsHandle_Edit.py | UcsHandle.Uri | def Uri(self):
""" Constructs the connection URI from name, noSsl and port instance variables. """
return ("%s://%s%s" % (("https", "http")[self._noSsl == True], self._name, (":" + str(self._port), "")[
(((self._noSsl == False) and (self._port == 80)) or ((self._noSsl == True) and (self._port == 443)))])) | python | def Uri(self):
""" Constructs the connection URI from name, noSsl and port instance variables. """
return ("%s://%s%s" % (("https", "http")[self._noSsl == True], self._name, (":" + str(self._port), "")[
(((self._noSsl == False) and (self._port == 80)) or ((self._noSsl == True) and (self._port == 443)))])) | [
"def",
"Uri",
"(",
"self",
")",
":",
"return",
"(",
"\"%s://%s%s\"",
"%",
"(",
"(",
"\"https\"",
",",
"\"http\"",
")",
"[",
"self",
".",
"_noSsl",
"==",
"True",
"]",
",",
"self",
".",
"_name",
",",
"(",
"\":\"",
"+",
"str",
"(",
"self",
".",
"_po... | Constructs the connection URI from name, noSsl and port instance variables. | [
"Constructs",
"the",
"connection",
"URI",
"from",
"name",
"noSsl",
"and",
"port",
"instance",
"variables",
"."
] | bf6b07d6abeacb922c92b198352eda4eb9e4629b | https://github.com/CiscoUcs/UcsPythonSDK/blob/bf6b07d6abeacb922c92b198352eda4eb9e4629b/src/UcsSdk/UcsHandle_Edit.py#L80-L83 | train | Returns the connection URI from the name noSsl and port instance variables. |
CiscoUcs/UcsPythonSDK | src/UcsSdk/UcsHandle_Edit.py | UcsHandle.UndoTransaction | def UndoTransaction(self):
""" Cancels any running transaction. """
from Ucs import ConfigMap
self._transactionInProgress = False
self._configMap = ConfigMap() | python | def UndoTransaction(self):
""" Cancels any running transaction. """
from Ucs import ConfigMap
self._transactionInProgress = False
self._configMap = ConfigMap() | [
"def",
"UndoTransaction",
"(",
"self",
")",
":",
"from",
"Ucs",
"import",
"ConfigMap",
"self",
".",
"_transactionInProgress",
"=",
"False",
"self",
".",
"_configMap",
"=",
"ConfigMap",
"(",
")"
] | Cancels any running transaction. | [
"Cancels",
"any",
"running",
"transaction",
"."
] | bf6b07d6abeacb922c92b198352eda4eb9e4629b | https://github.com/CiscoUcs/UcsPythonSDK/blob/bf6b07d6abeacb922c92b198352eda4eb9e4629b/src/UcsSdk/UcsHandle_Edit.py#L95-L100 | train | Cancels any running transaction. |
CiscoUcs/UcsPythonSDK | src/UcsSdk/UcsHandle_Edit.py | UcsHandle.CompleteTransaction | def CompleteTransaction(self, dumpXml=None):
"""
Completes a transaction.
This method completes a transaction by sending the final configuration (modification queries stored in configMap) to UCS and
returns the result.
"""
from Ucs import ConfigMap, Pair
from UcsBase import Manage... | python | def CompleteTransaction(self, dumpXml=None):
"""
Completes a transaction.
This method completes a transaction by sending the final configuration (modification queries stored in configMap) to UCS and
returns the result.
"""
from Ucs import ConfigMap, Pair
from UcsBase import Manage... | [
"def",
"CompleteTransaction",
"(",
"self",
",",
"dumpXml",
"=",
"None",
")",
":",
"from",
"Ucs",
"import",
"ConfigMap",
",",
"Pair",
"from",
"UcsBase",
"import",
"ManagedObject",
",",
"WriteUcsWarning",
",",
"WriteObject",
",",
"UcsException",
"self",
".",
"_t... | Completes a transaction.
This method completes a transaction by sending the final configuration (modification queries stored in configMap) to UCS and
returns the result. | [
"Completes",
"a",
"transaction",
"."
] | bf6b07d6abeacb922c92b198352eda4eb9e4629b | https://github.com/CiscoUcs/UcsPythonSDK/blob/bf6b07d6abeacb922c92b198352eda4eb9e4629b/src/UcsSdk/UcsHandle_Edit.py#L102-L127 | train | This method completes a transaction by sending the final configuration queries stored in configMap and writing the result to UCS and returning the result. |
CiscoUcs/UcsPythonSDK | src/UcsSdk/UcsHandle_Edit.py | UcsHandle.XmlQuery | def XmlQuery(self, method, options, dumpXml=None):
"""
Accepts any ExternalMethod stores any modification query locally if transaction is in progress (and returns temporary result)
prepares xml query as per the writeXmlOption from external method. Opens a connection to url, sends the xmlQuery string t... | python | def XmlQuery(self, method, options, dumpXml=None):
"""
Accepts any ExternalMethod stores any modification query locally if transaction is in progress (and returns temporary result)
prepares xml query as per the writeXmlOption from external method. Opens a connection to url, sends the xmlQuery string t... | [
"def",
"XmlQuery",
"(",
"self",
",",
"method",
",",
"options",
",",
"dumpXml",
"=",
"None",
")",
":",
"from",
"UcsBase",
"import",
"ExternalMethod",
",",
"ManagedObject",
",",
"UcsUtils",
"from",
"Ucs",
"import",
"ConfigConfig",
",",
"Pair",
",",
"ConfigMap"... | Accepts any ExternalMethod stores any modification query locally if transaction is in progress (and returns temporary result)
prepares xml query as per the writeXmlOption from external method. Opens a connection to url, sends the xmlQuery string to url
location, and returns result. Prepares objects fro... | [
"Accepts",
"any",
"ExternalMethod",
"stores",
"any",
"modification",
"query",
"locally",
"if",
"transaction",
"is",
"in",
"progress",
"(",
"and",
"returns",
"temporary",
"result",
")",
"prepares",
"xml",
"query",
"as",
"per",
"the",
"writeXmlOption",
"from",
"ex... | bf6b07d6abeacb922c92b198352eda4eb9e4629b | https://github.com/CiscoUcs/UcsPythonSDK/blob/bf6b07d6abeacb922c92b198352eda4eb9e4629b/src/UcsSdk/UcsHandle_Edit.py#L129-L266 | train | This method prepares an xml query from the server and returns the result. |
CiscoUcs/UcsPythonSDK | src/UcsSdk/UcsHandle_Edit.py | UcsHandle.XmlRawQuery | def XmlRawQuery(self, xml, dumpXml=None):
""" Accepts xmlQuery String and returns xml response String. No object manipulation is done in this method. """
if (dumpXml == None):
dumpXml = self._dumpXml
uri = self.Uri() + '/nuova'
if (dumpXml in _AffirmativeList):
print '%s ====> %s' % (self._ucs, xml)
#... | python | def XmlRawQuery(self, xml, dumpXml=None):
""" Accepts xmlQuery String and returns xml response String. No object manipulation is done in this method. """
if (dumpXml == None):
dumpXml = self._dumpXml
uri = self.Uri() + '/nuova'
if (dumpXml in _AffirmativeList):
print '%s ====> %s' % (self._ucs, xml)
#... | [
"def",
"XmlRawQuery",
"(",
"self",
",",
"xml",
",",
"dumpXml",
"=",
"None",
")",
":",
"if",
"(",
"dumpXml",
"==",
"None",
")",
":",
"dumpXml",
"=",
"self",
".",
"_dumpXml",
"uri",
"=",
"self",
".",
"Uri",
"(",
")",
"+",
"'/nuova'",
"if",
"(",
"du... | Accepts xmlQuery String and returns xml response String. No object manipulation is done in this method. | [
"Accepts",
"xmlQuery",
"String",
"and",
"returns",
"xml",
"response",
"String",
".",
"No",
"object",
"manipulation",
"is",
"done",
"in",
"this",
"method",
"."
] | bf6b07d6abeacb922c92b198352eda4eb9e4629b | https://github.com/CiscoUcs/UcsPythonSDK/blob/bf6b07d6abeacb922c92b198352eda4eb9e4629b/src/UcsSdk/UcsHandle_Edit.py#L268-L303 | train | This method is used to make a raw xml query. |
CiscoUcs/UcsPythonSDK | src/UcsSdk/UcsHandle_Edit.py | UcsHandle.Login | def Login(self, name, username=None, password=None, noSsl=False, port=None, dumpXml=None, proxy=None,
autoRefresh=YesOrNo.FALSE):
"""
Login method authenticates and connects to UCS.
- name specifies the IP Address IMC Server.
- username specifies the username credential.
- passwo... | python | def Login(self, name, username=None, password=None, noSsl=False, port=None, dumpXml=None, proxy=None,
autoRefresh=YesOrNo.FALSE):
"""
Login method authenticates and connects to UCS.
- name specifies the IP Address IMC Server.
- username specifies the username credential.
- passwo... | [
"def",
"Login",
"(",
"self",
",",
"name",
",",
"username",
"=",
"None",
",",
"password",
"=",
"None",
",",
"noSsl",
"=",
"False",
",",
"port",
"=",
"None",
",",
"dumpXml",
"=",
"None",
",",
"proxy",
"=",
"None",
",",
"autoRefresh",
"=",
"YesOrNo",
... | Login method authenticates and connects to UCS.
- name specifies the IP Address IMC Server.
- username specifies the username credential.
- password specifies the password credential.
- noSsl specifies if the connection is made via http(True) or https(False). Default is False.
-... | [
"Login",
"method",
"authenticates",
"and",
"connects",
"to",
"UCS",
"."
] | bf6b07d6abeacb922c92b198352eda4eb9e4629b | https://github.com/CiscoUcs/UcsPythonSDK/blob/bf6b07d6abeacb922c92b198352eda4eb9e4629b/src/UcsSdk/UcsHandle_Edit.py#L305-L395 | train | This method authenticates and connects to the IMC Server. |
CiscoUcs/UcsPythonSDK | src/UcsSdk/UcsHandle_Edit.py | UcsHandle.Logout | def Logout(self, dumpXml=None):
""" Logout method disconnects from UCS. """
from UcsBase import UcsException
if (self._cookie == None):
return True
if self._refreshTimer:
self._refreshTimer.cancel()
response = self.AaaLogout(dumpXml)
self._cookie = None
self._lastUpdateTime = str(time.asctime())
... | python | def Logout(self, dumpXml=None):
""" Logout method disconnects from UCS. """
from UcsBase import UcsException
if (self._cookie == None):
return True
if self._refreshTimer:
self._refreshTimer.cancel()
response = self.AaaLogout(dumpXml)
self._cookie = None
self._lastUpdateTime = str(time.asctime())
... | [
"def",
"Logout",
"(",
"self",
",",
"dumpXml",
"=",
"None",
")",
":",
"from",
"UcsBase",
"import",
"UcsException",
"if",
"(",
"self",
".",
"_cookie",
"==",
"None",
")",
":",
"return",
"True",
"if",
"self",
".",
"_refreshTimer",
":",
"self",
".",
"_refre... | Logout method disconnects from UCS. | [
"Logout",
"method",
"disconnects",
"from",
"UCS",
"."
] | bf6b07d6abeacb922c92b198352eda4eb9e4629b | https://github.com/CiscoUcs/UcsPythonSDK/blob/bf6b07d6abeacb922c92b198352eda4eb9e4629b/src/UcsSdk/UcsHandle_Edit.py#L397-L422 | train | Logout method disconnects from UCS. |
CiscoUcs/UcsPythonSDK | src/UcsSdk/UcsHandle_Edit.py | UcsHandle._Start_refresh_timer | def _Start_refresh_timer(self):
""" Internal method to support auto-refresh functionality. """
if self._refreshPeriod > 60:
interval = self._refreshPeriod - 60
else:
interval = 60
self._refreshTimer = Timer(self._refreshPeriod, self.Refresh)
# TODO:handle exit and logout active connections. revert from ... | python | def _Start_refresh_timer(self):
""" Internal method to support auto-refresh functionality. """
if self._refreshPeriod > 60:
interval = self._refreshPeriod - 60
else:
interval = 60
self._refreshTimer = Timer(self._refreshPeriod, self.Refresh)
# TODO:handle exit and logout active connections. revert from ... | [
"def",
"_Start_refresh_timer",
"(",
"self",
")",
":",
"if",
"self",
".",
"_refreshPeriod",
">",
"60",
":",
"interval",
"=",
"self",
".",
"_refreshPeriod",
"-",
"60",
"else",
":",
"interval",
"=",
"60",
"self",
".",
"_refreshTimer",
"=",
"Timer",
"(",
"se... | Internal method to support auto-refresh functionality. | [
"Internal",
"method",
"to",
"support",
"auto",
"-",
"refresh",
"functionality",
"."
] | bf6b07d6abeacb922c92b198352eda4eb9e4629b | https://github.com/CiscoUcs/UcsPythonSDK/blob/bf6b07d6abeacb922c92b198352eda4eb9e4629b/src/UcsSdk/UcsHandle_Edit.py#L424-L433 | train | Internal method to support auto - refresh functionality. |
CiscoUcs/UcsPythonSDK | src/UcsSdk/UcsHandle_Edit.py | UcsHandle.Refresh | def Refresh(self, autoRelogin=False, dumpXml=YesOrNo.FALSE):
"""
Sends the aaaRefresh query to the UCS to refresh the connection (to prevent session expiration).
"""
self._Stop_refresh_timer()
response = self.AaaRefresh(self._username, self._password, dumpXml)
if (response.errorCode != 0):
self._cookie ... | python | def Refresh(self, autoRelogin=False, dumpXml=YesOrNo.FALSE):
"""
Sends the aaaRefresh query to the UCS to refresh the connection (to prevent session expiration).
"""
self._Stop_refresh_timer()
response = self.AaaRefresh(self._username, self._password, dumpXml)
if (response.errorCode != 0):
self._cookie ... | [
"def",
"Refresh",
"(",
"self",
",",
"autoRelogin",
"=",
"False",
",",
"dumpXml",
"=",
"YesOrNo",
".",
"FALSE",
")",
":",
"self",
".",
"_Stop_refresh_timer",
"(",
")",
"response",
"=",
"self",
".",
"AaaRefresh",
"(",
"self",
".",
"_username",
",",
"self",... | Sends the aaaRefresh query to the UCS to refresh the connection (to prevent session expiration). | [
"Sends",
"the",
"aaaRefresh",
"query",
"to",
"the",
"UCS",
"to",
"refresh",
"the",
"connection",
"(",
"to",
"prevent",
"session",
"expiration",
")",
"."
] | bf6b07d6abeacb922c92b198352eda4eb9e4629b | https://github.com/CiscoUcs/UcsPythonSDK/blob/bf6b07d6abeacb922c92b198352eda4eb9e4629b/src/UcsSdk/UcsHandle_Edit.py#L441-L462 | train | Refresh the connection. |
CiscoUcs/UcsPythonSDK | src/UcsSdk/UcsHandle_Edit.py | UcsHandle._enqueue_function | def _enqueue_function(self):
"""
Internal method used by AddEventHandler.
Provides functionality of enqueue/dequeue of the events and triggering callbacks.
"""
from UcsBase import _GenericMO, UcsUtils, WriteObject
myThread = self._enqueueThread
self._enqueueThreadSignal.acquire()
try:
xmlQuery ... | python | def _enqueue_function(self):
"""
Internal method used by AddEventHandler.
Provides functionality of enqueue/dequeue of the events and triggering callbacks.
"""
from UcsBase import _GenericMO, UcsUtils, WriteObject
myThread = self._enqueueThread
self._enqueueThreadSignal.acquire()
try:
xmlQuery ... | [
"def",
"_enqueue_function",
"(",
"self",
")",
":",
"from",
"UcsBase",
"import",
"_GenericMO",
",",
"UcsUtils",
",",
"WriteObject",
"myThread",
"=",
"self",
".",
"_enqueueThread",
"self",
".",
"_enqueueThreadSignal",
".",
"acquire",
"(",
")",
"try",
":",
"xmlQu... | Internal method used by AddEventHandler.
Provides functionality of enqueue/dequeue of the events and triggering callbacks. | [
"Internal",
"method",
"used",
"by",
"AddEventHandler",
".",
"Provides",
"functionality",
"of",
"enqueue",
"/",
"dequeue",
"of",
"the",
"events",
"and",
"triggering",
"callbacks",
"."
] | bf6b07d6abeacb922c92b198352eda4eb9e4629b | https://github.com/CiscoUcs/UcsPythonSDK/blob/bf6b07d6abeacb922c92b198352eda4eb9e4629b/src/UcsSdk/UcsHandle_Edit.py#L464-L560 | train | This method is used by AddEventHandler. It is used by AddEventHandler. It is used by AddEventHandler. It is used by AddEventHandler. It is used by AddEventHandler. |
CiscoUcs/UcsPythonSDK | src/UcsSdk/UcsHandle_Edit.py | UcsHandle._start_enqueue_thread | def _start_enqueue_thread(self):
""" Internal method to start the enqueue thread which adds the events in an internal queue. """
self._enqueueThreadSignal.acquire()
self._enqueueThread = Thread(target=self._enqueue_function)
self._enqueueThread.daemon = True
self._enqueueThread.start()
self._enqueueThreadSi... | python | def _start_enqueue_thread(self):
""" Internal method to start the enqueue thread which adds the events in an internal queue. """
self._enqueueThreadSignal.acquire()
self._enqueueThread = Thread(target=self._enqueue_function)
self._enqueueThread.daemon = True
self._enqueueThread.start()
self._enqueueThreadSi... | [
"def",
"_start_enqueue_thread",
"(",
"self",
")",
":",
"self",
".",
"_enqueueThreadSignal",
".",
"acquire",
"(",
")",
"self",
".",
"_enqueueThread",
"=",
"Thread",
"(",
"target",
"=",
"self",
".",
"_enqueue_function",
")",
"self",
".",
"_enqueueThread",
".",
... | Internal method to start the enqueue thread which adds the events in an internal queue. | [
"Internal",
"method",
"to",
"start",
"the",
"enqueue",
"thread",
"which",
"adds",
"the",
"events",
"in",
"an",
"internal",
"queue",
"."
] | bf6b07d6abeacb922c92b198352eda4eb9e4629b | https://github.com/CiscoUcs/UcsPythonSDK/blob/bf6b07d6abeacb922c92b198352eda4eb9e4629b/src/UcsSdk/UcsHandle_Edit.py#L562-L569 | train | Internal method to start the enqueue thread which adds the events in the internal queue. |
CiscoUcs/UcsPythonSDK | src/UcsSdk/UcsHandle_Edit.py | UcsHandle._add_watch_block | def _add_watch_block(self, params, filterCb, capacity=500, cb=None):
""" Internal method to add a watch block for starting event monitoring. """
if (self._wbslock == None):
self._wbslock = Lock()
self._wbslock.acquire()
wb = WatchBlock(params, filterCb, capacity, cb) # Add a List of Watchers
if ((wb != N... | python | def _add_watch_block(self, params, filterCb, capacity=500, cb=None):
""" Internal method to add a watch block for starting event monitoring. """
if (self._wbslock == None):
self._wbslock = Lock()
self._wbslock.acquire()
wb = WatchBlock(params, filterCb, capacity, cb) # Add a List of Watchers
if ((wb != N... | [
"def",
"_add_watch_block",
"(",
"self",
",",
"params",
",",
"filterCb",
",",
"capacity",
"=",
"500",
",",
"cb",
"=",
"None",
")",
":",
"if",
"(",
"self",
".",
"_wbslock",
"==",
"None",
")",
":",
"self",
".",
"_wbslock",
"=",
"Lock",
"(",
")",
"self... | Internal method to add a watch block for starting event monitoring. | [
"Internal",
"method",
"to",
"add",
"a",
"watch",
"block",
"for",
"starting",
"event",
"monitoring",
"."
] | bf6b07d6abeacb922c92b198352eda4eb9e4629b | https://github.com/CiscoUcs/UcsPythonSDK/blob/bf6b07d6abeacb922c92b198352eda4eb9e4629b/src/UcsSdk/UcsHandle_Edit.py#L571-L595 | train | Internal method to add a watch block for starting event monitoring. |
CiscoUcs/UcsPythonSDK | src/UcsSdk/UcsHandle_Edit.py | UcsHandle._remove_watch_block | def _remove_watch_block(self, wb):
""" Internal method to remove a watch block for stopping event monitoring. """
if (self._wbslock == None):
self._wbslock = Lock()
self._wbslock.acquire()
self._wbs.remove(wb)
if len(self._wbs) == 0:
self._stop_enqueue_thread()
self._stop_dequeue_thread()
self._w... | python | def _remove_watch_block(self, wb):
""" Internal method to remove a watch block for stopping event monitoring. """
if (self._wbslock == None):
self._wbslock = Lock()
self._wbslock.acquire()
self._wbs.remove(wb)
if len(self._wbs) == 0:
self._stop_enqueue_thread()
self._stop_dequeue_thread()
self._w... | [
"def",
"_remove_watch_block",
"(",
"self",
",",
"wb",
")",
":",
"if",
"(",
"self",
".",
"_wbslock",
"==",
"None",
")",
":",
"self",
".",
"_wbslock",
"=",
"Lock",
"(",
")",
"self",
".",
"_wbslock",
".",
"acquire",
"(",
")",
"self",
".",
"_wbs",
".",... | Internal method to remove a watch block for stopping event monitoring. | [
"Internal",
"method",
"to",
"remove",
"a",
"watch",
"block",
"for",
"stopping",
"event",
"monitoring",
"."
] | bf6b07d6abeacb922c92b198352eda4eb9e4629b | https://github.com/CiscoUcs/UcsPythonSDK/blob/bf6b07d6abeacb922c92b198352eda4eb9e4629b/src/UcsSdk/UcsHandle_Edit.py#L597-L608 | train | Internal method to remove a watch block for stopping event monitoring. |
CiscoUcs/UcsPythonSDK | src/UcsSdk/UcsHandle_Edit.py | UcsHandle.AddEventHandler | def AddEventHandler(self, classId=None, managedObject=None, prop=None, successValue=[], failureValue=[],
transientValue=[], pollSec=None, timeoutSec=None, callBack=None):
"""
Adds an event handler.
An event handler can be added using this method where an user can subscribe for the event channel from UCS ... | python | def AddEventHandler(self, classId=None, managedObject=None, prop=None, successValue=[], failureValue=[],
transientValue=[], pollSec=None, timeoutSec=None, callBack=None):
"""
Adds an event handler.
An event handler can be added using this method where an user can subscribe for the event channel from UCS ... | [
"def",
"AddEventHandler",
"(",
"self",
",",
"classId",
"=",
"None",
",",
"managedObject",
"=",
"None",
",",
"prop",
"=",
"None",
",",
"successValue",
"=",
"[",
"]",
",",
"failureValue",
"=",
"[",
"]",
",",
"transientValue",
"=",
"[",
"]",
",",
"pollSec... | Adds an event handler.
An event handler can be added using this method where an user can subscribe for the event channel from UCS and can monitor those events for any
specific success value or failure value for a managed object.
- classId specifies the class name for which events should be monitored.
- mana... | [
"Adds",
"an",
"event",
"handler",
".",
"An",
"event",
"handler",
"can",
"be",
"added",
"using",
"this",
"method",
"where",
"an",
"user",
"can",
"subscribe",
"for",
"the",
"event",
"channel",
"from",
"UCS",
"and",
"can",
"monitor",
"those",
"events",
"for",... | bf6b07d6abeacb922c92b198352eda4eb9e4629b | https://github.com/CiscoUcs/UcsPythonSDK/blob/bf6b07d6abeacb922c92b198352eda4eb9e4629b/src/UcsSdk/UcsHandle_Edit.py#L626-L716 | train | This method adds an event handler to the event channel. |
CiscoUcs/UcsPythonSDK | src/UcsSdk/UcsHandle_Edit.py | UcsHandle.RemoveEventHandler | def RemoveEventHandler(self, wb):
""" Removes an event handler. """
from UcsBase import WriteUcsWarning
if wb in self._wbs:
self._remove_watch_block(wb)
else:
WriteUcsWarning("Event handler not found") | python | def RemoveEventHandler(self, wb):
""" Removes an event handler. """
from UcsBase import WriteUcsWarning
if wb in self._wbs:
self._remove_watch_block(wb)
else:
WriteUcsWarning("Event handler not found") | [
"def",
"RemoveEventHandler",
"(",
"self",
",",
"wb",
")",
":",
"from",
"UcsBase",
"import",
"WriteUcsWarning",
"if",
"wb",
"in",
"self",
".",
"_wbs",
":",
"self",
".",
"_remove_watch_block",
"(",
"wb",
")",
"else",
":",
"WriteUcsWarning",
"(",
"\"Event handl... | Removes an event handler. | [
"Removes",
"an",
"event",
"handler",
"."
] | bf6b07d6abeacb922c92b198352eda4eb9e4629b | https://github.com/CiscoUcs/UcsPythonSDK/blob/bf6b07d6abeacb922c92b198352eda4eb9e4629b/src/UcsSdk/UcsHandle_Edit.py#L718-L725 | train | Removes an event handler. |
CiscoUcs/UcsPythonSDK | src/UcsSdk/UcsHandle_Edit.py | UcsHandle._start_dequeue_thread | def _start_dequeue_thread(self):
""" Internal method to start dequeue thread. """
self._dequeueThread = Thread(target=self._dequeue_function)
self._dequeueThread.daemon = True
self._dequeueThread.start() | python | def _start_dequeue_thread(self):
""" Internal method to start dequeue thread. """
self._dequeueThread = Thread(target=self._dequeue_function)
self._dequeueThread.daemon = True
self._dequeueThread.start() | [
"def",
"_start_dequeue_thread",
"(",
"self",
")",
":",
"self",
".",
"_dequeueThread",
"=",
"Thread",
"(",
"target",
"=",
"self",
".",
"_dequeue_function",
")",
"self",
".",
"_dequeueThread",
".",
"daemon",
"=",
"True",
"self",
".",
"_dequeueThread",
".",
"st... | Internal method to start dequeue thread. | [
"Internal",
"method",
"to",
"start",
"dequeue",
"thread",
"."
] | bf6b07d6abeacb922c92b198352eda4eb9e4629b | https://github.com/CiscoUcs/UcsPythonSDK/blob/bf6b07d6abeacb922c92b198352eda4eb9e4629b/src/UcsSdk/UcsHandle_Edit.py#L731-L735 | train | Internal method to start dequeue thread. |
CiscoUcs/UcsPythonSDK | src/UcsSdk/UcsHandle_Edit.py | UcsHandle._dequeue_function | def _dequeue_function(self):
""" Internal method to dequeue to events. """
from UcsBase import WriteUcsWarning, _GenericMO, WriteObject, UcsUtils
while len(self._wbs):
lowestTimeout = None
for wb in self._wbs:
pollSec = wb.params["pollSec"]
managedObject = wb.params["managedObject"]
timeoutSec ... | python | def _dequeue_function(self):
""" Internal method to dequeue to events. """
from UcsBase import WriteUcsWarning, _GenericMO, WriteObject, UcsUtils
while len(self._wbs):
lowestTimeout = None
for wb in self._wbs:
pollSec = wb.params["pollSec"]
managedObject = wb.params["managedObject"]
timeoutSec ... | [
"def",
"_dequeue_function",
"(",
"self",
")",
":",
"from",
"UcsBase",
"import",
"WriteUcsWarning",
",",
"_GenericMO",
",",
"WriteObject",
",",
"UcsUtils",
"while",
"len",
"(",
"self",
".",
"_wbs",
")",
":",
"lowestTimeout",
"=",
"None",
"for",
"wb",
"in",
... | Internal method to dequeue to events. | [
"Internal",
"method",
"to",
"dequeue",
"to",
"events",
"."
] | bf6b07d6abeacb922c92b198352eda4eb9e4629b | https://github.com/CiscoUcs/UcsPythonSDK/blob/bf6b07d6abeacb922c92b198352eda4eb9e4629b/src/UcsSdk/UcsHandle_Edit.py#L741-L885 | train | This method is called by _get_watch_block_and_remove_watch_block_from_event_list. |
CiscoUcs/UcsPythonSDK | src/UcsSdk/UcsHandle_Edit.py | UcsHandle.StartKvmSession | def StartKvmSession(self, serviceProfile=None, blade=None, rackUnit=None, frameTitle=None, dumpXml=None):
"""
Starts KVM session.
launches the KVM session for the specific service profile, blade or rackUnit.
- serviceProfile specifies an object of type lsServer. Launches KVM session with which the service pr... | python | def StartKvmSession(self, serviceProfile=None, blade=None, rackUnit=None, frameTitle=None, dumpXml=None):
"""
Starts KVM session.
launches the KVM session for the specific service profile, blade or rackUnit.
- serviceProfile specifies an object of type lsServer. Launches KVM session with which the service pr... | [
"def",
"StartKvmSession",
"(",
"self",
",",
"serviceProfile",
"=",
"None",
",",
"blade",
"=",
"None",
",",
"rackUnit",
"=",
"None",
",",
"frameTitle",
"=",
"None",
",",
"dumpXml",
"=",
"None",
")",
":",
"from",
"UcsBase",
"import",
"WriteUcsWarning",
",",
... | Starts KVM session.
launches the KVM session for the specific service profile, blade or rackUnit.
- serviceProfile specifies an object of type lsServer. Launches KVM session with which the service profile is associated.
- blade specifies an object of type computeBlade. Launches KVM session of blade server.
... | [
"Starts",
"KVM",
"session",
".",
"launches",
"the",
"KVM",
"session",
"for",
"the",
"specific",
"service",
"profile",
"blade",
"or",
"rackUnit",
".",
"-",
"serviceProfile",
"specifies",
"an",
"object",
"of",
"type",
"lsServer",
".",
"Launches",
"KVM",
"session... | bf6b07d6abeacb922c92b198352eda4eb9e4629b | https://github.com/CiscoUcs/UcsPythonSDK/blob/bf6b07d6abeacb922c92b198352eda4eb9e4629b/src/UcsSdk/UcsHandle_Edit.py#L895-L1062 | train | Starts a new KVM session. |
CiscoUcs/UcsPythonSDK | src/UcsSdk/UcsHandle_Edit.py | UcsHandle.StartGuiSession | def StartGuiSession(self):
""" Launches the UCSM GUI via specific UCS handle. """
from UcsBase import WriteUcsWarning, UcsUtils, UcsValidationException
import urllib, tempfile, fileinput, os, subprocess, platform
osSupport = ["Windows", "Linux", "Microsoft"]
if platform.system() not in osSupport:
raise U... | python | def StartGuiSession(self):
""" Launches the UCSM GUI via specific UCS handle. """
from UcsBase import WriteUcsWarning, UcsUtils, UcsValidationException
import urllib, tempfile, fileinput, os, subprocess, platform
osSupport = ["Windows", "Linux", "Microsoft"]
if platform.system() not in osSupport:
raise U... | [
"def",
"StartGuiSession",
"(",
"self",
")",
":",
"from",
"UcsBase",
"import",
"WriteUcsWarning",
",",
"UcsUtils",
",",
"UcsValidationException",
"import",
"urllib",
",",
"tempfile",
",",
"fileinput",
",",
"os",
",",
"subprocess",
",",
"platform",
"osSupport",
"=... | Launches the UCSM GUI via specific UCS handle. | [
"Launches",
"the",
"UCSM",
"GUI",
"via",
"specific",
"UCS",
"handle",
"."
] | bf6b07d6abeacb922c92b198352eda4eb9e4629b | https://github.com/CiscoUcs/UcsPythonSDK/blob/bf6b07d6abeacb922c92b198352eda4eb9e4629b/src/UcsSdk/UcsHandle_Edit.py#L1064-L1109 | train | Starts the UCSM GUI session. |
CiscoUcs/UcsPythonSDK | src/UcsSdk/UcsHandle_Edit.py | UcsHandle.BackupUcs | def BackupUcs(self, type, pathPattern, timeoutSec=600, preservePooledValues=False, dumpXml=None):
"""
Creates and downloads the backup of UCS.
- type specifies the type of backup i.e. fullstate/config-logical/config-system/config-all.
- pathPattern specifies the path of the Backup file.
- timeoutSec speci... | python | def BackupUcs(self, type, pathPattern, timeoutSec=600, preservePooledValues=False, dumpXml=None):
"""
Creates and downloads the backup of UCS.
- type specifies the type of backup i.e. fullstate/config-logical/config-system/config-all.
- pathPattern specifies the path of the Backup file.
- timeoutSec speci... | [
"def",
"BackupUcs",
"(",
"self",
",",
"type",
",",
"pathPattern",
",",
"timeoutSec",
"=",
"600",
",",
"preservePooledValues",
"=",
"False",
",",
"dumpXml",
"=",
"None",
")",
":",
"from",
"UcsBase",
"import",
"WriteUcsWarning",
",",
"UcsUtils",
",",
"ManagedO... | Creates and downloads the backup of UCS.
- type specifies the type of backup i.e. fullstate/config-logical/config-system/config-all.
- pathPattern specifies the path of the Backup file.
- timeoutSec specifies the time in seconds for which method waits for the backUp file to generate else exit. | [
"Creates",
"and",
"downloads",
"the",
"backup",
"of",
"UCS",
".",
"-",
"type",
"specifies",
"the",
"type",
"of",
"backup",
"i",
".",
"e",
".",
"fullstate",
"/",
"config",
"-",
"logical",
"/",
"config",
"-",
"system",
"/",
"config",
"-",
"all",
".",
"... | bf6b07d6abeacb922c92b198352eda4eb9e4629b | https://github.com/CiscoUcs/UcsPythonSDK/blob/bf6b07d6abeacb922c92b198352eda4eb9e4629b/src/UcsSdk/UcsHandle_Edit.py#L1112-L1222 | train | This method creates and downloads a backup of UCS. |
CiscoUcs/UcsPythonSDK | src/UcsSdk/UcsHandle_Edit.py | UcsHandle.ImportUcsBackup | def ImportUcsBackup(self, path=None, merge=False, dumpXml=False):
"""
Imports backUp.
This operation will upload the UCSM backup taken earlier via GUI or BackupUcs operation for all configuration, system configuration, and
logical configuration files. User can perform an import while the system is up and ru... | python | def ImportUcsBackup(self, path=None, merge=False, dumpXml=False):
"""
Imports backUp.
This operation will upload the UCSM backup taken earlier via GUI or BackupUcs operation for all configuration, system configuration, and
logical configuration files. User can perform an import while the system is up and ru... | [
"def",
"ImportUcsBackup",
"(",
"self",
",",
"path",
"=",
"None",
",",
"merge",
"=",
"False",
",",
"dumpXml",
"=",
"False",
")",
":",
"from",
"UcsBase",
"import",
"WriteUcsWarning",
",",
"UcsUtils",
",",
"ManagedObject",
",",
"WriteObject",
",",
"UcsUtils",
... | Imports backUp.
This operation will upload the UCSM backup taken earlier via GUI or BackupUcs operation for all configuration, system configuration, and
logical configuration files. User can perform an import while the system is up and running.
- path specifies path of the backup file.
- merge specifies whe... | [
"Imports",
"backUp",
".",
"This",
"operation",
"will",
"upload",
"the",
"UCSM",
"backup",
"taken",
"earlier",
"via",
"GUI",
"or",
"BackupUcs",
"operation",
"for",
"all",
"configuration",
"system",
"configuration",
"and",
"logical",
"configuration",
"files",
".",
... | bf6b07d6abeacb922c92b198352eda4eb9e4629b | https://github.com/CiscoUcs/UcsPythonSDK/blob/bf6b07d6abeacb922c92b198352eda4eb9e4629b/src/UcsSdk/UcsHandle_Edit.py#L1224-L1301 | train | This function imports the UCSM backup file. |
CiscoUcs/UcsPythonSDK | src/UcsSdk/UcsHandle_Edit.py | UcsHandle.SendUcsFirmware | def SendUcsFirmware(self, path=None, dumpXml=False):
"""
Uploads a specific CCO Image on UCS.
- path specifies the path of the image to be uploaded.
"""
from UcsBase import WriteUcsWarning, UcsUtils, ManagedObject, WriteObject, UcsUtils, UcsValidationException, \
UcsException
from Ucs import ConfigCon... | python | def SendUcsFirmware(self, path=None, dumpXml=False):
"""
Uploads a specific CCO Image on UCS.
- path specifies the path of the image to be uploaded.
"""
from UcsBase import WriteUcsWarning, UcsUtils, ManagedObject, WriteObject, UcsUtils, UcsValidationException, \
UcsException
from Ucs import ConfigCon... | [
"def",
"SendUcsFirmware",
"(",
"self",
",",
"path",
"=",
"None",
",",
"dumpXml",
"=",
"False",
")",
":",
"from",
"UcsBase",
"import",
"WriteUcsWarning",
",",
"UcsUtils",
",",
"ManagedObject",
",",
"WriteObject",
",",
"UcsUtils",
",",
"UcsValidationException",
... | Uploads a specific CCO Image on UCS.
- path specifies the path of the image to be uploaded. | [
"Uploads",
"a",
"specific",
"CCO",
"Image",
"on",
"UCS",
".",
"-",
"path",
"specifies",
"the",
"path",
"of",
"the",
"image",
"to",
"be",
"uploaded",
"."
] | bf6b07d6abeacb922c92b198352eda4eb9e4629b | https://github.com/CiscoUcs/UcsPythonSDK/blob/bf6b07d6abeacb922c92b198352eda4eb9e4629b/src/UcsSdk/UcsHandle_Edit.py#L1303-L1375 | train | Uploads a specific CCO Image on UCS. |
CiscoUcs/UcsPythonSDK | src/UcsSdk/UcsHandle_Edit.py | UcsHandle.GetTechSupport | def GetTechSupport(self, pathPattern, ucsManager=False, ucsMgmt=False, chassisId=None, cimcId=None, adapterId=None,
iomId=None, fexId=None, rackServerId=None, rackAdapterId=None, timeoutSec=600,
removeFromUcs=False, dumpXml=None):
"""
Creates and downloads the technical support data for the respecti... | python | def GetTechSupport(self, pathPattern, ucsManager=False, ucsMgmt=False, chassisId=None, cimcId=None, adapterId=None,
iomId=None, fexId=None, rackServerId=None, rackAdapterId=None, timeoutSec=600,
removeFromUcs=False, dumpXml=None):
"""
Creates and downloads the technical support data for the respecti... | [
"def",
"GetTechSupport",
"(",
"self",
",",
"pathPattern",
",",
"ucsManager",
"=",
"False",
",",
"ucsMgmt",
"=",
"False",
",",
"chassisId",
"=",
"None",
",",
"cimcId",
"=",
"None",
",",
"adapterId",
"=",
"None",
",",
"iomId",
"=",
"None",
",",
"fexId",
... | Creates and downloads the technical support data for the respective UCSM.
- pathPattern specifies the path of the tech support file to be downloaded. File should be a tar file.
- ucsManager, if provided as True then technical support data for the entire UCSM instance will be created and downloaded.
- ucsMgmt, ... | [
"Creates",
"and",
"downloads",
"the",
"technical",
"support",
"data",
"for",
"the",
"respective",
"UCSM",
".",
"-",
"pathPattern",
"specifies",
"the",
"path",
"of",
"the",
"tech",
"support",
"file",
"to",
"be",
"downloaded",
".",
"File",
"should",
"be",
"a",... | bf6b07d6abeacb922c92b198352eda4eb9e4629b | https://github.com/CiscoUcs/UcsPythonSDK/blob/bf6b07d6abeacb922c92b198352eda4eb9e4629b/src/UcsSdk/UcsHandle_Edit.py#L1377-L1562 | train | This method returns the technical support data for the UCS. |
CiscoUcs/UcsPythonSDK | src/UcsSdk/UcsHandle_Edit.py | UcsHandle.SyncManagedObject | def SyncManagedObject(self, difference, deleteNotPresent=False, noVersionFilter=False, dumpXml=None):
"""
Syncs Managed Object.
Method takes the difference object (output of CompareManagedObject) and applies the differences on reference Managed Object.
- difference specifies the Difference object (output of ... | python | def SyncManagedObject(self, difference, deleteNotPresent=False, noVersionFilter=False, dumpXml=None):
"""
Syncs Managed Object.
Method takes the difference object (output of CompareManagedObject) and applies the differences on reference Managed Object.
- difference specifies the Difference object (output of ... | [
"def",
"SyncManagedObject",
"(",
"self",
",",
"difference",
",",
"deleteNotPresent",
"=",
"False",
",",
"noVersionFilter",
"=",
"False",
",",
"dumpXml",
"=",
"None",
")",
":",
"from",
"UcsBase",
"import",
"WriteUcsWarning",
",",
"WriteObject",
",",
"UcsUtils",
... | Syncs Managed Object.
Method takes the difference object (output of CompareManagedObject) and applies the differences on reference Managed Object.
- difference specifies the Difference object (output of ComparesManagedObject) which has differences of the properties of two or more Managed Objects.
- deleteNotPr... | [
"Syncs",
"Managed",
"Object",
".",
"Method",
"takes",
"the",
"difference",
"object",
"(",
"output",
"of",
"CompareManagedObject",
")",
"and",
"applies",
"the",
"differences",
"on",
"reference",
"Managed",
"Object",
".",
"-",
"difference",
"specifies",
"the",
"Di... | bf6b07d6abeacb922c92b198352eda4eb9e4629b | https://github.com/CiscoUcs/UcsPythonSDK/blob/bf6b07d6abeacb922c92b198352eda4eb9e4629b/src/UcsSdk/UcsHandle_Edit.py#L1564-L1807 | train | Syncs Managed Object. |
CiscoUcs/UcsPythonSDK | src/UcsSdk/UcsHandle_Edit.py | UcsHandle.GetUcsChild | def GetUcsChild(self, inMo=None, inDn=None, classId=None, inHierarchical=False, dumpXml=None):
"""
Gets Child Managed Object from UCS.
- in_mo, if provided, it acts as a parent for the present operation. (required if in_dn is None).
- in_dn, parent mo dn (required if in_mo is None)
- class_id of the managed ... | python | def GetUcsChild(self, inMo=None, inDn=None, classId=None, inHierarchical=False, dumpXml=None):
"""
Gets Child Managed Object from UCS.
- in_mo, if provided, it acts as a parent for the present operation. (required if in_dn is None).
- in_dn, parent mo dn (required if in_mo is None)
- class_id of the managed ... | [
"def",
"GetUcsChild",
"(",
"self",
",",
"inMo",
"=",
"None",
",",
"inDn",
"=",
"None",
",",
"classId",
"=",
"None",
",",
"inHierarchical",
"=",
"False",
",",
"dumpXml",
"=",
"None",
")",
":",
"from",
"UcsBase",
"import",
"UcsValidationException",
",",
"U... | Gets Child Managed Object from UCS.
- in_mo, if provided, it acts as a parent for the present operation. (required if in_dn is None).
- in_dn, parent mo dn (required if in_mo is None)
- class_id of the managed object/s to get.(optional)
- in_hierarchical, Explores hierarchy if true, else returns managed object... | [
"Gets",
"Child",
"Managed",
"Object",
"from",
"UCS",
"."
] | bf6b07d6abeacb922c92b198352eda4eb9e4629b | https://github.com/CiscoUcs/UcsPythonSDK/blob/bf6b07d6abeacb922c92b198352eda4eb9e4629b/src/UcsSdk/UcsHandle_Edit.py#L1810-L1835 | train | Get UCS Child Managed Object from UCS. |
CiscoUcs/UcsPythonSDK | src/UcsSdk/UcsHandle_Edit.py | UcsHandle.GetManagedObject | def GetManagedObject(self, inMo=None, classId=None, params=None, inHierarchical=False, dumpXml=None):
"""
Gets Managed Object from UCS.
- inMo, if provided, it acts as a parent for the present operation. It should be None unless a user wants to define a parent scope.
It can be a single MO or a list contai... | python | def GetManagedObject(self, inMo=None, classId=None, params=None, inHierarchical=False, dumpXml=None):
"""
Gets Managed Object from UCS.
- inMo, if provided, it acts as a parent for the present operation. It should be None unless a user wants to define a parent scope.
It can be a single MO or a list contai... | [
"def",
"GetManagedObject",
"(",
"self",
",",
"inMo",
"=",
"None",
",",
"classId",
"=",
"None",
",",
"params",
"=",
"None",
",",
"inHierarchical",
"=",
"False",
",",
"dumpXml",
"=",
"None",
")",
":",
"from",
"Ucs",
"import",
"ClassFactory",
",",
"Dn",
"... | Gets Managed Object from UCS.
- inMo, if provided, it acts as a parent for the present operation. It should be None unless a user wants to define a parent scope.
It can be a single MO or a list containing multiple managed objects.
- classId of the managed object/s to get.
- params contains semicolon (;) s... | [
"Gets",
"Managed",
"Object",
"from",
"UCS",
".",
"-",
"inMo",
"if",
"provided",
"it",
"acts",
"as",
"a",
"parent",
"for",
"the",
"present",
"operation",
".",
"It",
"should",
"be",
"None",
"unless",
"a",
"user",
"wants",
"to",
"define",
"a",
"parent",
"... | bf6b07d6abeacb922c92b198352eda4eb9e4629b | https://github.com/CiscoUcs/UcsPythonSDK/blob/bf6b07d6abeacb922c92b198352eda4eb9e4629b/src/UcsSdk/UcsHandle_Edit.py#L1837-L2011 | train | This method returns a managed object from UCS. |
CiscoUcs/UcsPythonSDK | src/UcsSdk/UcsHandle_Edit.py | UcsHandle.AddManagedObject | def AddManagedObject(self, inMo=None, classId=None, params=None, modifyPresent=False, dumpXml=None):
"""
Adds a Managed Object to UCS.
- inMo, if provided, it acts as a parent for the present operation. It should be None unless a user wants to define a parent scope.
It can be a single MO or a list contain... | python | def AddManagedObject(self, inMo=None, classId=None, params=None, modifyPresent=False, dumpXml=None):
"""
Adds a Managed Object to UCS.
- inMo, if provided, it acts as a parent for the present operation. It should be None unless a user wants to define a parent scope.
It can be a single MO or a list contain... | [
"def",
"AddManagedObject",
"(",
"self",
",",
"inMo",
"=",
"None",
",",
"classId",
"=",
"None",
",",
"params",
"=",
"None",
",",
"modifyPresent",
"=",
"False",
",",
"dumpXml",
"=",
"None",
")",
":",
"from",
"UcsBase",
"import",
"UcsUtils",
",",
"ManagedOb... | Adds a Managed Object to UCS.
- inMo, if provided, it acts as a parent for the present operation. It should be None unless a user wants to define a parent scope.
It can be a single MO or a list containing multiple managed objects.
- classId of the managed object/s to be added.
- params contains semicolon ... | [
"Adds",
"a",
"Managed",
"Object",
"to",
"UCS",
".",
"-",
"inMo",
"if",
"provided",
"it",
"acts",
"as",
"a",
"parent",
"for",
"the",
"present",
"operation",
".",
"It",
"should",
"be",
"None",
"unless",
"a",
"user",
"wants",
"to",
"define",
"a",
"parent"... | bf6b07d6abeacb922c92b198352eda4eb9e4629b | https://github.com/CiscoUcs/UcsPythonSDK/blob/bf6b07d6abeacb922c92b198352eda4eb9e4629b/src/UcsSdk/UcsHandle_Edit.py#L2014-L2154 | train | Adds a managed object to the UCS. |
CiscoUcs/UcsPythonSDK | src/UcsSdk/UcsHandle_Edit.py | UcsHandle.RemoveManagedObject | def RemoveManagedObject(self, inMo=None, classId=None, params=None, dumpXml=None):
"""
Removes Managed Object in UCS.
- inMo, if provided, it acts as the target object for the present operation. It should be None unless a user wants to provide an
inMo. It can be a single MO or a list containing multiple m... | python | def RemoveManagedObject(self, inMo=None, classId=None, params=None, dumpXml=None):
"""
Removes Managed Object in UCS.
- inMo, if provided, it acts as the target object for the present operation. It should be None unless a user wants to provide an
inMo. It can be a single MO or a list containing multiple m... | [
"def",
"RemoveManagedObject",
"(",
"self",
",",
"inMo",
"=",
"None",
",",
"classId",
"=",
"None",
",",
"params",
"=",
"None",
",",
"dumpXml",
"=",
"None",
")",
":",
"from",
"UcsBase",
"import",
"UcsUtils",
",",
"ManagedObject",
",",
"WriteUcsWarning",
",",... | Removes Managed Object in UCS.
- inMo, if provided, it acts as the target object for the present operation. It should be None unless a user wants to provide an
inMo. It can be a single MO or a list containing multiple managed objects.
- classId of the managed object/s to be removed.
- params contains semi... | [
"Removes",
"Managed",
"Object",
"in",
"UCS",
".",
"-",
"inMo",
"if",
"provided",
"it",
"acts",
"as",
"the",
"target",
"object",
"for",
"the",
"present",
"operation",
".",
"It",
"should",
"be",
"None",
"unless",
"a",
"user",
"wants",
"to",
"provide",
"an"... | bf6b07d6abeacb922c92b198352eda4eb9e4629b | https://github.com/CiscoUcs/UcsPythonSDK/blob/bf6b07d6abeacb922c92b198352eda4eb9e4629b/src/UcsSdk/UcsHandle_Edit.py#L2284-L2347 | train | This method removes Managed Object from UCS. |
wroberts/fsed | fsed/utils.py | open_file | def open_file(filename, mode='rb'):
"""
Opens a file for access with the given mode. This function
transparently wraps gzip and xz files as well as normal files.
You can also open zip files using syntax like:
f = utils.open_file('../semcor-parsed.zip:semcor000.txt')
"""
if (('r' not in mod... | python | def open_file(filename, mode='rb'):
"""
Opens a file for access with the given mode. This function
transparently wraps gzip and xz files as well as normal files.
You can also open zip files using syntax like:
f = utils.open_file('../semcor-parsed.zip:semcor000.txt')
"""
if (('r' not in mod... | [
"def",
"open_file",
"(",
"filename",
",",
"mode",
"=",
"'rb'",
")",
":",
"if",
"(",
"(",
"'r'",
"not",
"in",
"mode",
"or",
"hasattr",
"(",
"filename",
",",
"'read'",
")",
")",
"and",
"(",
"(",
"'a'",
"not",
"in",
"mode",
"and",
"'w'",
"not",
"in"... | Opens a file for access with the given mode. This function
transparently wraps gzip and xz files as well as normal files.
You can also open zip files using syntax like:
f = utils.open_file('../semcor-parsed.zip:semcor000.txt') | [
"Opens",
"a",
"file",
"for",
"access",
"with",
"the",
"given",
"mode",
".",
"This",
"function",
"transparently",
"wraps",
"gzip",
"and",
"xz",
"files",
"as",
"well",
"as",
"normal",
"files",
".",
"You",
"can",
"also",
"open",
"zip",
"files",
"using",
"sy... | c0c1c5e0ea3a413ef679fdf71635f7f2e5d79ca2 | https://github.com/wroberts/fsed/blob/c0c1c5e0ea3a413ef679fdf71635f7f2e5d79ca2/fsed/utils.py#L15-L55 | train | Open a file for access with the given mode. |
tehmaze/natural | natural/text.py | code | def code(sentence, pad=' ', format='army'):
'''
Transform a sentence using the code spelling alphabet, multiple
international code alphabets are supported.
====== ====================================================================
format description
====== ====================================... | python | def code(sentence, pad=' ', format='army'):
'''
Transform a sentence using the code spelling alphabet, multiple
international code alphabets are supported.
====== ====================================================================
format description
====== ====================================... | [
"def",
"code",
"(",
"sentence",
",",
"pad",
"=",
"' '",
",",
"format",
"=",
"'army'",
")",
":",
"try",
":",
"return",
"ALPHABET",
"[",
"'code'",
"]",
"[",
"format",
"]",
"(",
"sentence",
",",
"pad",
"or",
"CODE_PADDING",
"[",
"format",
"]",
")",
"... | Transform a sentence using the code spelling alphabet, multiple
international code alphabets are supported.
====== ====================================================================
format description
====== ====================================================================
army US (internati... | [
"Transform",
"a",
"sentence",
"using",
"the",
"code",
"spelling",
"alphabet",
"multiple",
"international",
"code",
"alphabets",
"are",
"supported",
"."
] | d7a1fc9de712f9bcf68884a80826a7977df356fb | https://github.com/tehmaze/natural/blob/d7a1fc9de712f9bcf68884a80826a7977df356fb/natural/text.py#L73-L121 | train | Transform a sentence using the code spelling alphabet multiple
international code alphabets are supported. |
tehmaze/natural | natural/text.py | nato | def nato(sentence, pad=' ', format='telephony'):
'''
Transform a sentence using the NATO spelling alphabet.
:param sentence: input sentence
:param pad: default ``' '``
:param format: default ``telephony``, options ``telephony`` or ``phonetic``
>>> print(nato('Python'))
papa yankee tango ho... | python | def nato(sentence, pad=' ', format='telephony'):
'''
Transform a sentence using the NATO spelling alphabet.
:param sentence: input sentence
:param pad: default ``' '``
:param format: default ``telephony``, options ``telephony`` or ``phonetic``
>>> print(nato('Python'))
papa yankee tango ho... | [
"def",
"nato",
"(",
"sentence",
",",
"pad",
"=",
"' '",
",",
"format",
"=",
"'telephony'",
")",
":",
"try",
":",
"return",
"''",
"+",
"ALPHABET",
"[",
"'nato'",
"]",
"[",
"format",
"]",
"(",
"sentence",
",",
"pad",
")",
"except",
"KeyError",
":",
"... | Transform a sentence using the NATO spelling alphabet.
:param sentence: input sentence
:param pad: default ``' '``
:param format: default ``telephony``, options ``telephony`` or ``phonetic``
>>> print(nato('Python'))
papa yankee tango hotel oscar november
>>> print(nato('Python', format='phon... | [
"Transform",
"a",
"sentence",
"using",
"the",
"NATO",
"spelling",
"alphabet",
"."
] | d7a1fc9de712f9bcf68884a80826a7977df356fb | https://github.com/tehmaze/natural/blob/d7a1fc9de712f9bcf68884a80826a7977df356fb/natural/text.py#L135-L153 | train | Transform a sentence using the NATO spelling alphabet. |
rmst/chi | chi/rl/async_dqn.py | deep_q_network | def deep_q_network():
""" Architecture according to:
http://www.nature.com/nature/journal/v518/n7540/full/nature14236.html
"""
@tt.model(tracker=tf.train.ExponentialMovingAverage(1 - .0005), # TODO: replace with original weight freeze
optimizer=tf.train.RMSPropOptimizer(.0002... | python | def deep_q_network():
""" Architecture according to:
http://www.nature.com/nature/journal/v518/n7540/full/nature14236.html
"""
@tt.model(tracker=tf.train.ExponentialMovingAverage(1 - .0005), # TODO: replace with original weight freeze
optimizer=tf.train.RMSPropOptimizer(.0002... | [
"def",
"deep_q_network",
"(",
")",
":",
"@",
"tt",
".",
"model",
"(",
"tracker",
"=",
"tf",
".",
"train",
".",
"ExponentialMovingAverage",
"(",
"1",
"-",
".0005",
")",
",",
"# TODO: replace with original weight freeze",
"optimizer",
"=",
"tf",
".",
"train",
... | Architecture according to:
http://www.nature.com/nature/journal/v518/n7540/full/nature14236.html | [
"Architecture",
"according",
"to",
":",
"http",
":",
"//",
"www",
".",
"nature",
".",
"com",
"/",
"nature",
"/",
"journal",
"/",
"v518",
"/",
"n7540",
"/",
"full",
"/",
"nature14236",
".",
"html"
] | b9205127f3736eb6ebbf6bb2960c4bbb747142b7 | https://github.com/rmst/chi/blob/b9205127f3736eb6ebbf6bb2960c4bbb747142b7/chi/rl/async_dqn.py#L198-L215 | train | Architecture according to deep_q_network http://www. ngram. com / n7540. html |
rmst/chi | chi/rl/async_dqn.py | delling_network | def delling_network():
""" Architecture according to Duelling DQN:
https://arxiv.org/abs/1511.06581
"""
@tt.model(tracker=tf.train.ExponentialMovingAverage(1 - .0005), # TODO: replace with original weight freeze
optimizer=tf.train.RMSPropOptimizer(6.25e-5, .95, .95, .01))
... | python | def delling_network():
""" Architecture according to Duelling DQN:
https://arxiv.org/abs/1511.06581
"""
@tt.model(tracker=tf.train.ExponentialMovingAverage(1 - .0005), # TODO: replace with original weight freeze
optimizer=tf.train.RMSPropOptimizer(6.25e-5, .95, .95, .01))
... | [
"def",
"delling_network",
"(",
")",
":",
"@",
"tt",
".",
"model",
"(",
"tracker",
"=",
"tf",
".",
"train",
".",
"ExponentialMovingAverage",
"(",
"1",
"-",
".0005",
")",
",",
"# TODO: replace with original weight freeze",
"optimizer",
"=",
"tf",
".",
"train",
... | Architecture according to Duelling DQN:
https://arxiv.org/abs/1511.06581 | [
"Architecture",
"according",
"to",
"Duelling",
"DQN",
":",
"https",
":",
"//",
"arxiv",
".",
"org",
"/",
"abs",
"/",
"1511",
".",
"06581"
] | b9205127f3736eb6ebbf6bb2960c4bbb747142b7 | https://github.com/rmst/chi/blob/b9205127f3736eb6ebbf6bb2960c4bbb747142b7/chi/rl/async_dqn.py#L218-L241 | train | Architecture according to Duelling DQN |
trendels/braceexpand | braceexpand.py | braceexpand | def braceexpand(pattern, escape=True):
"""braceexpand(pattern) -> iterator over generated strings
Returns an iterator over the strings resulting from brace expansion
of pattern. This function implements Brace Expansion as described in
bash(1), with the following limitations:
* A pattern containing... | python | def braceexpand(pattern, escape=True):
"""braceexpand(pattern) -> iterator over generated strings
Returns an iterator over the strings resulting from brace expansion
of pattern. This function implements Brace Expansion as described in
bash(1), with the following limitations:
* A pattern containing... | [
"def",
"braceexpand",
"(",
"pattern",
",",
"escape",
"=",
"True",
")",
":",
"return",
"(",
"_flatten",
"(",
"t",
",",
"escape",
")",
"for",
"t",
"in",
"parse_pattern",
"(",
"pattern",
",",
"escape",
")",
")"
] | braceexpand(pattern) -> iterator over generated strings
Returns an iterator over the strings resulting from brace expansion
of pattern. This function implements Brace Expansion as described in
bash(1), with the following limitations:
* A pattern containing unbalanced braces will raise an
Unbalan... | [
"braceexpand",
"(",
"pattern",
")",
"-",
">",
"iterator",
"over",
"generated",
"strings"
] | c17aa2f2b0d9f016a8115163d94acc9a147d54c2 | https://github.com/trendels/braceexpand/blob/c17aa2f2b0d9f016a8115163d94acc9a147d54c2/braceexpand.py#L23-L93 | train | This function expands a pattern into a sequence of strings and returns an iterator over the generated strings. |
yeraydiazdiaz/lunr.py | lunr/query.py | Query.clause | def clause(self, *args, **kwargs):
"""Adds a `lunr.Clause` to this query.
Unless the clause contains the fields to be matched all fields will be
matched. In addition a default boost of 1 is applied to the clause.
If the first argument is a `lunr.Clause` it will be mutated and added,
... | python | def clause(self, *args, **kwargs):
"""Adds a `lunr.Clause` to this query.
Unless the clause contains the fields to be matched all fields will be
matched. In addition a default boost of 1 is applied to the clause.
If the first argument is a `lunr.Clause` it will be mutated and added,
... | [
"def",
"clause",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"args",
"and",
"isinstance",
"(",
"args",
"[",
"0",
"]",
",",
"Clause",
")",
":",
"clause",
"=",
"args",
"[",
"0",
"]",
"else",
":",
"clause",
"=",
"Clause... | Adds a `lunr.Clause` to this query.
Unless the clause contains the fields to be matched all fields will be
matched. In addition a default boost of 1 is applied to the clause.
If the first argument is a `lunr.Clause` it will be mutated and added,
otherwise args and kwargs will be used i... | [
"Adds",
"a",
"lunr",
".",
"Clause",
"to",
"this",
"query",
"."
] | 28ec3f6d4888295eed730211ee9617aa488d6ba3 | https://github.com/yeraydiazdiaz/lunr.py/blob/28ec3f6d4888295eed730211ee9617aa488d6ba3/lunr/query.py#L43-L74 | train | Adds a Clause to this query. |
yeraydiazdiaz/lunr.py | lunr/query.py | Query.term | def term(self, term, **kwargs):
"""Adds a term to the current query, creating a Clause and adds it to
the list of clauses making up this Query.
The term is not tokenized and used "as is". Any conversion to token
or token-like strings should be performed before calling this method.
... | python | def term(self, term, **kwargs):
"""Adds a term to the current query, creating a Clause and adds it to
the list of clauses making up this Query.
The term is not tokenized and used "as is". Any conversion to token
or token-like strings should be performed before calling this method.
... | [
"def",
"term",
"(",
"self",
",",
"term",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"isinstance",
"(",
"term",
",",
"(",
"list",
",",
"tuple",
")",
")",
":",
"for",
"t",
"in",
"term",
":",
"self",
".",
"term",
"(",
"t",
",",
"*",
"*",
"kwargs",... | Adds a term to the current query, creating a Clause and adds it to
the list of clauses making up this Query.
The term is not tokenized and used "as is". Any conversion to token
or token-like strings should be performed before calling this method.
For example:
query.term(lun... | [
"Adds",
"a",
"term",
"to",
"the",
"current",
"query",
"creating",
"a",
"Clause",
"and",
"adds",
"it",
"to",
"the",
"list",
"of",
"clauses",
"making",
"up",
"this",
"Query",
"."
] | 28ec3f6d4888295eed730211ee9617aa488d6ba3 | https://github.com/yeraydiazdiaz/lunr.py/blob/28ec3f6d4888295eed730211ee9617aa488d6ba3/lunr/query.py#L76-L96 | train | Adds a term to the current query creating a Clause and adds it to the list of clauses making up this Query. |
yeraydiazdiaz/lunr.py | lunr/query.py | Query.is_negated | def is_negated(self):
"""A negated query is one in which every clause has a presence of
prohibited. These queries require some special processing to return
the expected results.
"""
return all(
clause.presence == QueryPresence.PROHIBITED for clause in self.clauses
... | python | def is_negated(self):
"""A negated query is one in which every clause has a presence of
prohibited. These queries require some special processing to return
the expected results.
"""
return all(
clause.presence == QueryPresence.PROHIBITED for clause in self.clauses
... | [
"def",
"is_negated",
"(",
"self",
")",
":",
"return",
"all",
"(",
"clause",
".",
"presence",
"==",
"QueryPresence",
".",
"PROHIBITED",
"for",
"clause",
"in",
"self",
".",
"clauses",
")"
] | A negated query is one in which every clause has a presence of
prohibited. These queries require some special processing to return
the expected results. | [
"A",
"negated",
"query",
"is",
"one",
"in",
"which",
"every",
"clause",
"has",
"a",
"presence",
"of",
"prohibited",
".",
"These",
"queries",
"require",
"some",
"special",
"processing",
"to",
"return",
"the",
"expected",
"results",
"."
] | 28ec3f6d4888295eed730211ee9617aa488d6ba3 | https://github.com/yeraydiazdiaz/lunr.py/blob/28ec3f6d4888295eed730211ee9617aa488d6ba3/lunr/query.py#L98-L105 | train | A negated query is one in which every clause has a presence of
prohibited. |
philippWassibauer/templated-emails | templated_emails/utils.py | send_templated_email | def send_templated_email(recipients, template_path, context=None,
from_email=settings.DEFAULT_FROM_EMAIL,
fail_silently=False, extra_headers=None):
"""
recipients can be either a list of emails or a list of users,
if it is users the system will change to the l... | python | def send_templated_email(recipients, template_path, context=None,
from_email=settings.DEFAULT_FROM_EMAIL,
fail_silently=False, extra_headers=None):
"""
recipients can be either a list of emails or a list of users,
if it is users the system will change to the l... | [
"def",
"send_templated_email",
"(",
"recipients",
",",
"template_path",
",",
"context",
"=",
"None",
",",
"from_email",
"=",
"settings",
".",
"DEFAULT_FROM_EMAIL",
",",
"fail_silently",
"=",
"False",
",",
"extra_headers",
"=",
"None",
")",
":",
"recipient_pks",
... | recipients can be either a list of emails or a list of users,
if it is users the system will change to the language that the
user has set as theyr mother toungue | [
"recipients",
"can",
"be",
"either",
"a",
"list",
"of",
"emails",
"or",
"a",
"list",
"of",
"users",
"if",
"it",
"is",
"users",
"the",
"system",
"will",
"change",
"to",
"the",
"language",
"that",
"the",
"user",
"has",
"set",
"as",
"theyr",
"mother",
"to... | 9f011ba84b67f2e0f088dae2b0b072c377c6d183 | https://github.com/philippWassibauer/templated-emails/blob/9f011ba84b67f2e0f088dae2b0b072c377c6d183/templated_emails/utils.py#L47-L61 | train | Send a templated email to the specified recipients. |
wroberts/fsed | fsed/ahocorasick.py | boundary_transform | def boundary_transform(seq, force_edges = True):
'''
Wraps all word transitions with a boundary token character (\x00).
If desired (with ``force_edges`` set to ``True``), this inserts
the boundary character at the beginning and end of the string.
Arguments:
- `seq`:
- `force_edges = True`:
... | python | def boundary_transform(seq, force_edges = True):
'''
Wraps all word transitions with a boundary token character (\x00).
If desired (with ``force_edges`` set to ``True``), this inserts
the boundary character at the beginning and end of the string.
Arguments:
- `seq`:
- `force_edges = True`:
... | [
"def",
"boundary_transform",
"(",
"seq",
",",
"force_edges",
"=",
"True",
")",
":",
"gen",
"=",
"boundary_words",
"(",
"seq",
")",
"if",
"force_edges",
":",
"gen",
"=",
"boundary_edges",
"(",
"gen",
")",
"gen",
"=",
"remove_duplicates",
"(",
"gen",
")",
... | Wraps all word transitions with a boundary token character (\x00).
If desired (with ``force_edges`` set to ``True``), this inserts
the boundary character at the beginning and end of the string.
Arguments:
- `seq`:
- `force_edges = True`: | [
"Wraps",
"all",
"word",
"transitions",
"with",
"a",
"boundary",
"token",
"character",
"(",
"\\",
"x00",
")",
".",
"If",
"desired",
"(",
"with",
"force_edges",
"set",
"to",
"True",
")",
"this",
"inserts",
"the",
"boundary",
"character",
"at",
"the",
"beginn... | c0c1c5e0ea3a413ef679fdf71635f7f2e5d79ca2 | https://github.com/wroberts/fsed/blob/c0c1c5e0ea3a413ef679fdf71635f7f2e5d79ca2/fsed/ahocorasick.py#L404-L419 | train | Returns a generator that yields all word transitions with a boundary token character. |
wroberts/fsed | fsed/ahocorasick.py | boundary_words | def boundary_words(seq):
'''
Wraps all word transitions with a boundary token character (\x00).
Arguments:
- `seq`:
'''
in_word = None
for char in seq:
if char == '\x00' and in_word is not None:
in_word = not in_word
elif char in WHITESPACE_CHARS:
if ... | python | def boundary_words(seq):
'''
Wraps all word transitions with a boundary token character (\x00).
Arguments:
- `seq`:
'''
in_word = None
for char in seq:
if char == '\x00' and in_word is not None:
in_word = not in_word
elif char in WHITESPACE_CHARS:
if ... | [
"def",
"boundary_words",
"(",
"seq",
")",
":",
"in_word",
"=",
"None",
"for",
"char",
"in",
"seq",
":",
"if",
"char",
"==",
"'\\x00'",
"and",
"in_word",
"is",
"not",
"None",
":",
"in_word",
"=",
"not",
"in_word",
"elif",
"char",
"in",
"WHITESPACE_CHARS",... | Wraps all word transitions with a boundary token character (\x00).
Arguments:
- `seq`: | [
"Wraps",
"all",
"word",
"transitions",
"with",
"a",
"boundary",
"token",
"character",
"(",
"\\",
"x00",
")",
"."
] | c0c1c5e0ea3a413ef679fdf71635f7f2e5d79ca2 | https://github.com/wroberts/fsed/blob/c0c1c5e0ea3a413ef679fdf71635f7f2e5d79ca2/fsed/ahocorasick.py#L421-L440 | train | Yields all word transitions with a boundary token character. |
wroberts/fsed | fsed/ahocorasick.py | remove_duplicates | def remove_duplicates(seq):
'''
Removes duplicate boundary token characters from the given
character iterable.
Arguments:
- `seq`:
'''
last_boundary = False
for char in seq:
if char == '\x00':
if not last_boundary:
last_boundary = True
... | python | def remove_duplicates(seq):
'''
Removes duplicate boundary token characters from the given
character iterable.
Arguments:
- `seq`:
'''
last_boundary = False
for char in seq:
if char == '\x00':
if not last_boundary:
last_boundary = True
... | [
"def",
"remove_duplicates",
"(",
"seq",
")",
":",
"last_boundary",
"=",
"False",
"for",
"char",
"in",
"seq",
":",
"if",
"char",
"==",
"'\\x00'",
":",
"if",
"not",
"last_boundary",
":",
"last_boundary",
"=",
"True",
"yield",
"char",
"else",
":",
"last_bound... | Removes duplicate boundary token characters from the given
character iterable.
Arguments:
- `seq`: | [
"Removes",
"duplicate",
"boundary",
"token",
"characters",
"from",
"the",
"given",
"character",
"iterable",
"."
] | c0c1c5e0ea3a413ef679fdf71635f7f2e5d79ca2 | https://github.com/wroberts/fsed/blob/c0c1c5e0ea3a413ef679fdf71635f7f2e5d79ca2/fsed/ahocorasick.py#L455-L471 | train | Removes duplicate boundary token characters from the given iterable. |
wroberts/fsed | fsed/ahocorasick.py | Trie.dfs | def dfs(self):
'''
Depth-first search generator. Yields `(node, parent)` for every
node in the tree, beginning with `(self.root, None)`.
'''
yield (self.root, None)
todo = [(self.root[char], self.root) for char in self.root]
while todo:
current, paren... | python | def dfs(self):
'''
Depth-first search generator. Yields `(node, parent)` for every
node in the tree, beginning with `(self.root, None)`.
'''
yield (self.root, None)
todo = [(self.root[char], self.root) for char in self.root]
while todo:
current, paren... | [
"def",
"dfs",
"(",
"self",
")",
":",
"yield",
"(",
"self",
".",
"root",
",",
"None",
")",
"todo",
"=",
"[",
"(",
"self",
".",
"root",
"[",
"char",
"]",
",",
"self",
".",
"root",
")",
"for",
"char",
"in",
"self",
".",
"root",
"]",
"while",
"to... | Depth-first search generator. Yields `(node, parent)` for every
node in the tree, beginning with `(self.root, None)`. | [
"Depth",
"-",
"first",
"search",
"generator",
".",
"Yields",
"(",
"node",
"parent",
")",
"for",
"every",
"node",
"in",
"the",
"tree",
"beginning",
"with",
"(",
"self",
".",
"root",
"None",
")",
"."
] | c0c1c5e0ea3a413ef679fdf71635f7f2e5d79ca2 | https://github.com/wroberts/fsed/blob/c0c1c5e0ea3a413ef679fdf71635f7f2e5d79ca2/fsed/ahocorasick.py#L121-L132 | train | Depth - first search generator. |
wroberts/fsed | fsed/ahocorasick.py | Trie.bfs | def bfs(self):
'''
Breadth-first search generator. Yields `(node, parent)` for every
node in the tree, beginning with `(self.root, None)`.
'''
yield (self.root, None)
todo = deque([(self.root[char], self.root) for char in self.root])
while todo:
curre... | python | def bfs(self):
'''
Breadth-first search generator. Yields `(node, parent)` for every
node in the tree, beginning with `(self.root, None)`.
'''
yield (self.root, None)
todo = deque([(self.root[char], self.root) for char in self.root])
while todo:
curre... | [
"def",
"bfs",
"(",
"self",
")",
":",
"yield",
"(",
"self",
".",
"root",
",",
"None",
")",
"todo",
"=",
"deque",
"(",
"[",
"(",
"self",
".",
"root",
"[",
"char",
"]",
",",
"self",
".",
"root",
")",
"for",
"char",
"in",
"self",
".",
"root",
"]"... | Breadth-first search generator. Yields `(node, parent)` for every
node in the tree, beginning with `(self.root, None)`. | [
"Breadth",
"-",
"first",
"search",
"generator",
".",
"Yields",
"(",
"node",
"parent",
")",
"for",
"every",
"node",
"in",
"the",
"tree",
"beginning",
"with",
"(",
"self",
".",
"root",
"None",
")",
"."
] | c0c1c5e0ea3a413ef679fdf71635f7f2e5d79ca2 | https://github.com/wroberts/fsed/blob/c0c1c5e0ea3a413ef679fdf71635f7f2e5d79ca2/fsed/ahocorasick.py#L134-L145 | train | Breadth - first search generator. |
wroberts/fsed | fsed/ahocorasick.py | Trie.pretty_print_str | def pretty_print_str(self):
'''
Create a string to pretty-print this trie to standard output.
'''
retval = ''
# dfs
todo = [self.root]
while todo:
current = todo.pop()
for char in reversed(sorted(current.keys())):
todo.appen... | python | def pretty_print_str(self):
'''
Create a string to pretty-print this trie to standard output.
'''
retval = ''
# dfs
todo = [self.root]
while todo:
current = todo.pop()
for char in reversed(sorted(current.keys())):
todo.appen... | [
"def",
"pretty_print_str",
"(",
"self",
")",
":",
"retval",
"=",
"''",
"# dfs",
"todo",
"=",
"[",
"self",
".",
"root",
"]",
"while",
"todo",
":",
"current",
"=",
"todo",
".",
"pop",
"(",
")",
"for",
"char",
"in",
"reversed",
"(",
"sorted",
"(",
"cu... | Create a string to pretty-print this trie to standard output. | [
"Create",
"a",
"string",
"to",
"pretty",
"-",
"print",
"this",
"trie",
"to",
"standard",
"output",
"."
] | c0c1c5e0ea3a413ef679fdf71635f7f2e5d79ca2 | https://github.com/wroberts/fsed/blob/c0c1c5e0ea3a413ef679fdf71635f7f2e5d79ca2/fsed/ahocorasick.py#L147-L160 | train | Create a string to pretty - print this trie to standard output. |
wroberts/fsed | fsed/ahocorasick.py | AhoCorasickTrie._reset_suffix_links | def _reset_suffix_links(self):
'''
Reset all suffix links in all nodes in this trie.
'''
self._suffix_links_set = False
for current, _parent in self.dfs():
current.suffix = None
current.dict_suffix = None
current.longest_prefix = None | python | def _reset_suffix_links(self):
'''
Reset all suffix links in all nodes in this trie.
'''
self._suffix_links_set = False
for current, _parent in self.dfs():
current.suffix = None
current.dict_suffix = None
current.longest_prefix = None | [
"def",
"_reset_suffix_links",
"(",
"self",
")",
":",
"self",
".",
"_suffix_links_set",
"=",
"False",
"for",
"current",
",",
"_parent",
"in",
"self",
".",
"dfs",
"(",
")",
":",
"current",
".",
"suffix",
"=",
"None",
"current",
".",
"dict_suffix",
"=",
"No... | Reset all suffix links in all nodes in this trie. | [
"Reset",
"all",
"suffix",
"links",
"in",
"all",
"nodes",
"in",
"this",
"trie",
"."
] | c0c1c5e0ea3a413ef679fdf71635f7f2e5d79ca2 | https://github.com/wroberts/fsed/blob/c0c1c5e0ea3a413ef679fdf71635f7f2e5d79ca2/fsed/ahocorasick.py#L185-L193 | train | Reset all suffix links in all nodes in this trie. |
wroberts/fsed | fsed/ahocorasick.py | AhoCorasickTrie._set_suffix_links | def _set_suffix_links(self):
'''
Sets all suffix links in all nodes in this trie.
'''
self._suffix_links_set = True
for current, parent in self.bfs():
# skip the root node
if parent is None:
continue
current.longest_prefix = par... | python | def _set_suffix_links(self):
'''
Sets all suffix links in all nodes in this trie.
'''
self._suffix_links_set = True
for current, parent in self.bfs():
# skip the root node
if parent is None:
continue
current.longest_prefix = par... | [
"def",
"_set_suffix_links",
"(",
"self",
")",
":",
"self",
".",
"_suffix_links_set",
"=",
"True",
"for",
"current",
",",
"parent",
"in",
"self",
".",
"bfs",
"(",
")",
":",
"# skip the root node",
"if",
"parent",
"is",
"None",
":",
"continue",
"current",
".... | Sets all suffix links in all nodes in this trie. | [
"Sets",
"all",
"suffix",
"links",
"in",
"all",
"nodes",
"in",
"this",
"trie",
"."
] | c0c1c5e0ea3a413ef679fdf71635f7f2e5d79ca2 | https://github.com/wroberts/fsed/blob/c0c1c5e0ea3a413ef679fdf71635f7f2e5d79ca2/fsed/ahocorasick.py#L195-L228 | train | Sets all suffix links in all nodes in this trie. |
wroberts/fsed | fsed/ahocorasick.py | AhoCorasickTrie.find_all | def find_all(self, seq):
'''
Generator expression. Yields tuples of `(begin, length, value)`,
where:
- `begin` is an integer identifying the character index where
the match begins (0-based)
- `length` is an integer indicating the length of the match (1
or mo... | python | def find_all(self, seq):
'''
Generator expression. Yields tuples of `(begin, length, value)`,
where:
- `begin` is an integer identifying the character index where
the match begins (0-based)
- `length` is an integer indicating the length of the match (1
or mo... | [
"def",
"find_all",
"(",
"self",
",",
"seq",
")",
":",
"if",
"not",
"self",
".",
"_suffix_links_set",
":",
"self",
".",
"_set_suffix_links",
"(",
")",
"current",
"=",
"self",
".",
"root",
"for",
"pos",
",",
"char",
"in",
"enumerate",
"(",
"seq",
")",
... | Generator expression. Yields tuples of `(begin, length, value)`,
where:
- `begin` is an integer identifying the character index where
the match begins (0-based)
- `length` is an integer indicating the length of the match (1
or more characters)
- `value` is the value... | [
"Generator",
"expression",
".",
"Yields",
"tuples",
"of",
"(",
"begin",
"length",
"value",
")",
"where",
":"
] | c0c1c5e0ea3a413ef679fdf71635f7f2e5d79ca2 | https://github.com/wroberts/fsed/blob/c0c1c5e0ea3a413ef679fdf71635f7f2e5d79ca2/fsed/ahocorasick.py#L230-L262 | train | Generator expression that finds all the node in the given sequence. |
wroberts/fsed | fsed/ahocorasick.py | AhoCorasickTrie.replace | def replace(self, seq):
'''
Performs search and replace on the given input string `seq` using
the values stored in this trie. This method uses a O(n**2)
chart-parsing algorithm to find the optimal way of replacing
matches in the input.
Arguments:
- `seq`:
... | python | def replace(self, seq):
'''
Performs search and replace on the given input string `seq` using
the values stored in this trie. This method uses a O(n**2)
chart-parsing algorithm to find the optimal way of replacing
matches in the input.
Arguments:
- `seq`:
... | [
"def",
"replace",
"(",
"self",
",",
"seq",
")",
":",
"# #1: seq must be stored in a container with a len() function",
"seq",
"=",
"list",
"(",
"seq",
")",
"# chart is a (n-1) X (n) table",
"# chart[0] represents all matches of length (0+1) = 1",
"# chart[n-1] represents all matches... | Performs search and replace on the given input string `seq` using
the values stored in this trie. This method uses a O(n**2)
chart-parsing algorithm to find the optimal way of replacing
matches in the input.
Arguments:
- `seq`: | [
"Performs",
"search",
"and",
"replace",
"on",
"the",
"given",
"input",
"string",
"seq",
"using",
"the",
"values",
"stored",
"in",
"this",
"trie",
".",
"This",
"method",
"uses",
"a",
"O",
"(",
"n",
"**",
"2",
")",
"chart",
"-",
"parsing",
"algorithm",
"... | c0c1c5e0ea3a413ef679fdf71635f7f2e5d79ca2 | https://github.com/wroberts/fsed/blob/c0c1c5e0ea3a413ef679fdf71635f7f2e5d79ca2/fsed/ahocorasick.py#L264-L338 | train | This method searches and replaces the given input string seq with the values stored in this trie. |
wroberts/fsed | fsed/ahocorasick.py | AhoCorasickTrie.greedy_replace | def greedy_replace(self, seq):
'''
Greedily matches strings in ``seq``, and replaces them with their
node values.
Arguments:
- `seq`: an iterable of characters to perform search-and-replace on
'''
if not self._suffix_links_set:
self._set_suffix_links(... | python | def greedy_replace(self, seq):
'''
Greedily matches strings in ``seq``, and replaces them with their
node values.
Arguments:
- `seq`: an iterable of characters to perform search-and-replace on
'''
if not self._suffix_links_set:
self._set_suffix_links(... | [
"def",
"greedy_replace",
"(",
"self",
",",
"seq",
")",
":",
"if",
"not",
"self",
".",
"_suffix_links_set",
":",
"self",
".",
"_set_suffix_links",
"(",
")",
"# start at the root",
"current",
"=",
"self",
".",
"root",
"buffered",
"=",
"''",
"outstr",
"=",
"'... | Greedily matches strings in ``seq``, and replaces them with their
node values.
Arguments:
- `seq`: an iterable of characters to perform search-and-replace on | [
"Greedily",
"matches",
"strings",
"in",
"seq",
"and",
"replaces",
"them",
"with",
"their",
"node",
"values",
"."
] | c0c1c5e0ea3a413ef679fdf71635f7f2e5d79ca2 | https://github.com/wroberts/fsed/blob/c0c1c5e0ea3a413ef679fdf71635f7f2e5d79ca2/fsed/ahocorasick.py#L340-L395 | train | Greedily matches strings in seq and replaces them with their respective node values. |
mapeveri/django-endless-pagination-vue | endless_pagination/utils.py | get_page_number_from_request | def get_page_number_from_request(
request, querystring_key=PAGE_LABEL, default=1):
"""Retrieve the current page number from *GET* or *POST* data.
If the page does not exists in *request*, or is not a number,
then *default* number is returned.
"""
try:
if request.method == 'POST':
... | python | def get_page_number_from_request(
request, querystring_key=PAGE_LABEL, default=1):
"""Retrieve the current page number from *GET* or *POST* data.
If the page does not exists in *request*, or is not a number,
then *default* number is returned.
"""
try:
if request.method == 'POST':
... | [
"def",
"get_page_number_from_request",
"(",
"request",
",",
"querystring_key",
"=",
"PAGE_LABEL",
",",
"default",
"=",
"1",
")",
":",
"try",
":",
"if",
"request",
".",
"method",
"==",
"'POST'",
":",
"page_number",
"=",
"request",
".",
"POST",
"[",
"querystri... | Retrieve the current page number from *GET* or *POST* data.
If the page does not exists in *request*, or is not a number,
then *default* number is returned. | [
"Retrieve",
"the",
"current",
"page",
"number",
"from",
"*",
"GET",
"*",
"or",
"*",
"POST",
"*",
"data",
"."
] | 3faa79a51b11d7ae0bd431abf8c38ecaf9180704 | https://github.com/mapeveri/django-endless-pagination-vue/blob/3faa79a51b11d7ae0bd431abf8c38ecaf9180704/endless_pagination/utils.py#L38-L53 | train | Retrieve the current page number from GET or POST data. |
CiscoUcs/UcsPythonSDK | src/UcsSdk/UcsBase.py | _write_mo | def _write_mo(mo):
""" Method to return string representation of a managed object. """
# from UcsBase import UcsUtils
classNotFound = False
if (UcsUtils.FindClassIdInMoMetaIgnoreCase(mo.classId) == None):
classNotFound = True
tabsize = 8
outstr = "\n"
if classNotFound:
outstr += "Managed Object\t\t\t:\t" + ... | python | def _write_mo(mo):
""" Method to return string representation of a managed object. """
# from UcsBase import UcsUtils
classNotFound = False
if (UcsUtils.FindClassIdInMoMetaIgnoreCase(mo.classId) == None):
classNotFound = True
tabsize = 8
outstr = "\n"
if classNotFound:
outstr += "Managed Object\t\t\t:\t" + ... | [
"def",
"_write_mo",
"(",
"mo",
")",
":",
"# from UcsBase import UcsUtils",
"classNotFound",
"=",
"False",
"if",
"(",
"UcsUtils",
".",
"FindClassIdInMoMetaIgnoreCase",
"(",
"mo",
".",
"classId",
")",
"==",
"None",
")",
":",
"classNotFound",
"=",
"True",
"tabsize"... | Method to return string representation of a managed object. | [
"Method",
"to",
"return",
"string",
"representation",
"of",
"a",
"managed",
"object",
"."
] | bf6b07d6abeacb922c92b198352eda4eb9e4629b | https://github.com/CiscoUcs/UcsPythonSDK/blob/bf6b07d6abeacb922c92b198352eda4eb9e4629b/src/UcsSdk/UcsBase.py#L932-L968 | train | Method to return string representation of a managed object. |
CiscoUcs/UcsPythonSDK | src/UcsSdk/UcsBase.py | WriteMoDiff | def WriteMoDiff(diffObj):
""" Writes the difference managedObject(output of CompareManagedObject) on the terminal. """
tabsize = 8
print str(diffObj.Dn).ljust(tabsize * 10), str(diffObj.InputObject.propMoMeta.name).ljust(tabsize * 4), str(
diffObj.SideIndicator).ljust(tabsize * 3), str(diffObj.DiffProperty) | python | def WriteMoDiff(diffObj):
""" Writes the difference managedObject(output of CompareManagedObject) on the terminal. """
tabsize = 8
print str(diffObj.Dn).ljust(tabsize * 10), str(diffObj.InputObject.propMoMeta.name).ljust(tabsize * 4), str(
diffObj.SideIndicator).ljust(tabsize * 3), str(diffObj.DiffProperty) | [
"def",
"WriteMoDiff",
"(",
"diffObj",
")",
":",
"tabsize",
"=",
"8",
"print",
"str",
"(",
"diffObj",
".",
"Dn",
")",
".",
"ljust",
"(",
"tabsize",
"*",
"10",
")",
",",
"str",
"(",
"diffObj",
".",
"InputObject",
".",
"propMoMeta",
".",
"name",
")",
... | Writes the difference managedObject(output of CompareManagedObject) on the terminal. | [
"Writes",
"the",
"difference",
"managedObject",
"(",
"output",
"of",
"CompareManagedObject",
")",
"on",
"the",
"terminal",
"."
] | bf6b07d6abeacb922c92b198352eda4eb9e4629b | https://github.com/CiscoUcs/UcsPythonSDK/blob/bf6b07d6abeacb922c92b198352eda4eb9e4629b/src/UcsSdk/UcsBase.py#L971-L975 | train | Writes the difference managedObject on the terminal. |
CiscoUcs/UcsPythonSDK | src/UcsSdk/UcsBase.py | WriteObject | def WriteObject(moList):
""" Writes the managed object on the terminal in form of key value pairs. """
from Ucs import Dn
from UcsHandle import UcsMoDiff
tabsize = 8
if (isinstance(moList, _GenericMO) == True):
print str(moList)
elif (isinstance(moList, ExternalMethod) == True):
if (hasattr(moList, "OutConfi... | python | def WriteObject(moList):
""" Writes the managed object on the terminal in form of key value pairs. """
from Ucs import Dn
from UcsHandle import UcsMoDiff
tabsize = 8
if (isinstance(moList, _GenericMO) == True):
print str(moList)
elif (isinstance(moList, ExternalMethod) == True):
if (hasattr(moList, "OutConfi... | [
"def",
"WriteObject",
"(",
"moList",
")",
":",
"from",
"Ucs",
"import",
"Dn",
"from",
"UcsHandle",
"import",
"UcsMoDiff",
"tabsize",
"=",
"8",
"if",
"(",
"isinstance",
"(",
"moList",
",",
"_GenericMO",
")",
"==",
"True",
")",
":",
"print",
"str",
"(",
... | Writes the managed object on the terminal in form of key value pairs. | [
"Writes",
"the",
"managed",
"object",
"on",
"the",
"terminal",
"in",
"form",
"of",
"key",
"value",
"pairs",
"."
] | bf6b07d6abeacb922c92b198352eda4eb9e4629b | https://github.com/CiscoUcs/UcsPythonSDK/blob/bf6b07d6abeacb922c92b198352eda4eb9e4629b/src/UcsSdk/UcsBase.py#L978-L1005 | train | Writes the managed object on the terminal in form of key value pairs. |
CiscoUcs/UcsPythonSDK | src/UcsSdk/UcsBase.py | UcsBase.childWriteXml | def childWriteXml(self, w, option):
"""Method writes the xml representation for the object."""
ch = []
for c in self.child:
ch.append(c.WriteXml(w, option))
return ch | python | def childWriteXml(self, w, option):
"""Method writes the xml representation for the object."""
ch = []
for c in self.child:
ch.append(c.WriteXml(w, option))
return ch | [
"def",
"childWriteXml",
"(",
"self",
",",
"w",
",",
"option",
")",
":",
"ch",
"=",
"[",
"]",
"for",
"c",
"in",
"self",
".",
"child",
":",
"ch",
".",
"append",
"(",
"c",
".",
"WriteXml",
"(",
"w",
",",
"option",
")",
")",
"return",
"ch"
] | Method writes the xml representation for the object. | [
"Method",
"writes",
"the",
"xml",
"representation",
"for",
"the",
"object",
"."
] | bf6b07d6abeacb922c92b198352eda4eb9e4629b | https://github.com/CiscoUcs/UcsPythonSDK/blob/bf6b07d6abeacb922c92b198352eda4eb9e4629b/src/UcsSdk/UcsBase.py#L68-L73 | train | Method writes the xml representation for the object. |
CiscoUcs/UcsPythonSDK | src/UcsSdk/UcsBase.py | ManagedObject.setattr | def setattr(self, key, value):
""" This method sets attribute of a Managed Object. """
if (UcsUtils.FindClassIdInMoMetaIgnoreCase(self.classId) != None):
if (key in _ManagedObjectMeta[self.classId]):
propMeta = UcsUtils.GetUcsPropertyMeta(self.classId, key)
if (propMeta.ValidatePropertyValue(value) == F... | python | def setattr(self, key, value):
""" This method sets attribute of a Managed Object. """
if (UcsUtils.FindClassIdInMoMetaIgnoreCase(self.classId) != None):
if (key in _ManagedObjectMeta[self.classId]):
propMeta = UcsUtils.GetUcsPropertyMeta(self.classId, key)
if (propMeta.ValidatePropertyValue(value) == F... | [
"def",
"setattr",
"(",
"self",
",",
"key",
",",
"value",
")",
":",
"if",
"(",
"UcsUtils",
".",
"FindClassIdInMoMetaIgnoreCase",
"(",
"self",
".",
"classId",
")",
"!=",
"None",
")",
":",
"if",
"(",
"key",
"in",
"_ManagedObjectMeta",
"[",
"self",
".",
"c... | This method sets attribute of a Managed Object. | [
"This",
"method",
"sets",
"attribute",
"of",
"a",
"Managed",
"Object",
"."
] | bf6b07d6abeacb922c92b198352eda4eb9e4629b | https://github.com/CiscoUcs/UcsPythonSDK/blob/bf6b07d6abeacb922c92b198352eda4eb9e4629b/src/UcsSdk/UcsBase.py#L200-L218 | train | This method sets an attribute of a Managed Object. |
CiscoUcs/UcsPythonSDK | src/UcsSdk/UcsBase.py | ManagedObject.getattr | def getattr(self, key):
""" This method gets attribute value of a Managed Object. """
if ((key == "classId") and (self.__dict__.has_key(key))):
return self.__dict__[key]
if UcsUtils.FindClassIdInMoMetaIgnoreCase(self.classId):
if self.__dict__.has_key(key):
if key in _ManagedObjectMeta[self.classId]:
... | python | def getattr(self, key):
""" This method gets attribute value of a Managed Object. """
if ((key == "classId") and (self.__dict__.has_key(key))):
return self.__dict__[key]
if UcsUtils.FindClassIdInMoMetaIgnoreCase(self.classId):
if self.__dict__.has_key(key):
if key in _ManagedObjectMeta[self.classId]:
... | [
"def",
"getattr",
"(",
"self",
",",
"key",
")",
":",
"if",
"(",
"(",
"key",
"==",
"\"classId\"",
")",
"and",
"(",
"self",
".",
"__dict__",
".",
"has_key",
"(",
"key",
")",
")",
")",
":",
"return",
"self",
".",
"__dict__",
"[",
"key",
"]",
"if",
... | This method gets attribute value of a Managed Object. | [
"This",
"method",
"gets",
"attribute",
"value",
"of",
"a",
"Managed",
"Object",
"."
] | bf6b07d6abeacb922c92b198352eda4eb9e4629b | https://github.com/CiscoUcs/UcsPythonSDK/blob/bf6b07d6abeacb922c92b198352eda4eb9e4629b/src/UcsSdk/UcsBase.py#L230-L256 | train | This method gets the attribute value of a Managed Object. |
CiscoUcs/UcsPythonSDK | src/UcsSdk/UcsBase.py | ManagedObject.MarkDirty | def MarkDirty(self):
""" This method marks the managed object dirty. """
if ((UcsUtils.FindClassIdInMoMetaIgnoreCase(self.classId) == None) and (not self.IsDirty())):
self.dirtyMask = ManagedObject.DUMMYDIRTY
else:
self.dirtyMask = self.propMoMeta.mask | python | def MarkDirty(self):
""" This method marks the managed object dirty. """
if ((UcsUtils.FindClassIdInMoMetaIgnoreCase(self.classId) == None) and (not self.IsDirty())):
self.dirtyMask = ManagedObject.DUMMYDIRTY
else:
self.dirtyMask = self.propMoMeta.mask | [
"def",
"MarkDirty",
"(",
"self",
")",
":",
"if",
"(",
"(",
"UcsUtils",
".",
"FindClassIdInMoMetaIgnoreCase",
"(",
"self",
".",
"classId",
")",
"==",
"None",
")",
"and",
"(",
"not",
"self",
".",
"IsDirty",
"(",
")",
")",
")",
":",
"self",
".",
"dirtyM... | This method marks the managed object dirty. | [
"This",
"method",
"marks",
"the",
"managed",
"object",
"dirty",
"."
] | bf6b07d6abeacb922c92b198352eda4eb9e4629b | https://github.com/CiscoUcs/UcsPythonSDK/blob/bf6b07d6abeacb922c92b198352eda4eb9e4629b/src/UcsSdk/UcsBase.py#L266-L271 | train | This method marks the managed object dirty. |
CiscoUcs/UcsPythonSDK | src/UcsSdk/UcsBase.py | ManagedObject.MakeRn | def MakeRn(self):
""" This method returns the Rn for a managed object. """
rnPattern = self.propMoMeta.rn
for prop in re.findall("\[([^\]]*)\]", rnPattern):
if prop in UcsUtils.GetUcsPropertyMetaAttributeList(self.classId):
if (self.getattr(prop) != None):
rnPattern = re.sub('\[%s\]' % prop, '%s' % se... | python | def MakeRn(self):
""" This method returns the Rn for a managed object. """
rnPattern = self.propMoMeta.rn
for prop in re.findall("\[([^\]]*)\]", rnPattern):
if prop in UcsUtils.GetUcsPropertyMetaAttributeList(self.classId):
if (self.getattr(prop) != None):
rnPattern = re.sub('\[%s\]' % prop, '%s' % se... | [
"def",
"MakeRn",
"(",
"self",
")",
":",
"rnPattern",
"=",
"self",
".",
"propMoMeta",
".",
"rn",
"for",
"prop",
"in",
"re",
".",
"findall",
"(",
"\"\\[([^\\]]*)\\]\"",
",",
"rnPattern",
")",
":",
"if",
"prop",
"in",
"UcsUtils",
".",
"GetUcsPropertyMetaAttri... | This method returns the Rn for a managed object. | [
"This",
"method",
"returns",
"the",
"Rn",
"for",
"a",
"managed",
"object",
"."
] | bf6b07d6abeacb922c92b198352eda4eb9e4629b | https://github.com/CiscoUcs/UcsPythonSDK/blob/bf6b07d6abeacb922c92b198352eda4eb9e4629b/src/UcsSdk/UcsBase.py#L277-L291 | train | This method returns the Rn for a managed object. |
CiscoUcs/UcsPythonSDK | src/UcsSdk/UcsBase.py | ManagedObject.WriteXml | def WriteXml(self, w, option, elementName=None):
""" Method writes the xml representation of the managed object. """
if (option == WriteXmlOption.Dirty and not self.IsDirty()):
return
if elementName == None:
x = w.createElement(self.propMoMeta.xmlAttribute)
else:
x = w.createElement(elementName)
if U... | python | def WriteXml(self, w, option, elementName=None):
""" Method writes the xml representation of the managed object. """
if (option == WriteXmlOption.Dirty and not self.IsDirty()):
return
if elementName == None:
x = w.createElement(self.propMoMeta.xmlAttribute)
else:
x = w.createElement(elementName)
if U... | [
"def",
"WriteXml",
"(",
"self",
",",
"w",
",",
"option",
",",
"elementName",
"=",
"None",
")",
":",
"if",
"(",
"option",
"==",
"WriteXmlOption",
".",
"Dirty",
"and",
"not",
"self",
".",
"IsDirty",
"(",
")",
")",
":",
"return",
"if",
"elementName",
"=... | Method writes the xml representation of the managed object. | [
"Method",
"writes",
"the",
"xml",
"representation",
"of",
"the",
"managed",
"object",
"."
] | bf6b07d6abeacb922c92b198352eda4eb9e4629b | https://github.com/CiscoUcs/UcsPythonSDK/blob/bf6b07d6abeacb922c92b198352eda4eb9e4629b/src/UcsSdk/UcsBase.py#L293-L317 | train | Method writes the xml representation of the object into the specified xml query document. |
CiscoUcs/UcsPythonSDK | src/UcsSdk/UcsBase.py | ManagedObject.LoadFromXml | def LoadFromXml(self, node, handle):
""" Method updates the object from the xml representation of the managed object. """
self.SetHandle(handle)
if node.hasAttributes():
# attributes = node._get_attributes()
# attCount = attributes._get_length()
attributes = node.attributes
attCount = len(attributes)
... | python | def LoadFromXml(self, node, handle):
""" Method updates the object from the xml representation of the managed object. """
self.SetHandle(handle)
if node.hasAttributes():
# attributes = node._get_attributes()
# attCount = attributes._get_length()
attributes = node.attributes
attCount = len(attributes)
... | [
"def",
"LoadFromXml",
"(",
"self",
",",
"node",
",",
"handle",
")",
":",
"self",
".",
"SetHandle",
"(",
"handle",
")",
"if",
"node",
".",
"hasAttributes",
"(",
")",
":",
"# attributes = node._get_attributes()",
"# attCount = attributes._get_length()",
"attributes",
... | Method updates the object from the xml representation of the managed object. | [
"Method",
"updates",
"the",
"object",
"from",
"the",
"xml",
"representation",
"of",
"the",
"managed",
"object",
"."
] | bf6b07d6abeacb922c92b198352eda4eb9e4629b | https://github.com/CiscoUcs/UcsPythonSDK/blob/bf6b07d6abeacb922c92b198352eda4eb9e4629b/src/UcsSdk/UcsBase.py#L319-L362 | train | This method updates the object from the xml representation of the managed object. |
CiscoUcs/UcsPythonSDK | src/UcsSdk/UcsBase.py | ExternalMethod.setattr | def setattr(self, key, value):
""" This method sets the attribute of external method object. """
if key in _MethodFactoryMeta[self.classId]:
self.__dict__[key] = value
elif key == 'errorCode':
self.errorCode = value
elif key == 'errorDescr':
self.errorDescr = value
elif key == 'invocationResult':
... | python | def setattr(self, key, value):
""" This method sets the attribute of external method object. """
if key in _MethodFactoryMeta[self.classId]:
self.__dict__[key] = value
elif key == 'errorCode':
self.errorCode = value
elif key == 'errorDescr':
self.errorDescr = value
elif key == 'invocationResult':
... | [
"def",
"setattr",
"(",
"self",
",",
"key",
",",
"value",
")",
":",
"if",
"key",
"in",
"_MethodFactoryMeta",
"[",
"self",
".",
"classId",
"]",
":",
"self",
".",
"__dict__",
"[",
"key",
"]",
"=",
"value",
"elif",
"key",
"==",
"'errorCode'",
":",
"self"... | This method sets the attribute of external method object. | [
"This",
"method",
"sets",
"the",
"attribute",
"of",
"external",
"method",
"object",
"."
] | bf6b07d6abeacb922c92b198352eda4eb9e4629b | https://github.com/CiscoUcs/UcsPythonSDK/blob/bf6b07d6abeacb922c92b198352eda4eb9e4629b/src/UcsSdk/UcsBase.py#L406-L421 | train | This method sets the attribute of the external method object. |
CiscoUcs/UcsPythonSDK | src/UcsSdk/UcsBase.py | ExternalMethod.getattr | def getattr(self, key):
""" This method gets the attribute value of external method object. """
if key in _MethodFactoryMeta[self.classId]:
""" property exists """
return self.__dict__[key]
else:
""" property does not exist """
return None | python | def getattr(self, key):
""" This method gets the attribute value of external method object. """
if key in _MethodFactoryMeta[self.classId]:
""" property exists """
return self.__dict__[key]
else:
""" property does not exist """
return None | [
"def",
"getattr",
"(",
"self",
",",
"key",
")",
":",
"if",
"key",
"in",
"_MethodFactoryMeta",
"[",
"self",
".",
"classId",
"]",
":",
"\"\"\" property exists \"\"\"",
"return",
"self",
".",
"__dict__",
"[",
"key",
"]",
"else",
":",
"\"\"\" property does not exi... | This method gets the attribute value of external method object. | [
"This",
"method",
"gets",
"the",
"attribute",
"value",
"of",
"external",
"method",
"object",
"."
] | bf6b07d6abeacb922c92b198352eda4eb9e4629b | https://github.com/CiscoUcs/UcsPythonSDK/blob/bf6b07d6abeacb922c92b198352eda4eb9e4629b/src/UcsSdk/UcsBase.py#L423-L430 | train | getattr - Gets the attribute value of the external method object. |
CiscoUcs/UcsPythonSDK | src/UcsSdk/UcsBase.py | ExternalMethod.getErrorResponse | def getErrorResponse(self, errorCode, errorDescr):
""" This methods sets error attributes of an external method object. """
self.errorCode = errorCode
self.errorDescr = errorDescr
self.response = "yes"
return self | python | def getErrorResponse(self, errorCode, errorDescr):
""" This methods sets error attributes of an external method object. """
self.errorCode = errorCode
self.errorDescr = errorDescr
self.response = "yes"
return self | [
"def",
"getErrorResponse",
"(",
"self",
",",
"errorCode",
",",
"errorDescr",
")",
":",
"self",
".",
"errorCode",
"=",
"errorCode",
"self",
".",
"errorDescr",
"=",
"errorDescr",
"self",
".",
"response",
"=",
"\"yes\"",
"return",
"self"
] | This methods sets error attributes of an external method object. | [
"This",
"methods",
"sets",
"error",
"attributes",
"of",
"an",
"external",
"method",
"object",
"."
] | bf6b07d6abeacb922c92b198352eda4eb9e4629b | https://github.com/CiscoUcs/UcsPythonSDK/blob/bf6b07d6abeacb922c92b198352eda4eb9e4629b/src/UcsSdk/UcsBase.py#L432-L437 | train | This method sets the error attributes of an external method object. |
CiscoUcs/UcsPythonSDK | src/UcsSdk/UcsBase.py | ExternalMethod.WriteXml | def WriteXml(self, w, option, elementName=None):
""" Method writes the xml representation of the managed object. """
if elementName == None:
x = w.createElement(self.propMoMeta.xmlAttribute)
else:
x = w.createElement(elementName)
for at in UcsUtils.GetUcsPropertyMetaAttributeList(self.classId):
atMeta ... | python | def WriteXml(self, w, option, elementName=None):
""" Method writes the xml representation of the managed object. """
if elementName == None:
x = w.createElement(self.propMoMeta.xmlAttribute)
else:
x = w.createElement(elementName)
for at in UcsUtils.GetUcsPropertyMetaAttributeList(self.classId):
atMeta ... | [
"def",
"WriteXml",
"(",
"self",
",",
"w",
",",
"option",
",",
"elementName",
"=",
"None",
")",
":",
"if",
"elementName",
"==",
"None",
":",
"x",
"=",
"w",
".",
"createElement",
"(",
"self",
".",
"propMoMeta",
".",
"xmlAttribute",
")",
"else",
":",
"x... | Method writes the xml representation of the managed object. | [
"Method",
"writes",
"the",
"xml",
"representation",
"of",
"the",
"managed",
"object",
"."
] | bf6b07d6abeacb922c92b198352eda4eb9e4629b | https://github.com/CiscoUcs/UcsPythonSDK/blob/bf6b07d6abeacb922c92b198352eda4eb9e4629b/src/UcsSdk/UcsBase.py#L439-L458 | train | Method writes the xml representation of the object. |
CiscoUcs/UcsPythonSDK | src/UcsSdk/UcsBase.py | ExternalMethod.LoadFromXml | def LoadFromXml(self, node, handle):
""" Method updates/fills the object from the xml representation of the managed object. """
from Ucs import ClassFactory
self.SetHandle(handle)
if node.hasAttributes():
# attributes = node._get_attributes()
# attCount = attributes._get_length()
attributes = node.att... | python | def LoadFromXml(self, node, handle):
""" Method updates/fills the object from the xml representation of the managed object. """
from Ucs import ClassFactory
self.SetHandle(handle)
if node.hasAttributes():
# attributes = node._get_attributes()
# attCount = attributes._get_length()
attributes = node.att... | [
"def",
"LoadFromXml",
"(",
"self",
",",
"node",
",",
"handle",
")",
":",
"from",
"Ucs",
"import",
"ClassFactory",
"self",
".",
"SetHandle",
"(",
"handle",
")",
"if",
"node",
".",
"hasAttributes",
"(",
")",
":",
"# attributes = node._get_attributes()",
"# attCo... | Method updates/fills the object from the xml representation of the managed object. | [
"Method",
"updates",
"/",
"fills",
"the",
"object",
"from",
"the",
"xml",
"representation",
"of",
"the",
"managed",
"object",
"."
] | bf6b07d6abeacb922c92b198352eda4eb9e4629b | https://github.com/CiscoUcs/UcsPythonSDK/blob/bf6b07d6abeacb922c92b198352eda4eb9e4629b/src/UcsSdk/UcsBase.py#L460-L502 | train | Loads the object from the xml representation of the managed object. |
CiscoUcs/UcsPythonSDK | src/UcsSdk/UcsBase.py | UcsUtils.GetUcsPropertyMeta | def GetUcsPropertyMeta(classId, key):
""" Methods returns the property meta of the provided key for the given classId. """
if classId in _ManagedObjectMeta:
if key in _ManagedObjectMeta[classId]:
return _ManagedObjectMeta[classId][key]
return None | python | def GetUcsPropertyMeta(classId, key):
""" Methods returns the property meta of the provided key for the given classId. """
if classId in _ManagedObjectMeta:
if key in _ManagedObjectMeta[classId]:
return _ManagedObjectMeta[classId][key]
return None | [
"def",
"GetUcsPropertyMeta",
"(",
"classId",
",",
"key",
")",
":",
"if",
"classId",
"in",
"_ManagedObjectMeta",
":",
"if",
"key",
"in",
"_ManagedObjectMeta",
"[",
"classId",
"]",
":",
"return",
"_ManagedObjectMeta",
"[",
"classId",
"]",
"[",
"key",
"]",
"ret... | Methods returns the property meta of the provided key for the given classId. | [
"Methods",
"returns",
"the",
"property",
"meta",
"of",
"the",
"provided",
"key",
"for",
"the",
"given",
"classId",
"."
] | bf6b07d6abeacb922c92b198352eda4eb9e4629b | https://github.com/CiscoUcs/UcsPythonSDK/blob/bf6b07d6abeacb922c92b198352eda4eb9e4629b/src/UcsSdk/UcsBase.py#L518-L523 | train | Get UCS property meta. |
CiscoUcs/UcsPythonSDK | src/UcsSdk/UcsBase.py | UcsUtils.GetUcsMethodMeta | def GetUcsMethodMeta(classId, key):
""" Methods returns the method meta of the ExternalMethod. """
if classId in _MethodFactoryMeta:
if key in _MethodFactoryMeta[classId]:
return _MethodFactoryMeta[classId][key]
return None | python | def GetUcsMethodMeta(classId, key):
""" Methods returns the method meta of the ExternalMethod. """
if classId in _MethodFactoryMeta:
if key in _MethodFactoryMeta[classId]:
return _MethodFactoryMeta[classId][key]
return None | [
"def",
"GetUcsMethodMeta",
"(",
"classId",
",",
"key",
")",
":",
"if",
"classId",
"in",
"_MethodFactoryMeta",
":",
"if",
"key",
"in",
"_MethodFactoryMeta",
"[",
"classId",
"]",
":",
"return",
"_MethodFactoryMeta",
"[",
"classId",
"]",
"[",
"key",
"]",
"retur... | Methods returns the method meta of the ExternalMethod. | [
"Methods",
"returns",
"the",
"method",
"meta",
"of",
"the",
"ExternalMethod",
"."
] | bf6b07d6abeacb922c92b198352eda4eb9e4629b | https://github.com/CiscoUcs/UcsPythonSDK/blob/bf6b07d6abeacb922c92b198352eda4eb9e4629b/src/UcsSdk/UcsBase.py#L526-L531 | train | Returns the method meta of the ExternalMethod. |
CiscoUcs/UcsPythonSDK | src/UcsSdk/UcsBase.py | UcsUtils.GetUcsPropertyMetaAttributeList | def GetUcsPropertyMetaAttributeList(classId):
""" Methods returns the class meta. """
if classId in _ManagedObjectMeta:
attrList = _ManagedObjectMeta[classId].keys()
attrList.remove("Meta")
return attrList
if classId in _MethodFactoryMeta:
attrList = _MethodFactoryMeta[classId].keys()
attrList.remo... | python | def GetUcsPropertyMetaAttributeList(classId):
""" Methods returns the class meta. """
if classId in _ManagedObjectMeta:
attrList = _ManagedObjectMeta[classId].keys()
attrList.remove("Meta")
return attrList
if classId in _MethodFactoryMeta:
attrList = _MethodFactoryMeta[classId].keys()
attrList.remo... | [
"def",
"GetUcsPropertyMetaAttributeList",
"(",
"classId",
")",
":",
"if",
"classId",
"in",
"_ManagedObjectMeta",
":",
"attrList",
"=",
"_ManagedObjectMeta",
"[",
"classId",
"]",
".",
"keys",
"(",
")",
"attrList",
".",
"remove",
"(",
"\"Meta\"",
")",
"return",
... | Methods returns the class meta. | [
"Methods",
"returns",
"the",
"class",
"meta",
"."
] | bf6b07d6abeacb922c92b198352eda4eb9e4629b | https://github.com/CiscoUcs/UcsPythonSDK/blob/bf6b07d6abeacb922c92b198352eda4eb9e4629b/src/UcsSdk/UcsBase.py#L534-L558 | train | Method returns the class meta. |
CiscoUcs/UcsPythonSDK | src/UcsSdk/UcsBase.py | UcsUtils.IsPropertyInMetaIgnoreCase | def IsPropertyInMetaIgnoreCase(classId, key):
""" Methods returns the property meta of the provided key for the given classId. Given key is case insensitive. """
if classId in _ManagedObjectMeta:
for prop in _ManagedObjectMeta[classId]:
if (prop.lower() == key.lower()):
return _ManagedObjectMeta[classId... | python | def IsPropertyInMetaIgnoreCase(classId, key):
""" Methods returns the property meta of the provided key for the given classId. Given key is case insensitive. """
if classId in _ManagedObjectMeta:
for prop in _ManagedObjectMeta[classId]:
if (prop.lower() == key.lower()):
return _ManagedObjectMeta[classId... | [
"def",
"IsPropertyInMetaIgnoreCase",
"(",
"classId",
",",
"key",
")",
":",
"if",
"classId",
"in",
"_ManagedObjectMeta",
":",
"for",
"prop",
"in",
"_ManagedObjectMeta",
"[",
"classId",
"]",
":",
"if",
"(",
"prop",
".",
"lower",
"(",
")",
"==",
"key",
".",
... | Methods returns the property meta of the provided key for the given classId. Given key is case insensitive. | [
"Methods",
"returns",
"the",
"property",
"meta",
"of",
"the",
"provided",
"key",
"for",
"the",
"given",
"classId",
".",
"Given",
"key",
"is",
"case",
"insensitive",
"."
] | bf6b07d6abeacb922c92b198352eda4eb9e4629b | https://github.com/CiscoUcs/UcsPythonSDK/blob/bf6b07d6abeacb922c92b198352eda4eb9e4629b/src/UcsSdk/UcsBase.py#L561-L571 | train | Returns the meta of the given key for the given classId. Given key is case insensitive. |
CiscoUcs/UcsPythonSDK | src/UcsSdk/UcsBase.py | UcsUtils.FindClassIdInMoMetaIgnoreCase | def FindClassIdInMoMetaIgnoreCase(classId):
""" Methods whether classId is valid or not . Given class is case insensitive. """
if not classId:
return None
if classId in _ManagedObjectMeta:
return classId
lClassId = classId.lower()
for key in _ManagedObjectMeta.keys():
if (key.lower() == lClassId):
... | python | def FindClassIdInMoMetaIgnoreCase(classId):
""" Methods whether classId is valid or not . Given class is case insensitive. """
if not classId:
return None
if classId in _ManagedObjectMeta:
return classId
lClassId = classId.lower()
for key in _ManagedObjectMeta.keys():
if (key.lower() == lClassId):
... | [
"def",
"FindClassIdInMoMetaIgnoreCase",
"(",
"classId",
")",
":",
"if",
"not",
"classId",
":",
"return",
"None",
"if",
"classId",
"in",
"_ManagedObjectMeta",
":",
"return",
"classId",
"lClassId",
"=",
"classId",
".",
"lower",
"(",
")",
"for",
"key",
"in",
"_... | Methods whether classId is valid or not . Given class is case insensitive. | [
"Methods",
"whether",
"classId",
"is",
"valid",
"or",
"not",
".",
"Given",
"class",
"is",
"case",
"insensitive",
"."
] | bf6b07d6abeacb922c92b198352eda4eb9e4629b | https://github.com/CiscoUcs/UcsPythonSDK/blob/bf6b07d6abeacb922c92b198352eda4eb9e4629b/src/UcsSdk/UcsBase.py#L574-L584 | train | Method to find classId in managed object meta. Given class is case insensitive. |
CiscoUcs/UcsPythonSDK | src/UcsSdk/UcsBase.py | UcsUtils.FindClassIdInMethodMetaIgnoreCase | def FindClassIdInMethodMetaIgnoreCase(classId):
""" Methods whether classId is valid or not . Given class is case insensitive. """
if classId in _MethodFactoryMeta:
return classId
lClassId = classId.lower()
for key in _MethodFactoryMeta.keys():
if (key.lower() == classId.lower()):
return key
return ... | python | def FindClassIdInMethodMetaIgnoreCase(classId):
""" Methods whether classId is valid or not . Given class is case insensitive. """
if classId in _MethodFactoryMeta:
return classId
lClassId = classId.lower()
for key in _MethodFactoryMeta.keys():
if (key.lower() == classId.lower()):
return key
return ... | [
"def",
"FindClassIdInMethodMetaIgnoreCase",
"(",
"classId",
")",
":",
"if",
"classId",
"in",
"_MethodFactoryMeta",
":",
"return",
"classId",
"lClassId",
"=",
"classId",
".",
"lower",
"(",
")",
"for",
"key",
"in",
"_MethodFactoryMeta",
".",
"keys",
"(",
")",
":... | Methods whether classId is valid or not . Given class is case insensitive. | [
"Methods",
"whether",
"classId",
"is",
"valid",
"or",
"not",
".",
"Given",
"class",
"is",
"case",
"insensitive",
"."
] | bf6b07d6abeacb922c92b198352eda4eb9e4629b | https://github.com/CiscoUcs/UcsPythonSDK/blob/bf6b07d6abeacb922c92b198352eda4eb9e4629b/src/UcsSdk/UcsBase.py#L587-L595 | train | Returns a list of methods whether classId is valid or not. Given class is case insensitive. |
CiscoUcs/UcsPythonSDK | src/UcsSdk/UcsBase.py | UcsUtils.HandleFilterMaxComponentLimit | def HandleFilterMaxComponentLimit(handle, lfilter):
"""
Method checks the filter count and if the filter count exceeds the maxComponents(number of filters), then the given filter
objects get distributed among small groups and then again binded together in complex filters(like and , or) so that the
count of filt... | python | def HandleFilterMaxComponentLimit(handle, lfilter):
"""
Method checks the filter count and if the filter count exceeds the maxComponents(number of filters), then the given filter
objects get distributed among small groups and then again binded together in complex filters(like and , or) so that the
count of filt... | [
"def",
"HandleFilterMaxComponentLimit",
"(",
"handle",
",",
"lfilter",
")",
":",
"from",
"Ucs",
"import",
"AndFilter",
",",
"OrFilter",
",",
"AbstractFilter",
"maxComponents",
"=",
"10",
"if",
"(",
"(",
"lfilter",
"==",
"None",
")",
"or",
"(",
"lfilter",
"."... | Method checks the filter count and if the filter count exceeds the maxComponents(number of filters), then the given filter
objects get distributed among small groups and then again binded together in complex filters(like and , or) so that the
count of filters can be reduced. | [
"Method",
"checks",
"the",
"filter",
"count",
"and",
"if",
"the",
"filter",
"count",
"exceeds",
"the",
"maxComponents",
"(",
"number",
"of",
"filters",
")",
"then",
"the",
"given",
"filter",
"objects",
"get",
"distributed",
"among",
"small",
"groups",
"and",
... | bf6b07d6abeacb922c92b198352eda4eb9e4629b | https://github.com/CiscoUcs/UcsPythonSDK/blob/bf6b07d6abeacb922c92b198352eda4eb9e4629b/src/UcsSdk/UcsBase.py#L598-L636 | train | This method handles the maximum number of components in a filter. |
CiscoUcs/UcsPythonSDK | src/UcsSdk/UcsBase.py | UcsUtils.CheckRegistryKey | def CheckRegistryKey(javaKey):
""" Method checks for the java in the registry entries. """
from _winreg import ConnectRegistry, HKEY_LOCAL_MACHINE, OpenKey, QueryValueEx
path = None
try:
aReg = ConnectRegistry(None, HKEY_LOCAL_MACHINE)
rk = OpenKey(aReg, javaKey)
for i in range(1024):
currentVersi... | python | def CheckRegistryKey(javaKey):
""" Method checks for the java in the registry entries. """
from _winreg import ConnectRegistry, HKEY_LOCAL_MACHINE, OpenKey, QueryValueEx
path = None
try:
aReg = ConnectRegistry(None, HKEY_LOCAL_MACHINE)
rk = OpenKey(aReg, javaKey)
for i in range(1024):
currentVersi... | [
"def",
"CheckRegistryKey",
"(",
"javaKey",
")",
":",
"from",
"_winreg",
"import",
"ConnectRegistry",
",",
"HKEY_LOCAL_MACHINE",
",",
"OpenKey",
",",
"QueryValueEx",
"path",
"=",
"None",
"try",
":",
"aReg",
"=",
"ConnectRegistry",
"(",
"None",
",",
"HKEY_LOCAL_MA... | Method checks for the java in the registry entries. | [
"Method",
"checks",
"for",
"the",
"java",
"in",
"the",
"registry",
"entries",
"."
] | bf6b07d6abeacb922c92b198352eda4eb9e4629b | https://github.com/CiscoUcs/UcsPythonSDK/blob/bf6b07d6abeacb922c92b198352eda4eb9e4629b/src/UcsSdk/UcsBase.py#L654-L672 | train | Checks for the java in the registry entries. |
CiscoUcs/UcsPythonSDK | src/UcsSdk/UcsBase.py | UcsUtils.GetJavaInstallationPath | def GetJavaInstallationPath():
""" Method returns the java installation path in the windows or Linux environment. """
import os, platform
# Get JavaPath for Ubuntu
# if os.name == "posix":
if platform.system() == "Linux":
path = os.environ.get('JAVA_HOME')
if not path:
raise UcsValidationException(... | python | def GetJavaInstallationPath():
""" Method returns the java installation path in the windows or Linux environment. """
import os, platform
# Get JavaPath for Ubuntu
# if os.name == "posix":
if platform.system() == "Linux":
path = os.environ.get('JAVA_HOME')
if not path:
raise UcsValidationException(... | [
"def",
"GetJavaInstallationPath",
"(",
")",
":",
"import",
"os",
",",
"platform",
"# Get JavaPath for Ubuntu",
"# if os.name == \"posix\":",
"if",
"platform",
".",
"system",
"(",
")",
"==",
"\"Linux\"",
":",
"path",
"=",
"os",
".",
"environ",
".",
"get",
"(",
... | Method returns the java installation path in the windows or Linux environment. | [
"Method",
"returns",
"the",
"java",
"installation",
"path",
"in",
"the",
"windows",
"or",
"Linux",
"environment",
"."
] | bf6b07d6abeacb922c92b198352eda4eb9e4629b | https://github.com/CiscoUcs/UcsPythonSDK/blob/bf6b07d6abeacb922c92b198352eda4eb9e4629b/src/UcsSdk/UcsBase.py#L675-L718 | train | Method returns the java installation path in the Windows or Linux environment. |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.