sequence
stringlengths
492
15.9k
code
stringlengths
75
8.58k
0, module; 0, 1; 1, ERROR; 1, 2; 1, 321; 2, function_definition; 2, 3; 2, 4; 2, 14; 2, 211; 3, function_name:_scan_xgettext_from_files; 4, parameters; 4, 5; 4, 6; 4, 7; 4, 8; 4, 11; 5, identifier:target; 6, identifier:source; 7, identifier:env; 8, default_parameter; 8, 9; 8, 10; 9, identifier:files; 10, None; 11, defau...
def _scan_xgettext_from_files(target, source, env, files=None, path=None): import re import SCons.Util import SCons.Node.FS if files is None: return 0 if not SCons.Util.is_List(files): files = [files] if path is None: if 'XGETTEXTPATH' in env: path = env['XGET...
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): root = create_default_directory_layout( root, NAME, VERSION, VENDOR, filename_set ) components = create_feature_dict( files ) factory = Document() def get_directory( node, dir ): if dir == '' or no...
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): lowest_id = IOTileReading.InvalidReadingID highest_id = IOTileReading.InvalidReadingID for item in itertools.chain(...
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, 12; 5, 19; 5, 39; 5, 45; 5, 57; 5, 69; 5, 88; 5, 138; 5, 144; 5, 165; 5, 173; 5, 195; 5, 201; 5, 205; 5, 227; 5, 234; 5, 241; 5, 248; 5, 255; 5, 262; 5, 269; 5...
def _object_instance_content(obj): retval = bytearray() if obj is None: return b'N.' if isinstance(obj, SCons.Util.BaseStringTypes): return SCons.Util.to_bytes(obj) inst_class = obj.__class__ inst_class_name = bytearray(obj.__class__.__name__,'utf-8') inst_class_module = bytearra...
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, 20; 11, 28; 11...
def execute(self, target, source, env, executor=None): escape_list = SCons.Subst.escape_list flatten_sequence = SCons.Util.flatten_sequence try: shell = env['SHELL'] except KeyError: raise SCons.Errors.UserError('Missing SHELL construction variable.') try:...
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, 18; 8, 22; 8, 50; 8, 63; 8, 72; 8, 95; 8, 108; 8, 124; 8, 143; 9, expression_statement; 9,...
def _try_load_module(path, import_name=None): logger = logging.getLogger(__name__) obj_name = None if len(path) > 2 and ':' in path[2:]: path, _, obj_name = path.rpartition(":") folder, basename = os.path.split(path) if folder == '': folder = './' if basename == '' or not os.path...
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): found_extensions = [] if product_name is not None: for comp in self.iter_components(): if comp_filter is not None and comp.name != comp_filter: ...
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): import_name = None if component is not None: import_name = _ensure_package_loaded(path, component) name, ext = _try_load_module(path, import_name=import_name) if name_filter is ...
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, 21; 7, 39; 7, 48; 7, 56; 7, 326; 8, if_statement; 8, 9; 8, 16; 9, comparison_operator:==; 9, 10; 9, 13; 10, subs...
def solutionEmitter(target, source, env): if source[0] == target[0]: source = [] (base, suff) = SCons.Util.splitext(str(target[0])) suff = env.subst('$MSVSSOLUTIONSUFFIX') target[0] = base + suff if not source: source = 'sln_inputs:' if 'name' in env: if SCons.Uti...
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, 20; 9, 24; 9, 153; 10, expression_statement; 10, 11; 11, assignment;...
async def process_message(self, message, wait=True): to_check = deque([self._waiters]) ignored = True while len(to_check) > 0: context = to_check.popleft() waiters = context.get(OperationManager._LEAF, []) for waiter in waiters: if isinstance(w...
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, 19; 6, 31; 6, 43; 6, 56; 6, 60; 6, 76; 6, 107; 6, 122; 6, 193; 7, function_definition; 7, 8; 7, 9; 7, 11; 8, function_name:is_international; 9, par...
def compile(self, values): def is_international(tag): return tag.endswith('_') def get_country_code(tag): return tag[-2:] def strip_country_code(tag): return tag[:-2] replacements = list(self.tagset.items()) str = "" domestic = [t for t...
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): lowest_id = IOTileReading.InvalidReadingID highest_id = IOTileReading.InvalidReadingID report_len = 20 + ...
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, 10; 5, 17; 5, 24; 5, 31; 5, 51; 5, 105; 5, 145; 5, 152; 5, 159; 5, 170; 5, 181; 5, 220; 5, 227; 5, 234; 5, 304; 5, 311; 5, 318; 6, expression_statement; 6, 7; 7...
def format_snippet(sensor_graph): output = [] output.append("disable") output.append("clear") output.append("reset") for node in sensor_graph.dump_nodes(): output.append('add_node "{}"'.format(node)) for streamer in sensor_graph.streamers: line = "add_streamer '{}' '{}' {} {} {}"...
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, 13; 6, 22; 6, 28; 6, 44; 6, 70; 6, 98; 6, 104; 7, expression_statement; 7, 8; 8, assignment; 8, 9; 8, 10; 9, identifier:payload; 10, ...
def _process_scan_event(self, response): payload = response.payload length = len(payload) - 10 if length < 0: return rssi, packet_type, sender, _addr_type, _bond, data = unpack("<bB6sBB%ds" % length, payload) string_address = ':'.join([format(x, "02X") for x in bytear...
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, 16; 7, 27; 7, 51; 7, 75; 7, 133; 8, expression_statement; 8, 9; 9, assignment; 9, 10; 9, 15; 10, pattern_l...
def _check_ver_range(self, version, ver_range): lower, upper, lower_inc, upper_inc = ver_range if lower is None and upper is None: return True if lower is not None: if lower_inc and version < lower: return False elif not lower_inc and version <...
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, 17; 7, 25; 7, 49; 7, 76; 7, 91; 7, 246; 8, expression_statement; 8, 9; 9, assignment; 9, 10; 9, 11; 10, identifier:save...
def is_LaTeX(flist,env,abspath): savedpath = modify_env_var(env, 'TEXINPUTS', abspath) paths = env['ENV']['TEXINPUTS'] if SCons.Util.is_List(paths): pass else: paths = paths.split(os.pathsep) if savedpath is _null: try: del env['ENV']['TEXINPUTS'] except K...
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, 250; 6, if_statement; 6, 7; 6, 15; 6, 179; 6, 240; 7, call; 7, 8; 7, 13; 8, attribute; 8, 9; 8, 12; 9, attribute; 9, 10; 9, 11; 10, identifier:SCons; 11, identifier:Uti...
def processDefines(defs): 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): if len(d) >= 2: l.append(str(d[0]) + '=' + str(d[1])) el...
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, 24; 6, if_statement; 6, 7; 6, 15; 7, not_operator; 7, 8; 8, call; 8, 9; 8, 14; 9, attribute; 9, 10; 9, 13; 10, attribute; 10, 11; 10, 12; 11, identifier:self; 12, ident...
def local_services(self): if not self._loop.inside_loop(): self._state_lock.acquire() try: return sorted([(index, name) for index, name in self._name_map.items()], key=lambda element: element[0]) finally: if not self._loop.inside_loop(): self._...
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, 14; 5, 22; 5, 30; 5, 187; 5, 219; 5, 234; 5, 274; 5, 314; 5, 322; 5, 330; 5, 343; 5, 350; 5, 357; 6, expression_statement; 6, 7; 7, assignment; 7, 8; 7, 9; 8, identifier:CLVar...
def generate(env): 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_CPPPATH = os.path.join('$QTDIR', 'include'), QT_LIBPATH =...
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, 18; 7, 27; 7, 65; 7, 78; 7, 103; 7, 107; 7, 214; 7, 219; 7, 236; 7, 240; 7, 297; 8, expression_statement; 8, 9...
def emit_rmic_classes(target, source, env): class_suffix = env.get('JAVACLASSSUFFIX', '.class') classdir = env.get('JAVACLASSDIR') if not classdir: try: s = source[0] except IndexError: classdir = '.' else: try: classdir = s.attribu...
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, 11; 6, 52; 6, 93; 6, 107; 6, 130; 6, 142; 6, 151; 6, 162; 6, 175; 6, 188; 6, 200; 6, 206; 6, 219; 6, 241; 6, 245; 6, 255; 7, expression_sta...
def _probe_services(self, handle): code = 0x2800 def event_filter_func(event): if (event.command_class == 4 and event.command == 2): event_handle, = unpack("B", event.payload[0:1]) return event_handle == handle return False def end_filter_f...
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): conn_handle = conn char_handle = handle def write_handle_acked(event): if event.command_class == 4 and event.command == 1: conn, _, char = unpack("<BHH", event.payload) return conn_handle ...
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, 12; 7, 70; 7, 78; 7, 103; 7, 117; 7, 155; 7, 200; 7, 217; 7, 231; 8, expression_statement; 8, 9; 9, assignment; ...
def build_specfiles(source, target, env): opened_files={} def open_file(needle, haystack): try: return opened_files[needle] except KeyError: file=filter(lambda x: x.get_path().rfind(needle)!=-1, haystack)[0] opened_files[needle]=open(file.get_abspath(), 'w') ...
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, 18; 7, 27; 7, 65; 7, 78; 7, 103; 7, 107; 7, 219; 7, 229; 7, 247; 7, 358; 8, expression_statement; 8, 9; 9, ass...
def emit_java_headers(target, source, env): class_suffix = env.get('JAVACLASSSUFFIX', '.class') classdir = env.get('JAVACLASSDIR') if not classdir: try: s = source[0] except IndexError: classdir = '.' else: try: classdir = s.attribu...
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, 18; 7, 36; 7, 54; 7, 58; 7, 163; 7, 187; 7, 207; 7, 227; 8, expression_statement; 8, 9; 9, assi...
def _parse_resource_usage(cls, action_dict, declarations): 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('close_after', [])] used = {} for resource in raw_used: if 'a...
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, 10; 5, 23; 5, 35; 5, 47; 5, 69; 5, 88; 5, 129; 5, 141; 5, 150; 5, 212; 5, 223; 5, 234; 5, 254; 5, 261; 6, expression_statement; 6, 7; 7, assignment; 7, 8; 7, 9; ...
def format_script(sensor_graph): records = [] records.append(SetGraphOnlineRecord(False, address=8)) records.append(ClearDataRecord(address=8)) records.append(ResetGraphRecord(address=8)) for node in sensor_graph.nodes: records.append(AddNodeRecord(str(node), address=8)) for streamer in ...
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, 17; 7, 27; 7, 134; 7, 166; 7, 188; 8, expression_statement; 8, 9; 9, assignment; 9, 10; 9, 11; 10, identifier:reading; 11...
def push(self, stream, reading): reading = copy.copy(reading) reading.stream = stream.encode() if stream.buffered: output_buffer = stream.output if self.id_assigner is not None: reading.reading_id = self.id_assigner(stream, reading) try: ...
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, 48; 9, 61; 10, if_statement; 10, 11; 10, 12; 11, identifier:o...
def inspect_last(self, stream, only_allocated=False): if only_allocated: found = False for walker in self._virtual_walkers: if walker.matches(stream): found = True break if not found: raise UnresolvedIden...
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, 20; 8, 24; 8, 28; 8, 43; 8, 53; 8, 75; 8, 84; 8, 124; 8, 145; 8, 188; 8, 231; 8, 276; 8...
def _dllEmitter(target, source, env, paramtp): 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: raise SCons.Errors.UserError('A shared libr...
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, 15; 8, 56; 8, 62; 8, 68; 8, 74; 8, 80; 8, 90; 8, 96; 8, 102; 8, 108; 8, 114; 8, 120; 8, 126...
def setup_environment(chip, args_file=None): config = ConfigManager() if platform.system() == 'Windows': env = Environment(tools=['mingw'], ENV=os.environ) else: env = Environment(tools=['default'], ENV=os.environ) env['INCPREFIX'] = '-I"' env['INCSUFFIX'] = '"' env['CPPDEFPREFIX...
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, 13; 5, 21; 5, 208; 6, expression_statement; 6, 7; 7, assignment; 7, 8; 7, 9; 8, identifier:fileHandle; 9, call; 9, 10; 9, 11; 10, identifier:_getFileHandle; 11, ...
def fastqRead(fileHandleOrFile): fileHandle = _getFileHandle(fileHandleOrFile) line = fileHandle.readline() while line != '': if line[0] == '@': name = line[1:-1] seq = fileHandle.readline()[:-1] plus = fileHandle.readline() if plus[0] != '+': ...
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): newickTree = newickTree.replace("(", " ( ") 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(args) ...
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', su_...
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, 55; 1...
def read_buffer(io, print_output=False, print_func=None): ''' Reads a file-like buffer object into lines and optionally prints the output. ''' def _print(line): if print_output: if print_func: formatted_line = print_func(line) else: formatt...
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, 300; 6, 313; 7, expression_statement; 7, 8; 8, string:''' Run a single operation for...
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') logge...
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, 45; 5, 67; 6, if_statement; 6, 7; 6, 11; 6, 18; 7, not_operator; 7, 8; 8, attribute; 8, 9; 8, 10; 9, identifier:self; 10, identifier:_receive_has_been_called; 11, block; 11, 12; ...
def send(self): if not self._receive_has_been_called: all_addrs = self._dest_addrs else: all_addrs = [a for (i, a) in list(self._id_to_addr.items()) if i in self._remaining_ids] if self._last_used_id is None: self._last_used_id = int(t...
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, 19; 6, 38; 6, 52; 6, 62; 6, 85; 6, 95; 6, 119; 6, 132; 6, 143; 6, 155; 6, 161; 6, 171; 6, 177; 6, 185; 6, 224; 6, 237; 6, 247; 6, 253; 6, 263; 6,...
def _parse(self, registers): result = {'ip': self.ip, 'connected': True} decoder = BinaryPayloadDecoder.fromRegisters(registers, byteorder=Endian.Big, wordorder=Endian.Little) b = [decoder.d...
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, 13; 8, 17; 8, 21; 8, 217; 9, expression_statement; 9, 10; 10, assignment; 10, 11; 10, 12; 1...
def ParseCFlags(self, start_line=0): modname = None modlist = [] flag = None for line_num in range(start_line, len(self.output)): line = self.output[line_num].rstrip() if not line: if flag: modlist.append(flag) flag = None continue mobj = self.module...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 12; 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:module_n...
def DEFINE_alias(name, original_name, flag_values=FLAGS, module_name=None): if original_name not in flag_values: raise UnrecognizedFlagError(original_name) flag = flag_values[original_name] class _Parser(ArgumentParser): def parse(self, argument): flag.parse(argument) return flag.value class...
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): if store is None: res = rcreds.acquire_cred(name, lifetime, mechs, usage) else: if rcred_cred_store is None: raise NotImplemente...
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): if store is None: if rcred_rfc5588 is None: raise NotImplementedError("Your GSSAPI implementation does " "not have 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): if store is not None and impersonator is not None: raise ValueError('You cannot use both the `impersonator` and ' '`store` arguments ...
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): adata = data.copy() if copy else data keep = list([keep]) if isinstance(keep, str) else list() if keep is None else list(keep) keep.extend(['spliced', 'unspliced', 'Ms', 'Mu', 'clusters', 'neighbors']) ann_dict = {'obs': adata.obs_keys(), 'var': ...
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): adata = data.copy() if copy else data set_initial_size...
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): adata = data.copy() if copy else data set_initial_size(adata) if n_top_genes is not None and adata.n_vars < n_top_gen...
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): adata = data.copy() if copy else data layers = adata.l...
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): adata = data.copy() if copy else data if 'spliced' not i...
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, 62; 9, 75; 9, 88; 9, 119; 9, 199; 9, 229; 9, 254; 9, 276; 9, 298; 9, 320; 9, 34...
def merge(adata, ldata, copy=True): if 'spliced' in ldata.layers.keys() and 'initial_size_spliced' not in ldata.obs.keys(): set_initial_size(ldata) elif 'spliced' in adata.layers.keys() and 'initial_size_spliced' not in adata.obs.keys(): set_initial_size(adata) common_obs = adata.obs_names.intersection(ldat...
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): adata = data.copy() if copy else data logg.info('computing cell fates', r=True) n_neighbors = 10 if n_neighbors is None else n_neighbors _adata = adata.copy() vgraph = VelocityGra...
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): adata = data.copy() if copy else data if 'spliced' not in adata.layers.keys() or 'unspliced' not in adata.layers.keys(): ...
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): if vkey+'_graph' not in...
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, 15; 6, 176; 7, expression_statement; 7, 8; 8, assignment; 8, 9; 8, 10; 9, identifier:subject_symbol; 10, attribute; 10, 11; 10, 14; 11, attri...
def update_holder(self, holder): subject_symbol = self.subject.symbol if subject_symbol in holder.state: if not holder.state[subject_symbol]['quantity']: holder.state[subject_symbol]['value'] = self.details['value'] elif same_sign( holder.state...
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, 14; 8, 27; 8, 35; 8, 53; 8, 57; 8, 89; 8, 109; 8, 160; 8, 211; 8, 331; 8, 349; 8, 364; 8, 373; ...
def addImagingColumns(msname, ack=True): import numpy as np t = table(msname, readonly=False, ack=False) cnames = t.colnames() try: cdesc = t.getcoldesc('DATA') except: raise ValueError('Column DATA does not exist') hasTiled = False try: dminfo = t.getdminfo("DATA") ...
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, 14; 6, 23; 6, 27; 6, 252; 6, 307; 6, 314; 6, 322; 7, expression_statement; 7, 8; 8, assignment; 8, 9; 8, 10; 9, identifier:t; 10, call; 10,...
def msregularize(msname, newname): t = table(msname) t1 = t.sort('unique ANTENNA1,ANTENNA2') nadded = 0 for tsub in t.iter(['TIME', 'DATA_DESC_ID']): nmissing = t1.nrows() - tsub.nrows() if nmissing < 0: raise ValueError("A time/band chunk has too many rows") if nmiss...
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={}): vtype = valuetype if vtype == '': vtype = _value_type_name(value) rec2 = {'valueType...
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={}): vtype = valuetype if vtype == '': vtype = _value_type_name(value) ...
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, 18; 8, 46; 8, 53; 8, 179; 9, if_statement; 9, 10; 9, 13; 10, comparison_operator:is; 10, 11; 1...
def makedminfo(tabdesc, group_spec=None): if group_spec is None: group_spec = {} class DMGroup(object): def __init__(self): self.columns = [] self.type = None self.spec = None dm_groups = defaultdict(DMGroup) for c, d in six.iteritems(tabdesc): if c in ('_define_hypercolumn_', '_ke...
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, 27; 10, 38; 10, 64; 10, 90; 11, if_statem...
def attrgetrow(self, groupname, key, value=None): if not isinstance(key, str): return self._attrgetrow(groupname, key) rownrs = self.attrfindrows(groupname, key, value) if len(rownrs) == 0: raise IndexError("Image attribute " + key + " in group " + ...
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={}): if not locals: locals = getlocals(3) backslash = False dollar = False nparen = 0 name = '' evalstr = '' squote = False dquote = False out = '' for tmp in s: if backslash: out += tmp back...
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): from .tableiter import tableiter return tableiter(self, columnnames, order, sort)
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, 17; 10, import_from_statement; 10, 11; 10, 15; 11, relative_import; 11, 12...
def index(self, columnnames, sort=True): from .tableindex import tableindex return tableindex(self, columnnames, sort)
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, 23; 9, if_statement; 9, 10; 9, 13; 10, comparison_operator:is; 10, 11; 10, 12; 11, identifier:table; 1...
def rownumbers(self, table=None): if table is None: return self._rownumbers(Table()) return self._rownumbers(table)
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): return self._showstructure(dataman, column, subtable, sort)
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'): if not query and not sortlist and not columns and \ limit <= 0 and offset <= 0: raise ValueError('No selection done (arguments query, ' + 'sortlist, c...
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'): command = 'select from $1 orderby ' + sortlist if limit > 0: command += ' limit %d' % limit if offset > 0: command += ' offset %d' % offset if name: command += ' giving ...
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, 15; 12, i...
def browse(self, wait=True, tempname="/tmp/seltable"): import os if os.system('test `which casabrowser`x != x') == 0: waitstr1 = "" waitstr2 = "foreground ..." if not wait: waitstr1 = " &" waitstr2 = "background ..." if self...
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, 15; 11, 19;...
def view(self, wait=True, tempname="/tmp/seltable"): import os viewed = False type = self.info()["type"] if type == "Measurement Set" or type == "Image": if os.system('test -x `which casaviewer` > /dev/null 2>&1') == 0: waitstr1 = "" waitstr2 =...
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, 10; 5, 56; 5, 60; 5, 64; 5, 112; 5, 131; 5, 135; 5, 156; 6, expression_statement; 6, 7; 7, assignment; 7, 8; 7, 9; 8, identifier:out; 9, string:"<table class='taqltable' s...
def _repr_html_(self): out = "<table class='taqltable' style='overflow-x:auto'>\n" if not(all([colname[:4] == "Col_" for colname in self.colnames()])): out += "<tr>" for colname in self.colnames(): out += "<th><b>"+colname+"</b></th>" out += "</tr>" ...
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, 16; 8, 27; 8, 52; 8, 58; 8, 62; 8, 111; 8, 127; 9, expression_statement; 9, 10; 10, ...
def handle_import(self, name, compilation, rule): path = PurePosixPath(name) search_exts = list(compilation.compiler.dynamic_extensions) if path.suffix and path.suffix in search_exts: basename = path.stem else: basename = path.name relative_to = path.paren...
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, 31; 8, 44; 8, 67; 8, 76; 8, 87; 8, 95; 8, 104; 8, 109; 8, 118; 9, expression_statement;...
def _get_properties(self, rule, scope, block): prop, raw_value = (_prop_split_re.split(block.prop, 1) + [None])[:2] if raw_value is not None: raw_value = raw_value.strip() try: is_var = (block.prop[len(prop)] == '=') except IndexError: is_var = False ...
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, 30; 9, 34; 9, 63; 9, 67; 9, 152; 9, 161; 9, 170; 9, 174; 9, 2...
def longest_common_subsequence(a, b, mergefunc=None): if mergefunc is None: def mergefunc(a, b): if a == b: return a return None eq = {} for ai, aval in enumerate(a): for bi, bval in enumerate(b): eq[ai, bi] = mergefunc(aval, bval) pref...
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, 10; 5, 16; 5, 84; 5, 105; 5, 147; 5, 217; 5, 226; 5, 235; 5, 324; 6, expression_statement; 6, 7; 7, assignment; 7, 8; 7, 9; 8, identifier:bom_encoding; 9, string:'UT...
def determine_encoding(buf): bom_encoding = 'UTF-8' if not buf: return bom_encoding if isinstance(buf, six.text_type): if buf[0] == '\ufeff': buf = buf[0:] charset_start = '@charset "' charset_end = '";' if buf.startswith(charset_start): start ...
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, 15; 8, 21; 8, 31; 8, 39; 8, 47; 8, 58; 8, 64; 8, 70; 8, 93; 8, 102; 8, 109; 9, ex...
def _draw_surfaces(self, surface, offset, surfaces): surface_blit = surface.blit ox, oy = offset left, top = self._tile_view.topleft hit = self._layer_quadtree.hit get_tile = self.data.get_tile_image tile_layers = tuple(self.data.visible_tile_layers) dirty = list(...
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, 36; 6, 47; 6, 55; 6, 63; 6, 69; 6, 75; 6, 81; 6, 90; 7, function_definition; 7, 8; 7, 9; 7, 13; 8, function_name:rev; 9, parameters; ...
def get_tile_images_by_rect(self, rect): def rev(seq, start, stop): if start < 0: start = 0 return enumerate(seq[start:stop + 1], start) x1, y1, x2, y2 = rect_to_bb(rect) images = self.tmx.images layers = self.tmx.layers at = self._animated...
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, 16; 5, 23; 5, 34; 6, expression_statement; 6, 7; 7, assignment; 7, 8; 7, 9; 8, identifier:out; 9, call; 9, 10; 9, 11; 10, identifier:get_info; 11, argument_list; 11, 12...
def describe_pdb(pdb_id): out = get_info(pdb_id, url_root = 'http://www.rcsb.org/pdb/rest/describePDB?structureId=') out = to_dict(out) out = remove_at_sign(out['PDBdescription']['PDB']) return out
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): destination_directory = dirname(dest_path) if not exists(destination_directory): makedirs(destination_directory) if not exists(dest_path) or overwrite: session = request...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 6; 2, function_name:server_extensions_handshake; 3, parameters; 3, 4; 3, 5; 4, identifier:requested; 5, identifier:supported; 6, block; 6, 7; 6, 11; 6, 86; 6, 178; 7, expression_statement; 7, 8; 8, assignment; 8, 9; 8, 10; 9, identifier:accepts; 10, dictionary; 11...
def server_extensions_handshake(requested, supported): accepts = {} for offer in requested: name = offer.split(";", 1)[0].strip() for extension in supported: if extension.name == name: accept = extension.accept(offer) if accept is True: ...
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, 16; 5, 38; 5, 43; 5, 47; 5, 189; 6, expression_statement; 6, 7; 7, assignment; 7, 8; 7, 9; 8, identifier:data_source; 9, call; 9, 10; 9, 11; 10, identifier:get_data_obj...
def listfiles(data_name): 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.") sys.exit() dirs = [''] paths = [...
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): request_url = self.base_url + url if relative else url floyd_logger.debug("Downloading file from url: {}".format(request_url)) request_headers = {} if self.auth_header: request_headers["Authorization"...
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): floyd_command = ["floyd", "run"] if instance_type: floyd_command.append('--' + INSTANCE_NAME_MAP[instance_type]) if env and not env == DEFAULT_ENV: floyd_command += ["--env", env] if message: ...
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): if len(env) > 1: floyd_logger.error( "You passed more than one environment: {}. Please specify a single environment.".format(env) ) sys.exit(1) env = env[0] parameters = {} e...
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'): if using == 'recharges': records = user.recharges else: records = user.records if interaction == 'callandtext': records = filter( lambda r: ...
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, 22; 5, 31; 5, 95; 6, if_statement; 6, 7; 6, 19; 7, call; 7, 8; 7, 9; 8, identifier:isinstance; 9, argument_list; 9, 10; 9, 11; 10, identifier:data; 11, tuple; 11, 12; 11, 1...
def infer_type(data): if isinstance(data, (type(None), numbers.Number)): return 'scalar' if isinstance(data, SummaryStats): return 'summarystats' if hasattr(data, "__len__"): data = [x for x in data if x is not None] if len(data) == 0 or isinstance(data[0], numbers.Number): ...
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, 29; 10, 59; 10, 67; ...
def churn_rate(user, summary='default', **kwargs): if len(user.records) == 0: return statistics([], summary=summary) query = { 'groupby': 'week', 'divide_by': OrderedDict([ ('part_of_week', ['allweek']), ('part_of_day', ['allday']) ]), 'using': 're...
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, 40; 5, 54; 5, 68; 5, 111; 5, 128; 5, 138; 5, 161; 5, 191; 5, 226; 5, 256; 5, 277; 5, 298; 5, 319; 6, function_definition; 6, 7; 6, 8; 6, 11; 7, function_name:format_int; 8, p...
def describe(self): def format_int(name, n): if n == 0 or n == 1: return "%i %s" % (n, name[:-1]) else: return "%i %s" % (n, name) empty_box = Colors.OKGREEN + '[ ]' + Colors.ENDC + ' ' filled_box = Colors.OKGREEN + '[x]' + Colors.ENDC + ' ...
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, 29; 6, expression_statement; 6, 7; 7, assignment; 7, 8; 7, 9; 8, identifier:other_keys; 9, call; 9, 10; 9, 11; 10, identifier:sorted; 11, argument_list; 11, 12; 12, list_...
def matrix_index(user): other_keys = sorted([k for k in user.network.keys() if k != user.name]) return [user.name] + other_keys
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, 19; 8, 34; 8, 44; 8, 51; 8, 55; 8, 130; 8, 146; 9, expression_statement; 9,...
def clustering_coefficient_weighted(user, interaction=None): matrix = matrix_undirected_weighted(user, interaction=interaction) weights = [weight for g in matrix for weight in g if weight is not None] if len(weights) == 0: return None max_weight = max(weights) triplet_weight = 0 for a, b...
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, 13; 5, 20; 5, 27; 5, 37; 5, 73; 5, 165; 5, 169; 5, 185; 6, expression_statement; 6, 7; 7, assignment; 7, 8; 7, 9; 8, identifier:matrix; 9, call; 9, 10; 9, 11;...
def assortativity_indicators(user): matrix = matrix_undirected_unweighted(user) count_indicator = defaultdict(int) total_indicator = defaultdict(int) ego_indics = all(user, flatten=True) ego_indics = {a: value for a, value in ego_indics.items() if a != "name" and a[:11] != "reporti...
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, 13; 5, 33; 5, 37; 5, 96; 5, 100; 5, 159; 6, expression_statement; 6, 7; 7, assignment; 7, 8; 7, 9; 8, identifier:matrix; 9, call; 9, 10; 9, 11; 10, identifier...
def assortativity_attributes(user): matrix = matrix_undirected_unweighted(user) neighbors = [k for k in user.network.keys() if k != user.name] neighbors_attrbs = {} for i, u_name in enumerate(matrix_index(user)): correspondent = user.network.get(u_name, None) if correspondent is None or ...
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): if snowball: if user is None: raise ValueError("Must specify a starting user from whom to initiate the snowball") else: users, agenda = [user], [user] while len(agenda) > 0: ...
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): if not isinstance(objects, list): objects = [objects] data = [flatten(obj) for obj in objects] all_keys = [d for datum in data for d in datum.keys()] field_names = sorted(set(all_keys), key=lambda x: all_keys.index(x)) with open(filenam...
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): antennas = None if antennas_path is not None: try: with o...
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)): last_time = None results = [] for g in group: if last_time is None or g.datetime - last_time < delta: if g.interaction == 'text': results.append(g) else: if len(results) != 0: ...
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): if not isinstance(cert, x509.Certificate): raise TypeError('cert must be an instance of asn1crypto.x509.Certificate, not %s' % type_name(cert)) if not isinstance(issuer, x509.Certificate): raise TypeError('issuer...