_id stringlengths 2 7 | title stringlengths 1 88 | partition stringclasses 3
values | text stringlengths 75 19.8k | language stringclasses 1
value | meta_information dict |
|---|---|---|---|---|---|
q54000 | ComponentsManagerUi.reload_components_ui | train | def reload_components_ui(self):
"""
Reloads user selected Components.
:return: Method success.
:rtype: bool
:note: May require user interaction.
"""
selected_components = self.get_selected_components()
self.__engine.start_processing("Reloading Componen... | python | {
"resource": ""
} |
q54001 | ComponentsManagerUi.activate_component | train | def activate_component(self, name):
"""
Activates given Component.
:param name: Component name.
:type name: unicode
:return: Method success.
:rtype: bool
"""
if not name in self.__engine.components_manager.components:
raise manager.exceptions... | python | {
"resource": ""
} |
q54002 | ComponentsManagerUi.deactivate_component | train | def deactivate_component(self, name):
"""
Deactivates given Component.
:param name: Component name.
:type name: unicode
:return: Method success.
:rtype: bool
"""
if not name in self.__engine.components_manager.components:
raise manager.except... | python | {
"resource": ""
} |
q54003 | ComponentsManagerUi.reload_component | train | def reload_component(self, name):
"""
Reloads given Component.
:param name: Component name.
:type name: unicode
:return: Method success.
:rtype: bool
"""
if not name in self.__engine.components_manager.components:
raise manager.exceptions.Com... | python | {
"resource": ""
} |
q54004 | ComponentsManagerUi.set_components | train | def set_components(self):
"""
Sets the Components Model nodes.
"""
node_flags = attributes_flags = int(Qt.ItemIsSelectable | Qt.ItemIsEnabled)
root_node = umbra.ui.nodes.DefaultNode(name="InvisibleRootNode")
paths = {}
for path in self.__engine.components_manag... | python | {
"resource": ""
} |
q54005 | get_file_list | train | def get_file_list(opts):
"""
Returns a list containing file paths of requested files to be parsed
using AnchorHub options.
:param opts: Namespace containing AnchorHub options, usually created from
command line arguments
:return: a list of absolute string file paths of files that should be
... | python | {
"resource": ""
} |
q54006 | ComponentNode.update_tool_tip | train | def update_tool_tip(self):
"""
Updates the node tooltip.
:return: Method success.
:rtype: bool
"""
self.roles[Qt.ToolTipRole] = self.__tool_tip_text.format(self.component.name,
self.component.author,
... | python | {
"resource": ""
} |
q54007 | FunStore.store | train | def store(self, store_item):
"""
Store for tweets and user information. Must have all required information and types
"""
required_keys = {"type": str, "timestamp": float}
if not isinstance(store_item, dict):
raise TypeError("The stored item should be a di... | python | {
"resource": ""
} |
q54008 | Table._table_exists | train | def _table_exists(self):
"""Database-specific method to see if the table exists"""
self.cursor.execute("SHOW TABLES")
for table in self.cursor.fetchall():
if table[0].lower() == self.name.lower():
return True
return False | python | {
"resource": ""
} |
q54009 | Table._get_table_info | train | def _get_table_info(self):
"""Database-specific method to get field names"""
self.rowid = None
self.fields = []
self.field_info = {}
self.cursor.execute('DESCRIBE %s' %self.name)
for row in self.cursor.fetchall():
field,typ,null,key,default,extra = row
... | python | {
"resource": ""
} |
q54010 | create_blocking_connection | train | def create_blocking_connection(host):
"""
Return properly created blocking connection.
Args:
host (str): Host as it is defined in :func:`.get_amqp_settings`.
Uses :func:`edeposit.amqp.amqpdaemon.getConParams`.
"""
return pika.BlockingConnection(
amqpdaemon.getConParams(
... | python | {
"resource": ""
} |
q54011 | create_schema | train | def create_schema(host):
"""
Create exchanges, queues and route them.
Args:
host (str): One of the possible hosts.
"""
connection = create_blocking_connection(host)
channel = connection.channel()
exchange = settings.get_amqp_settings()[host]["exchange"]
channel.exchange_declare... | python | {
"resource": ""
} |
q54012 | _get_channel | train | def _get_channel(host, timeout):
"""
Create communication channel for given `host`.
Args:
host (str): Specified --host.
timeout (int): Set `timeout` for returned `channel`.
Returns:
Object: Pika channel object.
"""
connection = create_blocking_connection(host)
# re... | python | {
"resource": ""
} |
q54013 | receive | train | def receive(host, timeout):
"""
Print all messages in queue.
Args:
host (str): Specified --host.
timeout (int): How log should script wait for message.
"""
parameters = settings.get_amqp_settings()[host]
queues = parameters["queues"]
queues = dict(map(lambda (x, y): (y, x),... | python | {
"resource": ""
} |
q54014 | send_message | train | def send_message(host, data, timeout=None, properties=None):
"""
Send message to given `host`.
Args:
host (str): Specified host: aleph/ftp/whatever available host.
data (str): JSON data.
timeout (int, default None): How much time wait for connection.
"""
channel = _get_chann... | python | {
"resource": ""
} |
q54015 | _visible_in_diff | train | def _visible_in_diff(merge_result, context_lines=3):
"""Collects the set of lines that should be visible in a diff with a certain number of context lines"""
i = old_line = new_line = 0
while i < len(merge_result):
line_or_conflict = merge_result[i]
if isinstance(line_or_conflict, tuple):
... | python | {
"resource": ""
} |
q54016 | _split_diff | train | def _split_diff(merge_result, context_lines=3):
"""Split diffs and context lines into groups based on None sentinel"""
collect = []
for item in _visible_in_diff(merge_result, context_lines=context_lines):
if item is None:
if collect:
yield collect
collect = []... | python | {
"resource": ""
} |
q54017 | _diff_group_position | train | def _diff_group_position(group):
"""Generate a unified diff position line for a diff group"""
old_start = group[0][0]
new_start = group[0][1]
old_length = new_length = 0
for old_line, new_line, line_or_conflict in group:
if isinstance(line_or_conflict, tuple):
old, new = line_or_... | python | {
"resource": ""
} |
q54018 | _diff_group | train | def _diff_group(group):
"""Generate a diff section for diff group"""
yield _diff_group_position(group)
for old_line, new_line, line_or_conflict in group:
if isinstance(line_or_conflict, tuple):
old, new = line_or_conflict
for o in old:
yield color.Deleted('-'... | python | {
"resource": ""
} |
q54019 | _full_diff | train | def _full_diff(merge_result, key, context_lines=3):
"""Generate a full diff based on a Weave merge result"""
header_printed = False
for group in _split_diff(merge_result, context_lines=context_lines):
if not header_printed:
header_printed = True
yield color.Header('diff a/%s ... | python | {
"resource": ""
} |
q54020 | LteParser.resolvePrefix | train | def resolvePrefix(self):
""" extract prefix information into dict with the key of '_prefixstr'
"""
tmpstrlist = []
tmpstodict = {}
for line in self.file_lines:
if line.startswith('%'):
stolist = line.replace('%', '').split('sto')
rpnexp... | python | {
"resource": ""
} |
q54021 | LteParser.get_rpndict_flag | train | def get_rpndict_flag(self, rpndict):
""" calculate flag set, the value is True or False,
if rpndict value is not None, flag is True, or False
if set with only one item, i.e. True returns,
means values of rpndict are all valid float numbers,
then finally return Tru... | python | {
"resource": ""
} |
q54022 | LteParser.update_rpndict | train | def update_rpndict(self, rpndict):
""" update rpndict, try to solve rpn expressions as many as possible,
leave unsolvable unchanged.
return new dict
"""
tmpdict = {k: v for k, v in rpndict.items()}
for k, v in rpndict.items():
v_str = str(v)
... | python | {
"resource": ""
} |
q54023 | LteParser.resolveEPICS | train | def resolveEPICS(self):
""" extract epics control configs into
"""
kw_name_list = []
kw_ctrlconf_list = []
for line in self.file_lines:
if line.startswith('!!epics'):
el = line.replace('!!epics', '').replace(':', ';;', 1).split(';;')
kw... | python | {
"resource": ""
} |
q54024 | LteParser.str2dict | train | def str2dict(self, rawstr):
""" convert str to dict format
USAGE: rdict = str2dict(rawstr)
:param rawstr: raw configuration string of element
"""
kw_list = []
sp1 = rawstr.split(':')
kw_name = sp1[0].strip().upper()
kw_desc = sp1[1:]
sp2 = kw_desc... | python | {
"resource": ""
} |
q54025 | LteParser.getKwAsDict | train | def getKwAsDict(self, kw):
""" return keyword configuration as a dict
Usage: rdict = getKwAsDict(kw)
"""
self.getKw(kw)
return self.str2dict(self.confstr) | python | {
"resource": ""
} |
q54026 | LteParser.detectAllKws | train | def detectAllKws(self):
""" Detect all keyword from infile, return as a list
USAGE: kwslist = detectAllKws()
"""
kwslist = []
for line in self.file_lines:
# if line.strip() == '': continue
line = ''.join(line.strip().split())
if line.startswit... | python | {
"resource": ""
} |
q54027 | LteParser.file2json | train | def file2json(self, jsonfile=None):
""" Convert entire lte file into json like format
USAGE: 1: kwsdictstr = file2json()
2: kwsdictstr = file2json(jsonfile = 'somefile')
show pretty format with pipeline: | jshon, or | pjson
if jsonfile is defined, dump to defined file be... | python | {
"resource": ""
} |
q54028 | LteParser.getKwConfig | train | def getKwConfig(self, kw):
""" return the configuration of kw, dict
USAGE: rdict = getKwConfig(kw)
"""
confd = self.getKwAsDict(kw).values()[0].values()[0]
return {k.lower(): v for k, v in confd.items()} | python | {
"resource": ""
} |
q54029 | LteParser.scanStoVars | train | def scanStoVars(self, strline):
""" scan input string line, replace sto parameters with calculated results.
"""
for wd in strline.split():
if wd in self.stodict:
strline = strline.replace(wd, str(self.stodict[wd]))
return strline | python | {
"resource": ""
} |
q54030 | LteParser.rpn2val | train | def rpn2val(self, rdict):
""" Resolve the rpn string into calulated float number
USAGE: rpn2val(rdict)
:param rdict: json like dict
"""
kw_name = list(rdict.keys())[0] # b11
kw_val = rdict[kw_name]
try:
kw_type = list(kw_val.keys())[0] # csrcsb... | python | {
"resource": ""
} |
q54031 | Lattice.getAllKws | train | def getAllKws(self):
""" extract all keywords into two categories
kws_ele: magnetic elements
kws_bl: beamline elements
return (kws_ele, kws_bl)
"""
kws_ele = []
kws_bl = []
for ele in self.all_elements:
if ele == '_prefixstr' or e... | python | {
"resource": ""
} |
q54032 | Lattice.showBeamlines | train | def showBeamlines(self):
""" show all defined beamlines
"""
cnt = 0
blidlist = []
for k in self.all_elements:
try:
if 'beamline' in self.all_elements.get(k):
cnt += 1
blidlist.append(k)
except:
... | python | {
"resource": ""
} |
q54033 | render_from_path | train | def render_from_path(path, context=None, globals=None):
"""
Renders a templated yaml document from file path.
:param path: A path to the yaml file to process.
:param context: A context to overlay on the yaml file. This will override any yaml values.
:param globals: A dictionary of globally-accessi... | python | {
"resource": ""
} |
q54034 | render_from_string | train | def render_from_string(content, context=None, globals=None):
"""
Renders a templated yaml document from a string.
:param content: The yaml string to evaluate.
:param context: A context to overlay on the yaml file. This will override any yaml values.
:param globals: A dictionary of globally-accessi... | python | {
"resource": ""
} |
q54035 | Interface.get_endpoint | train | def get_endpoint(self, endpoint=None):
"""Return interface URL endpoint."""
base_url = self.api_config.api_url
if not endpoint:
if 'localhost' in base_url:
endpoint = ''
else:
endpoint = ENDPOINTS[self.endpoint_type]
endpoint = '/'... | python | {
"resource": ""
} |
q54036 | Search.setQueries | train | def setQueries(self, queryParameters):
"""Sets the Query."""
if not isinstance(queryParameters, Query):
raise Sitools2Exception("queryParameters must be an instance of Query")
self.__queryParameters = queryParameters | python | {
"resource": ""
} |
q54037 | Search.getOutputColumn | train | def getOutputColumn(self, columnAlias):
"""Returns a Column."""
result = None
for column in self.__outputColumns:
if column.getColumnAlias() == columnAlias:
result = column
break
return result | python | {
"resource": ""
} |
q54038 | Search.__buildLimit | train | def __buildLimit(self, query ,limitResMax):
"""Builds limit parameter."""
limit = query._getParameters()['limit']
if limitResMax>0 and limitResMax < limit:
query = UpdateParameter(query, 'limit', limitResMax)
query = UpdateParameter(query, 'nocount', 'true')
... | python | {
"resource": ""
} |
q54039 | Search.__parseResponse | train | def __parseResponse(self, result):
"""Parses the server response."""
response = []
for data in result['data'] :
result_dict={}
for k,v in data.items() :
column = self.getOutputColumn(k)
if column != None:
type = column.g... | python | {
"resource": ""
} |
q54040 | Search.download | train | def download(self, FILENAME=None):
"""Downloads the files related to the query."""
resultFilename = None
url = self.__url+'/services'
result = Util.retrieveJsonResponseFromServer(url)
dataItems = result['data']
for item in dataItems:
plugin = P... | python | {
"resource": ""
} |
q54041 | Search.execute | train | def execute(self, limitRequest=350000, limitResMax=-1):
"""Executes the query."""
query = self.getQueries()
query = self.__buildLimit(query, limitResMax)
nbr_results = limitResMax
if (limitResMax == -1):
query.setBaseUrl(self.__url+'/count')
countUrl = qu... | python | {
"resource": ""
} |
q54042 | Plugin.__parseParameters | train | def __parseParameters(self):
"""Parses the parameters of data."""
self.__parameters = []
for parameter in self.__data['parameters']:
self.__parameters.append(Parameter(parameter)) | python | {
"resource": ""
} |
q54043 | Plugin.getParameterByValue | train | def getParameterByValue(self, value):
"""Searchs a parameter by value and returns it."""
result = None
for parameter in self.getParameters():
valueParam = parameter.getValue()
if valueParam == value:
result = parameter
break
return ... | python | {
"resource": ""
} |
q54044 | Plugin.getParameterByType | train | def getParameterByType(self, type):
"""Searchs a parameter by type and returns it."""
result = None
for parameter in self.getParameters():
typeParam = parameter.getType()
if typeParam == type:
result = parameter
break
return result | python | {
"resource": ""
} |
q54045 | Plugin.getParameterByName | train | def getParameterByName(self, name):
"""Searchs a parameter by name and returns it."""
result = None
for parameter in self.getParameters():
nameParam = parameter.getName()
if nameParam == name:
result = parameter
break
return result | python | {
"resource": ""
} |
q54046 | update_fid_list | train | def update_fid_list(self,filename,N):
'''
update file indices attribute `altimetry.data.hydro_data.fileid`
'''
self.filelist_count[self.filelist.index(filename)] = N
fid=self.fid_list.compress([enum[1][0] == os.path.basename(filename) for enum in enumerate(zip(*(self.filelis... | python | {
"resource": ""
} |
q54047 | get_currentDim | train | def get_currentDim(self):
'''
returns the current dimensions of the object
'''
selfDim = self._dimensions.copy()
if not isinstance(selfDim,dimStr):
if selfDim.has_key('_ndims') : nself = selfDim.pop('_ndims')
else :
self.warning(1,... | python | {
"resource": ""
} |
q54048 | make_github_markdown_collector | train | def make_github_markdown_collector(opts):
"""
Creates a Collector object used for parsing Markdown files with a GitHub
style anchor transformation
:param opts: Namespace object of options for the AnchorHub program.
Usually created from command-line arguments. It must contain a
'wrapper_regex' a... | python | {
"resource": ""
} |
q54049 | Simulator._doElegant | train | def _doElegant(self):
""" perform elegant tracking
"""
cmdlist = ['bash', self.sim_script, self.elegant_file, self.sim_path, self.sim_exec]
subprocess.call(cmdlist) | python | {
"resource": ""
} |
q54050 | Zactor.send | train | def send(self, msg_p):
"""
Send a zmsg message to the actor, take ownership of the message
and destroy when it has been sent.
"""
return lib.zactor_send(self._as_parameter_, byref(zmsg_p.from_param(msg_p))) | python | {
"resource": ""
} |
q54051 | Zarmour.encode | train | def encode(self, data, size):
"""
Encode a stream of bytes into an armoured string. Returns the armoured
string, or NULL if there was insufficient memory available to allocate
a new string.
"""
return return_fresh_string(lib.zarmour_encode(self._as_parameter_, data, size)) | python | {
"resource": ""
} |
q54052 | Zarmour.decode | train | def decode(self, data):
"""
Decode an armoured string into a chunk. The decoded output is
null-terminated, so it may be treated as a string, if that's what
it was prior to encoding.
"""
return Zchunk(lib.zarmour_decode(self._as_parameter_, data), True) | python | {
"resource": ""
} |
q54053 | Zcert.set_meta | train | def set_meta(self, name, format, *args):
"""
Set certificate metadata from formatted string.
"""
return lib.zcert_set_meta(self._as_parameter_, name, format, *args) | python | {
"resource": ""
} |
q54054 | Zcertstore.set_loader | train | def set_loader(self, loader, destructor, state):
"""
Override the default disk loader with a custom loader fn.
"""
return lib.zcertstore_set_loader(self._as_parameter_, loader, destructor, state) | python | {
"resource": ""
} |
q54055 | Zcertstore.lookup | train | def lookup(self, public_key):
"""
Look up certificate by public key, returns zcert_t object if found,
else returns NULL. The public key is provided in Z85 text format.
"""
return Zcert(lib.zcertstore_lookup(self._as_parameter_, public_key), False) | python | {
"resource": ""
} |
q54056 | Zchunk.set | train | def set(self, data, size):
"""
Set chunk data from user-supplied data; truncate if too large. Data may
be null. Returns actual size of chunk
"""
return lib.zchunk_set(self._as_parameter_, data, size) | python | {
"resource": ""
} |
q54057 | Zchunk.fill | train | def fill(self, filler, size):
"""
Fill chunk data from user-supplied octet
"""
return lib.zchunk_fill(self._as_parameter_, filler, size) | python | {
"resource": ""
} |
q54058 | Zchunk.append | train | def append(self, data, size):
"""
Append user-supplied data to chunk, return resulting chunk size. If the
data would exceeded the available space, it is truncated. If you want to
grow the chunk to accommodate new data, use the zchunk_extend method.
"""
return lib.zchunk_append(self._as_p... | python | {
"resource": ""
} |
q54059 | Zchunk.extend | train | def extend(self, data, size):
"""
Append user-supplied data to chunk, return resulting chunk size. If the
data would exceeded the available space, the chunk grows in size.
"""
return lib.zchunk_extend(self._as_parameter_, data, size) | python | {
"resource": ""
} |
q54060 | Zchunk.read | train | def read(handle, bytes):
"""
Read chunk from an open file descriptor
"""
return Zchunk(lib.zchunk_read(coerce_py_file(handle), bytes), True) | python | {
"resource": ""
} |
q54061 | Zconfig.put | train | def put(self, path, value):
"""
Insert or update configuration key with value
"""
return lib.zconfig_put(self._as_parameter_, path, value) | python | {
"resource": ""
} |
q54062 | Zconfig.putf | train | def putf(self, path, format, *args):
"""
Equivalent to zconfig_put, accepting a format specifier and variable
argument list, instead of a single string value.
"""
return lib.zconfig_putf(self._as_parameter_, path, format, *args) | python | {
"resource": ""
} |
q54063 | Zconfig.get | train | def get(self, path, default_value):
"""
Get value for config item into a string value; leading slash is optional
and ignored.
"""
return lib.zconfig_get(self._as_parameter_, path, default_value) | python | {
"resource": ""
} |
q54064 | Zconfig.set_value | train | def set_value(self, format, *args):
"""
Set new value for config item. The new value may be a string, a printf
format, or NULL. Note that if string may possibly contain '%', or if it
comes from an insecure source, you must use '%s' as the format, followed
by the string.
"""
return lib.zc... | python | {
"resource": ""
} |
q54065 | Zconfig.locate | train | def locate(self, path):
"""
Find a config item along a path; leading slash is optional and ignored.
"""
return Zconfig(lib.zconfig_locate(self._as_parameter_, path), False) | python | {
"resource": ""
} |
q54066 | Zconfig.at_depth | train | def at_depth(self, level):
"""
Locate the last config item at a specified depth
"""
return Zconfig(lib.zconfig_at_depth(self._as_parameter_, level), False) | python | {
"resource": ""
} |
q54067 | Zconfig.execute | train | def execute(self, handler, arg):
"""
Execute a callback for each config item in the tree; returns zero if
successful, else -1.
"""
return lib.zconfig_execute(self._as_parameter_, handler, arg) | python | {
"resource": ""
} |
q54068 | Zconfig.set_comment | train | def set_comment(self, format, *args):
"""
Add comment to config item before saving to disk. You can add as many
comment lines as you like. If you use a null format, all comments are
deleted.
"""
return lib.zconfig_set_comment(self._as_parameter_, format, *args) | python | {
"resource": ""
} |
q54069 | Zconfig.savef | train | def savef(self, format, *args):
"""
Equivalent to zconfig_save, taking a format string instead of a fixed
filename.
"""
return lib.zconfig_savef(self._as_parameter_, format, *args) | python | {
"resource": ""
} |
q54070 | Zdigest.update | train | def update(self, buffer, length):
"""
Add buffer into digest calculation
"""
return lib.zdigest_update(self._as_parameter_, buffer, length) | python | {
"resource": ""
} |
q54071 | Zdir.resync | train | def resync(self, alias):
"""
Return full contents of directory as a zdir_patch list.
"""
return Zlist(lib.zdir_resync(self._as_parameter_, alias), True) | python | {
"resource": ""
} |
q54072 | Zdir.fprint | train | def fprint(self, file, indent):
"""
Print contents of directory to open stream
"""
return lib.zdir_fprint(self._as_parameter_, coerce_py_file(file), indent) | python | {
"resource": ""
} |
q54073 | Zfile.read | train | def read(self, bytes, offset):
"""
Read chunk from file at specified position. If this was the last chunk,
sets the eof property. Returns a null chunk in case of error.
"""
return Zchunk(lib.zfile_read(self._as_parameter_, bytes, offset), True) | python | {
"resource": ""
} |
q54074 | Zfile.write | train | def write(self, chunk, offset):
"""
Write chunk to file at specified position
Return 0 if OK, else -1
"""
return lib.zfile_write(self._as_parameter_, chunk, offset) | python | {
"resource": ""
} |
q54075 | Zframe.send | train | def send(self_p, dest, flags):
"""
Send a frame to a socket, destroy frame after sending.
Return -1 on error, 0 on success.
"""
return lib.zframe_send(byref(zframe_p.from_param(self_p)), dest, flags) | python | {
"resource": ""
} |
q54076 | Zframe.reset | train | def reset(self, data, size):
"""
Set new contents for frame
"""
return lib.zframe_reset(self._as_parameter_, data, size) | python | {
"resource": ""
} |
q54077 | Zhash.update | train | def update(self, key, item):
"""
Update item into hash table with specified key and item.
If key is already present, destroys old item and inserts new one.
Use free_fn method to ensure deallocator is properly called on item.
"""
return lib.zhash_update(self._as_parameter_, key, item) | python | {
"resource": ""
} |
q54078 | Zhashx.update | train | def update(self, key, item):
"""
Update or insert item into hash table with specified key and item. If the
key is already present, destroys old item and inserts new one. If you set
a container item destructor, this is called on the old value. If the key
was not already present, inserts a new item. Sets ... | python | {
"resource": ""
} |
q54079 | Zhashx.pack_own | train | def pack_own(self, serializer):
"""
Same as pack but uses a user-defined serializer function to convert items
into longstr.
"""
return Zframe(lib.zhashx_pack_own(self._as_parameter_, serializer), True) | python | {
"resource": ""
} |
q54080 | Zlist.freefn | train | def freefn(self, item, fn, at_tail):
"""
Set a free function for the specified list item. When the item is
destroyed, the free function, if any, is called on that item.
Use this when list items are dynamically allocated, to ensure that
you don't have memory leaks. You can pass 'free' or NULL as a free_f... | python | {
"resource": ""
} |
q54081 | Zlistx.insert | train | def insert(self, item, low_value):
"""
Create a new node and insert it into a sorted list. Calls the item
duplicator, if any, on the item. If low_value is true, starts searching
from the start of the list, otherwise searches from the end. Use the item
comparator, if any, to find where to place the new n... | python | {
"resource": ""
} |
q54082 | Zlistx.reorder | train | def reorder(self, handle, low_value):
"""
Move an item, specified by handle, into position in a sorted list. Uses
the item comparator, if any, to determine the new location. If low_value
is true, starts searching from the start of the list, otherwise searches
from the end.
"""
return lib... | python | {
"resource": ""
} |
q54083 | Zloop.reader | train | def reader(self, sock, handler, arg):
"""
Register socket reader with the reactor. When the reader has messages,
the reactor will call the handler, passing the arg. Returns 0 if OK, -1
if there was an error. If you register the same socket more than once,
each instance will invoke its corresponding hand... | python | {
"resource": ""
} |
q54084 | Zloop.poller | train | def poller(self, item, handler, arg):
"""
Register low-level libzmq pollitem with the reactor. When the pollitem
is ready, will call the handler, passing the arg. Returns 0 if OK, -1
if there was an error. If you register the pollitem more than once, each
instance will invoke its corresponding handler. ... | python | {
"resource": ""
} |
q54085 | Zloop.timer | train | def timer(self, delay, times, handler, arg):
"""
Register a timer that expires after some delay and repeats some number of
times. At each expiry, will call the handler, passing the arg. To run a
timer forever, use 0 times. Returns a timer_id that is used to cancel the
timer in the future. Returns -1 if ... | python | {
"resource": ""
} |
q54086 | Zmsg.prepend | train | def prepend(self, frame_p):
"""
Push frame to the front of the message, i.e. before all other frames.
Message takes ownership of frame, will destroy it when message is sent.
Returns 0 on success, -1 on error. Deprecates zmsg_push, which did not
nullify the caller's frame reference.
"""
r... | python | {
"resource": ""
} |
q54087 | Zmsg.append | train | def append(self, frame_p):
"""
Add frame to the end of the message, i.e. after all other frames.
Message takes ownership of frame, will destroy it when message is sent.
Returns 0 on success. Deprecates zmsg_add, which did not nullify the
caller's frame reference.
"""
return lib.zmsg_appe... | python | {
"resource": ""
} |
q54088 | Zmsg.pushmem | train | def pushmem(self, data, size):
"""
Push block of memory to front of message, as a new frame.
Returns 0 on success, -1 on error.
"""
return lib.zmsg_pushmem(self._as_parameter_, data, size) | python | {
"resource": ""
} |
q54089 | Zmsg.addmem | train | def addmem(self, data, size):
"""
Add block of memory to the end of the message, as a new frame.
Returns 0 on success, -1 on error.
"""
return lib.zmsg_addmem(self._as_parameter_, data, size) | python | {
"resource": ""
} |
q54090 | Zmsg.pushstrf | train | def pushstrf(self, format, *args):
"""
Push formatted string as new frame to front of message.
Returns 0 on success, -1 on error.
"""
return lib.zmsg_pushstrf(self._as_parameter_, format, *args) | python | {
"resource": ""
} |
q54091 | Zmsg.addstrf | train | def addstrf(self, format, *args):
"""
Push formatted string as new frame to end of message.
Returns 0 on success, -1 on error.
"""
return lib.zmsg_addstrf(self._as_parameter_, format, *args) | python | {
"resource": ""
} |
q54092 | Zmsg.addmsg | train | def addmsg(self, msg_p):
"""
Push encoded message as a new frame. Message takes ownership of
submessage, so the original is destroyed in this call. Returns 0 on
success, -1 on error.
"""
return lib.zmsg_addmsg(self._as_parameter_, byref(zmsg_p.from_param(msg_p))) | python | {
"resource": ""
} |
q54093 | Zproc.set_env | train | def set_env(self, arguments):
"""
Setup the environment variables for the process.
"""
return lib.zproc_set_env(self._as_parameter_, byref(zhash_p.from_param(arguments))) | python | {
"resource": ""
} |
q54094 | Zsock.unbind | train | def unbind(self, format, *args):
"""
Unbind a socket from a formatted endpoint.
Returns 0 if OK, -1 if the endpoint was invalid or the function
isn't supported.
"""
return lib.zsock_unbind(self._as_parameter_, format, *args) | python | {
"resource": ""
} |
q54095 | Zsock.connect | train | def connect(self, format, *args):
"""
Connect a socket to a formatted endpoint
Returns 0 if OK, -1 if the endpoint was invalid.
"""
return lib.zsock_connect(self._as_parameter_, format, *args) | python | {
"resource": ""
} |
q54096 | Zsock.disconnect | train | def disconnect(self, format, *args):
"""
Disconnect a socket from a formatted endpoint
Returns 0 if OK, -1 if the endpoint was invalid or the function
isn't supported.
"""
return lib.zsock_disconnect(self._as_parameter_, format, *args) | python | {
"resource": ""
} |
q54097 | Zsock.attach | train | def attach(self, endpoints, serverish):
"""
Attach a socket to zero or more endpoints. If endpoints is not null,
parses as list of ZeroMQ endpoints, separated by commas, and prefixed by
'@' (to bind the socket) or '>' (to connect the socket). Returns 0 if all
endpoints were valid, or -1 if there was a s... | python | {
"resource": ""
} |
q54098 | Zsys.create_pipe | train | def create_pipe(backend_p):
"""
Create a pipe, which consists of two PAIR sockets connected over inproc.
The pipe is configured to use the zsys_pipehwm setting. Returns the
frontend socket successful, NULL if failed.
"""
return Zsock(lib.zsys_create_pipe(byref(zsock_p.from_param(backend_... | python | {
"resource": ""
} |
q54099 | Zsys.version | train | def version(major, minor, patch):
"""
Return the CZMQ version for run-time API detection; returns version
number into provided fields, providing reference isn't null in each case.
"""
return lib.zsys_version(byref(c_int.from_param(major)), byref(c_int.from_param(minor)), byref(c_int.from... | python | {
"resource": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.