sequence stringlengths 1.27k 35.1k | code stringlengths 75 8.58k |
|---|---|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'ERROR', 'children': ['2', '321']}; {'id': '2', 'type': 'function_definition', 'children': ['3', '4', '14', '211']}; {'id': '3', 'type': 'function_name', 'children': [], 'value': '_scan_xgettext_from_files'}; {'id': '4', 'type': 'parameters', 'childr... | 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... |
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '11']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'build_wxsfile_file_section'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6', '7', '8', '9', '10']}; {'id': '4', 'type'... | 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... |
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '25']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'FromReadings'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6', '7', '8', '13', '16', '19', '22']}; {'id': '4', 'type':... | 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(... |
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': '_object_instance_content'}; {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'identifier', 'children': [], 'v... | 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... |
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '11']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'execute'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6', '7', '8']}; {'id': '4', 'type': 'identifier', 'children': []... | 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:... |
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '8']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': '_try_load_module'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children': [], 'valu... | 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... |
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '21']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'load_extensions'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6', '9', '12', '15', '18']}; {'id': '4', 'type': 'identi... | 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:
... |
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '18']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'load_extension'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6', '9', '12', '15']}; {'id': '4', 'type': 'identifier', ... | 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 ... |
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '7']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'solutionEmitter'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6']}; {'id': '4', 'type': 'identifier', 'children': [], '... | 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... |
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '9']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'process_message'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6']}; {'id': '4', 'type': 'identifier', 'children': [], '... | 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... |
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '6']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'compile'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self... | 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... |
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '29']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'FromReadings'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6', '7', '12', '15', '20', '23', '26']}; {'id': '4', 'type'... | 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 + ... |
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'format_snippet'}; {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'se... | 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 '{}' '{}' {} {} {}"... |
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '6']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': '_process_scan_event'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children': [], 'v... | 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... |
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '7']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': '_check_ver_range'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6']}; {'id': '4', 'type': 'identifier', 'children': [], ... | 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 <... |
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '7']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'is_LaTeX'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6']}; {'id': '4', 'type': 'identifier', 'children': [], 'value':... | 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... |
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'processDefines'}; {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'de... | 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... |
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'local_services'}; {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'se... | 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._... |
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'generate'}; {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'env'}; {... | 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 =... |
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '7']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'emit_rmic_classes'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6']}; {'id': '4', 'type': 'identifier', 'children': [],... | 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... |
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '6']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': '_probe_services'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children': [], 'value... | 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... |
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '12']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': '_write_handle'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6', '7', '8', '9']}; {'id': '4', 'type': 'identifier', 'ch... | 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 ... |
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '7']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'build_specfiles'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6']}; {'id': '4', 'type': 'identifier', 'children': [], '... | 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')
... |
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '7']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'emit_java_headers'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6']}; {'id': '4', 'type': 'identifier', 'children': [],... | 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... |
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '7']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': '_parse_resource_usage'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6']}; {'id': '4', 'type': 'identifier', 'children':... | 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... |
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'format_script'}; {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'sen... | 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 ... |
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '7']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'push'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'se... | 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:
... |
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '9']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'inspect_last'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6']}; {'id': '4', 'type': 'identifier', 'children': [], 'val... | 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... |
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '8']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': '_dllEmitter'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6', '7']}; {'id': '4', 'type': 'identifier', 'children': [], ... | 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... |
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '8']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'setup_environment'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children': [], 'val... | 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... |
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'fastqRead'}; {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'fileHan... | 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] != '+':
... |
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '15']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'newickTreeParser'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '8', '9', '12']}; {'id': '4', 'type': 'identifier', 'chi... | def newickTreeParser(newickTree, defaultDistance=DEFAULT_DISTANCE, \
sortNonBinaryNodes=False, reportUnaryNodes=False):
newickTree = newickTree.replace("(", " ( ")
newickTree = newickTree.replace(")", " ) ")
newickTree = newickTree.replace(":", " : ")
newickTree = newickTree.replace... |
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'parse_iptables_rule'}; {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'identifier', 'children': [], 'value'... | 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)
... |
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '20']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'make_command'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '8', '11', '14', '17']}; {'id': '4', 'type': 'identifier', '... | 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_... |
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '11']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'read_buffer'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '8']}; {'id': '4', 'type': 'identifier', 'children': [], 'val... | 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... |
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '23']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'download'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6', '7', '8', '11', '14', '17', '20']}; {'id': '4', 'type': 'id... | 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 ... |
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '29']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'sync'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6', '7', '8', '11', '14', '17', '20', '23', '26']}; {'id': '4', 'ty... | 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... |
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '20']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'put'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6', '7', '8', '11', '14', '17']}; {'id': '4', 'type': 'identifier', ... | 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
... |
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '6']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': '_run_single_op'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children': [], 'value'... | 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... |
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'send'}; {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id... | 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... |
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '6']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': '_parse'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'... | def _parse(self, registers):
result = {'ip': self.ip, 'connected': True}
decoder = BinaryPayloadDecoder.fromRegisters(registers,
byteorder=Endian.Big,
wordorder=Endian.Little)
b = [decoder.d... |
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '8']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'ParseCFlags'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': '... | 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... |
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '12']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'DEFINE_alias'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6', '9']}; {'id': '4', 'type': 'identifier', 'children': []... | 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... |
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '20']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'acquire'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '8', '11', '14', '17']}; {'id': '4', 'type': 'identifier', 'child... | 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... |
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '20']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'store'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '8', '11', '14', '17']}; {'id': '4', 'type': 'identifier', 'childre... | 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")
... |
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '22']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'add'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6', '7', '10', '13', '16', '19']}; {'id': '4', 'type': 'identifier',... | 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 ... |
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '107']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'velocity_graph'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '8', '11', '14', '17', '20', '23', '26', '29', '32', '35'... | 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,
... |
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '14']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'cleanup'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '8', '11']}; {'id': '4', 'type': 'identifier', 'children': [], 'v... | 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': ... |
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '38']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'filter_genes'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '8', '11', '14', '17', '20', '23', '26', '29', '32', '35']};... | 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... |
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '32']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'filter_genes_dispersion'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '8', '11', '14', '17', '20', '23', '26', '29']}; ... | 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... |
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '31']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'normalize_per_cell'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '8', '11', '14', '17', '20', '25', '28']}; {'id': '4',... | 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... |
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '35']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'filter_and_normalize'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '8', '11', '14', '17', '20', '23', '26', '29', '32']... | 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... |
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '9']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'merge'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'a... | 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... |
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '20']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'cell_fate'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '8', '11', '14', '17']}; {'id': '4', 'type': 'identifier', 'chi... | 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... |
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '32']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'moments'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '8', '11', '14', '17', '20', '23', '26', '29']}; {'id': '4', 'typ... | 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():
... |
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '41']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'transition_matrix'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '8', '11', '14', '17', '20', '23', '26', '29', '32', '3... | 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... |
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '6']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'update_holder'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children': [], 'value':... | 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... |
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '8']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'addImagingColumns'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children': [], 'val... | 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")
... |
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '6']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'msregularize'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': ... | 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... |
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '43']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'tablefromascii'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6', '9', '12', '15', '18', '21', '24', '27', '30', '34', ... | def tablefromascii(tablename, asciifile,
headerfile='',
autoheader=False, autoshape=[],
columnnames=[], datatypes=[],
sep=' ',
commentmarker='',
firstline=1, lastline=-1,
readonly=True,
... |
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '27']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'makescacoldesc'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6', '9', '12', '15', '18', '21', '24']}; {'id': '4', 'typ... | def makescacoldesc(columnname, value,
datamanagertype='',
datamanagergroup='',
options=0, maxlen=0, comment='',
valuetype='', keywords={}):
vtype = valuetype
if vtype == '':
vtype = _value_type_name(value)
rec2 = {'valueType... |
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '33']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'makearrcoldesc'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6', '9', '12', '15', '18', '21', '24', '27', '30']}; {'id... | 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)
... |
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '8']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'makedminfo'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 't... | 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... |
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '10']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'attrgetrow'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6', '7']}; {'id': '4', 'type': 'identifier', 'children': [], ... | 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 " +
... |
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '14']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'substitute'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '8', '11']}; {'id': '4', 'type': 'identifier', 'children': [],... | 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... |
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '12']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'iter'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6', '9']}; {'id': '4', 'type': 'identifier', 'children': [], 'value... | def iter(self, columnnames, order='', sort=True):
from .tableiter import tableiter
return tableiter(self, columnnames, order, sort) |
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '9']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'index'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 's... | def index(self, columnnames, sort=True):
from .tableindex import tableindex
return tableindex(self, columnnames, sort) |
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '8']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'rownumbers'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 's... | def rownumbers(self, table=None):
if table is None:
return self._rownumbers(Table())
return self._rownumbers(table) |
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '17']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'showstructure'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '8', '11', '14']}; {'id': '4', 'type': 'identifier', 'child... | def showstructure(self, dataman=True, column=True, subtable=False,
sort=False):
return self._showstructure(dataman, column, subtable, sort) |
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '26']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'query'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '8', '11', '14', '17', '20', '23']}; {'id': '4', 'type': 'identifie... | 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... |
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '18']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'sort'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6', '9', '12', '15']}; {'id': '4', 'type': 'identifier', 'children'... | 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 ... |
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '11']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'browse'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '8']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': ... | 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... |
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '11']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'view'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '8']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 's... | 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 =... |
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': '_repr_html_'}; {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'... | 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>"
... |
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '8']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'handle_import'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6', '7']}; {'id': '4', 'type': 'identifier', 'children': []... | 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... |
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '8']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': '_get_properties'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6', '7']}; {'id': '4', 'type': 'identifier', 'children': ... | 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
... |
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '9']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'longest_common_subsequence'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6']}; {'id': '4', 'type': 'identifier', 'child... | 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... |
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'determine_encoding'}; {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'identifier', 'children': [], 'value':... | 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 ... |
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '8']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': '_draw_surfaces'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6', '7']}; {'id': '4', 'type': 'identifier', 'children': [... | 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(... |
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '6']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'get_tile_images_by_rect'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children': []... | 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... |
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'describe_pdb'}; {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'pdb_... | 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 |
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '15']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'download_file_from_google_drive'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6', '9', '12']}; {'id': '4', 'type': 'id... | 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... |
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '6']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'server_extensions_handshake'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children'... | 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:
... |
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'listfiles'}; {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'data_na... | 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 = [... |
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '16']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'download'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6', '7', '10', '13']}; {'id': '4', 'type': 'identifier', 'child... | 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"... |
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '11']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'get_command_line'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6', '7', '8', '9', '10']}; {'id': '4', 'type': 'identif... | 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:
... |
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '15']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'restart'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6', '7', '8', '9', '10', '11', '12', '13', '14']}; {'id': '4', '... | 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... |
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '17']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'filter_user'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '8', '11', '14']}; {'id': '4', 'type': 'identifier', 'childre... | 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: ... |
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'infer_type'}; {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'data'}... | 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):
... |
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '10']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'churn_rate'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '8']}; {'id': '4', 'type': 'identifier', 'children': [], 'valu... | 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... |
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'describe'}; {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; ... | 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 + ' ... |
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'matrix_index'}; {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'user... | def matrix_index(user):
other_keys = sorted([k for k in user.network.keys() if k != user.name])
return [user.name] + other_keys |
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '8']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'clustering_coefficient_weighted'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'child... | 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... |
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'assortativity_indicators'}; {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'identifier', 'children': [], 'v... | 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... |
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'assortativity_attributes'}; {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'identifier', 'children': [], 'v... | 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 ... |
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '15']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'network_sampling'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6', '9', '12']}; {'id': '4', 'type': 'identifier', 'chi... | 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:
... |
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '12']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'to_csv'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6', '9']}; {'id': '4', 'type': 'identifier', 'children': [], 'val... | 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... |
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '33']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'read_csv'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6', '9', '12', '15', '18', '21', '24', '27', '30']}; {'id': '4'... | 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... |
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '15']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': '_conversations'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children': [], 'value... | 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:
... |
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '18']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'fetch'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6', '9', '12', '15']}; {'id': '4', 'type': 'identifier', 'children... | 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... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.