sequence stringlengths 546 16.2k | code stringlengths 108 19.3k |
|---|---|
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 13; 2, function_name:_scan_xgettext_from_files; 3, parameters; 3, 4; 3, 5; 3, 6; 3, 7; 3, 10; 4, identifier:target; 5, identifier:source; 6, identifier:env; 7, default_parameter; 7, 8; 7, 9; 8, identifier:files; 9, None; 10, default_parameter; 10, 11; 10, 12; 11, ... | def _scan_xgettext_from_files(target, source, env, files=None, path=None):
""" Parses `POTFILES.in`-like file and returns list of extracted file names.
"""
import re
import SCons.Util
import SCons.Node.FS
if files is None:
return 0
if not SCons.Util.is_List(files):
files = [... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 11; 2, function_name:build_wxsfile_file_section; 3, parameters; 3, 4; 3, 5; 3, 6; 3, 7; 3, 8; 3, 9; 3, 10; 4, identifier:root; 5, identifier:files; 6, identifier:NAME; 7, identifier:VERSION; 8, identifier:VENDOR; 9, identifier:filename_set; 10, identifier:id_set; ... | def build_wxsfile_file_section(root, files, NAME, VERSION, VENDOR, filename_set, id_set):
""" Builds the Component sections of the wxs file with their included files.
Files need to be specified in 8.3 format and in the long name format, long
filenames will be converted automatically.
Features are spec... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 25; 2, function_name:FromReadings; 3, parameters; 3, 4; 3, 5; 3, 6; 3, 7; 3, 8; 3, 13; 3, 16; 3, 19; 3, 22; 4, identifier:cls; 5, identifier:uuid; 6, identifier:readings; 7, identifier:events; 8, default_parameter; 8, 9; 8, 10; 9, identifier:report_id; 10, attribu... | def FromReadings(cls, uuid, readings, events, report_id=IOTileReading.InvalidReadingID,
selector=0xFFFF, streamer=0x100, sent_timestamp=0, received_time=None):
"""Create a flexible dictionary report from a list of readings and events.
Args:
uuid (int): The uuid of the d... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 5; 2, function_name:_object_instance_content; 3, parameters; 3, 4; 4, identifier:obj; 5, block; 5, 6; 5, 8; 5, 14; 5, 21; 5, 41; 5, 47; 5, 59; 5, 71; 5, 90; 5, 91; 5, 141; 5, 147; 5, 168; 5, 176; 5, 198; 5, 204; 5, 208; 5, 232; 5, 239; 5, 246; 5, 253; 5, 260; 5, 2... | def _object_instance_content(obj):
"""
Returns consistant content for a action class or an instance thereof
:Parameters:
- `obj` Should be either and action class or an instance thereof
:Returns:
bytearray or bytes representing the obj suitable for generating a signature from.
"""
... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 11; 2, function_name:execute; 3, parameters; 3, 4; 3, 5; 3, 6; 3, 7; 3, 8; 4, identifier:self; 5, identifier:target; 6, identifier:source; 7, identifier:env; 8, default_parameter; 8, 9; 8, 10; 9, identifier:executor; 10, None; 11, block; 11, 12; 11, 14; 11, 22; 11... | def execute(self, target, source, env, executor=None):
"""Execute a command action.
This will handle lists of commands as well as individual commands,
because construction variable substitution may turn a single
"command" into a list. This means that this class can actually
han... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 8; 2, function_name:_try_load_module; 3, parameters; 3, 4; 3, 5; 4, identifier:path; 5, default_parameter; 5, 6; 5, 7; 6, identifier:import_name; 7, None; 8, block; 8, 9; 8, 11; 8, 20; 8, 24; 8, 53; 8, 66; 8, 75; 8, 98; 8, 111; 8, 127; 8, 146; 9, expression_statem... | def _try_load_module(path, import_name=None):
"""Try to programmatically load a python module by path.
Path should point to a python file (optionally without the .py) at the
end. If it ends in a :<name> then name must point to an object defined in
the module, which is returned instead of the module it... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 21; 2, function_name:load_extensions; 3, parameters; 3, 4; 3, 5; 3, 6; 3, 9; 3, 12; 3, 15; 3, 18; 4, identifier:self; 5, identifier:group; 6, default_parameter; 6, 7; 6, 8; 7, identifier:name_filter; 8, None; 9, default_parameter; 9, 10; 9, 11; 10, identifier:comp... | def load_extensions(self, group, name_filter=None, comp_filter=None, class_filter=None, product_name=None, unique=False):
"""Dynamically load and return extension objects of a given type.
This is the centralized way for all parts of CoreTools to allow plugin
behavior. Whenever a plugin is need... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 18; 2, function_name:load_extension; 3, parameters; 3, 4; 3, 5; 3, 6; 3, 9; 3, 12; 3, 15; 4, identifier:self; 5, identifier:path; 6, default_parameter; 6, 7; 6, 8; 7, identifier:name_filter; 8, None; 9, default_parameter; 9, 10; 9, 11; 10, identifier:class_filter;... | def load_extension(self, path, name_filter=None, class_filter=None, unique=False, component=None):
"""Load a single python module extension.
This function is similar to using the imp module directly to load a
module and potentially inspecting the objects it declares to filter
them by cl... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 7; 2, function_name:solutionEmitter; 3, parameters; 3, 4; 3, 5; 3, 6; 4, identifier:target; 5, identifier:source; 6, identifier:env; 7, block; 7, 8; 7, 10; 7, 11; 7, 12; 7, 13; 7, 26; 7, 27; 7, 45; 7, 54; 7, 62; 7, 332; 8, expression_statement; 8, 9; 9, comment; 1... | def solutionEmitter(target, source, env):
"""Sets up the DSW dependencies."""
# todo: Not sure what sets source to what user has passed as target,
# but this is what happens. When that is fixed, we also won't have
# to make the user always append env['MSVSSOLUTIONSUFFIX'] to target.
if source[0] ==... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 9; 2, function_name:process_message; 3, parameters; 3, 4; 3, 5; 3, 6; 4, identifier:self; 5, identifier:message; 6, default_parameter; 6, 7; 6, 8; 7, identifier:wait; 8, True; 9, block; 9, 10; 9, 12; 9, 22; 9, 26; 9, 156; 10, expression_statement; 10, 11; 11, comm... | async def process_message(self, message, wait=True):
"""Process a message to see if it wakes any waiters.
This will check waiters registered to see if they match the given
message. If so, they are awoken and passed the message. All matching
waiters will be woken.
This method ... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 6; 2, function_name:compile; 3, parameters; 3, 4; 3, 5; 4, identifier:self; 5, identifier:values; 6, block; 6, 7; 6, 9; 6, 21; 6, 33; 6, 45; 6, 58; 6, 62; 6, 78; 6, 109; 6, 124; 6, 195; 7, expression_statement; 7, 8; 8, comment; 9, function_definition; 9, 10; 9, 1... | def compile(self, values):
""" Compiles the tagset and returns a str containing the result
"""
def is_international(tag):
return tag.endswith('_')
def get_country_code(tag):
return tag[-2:]
def strip_country_code(tag):
return tag[:-2]
... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 29; 2, function_name:FromReadings; 3, parameters; 3, 4; 3, 5; 3, 6; 3, 7; 3, 12; 3, 15; 3, 20; 3, 23; 3, 26; 4, identifier:cls; 5, identifier:uuid; 6, identifier:readings; 7, default_parameter; 7, 8; 7, 9; 8, identifier:root_key; 9, attribute; 9, 10; 9, 11; 10, id... | def FromReadings(cls, uuid, readings, root_key=AuthProvider.NoKey, signer=None,
report_id=IOTileReading.InvalidReadingID, selector=0xFFFF, streamer=0, sent_timestamp=0):
"""Generate an instance of the report format from a list of readings and a uuid.
The signed list report is creat... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 5; 2, function_name:format_snippet; 3, parameters; 3, 4; 4, identifier:sensor_graph; 5, block; 5, 6; 5, 8; 5, 12; 5, 13; 5, 20; 5, 27; 5, 34; 5, 35; 5, 55; 5, 56; 5, 110; 5, 111; 5, 151; 5, 152; 5, 159; 5, 166; 5, 167; 5, 178; 5, 189; 5, 228; 5, 229; 5, 236; 5, 24... | def format_snippet(sensor_graph):
"""Format this sensor graph as iotile command snippets.
This includes commands to reset and clear previously stored
sensor graphs.
Args:
sensor_graph (SensorGraph): the sensor graph that we want to format
"""
output = []
# Clear any old sensor gr... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 6; 2, function_name:_process_scan_event; 3, parameters; 3, 4; 3, 5; 4, identifier:self; 5, identifier:response; 6, block; 6, 7; 6, 9; 6, 15; 6, 24; 6, 30; 6, 46; 6, 72; 6, 73; 6, 101; 6, 107; 6, 108; 6, 109; 7, expression_statement; 7, 8; 8, comment; 9, expression... | def _process_scan_event(self, response):
"""Parse the BLE advertisement packet.
If it's an IOTile device, parse and add to the scanned devices. Then,
parse advertisement and determine if it matches V1 or V2. There are
two supported type of advertisements:
v1: There is both an ... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 7; 2, function_name:_check_ver_range; 3, parameters; 3, 4; 3, 5; 3, 6; 4, identifier:self; 5, identifier:version; 6, identifier:ver_range; 7, block; 7, 8; 7, 10; 7, 18; 7, 19; 7, 30; 7, 54; 7, 78; 7, 79; 7, 139; 8, expression_statement; 8, 9; 9, comment; 10, expre... | def _check_ver_range(self, version, ver_range):
"""Check if version is included in ver_range
"""
lower, upper, lower_inc, upper_inc = ver_range
#If the range extends over everything, we automatically match
if lower is None and upper is None:
return True
if ... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 7; 2, function_name:is_LaTeX; 3, parameters; 3, 4; 3, 5; 3, 6; 4, identifier:flist; 5, identifier:env; 6, identifier:abspath; 7, block; 7, 8; 7, 10; 7, 11; 7, 12; 7, 13; 7, 22; 7, 30; 7, 55; 7, 56; 7, 84; 7, 99; 7, 100; 7, 261; 8, expression_statement; 8, 9; 9, co... | def is_LaTeX(flist,env,abspath):
"""Scan a file list to decide if it's TeX- or LaTeX-flavored."""
# We need to scan files that are included in case the
# \documentclass command is in them.
# get path list from both env['TEXINPUTS'] and env['ENV']['TEXINPUTS']
savedpath = modify_env_var(env, 'TEXIN... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 5; 2, function_name:processDefines; 3, parameters; 3, 4; 4, identifier:defs; 5, block; 5, 6; 5, 8; 5, 258; 6, expression_statement; 6, 7; 7, comment; 8, if_statement; 8, 9; 8, 17; 8, 181; 8, 248; 9, call; 9, 10; 9, 15; 10, attribute; 10, 11; 10, 14; 11, attribute;... | def processDefines(defs):
"""process defines, resolving strings, lists, dictionaries, into a list of
strings
"""
if SCons.Util.is_List(defs):
l = []
for d in defs:
if d is None:
continue
elif SCons.Util.is_List(d) or isinstance(d, tuple):
... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 5; 2, function_name:local_services; 3, parameters; 3, 4; 4, identifier:self; 5, block; 5, 6; 5, 8; 5, 26; 6, expression_statement; 6, 7; 7, comment; 8, if_statement; 8, 9; 8, 17; 9, not_operator; 9, 10; 10, call; 10, 11; 10, 16; 11, attribute; 11, 12; 11, 15; 12, ... | def local_services(self):
"""Get a list of id, name pairs for all of the known synced services.
This method is safe to call outside of the background event loop
without any race condition. Internally it uses a thread-safe mutex to
protect the local copies of supervisor data and ensure ... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 5; 2, function_name:generate; 3, parameters; 3, 4; 4, identifier:env; 5, block; 5, 6; 5, 8; 5, 16; 5, 24; 5, 32; 5, 201; 5, 202; 5, 234; 5, 249; 5, 289; 5, 329; 5, 330; 5, 338; 5, 346; 5, 359; 5, 366; 5, 373; 5, 374; 5, 375; 5, 376; 5, 377; 5, 378; 6, expression_s... | def generate(env):
"""Add Builders and construction variables for qt to an Environment."""
CLVar = SCons.Util.CLVar
Action = SCons.Action.Action
Builder = SCons.Builder.Builder
env.SetDefault(QTDIR = _detect(env),
QT_BINPATH = os.path.join('$QTDIR', 'bin'),
QT... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 7; 2, function_name:emit_rmic_classes; 3, parameters; 3, 4; 3, 5; 3, 6; 4, identifier:target; 5, identifier:source; 6, identifier:env; 7, block; 7, 8; 7, 10; 7, 20; 7, 29; 7, 67; 7, 80; 7, 105; 7, 109; 7, 216; 7, 221; 7, 238; 7, 242; 7, 299; 8, expression_statemen... | def emit_rmic_classes(target, source, env):
"""Create and return lists of Java RMI stub and skeleton
class files to be created from a set of class files.
"""
class_suffix = env.get('JAVACLASSSUFFIX', '.class')
classdir = env.get('JAVACLASSDIR')
if not classdir:
try:
s = sour... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 6; 2, function_name:_probe_services; 3, parameters; 3, 4; 3, 5; 4, identifier:self; 5, identifier:handle; 6, block; 6, 7; 6, 9; 6, 13; 6, 54; 6, 95; 6, 109; 6, 132; 6, 144; 6, 153; 6, 164; 6, 177; 6, 190; 6, 202; 6, 203; 6, 209; 6, 222; 6, 244; 6, 248; 6, 258; 7, ... | def _probe_services(self, handle):
"""Probe for all primary services and characteristics in those services
Args:
handle (int): the connection handle to probe
"""
code = 0x2800
def event_filter_func(event):
if (event.command_class == 4 and event.command ... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 12; 2, function_name:_write_handle; 3, parameters; 3, 4; 3, 5; 3, 6; 3, 7; 3, 8; 3, 9; 4, identifier:self; 5, identifier:conn; 6, identifier:handle; 7, identifier:ack; 8, identifier:value; 9, default_parameter; 9, 10; 9, 11; 10, identifier:timeout; 11, float:1.0; ... | def _write_handle(self, conn, handle, ack, value, timeout=1.0):
"""Write to a BLE device characteristic by its handle
Args:
conn (int): The connection handle for the device we should read from
handle (int): The characteristics handle we should read
ack (bool): Should... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 7; 2, function_name:build_specfiles; 3, parameters; 3, 4; 3, 5; 3, 6; 4, identifier:source; 5, identifier:target; 6, identifier:env; 7, block; 7, 8; 7, 10; 7, 11; 7, 12; 7, 13; 7, 14; 7, 15; 7, 16; 7, 17; 7, 21; 7, 79; 7, 87; 7, 112; 7, 116; 7, 128; 7, 129; 7, 130... | def build_specfiles(source, target, env):
""" Filter the targets for the needed files and use the variables in env
to create the specfile.
"""
#
# At first we care for the CONTROL/control file, which is the main file for ipk.
#
# For this we need to open multiple files in random order, so we... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 7; 2, function_name:emit_java_headers; 3, parameters; 3, 4; 3, 5; 3, 6; 4, identifier:target; 5, identifier:source; 6, identifier:env; 7, block; 7, 8; 7, 10; 7, 20; 7, 29; 7, 67; 7, 80; 7, 105; 7, 109; 7, 221; 7, 231; 7, 249; 7, 360; 8, expression_statement; 8, 9;... | def emit_java_headers(target, source, env):
"""Create and return lists of Java stub header files that will
be created from a set of class files.
"""
class_suffix = env.get('JAVACLASSSUFFIX', '.class')
classdir = env.get('JAVACLASSDIR')
if not classdir:
try:
s = source[0]
... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 7; 2, function_name:_parse_resource_usage; 3, parameters; 3, 4; 3, 5; 3, 6; 4, identifier:cls; 5, identifier:action_dict; 6, identifier:declarations; 7, block; 7, 8; 7, 10; 7, 20; 7, 38; 7, 56; 7, 60; 7, 165; 7, 166; 7, 190; 7, 210; 7, 230; 8, expression_statement... | def _parse_resource_usage(cls, action_dict, declarations):
"""Parse out what resources are used, opened and closed in an action step."""
raw_used = action_dict.pop('use', [])
opened = [x.strip() for x in action_dict.pop('open_before', [])]
closed = [x.strip() for x in action_dict.pop('c... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 5; 2, function_name:format_script; 3, parameters; 3, 4; 4, identifier:sensor_graph; 5, block; 5, 6; 5, 8; 5, 12; 5, 25; 5, 37; 5, 49; 5, 71; 5, 90; 5, 131; 5, 143; 5, 152; 5, 214; 5, 215; 5, 226; 5, 237; 5, 257; 5, 264; 6, expression_statement; 6, 7; 7, comment; 8... | def format_script(sensor_graph):
"""Create a binary script containing this sensor graph.
This function produces a repeatable script by applying a known sorting
order to all constants and config variables when iterating over those
dictionaries.
Args:
sensor_graph (SensorGraph): the sensor g... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 7; 2, function_name:push; 3, parameters; 3, 4; 3, 5; 3, 6; 4, identifier:self; 5, identifier:stream; 6, identifier:reading; 7, block; 7, 8; 7, 10; 7, 11; 7, 20; 7, 30; 7, 139; 7, 140; 7, 172; 7, 173; 7, 174; 7, 196; 8, expression_statement; 8, 9; 9, comment; 10, c... | def push(self, stream, reading):
"""Push a reading into a stream, updating any associated stream walkers.
Args:
stream (DataStream): the stream to push the reading into
reading (IOTileReading): the reading to push
"""
# Make sure the stream is correct
re... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 9; 2, function_name:inspect_last; 3, parameters; 3, 4; 3, 5; 3, 6; 4, identifier:self; 5, identifier:stream; 6, default_parameter; 6, 7; 6, 8; 7, identifier:only_allocated; 8, False; 9, block; 9, 10; 9, 12; 9, 50; 9, 63; 10, expression_statement; 10, 11; 11, comme... | def inspect_last(self, stream, only_allocated=False):
"""Return the last value pushed into a stream.
This function works even if the stream is virtual and no
virtual walker has been created for it. It is primarily
useful to aid in debugging sensor graphs.
Args:
str... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 8; 2, function_name:_dllEmitter; 3, parameters; 3, 4; 3, 5; 3, 6; 3, 7; 4, identifier:target; 5, identifier:source; 6, identifier:env; 7, identifier:paramtp; 8, block; 8, 9; 8, 11; 8, 22; 8, 26; 8, 30; 8, 45; 8, 55; 8, 77; 8, 86; 8, 127; 8, 148; 8, 192; 8, 235; 8,... | def _dllEmitter(target, source, env, paramtp):
"""Common implementation of dll emitter."""
SCons.Tool.msvc.validate_vars(env)
extratargets = []
extrasources = []
dll = env.FindIxes(target, '%sPREFIX' % paramtp, '%sSUFFIX' % paramtp)
no_import_lib = env.get('no_import_lib', 0)
if not dll:
... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 8; 2, function_name:setup_environment; 3, parameters; 3, 4; 3, 5; 4, identifier:chip; 5, default_parameter; 5, 6; 5, 7; 6, identifier:args_file; 7, None; 8, block; 8, 9; 8, 11; 8, 17; 8, 18; 8, 59; 8, 65; 8, 71; 8, 77; 8, 83; 8, 93; 8, 99; 8, 100; 8, 106; 8, 112; ... | def setup_environment(chip, args_file=None):
"""Setup the SCons environment for compiling arm cortex code.
This will return an env that has all of the correct settings and create a
command line arguments file for GCC that contains all of the required
flags. The use of a command line argument file passe... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 5; 2, function_name:fastqRead; 3, parameters; 3, 4; 4, identifier:fileHandleOrFile; 5, block; 5, 6; 5, 8; 5, 15; 5, 23; 5, 211; 6, expression_statement; 6, 7; 7, comment; 8, expression_statement; 8, 9; 9, assignment; 9, 10; 9, 11; 10, identifier:fileHandle; 11, ca... | def fastqRead(fileHandleOrFile):
"""Reads a fastq file iteratively
"""
fileHandle = _getFileHandle(fileHandleOrFile)
line = fileHandle.readline()
while line != '':
if line[0] == '@':
name = line[1:-1]
seq = fileHandle.readline()[:-1]
plus = fileHandle.read... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 15; 2, function_name:newickTreeParser; 3, parameters; 3, 4; 3, 5; 3, 8; 3, 9; 3, 12; 4, identifier:newickTree; 5, default_parameter; 5, 6; 5, 7; 6, identifier:defaultDistance; 7, identifier:DEFAULT_DISTANCE; 8, line_continuation:\; 9, default_parameter; 9, 10; 9, ... | def newickTreeParser(newickTree, defaultDistance=DEFAULT_DISTANCE, \
sortNonBinaryNodes=False, reportUnaryNodes=False):
"""
lax newick tree parser
"""
newickTree = newickTree.replace("(", " ( ")
newickTree = newickTree.replace(")", " ) ")
newickTree = newickTree.replace(":",... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 5; 2, function_name:parse_iptables_rule; 3, parameters; 3, 4; 4, identifier:line; 5, block; 5, 6; 5, 8; 5, 16; 5, 20; 5, 24; 5, 28; 5, 32; 5, 90; 5, 154; 5, 161; 5, 177; 6, expression_statement; 6, 7; 7, string:'''
Parse one iptables rule. Returns a dict where... | def parse_iptables_rule(line):
'''
Parse one iptables rule. Returns a dict where each iptables code argument
is mapped to a name using IPTABLES_ARGS.
'''
bits = line.split()
definition = {}
key = None
args = []
not_arg = False
def add_args():
arg_string = ' '.join(arg... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 20; 2, function_name:make_command; 3, parameters; 3, 4; 3, 5; 3, 8; 3, 11; 3, 14; 3, 17; 4, identifier:command; 5, default_parameter; 5, 6; 5, 7; 6, identifier:env; 7, None; 8, default_parameter; 8, 9; 8, 10; 9, identifier:su_user; 10, None; 11, default_parameter;... | def make_command(
command,
env=None,
su_user=None,
sudo=False,
sudo_user=None,
preserve_sudo_env=False,
):
'''
Builds a shell command with various kwargs.
'''
debug_meta = {}
for key, value in (
('sudo', sudo),
('sudo_user', sudo_user),
('su_user', s... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 11; 2, function_name:read_buffer; 3, parameters; 3, 4; 3, 5; 3, 8; 4, identifier:io; 5, default_parameter; 5, 6; 5, 7; 6, identifier:print_output; 7, False; 8, default_parameter; 8, 9; 8, 10; 9, identifier:print_func; 10, None; 11, block; 11, 12; 11, 14; 11, 15; 1... | def read_buffer(io, print_output=False, print_func=None):
'''
Reads a file-like buffer object into lines and optionally prints the output.
'''
# TODO: research this further - some steps towards handling stdin (ie password requests
# from programs that don't notice there's no TTY to accept passwords... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 23; 2, function_name:download; 3, parameters; 3, 4; 3, 5; 3, 6; 3, 7; 3, 8; 3, 11; 3, 14; 3, 17; 3, 20; 4, identifier:state; 5, identifier:host; 6, identifier:source_url; 7, identifier:destination; 8, default_parameter; 8, 9; 8, 10; 9, identifier:user; 10, None; 1... | def download(
state, host, source_url, destination,
user=None, group=None, mode=None, cache_time=None, force=False,
):
'''
Download files from remote locations.
+ source_url: source URl of the file
+ destination: where to save the file
+ user: user to own the files
+ group: group to own... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 29; 2, function_name:sync; 3, parameters; 3, 4; 3, 5; 3, 6; 3, 7; 3, 8; 3, 11; 3, 14; 3, 17; 3, 20; 3, 23; 3, 26; 4, identifier:state; 5, identifier:host; 6, identifier:source; 7, identifier:destination; 8, default_parameter; 8, 9; 8, 10; 9, identifier:user; 10, N... | def sync(
state, host, source, destination,
user=None, group=None, mode=None, delete=False,
exclude=None, exclude_dir=None, add_deploy_dir=True,
):
'''
Syncs a local directory with a remote one, with delete support. Note that delete will
remove extra files on the remote side, but not extra direc... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 20; 2, function_name:put; 3, parameters; 3, 4; 3, 5; 3, 6; 3, 7; 3, 8; 3, 11; 3, 14; 3, 17; 4, identifier:state; 5, identifier:host; 6, identifier:local_filename; 7, identifier:remote_filename; 8, default_parameter; 8, 9; 8, 10; 9, identifier:user; 10, None; 11, d... | def put(
state, host, local_filename, remote_filename,
user=None, group=None, mode=None, add_deploy_dir=True,
):
'''
Copy a local file to the remote system.
+ local_filename: local filename
+ remote_filename: remote filename
+ user: user to own the files
+ group: group to own the files
... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 6; 2, function_name:_run_single_op; 3, parameters; 3, 4; 3, 5; 4, identifier:state; 5, identifier:op_hash; 6, block; 6, 7; 6, 9; 6, 17; 6, 21; 6, 33; 6, 45; 6, 108; 6, 114; 6, 306; 6, 307; 6, 320; 7, expression_statement; 7, 8; 8, string:'''
Run a single opera... | def _run_single_op(state, op_hash):
'''
Run a single operation for all servers. Can be configured to run in serial.
'''
op_meta = state.op_meta[op_hash]
op_types = []
if op_meta['serial']:
op_types.append('serial')
if op_meta['run_once']:
op_types.append('run once')
... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 5; 2, function_name:send; 3, parameters; 3, 4; 4, identifier:self; 5, block; 5, 6; 5, 8; 5, 9; 5, 48; 5, 74; 5, 75; 6, expression_statement; 6, 7; 7, comment; 8, comment; 9, if_statement; 9, 10; 9, 14; 9, 21; 10, not_operator; 10, 11; 11, attribute; 11, 12; 11, 13... | def send(self):
"""
Send pings to multiple addresses, ensuring unique IDs for each request.
This operation is non-blocking. Use 'receive' to get the results.
Send can be called multiple times. If there are any addresses left from
the previous send, from which results have not b... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 6; 2, function_name:_parse; 3, parameters; 3, 4; 3, 5; 4, identifier:self; 5, identifier:registers; 6, block; 6, 7; 6, 9; 6, 21; 6, 40; 6, 41; 6, 55; 6, 65; 6, 66; 6, 89; 6, 99; 6, 100; 6, 124; 6, 137; 6, 138; 6, 149; 6, 161; 6, 162; 6, 163; 6, 164; 6, 165; 6, 166... | def _parse(self, registers):
"""Parse the response, returning a dictionary."""
result = {'ip': self.ip, 'connected': True}
decoder = BinaryPayloadDecoder.fromRegisters(registers,
byteorder=Endian.Big,
... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 8; 2, function_name:ParseCFlags; 3, parameters; 3, 4; 3, 5; 4, identifier:self; 5, default_parameter; 5, 6; 5, 7; 6, identifier:start_line; 7, integer:0; 8, block; 8, 9; 8, 11; 8, 15; 8, 16; 8, 20; 8, 24; 8, 227; 9, expression_statement; 9, 10; 10, comment; 11, ex... | def ParseCFlags(self, start_line=0):
"""Parse C style flags."""
modname = None # name of current module
modlist = []
flag = None
for line_num in range(start_line, len(self.output)): # collect flags
line = self.output[line_num].rstrip()
if not line: ... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 12; 1, 13; 2, function_name:DEFINE_alias; 3, parameters; 3, 4; 3, 5; 3, 6; 3, 9; 4, identifier:name; 5, identifier:original_name; 6, default_parameter; 6, 7; 6, 8; 7, identifier:flag_values; 8, identifier:FLAGS; 9, default_parameter; 9, 10; 9, 11; 10, identifier:m... | def DEFINE_alias(name, original_name, flag_values=FLAGS, module_name=None): # pylint: disable=g-bad-name
"""Defines an alias flag for an existing one.
Args:
name: A string, name of the alias flag.
original_name: A string, name of the original flag.
flag_values: FlagValues object with which the flag wi... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 20; 2, function_name:acquire; 3, parameters; 3, 4; 3, 5; 3, 8; 3, 11; 3, 14; 3, 17; 4, identifier:cls; 5, default_parameter; 5, 6; 5, 7; 6, identifier:name; 7, None; 8, default_parameter; 8, 9; 8, 10; 9, identifier:lifetime; 10, None; 11, default_parameter; 11, 12... | def acquire(cls, name=None, lifetime=None, mechs=None, usage='both',
store=None):
"""Acquire GSSAPI credentials
This method acquires credentials. If the `store` argument is
used, the credentials will be acquired from the given
credential store (if supported). Otherwise... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 20; 2, function_name:store; 3, parameters; 3, 4; 3, 5; 3, 8; 3, 11; 3, 14; 3, 17; 4, identifier:self; 5, default_parameter; 5, 6; 5, 7; 6, identifier:store; 7, None; 8, default_parameter; 8, 9; 8, 10; 9, identifier:usage; 10, string:'both'; 11, default_parameter; ... | def store(self, store=None, usage='both', mech=None,
overwrite=False, set_default=False):
"""Store these credentials into the given store
This method stores the current credentials into the specified
credentials store. If the default store is used, support for
:rfc:`5588`... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 22; 2, function_name:add; 3, parameters; 3, 4; 3, 5; 3, 6; 3, 7; 3, 10; 3, 13; 3, 16; 3, 19; 4, identifier:self; 5, identifier:name; 6, identifier:mech; 7, default_parameter; 7, 8; 7, 9; 8, identifier:usage; 9, string:'both'; 10, default_parameter; 10, 11; 10, 12;... | def add(self, name, mech, usage='both',
init_lifetime=None, accept_lifetime=None, impersonator=None,
store=None):
"""Acquire more credentials to add to the current set
This method works like :meth:`acquire`, except that it adds the
acquired credentials for a single mecha... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 107; 2, function_name:velocity_graph; 3, parameters; 3, 4; 3, 5; 3, 8; 3, 11; 3, 14; 3, 17; 3, 20; 3, 23; 3, 26; 3, 29; 3, 32; 3, 35; 3, 38; 3, 41; 3, 44; 3, 47; 3, 50; 3, 53; 3, 56; 3, 59; 3, 62; 3, 65; 3, 68; 3, 71; 3, 74; 3, 77; 3, 80; 3, 83; 3, 86; 3, 89; 3, 9... | def velocity_graph(adata, basis=None, vkey='velocity', which_graph='velocity', n_neighbors=10,
alpha=.8, perc=90, edge_width=.2, edge_color='grey', color=None, use_raw=None, layer=None,
color_map=None, colorbar=True, palette=None, size=None, sort_order=True, groups=None,
... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 14; 2, function_name:cleanup; 3, parameters; 3, 4; 3, 5; 3, 8; 3, 11; 4, identifier:data; 5, default_parameter; 5, 6; 5, 7; 6, identifier:clean; 7, string:'layers'; 8, default_parameter; 8, 9; 8, 10; 9, identifier:keep; 10, None; 11, default_parameter; 11, 12; 11,... | def cleanup(data, clean='layers', keep=None, copy=False):
"""Deletes attributes not needed.
Arguments
---------
data: :class:`~anndata.AnnData`
Annotated data matrix.
clean: `str` or list of `str` (default: `layers`)
Which attributes to consider for freeing memory.
keep: `str` o... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 38; 2, function_name:filter_genes; 3, parameters; 3, 4; 3, 5; 3, 8; 3, 11; 3, 14; 3, 17; 3, 20; 3, 23; 3, 26; 3, 29; 3, 32; 3, 35; 4, identifier:data; 5, default_parameter; 5, 6; 5, 7; 6, identifier:min_counts; 7, None; 8, default_parameter; 8, 9; 8, 10; 9, identi... | def filter_genes(data, min_counts=None, min_cells=None, max_counts=None, max_cells=None,
min_counts_u=None, min_cells_u=None, max_counts_u=None, max_cells_u=None,
min_shared_counts=None, min_shared_cells=None, copy=False):
"""Filter genes based on number of cells or counts.
Ke... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 32; 2, function_name:filter_genes_dispersion; 3, parameters; 3, 4; 3, 5; 3, 8; 3, 11; 3, 14; 3, 17; 3, 20; 3, 23; 3, 26; 3, 29; 4, identifier:data; 5, default_parameter; 5, 6; 5, 7; 6, identifier:flavor; 7, string:'seurat'; 8, default_parameter; 8, 9; 8, 10; 9, id... | def filter_genes_dispersion(data, flavor='seurat', min_disp=None, max_disp=None, min_mean=None, max_mean=None,
n_bins=20, n_top_genes=None, log=True, copy=False):
"""Extract highly variable genes.
The normalized dispersion is obtained by scaling with the mean and standard
deviati... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 31; 2, function_name:normalize_per_cell; 3, parameters; 3, 4; 3, 5; 3, 8; 3, 11; 3, 14; 3, 17; 3, 20; 3, 25; 3, 28; 4, identifier:data; 5, default_parameter; 5, 6; 5, 7; 6, identifier:counts_per_cell_after; 7, None; 8, default_parameter; 8, 9; 8, 10; 9, identifier... | def normalize_per_cell(data, counts_per_cell_after=None, counts_per_cell=None, key_n_counts=None,
max_proportion_per_cell=None, use_initial_size=True, layers=['spliced', 'unspliced'],
enforce=False, copy=False):
"""Normalize each cell by total counts over all genes.
... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 35; 2, function_name:filter_and_normalize; 3, parameters; 3, 4; 3, 5; 3, 8; 3, 11; 3, 14; 3, 17; 3, 20; 3, 23; 3, 26; 3, 29; 3, 32; 4, identifier:data; 5, default_parameter; 5, 6; 5, 7; 6, identifier:min_counts; 7, None; 8, default_parameter; 8, 9; 8, 10; 9, ident... | def filter_and_normalize(data, min_counts=None, min_counts_u=None, min_cells=None, min_cells_u=None,
min_shared_counts=None, min_shared_cells=None, n_top_genes=None, flavor='seurat', log=True,
copy=False):
"""Filtering, normalization and log transform
Expects n... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 9; 2, function_name:merge; 3, parameters; 3, 4; 3, 5; 3, 6; 4, identifier:adata; 5, identifier:ldata; 6, default_parameter; 6, 7; 6, 8; 7, identifier:copy; 8, True; 9, block; 9, 10; 9, 12; 9, 64; 9, 77; 9, 90; 9, 121; 9, 201; 9, 231; 9, 256; 9, 278; 9, 300; 9, 322... | def merge(adata, ldata, copy=True):
"""Merges two annotated data matrices.
Arguments
---------
adata: :class:`~anndata.AnnData`
Annotated data matrix (reference data set).
ldata: :class:`~anndata.AnnData`
Annotated data matrix (to be merged into adata).
Returns
-------
... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 20; 2, function_name:cell_fate; 3, parameters; 3, 4; 3, 5; 3, 8; 3, 11; 3, 14; 3, 17; 4, identifier:data; 5, default_parameter; 5, 6; 5, 7; 6, identifier:groupby; 7, string:'clusters'; 8, default_parameter; 8, 9; 8, 10; 9, identifier:disconnected_groups; 10, None;... | def cell_fate(data, groupby='clusters', disconnected_groups=None, self_transitions=False, n_neighbors=None, copy=False):
"""Computes individual cell endpoints
Arguments
---------
data: :class:`~anndata.AnnData`
Annotated data matrix.
groupby: `str` (default: `'clusters'`)
Key to whi... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 32; 2, function_name:moments; 3, parameters; 3, 4; 3, 5; 3, 8; 3, 11; 3, 14; 3, 17; 3, 20; 3, 23; 3, 26; 3, 29; 4, identifier:data; 5, default_parameter; 5, 6; 5, 7; 6, identifier:n_neighbors; 7, integer:30; 8, default_parameter; 8, 9; 8, 10; 9, identifier:n_pcs; ... | def moments(data, n_neighbors=30, n_pcs=30, mode='connectivities', method='umap', metric='euclidean', use_rep=None,
recurse_neighbors=False, renormalize=False, copy=False):
"""Computes moments for velocity estimation.
Arguments
---------
data: :class:`~anndata.AnnData`
Annotated dat... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 41; 2, function_name:transition_matrix; 3, parameters; 3, 4; 3, 5; 3, 8; 3, 11; 3, 14; 3, 17; 3, 20; 3, 23; 3, 26; 3, 29; 3, 32; 3, 35; 3, 38; 4, identifier:adata; 5, default_parameter; 5, 6; 5, 7; 6, identifier:vkey; 7, string:'velocity'; 8, default_parameter; 8,... | def transition_matrix(adata, vkey='velocity', basis=None, backward=False, self_transitions=True, scale=10, perc=None,
use_negative_cosines=False, weight_diffusion=0, scale_diffusion=1, weight_indirect_neighbors=None,
n_neighbors=None, vgraph=None):
"""Computes transition ... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 6; 2, function_name:update_holder; 3, parameters; 3, 4; 3, 5; 4, identifier:self; 5, identifier:holder; 6, block; 6, 7; 6, 9; 6, 17; 6, 18; 6, 19; 6, 197; 6, 198; 6, 199; 6, 200; 7, expression_statement; 7, 8; 8, comment; 9, expression_statement; 9, 10; 10, assign... | def update_holder(self, holder):
"""Udpate the Holder state according to the occurrence.
This implementation is a example of how a Occurrence object
can update the Holder state; this method should be overriden
by classes that inherit from the Occurrence class.
This sample imple... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 8; 2, function_name:addImagingColumns; 3, parameters; 3, 4; 3, 5; 4, identifier:msname; 5, default_parameter; 5, 6; 5, 7; 6, identifier:ack; 7, True; 8, block; 8, 9; 8, 11; 8, 12; 8, 17; 8, 18; 8, 31; 8, 39; 8, 40; 8, 58; 8, 59; 8, 63; 8, 95; 8, 96; 8, 116; 8, 117... | def addImagingColumns(msname, ack=True):
""" Add the columns to an MS needed for the casa imager.
It adds the columns MODEL_DATA, CORRECTED_DATA, and IMAGING_WEIGHT.
It also sets the CHANNEL_SELECTION keyword needed for the older casa
imagers.
A column is not added if already existing.
"""
... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 6; 2, function_name:msregularize; 3, parameters; 3, 4; 3, 5; 4, identifier:msname; 5, identifier:newname; 6, block; 6, 7; 6, 9; 6, 10; 6, 17; 6, 26; 6, 30; 6, 31; 6, 261; 6, 262; 6, 318; 6, 325; 6, 333; 7, expression_statement; 7, 8; 8, comment; 9, comment; 10, ex... | def msregularize(msname, newname):
""" Regularize an MS
The output MS will be such that it has the same number of baselines
for each time stamp. Where needed fully flagged rows are added.
Possibly missing rows are written into a separate MS <newname>-add.
It is concatenated with the original MS an... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 43; 2, function_name:tablefromascii; 3, parameters; 3, 4; 3, 5; 3, 6; 3, 9; 3, 12; 3, 15; 3, 18; 3, 21; 3, 24; 3, 27; 3, 30; 3, 34; 3, 37; 3, 40; 4, identifier:tablename; 5, identifier:asciifile; 6, default_parameter; 6, 7; 6, 8; 7, identifier:headerfile; 8, strin... | def tablefromascii(tablename, asciifile,
headerfile='',
autoheader=False, autoshape=[],
columnnames=[], datatypes=[],
sep=' ',
commentmarker='',
firstline=1, lastline=-1,
readonly=True,
... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 27; 2, function_name:makescacoldesc; 3, parameters; 3, 4; 3, 5; 3, 6; 3, 9; 3, 12; 3, 15; 3, 18; 3, 21; 3, 24; 4, identifier:columnname; 5, identifier:value; 6, default_parameter; 6, 7; 6, 8; 7, identifier:datamanagertype; 8, string:''; 9, default_parameter; 9, 10... | def makescacoldesc(columnname, value,
datamanagertype='',
datamanagergroup='',
options=0, maxlen=0, comment='',
valuetype='', keywords={}):
"""Create description of a scalar column.
A description for a scalar column can be created from... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 33; 2, function_name:makearrcoldesc; 3, parameters; 3, 4; 3, 5; 3, 6; 3, 9; 3, 12; 3, 15; 3, 18; 3, 21; 3, 24; 3, 27; 3, 30; 4, identifier:columnname; 5, identifier:value; 6, default_parameter; 6, 7; 6, 8; 7, identifier:ndim; 8, integer:0; 9, default_parameter; 9,... | def makearrcoldesc(columnname, value, ndim=0,
shape=[], datamanagertype='',
datamanagergroup='',
options=0, maxlen=0, comment='',
valuetype='', keywords={}):
"""Create description of an array column.
A description for a scalar column c... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 8; 2, function_name:makedminfo; 3, parameters; 3, 4; 3, 5; 4, identifier:tabdesc; 5, default_parameter; 5, 6; 5, 7; 6, identifier:group_spec; 7, None; 8, block; 8, 9; 8, 11; 8, 20; 8, 50; 8, 57; 8, 58; 8, 59; 8, 191; 8, 192; 9, expression_statement; 9, 10; 10, com... | def makedminfo(tabdesc, group_spec=None):
"""Creates a data manager information object.
Create a data manager information dictionary outline from a table description.
The resulting dictionary is a bare outline and is available for the purposes of
further customising the data manager via the `group_spec` argume... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 10; 2, function_name:attrgetrow; 3, parameters; 3, 4; 3, 5; 3, 6; 3, 7; 4, identifier:self; 5, identifier:groupname; 6, identifier:key; 7, default_parameter; 7, 8; 7, 9; 8, identifier:value; 9, None; 10, block; 10, 11; 10, 13; 10, 29; 10, 30; 10, 41; 10, 67; 10, 9... | def attrgetrow(self, groupname, key, value=None):
"""Get the values of all attributes of a row in a group.
If the key is an integer, the key is the row number for which
the attribute values have to be returned.
Otherwise the key has to be a string and it defines the name of an
... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 14; 2, function_name:substitute; 3, parameters; 3, 4; 3, 5; 3, 8; 3, 11; 4, identifier:s; 5, default_parameter; 5, 6; 5, 7; 6, identifier:objlist; 7, tuple; 8, default_parameter; 8, 9; 8, 10; 9, identifier:globals; 10, dictionary; 11, default_parameter; 11, 12; 11... | def substitute(s, objlist=(), globals={}, locals={}):
"""Substitute global python variables in a command string.
This function parses a string and tries to substitute parts like
`$name` by their value. It is uses by :mod:`image` and :mod:`table`
to handle image and table objects in a command, but also ... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 12; 2, function_name:iter; 3, parameters; 3, 4; 3, 5; 3, 6; 3, 9; 4, identifier:self; 5, identifier:columnnames; 6, default_parameter; 6, 7; 6, 8; 7, identifier:order; 8, string:''; 9, default_parameter; 9, 10; 9, 11; 10, identifier:sort; 11, True; 12, block; 12, ... | def iter(self, columnnames, order='', sort=True):
"""Return a tableiter object.
:class:`tableiter` lets one iterate over a table by returning in each
iteration step a reference table containing equal values for the given
columns.
By default a sort is done on the given columns to... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 9; 2, function_name:index; 3, parameters; 3, 4; 3, 5; 3, 6; 4, identifier:self; 5, identifier:columnnames; 6, default_parameter; 6, 7; 6, 8; 7, identifier:sort; 8, True; 9, block; 9, 10; 9, 12; 9, 19; 10, expression_statement; 10, 11; 11, comment; 12, import_from_... | def index(self, columnnames, sort=True):
"""Return a tableindex object.
:class:`tableindex` lets one get the row numbers of the rows holding
given values for the columns for which the index is created.
It uses an in-memory index on which a binary search is done.
By default the t... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 8; 2, function_name:rownumbers; 3, parameters; 3, 4; 3, 5; 4, identifier:self; 5, default_parameter; 5, 6; 5, 7; 6, identifier:table; 7, None; 8, block; 8, 9; 8, 11; 8, 25; 9, expression_statement; 9, 10; 10, comment; 11, if_statement; 11, 12; 11, 15; 12, comparis... | def rownumbers(self, table=None):
"""Return a list containing the row numbers of this table.
This method can be useful after a selection or a sort.
It returns the row numbers of the rows in this table with respect
to the given table. If no table is given, the original table is used.
... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 17; 2, function_name:showstructure; 3, parameters; 3, 4; 3, 5; 3, 8; 3, 11; 3, 14; 4, identifier:self; 5, default_parameter; 5, 6; 5, 7; 6, identifier:dataman; 7, True; 8, default_parameter; 8, 9; 8, 10; 9, identifier:column; 10, True; 11, default_parameter; 11, 1... | def showstructure(self, dataman=True, column=True, subtable=False,
sort=False):
"""Show table structure in a formatted string.
The structure of this table and optionally its subtables is shown.
It shows the data manager info and column descriptions.
Optionally the ... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 26; 2, function_name:query; 3, parameters; 3, 4; 3, 5; 3, 8; 3, 11; 3, 14; 3, 17; 3, 20; 3, 23; 4, identifier:self; 5, default_parameter; 5, 6; 5, 7; 6, identifier:query; 7, string:''; 8, default_parameter; 8, 9; 8, 10; 9, identifier:name; 10, string:''; 11, defau... | def query(self, query='', name='', sortlist='', columns='',
limit=0, offset=0, style='Python'):
"""Query the table and return the result as a reference table.
This method queries the table. It forms a
`TaQL <../../doc/199.html>`_
command from the given arguments and execut... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 18; 2, function_name:sort; 3, parameters; 3, 4; 3, 5; 3, 6; 3, 9; 3, 12; 3, 15; 4, identifier:self; 5, identifier:sortlist; 6, default_parameter; 6, 7; 6, 8; 7, identifier:name; 8, string:''; 9, default_parameter; 9, 10; 9, 11; 10, identifier:limit; 11, integer:0;... | def sort(self, sortlist, name='',
limit=0, offset=0, style='Python'):
"""Sort the table and return the result as a reference table.
This method sorts the table. It forms a
`TaQL <../../doc/199.html>`_
command from the given arguments and executes it using the
:func:... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 11; 2, function_name:browse; 3, parameters; 3, 4; 3, 5; 3, 8; 4, identifier:self; 5, default_parameter; 5, 6; 5, 7; 6, identifier:wait; 7, True; 8, default_parameter; 8, 9; 8, 10; 9, identifier:tempname; 10, string:"/tmp/seltable"; 11, block; 11, 12; 11, 14; 11, 1... | def browse(self, wait=True, tempname="/tmp/seltable"):
""" Browse a table using casabrowser or a simple wxwidget
based browser.
By default the casabrowser is used if it can be found (in your PATH).
Otherwise the wxwidget one is used if wx can be loaded.
The casabrowser can only... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 11; 2, function_name:view; 3, parameters; 3, 4; 3, 5; 3, 8; 4, identifier:self; 5, default_parameter; 5, 6; 5, 7; 6, identifier:wait; 7, True; 8, default_parameter; 8, 9; 8, 10; 9, identifier:tempname; 10, string:"/tmp/seltable"; 11, block; 11, 12; 11, 14; 11, 17;... | def view(self, wait=True, tempname="/tmp/seltable"):
""" View a table using casaviewer, casabrowser, or wxwidget
based browser.
The table is viewed depending on the type:
MeasurementSet
is viewed using casaviewer.
Image
is viewed using casaviewer.
ot... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 5; 2, function_name:_repr_html_; 3, parameters; 3, 4; 4, identifier:self; 5, block; 5, 6; 5, 8; 5, 12; 5, 13; 5, 59; 5, 63; 5, 67; 5, 116; 5, 135; 5, 139; 5, 160; 6, expression_statement; 6, 7; 7, comment; 8, expression_statement; 8, 9; 9, assignment; 9, 10; 9, 11... | def _repr_html_(self):
"""Give a nice representation of tables in notebooks."""
out = "<table class='taqltable' style='overflow-x:auto'>\n"
# Print column names (not if they are all auto-generated)
if not(all([colname[:4] == "Col_" for colname in self.colnames()])):
out += "... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 8; 2, function_name:handle_import; 3, parameters; 3, 4; 3, 5; 3, 6; 3, 7; 4, identifier:self; 5, identifier:name; 6, identifier:compilation; 7, identifier:rule; 8, block; 8, 9; 8, 11; 8, 12; 8, 13; 8, 14; 8, 15; 8, 16; 8, 17; 8, 18; 8, 25; 8, 36; 8, 61; 8, 67; 8, ... | def handle_import(self, name, compilation, rule):
"""Implementation of the core Sass import mechanism, which just looks
for files on disk.
"""
# TODO this is all not terribly well-specified by Sass. at worst,
# it's unclear how far "upwards" we should be allowed to go. but i'm
... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 8; 2, function_name:_get_properties; 3, parameters; 3, 4; 3, 5; 3, 6; 3, 7; 4, identifier:self; 5, identifier:rule; 6, identifier:scope; 7, identifier:block; 8, block; 8, 9; 8, 11; 8, 33; 8, 46; 8, 69; 8, 78; 8, 89; 8, 97; 8, 106; 8, 111; 8, 120; 9, expression_sta... | def _get_properties(self, rule, scope, block):
"""
Implements properties and variables extraction and assignment
"""
prop, raw_value = (_prop_split_re.split(block.prop, 1) + [None])[:2]
if raw_value is not None:
raw_value = raw_value.strip()
try:
... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 9; 2, function_name:longest_common_subsequence; 3, parameters; 3, 4; 3, 5; 3, 6; 4, identifier:a; 5, identifier:b; 6, default_parameter; 6, 7; 6, 8; 7, identifier:mergefunc; 8, None; 9, block; 9, 10; 9, 12; 9, 33; 9, 34; 9, 35; 9, 39; 9, 68; 9, 69; 9, 70; 9, 74; 9... | def longest_common_subsequence(a, b, mergefunc=None):
"""Find the longest common subsequence between two iterables.
The longest common subsequence is the core of any diff algorithm: it's the
longest sequence of elements that appears in both parent sequences in the
same order, but NOT necessarily consec... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 5; 2, function_name:determine_encoding; 3, parameters; 3, 4; 4, identifier:buf; 5, block; 5, 6; 5, 8; 5, 9; 5, 13; 5, 20; 5, 93; 5, 94; 5, 115; 5, 157; 5, 227; 5, 228; 5, 229; 5, 238; 5, 247; 5, 339; 6, expression_statement; 6, 7; 7, comment; 8, comment; 9, expres... | def determine_encoding(buf):
"""Return the appropriate encoding for the given CSS source, according to
the CSS charset rules.
`buf` may be either a string or bytes.
"""
# The ultimate default is utf8; bravo, W3C
bom_encoding = 'UTF-8'
if not buf:
# What
return bom_encoding
... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 8; 2, function_name:_draw_surfaces; 3, parameters; 3, 4; 3, 5; 3, 6; 3, 7; 4, identifier:self; 5, identifier:surface; 6, identifier:offset; 7, identifier:surfaces; 8, block; 8, 9; 8, 11; 8, 17; 8, 23; 8, 33; 8, 41; 8, 49; 8, 60; 8, 66; 8, 72; 8, 73; 8, 74; 8, 97; ... | def _draw_surfaces(self, surface, offset, surfaces):
""" Draw surfaces onto buffer, then redraw tiles that cover them
:param surface: destination
:param offset: offset to compensate for buffer alignment
:param surfaces: sequence of surfaces to blit
"""
surface_blit = sur... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 6; 2, function_name:get_tile_images_by_rect; 3, parameters; 3, 4; 3, 5; 4, identifier:self; 5, identifier:rect; 6, block; 6, 7; 6, 9; 6, 38; 6, 49; 6, 57; 6, 65; 6, 71; 6, 77; 6, 83; 6, 92; 7, expression_statement; 7, 8; 8, comment; 9, function_definition; 9, 10; ... | def get_tile_images_by_rect(self, rect):
""" Speed up data access
More efficient because data is accessed and cached locally
"""
def rev(seq, start, stop):
if start < 0:
start = 0
return enumerate(seq[start:stop + 1], start)
x1, y1, x2, ... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 5; 2, function_name:describe_pdb; 3, parameters; 3, 4; 4, identifier:pdb_id; 5, block; 5, 6; 5, 8; 5, 18; 5, 25; 5, 36; 6, expression_statement; 6, 7; 7, comment; 8, expression_statement; 8, 9; 9, assignment; 9, 10; 9, 11; 10, identifier:out; 11, call; 11, 12; 11,... | def describe_pdb(pdb_id):
"""Get description and metadata of a PDB entry
Parameters
----------
pdb_id : string
A 4 character string giving a pdb entry of interest
Returns
-------
out : string
A text pdb description from PDB
Examples
--------
>>> describe_pdb(... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 15; 2, function_name:download_file_from_google_drive; 3, parameters; 3, 4; 3, 5; 3, 6; 3, 9; 3, 12; 4, identifier:file_id; 5, identifier:dest_path; 6, default_parameter; 6, 7; 6, 8; 7, identifier:overwrite; 8, False; 9, default_parameter; 9, 10; 9, 11; 10, identif... | def download_file_from_google_drive(file_id, dest_path, overwrite=False, unzip=False, showsize=False):
"""
Downloads a shared file from google drive into a given folder.
Optionally unzips it.
Parameters
----------
file_id: str
the file identifier.
... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 6; 1, 7; 2, function_name:server_extensions_handshake; 3, parameters; 3, 4; 3, 5; 4, identifier:requested; 5, identifier:supported; 6, comment; 7, block; 7, 8; 7, 10; 7, 14; 7, 89; 7, 182; 8, expression_statement; 8, 9; 9, comment; 10, expression_statement; 10, 11... | def server_extensions_handshake(requested, supported):
# type: (List[str], List[Extension]) -> Optional[bytes]
"""Agree on the extensions to use returning an appropriate header value.
This returns None if there are no agreed extensions
"""
accepts = {}
for offer in requested:
name = off... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 5; 2, function_name:listfiles; 3, parameters; 3, 4; 4, identifier:data_name; 5, block; 5, 6; 5, 8; 5, 18; 5, 40; 5, 41; 5, 46; 5, 50; 5, 192; 6, expression_statement; 6, 7; 7, comment; 8, expression_statement; 8, 9; 9, assignment; 9, 10; 9, 11; 10, identifier:data... | def listfiles(data_name):
"""
List files in a dataset.
"""
data_source = get_data_object(data_name, use_data_config=False)
if not data_source:
if 'output' in data_name:
floyd_logger.info("Note: You cannot clone the output of a running job. You need to wait for it to finish.")
... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 16; 2, function_name:download; 3, parameters; 3, 4; 3, 5; 3, 6; 3, 7; 3, 10; 3, 13; 4, identifier:self; 5, identifier:url; 6, identifier:filename; 7, default_parameter; 7, 8; 7, 9; 8, identifier:relative; 9, False; 10, default_parameter; 10, 11; 10, 12; 11, identi... | def download(self, url, filename, relative=False, headers=None, timeout=5):
"""
Download the file from the given url at the current path
"""
request_url = self.base_url + url if relative else url
floyd_logger.debug("Downloading file from url: {}".format(request_url))
# A... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 11; 2, function_name:get_command_line; 3, parameters; 3, 4; 3, 5; 3, 6; 3, 7; 3, 8; 3, 9; 3, 10; 4, identifier:instance_type; 5, identifier:env; 6, identifier:message; 7, identifier:data; 8, identifier:mode; 9, identifier:open_notebook; 10, identifier:command_str;... | def get_command_line(instance_type, env, message, data, mode, open_notebook, command_str):
"""
Return a string representing the full floyd command entered in the command line
"""
floyd_command = ["floyd", "run"]
if instance_type:
floyd_command.append('--' + INSTANCE_NAME_MAP[instance_type])
... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 15; 2, function_name:restart; 3, parameters; 3, 4; 3, 5; 3, 6; 3, 7; 3, 8; 3, 9; 3, 10; 3, 11; 3, 12; 3, 13; 3, 14; 4, identifier:ctx; 5, identifier:job_name; 6, identifier:data; 7, identifier:open_notebook; 8, identifier:env; 9, identifier:message; 10, identifier... | def restart(ctx, job_name, data, open_notebook, env, message, gpu, cpu, gpup, cpup, command):
"""
Restart a finished job as a new job.
"""
# Error early if more than one --env is passed. Then get the first/only
# --env out of the list so all other operations work normally (they don't
# expect an... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 17; 2, function_name:filter_user; 3, parameters; 3, 4; 3, 5; 3, 8; 3, 11; 3, 14; 4, identifier:user; 5, default_parameter; 5, 6; 5, 7; 6, identifier:using; 7, string:'records'; 8, default_parameter; 8, 9; 8, 10; 9, identifier:interaction; 10, None; 11, default_par... | def filter_user(user, using='records', interaction=None,
part_of_week='allweek', part_of_day='allday'):
"""
Filter records of a User objects by interaction, part of week and day.
Parameters
----------
user : User
a bandicoot User object
type : str, default 'records'
... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 5; 2, function_name:infer_type; 3, parameters; 3, 4; 4, identifier:data; 5, block; 5, 6; 5, 8; 5, 24; 5, 33; 5, 98; 6, expression_statement; 6, 7; 7, comment; 8, if_statement; 8, 9; 8, 21; 9, call; 9, 10; 9, 11; 10, identifier:isinstance; 11, argument_list; 11, 12... | def infer_type(data):
"""
Infer the type of objects returned by indicators.
infer_type returns:
- 'scalar' for a number or None,
- 'summarystats' for a SummaryStats object,
- 'distribution_scalar' for a list of scalars,
- 'distribution_summarystats' for a list of SummaryStats objects
... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 10; 2, function_name:churn_rate; 3, parameters; 3, 4; 3, 5; 3, 8; 4, identifier:user; 5, default_parameter; 5, 6; 5, 7; 6, identifier:summary; 7, string:'default'; 8, dictionary_splat_pattern; 8, 9; 9, identifier:kwargs; 10, block; 10, 11; 10, 13; 10, 31; 10, 61; ... | def churn_rate(user, summary='default', **kwargs):
"""
Computes the frequency spent at every towers each week, and returns the
distribution of the cosine similarity between two consecutives week.
.. note:: The churn rate is always computed between pairs of weeks.
"""
if len(user.records) == 0:
... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 5; 2, function_name:describe; 3, parameters; 3, 4; 4, identifier:self; 5, block; 5, 6; 5, 8; 5, 42; 5, 56; 5, 70; 5, 113; 5, 130; 5, 140; 5, 163; 5, 193; 5, 228; 5, 258; 5, 279; 5, 300; 5, 321; 6, expression_statement; 6, 7; 7, comment; 8, function_definition; 8, ... | def describe(self):
"""
Generates a short description of the object, and writes it to the
standard output.
Examples
--------
>>> import bandicoot as bc
>>> user = bc.User()
>>> user.records = bc.tests.generate_user.random_burst(5)
>>> user.describ... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 5; 2, function_name:matrix_index; 3, parameters; 3, 4; 4, identifier:user; 5, block; 5, 6; 5, 8; 5, 31; 6, expression_statement; 6, 7; 7, comment; 8, expression_statement; 8, 9; 9, assignment; 9, 10; 9, 11; 10, identifier:other_keys; 11, call; 11, 12; 11, 13; 12, ... | def matrix_index(user):
"""
Returns the keys associated with each axis of the matrices.
The first key is always the name of the current user, followed by the
sorted names of all the correspondants.
"""
other_keys = sorted([k for k in user.network.keys() if k != user.name])
return [user.nam... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 8; 2, function_name:clustering_coefficient_weighted; 3, parameters; 3, 4; 3, 5; 4, identifier:user; 5, default_parameter; 5, 6; 5, 7; 6, identifier:interaction; 7, None; 8, block; 8, 9; 8, 11; 8, 21; 8, 36; 8, 46; 8, 53; 8, 57; 8, 132; 8, 148; 9, expression_statem... | def clustering_coefficient_weighted(user, interaction=None):
"""
The clustering coefficient of the user's weighted, undirected network.
It is defined the same way as :meth`~bandicoot.network.clustering_coefficient_unweighted`,
except that closed triplets are weighted by the number of interactions. For
... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 5; 2, function_name:assortativity_indicators; 3, parameters; 3, 4; 4, identifier:user; 5, block; 5, 6; 5, 8; 5, 15; 5, 22; 5, 29; 5, 30; 5, 40; 5, 76; 5, 169; 5, 173; 5, 189; 6, expression_statement; 6, 7; 7, comment; 8, expression_statement; 8, 9; 9, assignment; ... | def assortativity_indicators(user):
"""
Computes the assortativity of indicators.
This indicator measures the similarity of the current user with his
correspondants, for all bandicoot indicators. For each one, it calculates
the variance of the current user's value with the values for all his
co... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 5; 2, function_name:assortativity_attributes; 3, parameters; 3, 4; 4, identifier:user; 5, block; 5, 6; 5, 8; 5, 15; 5, 35; 5, 39; 5, 98; 5, 102; 5, 161; 6, expression_statement; 6, 7; 7, comment; 8, expression_statement; 8, 9; 9, assignment; 9, 10; 9, 11; 10, iden... | def assortativity_attributes(user):
"""
Computes the assortativity of the nominal attributes.
This indicator measures the homophily of the current user with his
correspondants, for each attributes. It returns a value between 0
(no assortativity) and 1 (all the contacts share the same value):
th... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 15; 2, function_name:network_sampling; 3, parameters; 3, 4; 3, 5; 3, 6; 3, 9; 3, 12; 4, identifier:n; 5, identifier:filename; 6, default_parameter; 6, 7; 6, 8; 7, identifier:directory; 8, None; 9, default_parameter; 9, 10; 9, 11; 10, identifier:snowball; 11, False... | def network_sampling(n, filename, directory=None, snowball=False, user=None):
"""
Selects a few users and exports a CSV of indicators for them.
TODO: Returns the network/graph between the selected users.
Parameters
----------
n : int
Number of users to select.
filename : string
... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 12; 2, function_name:to_csv; 3, parameters; 3, 4; 3, 5; 3, 6; 3, 9; 4, identifier:objects; 5, identifier:filename; 6, default_parameter; 6, 7; 6, 8; 7, identifier:digits; 8, integer:5; 9, default_parameter; 9, 10; 9, 11; 10, identifier:warnings; 11, True; 12, bloc... | def to_csv(objects, filename, digits=5, warnings=True):
"""
Export the flatten indicators of one or several users to CSV.
Parameters
----------
objects : list
List of objects to be exported.
filename : string
File to export to.
digits : int
Precision of floats.
... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 33; 2, function_name:read_csv; 3, parameters; 3, 4; 3, 5; 3, 6; 3, 9; 3, 12; 3, 15; 3, 18; 3, 21; 3, 24; 3, 27; 3, 30; 4, identifier:user_id; 5, identifier:records_path; 6, default_parameter; 6, 7; 6, 8; 7, identifier:antennas_path; 8, None; 9, default_parameter; ... | def read_csv(user_id, records_path, antennas_path=None, attributes_path=None,
recharges_path=None, network=False, duration_format='seconds',
describe=True, warnings=True, errors=False, drop_duplicates=False):
"""
Load user records from a CSV file.
Parameters
----------
us... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 15; 2, function_name:_conversations; 3, parameters; 3, 4; 3, 5; 4, identifier:group; 5, default_parameter; 5, 6; 5, 7; 6, identifier:delta; 7, call; 7, 8; 7, 11; 8, attribute; 8, 9; 8, 10; 9, identifier:datetime; 10, identifier:timedelta; 11, argument_list; 11, 12... | def _conversations(group, delta=datetime.timedelta(hours=1)):
"""
Group texts into conversations. The function returns an iterator over
records grouped by conversations.
See :ref:`Using bandicoot <conversations-label>` for a definition of
conversations.
A conversation begins when one person se... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 18; 2, function_name:fetch; 3, parameters; 3, 4; 3, 5; 3, 6; 3, 9; 3, 12; 3, 15; 4, identifier:cert; 5, identifier:issuer; 6, default_parameter; 6, 7; 6, 8; 7, identifier:hash_algo; 8, string:'sha1'; 9, default_parameter; 9, 10; 9, 11; 10, identifier:nonce; 11, Tr... | def fetch(cert, issuer, hash_algo='sha1', nonce=True, user_agent=None, timeout=10):
"""
Fetches an OCSP response for a certificate
:param cert:
An asn1cyrpto.x509.Certificate object to get an OCSP reponse for
:param issuer:
An asn1crypto.x509.Certificate object that is the issuer of ce... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.