repository_name
stringlengths
5
67
func_path_in_repository
stringlengths
4
234
func_name
stringlengths
0
314
whole_func_string
stringlengths
52
3.87M
language
stringclasses
6 values
func_code_string
stringlengths
52
3.87M
func_code_tokens
listlengths
15
672k
func_documentation_string
stringlengths
1
47.2k
func_documentation_tokens
listlengths
1
3.92k
split_name
stringclasses
1 value
func_code_url
stringlengths
85
339
ttinies/sc2gameLobby
sc2gameLobby/gameConfig.py
Config.flatten
def flatten(self, data=None): """reduce all objects into simplified values as a attr dictionary that could be transformed back into a full configuration via inflate()""" if data == None: data=self.attrs ret = {} for k,v in iteritems(data): if not v: continue # don't f...
python
def flatten(self, data=None): """reduce all objects into simplified values as a attr dictionary that could be transformed back into a full configuration via inflate()""" if data == None: data=self.attrs ret = {} for k,v in iteritems(data): if not v: continue # don't f...
[ "def", "flatten", "(", "self", ",", "data", "=", "None", ")", ":", "if", "data", "==", "None", ":", "data", "=", "self", ".", "attrs", "ret", "=", "{", "}", "for", "k", ",", "v", "in", "iteritems", "(", "data", ")", ":", "if", "not", "v", ":"...
reduce all objects into simplified values as a attr dictionary that could be transformed back into a full configuration via inflate()
[ "reduce", "all", "objects", "into", "simplified", "values", "as", "a", "attr", "dictionary", "that", "could", "be", "transformed", "back", "into", "a", "full", "configuration", "via", "inflate", "()" ]
train
https://github.com/ttinies/sc2gameLobby/blob/5352d51d53ddeb4858e92e682da89c4434123e52/sc2gameLobby/gameConfig.py#L346-L370
ttinies/sc2gameLobby
sc2gameLobby/gameConfig.py
Config.inflate
def inflate(self, newData={}): """ensure all object attribute values are objects""" from sc2maptool.functions import selectMap from sc2maptool.mapRecord import MapRecord self.__dict__.update(newData) #if not isinstance(self.state, types.GameStates): self.state = types.Ga...
python
def inflate(self, newData={}): """ensure all object attribute values are objects""" from sc2maptool.functions import selectMap from sc2maptool.mapRecord import MapRecord self.__dict__.update(newData) #if not isinstance(self.state, types.GameStates): self.state = types.Ga...
[ "def", "inflate", "(", "self", ",", "newData", "=", "{", "}", ")", ":", "from", "sc2maptool", ".", "functions", "import", "selectMap", "from", "sc2maptool", ".", "mapRecord", "import", "MapRecord", "self", ".", "__dict__", ".", "update", "(", "newData", ")...
ensure all object attribute values are objects
[ "ensure", "all", "object", "attribute", "values", "are", "objects" ]
train
https://github.com/ttinies/sc2gameLobby/blob/5352d51d53ddeb4858e92e682da89c4434123e52/sc2gameLobby/gameConfig.py#L372-L385
ttinies/sc2gameLobby
sc2gameLobby/gameConfig.py
Config.launchApp
def launchApp(self, **kwargs): """Launch Starcraft2 process in the background using this configuration. WARNING: if the same IP address and port are specified between multiple SC2 process instances, all subsequent processes after the first will fail to initialize and cr...
python
def launchApp(self, **kwargs): """Launch Starcraft2 process in the background using this configuration. WARNING: if the same IP address and port are specified between multiple SC2 process instances, all subsequent processes after the first will fail to initialize and cr...
[ "def", "launchApp", "(", "self", ",", "*", "*", "kwargs", ")", ":", "app", "=", "self", ".", "installedApp", "# TODO -- launch host in window minimized/headless mode", "vers", "=", "self", ".", "getVersion", "(", ")", "return", "app", ".", "start", "(", "versi...
Launch Starcraft2 process in the background using this configuration. WARNING: if the same IP address and port are specified between multiple SC2 process instances, all subsequent processes after the first will fail to initialize and crash.
[ "Launch", "Starcraft2", "process", "in", "the", "background", "using", "this", "configuration", ".", "WARNING", ":", "if", "the", "same", "IP", "address", "and", "port", "are", "specified", "between", "multiple", "SC2", "process", "instances", "all", "subsequent...
train
https://github.com/ttinies/sc2gameLobby/blob/5352d51d53ddeb4858e92e682da89c4434123e52/sc2gameLobby/gameConfig.py#L387-L397
ttinies/sc2gameLobby
sc2gameLobby/gameConfig.py
Config.load
def load(self, cfgFile=None, timeout=None): """expect that the data file has already been established""" #if cfgFile != None: self.cfgFile = cfgFile # if it's specified, use it if not cfgFile: cfgs = activeConfigs() if len(cfgs) > 1: raise Exception("found too many conf...
python
def load(self, cfgFile=None, timeout=None): """expect that the data file has already been established""" #if cfgFile != None: self.cfgFile = cfgFile # if it's specified, use it if not cfgFile: cfgs = activeConfigs() if len(cfgs) > 1: raise Exception("found too many conf...
[ "def", "load", "(", "self", ",", "cfgFile", "=", "None", ",", "timeout", "=", "None", ")", ":", "#if cfgFile != None: self.cfgFile = cfgFile # if it's specified, use it", "if", "not", "cfgFile", ":", "cfgs", "=", "activeConfigs", "(", ")", "if", "len", "(", "cfg...
expect that the data file has already been established
[ "expect", "that", "the", "data", "file", "has", "already", "been", "established" ]
train
https://github.com/ttinies/sc2gameLobby/blob/5352d51d53ddeb4858e92e682da89c4434123e52/sc2gameLobby/gameConfig.py#L399-L429
ttinies/sc2gameLobby
sc2gameLobby/gameConfig.py
Config.loadJson
def loadJson(self, data): """convert the json data into updating this obj's attrs""" if not isinstance(data, dict): data = json.loads(data) self.__dict__.update(data) self.inflate() # restore objects from str values #if self.ports: self._gotPorts = True retur...
python
def loadJson(self, data): """convert the json data into updating this obj's attrs""" if not isinstance(data, dict): data = json.loads(data) self.__dict__.update(data) self.inflate() # restore objects from str values #if self.ports: self._gotPorts = True retur...
[ "def", "loadJson", "(", "self", ",", "data", ")", ":", "if", "not", "isinstance", "(", "data", ",", "dict", ")", ":", "data", "=", "json", ".", "loads", "(", "data", ")", "self", ".", "__dict__", ".", "update", "(", "data", ")", "self", ".", "inf...
convert the json data into updating this obj's attrs
[ "convert", "the", "json", "data", "into", "updating", "this", "obj", "s", "attrs" ]
train
https://github.com/ttinies/sc2gameLobby/blob/5352d51d53ddeb4858e92e682da89c4434123e52/sc2gameLobby/gameConfig.py#L431-L438
ttinies/sc2gameLobby
sc2gameLobby/gameConfig.py
Config.toJson
def toJson(self, data=None, pretty=False): """convert the flattened dictionary into json""" if data==None: data = self.attrs data = self.flatten(data) # don't send objects as str in json #if pretty: ret = json.dumps(data, indent=4, sort_keys=True) #self.inflate() # restor...
python
def toJson(self, data=None, pretty=False): """convert the flattened dictionary into json""" if data==None: data = self.attrs data = self.flatten(data) # don't send objects as str in json #if pretty: ret = json.dumps(data, indent=4, sort_keys=True) #self.inflate() # restor...
[ "def", "toJson", "(", "self", ",", "data", "=", "None", ",", "pretty", "=", "False", ")", ":", "if", "data", "==", "None", ":", "data", "=", "self", ".", "attrs", "data", "=", "self", ".", "flatten", "(", "data", ")", "# don't send objects as str in js...
convert the flattened dictionary into json
[ "convert", "the", "flattened", "dictionary", "into", "json" ]
train
https://github.com/ttinies/sc2gameLobby/blob/5352d51d53ddeb4858e92e682da89c4434123e52/sc2gameLobby/gameConfig.py#L440-L447
ttinies/sc2gameLobby
sc2gameLobby/gameConfig.py
Config.getVersion
def getVersion(self): """the executable application's version""" if isinstance(self.version, versions.Version): return self.version if self.version: # verify specified version exists version = versions.Version(self.version) # create this object to allow self._version_ to be specifie...
python
def getVersion(self): """the executable application's version""" if isinstance(self.version, versions.Version): return self.version if self.version: # verify specified version exists version = versions.Version(self.version) # create this object to allow self._version_ to be specifie...
[ "def", "getVersion", "(", "self", ")", ":", "if", "isinstance", "(", "self", ".", "version", ",", "versions", ".", "Version", ")", ":", "return", "self", ".", "version", "if", "self", ".", "version", ":", "# verify specified version exists", "version", "=", ...
the executable application's version
[ "the", "executable", "application", "s", "version" ]
train
https://github.com/ttinies/sc2gameLobby/blob/5352d51d53ddeb4858e92e682da89c4434123e52/sc2gameLobby/gameConfig.py#L449-L468
ttinies/sc2gameLobby
sc2gameLobby/gameConfig.py
Config.getIPaddresses
def getIPaddresses(self): """identify the IP addresses where this process client will launch the SC2 client""" if not self.ipAddress: self.ipAddress = ipAddresses.getAll() # update with IP address return self.ipAddress
python
def getIPaddresses(self): """identify the IP addresses where this process client will launch the SC2 client""" if not self.ipAddress: self.ipAddress = ipAddresses.getAll() # update with IP address return self.ipAddress
[ "def", "getIPaddresses", "(", "self", ")", ":", "if", "not", "self", ".", "ipAddress", ":", "self", ".", "ipAddress", "=", "ipAddresses", ".", "getAll", "(", ")", "# update with IP address", "return", "self", ".", "ipAddress" ]
identify the IP addresses where this process client will launch the SC2 client
[ "identify", "the", "IP", "addresses", "where", "this", "process", "client", "will", "launch", "the", "SC2", "client" ]
train
https://github.com/ttinies/sc2gameLobby/blob/5352d51d53ddeb4858e92e682da89c4434123e52/sc2gameLobby/gameConfig.py#L470-L474
ttinies/sc2gameLobby
sc2gameLobby/gameConfig.py
Config.getPorts
def getPorts(self): """acquire ports to be used by the SC2 client launched by this process""" if self.ports: # no need to get ports if ports are al return self.ports if not self._gotPorts: self.ports = [ portpicker.pick_unused_port(), # game_port ...
python
def getPorts(self): """acquire ports to be used by the SC2 client launched by this process""" if self.ports: # no need to get ports if ports are al return self.ports if not self._gotPorts: self.ports = [ portpicker.pick_unused_port(), # game_port ...
[ "def", "getPorts", "(", "self", ")", ":", "if", "self", ".", "ports", ":", "# no need to get ports if ports are al", "return", "self", ".", "ports", "if", "not", "self", ".", "_gotPorts", ":", "self", ".", "ports", "=", "[", "portpicker", ".", "pick_unused_p...
acquire ports to be used by the SC2 client launched by this process
[ "acquire", "ports", "to", "be", "used", "by", "the", "SC2", "client", "launched", "by", "this", "process" ]
train
https://github.com/ttinies/sc2gameLobby/blob/5352d51d53ddeb4858e92e682da89c4434123e52/sc2gameLobby/gameConfig.py#L476-L487
ttinies/sc2gameLobby
sc2gameLobby/gameConfig.py
Config.requestCreateDetails
def requestCreateDetails(self): """add configuration to the SC2 protocol create request""" createReq = sc_pb.RequestCreateGame( # used to advance to Status.initGame state, when hosting realtime = self.realtime, disable_fog = self.fogDisabled, random_seed = int(time...
python
def requestCreateDetails(self): """add configuration to the SC2 protocol create request""" createReq = sc_pb.RequestCreateGame( # used to advance to Status.initGame state, when hosting realtime = self.realtime, disable_fog = self.fogDisabled, random_seed = int(time...
[ "def", "requestCreateDetails", "(", "self", ")", ":", "createReq", "=", "sc_pb", ".", "RequestCreateGame", "(", "# used to advance to Status.initGame state, when hosting", "realtime", "=", "self", ".", "realtime", ",", "disable_fog", "=", "self", ".", "fogDisabled", "...
add configuration to the SC2 protocol create request
[ "add", "configuration", "to", "the", "SC2", "protocol", "create", "request" ]
train
https://github.com/ttinies/sc2gameLobby/blob/5352d51d53ddeb4858e92e682da89c4434123e52/sc2gameLobby/gameConfig.py#L489-L504
ttinies/sc2gameLobby
sc2gameLobby/gameConfig.py
Config.requestJoinDetails
def requestJoinDetails(self): """add configuration information to the SC2 protocol join request REQUIREMENTS FOR SUCCESSFUL LAUNCH: server game_port must match between all join requests to client (represents the host's port to sync game clients) server base_port client game_port must be unique b...
python
def requestJoinDetails(self): """add configuration information to the SC2 protocol join request REQUIREMENTS FOR SUCCESSFUL LAUNCH: server game_port must match between all join requests to client (represents the host's port to sync game clients) server base_port client game_port must be unique b...
[ "def", "requestJoinDetails", "(", "self", ")", ":", "raw", ",", "score", ",", "feature", ",", "rendered", "=", "self", ".", "interfaces", "interface", "=", "sc_pb", ".", "InterfaceOptions", "(", ")", "interface", ".", "raw", "=", "raw", "# whether raw data i...
add configuration information to the SC2 protocol join request REQUIREMENTS FOR SUCCESSFUL LAUNCH: server game_port must match between all join requests to client (represents the host's port to sync game clients) server base_port client game_port must be unique between each client (represents ???) c...
[ "add", "configuration", "information", "to", "the", "SC2", "protocol", "join", "request", "REQUIREMENTS", "FOR", "SUCCESSFUL", "LAUNCH", ":", "server", "game_port", "must", "match", "between", "all", "join", "requests", "to", "client", "(", "represents", "the", ...
train
https://github.com/ttinies/sc2gameLobby/blob/5352d51d53ddeb4858e92e682da89c4434123e52/sc2gameLobby/gameConfig.py#L506-L548
ttinies/sc2gameLobby
sc2gameLobby/gameConfig.py
Config.returnPorts
def returnPorts(self): """deallocate specific ports on the current machine""" if self._gotPorts: #print("deleting ports >%s<"%(self.ports)) map(portpicker.return_port, self.ports) self._gotPorts = False self.ports = []
python
def returnPorts(self): """deallocate specific ports on the current machine""" if self._gotPorts: #print("deleting ports >%s<"%(self.ports)) map(portpicker.return_port, self.ports) self._gotPorts = False self.ports = []
[ "def", "returnPorts", "(", "self", ")", ":", "if", "self", ".", "_gotPorts", ":", "#print(\"deleting ports >%s<\"%(self.ports))", "map", "(", "portpicker", ".", "return_port", ",", "self", ".", "ports", ")", "self", ".", "_gotPorts", "=", "False", "self", ".",...
deallocate specific ports on the current machine
[ "deallocate", "specific", "ports", "on", "the", "current", "machine" ]
train
https://github.com/ttinies/sc2gameLobby/blob/5352d51d53ddeb4858e92e682da89c4434123e52/sc2gameLobby/gameConfig.py#L550-L556
ttinies/sc2gameLobby
sc2gameLobby/gameConfig.py
Config.save
def save(self, filename=None, debug=False): """save a data file such that all processes know the game that is running""" if not filename: filename = self.name with open(filename, "w") as f: # save config data file f.write(self.toJson(self.attrs)) if self.debug or debug: ...
python
def save(self, filename=None, debug=False): """save a data file such that all processes know the game that is running""" if not filename: filename = self.name with open(filename, "w") as f: # save config data file f.write(self.toJson(self.attrs)) if self.debug or debug: ...
[ "def", "save", "(", "self", ",", "filename", "=", "None", ",", "debug", "=", "False", ")", ":", "if", "not", "filename", ":", "filename", "=", "self", ".", "name", "with", "open", "(", "filename", ",", "\"w\"", ")", "as", "f", ":", "# save config dat...
save a data file such that all processes know the game that is running
[ "save", "a", "data", "file", "such", "that", "all", "processes", "know", "the", "game", "that", "is", "running" ]
train
https://github.com/ttinies/sc2gameLobby/blob/5352d51d53ddeb4858e92e682da89c4434123e52/sc2gameLobby/gameConfig.py#L558-L566
ttinies/sc2gameLobby
sc2gameLobby/gameConfig.py
Config.updateIDs
def updateIDs(self, ginfo, tag=None, debug=False): """ensure all player's playerIDs are correct given game's info""" # SC2APIProtocol.ResponseGameInfo attributes: # map_name # mod_names # local_map_path # player_info # s...
python
def updateIDs(self, ginfo, tag=None, debug=False): """ensure all player's playerIDs are correct given game's info""" # SC2APIProtocol.ResponseGameInfo attributes: # map_name # mod_names # local_map_path # player_info # s...
[ "def", "updateIDs", "(", "self", ",", "ginfo", ",", "tag", "=", "None", ",", "debug", "=", "False", ")", ":", "# SC2APIProtocol.ResponseGameInfo attributes:", "# map_name", "# mod_names", "# local_map_path", "# player_info", "# start_raw", "# options", "thisPlayer", "...
ensure all player's playerIDs are correct given game's info
[ "ensure", "all", "player", "s", "playerIDs", "are", "correct", "given", "game", "s", "info" ]
train
https://github.com/ttinies/sc2gameLobby/blob/5352d51d53ddeb4858e92e682da89c4434123e52/sc2gameLobby/gameConfig.py#L568-L591
ttinies/sc2gameLobby
sc2gameLobby/gameConfig.py
Config.whoAmI
def whoAmI(self): """return the player object that owns this configuration""" self.inflate() # ensure self.players contains player objects if self.thePlayer: for p in self.players: if p.name != self.thePlayer: continue return p elif len(self.pl...
python
def whoAmI(self): """return the player object that owns this configuration""" self.inflate() # ensure self.players contains player objects if self.thePlayer: for p in self.players: if p.name != self.thePlayer: continue return p elif len(self.pl...
[ "def", "whoAmI", "(", "self", ")", ":", "self", ".", "inflate", "(", ")", "# ensure self.players contains player objects", "if", "self", ".", "thePlayer", ":", "for", "p", "in", "self", ".", "players", ":", "if", "p", ".", "name", "!=", "self", ".", "the...
return the player object that owns this configuration
[ "return", "the", "player", "object", "that", "owns", "this", "configuration" ]
train
https://github.com/ttinies/sc2gameLobby/blob/5352d51d53ddeb4858e92e682da89c4434123e52/sc2gameLobby/gameConfig.py#L593-L604
jsvine/tinyapi
tinyapi/session.py
Session.request
def request(self, service, data): """ Makes a call to TinyLetter's __svcbus__ endpoint. """ _res = self._request(service, data) res = _res.json()[0][0] if res["success"] == True: return res["result"] else: err_msg = res["errmsg"] ...
python
def request(self, service, data): """ Makes a call to TinyLetter's __svcbus__ endpoint. """ _res = self._request(service, data) res = _res.json()[0][0] if res["success"] == True: return res["result"] else: err_msg = res["errmsg"] ...
[ "def", "request", "(", "self", ",", "service", ",", "data", ")", ":", "_res", "=", "self", ".", "_request", "(", "service", ",", "data", ")", "res", "=", "_res", ".", "json", "(", ")", "[", "0", "]", "[", "0", "]", "if", "res", "[", "\"success\...
Makes a call to TinyLetter's __svcbus__ endpoint.
[ "Makes", "a", "call", "to", "TinyLetter", "s", "__svcbus__", "endpoint", "." ]
train
https://github.com/jsvine/tinyapi/blob/ac2cf0400b2a9b22bd0b1f43b36be99f5d1a787c/tinyapi/session.py#L51-L61
jsvine/tinyapi
tinyapi/session.py
Session.get_messages
def get_messages(self, statuses=DEFAULT_MESSAGE_STATUSES, order="sent_at desc", offset=None, count=None, content=False): """Returns a list of messages your account sent. Messages are sorted by ``order``, starting at an optional integer...
python
def get_messages(self, statuses=DEFAULT_MESSAGE_STATUSES, order="sent_at desc", offset=None, count=None, content=False): """Returns a list of messages your account sent. Messages are sorted by ``order``, starting at an optional integer...
[ "def", "get_messages", "(", "self", ",", "statuses", "=", "DEFAULT_MESSAGE_STATUSES", ",", "order", "=", "\"sent_at desc\"", ",", "offset", "=", "None", ",", "count", "=", "None", ",", "content", "=", "False", ")", ":", "req_data", "=", "[", "{", "\"status...
Returns a list of messages your account sent. Messages are sorted by ``order``, starting at an optional integer ``offset``, and optionally limited to the first ``count`` items (in sorted order). Returned data includes various statistics about each message, e.g., ``total_opens``, ``open_rate``,...
[ "Returns", "a", "list", "of", "messages", "your", "account", "sent", ".", "Messages", "are", "sorted", "by", "order", "starting", "at", "an", "optional", "integer", "offset", "and", "optionally", "limited", "to", "the", "first", "count", "items", "(", "in", ...
train
https://github.com/jsvine/tinyapi/blob/ac2cf0400b2a9b22bd0b1f43b36be99f5d1a787c/tinyapi/session.py#L82-L98
jsvine/tinyapi
tinyapi/session.py
Session.get_drafts
def get_drafts(self, **kwargs): """Same as Session.get_messages, but where ``statuses=["draft"]``.""" default_kwargs = { "order": "updated_at desc" } default_kwargs.update(kwargs) return self.get_messages(statuses=["draft"], **default_kwargs)
python
def get_drafts(self, **kwargs): """Same as Session.get_messages, but where ``statuses=["draft"]``.""" default_kwargs = { "order": "updated_at desc" } default_kwargs.update(kwargs) return self.get_messages(statuses=["draft"], **default_kwargs)
[ "def", "get_drafts", "(", "self", ",", "*", "*", "kwargs", ")", ":", "default_kwargs", "=", "{", "\"order\"", ":", "\"updated_at desc\"", "}", "default_kwargs", ".", "update", "(", "kwargs", ")", "return", "self", ".", "get_messages", "(", "statuses", "=", ...
Same as Session.get_messages, but where ``statuses=["draft"]``.
[ "Same", "as", "Session", ".", "get_messages", "but", "where", "statuses", "=", "[", "draft", "]", "." ]
train
https://github.com/jsvine/tinyapi/blob/ac2cf0400b2a9b22bd0b1f43b36be99f5d1a787c/tinyapi/session.py#L100-L104
jsvine/tinyapi
tinyapi/session.py
Session.get_urls
def get_urls(self, order="total_clicks desc", offset=None, count=None): """Returns a list of URLs you've included in messages. List is sorted by ``total_clicks``, starting at an optional integer ``offset``, and optionally limited to the first ``count`` items. """ req_data = [ None, orde...
python
def get_urls(self, order="total_clicks desc", offset=None, count=None): """Returns a list of URLs you've included in messages. List is sorted by ``total_clicks``, starting at an optional integer ``offset``, and optionally limited to the first ``count`` items. """ req_data = [ None, orde...
[ "def", "get_urls", "(", "self", ",", "order", "=", "\"total_clicks desc\"", ",", "offset", "=", "None", ",", "count", "=", "None", ")", ":", "req_data", "=", "[", "None", ",", "order", ",", "fmt_paging", "(", "offset", ",", "count", ")", "]", "return",...
Returns a list of URLs you've included in messages. List is sorted by ``total_clicks``, starting at an optional integer ``offset``, and optionally limited to the first ``count`` items.
[ "Returns", "a", "list", "of", "URLs", "you", "ve", "included", "in", "messages", "." ]
train
https://github.com/jsvine/tinyapi/blob/ac2cf0400b2a9b22bd0b1f43b36be99f5d1a787c/tinyapi/session.py#L115-L121
jsvine/tinyapi
tinyapi/session.py
Session.get_message_urls
def get_message_urls(self, message_id, order="total_clicks desc"): """Returns a list of URLs you've included in a specific message. List is sorted by ``total_clicks``, starting at an optional integer ``offset``, and optionally limited to the first ``count`` items. """ req_data = [ { "me...
python
def get_message_urls(self, message_id, order="total_clicks desc"): """Returns a list of URLs you've included in a specific message. List is sorted by ``total_clicks``, starting at an optional integer ``offset``, and optionally limited to the first ``count`` items. """ req_data = [ { "me...
[ "def", "get_message_urls", "(", "self", ",", "message_id", ",", "order", "=", "\"total_clicks desc\"", ")", ":", "req_data", "=", "[", "{", "\"message_id\"", ":", "str", "(", "message_id", ")", "}", ",", "order", ",", "None", "]", "return", "self", ".", ...
Returns a list of URLs you've included in a specific message. List is sorted by ``total_clicks``, starting at an optional integer ``offset``, and optionally limited to the first ``count`` items.
[ "Returns", "a", "list", "of", "URLs", "you", "ve", "included", "in", "a", "specific", "message", "." ]
train
https://github.com/jsvine/tinyapi/blob/ac2cf0400b2a9b22bd0b1f43b36be99f5d1a787c/tinyapi/session.py#L123-L129
jsvine/tinyapi
tinyapi/session.py
Session.get_subscribers
def get_subscribers(self, order="created_at desc", offset=None, count=None): """Returns a list of subscribers. List is sorted by most-recent-to-subsribe, starting at an optional integer ``offset``, and optionally limited to the first ``count`` items (in sort...
python
def get_subscribers(self, order="created_at desc", offset=None, count=None): """Returns a list of subscribers. List is sorted by most-recent-to-subsribe, starting at an optional integer ``offset``, and optionally limited to the first ``count`` items (in sort...
[ "def", "get_subscribers", "(", "self", ",", "order", "=", "\"created_at desc\"", ",", "offset", "=", "None", ",", "count", "=", "None", ")", ":", "req_data", "=", "[", "None", ",", "order", ",", "fmt_paging", "(", "offset", ",", "count", ")", "]", "ret...
Returns a list of subscribers. List is sorted by most-recent-to-subsribe, starting at an optional integer ``offset``, and optionally limited to the first ``count`` items (in sorted order). Returned data includes various statistics about each subscriber, e.g., ``total_sent``, ``total_opens``, `...
[ "Returns", "a", "list", "of", "subscribers", ".", "List", "is", "sorted", "by", "most", "-", "recent", "-", "to", "-", "subsribe", "starting", "at", "an", "optional", "integer", "offset", "and", "optionally", "limited", "to", "the", "first", "count", "item...
train
https://github.com/jsvine/tinyapi/blob/ac2cf0400b2a9b22bd0b1f43b36be99f5d1a787c/tinyapi/session.py#L135-L146
Parsl/libsubmit
libsubmit/providers/local/local.py
LocalProvider.status
def status(self, job_ids): ''' Get the status of a list of jobs identified by their ids. Args: - job_ids (List of ids) : List of identifiers for the jobs Returns: - List of status codes. ''' logging.debug("Checking status of : {0}".format(job_ids)) ...
python
def status(self, job_ids): ''' Get the status of a list of jobs identified by their ids. Args: - job_ids (List of ids) : List of identifiers for the jobs Returns: - List of status codes. ''' logging.debug("Checking status of : {0}".format(job_ids)) ...
[ "def", "status", "(", "self", ",", "job_ids", ")", ":", "logging", ".", "debug", "(", "\"Checking status of : {0}\"", ".", "format", "(", "job_ids", ")", ")", "for", "job_id", "in", "self", ".", "resources", ":", "poll_code", "=", "self", ".", "resources",...
Get the status of a list of jobs identified by their ids. Args: - job_ids (List of ids) : List of identifiers for the jobs Returns: - List of status codes.
[ "Get", "the", "status", "of", "a", "list", "of", "jobs", "identified", "by", "their", "ids", "." ]
train
https://github.com/Parsl/libsubmit/blob/27a41c16dd6f1c16d830a9ce1c97804920a59f64/libsubmit/providers/local/local.py#L77-L101
Parsl/libsubmit
libsubmit/providers/local/local.py
LocalProvider._write_submit_script
def _write_submit_script(self, script_string, script_filename): ''' Load the template string with config values and write the generated submit script to a submit script file. Args: - template_string (string) : The template string to be used for the writing submit script ...
python
def _write_submit_script(self, script_string, script_filename): ''' Load the template string with config values and write the generated submit script to a submit script file. Args: - template_string (string) : The template string to be used for the writing submit script ...
[ "def", "_write_submit_script", "(", "self", ",", "script_string", ",", "script_filename", ")", ":", "try", ":", "with", "open", "(", "script_filename", ",", "'w'", ")", "as", "f", ":", "f", ".", "write", "(", "script_string", ")", "except", "KeyError", "as...
Load the template string with config values and write the generated submit script to a submit script file. Args: - template_string (string) : The template string to be used for the writing submit script - script_filename (string) : Name of the submit script Returns:...
[ "Load", "the", "template", "string", "with", "config", "values", "and", "write", "the", "generated", "submit", "script", "to", "a", "submit", "script", "file", "." ]
train
https://github.com/Parsl/libsubmit/blob/27a41c16dd6f1c16d830a9ce1c97804920a59f64/libsubmit/providers/local/local.py#L103-L132
Parsl/libsubmit
libsubmit/providers/local/local.py
LocalProvider.submit
def submit(self, command, blocksize, job_name="parsl.auto"): ''' Submits the command onto an Local Resource Manager job of blocksize parallel elements. Submit returns an ID that corresponds to the task that was just submitted. If tasks_per_node < 1: 1/tasks_per_node is provisioned...
python
def submit(self, command, blocksize, job_name="parsl.auto"): ''' Submits the command onto an Local Resource Manager job of blocksize parallel elements. Submit returns an ID that corresponds to the task that was just submitted. If tasks_per_node < 1: 1/tasks_per_node is provisioned...
[ "def", "submit", "(", "self", ",", "command", ",", "blocksize", ",", "job_name", "=", "\"parsl.auto\"", ")", ":", "job_name", "=", "\"{0}.{1}\"", ".", "format", "(", "job_name", ",", "time", ".", "time", "(", ")", ")", "# Set script path", "script_path", "...
Submits the command onto an Local Resource Manager job of blocksize parallel elements. Submit returns an ID that corresponds to the task that was just submitted. If tasks_per_node < 1: 1/tasks_per_node is provisioned If tasks_per_node == 1: A single node is provision...
[ "Submits", "the", "command", "onto", "an", "Local", "Resource", "Manager", "job", "of", "blocksize", "parallel", "elements", ".", "Submit", "returns", "an", "ID", "that", "corresponds", "to", "the", "task", "that", "was", "just", "submitted", "." ]
train
https://github.com/Parsl/libsubmit/blob/27a41c16dd6f1c16d830a9ce1c97804920a59f64/libsubmit/providers/local/local.py#L134-L173
Parsl/libsubmit
libsubmit/providers/local/local.py
LocalProvider.cancel
def cancel(self, job_ids): ''' Cancels the jobs specified by a list of job ids Args: job_ids : [<job_id> ...] Returns : [True/False...] : If the cancel operation fails the entire list will be False. ''' for job in job_ids: logger.debug("Terminating ...
python
def cancel(self, job_ids): ''' Cancels the jobs specified by a list of job ids Args: job_ids : [<job_id> ...] Returns : [True/False...] : If the cancel operation fails the entire list will be False. ''' for job in job_ids: logger.debug("Terminating ...
[ "def", "cancel", "(", "self", ",", "job_ids", ")", ":", "for", "job", "in", "job_ids", ":", "logger", ".", "debug", "(", "\"Terminating job/proc_id : {0}\"", ".", "format", "(", "job", ")", ")", "# Here we are assuming that for local, the job_ids are the process id's"...
Cancels the jobs specified by a list of job ids Args: job_ids : [<job_id> ...] Returns : [True/False...] : If the cancel operation fails the entire list will be False.
[ "Cancels", "the", "jobs", "specified", "by", "a", "list", "of", "job", "ids" ]
train
https://github.com/Parsl/libsubmit/blob/27a41c16dd6f1c16d830a9ce1c97804920a59f64/libsubmit/providers/local/local.py#L175-L193
xolox/python-vcs-repo-mgr
vcs_repo_mgr/backends/hg.py
HgRepo.is_bare
def is_bare(self): """ :data:`True` if the repository has no working tree, :data:`False` if it does. The value of this property is computed by running the ``hg id`` command to check whether the special global revision id ``000000000000`` is reported. """ # Make s...
python
def is_bare(self): """ :data:`True` if the repository has no working tree, :data:`False` if it does. The value of this property is computed by running the ``hg id`` command to check whether the special global revision id ``000000000000`` is reported. """ # Make s...
[ "def", "is_bare", "(", "self", ")", ":", "# Make sure the local repository exists.", "self", ".", "create", "(", ")", "# Check the global revision id of the working tree.", "try", ":", "output", "=", "self", ".", "context", ".", "capture", "(", "'hg'", ",", "'id'", ...
:data:`True` if the repository has no working tree, :data:`False` if it does. The value of this property is computed by running the ``hg id`` command to check whether the special global revision id ``000000000000`` is reported.
[ ":", "data", ":", "True", "if", "the", "repository", "has", "no", "working", "tree", ":", "data", ":", "False", "if", "it", "does", "." ]
train
https://github.com/xolox/python-vcs-repo-mgr/blob/fdad2441a3e7ba5deeeddfa1c2f5ebc00c393aed/vcs_repo_mgr/backends/hg.py#L65-L81
xolox/python-vcs-repo-mgr
vcs_repo_mgr/backends/hg.py
HgRepo.known_remotes
def known_remotes(self): """The names of the configured remote repositories (a list of :class:`.Remote` objects).""" objects = [] for line in self.context.capture('hg', 'paths').splitlines(): name, _, location = line.partition('=') if name and location: na...
python
def known_remotes(self): """The names of the configured remote repositories (a list of :class:`.Remote` objects).""" objects = [] for line in self.context.capture('hg', 'paths').splitlines(): name, _, location = line.partition('=') if name and location: na...
[ "def", "known_remotes", "(", "self", ")", ":", "objects", "=", "[", "]", "for", "line", "in", "self", ".", "context", ".", "capture", "(", "'hg'", ",", "'paths'", ")", ".", "splitlines", "(", ")", ":", "name", ",", "_", ",", "location", "=", "line"...
The names of the configured remote repositories (a list of :class:`.Remote` objects).
[ "The", "names", "of", "the", "configured", "remote", "repositories", "(", "a", "list", "of", ":", "class", ":", ".", "Remote", "objects", ")", "." ]
train
https://github.com/xolox/python-vcs-repo-mgr/blob/fdad2441a3e7ba5deeeddfa1c2f5ebc00c393aed/vcs_repo_mgr/backends/hg.py#L93-L111
xolox/python-vcs-repo-mgr
vcs_repo_mgr/backends/hg.py
HgRepo.merge_conflicts
def merge_conflicts(self): """The filenames of any files with merge conflicts (a list of strings).""" filenames = set() listing = self.context.capture('hg', 'resolve', '--list') for line in listing.splitlines(): tokens = line.split(None, 1) if len(tokens) == 2: ...
python
def merge_conflicts(self): """The filenames of any files with merge conflicts (a list of strings).""" filenames = set() listing = self.context.capture('hg', 'resolve', '--list') for line in listing.splitlines(): tokens = line.split(None, 1) if len(tokens) == 2: ...
[ "def", "merge_conflicts", "(", "self", ")", ":", "filenames", "=", "set", "(", ")", "listing", "=", "self", ".", "context", ".", "capture", "(", "'hg'", ",", "'resolve'", ",", "'--list'", ")", "for", "line", "in", "listing", ".", "splitlines", "(", ")"...
The filenames of any files with merge conflicts (a list of strings).
[ "The", "filenames", "of", "any", "files", "with", "merge", "conflicts", "(", "a", "list", "of", "strings", ")", "." ]
train
https://github.com/xolox/python-vcs-repo-mgr/blob/fdad2441a3e7ba5deeeddfa1c2f5ebc00c393aed/vcs_repo_mgr/backends/hg.py#L114-L124
xolox/python-vcs-repo-mgr
vcs_repo_mgr/backends/hg.py
HgRepo.find_branches
def find_branches(self): """ Find the branches in the Mercurial repository. :returns: A generator of :class:`.Revision` objects. .. note:: Closed branches are not included. """ listing = self.context.capture('hg', 'branches') for line in listing.splitlines(): ...
python
def find_branches(self): """ Find the branches in the Mercurial repository. :returns: A generator of :class:`.Revision` objects. .. note:: Closed branches are not included. """ listing = self.context.capture('hg', 'branches') for line in listing.splitlines(): ...
[ "def", "find_branches", "(", "self", ")", ":", "listing", "=", "self", ".", "context", ".", "capture", "(", "'hg'", ",", "'branches'", ")", "for", "line", "in", "listing", ".", "splitlines", "(", ")", ":", "tokens", "=", "line", ".", "split", "(", ")...
Find the branches in the Mercurial repository. :returns: A generator of :class:`.Revision` objects. .. note:: Closed branches are not included.
[ "Find", "the", "branches", "in", "the", "Mercurial", "repository", "." ]
train
https://github.com/xolox/python-vcs-repo-mgr/blob/fdad2441a3e7ba5deeeddfa1c2f5ebc00c393aed/vcs_repo_mgr/backends/hg.py#L137-L155
xolox/python-vcs-repo-mgr
vcs_repo_mgr/backends/hg.py
HgRepo.find_revision_id
def find_revision_id(self, revision=None): """Find the global revision id of the given revision.""" # Make sure the local repository exists. self.create() # Try to find the revision id of the specified revision. revision = revision or self.default_revision output = self.c...
python
def find_revision_id(self, revision=None): """Find the global revision id of the given revision.""" # Make sure the local repository exists. self.create() # Try to find the revision id of the specified revision. revision = revision or self.default_revision output = self.c...
[ "def", "find_revision_id", "(", "self", ",", "revision", "=", "None", ")", ":", "# Make sure the local repository exists.", "self", ".", "create", "(", ")", "# Try to find the revision id of the specified revision.", "revision", "=", "revision", "or", "self", ".", "defa...
Find the global revision id of the given revision.
[ "Find", "the", "global", "revision", "id", "of", "the", "given", "revision", "." ]
train
https://github.com/xolox/python-vcs-repo-mgr/blob/fdad2441a3e7ba5deeeddfa1c2f5ebc00c393aed/vcs_repo_mgr/backends/hg.py#L157-L165
xolox/python-vcs-repo-mgr
vcs_repo_mgr/backends/hg.py
HgRepo.find_revision_number
def find_revision_number(self, revision=None): """Find the local revision number of the given revision.""" # Make sure the local repository exists. self.create() # Try to find the revision number of the specified revision. revision = revision or self.default_revision outp...
python
def find_revision_number(self, revision=None): """Find the local revision number of the given revision.""" # Make sure the local repository exists. self.create() # Try to find the revision number of the specified revision. revision = revision or self.default_revision outp...
[ "def", "find_revision_number", "(", "self", ",", "revision", "=", "None", ")", ":", "# Make sure the local repository exists.", "self", ".", "create", "(", ")", "# Try to find the revision number of the specified revision.", "revision", "=", "revision", "or", "self", ".",...
Find the local revision number of the given revision.
[ "Find", "the", "local", "revision", "number", "of", "the", "given", "revision", "." ]
train
https://github.com/xolox/python-vcs-repo-mgr/blob/fdad2441a3e7ba5deeeddfa1c2f5ebc00c393aed/vcs_repo_mgr/backends/hg.py#L167-L178
xolox/python-vcs-repo-mgr
vcs_repo_mgr/backends/hg.py
HgRepo.find_tags
def find_tags(self): """Find information about the tags in the repository.""" listing = self.context.capture('hg', 'tags') for line in listing.splitlines(): tokens = line.split() if len(tokens) >= 2 and ':' in tokens[1]: revision_number, revision_id = toke...
python
def find_tags(self): """Find information about the tags in the repository.""" listing = self.context.capture('hg', 'tags') for line in listing.splitlines(): tokens = line.split() if len(tokens) >= 2 and ':' in tokens[1]: revision_number, revision_id = toke...
[ "def", "find_tags", "(", "self", ")", ":", "listing", "=", "self", ".", "context", ".", "capture", "(", "'hg'", ",", "'tags'", ")", "for", "line", "in", "listing", ".", "splitlines", "(", ")", ":", "tokens", "=", "line", ".", "split", "(", ")", "if...
Find information about the tags in the repository.
[ "Find", "information", "about", "the", "tags", "in", "the", "repository", "." ]
train
https://github.com/xolox/python-vcs-repo-mgr/blob/fdad2441a3e7ba5deeeddfa1c2f5ebc00c393aed/vcs_repo_mgr/backends/hg.py#L180-L192
xolox/python-vcs-repo-mgr
vcs_repo_mgr/backends/hg.py
HgRepo.get_checkout_command
def get_checkout_command(self, revision, clean=False): """Get the command to update the working tree of the local repository.""" command = ['hg', 'update'] if clean: command.append('--clean') command.append('--rev=%s' % revision) return command
python
def get_checkout_command(self, revision, clean=False): """Get the command to update the working tree of the local repository.""" command = ['hg', 'update'] if clean: command.append('--clean') command.append('--rev=%s' % revision) return command
[ "def", "get_checkout_command", "(", "self", ",", "revision", ",", "clean", "=", "False", ")", ":", "command", "=", "[", "'hg'", ",", "'update'", "]", "if", "clean", ":", "command", ".", "append", "(", "'--clean'", ")", "command", ".", "append", "(", "'...
Get the command to update the working tree of the local repository.
[ "Get", "the", "command", "to", "update", "the", "working", "tree", "of", "the", "local", "repository", "." ]
train
https://github.com/xolox/python-vcs-repo-mgr/blob/fdad2441a3e7ba5deeeddfa1c2f5ebc00c393aed/vcs_repo_mgr/backends/hg.py#L200-L206
xolox/python-vcs-repo-mgr
vcs_repo_mgr/backends/hg.py
HgRepo.get_commit_command
def get_commit_command(self, message, author=None): """ Get the command to commit changes to tracked files in the working tree. This method uses the ``hg remove --after`` to match the semantics of ``git commit --all`` (which is _not_ the same as ``hg commit --addremove``) howeve...
python
def get_commit_command(self, message, author=None): """ Get the command to commit changes to tracked files in the working tree. This method uses the ``hg remove --after`` to match the semantics of ``git commit --all`` (which is _not_ the same as ``hg commit --addremove``) howeve...
[ "def", "get_commit_command", "(", "self", ",", "message", ",", "author", "=", "None", ")", ":", "tokens", "=", "[", "'hg remove --after 2>/dev/null; hg commit'", "]", "if", "author", ":", "tokens", ".", "append", "(", "'--user=%s'", "%", "quote", "(", "author"...
Get the command to commit changes to tracked files in the working tree. This method uses the ``hg remove --after`` to match the semantics of ``git commit --all`` (which is _not_ the same as ``hg commit --addremove``) however ``hg remove --after`` is _very_ verbose (it comments on every ...
[ "Get", "the", "command", "to", "commit", "changes", "to", "tracked", "files", "in", "the", "working", "tree", "." ]
train
https://github.com/xolox/python-vcs-repo-mgr/blob/fdad2441a3e7ba5deeeddfa1c2f5ebc00c393aed/vcs_repo_mgr/backends/hg.py#L208-L223
xolox/python-vcs-repo-mgr
vcs_repo_mgr/backends/hg.py
HgRepo.get_delete_branch_command
def get_delete_branch_command(self, branch_name, message, author): """Get the command to delete or close a branch in the local repository.""" tokens = ['hg update --rev=%s && hg commit' % quote(branch_name)] if author: tokens.append('--user=%s' % quote(author.combined)) token...
python
def get_delete_branch_command(self, branch_name, message, author): """Get the command to delete or close a branch in the local repository.""" tokens = ['hg update --rev=%s && hg commit' % quote(branch_name)] if author: tokens.append('--user=%s' % quote(author.combined)) token...
[ "def", "get_delete_branch_command", "(", "self", ",", "branch_name", ",", "message", ",", "author", ")", ":", "tokens", "=", "[", "'hg update --rev=%s && hg commit'", "%", "quote", "(", "branch_name", ")", "]", "if", "author", ":", "tokens", ".", "append", "("...
Get the command to delete or close a branch in the local repository.
[ "Get", "the", "command", "to", "delete", "or", "close", "a", "branch", "in", "the", "local", "repository", "." ]
train
https://github.com/xolox/python-vcs-repo-mgr/blob/fdad2441a3e7ba5deeeddfa1c2f5ebc00c393aed/vcs_repo_mgr/backends/hg.py#L243-L250
xolox/python-vcs-repo-mgr
vcs_repo_mgr/backends/hg.py
HgRepo.get_pull_command
def get_pull_command(self, remote=None, revision=None): """Get the command to pull changes from a remote repository into the local repository.""" command = ['hg', 'pull'] if remote: command.append(remote) if revision: command.append('--rev=%s' % revision) ...
python
def get_pull_command(self, remote=None, revision=None): """Get the command to pull changes from a remote repository into the local repository.""" command = ['hg', 'pull'] if remote: command.append(remote) if revision: command.append('--rev=%s' % revision) ...
[ "def", "get_pull_command", "(", "self", ",", "remote", "=", "None", ",", "revision", "=", "None", ")", ":", "command", "=", "[", "'hg'", ",", "'pull'", "]", "if", "remote", ":", "command", ".", "append", "(", "remote", ")", "if", "revision", ":", "co...
Get the command to pull changes from a remote repository into the local repository.
[ "Get", "the", "command", "to", "pull", "changes", "from", "a", "remote", "repository", "into", "the", "local", "repository", "." ]
train
https://github.com/xolox/python-vcs-repo-mgr/blob/fdad2441a3e7ba5deeeddfa1c2f5ebc00c393aed/vcs_repo_mgr/backends/hg.py#L260-L267
laf/russound
russound/russound.py
Russound.connect
def connect(self): """ Connect to the tcp gateway Allow for this function to be keypad agnostic If keypad value is omitted, then set it to the hex value of 70 which is the recommended value for an external device controlling the system (top of pg 3 of cav6.6_rnet_protocol_v1.01.00.pdf). ...
python
def connect(self): """ Connect to the tcp gateway Allow for this function to be keypad agnostic If keypad value is omitted, then set it to the hex value of 70 which is the recommended value for an external device controlling the system (top of pg 3 of cav6.6_rnet_protocol_v1.01.00.pdf). ...
[ "def", "connect", "(", "self", ")", ":", "try", ":", "self", ".", "sock", ".", "connect", "(", "(", "self", ".", "_host", ",", "self", ".", "_port", ")", ")", "_LOGGER", ".", "info", "(", "\"Successfully connected to Russound on %s:%s\"", ",", "self", "....
Connect to the tcp gateway Allow for this function to be keypad agnostic If keypad value is omitted, then set it to the hex value of 70 which is the recommended value for an external device controlling the system (top of pg 3 of cav6.6_rnet_protocol_v1.01.00.pdf). (In fact I don't know under ...
[ "Connect", "to", "the", "tcp", "gateway", "Allow", "for", "this", "function", "to", "be", "keypad", "agnostic", "If", "keypad", "value", "is", "omitted", "then", "set", "it", "to", "the", "hex", "value", "of", "70", "which", "is", "the", "recommended", "...
train
https://github.com/laf/russound/blob/683af823f78ad02111f9966dc7b535dd66a1f083/russound/russound.py#L44-L59
laf/russound
russound/russound.py
Russound.set_power
def set_power(self, controller, zone, power): """ Switch power on/off to a zone :param controller: Russound Controller ID. For systems with one controller this should be a value of 1. :param zone: The zone to be controlled. Expect a 1 based number. :param power: 0 = off, 1 = on "...
python
def set_power(self, controller, zone, power): """ Switch power on/off to a zone :param controller: Russound Controller ID. For systems with one controller this should be a value of 1. :param zone: The zone to be controlled. Expect a 1 based number. :param power: 0 = off, 1 = on "...
[ "def", "set_power", "(", "self", ",", "controller", ",", "zone", ",", "power", ")", ":", "_LOGGER", ".", "debug", "(", "\"Begin - controller= %s, zone= %s, change power to %s\"", ",", "controller", ",", "zone", ",", "power", ")", "send_msg", "=", "self", ".", ...
Switch power on/off to a zone :param controller: Russound Controller ID. For systems with one controller this should be a value of 1. :param zone: The zone to be controlled. Expect a 1 based number. :param power: 0 = off, 1 = on
[ "Switch", "power", "on", "/", "off", "to", "a", "zone", ":", "param", "controller", ":", "Russound", "Controller", "ID", ".", "For", "systems", "with", "one", "controller", "this", "should", "be", "a", "value", "of", "1", ".", ":", "param", "zone", ":"...
train
https://github.com/laf/russound/blob/683af823f78ad02111f9966dc7b535dd66a1f083/russound/russound.py#L69-L88
laf/russound
russound/russound.py
Russound.set_volume
def set_volume(self, controller, zone, volume): """ Set volume for zone to specific value. Divide the volume by 2 to translate to a range (0..50) as expected by Russound (Even thought the keypads show 0..100). """ _LOGGER.debug("Begin - controller= %s, zone= %s, change volume to...
python
def set_volume(self, controller, zone, volume): """ Set volume for zone to specific value. Divide the volume by 2 to translate to a range (0..50) as expected by Russound (Even thought the keypads show 0..100). """ _LOGGER.debug("Begin - controller= %s, zone= %s, change volume to...
[ "def", "set_volume", "(", "self", ",", "controller", ",", "zone", ",", "volume", ")", ":", "_LOGGER", ".", "debug", "(", "\"Begin - controller= %s, zone= %s, change volume to %s\"", ",", "controller", ",", "zone", ",", "volume", ")", "send_msg", "=", "self", "."...
Set volume for zone to specific value. Divide the volume by 2 to translate to a range (0..50) as expected by Russound (Even thought the keypads show 0..100).
[ "Set", "volume", "for", "zone", "to", "specific", "value", ".", "Divide", "the", "volume", "by", "2", "to", "translate", "to", "a", "range", "(", "0", "..", "50", ")", "as", "expected", "by", "Russound", "(", "Even", "thought", "the", "keypads", "show"...
train
https://github.com/laf/russound/blob/683af823f78ad02111f9966dc7b535dd66a1f083/russound/russound.py#L90-L108
laf/russound
russound/russound.py
Russound.set_source
def set_source(self, controller, zone, source): """ Set source for a zone - 0 based value for source """ _LOGGER.info("Begin - controller= %s, zone= %s change source to %s.", controller, zone, source) send_msg = self.create_send_message("F0 @cc 00 7F 00 @zz @kk 05 02 00 00 00 F1 3E 00 00 00 @pr...
python
def set_source(self, controller, zone, source): """ Set source for a zone - 0 based value for source """ _LOGGER.info("Begin - controller= %s, zone= %s change source to %s.", controller, zone, source) send_msg = self.create_send_message("F0 @cc 00 7F 00 @zz @kk 05 02 00 00 00 F1 3E 00 00 00 @pr...
[ "def", "set_source", "(", "self", ",", "controller", ",", "zone", ",", "source", ")", ":", "_LOGGER", ".", "info", "(", "\"Begin - controller= %s, zone= %s change source to %s.\"", ",", "controller", ",", "zone", ",", "source", ")", "send_msg", "=", "self", ".",...
Set source for a zone - 0 based value for source
[ "Set", "source", "for", "a", "zone", "-", "0", "based", "value", "for", "source" ]
train
https://github.com/laf/russound/blob/683af823f78ad02111f9966dc7b535dd66a1f083/russound/russound.py#L110-L126
laf/russound
russound/russound.py
Russound.all_on_off
def all_on_off(self, power): """ Turn all zones on or off Note that the all on function is not supported by the Russound CAA66, although it does support the all off. On and off are supported by the CAV6.6. Note: Not tested (acambitsis) """ send_msg = self.create_send_mes...
python
def all_on_off(self, power): """ Turn all zones on or off Note that the all on function is not supported by the Russound CAA66, although it does support the all off. On and off are supported by the CAV6.6. Note: Not tested (acambitsis) """ send_msg = self.create_send_mes...
[ "def", "all_on_off", "(", "self", ",", "power", ")", ":", "send_msg", "=", "self", ".", "create_send_message", "(", "\"F0 7F 00 7F 00 00 @kk 05 02 02 00 00 F1 22 00 00 @pr 00 00 01\"", ",", "None", ",", "None", ",", "power", ")", "self", ".", "send_data", "(", "se...
Turn all zones on or off Note that the all on function is not supported by the Russound CAA66, although it does support the all off. On and off are supported by the CAV6.6. Note: Not tested (acambitsis)
[ "Turn", "all", "zones", "on", "or", "off", "Note", "that", "the", "all", "on", "function", "is", "not", "supported", "by", "the", "Russound", "CAA66", "although", "it", "does", "support", "the", "all", "off", ".", "On", "and", "off", "are", "supported", ...
train
https://github.com/laf/russound/blob/683af823f78ad02111f9966dc7b535dd66a1f083/russound/russound.py#L128-L138
laf/russound
russound/russound.py
Russound.toggle_mute
def toggle_mute(self, controller, zone): """ Toggle mute on/off for a zone Note: Not tested (acambitsis) """ send_msg = self.create_send_message("F0 @cc 00 7F 00 @zz @kk 05 02 02 00 00 F1 40 00 00 00 0D 00 01", controller, zone) self.send_data...
python
def toggle_mute(self, controller, zone): """ Toggle mute on/off for a zone Note: Not tested (acambitsis) """ send_msg = self.create_send_message("F0 @cc 00 7F 00 @zz @kk 05 02 02 00 00 F1 40 00 00 00 0D 00 01", controller, zone) self.send_data...
[ "def", "toggle_mute", "(", "self", ",", "controller", ",", "zone", ")", ":", "send_msg", "=", "self", ".", "create_send_message", "(", "\"F0 @cc 00 7F 00 @zz @kk 05 02 02 00 00 F1 40 00 00 00 0D 00 01\"", ",", "controller", ",", "zone", ")", "self", ".", "send_data", ...
Toggle mute on/off for a zone Note: Not tested (acambitsis)
[ "Toggle", "mute", "on", "/", "off", "for", "a", "zone", "Note", ":", "Not", "tested", "(", "acambitsis", ")" ]
train
https://github.com/laf/russound/blob/683af823f78ad02111f9966dc7b535dd66a1f083/russound/russound.py#L140-L147
laf/russound
russound/russound.py
Russound.get_zone_info
def get_zone_info(self, controller, zone, return_variable): """ Get all relevant info for the zone When called with return_variable == 4, then the function returns a list with current volume, source and ON/OFF status. When called with 0, 1 or 2, it will return an integer wit...
python
def get_zone_info(self, controller, zone, return_variable): """ Get all relevant info for the zone When called with return_variable == 4, then the function returns a list with current volume, source and ON/OFF status. When called with 0, 1 or 2, it will return an integer wit...
[ "def", "get_zone_info", "(", "self", ",", "controller", ",", "zone", ",", "return_variable", ")", ":", "# Define the signature for a response message, used later to find the correct response from the controller.", "# FF is the hex we use to signify bytes that need to be ignored when compar...
Get all relevant info for the zone When called with return_variable == 4, then the function returns a list with current volume, source and ON/OFF status. When called with 0, 1 or 2, it will return an integer with the Power, Source and Volume
[ "Get", "all", "relevant", "info", "for", "the", "zone", "When", "called", "with", "return_variable", "==", "4", "then", "the", "function", "returns", "a", "list", "with", "current", "volume", "source", "and", "ON", "/", "OFF", "status", ".", "When", "calle...
train
https://github.com/laf/russound/blob/683af823f78ad02111f9966dc7b535dd66a1f083/russound/russound.py#L149-L184
laf/russound
russound/russound.py
Russound.get_volume
def get_volume(self, controller, zone): """ Gets the volume level which needs to be doubled to get it to the range of 0..100 - it is located on a 2 byte offset """ volume_level = self.get_zone_info(controller, zone, 2) if volume_level is not None: volume_level *= 2 re...
python
def get_volume(self, controller, zone): """ Gets the volume level which needs to be doubled to get it to the range of 0..100 - it is located on a 2 byte offset """ volume_level = self.get_zone_info(controller, zone, 2) if volume_level is not None: volume_level *= 2 re...
[ "def", "get_volume", "(", "self", ",", "controller", ",", "zone", ")", ":", "volume_level", "=", "self", ".", "get_zone_info", "(", "controller", ",", "zone", ",", "2", ")", "if", "volume_level", "is", "not", "None", ":", "volume_level", "*=", "2", "retu...
Gets the volume level which needs to be doubled to get it to the range of 0..100 - it is located on a 2 byte offset
[ "Gets", "the", "volume", "level", "which", "needs", "to", "be", "doubled", "to", "get", "it", "to", "the", "range", "of", "0", "..", "100", "-", "it", "is", "located", "on", "a", "2", "byte", "offset" ]
train
https://github.com/laf/russound/blob/683af823f78ad02111f9966dc7b535dd66a1f083/russound/russound.py#L194-L200
laf/russound
russound/russound.py
Russound.create_send_message
def create_send_message(self, string_message, controller, zone=None, parameter=None): """ Creates a message from a string, substituting the necessary parameters, that is ready to send to the socket """ cc = hex(int(controller) - 1).replace('0x', '') # RNET requires controller value to be zero ...
python
def create_send_message(self, string_message, controller, zone=None, parameter=None): """ Creates a message from a string, substituting the necessary parameters, that is ready to send to the socket """ cc = hex(int(controller) - 1).replace('0x', '') # RNET requires controller value to be zero ...
[ "def", "create_send_message", "(", "self", ",", "string_message", ",", "controller", ",", "zone", "=", "None", ",", "parameter", "=", "None", ")", ":", "cc", "=", "hex", "(", "int", "(", "controller", ")", "-", "1", ")", ".", "replace", "(", "'0x'", ...
Creates a message from a string, substituting the necessary parameters, that is ready to send to the socket
[ "Creates", "a", "message", "from", "a", "string", "substituting", "the", "necessary", "parameters", "that", "is", "ready", "to", "send", "to", "the", "socket" ]
train
https://github.com/laf/russound/blob/683af823f78ad02111f9966dc7b535dd66a1f083/russound/russound.py#L202-L224
laf/russound
russound/russound.py
Russound.create_response_signature
def create_response_signature(self, string_message, zone): """ Basic helper function to keep code clean for defining a response message signature """ zz = '' if zone is not None: zz = hex(int(zone)-1).replace('0x', '') # RNET requires zone value to be zero based string_mess...
python
def create_response_signature(self, string_message, zone): """ Basic helper function to keep code clean for defining a response message signature """ zz = '' if zone is not None: zz = hex(int(zone)-1).replace('0x', '') # RNET requires zone value to be zero based string_mess...
[ "def", "create_response_signature", "(", "self", ",", "string_message", ",", "zone", ")", ":", "zz", "=", "''", "if", "zone", "is", "not", "None", ":", "zz", "=", "hex", "(", "int", "(", "zone", ")", "-", "1", ")", ".", "replace", "(", "'0x'", ",",...
Basic helper function to keep code clean for defining a response message signature
[ "Basic", "helper", "function", "to", "keep", "code", "clean", "for", "defining", "a", "response", "message", "signature" ]
train
https://github.com/laf/russound/blob/683af823f78ad02111f9966dc7b535dd66a1f083/russound/russound.py#L226-L233
laf/russound
russound/russound.py
Russound.send_data
def send_data(self, data, delay=COMMAND_DELAY): """ Send data to connected gateway """ time_since_last_send = time.time() - self._last_send delay = max(0, delay - time_since_last_send) time.sleep(delay) # Ensure minim recommended delay since last send for item in data: ...
python
def send_data(self, data, delay=COMMAND_DELAY): """ Send data to connected gateway """ time_since_last_send = time.time() - self._last_send delay = max(0, delay - time_since_last_send) time.sleep(delay) # Ensure minim recommended delay since last send for item in data: ...
[ "def", "send_data", "(", "self", ",", "data", ",", "delay", "=", "COMMAND_DELAY", ")", ":", "time_since_last_send", "=", "time", ".", "time", "(", ")", "-", "self", ".", "_last_send", "delay", "=", "max", "(", "0", ",", "delay", "-", "time_since_last_sen...
Send data to connected gateway
[ "Send", "data", "to", "connected", "gateway" ]
train
https://github.com/laf/russound/blob/683af823f78ad02111f9966dc7b535dd66a1f083/russound/russound.py#L235-L251
laf/russound
russound/russound.py
Russound.get_response_message
def get_response_message(self, resp_msg_signature=None, delay=COMMAND_DELAY): """ Receive data from connected gateway and if required seach and return a stream that starts at the required response message signature. The reason we couple the search for the response signature here is that given the ...
python
def get_response_message(self, resp_msg_signature=None, delay=COMMAND_DELAY): """ Receive data from connected gateway and if required seach and return a stream that starts at the required response message signature. The reason we couple the search for the response signature here is that given the ...
[ "def", "get_response_message", "(", "self", ",", "resp_msg_signature", "=", "None", ",", "delay", "=", "COMMAND_DELAY", ")", ":", "matching_message", "=", "None", "# Set intial value to none (assume no response found)", "if", "resp_msg_signature", "is", "None", ":", "no...
Receive data from connected gateway and if required seach and return a stream that starts at the required response message signature. The reason we couple the search for the response signature here is that given the RNET protocol and TCP comms, we dont have an easy way of knowign that we have received ...
[ "Receive", "data", "from", "connected", "gateway", "and", "if", "required", "seach", "and", "return", "a", "stream", "that", "starts", "at", "the", "required", "response", "message", "signature", ".", "The", "reason", "we", "couple", "the", "search", "for", ...
train
https://github.com/laf/russound/blob/683af823f78ad02111f9966dc7b535dd66a1f083/russound/russound.py#L253-L290
laf/russound
russound/russound.py
Russound.find_signature
def find_signature(self, data_stream, msg_signature): """ Takes the stream of bytes received and looks for a message that matches the signature of the expected response """ signature_match_index = None # The message that will be returned if it matches the signature msg_signature = msg_...
python
def find_signature(self, data_stream, msg_signature): """ Takes the stream of bytes received and looks for a message that matches the signature of the expected response """ signature_match_index = None # The message that will be returned if it matches the signature msg_signature = msg_...
[ "def", "find_signature", "(", "self", ",", "data_stream", ",", "msg_signature", ")", ":", "signature_match_index", "=", "None", "# The message that will be returned if it matches the signature", "msg_signature", "=", "msg_signature", ".", "split", "(", ")", "# Split into li...
Takes the stream of bytes received and looks for a message that matches the signature of the expected response
[ "Takes", "the", "stream", "of", "bytes", "received", "and", "looks", "for", "a", "message", "that", "matches", "the", "signature", "of", "the", "expected", "response" ]
train
https://github.com/laf/russound/blob/683af823f78ad02111f9966dc7b535dd66a1f083/russound/russound.py#L292-L317
laf/russound
russound/russound.py
Russound.calc_checksum
def calc_checksum(self, data): """ Calculate the checksum we need """ output = 0 length = len(data) for value in data: output += int(value, 16) output += length checksum = hex(output & int('0x007F', 16)).lstrip("0x") data.append(checksum) dat...
python
def calc_checksum(self, data): """ Calculate the checksum we need """ output = 0 length = len(data) for value in data: output += int(value, 16) output += length checksum = hex(output & int('0x007F', 16)).lstrip("0x") data.append(checksum) dat...
[ "def", "calc_checksum", "(", "self", ",", "data", ")", ":", "output", "=", "0", "length", "=", "len", "(", "data", ")", "for", "value", "in", "data", ":", "output", "+=", "int", "(", "value", ",", "16", ")", "output", "+=", "length", "checksum", "=...
Calculate the checksum we need
[ "Calculate", "the", "checksum", "we", "need" ]
train
https://github.com/laf/russound/blob/683af823f78ad02111f9966dc7b535dd66a1f083/russound/russound.py#L319-L331
OnroerendErfgoed/crabpy
crabpy/client.py
crab_factory
def crab_factory(**kwargs): ''' Factory that generates a CRAB client. A few parameters will be handled by the factory, other parameters will be passed on to the client. :param wsdl: `Optional.` Allows overriding the default CRAB wsdl url. :param proxy: `Optional.` A dictionary of proxy informa...
python
def crab_factory(**kwargs): ''' Factory that generates a CRAB client. A few parameters will be handled by the factory, other parameters will be passed on to the client. :param wsdl: `Optional.` Allows overriding the default CRAB wsdl url. :param proxy: `Optional.` A dictionary of proxy informa...
[ "def", "crab_factory", "(", "*", "*", "kwargs", ")", ":", "if", "'wsdl'", "in", "kwargs", ":", "wsdl", "=", "kwargs", "[", "'wsdl'", "]", "del", "kwargs", "[", "'wsdl'", "]", "else", ":", "wsdl", "=", "\"http://crab.agiv.be/wscrab/wscrab.svc?wsdl\"", "log", ...
Factory that generates a CRAB client. A few parameters will be handled by the factory, other parameters will be passed on to the client. :param wsdl: `Optional.` Allows overriding the default CRAB wsdl url. :param proxy: `Optional.` A dictionary of proxy information that is passed to the under...
[ "Factory", "that", "generates", "a", "CRAB", "client", "." ]
train
https://github.com/OnroerendErfgoed/crabpy/blob/3a6fd8bc5aca37c2a173e3ea94e4e468b8aa79c1/crabpy/client.py#L16-L38
OnroerendErfgoed/crabpy
crabpy/client.py
crab_request
def crab_request(client, action, *args): ''' Utility function that helps making requests to the CRAB service. :param client: A :class:`suds.client.Client` for the CRAB service. :param string action: Which method to call, eg. `ListGewesten` :returns: Result of the SOAP call. .. versionadded:: 0...
python
def crab_request(client, action, *args): ''' Utility function that helps making requests to the CRAB service. :param client: A :class:`suds.client.Client` for the CRAB service. :param string action: Which method to call, eg. `ListGewesten` :returns: Result of the SOAP call. .. versionadded:: 0...
[ "def", "crab_request", "(", "client", ",", "action", ",", "*", "args", ")", ":", "log", ".", "debug", "(", "'Calling %s on CRAB service.'", ",", "action", ")", "return", "getattr", "(", "client", ".", "service", ",", "action", ")", "(", "*", "args", ")" ...
Utility function that helps making requests to the CRAB service. :param client: A :class:`suds.client.Client` for the CRAB service. :param string action: Which method to call, eg. `ListGewesten` :returns: Result of the SOAP call. .. versionadded:: 0.3.0
[ "Utility", "function", "that", "helps", "making", "requests", "to", "the", "CRAB", "service", "." ]
train
https://github.com/OnroerendErfgoed/crabpy/blob/3a6fd8bc5aca37c2a173e3ea94e4e468b8aa79c1/crabpy/client.py#L41-L52
xolox/python-vcs-repo-mgr
vcs_repo_mgr/backends/bzr.py
BzrRepo.is_bare
def is_bare(self): """ :data:`True` if the repository has no working tree, :data:`False` if it does. The value of this property is computed by checking whether the ``.bzr/checkout`` directory exists (it doesn't exist in Bazaar repositories created using ``bzr branch --no-tree .....
python
def is_bare(self): """ :data:`True` if the repository has no working tree, :data:`False` if it does. The value of this property is computed by checking whether the ``.bzr/checkout`` directory exists (it doesn't exist in Bazaar repositories created using ``bzr branch --no-tree .....
[ "def", "is_bare", "(", "self", ")", ":", "# Make sure the local repository exists.", "self", ".", "create", "(", ")", "# Check the existence of the directory.", "checkout_directory", "=", "os", ".", "path", ".", "join", "(", "self", ".", "vcs_directory", ",", "'chec...
:data:`True` if the repository has no working tree, :data:`False` if it does. The value of this property is computed by checking whether the ``.bzr/checkout`` directory exists (it doesn't exist in Bazaar repositories created using ``bzr branch --no-tree ...``).
[ ":", "data", ":", "True", "if", "the", "repository", "has", "no", "working", "tree", ":", "data", ":", "False", "if", "it", "does", "." ]
train
https://github.com/xolox/python-vcs-repo-mgr/blob/fdad2441a3e7ba5deeeddfa1c2f5ebc00c393aed/vcs_repo_mgr/backends/bzr.py#L66-L78
xolox/python-vcs-repo-mgr
vcs_repo_mgr/backends/bzr.py
BzrRepo.known_remotes
def known_remotes(self): """The names of the configured remote repositories (a list of :class:`.Remote` objects).""" objects = [] output = self.context.capture( 'bzr', 'config', 'parent_location', check=False, silent=True, ) if output and not output.isspac...
python
def known_remotes(self): """The names of the configured remote repositories (a list of :class:`.Remote` objects).""" objects = [] output = self.context.capture( 'bzr', 'config', 'parent_location', check=False, silent=True, ) if output and not output.isspac...
[ "def", "known_remotes", "(", "self", ")", ":", "objects", "=", "[", "]", "output", "=", "self", ".", "context", ".", "capture", "(", "'bzr'", ",", "'config'", ",", "'parent_location'", ",", "check", "=", "False", ",", "silent", "=", "True", ",", ")", ...
The names of the configured remote repositories (a list of :class:`.Remote` objects).
[ "The", "names", "of", "the", "configured", "remote", "repositories", "(", "a", "list", "of", ":", "class", ":", ".", "Remote", "objects", ")", "." ]
train
https://github.com/xolox/python-vcs-repo-mgr/blob/fdad2441a3e7ba5deeeddfa1c2f5ebc00c393aed/vcs_repo_mgr/backends/bzr.py#L90-L113
xolox/python-vcs-repo-mgr
vcs_repo_mgr/backends/bzr.py
BzrRepo.find_revision_id
def find_revision_id(self, revision=None): """Find the global revision id of the given revision.""" # Make sure the local repository exists. self.create() # Try to find the revision id of the specified revision. revision = revision or self.default_revision output = self.c...
python
def find_revision_id(self, revision=None): """Find the global revision id of the given revision.""" # Make sure the local repository exists. self.create() # Try to find the revision id of the specified revision. revision = revision or self.default_revision output = self.c...
[ "def", "find_revision_id", "(", "self", ",", "revision", "=", "None", ")", ":", "# Make sure the local repository exists.", "self", ".", "create", "(", ")", "# Try to find the revision id of the specified revision.", "revision", "=", "revision", "or", "self", ".", "defa...
Find the global revision id of the given revision.
[ "Find", "the", "global", "revision", "id", "of", "the", "given", "revision", "." ]
train
https://github.com/xolox/python-vcs-repo-mgr/blob/fdad2441a3e7ba5deeeddfa1c2f5ebc00c393aed/vcs_repo_mgr/backends/bzr.py#L137-L151
xolox/python-vcs-repo-mgr
vcs_repo_mgr/backends/bzr.py
BzrRepo.find_revision_number
def find_revision_number(self, revision=None): """ Find the local revision number of the given revision. .. note:: Bazaar has the concept of dotted revision numbers: For revisions which have been merged into a branch, a dotted notation is used (e.g., 3112....
python
def find_revision_number(self, revision=None): """ Find the local revision number of the given revision. .. note:: Bazaar has the concept of dotted revision numbers: For revisions which have been merged into a branch, a dotted notation is used (e.g., 3112....
[ "def", "find_revision_number", "(", "self", ",", "revision", "=", "None", ")", ":", "# Make sure the local repository exists.", "self", ".", "create", "(", ")", "# Try to find the revision number of the specified revision.", "revision", "=", "revision", "or", "self", ".",...
Find the local revision number of the given revision. .. note:: Bazaar has the concept of dotted revision numbers: For revisions which have been merged into a branch, a dotted notation is used (e.g., 3112.1.5). Dotted revision numbers have three numbers...
[ "Find", "the", "local", "revision", "number", "of", "the", "given", "revision", "." ]
train
https://github.com/xolox/python-vcs-repo-mgr/blob/fdad2441a3e7ba5deeeddfa1c2f5ebc00c393aed/vcs_repo_mgr/backends/bzr.py#L153-L185
xolox/python-vcs-repo-mgr
vcs_repo_mgr/backends/bzr.py
BzrRepo.find_tags
def find_tags(self): """ Find information about the tags in the repository. .. note:: The ``bzr tags`` command reports tags pointing to non-existing revisions as ``?`` but doesn't provide revision ids. We can get the revision ids using the ``bzr tags ...
python
def find_tags(self): """ Find information about the tags in the repository. .. note:: The ``bzr tags`` command reports tags pointing to non-existing revisions as ``?`` but doesn't provide revision ids. We can get the revision ids using the ``bzr tags ...
[ "def", "find_tags", "(", "self", ")", ":", "valid_tags", "=", "[", "]", "listing", "=", "self", ".", "context", ".", "capture", "(", "'bzr'", ",", "'tags'", ")", "for", "line", "in", "listing", ".", "splitlines", "(", ")", ":", "tokens", "=", "line",...
Find information about the tags in the repository. .. note:: The ``bzr tags`` command reports tags pointing to non-existing revisions as ``?`` but doesn't provide revision ids. We can get the revision ids using the ``bzr tags --show-ids`` command but this c...
[ "Find", "information", "about", "the", "tags", "in", "the", "repository", "." ]
train
https://github.com/xolox/python-vcs-repo-mgr/blob/fdad2441a3e7ba5deeeddfa1c2f5ebc00c393aed/vcs_repo_mgr/backends/bzr.py#L187-L213
xolox/python-vcs-repo-mgr
vcs_repo_mgr/backends/bzr.py
BzrRepo.get_commit_command
def get_commit_command(self, message, author=None): """Get the command to commit changes to tracked files in the working tree.""" command = ['bzr', 'commit'] if author: command.extend(('--author', author.combined)) command.append('--message') command.append(message) ...
python
def get_commit_command(self, message, author=None): """Get the command to commit changes to tracked files in the working tree.""" command = ['bzr', 'commit'] if author: command.extend(('--author', author.combined)) command.append('--message') command.append(message) ...
[ "def", "get_commit_command", "(", "self", ",", "message", ",", "author", "=", "None", ")", ":", "command", "=", "[", "'bzr'", ",", "'commit'", "]", "if", "author", ":", "command", ".", "extend", "(", "(", "'--author'", ",", "author", ".", "combined", "...
Get the command to commit changes to tracked files in the working tree.
[ "Get", "the", "command", "to", "commit", "changes", "to", "tracked", "files", "in", "the", "working", "tree", "." ]
train
https://github.com/xolox/python-vcs-repo-mgr/blob/fdad2441a3e7ba5deeeddfa1c2f5ebc00c393aed/vcs_repo_mgr/backends/bzr.py#L221-L228
xolox/python-vcs-repo-mgr
vcs_repo_mgr/backends/bzr.py
BzrRepo.get_pull_command
def get_pull_command(self, remote=None, revision=None): """Get the command to pull changes from a remote repository into the local repository.""" if revision: raise NotImplementedError(compact(""" Bazaar repository support doesn't include the ability to pull s...
python
def get_pull_command(self, remote=None, revision=None): """Get the command to pull changes from a remote repository into the local repository.""" if revision: raise NotImplementedError(compact(""" Bazaar repository support doesn't include the ability to pull s...
[ "def", "get_pull_command", "(", "self", ",", "remote", "=", "None", ",", "revision", "=", "None", ")", ":", "if", "revision", ":", "raise", "NotImplementedError", "(", "compact", "(", "\"\"\"\n Bazaar repository support doesn't include\n the ...
Get the command to pull changes from a remote repository into the local repository.
[ "Get", "the", "command", "to", "pull", "changes", "from", "a", "remote", "repository", "into", "the", "local", "repository", "." ]
train
https://github.com/xolox/python-vcs-repo-mgr/blob/fdad2441a3e7ba5deeeddfa1c2f5ebc00c393aed/vcs_repo_mgr/backends/bzr.py#L248-L258
xolox/python-vcs-repo-mgr
vcs_repo_mgr/backends/bzr.py
BzrRepo.get_push_command
def get_push_command(self, remote=None, revision=None): """Get the command to push changes from the local repository to a remote repository.""" if revision: raise NotImplementedError(compact(""" Bazaar repository support doesn't include the ability to push spe...
python
def get_push_command(self, remote=None, revision=None): """Get the command to push changes from the local repository to a remote repository.""" if revision: raise NotImplementedError(compact(""" Bazaar repository support doesn't include the ability to push spe...
[ "def", "get_push_command", "(", "self", ",", "remote", "=", "None", ",", "revision", "=", "None", ")", ":", "if", "revision", ":", "raise", "NotImplementedError", "(", "compact", "(", "\"\"\"\n Bazaar repository support doesn't include\n the ...
Get the command to push changes from the local repository to a remote repository.
[ "Get", "the", "command", "to", "push", "changes", "from", "the", "local", "repository", "to", "a", "remote", "repository", "." ]
train
https://github.com/xolox/python-vcs-repo-mgr/blob/fdad2441a3e7ba5deeeddfa1c2f5ebc00c393aed/vcs_repo_mgr/backends/bzr.py#L260-L270
xolox/python-vcs-repo-mgr
vcs_repo_mgr/backends/bzr.py
BzrRepo.update_context
def update_context(self): """ Make sure Bazaar respects the configured author. This method first calls :func:`.Repository.update_context()` and then it sets the ``$BZR_EMAIL`` environment variable based on the value of :attr:`~Repository.author` (but only if :attr:`~Repository.a...
python
def update_context(self): """ Make sure Bazaar respects the configured author. This method first calls :func:`.Repository.update_context()` and then it sets the ``$BZR_EMAIL`` environment variable based on the value of :attr:`~Repository.author` (but only if :attr:`~Repository.a...
[ "def", "update_context", "(", "self", ")", ":", "# Call our superclass.", "super", "(", "BzrRepo", ",", "self", ")", ".", "update_context", "(", ")", "# Try to ensure that $BZR_EMAIL is set (see above for the reason)", "# but only if the `author' property was set by the caller (m...
Make sure Bazaar respects the configured author. This method first calls :func:`.Repository.update_context()` and then it sets the ``$BZR_EMAIL`` environment variable based on the value of :attr:`~Repository.author` (but only if :attr:`~Repository.author` was set by the caller). ...
[ "Make", "sure", "Bazaar", "respects", "the", "configured", "author", "." ]
train
https://github.com/xolox/python-vcs-repo-mgr/blob/fdad2441a3e7ba5deeeddfa1c2f5ebc00c393aed/vcs_repo_mgr/backends/bzr.py#L272-L298
ttinies/sc2gameLobby
sc2gameLobby/runConfigs/platforms.py
LocalBase.exec_path
def exec_path(self, baseVersion=None): """Get the exec_path for this platform. Possibly find the latest build.""" if not os.path.isdir(self.data_dir): raise sc_process.SC2LaunchError("Install Starcraft II at %s or set the SC2PATH environment variable"%(self.data_dir)) if baseVersion==None: # then se...
python
def exec_path(self, baseVersion=None): """Get the exec_path for this platform. Possibly find the latest build.""" if not os.path.isdir(self.data_dir): raise sc_process.SC2LaunchError("Install Starcraft II at %s or set the SC2PATH environment variable"%(self.data_dir)) if baseVersion==None: # then se...
[ "def", "exec_path", "(", "self", ",", "baseVersion", "=", "None", ")", ":", "if", "not", "os", ".", "path", ".", "isdir", "(", "self", ".", "data_dir", ")", ":", "raise", "sc_process", ".", "SC2LaunchError", "(", "\"Install Starcraft II at %s or set the SC2PAT...
Get the exec_path for this platform. Possibly find the latest build.
[ "Get", "the", "exec_path", "for", "this", "platform", ".", "Possibly", "find", "the", "latest", "build", "." ]
train
https://github.com/ttinies/sc2gameLobby/blob/5352d51d53ddeb4858e92e682da89c4434123e52/sc2gameLobby/runConfigs/platforms.py#L89-L109
ttinies/sc2gameLobby
sc2gameLobby/runConfigs/platforms.py
LocalBase.start
def start(self, version=None, **kwargs):#game_version=None, data_version=None, **kwargs): """Launch the game process.""" if not version: version = self.mostRecentVersion pysc2Version = lib.Version( # convert to pysc2 Version version.version, version.baseVersion, version.dataH...
python
def start(self, version=None, **kwargs):#game_version=None, data_version=None, **kwargs): """Launch the game process.""" if not version: version = self.mostRecentVersion pysc2Version = lib.Version( # convert to pysc2 Version version.version, version.baseVersion, version.dataH...
[ "def", "start", "(", "self", ",", "version", "=", "None", ",", "*", "*", "kwargs", ")", ":", "#game_version=None, data_version=None, **kwargs):", "if", "not", "version", ":", "version", "=", "self", ".", "mostRecentVersion", "pysc2Version", "=", "lib", ".", "V...
Launch the game process.
[ "Launch", "the", "game", "process", "." ]
train
https://github.com/ttinies/sc2gameLobby/blob/5352d51d53ddeb4858e92e682da89c4434123e52/sc2gameLobby/runConfigs/platforms.py#L124-L137
ldiary/marigoso
marigoso/browser.py
Mouse.press
def press(self, coordinate, success=None): """Success must be given as a tuple of a (coordinate, timeout). Use (coordinate,) if you want to use the default timeout.""" if isinstance(coordinate, WebElement): coordinate.click() else: self.get_element(coordinate).cli...
python
def press(self, coordinate, success=None): """Success must be given as a tuple of a (coordinate, timeout). Use (coordinate,) if you want to use the default timeout.""" if isinstance(coordinate, WebElement): coordinate.click() else: self.get_element(coordinate).cli...
[ "def", "press", "(", "self", ",", "coordinate", ",", "success", "=", "None", ")", ":", "if", "isinstance", "(", "coordinate", ",", "WebElement", ")", ":", "coordinate", ".", "click", "(", ")", "else", ":", "self", ".", "get_element", "(", "coordinate", ...
Success must be given as a tuple of a (coordinate, timeout). Use (coordinate,) if you want to use the default timeout.
[ "Success", "must", "be", "given", "as", "a", "tuple", "of", "a", "(", "coordinate", "timeout", ")", ".", "Use", "(", "coordinate", ")", "if", "you", "want", "to", "use", "the", "default", "timeout", "." ]
train
https://github.com/ldiary/marigoso/blob/886dd4356f83dd3ea6867df6243ba336119011f1/marigoso/browser.py#L145-L153
ldiary/marigoso
marigoso/browser.py
Mouse.select_text
def select_text(self, coordinate, text, select2drop=None): ''' :param an element or a locator of the select element :param a selection text or selection index to be selected :param the select2 dropdown locator :return: True ''' if not isinstance(coordinate, Select...
python
def select_text(self, coordinate, text, select2drop=None): ''' :param an element or a locator of the select element :param a selection text or selection index to be selected :param the select2 dropdown locator :return: True ''' if not isinstance(coordinate, Select...
[ "def", "select_text", "(", "self", ",", "coordinate", ",", "text", ",", "select2drop", "=", "None", ")", ":", "if", "not", "isinstance", "(", "coordinate", ",", "Select", ")", ":", "if", "isinstance", "(", "coordinate", ",", "str", ")", ":", "element", ...
:param an element or a locator of the select element :param a selection text or selection index to be selected :param the select2 dropdown locator :return: True
[ ":", "param", "an", "element", "or", "a", "locator", "of", "the", "select", "element", ":", "param", "a", "selection", "text", "or", "selection", "index", "to", "be", "selected", ":", "param", "the", "select2", "dropdown", "locator", ":", "return", ":", ...
train
https://github.com/ldiary/marigoso/blob/886dd4356f83dd3ea6867df6243ba336119011f1/marigoso/browser.py#L159-L200
ldiary/marigoso
marigoso/browser.py
Mouse.select2
def select2(self, box, drop, text): ''' :param box: the locator for Selection Box :param drop: the locator for Selection Dropdown :param text: the text value to select or the index of the option to select :return: True :example: https://github.com/ldiary/marigoso/blob/mas...
python
def select2(self, box, drop, text): ''' :param box: the locator for Selection Box :param drop: the locator for Selection Dropdown :param text: the text value to select or the index of the option to select :return: True :example: https://github.com/ldiary/marigoso/blob/mas...
[ "def", "select2", "(", "self", ",", "box", ",", "drop", ",", "text", ")", ":", "if", "not", "self", ".", "is_available", "(", "drop", ")", ":", "if", "isinstance", "(", "box", ",", "str", ")", ":", "self", ".", "get_element", "(", "box", ")", "."...
:param box: the locator for Selection Box :param drop: the locator for Selection Dropdown :param text: the text value to select or the index of the option to select :return: True :example: https://github.com/ldiary/marigoso/blob/master/notebooks/handling_select2_controls_in_selenium_webd...
[ ":", "param", "box", ":", "the", "locator", "for", "Selection", "Box", ":", "param", "drop", ":", "the", "locator", "for", "Selection", "Dropdown", ":", "param", "text", ":", "the", "text", "value", "to", "select", "or", "the", "index", "of", "the", "o...
train
https://github.com/ldiary/marigoso/blob/886dd4356f83dd3ea6867df6243ba336119011f1/marigoso/browser.py#L202-L226
ldiary/marigoso
marigoso/browser.py
Mouse.submit_btn
def submit_btn(self, value, success=None): """This presses an input button with type=submit. Success must be given as a tuple of a (coordinate, timeout). Use (coordinate,) if you want to use the default timeout.""" self.press("css=input[value='{}']".format(value)) if success is n...
python
def submit_btn(self, value, success=None): """This presses an input button with type=submit. Success must be given as a tuple of a (coordinate, timeout). Use (coordinate,) if you want to use the default timeout.""" self.press("css=input[value='{}']".format(value)) if success is n...
[ "def", "submit_btn", "(", "self", ",", "value", ",", "success", "=", "None", ")", ":", "self", ".", "press", "(", "\"css=input[value='{}']\"", ".", "format", "(", "value", ")", ")", "if", "success", "is", "not", "None", ":", "assert", "self", ".", "is_...
This presses an input button with type=submit. Success must be given as a tuple of a (coordinate, timeout). Use (coordinate,) if you want to use the default timeout.
[ "This", "presses", "an", "input", "button", "with", "type", "=", "submit", ".", "Success", "must", "be", "given", "as", "a", "tuple", "of", "a", "(", "coordinate", "timeout", ")", ".", "Use", "(", "coordinate", ")", "if", "you", "want", "to", "use", ...
train
https://github.com/ldiary/marigoso/blob/886dd4356f83dd3ea6867df6243ba336119011f1/marigoso/browser.py#L228-L234
Captricity/captools
captools/api/util.py
generate_request_access_signature
def generate_request_access_signature(parameters, secret_key): """ Generate the parameter signature used during third party access requests """ # pull out the parameter keys keys = parameters.keys() # alphanumerically sort the keys in place keys.sort() # create an array of url encoded ...
python
def generate_request_access_signature(parameters, secret_key): """ Generate the parameter signature used during third party access requests """ # pull out the parameter keys keys = parameters.keys() # alphanumerically sort the keys in place keys.sort() # create an array of url encoded ...
[ "def", "generate_request_access_signature", "(", "parameters", ",", "secret_key", ")", ":", "# pull out the parameter keys", "keys", "=", "parameters", ".", "keys", "(", ")", "# alphanumerically sort the keys in place", "keys", ".", "sort", "(", ")", "# create an array of...
Generate the parameter signature used during third party access requests
[ "Generate", "the", "parameter", "signature", "used", "during", "third", "party", "access", "requests" ]
train
https://github.com/Captricity/captools/blob/e7dc069ff5ede95d4956c7a0a4614d0e53e5a955/captools/api/util.py#L6-L26
plotly/octogrid
octogrid/auth/auth.py
has_credentials_stored
def has_credentials_stored(): """ Return 'auth token' string, if the user credentials are already stored """ try: with open(credentials_file, 'r') as f: token = f.readline().strip() id = f.readline().strip() return token except Exception, e: retu...
python
def has_credentials_stored(): """ Return 'auth token' string, if the user credentials are already stored """ try: with open(credentials_file, 'r') as f: token = f.readline().strip() id = f.readline().strip() return token except Exception, e: retu...
[ "def", "has_credentials_stored", "(", ")", ":", "try", ":", "with", "open", "(", "credentials_file", ",", "'r'", ")", "as", "f", ":", "token", "=", "f", ".", "readline", "(", ")", ".", "strip", "(", ")", "id", "=", "f", ".", "readline", "(", ")", ...
Return 'auth token' string, if the user credentials are already stored
[ "Return", "auth", "token", "string", "if", "the", "user", "credentials", "are", "already", "stored" ]
train
https://github.com/plotly/octogrid/blob/46237a72c79765fe5a48af7065049c692e6457a7/octogrid/auth/auth.py#L19-L31
plotly/octogrid
octogrid/auth/auth.py
authenticate
def authenticate(): """ Authenticate the user and store the 'token' for further use Return the authentication 'token' """ print LOGIN_INIT_MESSAGE username = raw_input('{0}: '.format(LOGIN_USER_MESSAGE)) password = None while password is None: password = getpass('Password for ...
python
def authenticate(): """ Authenticate the user and store the 'token' for further use Return the authentication 'token' """ print LOGIN_INIT_MESSAGE username = raw_input('{0}: '.format(LOGIN_USER_MESSAGE)) password = None while password is None: password = getpass('Password for ...
[ "def", "authenticate", "(", ")", ":", "print", "LOGIN_INIT_MESSAGE", "username", "=", "raw_input", "(", "'{0}: '", ".", "format", "(", "LOGIN_USER_MESSAGE", ")", ")", "password", "=", "None", "while", "password", "is", "None", ":", "password", "=", "getpass", ...
Authenticate the user and store the 'token' for further use Return the authentication 'token'
[ "Authenticate", "the", "user", "and", "store", "the", "token", "for", "further", "use", "Return", "the", "authentication", "token" ]
train
https://github.com/plotly/octogrid/blob/46237a72c79765fe5a48af7065049c692e6457a7/octogrid/auth/auth.py#L34-L58
plotly/octogrid
octogrid/utils/utils.py
community_colors
def community_colors(n): """ Returns a list of visually separable colors according to total communities """ if (n > 0): colors = cl.scales['12']['qual']['Paired'] shuffle(colors) return colors[:n] else: return choice(cl.scales['12']['qual']['Paired'])
python
def community_colors(n): """ Returns a list of visually separable colors according to total communities """ if (n > 0): colors = cl.scales['12']['qual']['Paired'] shuffle(colors) return colors[:n] else: return choice(cl.scales['12']['qual']['Paired'])
[ "def", "community_colors", "(", "n", ")", ":", "if", "(", "n", ">", "0", ")", ":", "colors", "=", "cl", ".", "scales", "[", "'12'", "]", "[", "'qual'", "]", "[", "'Paired'", "]", "shuffle", "(", "colors", ")", "return", "colors", "[", ":", "n", ...
Returns a list of visually separable colors according to total communities
[ "Returns", "a", "list", "of", "visually", "separable", "colors", "according", "to", "total", "communities" ]
train
https://github.com/plotly/octogrid/blob/46237a72c79765fe5a48af7065049c692e6457a7/octogrid/utils/utils.py#L17-L28
plotly/octogrid
octogrid/utils/utils.py
login_as_bot
def login_as_bot(): """ Login as the bot account "octogrid", if user isn't authenticated on Plotly """ plotly_credentials_file = join( join(expanduser('~'), PLOTLY_DIRECTORY), PLOTLY_CREDENTIALS_FILENAME) if isfile(plotly_credentials_file): with open(plotly_credentials_file, 'r') as f: credentials = lo...
python
def login_as_bot(): """ Login as the bot account "octogrid", if user isn't authenticated on Plotly """ plotly_credentials_file = join( join(expanduser('~'), PLOTLY_DIRECTORY), PLOTLY_CREDENTIALS_FILENAME) if isfile(plotly_credentials_file): with open(plotly_credentials_file, 'r') as f: credentials = lo...
[ "def", "login_as_bot", "(", ")", ":", "plotly_credentials_file", "=", "join", "(", "join", "(", "expanduser", "(", "'~'", ")", ",", "PLOTLY_DIRECTORY", ")", ",", "PLOTLY_CREDENTIALS_FILENAME", ")", "if", "isfile", "(", "plotly_credentials_file", ")", ":", "with"...
Login as the bot account "octogrid", if user isn't authenticated on Plotly
[ "Login", "as", "the", "bot", "account", "octogrid", "if", "user", "isn", "t", "authenticated", "on", "Plotly" ]
train
https://github.com/plotly/octogrid/blob/46237a72c79765fe5a48af7065049c692e6457a7/octogrid/utils/utils.py#L31-L46
Parsl/libsubmit
libsubmit/providers/slurm/slurm.py
SlurmProvider.submit
def submit(self, command, blocksize, job_name="parsl.auto"): """Submit the command as a slurm job of blocksize parallel elements. Parameters ---------- command : str Command to be made on the remote side. blocksize : int Not implemented. job_name ...
python
def submit(self, command, blocksize, job_name="parsl.auto"): """Submit the command as a slurm job of blocksize parallel elements. Parameters ---------- command : str Command to be made on the remote side. blocksize : int Not implemented. job_name ...
[ "def", "submit", "(", "self", ",", "command", ",", "blocksize", ",", "job_name", "=", "\"parsl.auto\"", ")", ":", "if", "self", ".", "provisioned_blocks", ">=", "self", ".", "max_blocks", ":", "logger", ".", "warn", "(", "\"Slurm provider '{}' is at capacity (no...
Submit the command as a slurm job of blocksize parallel elements. Parameters ---------- command : str Command to be made on the remote side. blocksize : int Not implemented. job_name : str Name for the job (must be unique). Returns ...
[ "Submit", "the", "command", "as", "a", "slurm", "job", "of", "blocksize", "parallel", "elements", "." ]
train
https://github.com/Parsl/libsubmit/blob/27a41c16dd6f1c16d830a9ce1c97804920a59f64/libsubmit/providers/slurm/slurm.py#L134-L193
rodynnz/xccdf
src/xccdf/models/title.py
Title.update_xml_element
def update_xml_element(self): """ Updates the xml element contents to matches the instance contents. :returns: Updated XML element. :rtype: lxml.etree._Element """ if not hasattr(self, 'xml_element'): self.xml_element = etree.Element(self.name, nsmap=NSMAP) ...
python
def update_xml_element(self): """ Updates the xml element contents to matches the instance contents. :returns: Updated XML element. :rtype: lxml.etree._Element """ if not hasattr(self, 'xml_element'): self.xml_element = etree.Element(self.name, nsmap=NSMAP) ...
[ "def", "update_xml_element", "(", "self", ")", ":", "if", "not", "hasattr", "(", "self", ",", "'xml_element'", ")", ":", "self", ".", "xml_element", "=", "etree", ".", "Element", "(", "self", ".", "name", ",", "nsmap", "=", "NSMAP", ")", "if", "hasattr...
Updates the xml element contents to matches the instance contents. :returns: Updated XML element. :rtype: lxml.etree._Element
[ "Updates", "the", "xml", "element", "contents", "to", "matches", "the", "instance", "contents", "." ]
train
https://github.com/rodynnz/xccdf/blob/1b9dc2f06b5cce8db2a54c5f95a8f6bcf5cb6981/src/xccdf/models/title.py#L51-L70
klen/makesite
makesite/modules/django/main/utils/files.py
upload_to
def upload_to(instance, filename, prefix=None): """ Auto upload function for File and Image fields. """ ext = path.splitext(filename)[1] name = str(instance.pk or time()) + filename # We think that we use utf8 based OS file system filename = md5(name.encode('utf8')).hexdigest() + ext basedi...
python
def upload_to(instance, filename, prefix=None): """ Auto upload function for File and Image fields. """ ext = path.splitext(filename)[1] name = str(instance.pk or time()) + filename # We think that we use utf8 based OS file system filename = md5(name.encode('utf8')).hexdigest() + ext basedi...
[ "def", "upload_to", "(", "instance", ",", "filename", ",", "prefix", "=", "None", ")", ":", "ext", "=", "path", ".", "splitext", "(", "filename", ")", "[", "1", "]", "name", "=", "str", "(", "instance", ".", "pk", "or", "time", "(", ")", ")", "+"...
Auto upload function for File and Image fields.
[ "Auto", "upload", "function", "for", "File", "and", "Image", "fields", "." ]
train
https://github.com/klen/makesite/blob/f6f77a43a04a256189e8fffbeac1ffd63f35a10c/makesite/modules/django/main/utils/files.py#L6-L17
attakei/errcron
docs/conf.py
reverse_toctree
def reverse_toctree(app, doctree, docname): """Reverse the order of entries in the root toctree if 'glob' is used.""" if docname == "changes": for node in doctree.traverse(): if node.tagname == "toctree" and node.get("glob"): node["entries"].reverse() break
python
def reverse_toctree(app, doctree, docname): """Reverse the order of entries in the root toctree if 'glob' is used.""" if docname == "changes": for node in doctree.traverse(): if node.tagname == "toctree" and node.get("glob"): node["entries"].reverse() break
[ "def", "reverse_toctree", "(", "app", ",", "doctree", ",", "docname", ")", ":", "if", "docname", "==", "\"changes\"", ":", "for", "node", "in", "doctree", ".", "traverse", "(", ")", ":", "if", "node", ".", "tagname", "==", "\"toctree\"", "and", "node", ...
Reverse the order of entries in the root toctree if 'glob' is used.
[ "Reverse", "the", "order", "of", "entries", "in", "the", "root", "toctree", "if", "glob", "is", "used", "." ]
train
https://github.com/attakei/errcron/blob/a3938fc7d051daefb6813588fcbeb9592bd00c9a/docs/conf.py#L365-L371
inveniosoftware/invenio-marc21
invenio_marc21/serializers/marcxml.py
MARCXMLSerializer.dump
def dump(self, obj): """Serialize object with schema. :param obj: The object to serialize. :returns: The object serialized. """ if self.schema_class: obj = self.schema_class().dump(obj).data else: obj = obj['metadata'] return super(MARCXML...
python
def dump(self, obj): """Serialize object with schema. :param obj: The object to serialize. :returns: The object serialized. """ if self.schema_class: obj = self.schema_class().dump(obj).data else: obj = obj['metadata'] return super(MARCXML...
[ "def", "dump", "(", "self", ",", "obj", ")", ":", "if", "self", ".", "schema_class", ":", "obj", "=", "self", ".", "schema_class", "(", ")", ".", "dump", "(", "obj", ")", ".", "data", "else", ":", "obj", "=", "obj", "[", "'metadata'", "]", "retur...
Serialize object with schema. :param obj: The object to serialize. :returns: The object serialized.
[ "Serialize", "object", "with", "schema", "." ]
train
https://github.com/inveniosoftware/invenio-marc21/blob/b91347b5b000757b6dc9dc1be88d76ca09611905/invenio_marc21/serializers/marcxml.py#L44-L54
inveniosoftware/invenio-marc21
invenio_marc21/serializers/marcxml.py
MARCXMLSerializer.serialize
def serialize(self, pid, record, links_factory=None): """Serialize a single record and persistent identifier. :param pid: The :class:`invenio_pidstore.models.PersistentIdentifier` instance. :param record: The :class:`invenio_records.api.Record` instance. :param links_factory...
python
def serialize(self, pid, record, links_factory=None): """Serialize a single record and persistent identifier. :param pid: The :class:`invenio_pidstore.models.PersistentIdentifier` instance. :param record: The :class:`invenio_records.api.Record` instance. :param links_factory...
[ "def", "serialize", "(", "self", ",", "pid", ",", "record", ",", "links_factory", "=", "None", ")", ":", "return", "dumps", "(", "self", ".", "transform_record", "(", "pid", ",", "record", ",", "links_factory", ")", ",", "*", "*", "self", ".", "dumps_k...
Serialize a single record and persistent identifier. :param pid: The :class:`invenio_pidstore.models.PersistentIdentifier` instance. :param record: The :class:`invenio_records.api.Record` instance. :param links_factory: Factory function for the link generation, which are...
[ "Serialize", "a", "single", "record", "and", "persistent", "identifier", "." ]
train
https://github.com/inveniosoftware/invenio-marc21/blob/b91347b5b000757b6dc9dc1be88d76ca09611905/invenio_marc21/serializers/marcxml.py#L56-L67
inveniosoftware/invenio-marc21
invenio_marc21/serializers/marcxml.py
MARCXMLSerializer.serialize_search
def serialize_search(self, pid_fetcher, search_result, item_links_factory=None, **kwargs): """Serialize a search result. :param pid_fetcher: Persistent identifier fetcher. :param search_result: Elasticsearch search result. :param item_links_factory: Factory func...
python
def serialize_search(self, pid_fetcher, search_result, item_links_factory=None, **kwargs): """Serialize a search result. :param pid_fetcher: Persistent identifier fetcher. :param search_result: Elasticsearch search result. :param item_links_factory: Factory func...
[ "def", "serialize_search", "(", "self", ",", "pid_fetcher", ",", "search_result", ",", "item_links_factory", "=", "None", ",", "*", "*", "kwargs", ")", ":", "ret", "=", "[", "self", ".", "transform_search_hit", "(", "pid_fetcher", "(", "hit", "[", "'_id'", ...
Serialize a search result. :param pid_fetcher: Persistent identifier fetcher. :param search_result: Elasticsearch search result. :param item_links_factory: Factory function for the items in result. (Default: ``None``) :returns: The objects serialized.
[ "Serialize", "a", "search", "result", "." ]
train
https://github.com/inveniosoftware/invenio-marc21/blob/b91347b5b000757b6dc9dc1be88d76ca09611905/invenio_marc21/serializers/marcxml.py#L69-L85
inveniosoftware/invenio-marc21
invenio_marc21/serializers/marcxml.py
MARCXMLSerializer.serialize_oaipmh
def serialize_oaipmh(self, pid, record): """Serialize a single record for OAI-PMH. :param pid: The :class:`invenio_pidstore.models.PersistentIdentifier` instance. :param record: The :class:`invenio_records.api.Record` instance. :returns: The object serialized. """ ...
python
def serialize_oaipmh(self, pid, record): """Serialize a single record for OAI-PMH. :param pid: The :class:`invenio_pidstore.models.PersistentIdentifier` instance. :param record: The :class:`invenio_records.api.Record` instance. :returns: The object serialized. """ ...
[ "def", "serialize_oaipmh", "(", "self", ",", "pid", ",", "record", ")", ":", "obj", "=", "self", ".", "transform_record", "(", "pid", ",", "record", "[", "'_source'", "]", ")", "if", "isinstance", "(", "record", "[", "'_source'", "]", ",", "Record", ")...
Serialize a single record for OAI-PMH. :param pid: The :class:`invenio_pidstore.models.PersistentIdentifier` instance. :param record: The :class:`invenio_records.api.Record` instance. :returns: The object serialized.
[ "Serialize", "a", "single", "record", "for", "OAI", "-", "PMH", "." ]
train
https://github.com/inveniosoftware/invenio-marc21/blob/b91347b5b000757b6dc9dc1be88d76ca09611905/invenio_marc21/serializers/marcxml.py#L87-L99
payplug/payplug-python
payplug/notifications.py
treat
def treat(request_body): """ Treat a notification and guarantee its authenticity. :param request_body: The request body in plain text. :type request_body: string :return: A safe APIResource :rtype: APIResource """ # Python 3+ support if isinstance(request_body, six.binary_type): ...
python
def treat(request_body): """ Treat a notification and guarantee its authenticity. :param request_body: The request body in plain text. :type request_body: string :return: A safe APIResource :rtype: APIResource """ # Python 3+ support if isinstance(request_body, six.binary_type): ...
[ "def", "treat", "(", "request_body", ")", ":", "# Python 3+ support", "if", "isinstance", "(", "request_body", ",", "six", ".", "binary_type", ")", ":", "request_body", "=", "request_body", ".", "decode", "(", "'utf-8'", ")", "try", ":", "data", "=", "json",...
Treat a notification and guarantee its authenticity. :param request_body: The request body in plain text. :type request_body: string :return: A safe APIResource :rtype: APIResource
[ "Treat", "a", "notification", "and", "guarantee", "its", "authenticity", "." ]
train
https://github.com/payplug/payplug-python/blob/42dec9d6bff420dd0c26e51a84dd000adff04331/payplug/notifications.py#L8-L34
Parsl/libsubmit
libsubmit/channels/local/local.py
LocalChannel.execute_no_wait
def execute_no_wait(self, cmd, walltime, envs={}): ''' Synchronously execute a commandline string on the shell. Args: - cmd (string) : Commandline string to execute - walltime (int) : walltime in seconds, this is not really used now. Returns: - retcode : Ret...
python
def execute_no_wait(self, cmd, walltime, envs={}): ''' Synchronously execute a commandline string on the shell. Args: - cmd (string) : Commandline string to execute - walltime (int) : walltime in seconds, this is not really used now. Returns: - retcode : Ret...
[ "def", "execute_no_wait", "(", "self", ",", "cmd", ",", "walltime", ",", "envs", "=", "{", "}", ")", ":", "current_env", "=", "copy", ".", "deepcopy", "(", "self", ".", "_envs", ")", "current_env", ".", "update", "(", "envs", ")", "try", ":", "proc",...
Synchronously execute a commandline string on the shell. Args: - cmd (string) : Commandline string to execute - walltime (int) : walltime in seconds, this is not really used now. Returns: - retcode : Return code from the execution, -1 on fail - stdout : ...
[ "Synchronously", "execute", "a", "commandline", "string", "on", "the", "shell", "." ]
train
https://github.com/Parsl/libsubmit/blob/27a41c16dd6f1c16d830a9ce1c97804920a59f64/libsubmit/channels/local/local.py#L96-L131
qweeze/wex-api-client
wex/client.py
Client.ticker
def ticker(self, pair, ignore_invalid=0): """ This method provides all the information about currently active pairs, such as: the maximum price, the minimum price, average price, trade volume, trade volume in currency, the last trade, Buy and Sell price. All information is provided over ...
python
def ticker(self, pair, ignore_invalid=0): """ This method provides all the information about currently active pairs, such as: the maximum price, the minimum price, average price, trade volume, trade volume in currency, the last trade, Buy and Sell price. All information is provided over ...
[ "def", "ticker", "(", "self", ",", "pair", ",", "ignore_invalid", "=", "0", ")", ":", "return", "self", ".", "_public_api_call", "(", "'ticker'", ",", "pair", "=", "pair", ",", "ignore_invalid", "=", "ignore_invalid", ")" ]
This method provides all the information about currently active pairs, such as: the maximum price, the minimum price, average price, trade volume, trade volume in currency, the last trade, Buy and Sell price. All information is provided over the past 24 hours. :param str or iterable pair: pair (...
[ "This", "method", "provides", "all", "the", "information", "about", "currently", "active", "pairs", "such", "as", ":", "the", "maximum", "price", "the", "minimum", "price", "average", "price", "trade", "volume", "trade", "volume", "in", "currency", "the", "las...
train
https://github.com/qweeze/wex-api-client/blob/e84d139be229aab2c7c5eda5976b812be651807b/wex/client.py#L80-L88
qweeze/wex-api-client
wex/client.py
Client.depth
def depth(self, pair, limit=150, ignore_invalid=0): """ This method provides the information about active orders on the pair. :param str or iterable pair: pair (ex. 'btc_usd' or ['btc_usd', 'eth_usd']) :param limit: how many orders should be displayed (150 by default, max 5000) :...
python
def depth(self, pair, limit=150, ignore_invalid=0): """ This method provides the information about active orders on the pair. :param str or iterable pair: pair (ex. 'btc_usd' or ['btc_usd', 'eth_usd']) :param limit: how many orders should be displayed (150 by default, max 5000) :...
[ "def", "depth", "(", "self", ",", "pair", ",", "limit", "=", "150", ",", "ignore_invalid", "=", "0", ")", ":", "return", "self", ".", "_public_api_call", "(", "'depth'", ",", "pair", "=", "pair", ",", "limit", "=", "limit", ",", "ignore_invalid", "=", ...
This method provides the information about active orders on the pair. :param str or iterable pair: pair (ex. 'btc_usd' or ['btc_usd', 'eth_usd']) :param limit: how many orders should be displayed (150 by default, max 5000) :param int ignore_invalid: ignore non-existing pairs
[ "This", "method", "provides", "the", "information", "about", "active", "orders", "on", "the", "pair", ".", ":", "param", "str", "or", "iterable", "pair", ":", "pair", "(", "ex", ".", "btc_usd", "or", "[", "btc_usd", "eth_usd", "]", ")", ":", "param", "...
train
https://github.com/qweeze/wex-api-client/blob/e84d139be229aab2c7c5eda5976b812be651807b/wex/client.py#L90-L97
qweeze/wex-api-client
wex/client.py
Client.trades
def trades(self, pair, limit=150, ignore_invalid=0): """ This method provides the information about the last trades. :param str or iterable pair: pair (ex. 'btc_usd' or ['btc_usd', 'eth_usd']) :param limit: how many orders should be displayed (150 by default, max 5000) :param int...
python
def trades(self, pair, limit=150, ignore_invalid=0): """ This method provides the information about the last trades. :param str or iterable pair: pair (ex. 'btc_usd' or ['btc_usd', 'eth_usd']) :param limit: how many orders should be displayed (150 by default, max 5000) :param int...
[ "def", "trades", "(", "self", ",", "pair", ",", "limit", "=", "150", ",", "ignore_invalid", "=", "0", ")", ":", "return", "self", ".", "_public_api_call", "(", "'trades'", ",", "pair", "=", "pair", ",", "limit", "=", "limit", ",", "ignore_invalid", "="...
This method provides the information about the last trades. :param str or iterable pair: pair (ex. 'btc_usd' or ['btc_usd', 'eth_usd']) :param limit: how many orders should be displayed (150 by default, max 5000) :param int ignore_invalid: ignore non-existing pairs
[ "This", "method", "provides", "the", "information", "about", "the", "last", "trades", ".", ":", "param", "str", "or", "iterable", "pair", ":", "pair", "(", "ex", ".", "btc_usd", "or", "[", "btc_usd", "eth_usd", "]", ")", ":", "param", "limit", ":", "ho...
train
https://github.com/qweeze/wex-api-client/blob/e84d139be229aab2c7c5eda5976b812be651807b/wex/client.py#L99-L106
qweeze/wex-api-client
wex/client.py
Client.trade
def trade(self, pair, type_, rate, amount): """ The basic method that can be used for creating orders and trading on the exchange. To use this method you need an API key privilege to trade. You can only create limit orders using this method, but you can emulate market orders using rate p...
python
def trade(self, pair, type_, rate, amount): """ The basic method that can be used for creating orders and trading on the exchange. To use this method you need an API key privilege to trade. You can only create limit orders using this method, but you can emulate market orders using rate p...
[ "def", "trade", "(", "self", ",", "pair", ",", "type_", ",", "rate", ",", "amount", ")", ":", "return", "self", ".", "_trade_api_call", "(", "'Trade'", ",", "pair", "=", "pair", ",", "type_", "=", "type_", ",", "rate", "=", "rate", ",", "amount", "...
The basic method that can be used for creating orders and trading on the exchange. To use this method you need an API key privilege to trade. You can only create limit orders using this method, but you can emulate market orders using rate parameters. E.g. using rate=0.1 you can sell at the best ...
[ "The", "basic", "method", "that", "can", "be", "used", "for", "creating", "orders", "and", "trading", "on", "the", "exchange", ".", "To", "use", "this", "method", "you", "need", "an", "API", "key", "privilege", "to", "trade", ".", "You", "can", "only", ...
train
https://github.com/qweeze/wex-api-client/blob/e84d139be229aab2c7c5eda5976b812be651807b/wex/client.py#L116-L130
qweeze/wex-api-client
wex/client.py
Client.trade_history
def trade_history( self, from_=None, count=None, from_id=None, end_id=None, order=None, since=None, end=None, pair=None ): """ Returns trade history. To use this method you need a privilege of the info key. :param int or None from_: trade ID, from which the display s...
python
def trade_history( self, from_=None, count=None, from_id=None, end_id=None, order=None, since=None, end=None, pair=None ): """ Returns trade history. To use this method you need a privilege of the info key. :param int or None from_: trade ID, from which the display s...
[ "def", "trade_history", "(", "self", ",", "from_", "=", "None", ",", "count", "=", "None", ",", "from_id", "=", "None", ",", "end_id", "=", "None", ",", "order", "=", "None", ",", "since", "=", "None", ",", "end", "=", "None", ",", "pair", "=", "...
Returns trade history. To use this method you need a privilege of the info key. :param int or None from_: trade ID, from which the display starts (default 0) :param int or None count: the number of trades for display (default 1000) :param int or None from_id: trade ID, from which the di...
[ "Returns", "trade", "history", ".", "To", "use", "this", "method", "you", "need", "a", "privilege", "of", "the", "info", "key", "." ]
train
https://github.com/qweeze/wex-api-client/blob/e84d139be229aab2c7c5eda5976b812be651807b/wex/client.py#L160-L180
qweeze/wex-api-client
wex/client.py
Client.trans_history
def trans_history( self, from_=None, count=None, from_id=None, end_id=None, order=None, since=None, end=None ): """ Returns the history of transactions. To use this method you need a privilege of the info key. :param int or None from_: transaction ID, from which the ...
python
def trans_history( self, from_=None, count=None, from_id=None, end_id=None, order=None, since=None, end=None ): """ Returns the history of transactions. To use this method you need a privilege of the info key. :param int or None from_: transaction ID, from which the ...
[ "def", "trans_history", "(", "self", ",", "from_", "=", "None", ",", "count", "=", "None", ",", "from_id", "=", "None", ",", "end_id", "=", "None", ",", "order", "=", "None", ",", "since", "=", "None", ",", "end", "=", "None", ")", ":", "return", ...
Returns the history of transactions. To use this method you need a privilege of the info key. :param int or None from_: transaction ID, from which the display starts (default 0) :param int or None count: number of transaction to be displayed (default 1000) :param int or None from_id: tr...
[ "Returns", "the", "history", "of", "transactions", ".", "To", "use", "this", "method", "you", "need", "a", "privilege", "of", "the", "info", "key", "." ]
train
https://github.com/qweeze/wex-api-client/blob/e84d139be229aab2c7c5eda5976b812be651807b/wex/client.py#L182-L201
qweeze/wex-api-client
wex/client.py
Client.withdraw_coin
def withdraw_coin(self, coin_name, amount, address): """ The method is designed for cryptocurrency withdrawals. Please note: You need to have the privilege of the Withdraw key to be able to use this method. You can make a request for enabling this privilege by submitting a ticket to Supp...
python
def withdraw_coin(self, coin_name, amount, address): """ The method is designed for cryptocurrency withdrawals. Please note: You need to have the privilege of the Withdraw key to be able to use this method. You can make a request for enabling this privilege by submitting a ticket to Supp...
[ "def", "withdraw_coin", "(", "self", ",", "coin_name", ",", "amount", ",", "address", ")", ":", "return", "self", ".", "_trade_api_call", "(", "'WithdrawCoin'", ",", "coinName", "=", "coin_name", ",", "amount", "=", "amount", ",", "address", "=", "address", ...
The method is designed for cryptocurrency withdrawals. Please note: You need to have the privilege of the Withdraw key to be able to use this method. You can make a request for enabling this privilege by submitting a ticket to Support. You need to create the API key that you are going to use for...
[ "The", "method", "is", "designed", "for", "cryptocurrency", "withdrawals", ".", "Please", "note", ":", "You", "need", "to", "have", "the", "privilege", "of", "the", "Withdraw", "key", "to", "be", "able", "to", "use", "this", "method", ".", "You", "can", ...
train
https://github.com/qweeze/wex-api-client/blob/e84d139be229aab2c7c5eda5976b812be651807b/wex/client.py#L215-L231
qweeze/wex-api-client
wex/client.py
Client.create_coupon
def create_coupon(self, currency, amount, receiver): """ This method allows you to create Coupons. Please, note: In order to use this method, you need the Coupon key privilege. You can make a request to enable it by submitting a ticket to Support.. You need to create the API key ...
python
def create_coupon(self, currency, amount, receiver): """ This method allows you to create Coupons. Please, note: In order to use this method, you need the Coupon key privilege. You can make a request to enable it by submitting a ticket to Support.. You need to create the API key ...
[ "def", "create_coupon", "(", "self", ",", "currency", ",", "amount", ",", "receiver", ")", ":", "return", "self", ".", "_trade_api_call", "(", "'CreateCoupon'", ",", "currency", "=", "currency", ",", "amount", "=", "amount", ",", "receiver", "=", "receiver",...
This method allows you to create Coupons. Please, note: In order to use this method, you need the Coupon key privilege. You can make a request to enable it by submitting a ticket to Support.. You need to create the API key that you are going to use for this method in advance. Please provide ...
[ "This", "method", "allows", "you", "to", "create", "Coupons", ".", "Please", "note", ":", "In", "order", "to", "use", "this", "method", "you", "need", "the", "Coupon", "key", "privilege", ".", "You", "can", "make", "a", "request", "to", "enable", "it", ...
train
https://github.com/qweeze/wex-api-client/blob/e84d139be229aab2c7c5eda5976b812be651807b/wex/client.py#L233-L250
ttinies/sc2gameLobby
sc2gameLobby/joinGame.py
playerJoin
def playerJoin(config, agentCallBack, lobbyTimeout=c.INITIAL_TIMEOUT, debug=True): """cause an agent to join an already hosted game""" FLAGS(sys.argv) # ignore pysc2 command-line handling (eww) log = protocol.logging.logging log.disable(log.CRITICAL) # disable pysc2 logging amHosting = not bool(co...
python
def playerJoin(config, agentCallBack, lobbyTimeout=c.INITIAL_TIMEOUT, debug=True): """cause an agent to join an already hosted game""" FLAGS(sys.argv) # ignore pysc2 command-line handling (eww) log = protocol.logging.logging log.disable(log.CRITICAL) # disable pysc2 logging amHosting = not bool(co...
[ "def", "playerJoin", "(", "config", ",", "agentCallBack", ",", "lobbyTimeout", "=", "c", ".", "INITIAL_TIMEOUT", ",", "debug", "=", "True", ")", ":", "FLAGS", "(", "sys", ".", "argv", ")", "# ignore pysc2 command-line handling (eww)", "log", "=", "protocol", "...
cause an agent to join an already hosted game
[ "cause", "an", "agent", "to", "join", "an", "already", "hosted", "game" ]
train
https://github.com/ttinies/sc2gameLobby/blob/5352d51d53ddeb4858e92e682da89c4434123e52/sc2gameLobby/joinGame.py#L25-L102
payplug/payplug-python
payplug/network.py
_get_python_version_string
def _get_python_version_string(): """ Returns a string representation of the Python version. :return: "2.7.8" if python version is 2.7.8. :rtype string """ version_info = sys.version_info return '.'.join(map(str, [version_info[0], version_info[1], version_info[2]]))
python
def _get_python_version_string(): """ Returns a string representation of the Python version. :return: "2.7.8" if python version is 2.7.8. :rtype string """ version_info = sys.version_info return '.'.join(map(str, [version_info[0], version_info[1], version_info[2]]))
[ "def", "_get_python_version_string", "(", ")", ":", "version_info", "=", "sys", ".", "version_info", "return", "'.'", ".", "join", "(", "map", "(", "str", ",", "[", "version_info", "[", "0", "]", ",", "version_info", "[", "1", "]", ",", "version_info", "...
Returns a string representation of the Python version. :return: "2.7.8" if python version is 2.7.8. :rtype string
[ "Returns", "a", "string", "representation", "of", "the", "Python", "version", "." ]
train
https://github.com/payplug/payplug-python/blob/42dec9d6bff420dd0c26e51a84dd000adff04331/payplug/network.py#L302-L310
payplug/payplug-python
payplug/network.py
HttpRequest._raise_unrecoverable_error_payplug
def _raise_unrecoverable_error_payplug(self, exception): """ Raises an exceptions.ClientError with a message telling that the error probably comes from PayPlug. :param exception: Exception that caused the ClientError. :type exception: Exception :raise exceptions.ClientError ...
python
def _raise_unrecoverable_error_payplug(self, exception): """ Raises an exceptions.ClientError with a message telling that the error probably comes from PayPlug. :param exception: Exception that caused the ClientError. :type exception: Exception :raise exceptions.ClientError ...
[ "def", "_raise_unrecoverable_error_payplug", "(", "self", ",", "exception", ")", ":", "message", "=", "(", "'There was an unrecoverable error during the HTTP request. It seems to come from our servers. '", "'If you are behind a proxy, ensure that it is configured correctly. If the issue pers...
Raises an exceptions.ClientError with a message telling that the error probably comes from PayPlug. :param exception: Exception that caused the ClientError. :type exception: Exception :raise exceptions.ClientError
[ "Raises", "an", "exceptions", ".", "ClientError", "with", "a", "message", "telling", "that", "the", "error", "probably", "comes", "from", "PayPlug", ".", ":", "param", "exception", ":", "Exception", "that", "caused", "the", "ClientError", ".", ":", "type", "...
train
https://github.com/payplug/payplug-python/blob/42dec9d6bff420dd0c26e51a84dd000adff04331/payplug/network.py#L14-L24
payplug/payplug-python
payplug/network.py
HttpRequest._raise_unrecoverable_error_client
def _raise_unrecoverable_error_client(self, exception): """ Raises an exceptions.ClientError with a message telling that the error probably comes from the client configuration. :param exception: Exception that caused the ClientError :type exception: Exception :raise excep...
python
def _raise_unrecoverable_error_client(self, exception): """ Raises an exceptions.ClientError with a message telling that the error probably comes from the client configuration. :param exception: Exception that caused the ClientError :type exception: Exception :raise excep...
[ "def", "_raise_unrecoverable_error_client", "(", "self", ",", "exception", ")", ":", "message", "=", "(", "'There was an unrecoverable error during the HTTP request which is probably related to your '", "'configuration. Please verify `'", "+", "self", ".", "DEPENDENCY", "+", "'` ...
Raises an exceptions.ClientError with a message telling that the error probably comes from the client configuration. :param exception: Exception that caused the ClientError :type exception: Exception :raise exceptions.ClientError
[ "Raises", "an", "exceptions", ".", "ClientError", "with", "a", "message", "telling", "that", "the", "error", "probably", "comes", "from", "the", "client", "configuration", ".", ":", "param", "exception", ":", "Exception", "that", "caused", "the", "ClientError", ...
train
https://github.com/payplug/payplug-python/blob/42dec9d6bff420dd0c26e51a84dd000adff04331/payplug/network.py#L26-L38
payplug/payplug-python
payplug/network.py
RequestsRequest.do_request
def do_request(self, http_verb, url, headers, data=None): """ :see :func:`~HttpRequest.do_request` """ if data: data = json.dumps(data) try: response = requests.request(http_verb, url, headers=headers, data=data, verify=config.CACERT_PATH) except (...
python
def do_request(self, http_verb, url, headers, data=None): """ :see :func:`~HttpRequest.do_request` """ if data: data = json.dumps(data) try: response = requests.request(http_verb, url, headers=headers, data=data, verify=config.CACERT_PATH) except (...
[ "def", "do_request", "(", "self", ",", "http_verb", ",", "url", ",", "headers", ",", "data", "=", "None", ")", ":", "if", "data", ":", "data", "=", "json", ".", "dumps", "(", "data", ")", "try", ":", "response", "=", "requests", ".", "request", "("...
:see :func:`~HttpRequest.do_request`
[ ":", "see", ":", "func", ":", "~HttpRequest", ".", "do_request" ]
train
https://github.com/payplug/payplug-python/blob/42dec9d6bff420dd0c26e51a84dd000adff04331/payplug/network.py#L81-L94
payplug/payplug-python
payplug/network.py
UrllibRequest.do_request
def do_request(self, http_verb, url, headers, data=None): """ :see :func:`~HttpRequest.do_request` """ if data: data = json.dumps(data) request = urllib.request.Request(url, data, headers) request.get_method = lambda: http_verb try: respon...
python
def do_request(self, http_verb, url, headers, data=None): """ :see :func:`~HttpRequest.do_request` """ if data: data = json.dumps(data) request = urllib.request.Request(url, data, headers) request.get_method = lambda: http_verb try: respon...
[ "def", "do_request", "(", "self", ",", "http_verb", ",", "url", ",", "headers", ",", "data", "=", "None", ")", ":", "if", "data", ":", "data", "=", "json", ".", "dumps", "(", "data", ")", "request", "=", "urllib", ".", "request", ".", "Request", "(...
:see :func:`~HttpRequest.do_request`
[ ":", "see", ":", "func", ":", "~HttpRequest", ".", "do_request" ]
train
https://github.com/payplug/payplug-python/blob/42dec9d6bff420dd0c26e51a84dd000adff04331/payplug/network.py#L108-L131
payplug/payplug-python
payplug/network.py
HttpClient._request
def _request(self, http_verb, url, data=None, authenticated=True): """ Perform an HTTP request. See https://docs.python.org/3/library/json.html#json-to-py-table for the http response object. :param http_verb: the HTTP verb (GET, POST, PUT, …) :type http_verb: string :pa...
python
def _request(self, http_verb, url, data=None, authenticated=True): """ Perform an HTTP request. See https://docs.python.org/3/library/json.html#json-to-py-table for the http response object. :param http_verb: the HTTP verb (GET, POST, PUT, …) :type http_verb: string :pa...
[ "def", "_request", "(", "self", ",", "http_verb", ",", "url", ",", "data", "=", "None", ",", "authenticated", "=", "True", ")", ":", "user_agent", "=", "(", "'PayPlug-Python/{lib_version} (Python/{python_version}; '", "'{request_library})'", ".", "format", "(", "l...
Perform an HTTP request. See https://docs.python.org/3/library/json.html#json-to-py-table for the http response object. :param http_verb: the HTTP verb (GET, POST, PUT, …) :type http_verb: string :param url: the path to the resource queried :type url: string :param data...
[ "Perform", "an", "HTTP", "request", "." ]
train
https://github.com/payplug/payplug-python/blob/42dec9d6bff420dd0c26e51a84dd000adff04331/payplug/network.py#L252-L299
xolox/python-vcs-repo-mgr
vcs_repo_mgr/__init__.py
coerce_author
def coerce_author(value): """ Coerce strings to :class:`Author` objects. :param value: A string or :class:`Author` object. :returns: An :class:`Author` object. :raises: :exc:`~exceptions.ValueError` when `value` isn't a string or :class:`Author` object. """ # Author objects pas...
python
def coerce_author(value): """ Coerce strings to :class:`Author` objects. :param value: A string or :class:`Author` object. :returns: An :class:`Author` object. :raises: :exc:`~exceptions.ValueError` when `value` isn't a string or :class:`Author` object. """ # Author objects pas...
[ "def", "coerce_author", "(", "value", ")", ":", "# Author objects pass through untouched.", "if", "isinstance", "(", "value", ",", "Author", ")", ":", "return", "value", "# In all other cases we expect a string.", "if", "not", "isinstance", "(", "value", ",", "string_...
Coerce strings to :class:`Author` objects. :param value: A string or :class:`Author` object. :returns: An :class:`Author` object. :raises: :exc:`~exceptions.ValueError` when `value` isn't a string or :class:`Author` object.
[ "Coerce", "strings", "to", ":", "class", ":", "Author", "objects", "." ]
train
https://github.com/xolox/python-vcs-repo-mgr/blob/fdad2441a3e7ba5deeeddfa1c2f5ebc00c393aed/vcs_repo_mgr/__init__.py#L144-L168
xolox/python-vcs-repo-mgr
vcs_repo_mgr/__init__.py
coerce_feature_branch
def coerce_feature_branch(value): """ Convert a string to a :class:`FeatureBranchSpec` object. :param value: A string or :class:`FeatureBranchSpec` object. :returns: A :class:`FeatureBranchSpec` object. """ # Repository objects pass through untouched. if isinstance(value, FeatureBranchSpec)...
python
def coerce_feature_branch(value): """ Convert a string to a :class:`FeatureBranchSpec` object. :param value: A string or :class:`FeatureBranchSpec` object. :returns: A :class:`FeatureBranchSpec` object. """ # Repository objects pass through untouched. if isinstance(value, FeatureBranchSpec)...
[ "def", "coerce_feature_branch", "(", "value", ")", ":", "# Repository objects pass through untouched.", "if", "isinstance", "(", "value", ",", "FeatureBranchSpec", ")", ":", "return", "value", "# We expect a string with a name or URL.", "if", "not", "isinstance", "(", "va...
Convert a string to a :class:`FeatureBranchSpec` object. :param value: A string or :class:`FeatureBranchSpec` object. :returns: A :class:`FeatureBranchSpec` object.
[ "Convert", "a", "string", "to", "a", ":", "class", ":", "FeatureBranchSpec", "object", "." ]
train
https://github.com/xolox/python-vcs-repo-mgr/blob/fdad2441a3e7ba5deeeddfa1c2f5ebc00c393aed/vcs_repo_mgr/__init__.py#L171-L185
xolox/python-vcs-repo-mgr
vcs_repo_mgr/__init__.py
coerce_repository
def coerce_repository(value, context=None): """ Convert a string (taken to be a repository name or location) to a :class:`Repository` object. :param value: The name or location of a repository (a string) or a :class:`Repository` object. :param context: An execution context created by ...
python
def coerce_repository(value, context=None): """ Convert a string (taken to be a repository name or location) to a :class:`Repository` object. :param value: The name or location of a repository (a string) or a :class:`Repository` object. :param context: An execution context created by ...
[ "def", "coerce_repository", "(", "value", ",", "context", "=", "None", ")", ":", "# Coerce the context argument.", "context", "=", "context", "or", "LocalContext", "(", ")", "# Repository objects pass through untouched.", "if", "isinstance", "(", "value", ",", "Reposi...
Convert a string (taken to be a repository name or location) to a :class:`Repository` object. :param value: The name or location of a repository (a string) or a :class:`Repository` object. :param context: An execution context created by :mod:`executor.contexts` (defaults t...
[ "Convert", "a", "string", "(", "taken", "to", "be", "a", "repository", "name", "or", "location", ")", "to", "a", ":", "class", ":", "Repository", "object", "." ]
train
https://github.com/xolox/python-vcs-repo-mgr/blob/fdad2441a3e7ba5deeeddfa1c2f5ebc00c393aed/vcs_repo_mgr/__init__.py#L188-L268