repository_name stringlengths 7 55 | func_path_in_repository stringlengths 4 223 | func_name stringlengths 1 134 | whole_func_string stringlengths 75 104k | language stringclasses 1
value | func_code_string stringlengths 75 104k | func_code_tokens listlengths 19 28.4k | func_documentation_string stringlengths 1 46.9k | func_documentation_tokens listlengths 1 1.97k | split_name stringclasses 1
value | func_code_url stringlengths 87 315 |
|---|---|---|---|---|---|---|---|---|---|---|
gabstopper/smc-python | smc/core/interfaces.py | Interface.addresses | def addresses(self):
"""
Return 3-tuple with (address, network, nicid)
:return: address related information of interface as 3-tuple list
:rtype: list
"""
addresses = []
for i in self.all_interfaces:
if isinstance(i, VlanInterface):
for... | python | def addresses(self):
"""
Return 3-tuple with (address, network, nicid)
:return: address related information of interface as 3-tuple list
:rtype: list
"""
addresses = []
for i in self.all_interfaces:
if isinstance(i, VlanInterface):
for... | [
"def",
"addresses",
"(",
"self",
")",
":",
"addresses",
"=",
"[",
"]",
"for",
"i",
"in",
"self",
".",
"all_interfaces",
":",
"if",
"isinstance",
"(",
"i",
",",
"VlanInterface",
")",
":",
"for",
"v",
"in",
"i",
".",
"interfaces",
":",
"addresses",
"."... | Return 3-tuple with (address, network, nicid)
:return: address related information of interface as 3-tuple list
:rtype: list | [
"Return",
"3",
"-",
"tuple",
"with",
"(",
"address",
"network",
"nicid",
")"
] | train | https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/core/interfaces.py#L503-L517 |
gabstopper/smc-python | smc/core/interfaces.py | Interface.sub_interfaces | def sub_interfaces(self):
"""
Flatten out all top level interfaces and only return sub interfaces.
It is recommended to use :meth:`~all_interfaces`, :meth:`~interfaces`
or :meth:`~vlan_interfaces` which return collections with helper
methods to get sub interfaces based on index o... | python | def sub_interfaces(self):
"""
Flatten out all top level interfaces and only return sub interfaces.
It is recommended to use :meth:`~all_interfaces`, :meth:`~interfaces`
or :meth:`~vlan_interfaces` which return collections with helper
methods to get sub interfaces based on index o... | [
"def",
"sub_interfaces",
"(",
"self",
")",
":",
"interfaces",
"=",
"self",
".",
"all_interfaces",
"sub_interfaces",
"=",
"[",
"]",
"for",
"interface",
"in",
"interfaces",
":",
"if",
"isinstance",
"(",
"interface",
",",
"VlanInterface",
")",
":",
"if",
"inter... | Flatten out all top level interfaces and only return sub interfaces.
It is recommended to use :meth:`~all_interfaces`, :meth:`~interfaces`
or :meth:`~vlan_interfaces` which return collections with helper
methods to get sub interfaces based on index or attribute value pairs.
:rtype: list... | [
"Flatten",
"out",
"all",
"top",
"level",
"interfaces",
"and",
"only",
"return",
"sub",
"interfaces",
".",
"It",
"is",
"recommended",
"to",
"use",
":",
"meth",
":",
"~all_interfaces",
":",
"meth",
":",
"~interfaces",
"or",
":",
"meth",
":",
"~vlan_interfaces"... | train | https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/core/interfaces.py#L584-L605 |
gabstopper/smc-python | smc/core/interfaces.py | Interface.get_boolean | def get_boolean(self, name):
"""
Get the boolean value for attribute specified from the
sub interface/s.
"""
for interface in self.all_interfaces:
if isinstance(interface, VlanInterface):
if any(vlan for vlan in interface.interfaces
... | python | def get_boolean(self, name):
"""
Get the boolean value for attribute specified from the
sub interface/s.
"""
for interface in self.all_interfaces:
if isinstance(interface, VlanInterface):
if any(vlan for vlan in interface.interfaces
... | [
"def",
"get_boolean",
"(",
"self",
",",
"name",
")",
":",
"for",
"interface",
"in",
"self",
".",
"all_interfaces",
":",
"if",
"isinstance",
"(",
"interface",
",",
"VlanInterface",
")",
":",
"if",
"any",
"(",
"vlan",
"for",
"vlan",
"in",
"interface",
".",... | Get the boolean value for attribute specified from the
sub interface/s. | [
"Get",
"the",
"boolean",
"value",
"for",
"attribute",
"specified",
"from",
"the",
"sub",
"interface",
"/",
"s",
"."
] | train | https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/core/interfaces.py#L607-L620 |
gabstopper/smc-python | smc/core/interfaces.py | Interface.delete_invalid_route | def delete_invalid_route(self):
"""
Delete any invalid routes for this interface. An invalid route is
a left over when an interface is changed to a different network.
:return: None
"""
try:
routing = self._engine.routing.get(self.interface_id)
... | python | def delete_invalid_route(self):
"""
Delete any invalid routes for this interface. An invalid route is
a left over when an interface is changed to a different network.
:return: None
"""
try:
routing = self._engine.routing.get(self.interface_id)
... | [
"def",
"delete_invalid_route",
"(",
"self",
")",
":",
"try",
":",
"routing",
"=",
"self",
".",
"_engine",
".",
"routing",
".",
"get",
"(",
"self",
".",
"interface_id",
")",
"for",
"route",
"in",
"routing",
":",
"if",
"route",
".",
"invalid",
"or",
"rou... | Delete any invalid routes for this interface. An invalid route is
a left over when an interface is changed to a different network.
:return: None | [
"Delete",
"any",
"invalid",
"routes",
"for",
"this",
"interface",
".",
"An",
"invalid",
"route",
"is",
"a",
"left",
"over",
"when",
"an",
"interface",
"is",
"changed",
"to",
"a",
"different",
"network",
".",
":",
"return",
":",
"None"
] | train | https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/core/interfaces.py#L622-L635 |
gabstopper/smc-python | smc/core/interfaces.py | Interface.reset_interface | def reset_interface(self):
"""
Reset the interface by removing all assigned addresses and VLANs.
This will not delete the interface itself, only the sub interfaces that
may have addresses assigned. This will not affect inline or capture
interfaces.
Note that if this inter... | python | def reset_interface(self):
"""
Reset the interface by removing all assigned addresses and VLANs.
This will not delete the interface itself, only the sub interfaces that
may have addresses assigned. This will not affect inline or capture
interfaces.
Note that if this inter... | [
"def",
"reset_interface",
"(",
"self",
")",
":",
"self",
".",
"data",
"[",
"'interfaces'",
"]",
"=",
"[",
"]",
"if",
"self",
".",
"typeof",
"!=",
"'tunnel_interface'",
":",
"self",
".",
"data",
"[",
"'vlanInterfaces'",
"]",
"=",
"[",
"]",
"self",
".",
... | Reset the interface by removing all assigned addresses and VLANs.
This will not delete the interface itself, only the sub interfaces that
may have addresses assigned. This will not affect inline or capture
interfaces.
Note that if this interface is used as a primary control, auth request... | [
"Reset",
"the",
"interface",
"by",
"removing",
"all",
"assigned",
"addresses",
"and",
"VLANs",
".",
"This",
"will",
"not",
"delete",
"the",
"interface",
"itself",
"only",
"the",
"sub",
"interfaces",
"that",
"may",
"have",
"addresses",
"assigned",
".",
"This",
... | train | https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/core/interfaces.py#L637-L657 |
gabstopper/smc-python | smc/core/interfaces.py | Interface.change_interface_id | def change_interface_id(self, interface_id):
"""
Change the interface ID for this interface. This can be used on any
interface type. If the interface is an Inline interface, you must
provide the ``interface_id`` in format '1-2' to define both
interfaces in the pair. The change is... | python | def change_interface_id(self, interface_id):
"""
Change the interface ID for this interface. This can be used on any
interface type. If the interface is an Inline interface, you must
provide the ``interface_id`` in format '1-2' to define both
interfaces in the pair. The change is... | [
"def",
"change_interface_id",
"(",
"self",
",",
"interface_id",
")",
":",
"splitted",
"=",
"str",
"(",
"interface_id",
")",
".",
"split",
"(",
"'-'",
")",
"if1",
"=",
"splitted",
"[",
"0",
"]",
"for",
"interface",
"in",
"self",
".",
"all_interfaces",
":"... | Change the interface ID for this interface. This can be used on any
interface type. If the interface is an Inline interface, you must
provide the ``interface_id`` in format '1-2' to define both
interfaces in the pair. The change is committed after calling this
method.
::
... | [
"Change",
"the",
"interface",
"ID",
"for",
"this",
"interface",
".",
"This",
"can",
"be",
"used",
"on",
"any",
"interface",
"type",
".",
"If",
"the",
"interface",
"is",
"an",
"Inline",
"interface",
"you",
"must",
"provide",
"the",
"interface_id",
"in",
"fo... | train | https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/core/interfaces.py#L680-L726 |
gabstopper/smc-python | smc/core/interfaces.py | Interface._update_interface | def _update_interface(self, other_interface):
"""
Update the physical interface base settings with another interface.
Only set updated if a value has changed. You must also call `update`
on the interface if modifications are made. This is called from other
interfaces (i.e. Physic... | python | def _update_interface(self, other_interface):
"""
Update the physical interface base settings with another interface.
Only set updated if a value has changed. You must also call `update`
on the interface if modifications are made. This is called from other
interfaces (i.e. Physic... | [
"def",
"_update_interface",
"(",
"self",
",",
"other_interface",
")",
":",
"updated",
"=",
"False",
"for",
"name",
",",
"value",
"in",
"other_interface",
".",
"data",
".",
"items",
"(",
")",
":",
"if",
"isinstance",
"(",
"value",
",",
"string_types",
")",
... | Update the physical interface base settings with another interface.
Only set updated if a value has changed. You must also call `update`
on the interface if modifications are made. This is called from other
interfaces (i.e. PhysicalInterface, ClusterPhysicalInterface, etc) to
update the ... | [
"Update",
"the",
"physical",
"interface",
"base",
"settings",
"with",
"another",
"interface",
".",
"Only",
"set",
"updated",
"if",
"a",
"value",
"has",
"changed",
".",
"You",
"must",
"also",
"call",
"update",
"on",
"the",
"interface",
"if",
"modifications",
... | train | https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/core/interfaces.py#L728-L750 |
gabstopper/smc-python | smc/core/interfaces.py | Interface.update_interface | def update_interface(self, other_interface, ignore_mgmt=True):
"""
Update an existing interface by comparing values between two
interfaces. If a VLAN interface is defined in the other interface
and it doesn't exist on the existing interface, it will be created.
:param ot... | python | def update_interface(self, other_interface, ignore_mgmt=True):
"""
Update an existing interface by comparing values between two
interfaces. If a VLAN interface is defined in the other interface
and it doesn't exist on the existing interface, it will be created.
:param ot... | [
"def",
"update_interface",
"(",
"self",
",",
"other_interface",
",",
"ignore_mgmt",
"=",
"True",
")",
":",
"base_updated",
"=",
"self",
".",
"_update_interface",
"(",
"other_interface",
")",
"mgmt",
"=",
"(",
"'auth_request'",
",",
"'backup_heartbeat'",
",",
"'b... | Update an existing interface by comparing values between two
interfaces. If a VLAN interface is defined in the other interface
and it doesn't exist on the existing interface, it will be created.
:param other_interface Interface: an instance of an
interface where values in th... | [
"Update",
"an",
"existing",
"interface",
"by",
"comparing",
"values",
"between",
"two",
"interfaces",
".",
"If",
"a",
"VLAN",
"interface",
"is",
"defined",
"in",
"the",
"other",
"interface",
"and",
"it",
"doesn",
"t",
"exist",
"on",
"the",
"existing",
"inter... | train | https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/core/interfaces.py#L752-L842 |
gabstopper/smc-python | smc/core/interfaces.py | Interface.name | def name(self):
"""
Read only name tag
"""
name = super(Interface, self).name
return name if name else self.data.get('name') | python | def name(self):
"""
Read only name tag
"""
name = super(Interface, self).name
return name if name else self.data.get('name') | [
"def",
"name",
"(",
"self",
")",
":",
"name",
"=",
"super",
"(",
"Interface",
",",
"self",
")",
".",
"name",
"return",
"name",
"if",
"name",
"else",
"self",
".",
"data",
".",
"get",
"(",
"'name'",
")"
] | Read only name tag | [
"Read",
"only",
"name",
"tag"
] | train | https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/core/interfaces.py#L845-L850 |
gabstopper/smc-python | smc/core/interfaces.py | TunnelInterface._add_interface | def _add_interface(self, interface_id, **kw):
"""
Create a tunnel interface. Kw argument list is as follows
"""
base_interface = ElementCache()
base_interface.update(
interface_id=str(interface_id),
interfaces=[])
if 'zone_ref' in kw:
... | python | def _add_interface(self, interface_id, **kw):
"""
Create a tunnel interface. Kw argument list is as follows
"""
base_interface = ElementCache()
base_interface.update(
interface_id=str(interface_id),
interfaces=[])
if 'zone_ref' in kw:
... | [
"def",
"_add_interface",
"(",
"self",
",",
"interface_id",
",",
"*",
"*",
"kw",
")",
":",
"base_interface",
"=",
"ElementCache",
"(",
")",
"base_interface",
".",
"update",
"(",
"interface_id",
"=",
"str",
"(",
"interface_id",
")",
",",
"interfaces",
"=",
"... | Create a tunnel interface. Kw argument list is as follows | [
"Create",
"a",
"tunnel",
"interface",
".",
"Kw",
"argument",
"list",
"is",
"as",
"follows"
] | train | https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/core/interfaces.py#L941-L976 |
gabstopper/smc-python | smc/core/interfaces.py | PhysicalInterface.ndi_interfaces | def ndi_interfaces(self):
"""
Return a formatted dict list of NDI interfaces on this engine.
This will ignore CVI or any inline or layer 2 interface types.
This can be used to identify to indicate available IP addresses
for a given interface which can be used to run services suc... | python | def ndi_interfaces(self):
"""
Return a formatted dict list of NDI interfaces on this engine.
This will ignore CVI or any inline or layer 2 interface types.
This can be used to identify to indicate available IP addresses
for a given interface which can be used to run services suc... | [
"def",
"ndi_interfaces",
"(",
"self",
")",
":",
"return",
"[",
"{",
"'address'",
":",
"interface",
".",
"address",
",",
"'nicid'",
":",
"interface",
".",
"nicid",
"}",
"for",
"interface",
"in",
"self",
".",
"interfaces",
"if",
"isinstance",
"(",
"interface... | Return a formatted dict list of NDI interfaces on this engine.
This will ignore CVI or any inline or layer 2 interface types.
This can be used to identify to indicate available IP addresses
for a given interface which can be used to run services such as
SNMP or DNS Relay.
... | [
"Return",
"a",
"formatted",
"dict",
"list",
"of",
"NDI",
"interfaces",
"on",
"this",
"engine",
".",
"This",
"will",
"ignore",
"CVI",
"or",
"any",
"inline",
"or",
"layer",
"2",
"interface",
"types",
".",
"This",
"can",
"be",
"used",
"to",
"identify",
"to"... | train | https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/core/interfaces.py#L1114-L1127 |
gabstopper/smc-python | smc/core/interfaces.py | PhysicalInterface.change_vlan_id | def change_vlan_id(self, original, new):
"""
Change VLAN ID for a single VLAN, cluster VLAN or inline
interface. When changing a single or cluster FW vlan, you
can specify the original VLAN and new VLAN as either single
int or str value. If modifying an inline interface VLAN when... | python | def change_vlan_id(self, original, new):
"""
Change VLAN ID for a single VLAN, cluster VLAN or inline
interface. When changing a single or cluster FW vlan, you
can specify the original VLAN and new VLAN as either single
int or str value. If modifying an inline interface VLAN when... | [
"def",
"change_vlan_id",
"(",
"self",
",",
"original",
",",
"new",
")",
":",
"vlan",
"=",
"self",
".",
"vlan_interface",
".",
"get_vlan",
"(",
"original",
")",
"newvlan",
"=",
"str",
"(",
"new",
")",
".",
"split",
"(",
"'-'",
")",
"splitted",
"=",
"v... | Change VLAN ID for a single VLAN, cluster VLAN or inline
interface. When changing a single or cluster FW vlan, you
can specify the original VLAN and new VLAN as either single
int or str value. If modifying an inline interface VLAN when
the interface pair has two different VLAN identifier... | [
"Change",
"VLAN",
"ID",
"for",
"a",
"single",
"VLAN",
"cluster",
"VLAN",
"or",
"inline",
"interface",
".",
"When",
"changing",
"a",
"single",
"or",
"cluster",
"FW",
"vlan",
"you",
"can",
"specify",
"the",
"original",
"VLAN",
"and",
"new",
"VLAN",
"as",
"... | train | https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/core/interfaces.py#L1129-L1173 |
gabstopper/smc-python | smc/core/interfaces.py | PhysicalInterface.enable_aggregate_mode | def enable_aggregate_mode(self, mode, interfaces):
"""
Enable Aggregate (LAGG) mode on this interface. Possible LAGG
types are 'ha' and 'lb' (load balancing). For HA, only one
secondary interface ID is required. For load balancing mode, up
to 7 additional are supported (8 max... | python | def enable_aggregate_mode(self, mode, interfaces):
"""
Enable Aggregate (LAGG) mode on this interface. Possible LAGG
types are 'ha' and 'lb' (load balancing). For HA, only one
secondary interface ID is required. For load balancing mode, up
to 7 additional are supported (8 max... | [
"def",
"enable_aggregate_mode",
"(",
"self",
",",
"mode",
",",
"interfaces",
")",
":",
"if",
"mode",
"in",
"[",
"'lb'",
",",
"'ha'",
"]",
":",
"self",
".",
"data",
"[",
"'aggregate_mode'",
"]",
"=",
"mode",
"self",
".",
"data",
"[",
"'second_interface_id... | Enable Aggregate (LAGG) mode on this interface. Possible LAGG
types are 'ha' and 'lb' (load balancing). For HA, only one
secondary interface ID is required. For load balancing mode, up
to 7 additional are supported (8 max interfaces).
:param str mode: 'lb' or 'ha'
:param... | [
"Enable",
"Aggregate",
"(",
"LAGG",
")",
"mode",
"on",
"this",
"interface",
".",
"Possible",
"LAGG",
"types",
"are",
"ha",
"and",
"lb",
"(",
"load",
"balancing",
")",
".",
"For",
"HA",
"only",
"one",
"secondary",
"interface",
"ID",
"is",
"required",
".",... | train | https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/core/interfaces.py#L1175-L1191 |
gabstopper/smc-python | smc/core/interfaces.py | PhysicalInterface.static_arp_entry | def static_arp_entry(self, ipaddress, macaddress, arp_type='static', netmask=32):
"""
Add an arp entry to this physical interface.
::
interface = engine.physical_interface.get(0)
interface.static_arp_entry(
ipaddress='23.23.23.23',
arp_typ... | python | def static_arp_entry(self, ipaddress, macaddress, arp_type='static', netmask=32):
"""
Add an arp entry to this physical interface.
::
interface = engine.physical_interface.get(0)
interface.static_arp_entry(
ipaddress='23.23.23.23',
arp_typ... | [
"def",
"static_arp_entry",
"(",
"self",
",",
"ipaddress",
",",
"macaddress",
",",
"arp_type",
"=",
"'static'",
",",
"netmask",
"=",
"32",
")",
":",
"self",
".",
"data",
"[",
"'arp_entry'",
"]",
".",
"append",
"(",
"{",
"'ipaddress'",
":",
"ipaddress",
",... | Add an arp entry to this physical interface.
::
interface = engine.physical_interface.get(0)
interface.static_arp_entry(
ipaddress='23.23.23.23',
arp_type='static',
macaddress='02:02:02:02:04:04')
interface.save()
:par... | [
"Add",
"an",
"arp",
"entry",
"to",
"this",
"physical",
"interface",
".",
"::"
] | train | https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/core/interfaces.py#L1205-L1227 |
gabstopper/smc-python | smc/core/interfaces.py | ClusterPhysicalInterface._add_interface | def _add_interface(self, interface_id, mgt=None, **kw):
"""
Add the Cluster interface. If adding a cluster interface to
an existing node, retrieve the existing interface and call
this method. Use the supported format for defining an interface.
"""
_kw = copy.deepcopy(kw) ... | python | def _add_interface(self, interface_id, mgt=None, **kw):
"""
Add the Cluster interface. If adding a cluster interface to
an existing node, retrieve the existing interface and call
this method. Use the supported format for defining an interface.
"""
_kw = copy.deepcopy(kw) ... | [
"def",
"_add_interface",
"(",
"self",
",",
"interface_id",
",",
"mgt",
"=",
"None",
",",
"*",
"*",
"kw",
")",
":",
"_kw",
"=",
"copy",
".",
"deepcopy",
"(",
"kw",
")",
"# Preserve original kw, especially lists",
"mgt",
"=",
"mgt",
"if",
"mgt",
"else",
"{... | Add the Cluster interface. If adding a cluster interface to
an existing node, retrieve the existing interface and call
this method. Use the supported format for defining an interface. | [
"Add",
"the",
"Cluster",
"interface",
".",
"If",
"adding",
"a",
"cluster",
"interface",
"to",
"an",
"existing",
"node",
"retrieve",
"the",
"existing",
"interface",
"and",
"call",
"this",
"method",
".",
"Use",
"the",
"supported",
"format",
"for",
"defining",
... | train | https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/core/interfaces.py#L1616-L1689 |
gabstopper/smc-python | smc/core/interfaces.py | VlanInterface.delete | def delete(self):
"""
Delete this Vlan interface from the parent interface.
This will also remove stale routes if the interface has
networks associated with it.
:return: None
"""
if self in self._parent.vlan_interface:
self._parent.data['vlanI... | python | def delete(self):
"""
Delete this Vlan interface from the parent interface.
This will also remove stale routes if the interface has
networks associated with it.
:return: None
"""
if self in self._parent.vlan_interface:
self._parent.data['vlanI... | [
"def",
"delete",
"(",
"self",
")",
":",
"if",
"self",
"in",
"self",
".",
"_parent",
".",
"vlan_interface",
":",
"self",
".",
"_parent",
".",
"data",
"[",
"'vlanInterfaces'",
"]",
"=",
"[",
"v",
"for",
"v",
"in",
"self",
".",
"_parent",
".",
"vlan_int... | Delete this Vlan interface from the parent interface.
This will also remove stale routes if the interface has
networks associated with it.
:return: None | [
"Delete",
"this",
"Vlan",
"interface",
"from",
"the",
"parent",
"interface",
".",
"This",
"will",
"also",
"remove",
"stale",
"routes",
"if",
"the",
"interface",
"has",
"networks",
"associated",
"with",
"it",
".",
":",
"return",
":",
"None"
] | train | https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/core/interfaces.py#L1750-L1765 |
gabstopper/smc-python | smc/core/interfaces.py | VlanInterface.change_vlan_id | def change_vlan_id(self, vlan_id):
"""
Change the VLAN id for this VLAN interface. If this is an
inline interface, you can specify two interface values to
create unique VLANs on both sides of the inline pair. Or
provide a single to use the same VLAN id.
:param st... | python | def change_vlan_id(self, vlan_id):
"""
Change the VLAN id for this VLAN interface. If this is an
inline interface, you can specify two interface values to
create unique VLANs on both sides of the inline pair. Or
provide a single to use the same VLAN id.
:param st... | [
"def",
"change_vlan_id",
"(",
"self",
",",
"vlan_id",
")",
":",
"intf_id",
",",
"_",
"=",
"self",
".",
"interface_id",
".",
"split",
"(",
"'.'",
")",
"self",
".",
"interface_id",
"=",
"'{}.{}'",
".",
"format",
"(",
"intf_id",
",",
"vlan_id",
")",
"for"... | Change the VLAN id for this VLAN interface. If this is an
inline interface, you can specify two interface values to
create unique VLANs on both sides of the inline pair. Or
provide a single to use the same VLAN id.
:param str vlan_id: string value for new VLAN id.
:raise... | [
"Change",
"the",
"VLAN",
"id",
"for",
"this",
"VLAN",
"interface",
".",
"If",
"this",
"is",
"an",
"inline",
"interface",
"you",
"can",
"specify",
"two",
"interface",
"values",
"to",
"create",
"unique",
"VLANs",
"on",
"both",
"sides",
"of",
"the",
"inline",... | train | https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/core/interfaces.py#L1781-L1796 |
gabstopper/smc-python | smc/core/interfaces.py | AllInterfaces.get | def get(self, *args, **kwargs):
"""
Get from the interface collection. It is more accurate to use
kwargs to specify an attribute of the sub interface to retrieve
rather than using an index value. If retrieving using an index,
the collection will first check vlan interfaces and st... | python | def get(self, *args, **kwargs):
"""
Get from the interface collection. It is more accurate to use
kwargs to specify an attribute of the sub interface to retrieve
rather than using an index value. If retrieving using an index,
the collection will first check vlan interfaces and st... | [
"def",
"get",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"for",
"collection",
"in",
"self",
".",
"items",
":",
"if",
"args",
":",
"index",
"=",
"args",
"[",
"0",
"]",
"if",
"len",
"(",
"collection",
")",
"and",
"(",
"inde... | Get from the interface collection. It is more accurate to use
kwargs to specify an attribute of the sub interface to retrieve
rather than using an index value. If retrieving using an index,
the collection will first check vlan interfaces and standard
interfaces second. In most cases, if ... | [
"Get",
"from",
"the",
"interface",
"collection",
".",
"It",
"is",
"more",
"accurate",
"to",
"use",
"kwargs",
"to",
"specify",
"an",
"attribute",
"of",
"the",
"sub",
"interface",
"to",
"retrieve",
"rather",
"than",
"using",
"an",
"index",
"value",
".",
"If"... | train | https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/core/interfaces.py#L1833-L1857 |
gabstopper/smc-python | smc/core/interfaces.py | VlanCollection.get_vlan | def get_vlan(self, *args, **kwargs):
"""
Get the VLAN from this PhysicalInterface.
Use args if you want to specify only the VLAN id. Otherwise
you can specify a valid attribute for the VLAN sub interface
such as `address` for example::
>>> vlan = itf.vlan_int... | python | def get_vlan(self, *args, **kwargs):
"""
Get the VLAN from this PhysicalInterface.
Use args if you want to specify only the VLAN id. Otherwise
you can specify a valid attribute for the VLAN sub interface
such as `address` for example::
>>> vlan = itf.vlan_int... | [
"def",
"get_vlan",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"args",
":",
"kwargs",
"=",
"{",
"'vlan_id'",
":",
"str",
"(",
"args",
"[",
"0",
"]",
")",
"}",
"key",
",",
"value",
"=",
"kwargs",
".",
"popitem",
"(",
... | Get the VLAN from this PhysicalInterface.
Use args if you want to specify only the VLAN id. Otherwise
you can specify a valid attribute for the VLAN sub interface
such as `address` for example::
>>> vlan = itf.vlan_interface.get_vlan(4)
>>> vlan
Layer... | [
"Get",
"the",
"VLAN",
"from",
"this",
"PhysicalInterface",
".",
"Use",
"args",
"if",
"you",
"want",
"to",
"specify",
"only",
"the",
"VLAN",
"id",
".",
"Otherwise",
"you",
"can",
"specify",
"a",
"valid",
"attribute",
"for",
"the",
"VLAN",
"sub",
"interface"... | train | https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/core/interfaces.py#L1886-L1911 |
gabstopper/smc-python | smc/core/interfaces.py | VlanCollection.get | def get(self, *args, **kwargs):
"""
Get the sub interfaces for this VlanInterface
>>> itf = engine.interface.get(3)
>>> list(itf.vlan_interface)
[Layer3PhysicalInterfaceVlan(name=VLAN 3.3), Layer3PhysicalInterfaceVlan(name=VLAN 3.5),
Layer3Physica... | python | def get(self, *args, **kwargs):
"""
Get the sub interfaces for this VlanInterface
>>> itf = engine.interface.get(3)
>>> list(itf.vlan_interface)
[Layer3PhysicalInterfaceVlan(name=VLAN 3.3), Layer3PhysicalInterfaceVlan(name=VLAN 3.5),
Layer3Physica... | [
"def",
"get",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"args",
":",
"kwargs",
"=",
"{",
"'vlan_id'",
":",
"str",
"(",
"args",
"[",
"0",
"]",
")",
"}",
"key",
",",
"value",
"=",
"kwargs",
".",
"popitem",
"(",
")"... | Get the sub interfaces for this VlanInterface
>>> itf = engine.interface.get(3)
>>> list(itf.vlan_interface)
[Layer3PhysicalInterfaceVlan(name=VLAN 3.3), Layer3PhysicalInterfaceVlan(name=VLAN 3.5),
Layer3PhysicalInterfaceVlan(name=VLAN 3.4)]
:par... | [
"Get",
"the",
"sub",
"interfaces",
"for",
"this",
"VlanInterface",
">>>",
"itf",
"=",
"engine",
".",
"interface",
".",
"get",
"(",
"3",
")",
">>>",
"list",
"(",
"itf",
".",
"vlan_interface",
")",
"[",
"Layer3PhysicalInterfaceVlan",
"(",
"name",
"=",
"VLAN"... | train | https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/core/interfaces.py#L1913-L1934 |
gabstopper/smc-python | smc/core/interfaces.py | InterfaceEditor.find_mgmt_interface | def find_mgmt_interface(self, mgmt):
"""
Find the management interface specified and return
either the string representation of the interface_id.
Valid options: primary_mgt, backup_mgt, primary_heartbeat,
backup_heartbeat, outgoing, auth_request
:ret... | python | def find_mgmt_interface(self, mgmt):
"""
Find the management interface specified and return
either the string representation of the interface_id.
Valid options: primary_mgt, backup_mgt, primary_heartbeat,
backup_heartbeat, outgoing, auth_request
:ret... | [
"def",
"find_mgmt_interface",
"(",
"self",
",",
"mgmt",
")",
":",
"for",
"intf",
"in",
"self",
":",
"for",
"allitf",
"in",
"intf",
".",
"all_interfaces",
":",
"if",
"isinstance",
"(",
"allitf",
",",
"VlanInterface",
")",
":",
"for",
"vlan",
"in",
"allitf... | Find the management interface specified and return
either the string representation of the interface_id.
Valid options: primary_mgt, backup_mgt, primary_heartbeat,
backup_heartbeat, outgoing, auth_request
:return: str interface_id | [
"Find",
"the",
"management",
"interface",
"specified",
"and",
"return",
"either",
"the",
"string",
"representation",
"of",
"the",
"interface_id",
".",
"Valid",
"options",
":",
"primary_mgt",
"backup_mgt",
"primary_heartbeat",
"backup_heartbeat",
"outgoing",
"auth_reques... | train | https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/core/interfaces.py#L1976-L1994 |
gabstopper/smc-python | smc/core/interfaces.py | InterfaceEditor.get | def get(self, interface_id):
"""
Get the interface from engine json
:param str interface_id: interface ID to find
:raises InterfaceNotFound: Cannot find interface
"""
# From within engine, skips nested iterators for this find
# Make sure were dealing with... | python | def get(self, interface_id):
"""
Get the interface from engine json
:param str interface_id: interface ID to find
:raises InterfaceNotFound: Cannot find interface
"""
# From within engine, skips nested iterators for this find
# Make sure were dealing with... | [
"def",
"get",
"(",
"self",
",",
"interface_id",
")",
":",
"# From within engine, skips nested iterators for this find",
"# Make sure were dealing with a string",
"interface_id",
"=",
"str",
"(",
"interface_id",
")",
"for",
"intf",
"in",
"self",
":",
"if",
"intf",
".",
... | Get the interface from engine json
:param str interface_id: interface ID to find
:raises InterfaceNotFound: Cannot find interface | [
"Get",
"the",
"interface",
"from",
"engine",
"json",
":",
"param",
"str",
"interface_id",
":",
"interface",
"ID",
"to",
"find",
":",
"raises",
"InterfaceNotFound",
":",
"Cannot",
"find",
"interface"
] | train | https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/core/interfaces.py#L1996-L2029 |
gabstopper/smc-python | smc/core/interfaces.py | InterfaceEditor.set_unset | def set_unset(self, interface_id, attribute, address=None):
"""
Set attribute to True and unset the same attribute for all other
interfaces. This is used for interface options that can only be
set on one engine interface.
:raises InterfaceNotFound: raise if specified ad... | python | def set_unset(self, interface_id, attribute, address=None):
"""
Set attribute to True and unset the same attribute for all other
interfaces. This is used for interface options that can only be
set on one engine interface.
:raises InterfaceNotFound: raise if specified ad... | [
"def",
"set_unset",
"(",
"self",
",",
"interface_id",
",",
"attribute",
",",
"address",
"=",
"None",
")",
":",
"interface",
"=",
"self",
".",
"get",
"(",
"interface_id",
")",
"if",
"interface_id",
"is",
"not",
"None",
"else",
"None",
"if",
"address",
"is... | Set attribute to True and unset the same attribute for all other
interfaces. This is used for interface options that can only be
set on one engine interface.
:raises InterfaceNotFound: raise if specified address does not exist or
if the interface is not supported for this m... | [
"Set",
"attribute",
"to",
"True",
"and",
"unset",
"the",
"same",
"attribute",
"for",
"all",
"other",
"interfaces",
".",
"This",
"is",
"used",
"for",
"interface",
"options",
"that",
"can",
"only",
"be",
"set",
"on",
"one",
"engine",
"interface",
".",
":",
... | train | https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/core/interfaces.py#L2031-L2067 |
gabstopper/smc-python | smc/core/interfaces.py | InterfaceEditor.set_auth_request | def set_auth_request(self, interface_id, address=None):
"""
Set auth request, there can only be one per engine so unset all
other interfaces. If this is a cluster, auth request can only be
set on an interface with a CVI (not valid on NDI only cluster
interfaces).
If this ... | python | def set_auth_request(self, interface_id, address=None):
"""
Set auth request, there can only be one per engine so unset all
other interfaces. If this is a cluster, auth request can only be
set on an interface with a CVI (not valid on NDI only cluster
interfaces).
If this ... | [
"def",
"set_auth_request",
"(",
"self",
",",
"interface_id",
",",
"address",
"=",
"None",
")",
":",
"for",
"engine_type",
"in",
"[",
"'master'",
",",
"'layer2'",
",",
"'ips'",
"]",
":",
"if",
"engine_type",
"in",
"self",
".",
"engine",
".",
"type",
":",
... | Set auth request, there can only be one per engine so unset all
other interfaces. If this is a cluster, auth request can only be
set on an interface with a CVI (not valid on NDI only cluster
interfaces).
If this is a cluster interface, address should be CVI IP. | [
"Set",
"auth",
"request",
"there",
"can",
"only",
"be",
"one",
"per",
"engine",
"so",
"unset",
"all",
"other",
"interfaces",
".",
"If",
"this",
"is",
"a",
"cluster",
"auth",
"request",
"can",
"only",
"be",
"set",
"on",
"an",
"interface",
"with",
"a",
"... | train | https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/core/interfaces.py#L2069-L2114 |
gabstopper/smc-python | smc/routing/bgp.py | as_dotted | def as_dotted(dotted_str):
"""
Implement RFC 5396 to support 'asdotted' notation for BGP AS numbers.
Provide a string in format of '1.10', '65000.65015' and this will return
a 4-byte decimal representation of the AS number.
Get the binary values for the int's and pad to 16 bits if necessary
(val... | python | def as_dotted(dotted_str):
"""
Implement RFC 5396 to support 'asdotted' notation for BGP AS numbers.
Provide a string in format of '1.10', '65000.65015' and this will return
a 4-byte decimal representation of the AS number.
Get the binary values for the int's and pad to 16 bits if necessary
(val... | [
"def",
"as_dotted",
"(",
"dotted_str",
")",
":",
"#max_asn = 4294967295 (65535 * 65535)",
"if",
"'.'",
"not",
"in",
"dotted_str",
":",
"return",
"dotted_str",
"max_byte",
"=",
"65535",
"left",
",",
"right",
"=",
"map",
"(",
"int",
",",
"dotted_str",
".",
"spli... | Implement RFC 5396 to support 'asdotted' notation for BGP AS numbers.
Provide a string in format of '1.10', '65000.65015' and this will return
a 4-byte decimal representation of the AS number.
Get the binary values for the int's and pad to 16 bits if necessary
(values <255). Concatenate the first 2 byte... | [
"Implement",
"RFC",
"5396",
"to",
"support",
"asdotted",
"notation",
"for",
"BGP",
"AS",
"numbers",
".",
"Provide",
"a",
"string",
"in",
"format",
"of",
"1",
".",
"10",
"65000",
".",
"65015",
"and",
"this",
"will",
"return",
"a",
"4",
"-",
"byte",
"dec... | train | https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/routing/bgp.py#L289-L312 |
gabstopper/smc-python | smc/routing/bgp.py | DynamicRouting.update_antispoofing | def update_antispoofing(self, networks=None):
"""
Pass a list of networks to update antispoofing networks with.
You can clear networks by providing an empty list. If networks
are provided but already exist, no update is made.
:param list networks: networks, groups or hos... | python | def update_antispoofing(self, networks=None):
"""
Pass a list of networks to update antispoofing networks with.
You can clear networks by providing an empty list. If networks
are provided but already exist, no update is made.
:param list networks: networks, groups or hos... | [
"def",
"update_antispoofing",
"(",
"self",
",",
"networks",
"=",
"None",
")",
":",
"if",
"not",
"networks",
"and",
"len",
"(",
"self",
".",
"data",
".",
"get",
"(",
"'antispoofing_ne_ref'",
")",
")",
":",
"self",
".",
"data",
".",
"update",
"(",
"antis... | Pass a list of networks to update antispoofing networks with.
You can clear networks by providing an empty list. If networks
are provided but already exist, no update is made.
:param list networks: networks, groups or hosts for antispoofing
:rtype: bool | [
"Pass",
"a",
"list",
"of",
"networks",
"to",
"update",
"antispoofing",
"networks",
"with",
".",
"You",
"can",
"clear",
"networks",
"by",
"providing",
"an",
"empty",
"list",
".",
"If",
"networks",
"are",
"provided",
"but",
"already",
"exist",
"no",
"update",
... | train | https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/routing/bgp.py#L71-L87 |
gabstopper/smc-python | smc/routing/bgp.py | BGP.enable | def enable(self, autonomous_system, announced_networks,
router_id=None, bgp_profile=None):
"""
Enable BGP on this engine. On master engine, enable BGP on the
virtual firewall. When adding networks to `announced_networks`, the
element types can be of type :class:`smc.elemen... | python | def enable(self, autonomous_system, announced_networks,
router_id=None, bgp_profile=None):
"""
Enable BGP on this engine. On master engine, enable BGP on the
virtual firewall. When adding networks to `announced_networks`, the
element types can be of type :class:`smc.elemen... | [
"def",
"enable",
"(",
"self",
",",
"autonomous_system",
",",
"announced_networks",
",",
"router_id",
"=",
"None",
",",
"bgp_profile",
"=",
"None",
")",
":",
"autonomous_system",
"=",
"element_resolver",
"(",
"autonomous_system",
")",
"bgp_profile",
"=",
"element_r... | Enable BGP on this engine. On master engine, enable BGP on the
virtual firewall. When adding networks to `announced_networks`, the
element types can be of type :class:`smc.elements.network.Host`,
:class:`smc.elements.network.Network` or :class:`smc.elements.group.Group`.
If passing a Gro... | [
"Enable",
"BGP",
"on",
"this",
"engine",
".",
"On",
"master",
"engine",
"enable",
"BGP",
"on",
"the",
"virtual",
"firewall",
".",
"When",
"adding",
"networks",
"to",
"announced_networks",
"the",
"element",
"types",
"can",
"be",
"of",
"type",
":",
"class",
... | train | https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/routing/bgp.py#L166-L212 |
gabstopper/smc-python | smc/routing/bgp.py | BGP.update_configuration | def update_configuration(self, **kwargs):
"""
Update configuration using valid kwargs as defined in
the enable constructor.
:param dict kwargs: kwargs to satisfy valid args from `enable`
:rtype: bool
"""
updated = False
if 'announced_networks' in ... | python | def update_configuration(self, **kwargs):
"""
Update configuration using valid kwargs as defined in
the enable constructor.
:param dict kwargs: kwargs to satisfy valid args from `enable`
:rtype: bool
"""
updated = False
if 'announced_networks' in ... | [
"def",
"update_configuration",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"updated",
"=",
"False",
"if",
"'announced_networks'",
"in",
"kwargs",
":",
"kwargs",
".",
"update",
"(",
"announced_ne_setting",
"=",
"kwargs",
".",
"pop",
"(",
"'announced_network... | Update configuration using valid kwargs as defined in
the enable constructor.
:param dict kwargs: kwargs to satisfy valid args from `enable`
:rtype: bool | [
"Update",
"configuration",
"using",
"valid",
"kwargs",
"as",
"defined",
"in",
"the",
"enable",
"constructor",
".",
":",
"param",
"dict",
"kwargs",
":",
"kwargs",
"to",
"satisfy",
"valid",
"args",
"from",
"enable",
":",
"rtype",
":",
"bool"
] | train | https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/routing/bgp.py#L214-L246 |
gabstopper/smc-python | smc/routing/bgp.py | BGP.announced_networks | def announced_networks(self):
"""
Show all announced networks for the BGP configuration.
Returns tuple of advertised network, routemap. Route
map may be None.
::
for advertised in engine.bgp.advertisements:
net, route_map = advertised
... | python | def announced_networks(self):
"""
Show all announced networks for the BGP configuration.
Returns tuple of advertised network, routemap. Route
map may be None.
::
for advertised in engine.bgp.advertisements:
net, route_map = advertised
... | [
"def",
"announced_networks",
"(",
"self",
")",
":",
"return",
"[",
"(",
"Element",
".",
"from_href",
"(",
"ne",
".",
"get",
"(",
"'announced_ne_ref'",
")",
")",
",",
"Element",
".",
"from_href",
"(",
"ne",
".",
"get",
"(",
"'announced_rm_ref'",
")",
")",... | Show all announced networks for the BGP configuration.
Returns tuple of advertised network, routemap. Route
map may be None.
::
for advertised in engine.bgp.advertisements:
net, route_map = advertised
:return: list of tuples (advertised_netwo... | [
"Show",
"all",
"announced",
"networks",
"for",
"the",
"BGP",
"configuration",
".",
"Returns",
"tuple",
"of",
"advertised",
"network",
"routemap",
".",
"Route",
"map",
"may",
"be",
"None",
".",
"::",
"for",
"advertised",
"in",
"engine",
".",
"bgp",
".",
"ad... | train | https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/routing/bgp.py#L271-L285 |
gabstopper/smc-python | smc/routing/bgp.py | AutonomousSystem.create | def create(cls, name, as_number, comment=None):
"""
Create an AS to be applied on the engine BGP configuration. An
AS is a required parameter when creating an ExternalBGPPeer. You
can also provide an AS number using an 'asdot' syntax::
AutonomousSystem.create(name='m... | python | def create(cls, name, as_number, comment=None):
"""
Create an AS to be applied on the engine BGP configuration. An
AS is a required parameter when creating an ExternalBGPPeer. You
can also provide an AS number using an 'asdot' syntax::
AutonomousSystem.create(name='m... | [
"def",
"create",
"(",
"cls",
",",
"name",
",",
"as_number",
",",
"comment",
"=",
"None",
")",
":",
"as_number",
"=",
"as_dotted",
"(",
"str",
"(",
"as_number",
")",
")",
"json",
"=",
"{",
"'name'",
":",
"name",
",",
"'as_number'",
":",
"as_number",
"... | Create an AS to be applied on the engine BGP configuration. An
AS is a required parameter when creating an ExternalBGPPeer. You
can also provide an AS number using an 'asdot' syntax::
AutonomousSystem.create(name='myas', as_number='200.600')
:param str name: name of this AS... | [
"Create",
"an",
"AS",
"to",
"be",
"applied",
"on",
"the",
"engine",
"BGP",
"configuration",
".",
"An",
"AS",
"is",
"a",
"required",
"parameter",
"when",
"creating",
"an",
"ExternalBGPPeer",
".",
"You",
"can",
"also",
"provide",
"an",
"AS",
"number",
"using... | train | https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/routing/bgp.py#L324-L346 |
gabstopper/smc-python | smc/routing/bgp.py | BGPProfile.create | def create(cls, name, port=179, external_distance=20, internal_distance=200,
local_distance=200, subnet_distance=None):
"""
Create a custom BGP Profile
:param str name: name of profile
:param int port: port for BGP process
:param int external_distance: external ad... | python | def create(cls, name, port=179, external_distance=20, internal_distance=200,
local_distance=200, subnet_distance=None):
"""
Create a custom BGP Profile
:param str name: name of profile
:param int port: port for BGP process
:param int external_distance: external ad... | [
"def",
"create",
"(",
"cls",
",",
"name",
",",
"port",
"=",
"179",
",",
"external_distance",
"=",
"20",
",",
"internal_distance",
"=",
"200",
",",
"local_distance",
"=",
"200",
",",
"subnet_distance",
"=",
"None",
")",
":",
"json",
"=",
"{",
"'name'",
... | Create a custom BGP Profile
:param str name: name of profile
:param int port: port for BGP process
:param int external_distance: external administrative distance; (1-255)
:param int internal_distance: internal administrative distance (1-255)
:param int local_distance: local admi... | [
"Create",
"a",
"custom",
"BGP",
"Profile"
] | train | https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/routing/bgp.py#L393-L420 |
gabstopper/smc-python | smc/routing/bgp.py | BGPProfile.subnet_distance | def subnet_distance(self):
"""
Specific subnet administrative distances
:return: list of tuple (subnet, distance)
"""
return [(Element.from_href(entry.get('subnet')), entry.get('distance'))
for entry in self.data.get('distance_entry')] | python | def subnet_distance(self):
"""
Specific subnet administrative distances
:return: list of tuple (subnet, distance)
"""
return [(Element.from_href(entry.get('subnet')), entry.get('distance'))
for entry in self.data.get('distance_entry')] | [
"def",
"subnet_distance",
"(",
"self",
")",
":",
"return",
"[",
"(",
"Element",
".",
"from_href",
"(",
"entry",
".",
"get",
"(",
"'subnet'",
")",
")",
",",
"entry",
".",
"get",
"(",
"'distance'",
")",
")",
"for",
"entry",
"in",
"self",
".",
"data",
... | Specific subnet administrative distances
:return: list of tuple (subnet, distance) | [
"Specific",
"subnet",
"administrative",
"distances"
] | train | https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/routing/bgp.py#L463-L470 |
gabstopper/smc-python | smc/routing/bgp.py | ExternalBGPPeer.create | def create(cls, name, neighbor_as, neighbor_ip,
neighbor_port=179, comment=None):
"""
Create an external BGP Peer.
:param str name: name of peer
:param str,AutonomousSystem neighbor_as_ref: AutonomousSystem
element or href.
:param str neighbor_ip: ip... | python | def create(cls, name, neighbor_as, neighbor_ip,
neighbor_port=179, comment=None):
"""
Create an external BGP Peer.
:param str name: name of peer
:param str,AutonomousSystem neighbor_as_ref: AutonomousSystem
element or href.
:param str neighbor_ip: ip... | [
"def",
"create",
"(",
"cls",
",",
"name",
",",
"neighbor_as",
",",
"neighbor_ip",
",",
"neighbor_port",
"=",
"179",
",",
"comment",
"=",
"None",
")",
":",
"json",
"=",
"{",
"'name'",
":",
"name",
",",
"'neighbor_ip'",
":",
"neighbor_ip",
",",
"'neighbor_... | Create an external BGP Peer.
:param str name: name of peer
:param str,AutonomousSystem neighbor_as_ref: AutonomousSystem
element or href.
:param str neighbor_ip: ip address of BGP peer
:param int neighbor_port: port for BGP, default 179.
:raises CreateElementFailed... | [
"Create",
"an",
"external",
"BGP",
"Peer",
"."
] | train | https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/routing/bgp.py#L490-L512 |
gabstopper/smc-python | smc/routing/bgp.py | BGPPeering.create | def create(cls, name, connection_profile_ref=None,
md5_password=None, local_as_option='not_set',
max_prefix_option='not_enabled', send_community='no',
connected_check='disabled', orf_option='disabled',
next_hop_self=True, override_capability=False,
... | python | def create(cls, name, connection_profile_ref=None,
md5_password=None, local_as_option='not_set',
max_prefix_option='not_enabled', send_community='no',
connected_check='disabled', orf_option='disabled',
next_hop_self=True, override_capability=False,
... | [
"def",
"create",
"(",
"cls",
",",
"name",
",",
"connection_profile_ref",
"=",
"None",
",",
"md5_password",
"=",
"None",
",",
"local_as_option",
"=",
"'not_set'",
",",
"max_prefix_option",
"=",
"'not_enabled'",
",",
"send_community",
"=",
"'no'",
",",
"connected_... | Create a new BGPPeering configuration.
:param str name: name of peering
:param str,BGPConnectionProfile connection_profile_ref: required BGP
connection profile. System default used if not provided.
:param str md5_password: optional md5_password
:param str local_as_option: th... | [
"Create",
"a",
"new",
"BGPPeering",
"configuration",
"."
] | train | https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/routing/bgp.py#L554-L614 |
gabstopper/smc-python | smc/routing/bgp.py | BGPConnectionProfile.create | def create(cls, name, md5_password=None, connect_retry=120,
session_hold_timer=180, session_keep_alive=60):
"""
Create a new BGP Connection Profile.
:param str name: name of profile
:param str md5_password: optional md5 password
:param int connect_retry: The conne... | python | def create(cls, name, md5_password=None, connect_retry=120,
session_hold_timer=180, session_keep_alive=60):
"""
Create a new BGP Connection Profile.
:param str name: name of profile
:param str md5_password: optional md5 password
:param int connect_retry: The conne... | [
"def",
"create",
"(",
"cls",
",",
"name",
",",
"md5_password",
"=",
"None",
",",
"connect_retry",
"=",
"120",
",",
"session_hold_timer",
"=",
"180",
",",
"session_keep_alive",
"=",
"60",
")",
":",
"json",
"=",
"{",
"'name'",
":",
"name",
",",
"'connect'"... | Create a new BGP Connection Profile.
:param str name: name of profile
:param str md5_password: optional md5 password
:param int connect_retry: The connect retry timer, in seconds
:param int session_hold_timer: The session hold timer, in seconds
:param int session_keep_alive: The... | [
"Create",
"a",
"new",
"BGP",
"Connection",
"Profile",
"."
] | train | https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/routing/bgp.py#L634-L656 |
gabstopper/smc-python | smc/administration/role.py | Role.enable | def enable(self, values):
"""
Enable specific permissions on this role. Use :py:attr:`~permissions` to
view valid permission settings and current value/s. Change is committed
immediately.
:param list values: list of values by allowed types
:return: None
"... | python | def enable(self, values):
"""
Enable specific permissions on this role. Use :py:attr:`~permissions` to
view valid permission settings and current value/s. Change is committed
immediately.
:param list values: list of values by allowed types
:return: None
"... | [
"def",
"enable",
"(",
"self",
",",
"values",
")",
":",
"for",
"value",
"in",
"values",
":",
"if",
"value",
"in",
"self",
".",
"data",
":",
"self",
".",
"data",
"[",
"value",
"]",
"=",
"True"
] | Enable specific permissions on this role. Use :py:attr:`~permissions` to
view valid permission settings and current value/s. Change is committed
immediately.
:param list values: list of values by allowed types
:return: None | [
"Enable",
"specific",
"permissions",
"on",
"this",
"role",
".",
"Use",
":",
"py",
":",
"attr",
":",
"~permissions",
"to",
"view",
"valid",
"permission",
"settings",
"and",
"current",
"value",
"/",
"s",
".",
"Change",
"is",
"committed",
"immediately",
".",
... | train | https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/administration/role.py#L88-L99 |
gabstopper/smc-python | smc/administration/role.py | Role.disable | def disable(self, values):
"""
Disable specific permissions on this role. Use :py:attr:`~permissions` to
view valid permission settings and current value/s. Change is committed
immediately.
:param list values: list of values by allowed types
:return: None
... | python | def disable(self, values):
"""
Disable specific permissions on this role. Use :py:attr:`~permissions` to
view valid permission settings and current value/s. Change is committed
immediately.
:param list values: list of values by allowed types
:return: None
... | [
"def",
"disable",
"(",
"self",
",",
"values",
")",
":",
"for",
"value",
"in",
"values",
":",
"if",
"value",
"in",
"self",
".",
"data",
":",
"self",
".",
"data",
"[",
"value",
"]",
"=",
"False"
] | Disable specific permissions on this role. Use :py:attr:`~permissions` to
view valid permission settings and current value/s. Change is committed
immediately.
:param list values: list of values by allowed types
:return: None | [
"Disable",
"specific",
"permissions",
"on",
"this",
"role",
".",
"Use",
":",
"py",
":",
"attr",
":",
"~permissions",
"to",
"view",
"valid",
"permission",
"settings",
"and",
"current",
"value",
"/",
"s",
".",
"Change",
"is",
"committed",
"immediately",
".",
... | train | https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/administration/role.py#L101-L112 |
gabstopper/smc-python | smc/administration/role.py | Role.permissions | def permissions(self):
"""
Return valid permissions and setting for this role. Permissions are
returned as a list of dict items, {permission: state}. State for the
permission is either True or False. Use :meth:`~enable` and
:meth:`~disable` to toggle role settings.
... | python | def permissions(self):
"""
Return valid permissions and setting for this role. Permissions are
returned as a list of dict items, {permission: state}. State for the
permission is either True or False. Use :meth:`~enable` and
:meth:`~disable` to toggle role settings.
... | [
"def",
"permissions",
"(",
"self",
")",
":",
"permissions",
"=",
"[",
"]",
"for",
"permission",
",",
"value",
"in",
"self",
".",
"data",
".",
"items",
"(",
")",
":",
"if",
"permission",
"not",
"in",
"self",
".",
"_reserved",
":",
"permissions",
".",
... | Return valid permissions and setting for this role. Permissions are
returned as a list of dict items, {permission: state}. State for the
permission is either True or False. Use :meth:`~enable` and
:meth:`~disable` to toggle role settings.
:return: list of permission settings
... | [
"Return",
"valid",
"permissions",
"and",
"setting",
"for",
"this",
"role",
".",
"Permissions",
"are",
"returned",
"as",
"a",
"list",
"of",
"dict",
"items",
"{",
"permission",
":",
"state",
"}",
".",
"State",
"for",
"the",
"permission",
"is",
"either",
"Tru... | train | https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/administration/role.py#L115-L129 |
gabstopper/smc-python | smc/policy/rule_nat.py | _extract_ports | def _extract_ports(port_string):
"""
Return a dict for translated_value based on a string or int
value.
Value could be 80, or '80' or '80-90'.
Will be returned as {'min_port': 80, 'max_port': 80} or
{'min_port': 80, 'max_port': 90}
:rtype: dict
"""
_ports = str(port_s... | python | def _extract_ports(port_string):
"""
Return a dict for translated_value based on a string or int
value.
Value could be 80, or '80' or '80-90'.
Will be returned as {'min_port': 80, 'max_port': 80} or
{'min_port': 80, 'max_port': 90}
:rtype: dict
"""
_ports = str(port_s... | [
"def",
"_extract_ports",
"(",
"port_string",
")",
":",
"_ports",
"=",
"str",
"(",
"port_string",
")",
"if",
"'-'",
"in",
"_ports",
":",
"start",
",",
"end",
"=",
"_ports",
".",
"split",
"(",
"'-'",
")",
"return",
"{",
"'min_port'",
":",
"start",
",",
... | Return a dict for translated_value based on a string or int
value.
Value could be 80, or '80' or '80-90'.
Will be returned as {'min_port': 80, 'max_port': 80} or
{'min_port': 80, 'max_port': 90}
:rtype: dict | [
"Return",
"a",
"dict",
"for",
"translated_value",
"based",
"on",
"a",
"string",
"or",
"int",
"value",
".",
"Value",
"could",
"be",
"80",
"or",
"80",
"or",
"80",
"-",
"90",
".",
"Will",
"be",
"returned",
"as",
"{",
"min_port",
":",
"80",
"max_port",
"... | train | https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/policy/rule_nat.py#L455-L471 |
gabstopper/smc-python | smc/policy/rule_nat.py | NATRule._update_nat_field | def _update_nat_field(self, source_or_dest):
"""
If the source or destination field of a rule is changed and the rule
is a NAT rule, this method will check to see if the changed field
maps to a NAT type and modifies the `original_value` field within
the NAT dict to reflect the ne... | python | def _update_nat_field(self, source_or_dest):
"""
If the source or destination field of a rule is changed and the rule
is a NAT rule, this method will check to see if the changed field
maps to a NAT type and modifies the `original_value` field within
the NAT dict to reflect the ne... | [
"def",
"_update_nat_field",
"(",
"self",
",",
"source_or_dest",
")",
":",
"original_value",
"=",
"source_or_dest",
".",
"all_as_href",
"(",
")",
"if",
"original_value",
":",
"nat_element",
"=",
"None",
"if",
"'src'",
"in",
"source_or_dest",
".",
"typeof",
"and",... | If the source or destination field of a rule is changed and the rule
is a NAT rule, this method will check to see if the changed field
maps to a NAT type and modifies the `original_value` field within
the NAT dict to reflect the new element reference. It is possible
that a NAT rule doesn... | [
"If",
"the",
"source",
"or",
"destination",
"field",
"of",
"a",
"rule",
"is",
"changed",
"and",
"the",
"rule",
"is",
"a",
"NAT",
"rule",
"this",
"method",
"will",
"check",
"to",
"see",
"if",
"the",
"changed",
"field",
"maps",
"to",
"a",
"NAT",
"type",
... | train | https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/policy/rule_nat.py#L31-L54 |
gabstopper/smc-python | smc/policy/rule_nat.py | NATValue._update_field | def _update_field(self, natvalue):
"""
Update this NATValue if values are different
:rtype: bool
"""
updated = False
if natvalue.element and natvalue.element != self.element:
self.update(element=natvalue.element)
self.pop('ip_descriptor', ... | python | def _update_field(self, natvalue):
"""
Update this NATValue if values are different
:rtype: bool
"""
updated = False
if natvalue.element and natvalue.element != self.element:
self.update(element=natvalue.element)
self.pop('ip_descriptor', ... | [
"def",
"_update_field",
"(",
"self",
",",
"natvalue",
")",
":",
"updated",
"=",
"False",
"if",
"natvalue",
".",
"element",
"and",
"natvalue",
".",
"element",
"!=",
"self",
".",
"element",
":",
"self",
".",
"update",
"(",
"element",
"=",
"natvalue",
".",
... | Update this NATValue if values are different
:rtype: bool | [
"Update",
"this",
"NATValue",
"if",
"values",
"are",
"different",
":",
"rtype",
":",
"bool"
] | train | https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/policy/rule_nat.py#L112-L135 |
gabstopper/smc-python | smc/policy/rule_nat.py | NATElement.update_field | def update_field(self, element_or_ip_address=None,
start_port=None, end_port=None, **kw):
"""
Update the source NAT translation on this rule.
You must call `save` or `update` on the rule to make this
modification. To update the source target for this NAT rule, update
... | python | def update_field(self, element_or_ip_address=None,
start_port=None, end_port=None, **kw):
"""
Update the source NAT translation on this rule.
You must call `save` or `update` on the rule to make this
modification. To update the source target for this NAT rule, update
... | [
"def",
"update_field",
"(",
"self",
",",
"element_or_ip_address",
"=",
"None",
",",
"start_port",
"=",
"None",
",",
"end_port",
"=",
"None",
",",
"*",
"*",
"kw",
")",
":",
"updated",
"=",
"False",
"src",
"=",
"_resolve_nat_element",
"(",
"element_or_ip_addre... | Update the source NAT translation on this rule.
You must call `save` or `update` on the rule to make this
modification. To update the source target for this NAT rule, update
the source field directly using rule.sources.update_field(...).
This will automatically update the NAT value. This... | [
"Update",
"the",
"source",
"NAT",
"translation",
"on",
"this",
"rule",
".",
"You",
"must",
"call",
"save",
"or",
"update",
"on",
"the",
"rule",
"to",
"make",
"this",
"modification",
".",
"To",
"update",
"the",
"source",
"target",
"for",
"this",
"NAT",
"r... | train | https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/policy/rule_nat.py#L187-L252 |
gabstopper/smc-python | smc/policy/rule_nat.py | NATElement.translated_value | def translated_value(self):
"""
The translated value for this NAT type. If this rule
does not have a NAT value defined, this will return
None.
:return: NATValue or None
:rtype: NATValue
"""
if self.typeof in self:
return NATValue(self.... | python | def translated_value(self):
"""
The translated value for this NAT type. If this rule
does not have a NAT value defined, this will return
None.
:return: NATValue or None
:rtype: NATValue
"""
if self.typeof in self:
return NATValue(self.... | [
"def",
"translated_value",
"(",
"self",
")",
":",
"if",
"self",
".",
"typeof",
"in",
"self",
":",
"return",
"NATValue",
"(",
"self",
".",
"get",
"(",
"self",
".",
"typeof",
",",
"{",
"}",
")",
".",
"get",
"(",
"'translated_value'",
")",
")"
] | The translated value for this NAT type. If this rule
does not have a NAT value defined, this will return
None.
:return: NATValue or None
:rtype: NATValue | [
"The",
"translated",
"value",
"for",
"this",
"NAT",
"type",
".",
"If",
"this",
"rule",
"does",
"not",
"have",
"a",
"NAT",
"value",
"defined",
"this",
"will",
"return",
"None",
".",
":",
"return",
":",
"NATValue",
"or",
"None",
":",
"rtype",
":",
"NATVa... | train | https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/policy/rule_nat.py#L258-L269 |
gabstopper/smc-python | smc/policy/rule_nat.py | StaticDestNAT.update_field | def update_field(self, element_or_ip_address=None,
original_port=None, translated_port=None, **kw):
"""
Update the destination NAT translation on this rule. You must call
`save` or `update` on the rule to make this modification. The
destination field in the NAT rule determin... | python | def update_field(self, element_or_ip_address=None,
original_port=None, translated_port=None, **kw):
"""
Update the destination NAT translation on this rule. You must call
`save` or `update` on the rule to make this modification. The
destination field in the NAT rule determin... | [
"def",
"update_field",
"(",
"self",
",",
"element_or_ip_address",
"=",
"None",
",",
"original_port",
"=",
"None",
",",
"translated_port",
"=",
"None",
",",
"*",
"*",
"kw",
")",
":",
"updated",
"=",
"False",
"src",
"=",
"_resolve_nat_element",
"(",
"element_o... | Update the destination NAT translation on this rule. You must call
`save` or `update` on the rule to make this modification. The
destination field in the NAT rule determines which destination is
the target of the NAT. To change the target, call the
rule.destinations.update_field(...) met... | [
"Update",
"the",
"destination",
"NAT",
"translation",
"on",
"this",
"rule",
".",
"You",
"must",
"call",
"save",
"or",
"update",
"on",
"the",
"rule",
"to",
"make",
"this",
"modification",
".",
"The",
"destination",
"field",
"in",
"the",
"NAT",
"rule",
"dete... | train | https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/policy/rule_nat.py#L293-L380 |
gabstopper/smc-python | smc/policy/rule_nat.py | IPv4NATRule.create | def create(self, name, sources=None, destinations=None, services=None,
dynamic_src_nat=None, dynamic_src_nat_ports=(1024, 65535),
static_src_nat=None, static_dst_nat=None,
static_dst_nat_ports=None, is_disabled=False, used_on=None,
add_pos=None, after=None, be... | python | def create(self, name, sources=None, destinations=None, services=None,
dynamic_src_nat=None, dynamic_src_nat_ports=(1024, 65535),
static_src_nat=None, static_dst_nat=None,
static_dst_nat_ports=None, is_disabled=False, used_on=None,
add_pos=None, after=None, be... | [
"def",
"create",
"(",
"self",
",",
"name",
",",
"sources",
"=",
"None",
",",
"destinations",
"=",
"None",
",",
"services",
"=",
"None",
",",
"dynamic_src_nat",
"=",
"None",
",",
"dynamic_src_nat_ports",
"=",
"(",
"1024",
",",
"65535",
")",
",",
"static_s... | Create a NAT rule.
When providing sources/destinations or services, you can provide the
element href, network element or services from ``smc.elements``.
You can also mix href strings with Element types in these fields.
:param str name: name of NAT rule
:param list sources: lis... | [
"Create",
"a",
"NAT",
"rule",
"."
] | train | https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/policy/rule_nat.py#L535-L640 |
GoogleCloudPlatform/google-auth-library-python-httplib2 | google_auth_httplib2.py | AuthorizedHttp.request | def request(self, uri, method='GET', body=None, headers=None,
**kwargs):
"""Implementation of httplib2's Http.request."""
_credential_refresh_attempt = kwargs.pop(
'_credential_refresh_attempt', 0)
# Make a copy of the headers. They will be modified by the credentia... | python | def request(self, uri, method='GET', body=None, headers=None,
**kwargs):
"""Implementation of httplib2's Http.request."""
_credential_refresh_attempt = kwargs.pop(
'_credential_refresh_attempt', 0)
# Make a copy of the headers. They will be modified by the credentia... | [
"def",
"request",
"(",
"self",
",",
"uri",
",",
"method",
"=",
"'GET'",
",",
"body",
"=",
"None",
",",
"headers",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"_credential_refresh_attempt",
"=",
"kwargs",
".",
"pop",
"(",
"'_credential_refresh_attempt'"... | Implementation of httplib2's Http.request. | [
"Implementation",
"of",
"httplib2",
"s",
"Http",
".",
"request",
"."
] | train | https://github.com/GoogleCloudPlatform/google-auth-library-python-httplib2/blob/e7cd722281d1d897fa9ae6e3b6b78ae142778e6e/google_auth_httplib2.py#L178-L228 |
randomsync/robotframework-mqttlibrary | src/MQTTLibrary/MQTTKeywords.py | MQTTKeywords.connect | def connect(self, broker, port=1883, client_id="", clean_session=True):
""" Connect to an MQTT broker. This is a pre-requisite step for publish
and subscribe keywords.
`broker` MQTT broker host
`port` broker port (default 1883)
`client_id` if not specified, a random id is gene... | python | def connect(self, broker, port=1883, client_id="", clean_session=True):
""" Connect to an MQTT broker. This is a pre-requisite step for publish
and subscribe keywords.
`broker` MQTT broker host
`port` broker port (default 1883)
`client_id` if not specified, a random id is gene... | [
"def",
"connect",
"(",
"self",
",",
"broker",
",",
"port",
"=",
"1883",
",",
"client_id",
"=",
"\"\"",
",",
"clean_session",
"=",
"True",
")",
":",
"logger",
".",
"info",
"(",
"'Connecting to %s at port %s'",
"%",
"(",
"broker",
",",
"port",
")",
")",
... | Connect to an MQTT broker. This is a pre-requisite step for publish
and subscribe keywords.
`broker` MQTT broker host
`port` broker port (default 1883)
`client_id` if not specified, a random id is generated
`clean_session` specifies the clean session flag for the connection
... | [
"Connect",
"to",
"an",
"MQTT",
"broker",
".",
"This",
"is",
"a",
"pre",
"-",
"requisite",
"step",
"for",
"publish",
"and",
"subscribe",
"keywords",
"."
] | train | https://github.com/randomsync/robotframework-mqttlibrary/blob/14f20038ccdbb576cc1057ec6736e3685138f59e/src/MQTTLibrary/MQTTKeywords.py#L28-L75 |
randomsync/robotframework-mqttlibrary | src/MQTTLibrary/MQTTKeywords.py | MQTTKeywords.publish | def publish(self, topic, message=None, qos=0, retain=False):
""" Publish a message to a topic with specified qos and retained flag.
It is required that a connection has been established using `Connect`
keyword before using this keyword.
`topic` topic to which the message will be publish... | python | def publish(self, topic, message=None, qos=0, retain=False):
""" Publish a message to a topic with specified qos and retained flag.
It is required that a connection has been established using `Connect`
keyword before using this keyword.
`topic` topic to which the message will be publish... | [
"def",
"publish",
"(",
"self",
",",
"topic",
",",
"message",
"=",
"None",
",",
"qos",
"=",
"0",
",",
"retain",
"=",
"False",
")",
":",
"logger",
".",
"info",
"(",
"'Publish topic: %s, message: %s, qos: %s, retain: %s'",
"%",
"(",
"topic",
",",
"message",
"... | Publish a message to a topic with specified qos and retained flag.
It is required that a connection has been established using `Connect`
keyword before using this keyword.
`topic` topic to which the message will be published
`message` message payload to publish
`qos` qos of th... | [
"Publish",
"a",
"message",
"to",
"a",
"topic",
"with",
"specified",
"qos",
"and",
"retained",
"flag",
".",
"It",
"is",
"required",
"that",
"a",
"connection",
"has",
"been",
"established",
"using",
"Connect",
"keyword",
"before",
"using",
"this",
"keyword",
"... | train | https://github.com/randomsync/robotframework-mqttlibrary/blob/14f20038ccdbb576cc1057ec6736e3685138f59e/src/MQTTLibrary/MQTTKeywords.py#L77-L110 |
randomsync/robotframework-mqttlibrary | src/MQTTLibrary/MQTTKeywords.py | MQTTKeywords.subscribe | def subscribe(self, topic, qos, timeout=1, limit=1):
""" Subscribe to a topic and return a list of message payloads received
within the specified time.
`topic` topic to subscribe to
`qos` quality of service for the subscription
`timeout` duration of subscription. Specify 0... | python | def subscribe(self, topic, qos, timeout=1, limit=1):
""" Subscribe to a topic and return a list of message payloads received
within the specified time.
`topic` topic to subscribe to
`qos` quality of service for the subscription
`timeout` duration of subscription. Specify 0... | [
"def",
"subscribe",
"(",
"self",
",",
"topic",
",",
"qos",
",",
"timeout",
"=",
"1",
",",
"limit",
"=",
"1",
")",
":",
"seconds",
"=",
"convert_time",
"(",
"timeout",
")",
"self",
".",
"_messages",
"[",
"topic",
"]",
"=",
"[",
"]",
"limit",
"=",
... | Subscribe to a topic and return a list of message payloads received
within the specified time.
`topic` topic to subscribe to
`qos` quality of service for the subscription
`timeout` duration of subscription. Specify 0 to enable background looping (async)
`limit` the max nu... | [
"Subscribe",
"to",
"a",
"topic",
"and",
"return",
"a",
"list",
"of",
"message",
"payloads",
"received",
"within",
"the",
"specified",
"time",
"."
] | train | https://github.com/randomsync/robotframework-mqttlibrary/blob/14f20038ccdbb576cc1057ec6736e3685138f59e/src/MQTTLibrary/MQTTKeywords.py#L112-L162 |
randomsync/robotframework-mqttlibrary | src/MQTTLibrary/MQTTKeywords.py | MQTTKeywords.listen | def listen(self, topic, timeout=1, limit=1):
""" Listen to a topic and return a list of message payloads received
within the specified time. Requires an async Subscribe to have been called previously.
`topic` topic to listen to
`timeout` duration to listen
`limit` the max ... | python | def listen(self, topic, timeout=1, limit=1):
""" Listen to a topic and return a list of message payloads received
within the specified time. Requires an async Subscribe to have been called previously.
`topic` topic to listen to
`timeout` duration to listen
`limit` the max ... | [
"def",
"listen",
"(",
"self",
",",
"topic",
",",
"timeout",
"=",
"1",
",",
"limit",
"=",
"1",
")",
":",
"if",
"not",
"self",
".",
"_subscribed",
":",
"logger",
".",
"warn",
"(",
"'Cannot listen when not subscribed to a topic'",
")",
"return",
"[",
"]",
"... | Listen to a topic and return a list of message payloads received
within the specified time. Requires an async Subscribe to have been called previously.
`topic` topic to listen to
`timeout` duration to listen
`limit` the max number of payloads that will be returned. Specify 0
... | [
"Listen",
"to",
"a",
"topic",
"and",
"return",
"a",
"list",
"of",
"message",
"payloads",
"received",
"within",
"the",
"specified",
"time",
".",
"Requires",
"an",
"async",
"Subscribe",
"to",
"have",
"been",
"called",
"previously",
"."
] | train | https://github.com/randomsync/robotframework-mqttlibrary/blob/14f20038ccdbb576cc1057ec6736e3685138f59e/src/MQTTLibrary/MQTTKeywords.py#L164-L223 |
randomsync/robotframework-mqttlibrary | src/MQTTLibrary/MQTTKeywords.py | MQTTKeywords.subscribe_and_validate | def subscribe_and_validate(self, topic, qos, payload, timeout=1):
""" Subscribe to a topic and validate that the specified payload is
received within timeout. It is required that a connection has been
established using `Connect` keyword. The payload can be specified as
a python regular e... | python | def subscribe_and_validate(self, topic, qos, payload, timeout=1):
""" Subscribe to a topic and validate that the specified payload is
received within timeout. It is required that a connection has been
established using `Connect` keyword. The payload can be specified as
a python regular e... | [
"def",
"subscribe_and_validate",
"(",
"self",
",",
"topic",
",",
"qos",
",",
"payload",
",",
"timeout",
"=",
"1",
")",
":",
"seconds",
"=",
"convert_time",
"(",
"timeout",
")",
"self",
".",
"_verified",
"=",
"False",
"logger",
".",
"info",
"(",
"'Subscri... | Subscribe to a topic and validate that the specified payload is
received within timeout. It is required that a connection has been
established using `Connect` keyword. The payload can be specified as
a python regular expression. If the specified payload is not received
within timeout, an... | [
"Subscribe",
"to",
"a",
"topic",
"and",
"validate",
"that",
"the",
"specified",
"payload",
"is",
"received",
"within",
"timeout",
".",
"It",
"is",
"required",
"that",
"a",
"connection",
"has",
"been",
"established",
"using",
"Connect",
"keyword",
".",
"The",
... | train | https://github.com/randomsync/robotframework-mqttlibrary/blob/14f20038ccdbb576cc1057ec6736e3685138f59e/src/MQTTLibrary/MQTTKeywords.py#L225-L260 |
randomsync/robotframework-mqttlibrary | src/MQTTLibrary/MQTTKeywords.py | MQTTKeywords.unsubscribe | def unsubscribe(self, topic):
""" Unsubscribe the client from the specified topic.
`topic` topic to unsubscribe from
Example:
| Unsubscribe | test/mqtt_test |
"""
try:
tmp = self._mqttc
except AttributeError:
logger.info('No MQTT Client ... | python | def unsubscribe(self, topic):
""" Unsubscribe the client from the specified topic.
`topic` topic to unsubscribe from
Example:
| Unsubscribe | test/mqtt_test |
"""
try:
tmp = self._mqttc
except AttributeError:
logger.info('No MQTT Client ... | [
"def",
"unsubscribe",
"(",
"self",
",",
"topic",
")",
":",
"try",
":",
"tmp",
"=",
"self",
".",
"_mqttc",
"except",
"AttributeError",
":",
"logger",
".",
"info",
"(",
"'No MQTT Client instance found so nothing to unsubscribe from.'",
")",
"return",
"if",
"self",
... | Unsubscribe the client from the specified topic.
`topic` topic to unsubscribe from
Example:
| Unsubscribe | test/mqtt_test | | [
"Unsubscribe",
"the",
"client",
"from",
"the",
"specified",
"topic",
"."
] | train | https://github.com/randomsync/robotframework-mqttlibrary/blob/14f20038ccdbb576cc1057ec6736e3685138f59e/src/MQTTLibrary/MQTTKeywords.py#L262-L296 |
randomsync/robotframework-mqttlibrary | src/MQTTLibrary/MQTTKeywords.py | MQTTKeywords.disconnect | def disconnect(self):
""" Disconnect from MQTT Broker.
Example:
| Disconnect |
"""
try:
tmp = self._mqttc
except AttributeError:
logger.info('No MQTT Client instance found so nothing to disconnect from.')
return
self._disconn... | python | def disconnect(self):
""" Disconnect from MQTT Broker.
Example:
| Disconnect |
"""
try:
tmp = self._mqttc
except AttributeError:
logger.info('No MQTT Client instance found so nothing to disconnect from.')
return
self._disconn... | [
"def",
"disconnect",
"(",
"self",
")",
":",
"try",
":",
"tmp",
"=",
"self",
".",
"_mqttc",
"except",
"AttributeError",
":",
"logger",
".",
"info",
"(",
"'No MQTT Client instance found so nothing to disconnect from.'",
")",
"return",
"self",
".",
"_disconnected",
"... | Disconnect from MQTT Broker.
Example:
| Disconnect | | [
"Disconnect",
"from",
"MQTT",
"Broker",
"."
] | train | https://github.com/randomsync/robotframework-mqttlibrary/blob/14f20038ccdbb576cc1057ec6736e3685138f59e/src/MQTTLibrary/MQTTKeywords.py#L298-L323 |
randomsync/robotframework-mqttlibrary | src/MQTTLibrary/MQTTKeywords.py | MQTTKeywords.publish_single | def publish_single(self, topic, payload=None, qos=0, retain=False,
hostname="localhost", port=1883, client_id="", keepalive=60,
will=None, auth=None, tls=None, protocol=mqtt.MQTTv31):
""" Publish a single message and disconnect. This keyword uses the
[http://eclipse.org/paho/cli... | python | def publish_single(self, topic, payload=None, qos=0, retain=False,
hostname="localhost", port=1883, client_id="", keepalive=60,
will=None, auth=None, tls=None, protocol=mqtt.MQTTv31):
""" Publish a single message and disconnect. This keyword uses the
[http://eclipse.org/paho/cli... | [
"def",
"publish_single",
"(",
"self",
",",
"topic",
",",
"payload",
"=",
"None",
",",
"qos",
"=",
"0",
",",
"retain",
"=",
"False",
",",
"hostname",
"=",
"\"localhost\"",
",",
"port",
"=",
"1883",
",",
"client_id",
"=",
"\"\"",
",",
"keepalive",
"=",
... | Publish a single message and disconnect. This keyword uses the
[http://eclipse.org/paho/clients/python/docs/#single|single]
function of publish module.
`topic` topic to which the message will be published
`payload` message payload to publish (default None)
`qos` qos of the mes... | [
"Publish",
"a",
"single",
"message",
"and",
"disconnect",
".",
"This",
"keyword",
"uses",
"the",
"[",
"http",
":",
"//",
"eclipse",
".",
"org",
"/",
"paho",
"/",
"clients",
"/",
"python",
"/",
"docs",
"/",
"#single|single",
"]",
"function",
"of",
"publis... | train | https://github.com/randomsync/robotframework-mqttlibrary/blob/14f20038ccdbb576cc1057ec6736e3685138f59e/src/MQTTLibrary/MQTTKeywords.py#L325-L372 |
randomsync/robotframework-mqttlibrary | src/MQTTLibrary/MQTTKeywords.py | MQTTKeywords.publish_multiple | def publish_multiple(self, msgs, hostname="localhost", port=1883,
client_id="", keepalive=60, will=None, auth=None,
tls=None, protocol=mqtt.MQTTv31):
""" Publish multiple messages and disconnect. This keyword uses the
[http://eclipse.org/paho/clients/python/docs/#multiple|multip... | python | def publish_multiple(self, msgs, hostname="localhost", port=1883,
client_id="", keepalive=60, will=None, auth=None,
tls=None, protocol=mqtt.MQTTv31):
""" Publish multiple messages and disconnect. This keyword uses the
[http://eclipse.org/paho/clients/python/docs/#multiple|multip... | [
"def",
"publish_multiple",
"(",
"self",
",",
"msgs",
",",
"hostname",
"=",
"\"localhost\"",
",",
"port",
"=",
"1883",
",",
"client_id",
"=",
"\"\"",
",",
"keepalive",
"=",
"60",
",",
"will",
"=",
"None",
",",
"auth",
"=",
"None",
",",
"tls",
"=",
"No... | Publish multiple messages and disconnect. This keyword uses the
[http://eclipse.org/paho/clients/python/docs/#multiple|multiple]
function of publish module.
`msgs` a list of messages to publish. Each message is either a dict
or a tuple. If a dict, it must be of the form:
... | [
"Publish",
"multiple",
"messages",
"and",
"disconnect",
".",
"This",
"keyword",
"uses",
"the",
"[",
"http",
":",
"//",
"eclipse",
".",
"org",
"/",
"paho",
"/",
"clients",
"/",
"python",
"/",
"docs",
"/",
"#multiple|multiple",
"]",
"function",
"of",
"publis... | train | https://github.com/randomsync/robotframework-mqttlibrary/blob/14f20038ccdbb576cc1057ec6736e3685138f59e/src/MQTTLibrary/MQTTKeywords.py#L374-L406 |
imbolc/aiohttp-login | aiohttp_login/decorators.py | user_to_request | def user_to_request(handler):
'''Add user to request if user logged in'''
@wraps(handler)
async def decorator(*args):
request = _get_request(args)
request[cfg.REQUEST_USER_KEY] = await get_cur_user(request)
return await handler(*args)
return decorator | python | def user_to_request(handler):
'''Add user to request if user logged in'''
@wraps(handler)
async def decorator(*args):
request = _get_request(args)
request[cfg.REQUEST_USER_KEY] = await get_cur_user(request)
return await handler(*args)
return decorator | [
"def",
"user_to_request",
"(",
"handler",
")",
":",
"@",
"wraps",
"(",
"handler",
")",
"async",
"def",
"decorator",
"(",
"*",
"args",
")",
":",
"request",
"=",
"_get_request",
"(",
"args",
")",
"request",
"[",
"cfg",
".",
"REQUEST_USER_KEY",
"]",
"=",
... | Add user to request if user logged in | [
"Add",
"user",
"to",
"request",
"if",
"user",
"logged",
"in"
] | train | https://github.com/imbolc/aiohttp-login/blob/43b30d8630ca5c14d4b75c398eb5f6a27ddf0a52/aiohttp_login/decorators.py#L21-L28 |
brandon-rhodes/python-adventure | adventure/model.py | Word.add_synonym | def add_synonym(self, other):
"""Every word in a group of synonyms shares the same list."""
self.synonyms.extend(other.synonyms)
other.synonyms = self.synonyms | python | def add_synonym(self, other):
"""Every word in a group of synonyms shares the same list."""
self.synonyms.extend(other.synonyms)
other.synonyms = self.synonyms | [
"def",
"add_synonym",
"(",
"self",
",",
"other",
")",
":",
"self",
".",
"synonyms",
".",
"extend",
"(",
"other",
".",
"synonyms",
")",
"other",
".",
"synonyms",
"=",
"self",
".",
"synonyms"
] | Every word in a group of synonyms shares the same list. | [
"Every",
"word",
"in",
"a",
"group",
"of",
"synonyms",
"shares",
"the",
"same",
"list",
"."
] | train | https://github.com/brandon-rhodes/python-adventure/blob/e503b68e394fbccb05fe381901c7009fb1bda3d9/adventure/model.py#L102-L105 |
imbolc/aiohttp-login | aiohttp_login/sql.py | find_one_sql | def find_one_sql(table, filter, fields=None):
'''
>>> find_one_sql('tbl', {'foo': 10, 'bar': 'baz'})
('SELECT * FROM tbl WHERE bar=$1 AND foo=$2', ['baz', 10])
>>> find_one_sql('tbl', {'id': 10}, fields=['foo', 'bar'])
('SELECT foo, bar FROM tbl WHERE id=$1', [10])
'''
keys, values = _split_... | python | def find_one_sql(table, filter, fields=None):
'''
>>> find_one_sql('tbl', {'foo': 10, 'bar': 'baz'})
('SELECT * FROM tbl WHERE bar=$1 AND foo=$2', ['baz', 10])
>>> find_one_sql('tbl', {'id': 10}, fields=['foo', 'bar'])
('SELECT foo, bar FROM tbl WHERE id=$1', [10])
'''
keys, values = _split_... | [
"def",
"find_one_sql",
"(",
"table",
",",
"filter",
",",
"fields",
"=",
"None",
")",
":",
"keys",
",",
"values",
"=",
"_split_dict",
"(",
"filter",
")",
"fields",
"=",
"', '",
".",
"join",
"(",
"fields",
")",
"if",
"fields",
"else",
"'*'",
"where",
"... | >>> find_one_sql('tbl', {'foo': 10, 'bar': 'baz'})
('SELECT * FROM tbl WHERE bar=$1 AND foo=$2', ['baz', 10])
>>> find_one_sql('tbl', {'id': 10}, fields=['foo', 'bar'])
('SELECT foo, bar FROM tbl WHERE id=$1', [10]) | [
">>>",
"find_one_sql",
"(",
"tbl",
"{",
"foo",
":",
"10",
"bar",
":",
"baz",
"}",
")",
"(",
"SELECT",
"*",
"FROM",
"tbl",
"WHERE",
"bar",
"=",
"$1",
"AND",
"foo",
"=",
"$2",
"[",
"baz",
"10",
"]",
")",
">>>",
"find_one_sql",
"(",
"tbl",
"{",
"i... | train | https://github.com/imbolc/aiohttp-login/blob/43b30d8630ca5c14d4b75c398eb5f6a27ddf0a52/aiohttp_login/sql.py#L14-L25 |
imbolc/aiohttp-login | aiohttp_login/sql.py | insert_sql | def insert_sql(table, data, returning='id'):
'''
>>> insert_sql('tbl', {'foo': 'bar', 'id': 1})
('INSERT INTO tbl (foo, id) VALUES ($1, $2) RETURNING id', ['bar', 1])
>>> insert_sql('tbl', {'foo': 'bar', 'id': 1}, returning=None)
('INSERT INTO tbl (foo, id) VALUES ($1, $2)', ['bar', 1])
>>> in... | python | def insert_sql(table, data, returning='id'):
'''
>>> insert_sql('tbl', {'foo': 'bar', 'id': 1})
('INSERT INTO tbl (foo, id) VALUES ($1, $2) RETURNING id', ['bar', 1])
>>> insert_sql('tbl', {'foo': 'bar', 'id': 1}, returning=None)
('INSERT INTO tbl (foo, id) VALUES ($1, $2)', ['bar', 1])
>>> in... | [
"def",
"insert_sql",
"(",
"table",
",",
"data",
",",
"returning",
"=",
"'id'",
")",
":",
"keys",
",",
"values",
"=",
"_split_dict",
"(",
"data",
")",
"sql",
"=",
"'INSERT INTO {} ({}) VALUES ({}){}'",
".",
"format",
"(",
"table",
",",
"', '",
".",
"join",
... | >>> insert_sql('tbl', {'foo': 'bar', 'id': 1})
('INSERT INTO tbl (foo, id) VALUES ($1, $2) RETURNING id', ['bar', 1])
>>> insert_sql('tbl', {'foo': 'bar', 'id': 1}, returning=None)
('INSERT INTO tbl (foo, id) VALUES ($1, $2)', ['bar', 1])
>>> insert_sql('tbl', {'foo': 'bar', 'id': 1}, returning='pk')
... | [
">>>",
"insert_sql",
"(",
"tbl",
"{",
"foo",
":",
"bar",
"id",
":",
"1",
"}",
")",
"(",
"INSERT",
"INTO",
"tbl",
"(",
"foo",
"id",
")",
"VALUES",
"(",
"$1",
"$2",
")",
"RETURNING",
"id",
"[",
"bar",
"1",
"]",
")"
] | train | https://github.com/imbolc/aiohttp-login/blob/43b30d8630ca5c14d4b75c398eb5f6a27ddf0a52/aiohttp_login/sql.py#L34-L51 |
imbolc/aiohttp-login | aiohttp_login/sql.py | update_sql | def update_sql(table, filter, updates):
'''
>>> update_sql('tbl', {'foo': 'a', 'bar': 1}, {'bar': 2, 'baz': 'b'})
('UPDATE tbl SET bar=$1, baz=$2 WHERE bar=$3 AND foo=$4', [2, 'b', 1, 'a'])
'''
where_keys, where_vals = _split_dict(filter)
up_keys, up_vals = _split_dict(updates)
changes = _pa... | python | def update_sql(table, filter, updates):
'''
>>> update_sql('tbl', {'foo': 'a', 'bar': 1}, {'bar': 2, 'baz': 'b'})
('UPDATE tbl SET bar=$1, baz=$2 WHERE bar=$3 AND foo=$4', [2, 'b', 1, 'a'])
'''
where_keys, where_vals = _split_dict(filter)
up_keys, up_vals = _split_dict(updates)
changes = _pa... | [
"def",
"update_sql",
"(",
"table",
",",
"filter",
",",
"updates",
")",
":",
"where_keys",
",",
"where_vals",
"=",
"_split_dict",
"(",
"filter",
")",
"up_keys",
",",
"up_vals",
"=",
"_split_dict",
"(",
"updates",
")",
"changes",
"=",
"_pairs",
"(",
"up_keys... | >>> update_sql('tbl', {'foo': 'a', 'bar': 1}, {'bar': 2, 'baz': 'b'})
('UPDATE tbl SET bar=$1, baz=$2 WHERE bar=$3 AND foo=$4', [2, 'b', 1, 'a']) | [
">>>",
"update_sql",
"(",
"tbl",
"{",
"foo",
":",
"a",
"bar",
":",
"1",
"}",
"{",
"bar",
":",
"2",
"baz",
":",
"b",
"}",
")",
"(",
"UPDATE",
"tbl",
"SET",
"bar",
"=",
"$1",
"baz",
"=",
"$2",
"WHERE",
"bar",
"=",
"$3",
"AND",
"foo",
"=",
"$4... | train | https://github.com/imbolc/aiohttp-login/blob/43b30d8630ca5c14d4b75c398eb5f6a27ddf0a52/aiohttp_login/sql.py#L60-L71 |
imbolc/aiohttp-login | aiohttp_login/sql.py | delete_sql | def delete_sql(table, filter):
'''
>>> delete_sql('tbl', {'foo': 10, 'bar': 'baz'})
('DELETE FROM tbl WHERE bar=$1 AND foo=$2', ['baz', 10])
'''
keys, values = _split_dict(filter)
where = _pairs(keys)
sql = 'DELETE FROM {} WHERE {}'.format(table, where)
return sql, values | python | def delete_sql(table, filter):
'''
>>> delete_sql('tbl', {'foo': 10, 'bar': 'baz'})
('DELETE FROM tbl WHERE bar=$1 AND foo=$2', ['baz', 10])
'''
keys, values = _split_dict(filter)
where = _pairs(keys)
sql = 'DELETE FROM {} WHERE {}'.format(table, where)
return sql, values | [
"def",
"delete_sql",
"(",
"table",
",",
"filter",
")",
":",
"keys",
",",
"values",
"=",
"_split_dict",
"(",
"filter",
")",
"where",
"=",
"_pairs",
"(",
"keys",
")",
"sql",
"=",
"'DELETE FROM {} WHERE {}'",
".",
"format",
"(",
"table",
",",
"where",
")",
... | >>> delete_sql('tbl', {'foo': 10, 'bar': 'baz'})
('DELETE FROM tbl WHERE bar=$1 AND foo=$2', ['baz', 10]) | [
">>>",
"delete_sql",
"(",
"tbl",
"{",
"foo",
":",
"10",
"bar",
":",
"baz",
"}",
")",
"(",
"DELETE",
"FROM",
"tbl",
"WHERE",
"bar",
"=",
"$1",
"AND",
"foo",
"=",
"$2",
"[",
"baz",
"10",
"]",
")"
] | train | https://github.com/imbolc/aiohttp-login/blob/43b30d8630ca5c14d4b75c398eb5f6a27ddf0a52/aiohttp_login/sql.py#L80-L88 |
imbolc/aiohttp-login | aiohttp_login/sql.py | _pairs | def _pairs(keys, *, start=1, sep=' AND '):
'''
>>> _pairs(['foo', 'bar', 'baz'], sep=', ')
'foo=$1, bar=$2, baz=$3'
>>> _pairs(['foo', 'bar', 'baz'], start=2)
'foo=$2 AND bar=$3 AND baz=$4'
'''
return sep.join('{}=${}'.format(k, i) for i, k in enumerate(keys, start)) | python | def _pairs(keys, *, start=1, sep=' AND '):
'''
>>> _pairs(['foo', 'bar', 'baz'], sep=', ')
'foo=$1, bar=$2, baz=$3'
>>> _pairs(['foo', 'bar', 'baz'], start=2)
'foo=$2 AND bar=$3 AND baz=$4'
'''
return sep.join('{}=${}'.format(k, i) for i, k in enumerate(keys, start)) | [
"def",
"_pairs",
"(",
"keys",
",",
"*",
",",
"start",
"=",
"1",
",",
"sep",
"=",
"' AND '",
")",
":",
"return",
"sep",
".",
"join",
"(",
"'{}=${}'",
".",
"format",
"(",
"k",
",",
"i",
")",
"for",
"i",
",",
"k",
"in",
"enumerate",
"(",
"keys",
... | >>> _pairs(['foo', 'bar', 'baz'], sep=', ')
'foo=$1, bar=$2, baz=$3'
>>> _pairs(['foo', 'bar', 'baz'], start=2)
'foo=$2 AND bar=$3 AND baz=$4' | [
">>>",
"_pairs",
"(",
"[",
"foo",
"bar",
"baz",
"]",
"sep",
"=",
")",
"foo",
"=",
"$1",
"bar",
"=",
"$2",
"baz",
"=",
"$3",
">>>",
"_pairs",
"(",
"[",
"foo",
"bar",
"baz",
"]",
"start",
"=",
"2",
")",
"foo",
"=",
"$2",
"AND",
"bar",
"=",
"$... | train | https://github.com/imbolc/aiohttp-login/blob/43b30d8630ca5c14d4b75c398eb5f6a27ddf0a52/aiohttp_login/sql.py#L91-L98 |
imbolc/aiohttp-login | aiohttp_login/sql.py | _split_dict | def _split_dict(dic):
'''Split dict into sorted keys and values
>>> _split_dict({'b': 2, 'a': 1})
(['a', 'b'], [1, 2])
'''
keys = sorted(dic.keys())
return keys, [dic[k] for k in keys] | python | def _split_dict(dic):
'''Split dict into sorted keys and values
>>> _split_dict({'b': 2, 'a': 1})
(['a', 'b'], [1, 2])
'''
keys = sorted(dic.keys())
return keys, [dic[k] for k in keys] | [
"def",
"_split_dict",
"(",
"dic",
")",
":",
"keys",
"=",
"sorted",
"(",
"dic",
".",
"keys",
"(",
")",
")",
"return",
"keys",
",",
"[",
"dic",
"[",
"k",
"]",
"for",
"k",
"in",
"keys",
"]"
] | Split dict into sorted keys and values
>>> _split_dict({'b': 2, 'a': 1})
(['a', 'b'], [1, 2]) | [
"Split",
"dict",
"into",
"sorted",
"keys",
"and",
"values"
] | train | https://github.com/imbolc/aiohttp-login/blob/43b30d8630ca5c14d4b75c398eb5f6a27ddf0a52/aiohttp_login/sql.py#L110-L117 |
brandon-rhodes/python-adventure | adventure/__init__.py | play | def play(seed=None):
"""Turn the Python prompt into an Adventure game.
With optional the `seed` argument the caller can supply an integer
to start the Python random number generator at a known state.
"""
global _game
from .game import Game
from .prompt import install_words
_game = Ga... | python | def play(seed=None):
"""Turn the Python prompt into an Adventure game.
With optional the `seed` argument the caller can supply an integer
to start the Python random number generator at a known state.
"""
global _game
from .game import Game
from .prompt import install_words
_game = Ga... | [
"def",
"play",
"(",
"seed",
"=",
"None",
")",
":",
"global",
"_game",
"from",
".",
"game",
"import",
"Game",
"from",
".",
"prompt",
"import",
"install_words",
"_game",
"=",
"Game",
"(",
"seed",
")",
"load_advent_dat",
"(",
"_game",
")",
"install_words",
... | Turn the Python prompt into an Adventure game.
With optional the `seed` argument the caller can supply an integer
to start the Python random number generator at a known state. | [
"Turn",
"the",
"Python",
"prompt",
"into",
"an",
"Adventure",
"game",
"."
] | train | https://github.com/brandon-rhodes/python-adventure/blob/e503b68e394fbccb05fe381901c7009fb1bda3d9/adventure/__init__.py#L15-L31 |
brandon-rhodes/python-adventure | adventure/game.py | Game.write | def write(self, more):
"""Append the Unicode representation of `s` to our output."""
if more:
self.output += str(more).upper()
self.output += '\n' | python | def write(self, more):
"""Append the Unicode representation of `s` to our output."""
if more:
self.output += str(more).upper()
self.output += '\n' | [
"def",
"write",
"(",
"self",
",",
"more",
")",
":",
"if",
"more",
":",
"self",
".",
"output",
"+=",
"str",
"(",
"more",
")",
".",
"upper",
"(",
")",
"self",
".",
"output",
"+=",
"'\\n'"
] | Append the Unicode representation of `s` to our output. | [
"Append",
"the",
"Unicode",
"representation",
"of",
"s",
"to",
"our",
"output",
"."
] | train | https://github.com/brandon-rhodes/python-adventure/blob/e503b68e394fbccb05fe381901c7009fb1bda3d9/adventure/game.py#L67-L71 |
brandon-rhodes/python-adventure | adventure/game.py | Game.yesno | def yesno(self, s, yesno_callback, casual=False):
"""Ask a question and prepare to receive a yes-or-no answer."""
self.write(s)
self.yesno_callback = yesno_callback
self.yesno_casual = casual | python | def yesno(self, s, yesno_callback, casual=False):
"""Ask a question and prepare to receive a yes-or-no answer."""
self.write(s)
self.yesno_callback = yesno_callback
self.yesno_casual = casual | [
"def",
"yesno",
"(",
"self",
",",
"s",
",",
"yesno_callback",
",",
"casual",
"=",
"False",
")",
":",
"self",
".",
"write",
"(",
"s",
")",
"self",
".",
"yesno_callback",
"=",
"yesno_callback",
"self",
".",
"yesno_casual",
"=",
"casual"
] | Ask a question and prepare to receive a yes-or-no answer. | [
"Ask",
"a",
"question",
"and",
"prepare",
"to",
"receive",
"a",
"yes",
"-",
"or",
"-",
"no",
"answer",
"."
] | train | https://github.com/brandon-rhodes/python-adventure/blob/e503b68e394fbccb05fe381901c7009fb1bda3d9/adventure/game.py#L76-L80 |
brandon-rhodes/python-adventure | adventure/game.py | Game.start | def start(self):
"""Start the game."""
# For old-fashioned players, accept five-letter truncations like
# "inven" instead of insisting on full words like "inventory".
for key, value in list(self.vocabulary.items()):
if isinstance(key, str) and len(key) > 5:
... | python | def start(self):
"""Start the game."""
# For old-fashioned players, accept five-letter truncations like
# "inven" instead of insisting on full words like "inventory".
for key, value in list(self.vocabulary.items()):
if isinstance(key, str) and len(key) > 5:
... | [
"def",
"start",
"(",
"self",
")",
":",
"# For old-fashioned players, accept five-letter truncations like",
"# \"inven\" instead of insisting on full words like \"inventory\".",
"for",
"key",
",",
"value",
"in",
"list",
"(",
"self",
".",
"vocabulary",
".",
"items",
"(",
")",... | Start the game. | [
"Start",
"the",
"game",
"."
] | train | https://github.com/brandon-rhodes/python-adventure/blob/e503b68e394fbccb05fe381901c7009fb1bda3d9/adventure/game.py#L118-L132 |
brandon-rhodes/python-adventure | adventure/game.py | Game.start2 | def start2(self, yes):
"""Display instructions if the user wants them."""
if yes:
self.write_message(1)
self.hints[3].used = True
self.lamp_turns = 1000
self.oldloc2 = self.oldloc = self.loc = self.rooms[1]
self.dwarves = [ Dwarf(self.rooms[n]) for n ... | python | def start2(self, yes):
"""Display instructions if the user wants them."""
if yes:
self.write_message(1)
self.hints[3].used = True
self.lamp_turns = 1000
self.oldloc2 = self.oldloc = self.loc = self.rooms[1]
self.dwarves = [ Dwarf(self.rooms[n]) for n ... | [
"def",
"start2",
"(",
"self",
",",
"yes",
")",
":",
"if",
"yes",
":",
"self",
".",
"write_message",
"(",
"1",
")",
"self",
".",
"hints",
"[",
"3",
"]",
".",
"used",
"=",
"True",
"self",
".",
"lamp_turns",
"=",
"1000",
"self",
".",
"oldloc2",
"=",... | Display instructions if the user wants them. | [
"Display",
"instructions",
"if",
"the",
"user",
"wants",
"them",
"."
] | train | https://github.com/brandon-rhodes/python-adventure/blob/e503b68e394fbccb05fe381901c7009fb1bda3d9/adventure/game.py#L134-L150 |
brandon-rhodes/python-adventure | adventure/game.py | Game.do_command | def do_command(self, words):
"""Parse and act upon the command in the list of strings `words`."""
self.output = ''
self._do_command(words)
return self.output | python | def do_command(self, words):
"""Parse and act upon the command in the list of strings `words`."""
self.output = ''
self._do_command(words)
return self.output | [
"def",
"do_command",
"(",
"self",
",",
"words",
")",
":",
"self",
".",
"output",
"=",
"''",
"self",
".",
"_do_command",
"(",
"words",
")",
"return",
"self",
".",
"output"
] | Parse and act upon the command in the list of strings `words`. | [
"Parse",
"and",
"act",
"upon",
"the",
"command",
"in",
"the",
"list",
"of",
"strings",
"words",
"."
] | train | https://github.com/brandon-rhodes/python-adventure/blob/e503b68e394fbccb05fe381901c7009fb1bda3d9/adventure/game.py#L434-L438 |
brandon-rhodes/python-adventure | adventure/game.py | Game.resume | def resume(self, obj):
"""Returns an Adventure game saved to the given file."""
if isinstance(obj, str):
savefile = open(obj, 'rb')
else:
savefile = obj
game = pickle.loads(zlib.decompress(savefile.read()))
if savefile is not obj:
savefile.clos... | python | def resume(self, obj):
"""Returns an Adventure game saved to the given file."""
if isinstance(obj, str):
savefile = open(obj, 'rb')
else:
savefile = obj
game = pickle.loads(zlib.decompress(savefile.read()))
if savefile is not obj:
savefile.clos... | [
"def",
"resume",
"(",
"self",
",",
"obj",
")",
":",
"if",
"isinstance",
"(",
"obj",
",",
"str",
")",
":",
"savefile",
"=",
"open",
"(",
"obj",
",",
"'rb'",
")",
"else",
":",
"savefile",
"=",
"obj",
"game",
"=",
"pickle",
".",
"loads",
"(",
"zlib"... | Returns an Adventure game saved to the given file. | [
"Returns",
"an",
"Adventure",
"game",
"saved",
"to",
"the",
"given",
"file",
"."
] | train | https://github.com/brandon-rhodes/python-adventure/blob/e503b68e394fbccb05fe381901c7009fb1bda3d9/adventure/game.py#L1574-L1587 |
brandon-rhodes/python-adventure | adventure/data.py | parse | def parse(data, datafile):
"""Read the Adventure data file and return a ``Data`` object."""
data._last_travel = [0, [0]] # x and verbs used by section 3
while True:
section_number = int(datafile.readline())
if not section_number: # no further sections
break
store = glo... | python | def parse(data, datafile):
"""Read the Adventure data file and return a ``Data`` object."""
data._last_travel = [0, [0]] # x and verbs used by section 3
while True:
section_number = int(datafile.readline())
if not section_number: # no further sections
break
store = glo... | [
"def",
"parse",
"(",
"data",
",",
"datafile",
")",
":",
"data",
".",
"_last_travel",
"=",
"[",
"0",
",",
"[",
"0",
"]",
"]",
"# x and verbs used by section 3",
"while",
"True",
":",
"section_number",
"=",
"int",
"(",
"datafile",
".",
"readline",
"(",
")"... | Read the Adventure data file and return a ``Data`` object. | [
"Read",
"the",
"Adventure",
"data",
"file",
"and",
"return",
"a",
"Data",
"object",
"."
] | train | https://github.com/brandon-rhodes/python-adventure/blob/e503b68e394fbccb05fe381901c7009fb1bda3d9/adventure/data.py#L201-L228 |
BradWhittington/django-mailgun | django_mailgun.py | MailgunBackend._map_smtp_headers_to_api_parameters | def _map_smtp_headers_to_api_parameters(self, email_message):
"""
Map the values passed in SMTP headers to API-ready
2-item tuples present in HEADERS_MAP
header values must be a single string or list or tuple of strings
:return: 2-item tuples of the form (api_name, api_values)
... | python | def _map_smtp_headers_to_api_parameters(self, email_message):
"""
Map the values passed in SMTP headers to API-ready
2-item tuples present in HEADERS_MAP
header values must be a single string or list or tuple of strings
:return: 2-item tuples of the form (api_name, api_values)
... | [
"def",
"_map_smtp_headers_to_api_parameters",
"(",
"self",
",",
"email_message",
")",
":",
"api_data",
"=",
"[",
"]",
"for",
"smtp_key",
",",
"api_transformer",
"in",
"six",
".",
"iteritems",
"(",
"self",
".",
"_headers_map",
")",
":",
"data_to_transform",
"=",
... | Map the values passed in SMTP headers to API-ready
2-item tuples present in HEADERS_MAP
header values must be a single string or list or tuple of strings
:return: 2-item tuples of the form (api_name, api_values) | [
"Map",
"the",
"values",
"passed",
"in",
"SMTP",
"headers",
"to",
"API",
"-",
"ready",
"2",
"-",
"item",
"tuples",
"present",
"in",
"HEADERS_MAP"
] | train | https://github.com/BradWhittington/django-mailgun/blob/c4bfb77fca1eb3d5c772294e3d065274bab9ddc6/django_mailgun.py#L74-L97 |
BradWhittington/django-mailgun | django_mailgun.py | MailgunBackend._send | def _send(self, email_message):
"""A helper method that does the actual sending."""
if not email_message.recipients():
return False
from_email = sanitize_address(email_message.from_email, email_message.encoding)
to_recipients = [sanitize_address(addr, email_message.encoding)... | python | def _send(self, email_message):
"""A helper method that does the actual sending."""
if not email_message.recipients():
return False
from_email = sanitize_address(email_message.from_email, email_message.encoding)
to_recipients = [sanitize_address(addr, email_message.encoding)... | [
"def",
"_send",
"(",
"self",
",",
"email_message",
")",
":",
"if",
"not",
"email_message",
".",
"recipients",
"(",
")",
":",
"return",
"False",
"from_email",
"=",
"sanitize_address",
"(",
"email_message",
".",
"from_email",
",",
"email_message",
".",
"encoding... | A helper method that does the actual sending. | [
"A",
"helper",
"method",
"that",
"does",
"the",
"actual",
"sending",
"."
] | train | https://github.com/BradWhittington/django-mailgun/blob/c4bfb77fca1eb3d5c772294e3d065274bab9ddc6/django_mailgun.py#L99-L166 |
BradWhittington/django-mailgun | django_mailgun.py | MailgunBackend.send_messages | def send_messages(self, email_messages):
"""Sends one or more EmailMessage objects and returns the number of
email messages sent.
"""
if not email_messages:
return
num_sent = 0
for message in email_messages:
if self._send(message):
... | python | def send_messages(self, email_messages):
"""Sends one or more EmailMessage objects and returns the number of
email messages sent.
"""
if not email_messages:
return
num_sent = 0
for message in email_messages:
if self._send(message):
... | [
"def",
"send_messages",
"(",
"self",
",",
"email_messages",
")",
":",
"if",
"not",
"email_messages",
":",
"return",
"num_sent",
"=",
"0",
"for",
"message",
"in",
"email_messages",
":",
"if",
"self",
".",
"_send",
"(",
"message",
")",
":",
"num_sent",
"+=",... | Sends one or more EmailMessage objects and returns the number of
email messages sent. | [
"Sends",
"one",
"or",
"more",
"EmailMessage",
"objects",
"and",
"returns",
"the",
"number",
"of",
"email",
"messages",
"sent",
"."
] | train | https://github.com/BradWhittington/django-mailgun/blob/c4bfb77fca1eb3d5c772294e3d065274bab9ddc6/django_mailgun.py#L168-L180 |
Stanford-Online/xblock-image-modal | imagemodal/views.py | ImageModalViewMixin.student_view | def student_view(self, context=None):
"""
Build the fragment for the default student view
"""
context = context or {}
context.update({
'display_name': self.display_name,
'image_url': self.image_url,
'thumbnail_url': self.thumbnail_url or self.i... | python | def student_view(self, context=None):
"""
Build the fragment for the default student view
"""
context = context or {}
context.update({
'display_name': self.display_name,
'image_url': self.image_url,
'thumbnail_url': self.thumbnail_url or self.i... | [
"def",
"student_view",
"(",
"self",
",",
"context",
"=",
"None",
")",
":",
"context",
"=",
"context",
"or",
"{",
"}",
"context",
".",
"update",
"(",
"{",
"'display_name'",
":",
"self",
".",
"display_name",
",",
"'image_url'",
":",
"self",
".",
"image_url... | Build the fragment for the default student view | [
"Build",
"the",
"fragment",
"for",
"the",
"default",
"student",
"view"
] | train | https://github.com/Stanford-Online/xblock-image-modal/blob/bd05f99a830a44f8d1a0e6e137e507b8ff8ff028/imagemodal/views.py#L27-L53 |
Stanford-Online/xblock-image-modal | imagemodal/mixins/fragment.py | XBlockFragmentBuilderMixin.build_fragment | def build_fragment(
self,
template='',
context=None,
css=None,
js=None,
js_init=None,
):
"""
Creates a fragment for display.
"""
template = 'templates/' + template
context = context or {}
css = cs... | python | def build_fragment(
self,
template='',
context=None,
css=None,
js=None,
js_init=None,
):
"""
Creates a fragment for display.
"""
template = 'templates/' + template
context = context or {}
css = cs... | [
"def",
"build_fragment",
"(",
"self",
",",
"template",
"=",
"''",
",",
"context",
"=",
"None",
",",
"css",
"=",
"None",
",",
"js",
"=",
"None",
",",
"js_init",
"=",
"None",
",",
")",
":",
"template",
"=",
"'templates/'",
"+",
"template",
"context",
"... | Creates a fragment for display. | [
"Creates",
"a",
"fragment",
"for",
"display",
"."
] | train | https://github.com/Stanford-Online/xblock-image-modal/blob/bd05f99a830a44f8d1a0e6e137e507b8ff8ff028/imagemodal/mixins/fragment.py#L14-L50 |
Stanford-Online/xblock-image-modal | imagemodal/mixins/scenario.py | _parse_title | def _parse_title(file_path):
"""
Parse a title from a file name
"""
title = file_path
title = title.split('/')[-1]
title = '.'.join(title.split('.')[:-1])
title = ' '.join(title.split('-'))
title = ' '.join([
word.capitalize()
for word in title.split(' ')
])
retur... | python | def _parse_title(file_path):
"""
Parse a title from a file name
"""
title = file_path
title = title.split('/')[-1]
title = '.'.join(title.split('.')[:-1])
title = ' '.join(title.split('-'))
title = ' '.join([
word.capitalize()
for word in title.split(' ')
])
retur... | [
"def",
"_parse_title",
"(",
"file_path",
")",
":",
"title",
"=",
"file_path",
"title",
"=",
"title",
".",
"split",
"(",
"'/'",
")",
"[",
"-",
"1",
"]",
"title",
"=",
"'.'",
".",
"join",
"(",
"title",
".",
"split",
"(",
"'.'",
")",
"[",
":",
"-",
... | Parse a title from a file name | [
"Parse",
"a",
"title",
"from",
"a",
"file",
"name"
] | train | https://github.com/Stanford-Online/xblock-image-modal/blob/bd05f99a830a44f8d1a0e6e137e507b8ff8ff028/imagemodal/mixins/scenario.py#L17-L29 |
Stanford-Online/xblock-image-modal | imagemodal/mixins/scenario.py | _read_files | def _read_files(files):
"""
Read the contents of a list of files
"""
file_contents = [
(
_parse_title(file_path),
_read_file(file_path),
)
for file_path in files
]
return file_contents | python | def _read_files(files):
"""
Read the contents of a list of files
"""
file_contents = [
(
_parse_title(file_path),
_read_file(file_path),
)
for file_path in files
]
return file_contents | [
"def",
"_read_files",
"(",
"files",
")",
":",
"file_contents",
"=",
"[",
"(",
"_parse_title",
"(",
"file_path",
")",
",",
"_read_file",
"(",
"file_path",
")",
",",
")",
"for",
"file_path",
"in",
"files",
"]",
"return",
"file_contents"
] | Read the contents of a list of files | [
"Read",
"the",
"contents",
"of",
"a",
"list",
"of",
"files"
] | train | https://github.com/Stanford-Online/xblock-image-modal/blob/bd05f99a830a44f8d1a0e6e137e507b8ff8ff028/imagemodal/mixins/scenario.py#L32-L43 |
Stanford-Online/xblock-image-modal | imagemodal/mixins/scenario.py | _find_files | def _find_files(directory):
"""
Find XML files in the directory
"""
pattern = "{directory}/*.xml".format(
directory=directory,
)
files = glob(pattern)
return files | python | def _find_files(directory):
"""
Find XML files in the directory
"""
pattern = "{directory}/*.xml".format(
directory=directory,
)
files = glob(pattern)
return files | [
"def",
"_find_files",
"(",
"directory",
")",
":",
"pattern",
"=",
"\"{directory}/*.xml\"",
".",
"format",
"(",
"directory",
"=",
"directory",
",",
")",
"files",
"=",
"glob",
"(",
"pattern",
")",
"return",
"files"
] | Find XML files in the directory | [
"Find",
"XML",
"files",
"in",
"the",
"directory"
] | train | https://github.com/Stanford-Online/xblock-image-modal/blob/bd05f99a830a44f8d1a0e6e137e507b8ff8ff028/imagemodal/mixins/scenario.py#L46-L54 |
Stanford-Online/xblock-image-modal | imagemodal/mixins/scenario.py | XBlockWorkbenchMixin.workbench_scenarios | def workbench_scenarios(cls):
"""
Gather scenarios to be displayed in the workbench
"""
module = cls.__module__
module = module.split('.')[0]
directory = pkg_resources.resource_filename(module, 'scenarios')
files = _find_files(directory)
scenarios = _read_... | python | def workbench_scenarios(cls):
"""
Gather scenarios to be displayed in the workbench
"""
module = cls.__module__
module = module.split('.')[0]
directory = pkg_resources.resource_filename(module, 'scenarios')
files = _find_files(directory)
scenarios = _read_... | [
"def",
"workbench_scenarios",
"(",
"cls",
")",
":",
"module",
"=",
"cls",
".",
"__module__",
"module",
"=",
"module",
".",
"split",
"(",
"'.'",
")",
"[",
"0",
"]",
"directory",
"=",
"pkg_resources",
".",
"resource_filename",
"(",
"module",
",",
"'scenarios... | Gather scenarios to be displayed in the workbench | [
"Gather",
"scenarios",
"to",
"be",
"displayed",
"in",
"the",
"workbench"
] | train | https://github.com/Stanford-Online/xblock-image-modal/blob/bd05f99a830a44f8d1a0e6e137e507b8ff8ff028/imagemodal/mixins/scenario.py#L63-L72 |
broadinstitute/fiss | firecloud/api.py | _set_session | def _set_session():
""" Sets global __SESSION and __USER_ID if they haven't been set """
global __SESSION
global __USER_ID
if __SESSION is None:
try:
__SESSION = AuthorizedSession(google.auth.default(['https://www.googleapis.com/auth/userinfo.profile',
... | python | def _set_session():
""" Sets global __SESSION and __USER_ID if they haven't been set """
global __SESSION
global __USER_ID
if __SESSION is None:
try:
__SESSION = AuthorizedSession(google.auth.default(['https://www.googleapis.com/auth/userinfo.profile',
... | [
"def",
"_set_session",
"(",
")",
":",
"global",
"__SESSION",
"global",
"__USER_ID",
"if",
"__SESSION",
"is",
"None",
":",
"try",
":",
"__SESSION",
"=",
"AuthorizedSession",
"(",
"google",
".",
"auth",
".",
"default",
"(",
"[",
"'https://www.googleapis.com/auth/u... | Sets global __SESSION and __USER_ID if they haven't been set | [
"Sets",
"global",
"__SESSION",
"and",
"__USER_ID",
"if",
"they",
"haven",
"t",
"been",
"set"
] | train | https://github.com/broadinstitute/fiss/blob/dddf91547479506dbbafb69ec84d44dcc4a94ab4/firecloud/api.py#L43-L71 |
broadinstitute/fiss | firecloud/api.py | _fiss_agent_header | def _fiss_agent_header(headers=None):
""" Return request headers for fiss.
Inserts FISS as the User-Agent.
Initializes __SESSION if it hasn't been set.
Args:
headers (dict): Include additional headers as key-value pairs
"""
_set_session()
fiss_headers = {"User-Agent" : FIS... | python | def _fiss_agent_header(headers=None):
""" Return request headers for fiss.
Inserts FISS as the User-Agent.
Initializes __SESSION if it hasn't been set.
Args:
headers (dict): Include additional headers as key-value pairs
"""
_set_session()
fiss_headers = {"User-Agent" : FIS... | [
"def",
"_fiss_agent_header",
"(",
"headers",
"=",
"None",
")",
":",
"_set_session",
"(",
")",
"fiss_headers",
"=",
"{",
"\"User-Agent\"",
":",
"FISS_USER_AGENT",
"}",
"if",
"headers",
"is",
"not",
"None",
":",
"fiss_headers",
".",
"update",
"(",
"headers",
"... | Return request headers for fiss.
Inserts FISS as the User-Agent.
Initializes __SESSION if it hasn't been set.
Args:
headers (dict): Include additional headers as key-value pairs | [
"Return",
"request",
"headers",
"for",
"fiss",
".",
"Inserts",
"FISS",
"as",
"the",
"User",
"-",
"Agent",
".",
"Initializes",
"__SESSION",
"if",
"it",
"hasn",
"t",
"been",
"set",
"."
] | train | https://github.com/broadinstitute/fiss/blob/dddf91547479506dbbafb69ec84d44dcc4a94ab4/firecloud/api.py#L73-L87 |
broadinstitute/fiss | firecloud/api.py | _check_response_code | def _check_response_code(response, codes):
"""
Throws an exception if the http response is not expected. Can check single
integer or list of valid responses.
Example usage:
>>> r = api.get_workspace("broad-firecloud-testing", "Fake-Bucket")
>>> _check_response_code(r, 200)
... ... | python | def _check_response_code(response, codes):
"""
Throws an exception if the http response is not expected. Can check single
integer or list of valid responses.
Example usage:
>>> r = api.get_workspace("broad-firecloud-testing", "Fake-Bucket")
>>> _check_response_code(r, 200)
... ... | [
"def",
"_check_response_code",
"(",
"response",
",",
"codes",
")",
":",
"if",
"type",
"(",
"codes",
")",
"==",
"int",
":",
"codes",
"=",
"[",
"codes",
"]",
"if",
"response",
".",
"status_code",
"not",
"in",
"codes",
":",
"raise",
"FireCloudServerError",
... | Throws an exception if the http response is not expected. Can check single
integer or list of valid responses.
Example usage:
>>> r = api.get_workspace("broad-firecloud-testing", "Fake-Bucket")
>>> _check_response_code(r, 200)
... FireCloudServerError ... | [
"Throws",
"an",
"exception",
"if",
"the",
"http",
"response",
"is",
"not",
"expected",
".",
"Can",
"check",
"single",
"integer",
"or",
"list",
"of",
"valid",
"responses",
"."
] | train | https://github.com/broadinstitute/fiss/blob/dddf91547479506dbbafb69ec84d44dcc4a94ab4/firecloud/api.py#L129-L142 |
broadinstitute/fiss | firecloud/api.py | list_entity_types | def list_entity_types(namespace, workspace):
"""List the entity types present in a workspace.
Args:
namespace (str): project to which workspace belongs
workspace (str): Workspace name
Swagger:
https://api.firecloud.org/#!/Entities/getEntityTypes
"""
headers = _fiss_agent_he... | python | def list_entity_types(namespace, workspace):
"""List the entity types present in a workspace.
Args:
namespace (str): project to which workspace belongs
workspace (str): Workspace name
Swagger:
https://api.firecloud.org/#!/Entities/getEntityTypes
"""
headers = _fiss_agent_he... | [
"def",
"list_entity_types",
"(",
"namespace",
",",
"workspace",
")",
":",
"headers",
"=",
"_fiss_agent_header",
"(",
"{",
"\"Content-type\"",
":",
"\"application/json\"",
"}",
")",
"uri",
"=",
"\"workspaces/{0}/{1}/entities\"",
".",
"format",
"(",
"namespace",
",",
... | List the entity types present in a workspace.
Args:
namespace (str): project to which workspace belongs
workspace (str): Workspace name
Swagger:
https://api.firecloud.org/#!/Entities/getEntityTypes | [
"List",
"the",
"entity",
"types",
"present",
"in",
"a",
"workspace",
"."
] | train | https://github.com/broadinstitute/fiss/blob/dddf91547479506dbbafb69ec84d44dcc4a94ab4/firecloud/api.py#L170-L182 |
broadinstitute/fiss | firecloud/api.py | upload_entities | def upload_entities(namespace, workspace, entity_data):
"""Upload entities from tab-delimited string.
Args:
namespace (str): project to which workspace belongs
workspace (str): Workspace name
entity_data (str): TSV string describing entites
Swagger:
https://api.firecloud.or... | python | def upload_entities(namespace, workspace, entity_data):
"""Upload entities from tab-delimited string.
Args:
namespace (str): project to which workspace belongs
workspace (str): Workspace name
entity_data (str): TSV string describing entites
Swagger:
https://api.firecloud.or... | [
"def",
"upload_entities",
"(",
"namespace",
",",
"workspace",
",",
"entity_data",
")",
":",
"body",
"=",
"urlencode",
"(",
"{",
"\"entities\"",
":",
"entity_data",
"}",
")",
"headers",
"=",
"_fiss_agent_header",
"(",
"{",
"'Content-type'",
":",
"\"application/x-... | Upload entities from tab-delimited string.
Args:
namespace (str): project to which workspace belongs
workspace (str): Workspace name
entity_data (str): TSV string describing entites
Swagger:
https://api.firecloud.org/#!/Entities/importEntities | [
"Upload",
"entities",
"from",
"tab",
"-",
"delimited",
"string",
"."
] | train | https://github.com/broadinstitute/fiss/blob/dddf91547479506dbbafb69ec84d44dcc4a94ab4/firecloud/api.py#L184-L200 |
broadinstitute/fiss | firecloud/api.py | upload_entities_tsv | def upload_entities_tsv(namespace, workspace, entities_tsv):
"""Upload entities from a tsv loadfile.
File-based wrapper for api.upload_entities().
A loadfile is a tab-separated text file with a header row
describing entity type and attribute names, followed by
rows of entities and their attribute v... | python | def upload_entities_tsv(namespace, workspace, entities_tsv):
"""Upload entities from a tsv loadfile.
File-based wrapper for api.upload_entities().
A loadfile is a tab-separated text file with a header row
describing entity type and attribute names, followed by
rows of entities and their attribute v... | [
"def",
"upload_entities_tsv",
"(",
"namespace",
",",
"workspace",
",",
"entities_tsv",
")",
":",
"if",
"isinstance",
"(",
"entities_tsv",
",",
"string_types",
")",
":",
"with",
"open",
"(",
"entities_tsv",
",",
"\"r\"",
")",
"as",
"tsv",
":",
"entity_data",
... | Upload entities from a tsv loadfile.
File-based wrapper for api.upload_entities().
A loadfile is a tab-separated text file with a header row
describing entity type and attribute names, followed by
rows of entities and their attribute values.
Ex:
entity:participant_id age alive
... | [
"Upload",
"entities",
"from",
"a",
"tsv",
"loadfile",
"."
] | train | https://github.com/broadinstitute/fiss/blob/dddf91547479506dbbafb69ec84d44dcc4a94ab4/firecloud/api.py#L202-L227 |
broadinstitute/fiss | firecloud/api.py | copy_entities | def copy_entities(from_namespace, from_workspace, to_namespace,
to_workspace, etype, enames, link_existing_entities=False):
"""Copy entities between workspaces
Args:
from_namespace (str): project (namespace) to which source workspace belongs
from_workspace (str): Source worksp... | python | def copy_entities(from_namespace, from_workspace, to_namespace,
to_workspace, etype, enames, link_existing_entities=False):
"""Copy entities between workspaces
Args:
from_namespace (str): project (namespace) to which source workspace belongs
from_workspace (str): Source worksp... | [
"def",
"copy_entities",
"(",
"from_namespace",
",",
"from_workspace",
",",
"to_namespace",
",",
"to_workspace",
",",
"etype",
",",
"enames",
",",
"link_existing_entities",
"=",
"False",
")",
":",
"uri",
"=",
"\"workspaces/{0}/{1}/entities/copy\"",
".",
"format",
"("... | Copy entities between workspaces
Args:
from_namespace (str): project (namespace) to which source workspace belongs
from_workspace (str): Source workspace name
to_namespace (str): project (namespace) to which target workspace belongs
to_workspace (str): Target workspace name
... | [
"Copy",
"entities",
"between",
"workspaces"
] | train | https://github.com/broadinstitute/fiss/blob/dddf91547479506dbbafb69ec84d44dcc4a94ab4/firecloud/api.py#L229-L257 |
broadinstitute/fiss | firecloud/api.py | get_entities | def get_entities(namespace, workspace, etype):
"""List entities of given type in a workspace.
Response content will be in JSON format.
Args:
namespace (str): project to which workspace belongs
workspace (str): Workspace name
etype (str): Entity type
Swagger:
https://ap... | python | def get_entities(namespace, workspace, etype):
"""List entities of given type in a workspace.
Response content will be in JSON format.
Args:
namespace (str): project to which workspace belongs
workspace (str): Workspace name
etype (str): Entity type
Swagger:
https://ap... | [
"def",
"get_entities",
"(",
"namespace",
",",
"workspace",
",",
"etype",
")",
":",
"uri",
"=",
"\"workspaces/{0}/{1}/entities/{2}\"",
".",
"format",
"(",
"namespace",
",",
"workspace",
",",
"etype",
")",
"return",
"__get",
"(",
"uri",
")"
] | List entities of given type in a workspace.
Response content will be in JSON format.
Args:
namespace (str): project to which workspace belongs
workspace (str): Workspace name
etype (str): Entity type
Swagger:
https://api.firecloud.org/#!/Entities/getEntities | [
"List",
"entities",
"of",
"given",
"type",
"in",
"a",
"workspace",
"."
] | train | https://github.com/broadinstitute/fiss/blob/dddf91547479506dbbafb69ec84d44dcc4a94ab4/firecloud/api.py#L259-L273 |
broadinstitute/fiss | firecloud/api.py | get_entities_tsv | def get_entities_tsv(namespace, workspace, etype):
"""List entities of given type in a workspace as a TSV.
Identical to get_entities(), but the response is a TSV.
Args:
namespace (str): project to which workspace belongs
workspace (str): Workspace name
etype (str): Entity type
... | python | def get_entities_tsv(namespace, workspace, etype):
"""List entities of given type in a workspace as a TSV.
Identical to get_entities(), but the response is a TSV.
Args:
namespace (str): project to which workspace belongs
workspace (str): Workspace name
etype (str): Entity type
... | [
"def",
"get_entities_tsv",
"(",
"namespace",
",",
"workspace",
",",
"etype",
")",
":",
"uri",
"=",
"\"workspaces/{0}/{1}/entities/{2}/tsv\"",
".",
"format",
"(",
"namespace",
",",
"workspace",
",",
"etype",
")",
"return",
"__get",
"(",
"uri",
")"
] | List entities of given type in a workspace as a TSV.
Identical to get_entities(), but the response is a TSV.
Args:
namespace (str): project to which workspace belongs
workspace (str): Workspace name
etype (str): Entity type
Swagger:
https://api.firecloud.org/#!/Entities/br... | [
"List",
"entities",
"of",
"given",
"type",
"in",
"a",
"workspace",
"as",
"a",
"TSV",
"."
] | train | https://github.com/broadinstitute/fiss/blob/dddf91547479506dbbafb69ec84d44dcc4a94ab4/firecloud/api.py#L275-L290 |
broadinstitute/fiss | firecloud/api.py | get_entity | def get_entity(namespace, workspace, etype, ename):
"""Request entity information.
Gets entity metadata and attributes.
Args:
namespace (str): project to which workspace belongs
workspace (str): Workspace name
etype (str): Entity type
ename (str): The entity's unique id
... | python | def get_entity(namespace, workspace, etype, ename):
"""Request entity information.
Gets entity metadata and attributes.
Args:
namespace (str): project to which workspace belongs
workspace (str): Workspace name
etype (str): Entity type
ename (str): The entity's unique id
... | [
"def",
"get_entity",
"(",
"namespace",
",",
"workspace",
",",
"etype",
",",
"ename",
")",
":",
"uri",
"=",
"\"workspaces/{0}/{1}/entities/{2}/{3}\"",
".",
"format",
"(",
"namespace",
",",
"workspace",
",",
"etype",
",",
"ename",
")",
"return",
"__get",
"(",
... | Request entity information.
Gets entity metadata and attributes.
Args:
namespace (str): project to which workspace belongs
workspace (str): Workspace name
etype (str): Entity type
ename (str): The entity's unique id
Swagger:
https://api.firecloud.org/#!/Entities/ge... | [
"Request",
"entity",
"information",
"."
] | train | https://github.com/broadinstitute/fiss/blob/dddf91547479506dbbafb69ec84d44dcc4a94ab4/firecloud/api.py#L292-L308 |
broadinstitute/fiss | firecloud/api.py | delete_entities | def delete_entities(namespace, workspace, json_body):
"""Delete entities in a workspace.
Note: This action is not reversible. Be careful!
Args:
namespace (str): project to which workspace belongs
workspace (str): Workspace name
json_body:
[
{
"entityTy... | python | def delete_entities(namespace, workspace, json_body):
"""Delete entities in a workspace.
Note: This action is not reversible. Be careful!
Args:
namespace (str): project to which workspace belongs
workspace (str): Workspace name
json_body:
[
{
"entityTy... | [
"def",
"delete_entities",
"(",
"namespace",
",",
"workspace",
",",
"json_body",
")",
":",
"uri",
"=",
"\"workspaces/{0}/{1}/entities/delete\"",
".",
"format",
"(",
"namespace",
",",
"workspace",
")",
"return",
"__post",
"(",
"uri",
",",
"json",
"=",
"json_body",... | Delete entities in a workspace.
Note: This action is not reversible. Be careful!
Args:
namespace (str): project to which workspace belongs
workspace (str): Workspace name
json_body:
[
{
"entityType": "string",
"entityName": "string"
}... | [
"Delete",
"entities",
"in",
"a",
"workspace",
"."
] | train | https://github.com/broadinstitute/fiss/blob/dddf91547479506dbbafb69ec84d44dcc4a94ab4/firecloud/api.py#L310-L331 |
broadinstitute/fiss | firecloud/api.py | delete_entity_type | def delete_entity_type(namespace, workspace, etype, ename):
"""Delete entities in a workspace.
Note: This action is not reversible. Be careful!
Args:
namespace (str): project to which workspace belongs
workspace (str): Workspace name
etype (str): Entity type
ename (str, or ... | python | def delete_entity_type(namespace, workspace, etype, ename):
"""Delete entities in a workspace.
Note: This action is not reversible. Be careful!
Args:
namespace (str): project to which workspace belongs
workspace (str): Workspace name
etype (str): Entity type
ename (str, or ... | [
"def",
"delete_entity_type",
"(",
"namespace",
",",
"workspace",
",",
"etype",
",",
"ename",
")",
":",
"uri",
"=",
"\"workspaces/{0}/{1}/entities/delete\"",
".",
"format",
"(",
"namespace",
",",
"workspace",
")",
"if",
"isinstance",
"(",
"ename",
",",
"string_ty... | Delete entities in a workspace.
Note: This action is not reversible. Be careful!
Args:
namespace (str): project to which workspace belongs
workspace (str): Workspace name
etype (str): Entity type
ename (str, or iterable of str): unique entity id(s)
Swagger:
https:/... | [
"Delete",
"entities",
"in",
"a",
"workspace",
"."
] | train | https://github.com/broadinstitute/fiss/blob/dddf91547479506dbbafb69ec84d44dcc4a94ab4/firecloud/api.py#L333-L354 |
broadinstitute/fiss | firecloud/api.py | get_entities_query | def get_entities_query(namespace, workspace, etype, page=1,
page_size=100, sort_direction="asc",
filter_terms=None):
"""Paginated version of get_entities_with_type.
Args:
namespace (str): project to which workspace belongs
workspace (str): Workspace... | python | def get_entities_query(namespace, workspace, etype, page=1,
page_size=100, sort_direction="asc",
filter_terms=None):
"""Paginated version of get_entities_with_type.
Args:
namespace (str): project to which workspace belongs
workspace (str): Workspace... | [
"def",
"get_entities_query",
"(",
"namespace",
",",
"workspace",
",",
"etype",
",",
"page",
"=",
"1",
",",
"page_size",
"=",
"100",
",",
"sort_direction",
"=",
"\"asc\"",
",",
"filter_terms",
"=",
"None",
")",
":",
"# Initial parameters for pagination",
"params"... | Paginated version of get_entities_with_type.
Args:
namespace (str): project to which workspace belongs
workspace (str): Workspace name
Swagger:
https://api.firecloud.org/#!/Entities/entityQuery | [
"Paginated",
"version",
"of",
"get_entities_with_type",
"."
] | train | https://github.com/broadinstitute/fiss/blob/dddf91547479506dbbafb69ec84d44dcc4a94ab4/firecloud/api.py#L434-L458 |
broadinstitute/fiss | firecloud/api.py | update_entity | def update_entity(namespace, workspace, etype, ename, updates):
""" Update entity attributes in a workspace.
Args:
namespace (str): project to which workspace belongs
workspace (str): Workspace name
etype (str): Entity type
ename (str): Entity name
updates (lis... | python | def update_entity(namespace, workspace, etype, ename, updates):
""" Update entity attributes in a workspace.
Args:
namespace (str): project to which workspace belongs
workspace (str): Workspace name
etype (str): Entity type
ename (str): Entity name
updates (lis... | [
"def",
"update_entity",
"(",
"namespace",
",",
"workspace",
",",
"etype",
",",
"ename",
",",
"updates",
")",
":",
"headers",
"=",
"_fiss_agent_header",
"(",
"{",
"\"Content-type\"",
":",
"\"application/json\"",
"}",
")",
"uri",
"=",
"\"{0}workspaces/{1}/{2}/entiti... | Update entity attributes in a workspace.
Args:
namespace (str): project to which workspace belongs
workspace (str): Workspace name
etype (str): Entity type
ename (str): Entity name
updates (list(dict)): List of updates to entity from _attr_set, e.g.
Swagger:
... | [
"Update",
"entity",
"attributes",
"in",
"a",
"workspace",
"."
] | train | https://github.com/broadinstitute/fiss/blob/dddf91547479506dbbafb69ec84d44dcc4a94ab4/firecloud/api.py#L460-L478 |
broadinstitute/fiss | firecloud/api.py | list_workspace_configs | def list_workspace_configs(namespace, workspace, allRepos=False):
"""List method configurations in workspace.
Args:
namespace (str): project to which workspace belongs
workspace (str): Workspace name
Swagger:
https://api.firecloud.org/#!/Method_Configurations/listWorkspaceMethodCon... | python | def list_workspace_configs(namespace, workspace, allRepos=False):
"""List method configurations in workspace.
Args:
namespace (str): project to which workspace belongs
workspace (str): Workspace name
Swagger:
https://api.firecloud.org/#!/Method_Configurations/listWorkspaceMethodCon... | [
"def",
"list_workspace_configs",
"(",
"namespace",
",",
"workspace",
",",
"allRepos",
"=",
"False",
")",
":",
"uri",
"=",
"\"workspaces/{0}/{1}/methodconfigs\"",
".",
"format",
"(",
"namespace",
",",
"workspace",
")",
"return",
"__get",
"(",
"uri",
",",
"params"... | List method configurations in workspace.
Args:
namespace (str): project to which workspace belongs
workspace (str): Workspace name
Swagger:
https://api.firecloud.org/#!/Method_Configurations/listWorkspaceMethodConfigs
DUPLICATE: https://api.firecloud.org/#!/Workspaces/listWorks... | [
"List",
"method",
"configurations",
"in",
"workspace",
"."
] | train | https://github.com/broadinstitute/fiss/blob/dddf91547479506dbbafb69ec84d44dcc4a94ab4/firecloud/api.py#L484-L496 |
broadinstitute/fiss | firecloud/api.py | create_workspace_config | def create_workspace_config(namespace, workspace, body):
"""Create method configuration in workspace.
Args:
namespace (str): project to which workspace belongs
workspace (str): Workspace name
body (json) : a filled-in JSON object for the new method config
(e.g. see... | python | def create_workspace_config(namespace, workspace, body):
"""Create method configuration in workspace.
Args:
namespace (str): project to which workspace belongs
workspace (str): Workspace name
body (json) : a filled-in JSON object for the new method config
(e.g. see... | [
"def",
"create_workspace_config",
"(",
"namespace",
",",
"workspace",
",",
"body",
")",
":",
"#json_body = {",
"# \"namespace\" : mnamespace,",
"# \"name\" : method,",
"# \"rootEntityType\" : root_etype,",
"# \"inputs\" : {},",
"# \"outputs\" : {},",
"# ... | Create method configuration in workspace.
Args:
namespace (str): project to which workspace belongs
workspace (str): Workspace name
body (json) : a filled-in JSON object for the new method config
(e.g. see return value of get_workspace_config)
Swagger:
htt... | [
"Create",
"method",
"configuration",
"in",
"workspace",
"."
] | train | https://github.com/broadinstitute/fiss/blob/dddf91547479506dbbafb69ec84d44dcc4a94ab4/firecloud/api.py#L498-L521 |
broadinstitute/fiss | firecloud/api.py | delete_workspace_config | def delete_workspace_config(namespace, workspace, cnamespace, config):
"""Delete method configuration in workspace.
Args:
namespace (str): project to which workspace belongs
workspace (str): Workspace name
mnamespace (str): Method namespace
method (str): Method name
Swagger... | python | def delete_workspace_config(namespace, workspace, cnamespace, config):
"""Delete method configuration in workspace.
Args:
namespace (str): project to which workspace belongs
workspace (str): Workspace name
mnamespace (str): Method namespace
method (str): Method name
Swagger... | [
"def",
"delete_workspace_config",
"(",
"namespace",
",",
"workspace",
",",
"cnamespace",
",",
"config",
")",
":",
"uri",
"=",
"\"workspaces/{0}/{1}/method_configs/{2}/{3}\"",
".",
"format",
"(",
"namespace",
",",
"workspace",
",",
"cnamespace",
",",
"config",
")",
... | Delete method configuration in workspace.
Args:
namespace (str): project to which workspace belongs
workspace (str): Workspace name
mnamespace (str): Method namespace
method (str): Method name
Swagger:
https://api.firecloud.org/#!/Method_Configurations/deleteWorkspaceMe... | [
"Delete",
"method",
"configuration",
"in",
"workspace",
"."
] | train | https://github.com/broadinstitute/fiss/blob/dddf91547479506dbbafb69ec84d44dcc4a94ab4/firecloud/api.py#L523-L537 |
broadinstitute/fiss | firecloud/api.py | get_workspace_config | def get_workspace_config(namespace, workspace, cnamespace, config):
"""Get method configuration in workspace.
Args:
namespace (str): project to which workspace belongs
workspace (str): Workspace name
cnamespace (str): Config namespace
config (str): Config name
Swagger:
... | python | def get_workspace_config(namespace, workspace, cnamespace, config):
"""Get method configuration in workspace.
Args:
namespace (str): project to which workspace belongs
workspace (str): Workspace name
cnamespace (str): Config namespace
config (str): Config name
Swagger:
... | [
"def",
"get_workspace_config",
"(",
"namespace",
",",
"workspace",
",",
"cnamespace",
",",
"config",
")",
":",
"uri",
"=",
"\"workspaces/{0}/{1}/method_configs/{2}/{3}\"",
".",
"format",
"(",
"namespace",
",",
"workspace",
",",
"cnamespace",
",",
"config",
")",
"r... | Get method configuration in workspace.
Args:
namespace (str): project to which workspace belongs
workspace (str): Workspace name
cnamespace (str): Config namespace
config (str): Config name
Swagger:
https://api.firecloud.org/#!/Method_Configurations/getWorkspaceMethodCo... | [
"Get",
"method",
"configuration",
"in",
"workspace",
"."
] | train | https://github.com/broadinstitute/fiss/blob/dddf91547479506dbbafb69ec84d44dcc4a94ab4/firecloud/api.py#L539-L554 |
broadinstitute/fiss | firecloud/api.py | overwrite_workspace_config | def overwrite_workspace_config(namespace, workspace, cnamespace, configname, body):
"""Add or overwrite method configuration in workspace.
Args:
namespace (str): project to which workspace belongs
workspace (str): Workspace name
cnamespace (str): Configuration namespace
config... | python | def overwrite_workspace_config(namespace, workspace, cnamespace, configname, body):
"""Add or overwrite method configuration in workspace.
Args:
namespace (str): project to which workspace belongs
workspace (str): Workspace name
cnamespace (str): Configuration namespace
config... | [
"def",
"overwrite_workspace_config",
"(",
"namespace",
",",
"workspace",
",",
"cnamespace",
",",
"configname",
",",
"body",
")",
":",
"headers",
"=",
"_fiss_agent_header",
"(",
"{",
"\"Content-type\"",
":",
"\"application/json\"",
"}",
")",
"uri",
"=",
"\"workspac... | Add or overwrite method configuration in workspace.
Args:
namespace (str): project to which workspace belongs
workspace (str): Workspace name
cnamespace (str): Configuration namespace
configname (str): Configuration name
body (json): new body (definition) of the metho... | [
"Add",
"or",
"overwrite",
"method",
"configuration",
"in",
"workspace",
"."
] | train | https://github.com/broadinstitute/fiss/blob/dddf91547479506dbbafb69ec84d44dcc4a94ab4/firecloud/api.py#L556-L572 |
broadinstitute/fiss | firecloud/api.py | update_workspace_config | def update_workspace_config(namespace, workspace, cnamespace, configname, body):
"""Update method configuration in workspace.
Args:
namespace (str): project to which workspace belongs
workspace (str): Workspace name
cnamespace (str): Configuration namespace
configname (str): C... | python | def update_workspace_config(namespace, workspace, cnamespace, configname, body):
"""Update method configuration in workspace.
Args:
namespace (str): project to which workspace belongs
workspace (str): Workspace name
cnamespace (str): Configuration namespace
configname (str): C... | [
"def",
"update_workspace_config",
"(",
"namespace",
",",
"workspace",
",",
"cnamespace",
",",
"configname",
",",
"body",
")",
":",
"uri",
"=",
"\"workspaces/{0}/{1}/method_configs/{2}/{3}\"",
".",
"format",
"(",
"namespace",
",",
"workspace",
",",
"cnamespace",
",",... | Update method configuration in workspace.
Args:
namespace (str): project to which workspace belongs
workspace (str): Workspace name
cnamespace (str): Configuration namespace
configname (str): Configuration name
body (json): new body (definition) of the method config
... | [
"Update",
"method",
"configuration",
"in",
"workspace",
"."
] | train | https://github.com/broadinstitute/fiss/blob/dddf91547479506dbbafb69ec84d44dcc4a94ab4/firecloud/api.py#L574-L589 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.