sequence stringlengths 1.19k 35k | code stringlengths 75 8.58k |
|---|---|
{'id': '0', 'type': 'module', 'children': ['1']}, {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '6']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'check_base_suggested_attributes'}, {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'child... | def check_base_suggested_attributes(self, dataset):
'''
Check the global suggested attributes for 2.0 templates. These go an extra step besides
just checking that they exist.
:param netCDF4.Dataset dataset: An open netCDF dataset
:creator_type = "" ; //.............................. |
{'id': '0', 'type': 'module', 'children': ['1']}, {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'load_from_args_as_dataframe'}, {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'identifier', 'children': [],... | def load_from_args_as_dataframe(args):
'''
Given parsed variant-loading arguments, return a pandas DataFrame.
If no variant loading arguments are specified, return None.
'''
if not args.variants and not args.single_variant:
return None
if args.variant_source_name:
variant_source_... |
{'id': '0', 'type': 'module', 'children': ['1']}, {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '9']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'protected'}, {'id': '3', 'type': 'parameters', 'children': ['4', '5', '7']}; {'id': '4', 'type': 'identifier', 'children': [], 'value'... | def protected(self, *tests, **kwargs):
_role = kwargs.pop('role', None)
_roles = kwargs.pop('roles', None) or []
_csrf = kwargs.pop('csrf', None)
_url_sign_in = kwargs.pop('url_sign_in', None)
_request = kwargs.pop('request', None)
if _role:
_roles.append(_rol... |
{'id': '0', 'type': 'module', 'children': ['1']}, {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '10']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': '_verify_multi'}, {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6', '7']}; {'id': '4', 'type': 'identifier', 'children': [... | def _verify_multi(self, token, verifying_keys, num_required=None):
headers, payload, raw_signatures, signing_inputs = _unpack_token_json(token)
if num_required is None:
num_required = len(raw_signatures)
if num_required > len(verifying_keys):
return False
if len(h... |
{'id': '0', 'type': 'module', 'children': ['1']}, {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '9']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'parse_pic_field'}, {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6', '7', '8']}; {'id': '4', 'type': 'identifier', 'childr... | def parse_pic_field(l, c, last_section_node, last_vars, line):
parent_node = None
raw_tokens = line.split(" ")
tokens = []
for t in raw_tokens:
if not t.isspace() and t != "":
tokens.append(t)
try:
if tokens[0].upper() == "FD":
lvl = 1
else:
... |
{'id': '0', 'type': 'module', 'children': ['1']}, {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '9']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'getgrouploansurl'}, {'id': '3', 'type': 'parameters', 'children': ['4', '5', '7']}; {'id': '4', 'type': 'identifier', 'children': [], ... | def getgrouploansurl(idgroup, *args, **kwargs):
getparams = []
if kwargs:
try:
if kwargs["fullDetails"] == True:
getparams.append("fullDetails=true")
else:
getparams.append("fullDetails=false")
except Exception as ex:
pass
... |
{'id': '0', 'type': 'module', 'children': ['1']}, {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '9']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'getclientloansurl'}, {'id': '3', 'type': 'parameters', 'children': ['4', '5', '7']}; {'id': '4', 'type': 'identifier', 'children': [],... | def getclientloansurl(idclient, *args, **kwargs):
getparams = []
if kwargs:
try:
if kwargs["fullDetails"] == True:
getparams.append("fullDetails=true")
else:
getparams.append("fullDetails=false")
except Exception as ex:
pass
... |
{'id': '0', 'type': 'module', 'children': ['1']}, {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '11']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'backup_db'}, {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6', '7', '9']}; {'id': '4', 'type': 'identifier', 'children': ... | def backup_db(callback, bool_func, output_fname, *args, **kwargs):
from datetime import datetime
try:
verbose = kwargs['verbose']
except KeyError:
verbose = False
try:
retries = kwargs['retries']
except KeyError:
retries = -1
try:
force_download_latest = b... |
{'id': '0', 'type': 'module', 'children': ['1']}, {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '9']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'send'}, {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'},... | def send(self, stack: Layers):
if not isinstance(stack, Stack):
stack = Stack(stack)
if 'callback_query' in self._update and stack.has_layer(Update):
layer = stack.get_layer(Update)
try:
msg = self._update['callback_query']['message']
excep... |
{'id': '0', 'type': 'module', 'children': ['1']}, {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '22']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': '_send_text'}, {'id': '3', 'type': 'parameters', 'children': ['4', '5', '9', '13']}; {'id': '4', 'type': 'identifier', 'children': [],... | async def _send_text(self,
request: Request,
stack: Stack,
parse_mode: Optional[Text] = None):
parts = []
chat_id = request.message.get_chat_id()
for layer in stack.layers:
if isinstance(layer, (lyr.Text, lyr.... |
{'id': '0', 'type': 'module', 'children': ['1']}, {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '9']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'setRepayments'}, {'id': '3', 'type': 'parameters', 'children': ['4', '5', '7']}; {'id': '4', 'type': 'identifier', 'children': [], 'va... | def setRepayments(self, *args, **kwargs):
def duedate(repayment):
try:
return repayment['dueDate']
except KeyError as kerr:
return datetime.now()
try:
reps = self.mamburepaymentsclass(entid=self['id'], *args, **kwargs)
except At... |
{'id': '0', 'type': 'module', 'children': ['1']}, {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '9']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'setTransactions'}, {'id': '3', 'type': 'parameters', 'children': ['4', '5', '7']}; {'id': '4', 'type': 'identifier', 'children': [], '... | def setTransactions(self, *args, **kwargs):
def transactionid(transaction):
try:
return transaction['transactionId']
except KeyError as kerr:
return None
try:
trans = self.mambutransactionsclass(entid=self['id'], *args, **kwargs)
... |
{'id': '0', 'type': 'module', 'children': ['1']}, {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '7']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': '_filter'}, {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': ... | def _filter(self, environ, params):
if self.queries:
if 'QUERY_STRING' not in environ:
return False
available = set(qstr.partition('=')[0] for qstr in
environ['QUERY_STRING'].split('&'))
required = set(self.queries)
if n... |
{'id': '0', 'type': 'module', 'children': ['1']}, {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '41']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'show'}, {'id': '3', 'type': 'parameters', 'children': ['4', '5', '8', '11', '14', '17', '20', '23', '26', '29', '32', '35', '38']}; {... | def show(
items,
command='dmenu',
bottom=None,
fast=None,
case_insensitive=None,
lines=None,
monitor=None,
prompt=None,
font=None,
background=None,
foreground=None,
background_selected=None,
foreground_selected=None)... |
{'id': '0', 'type': 'module', 'children': ['1']}, {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '14']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'clean_names'}, {'id': '3', 'type': 'parameters', 'children': ['4', '5', '8', '11']}; {'id': '4', 'type': 'identifier', 'children': []... | def clean_names(lines, ensure_unique_names=False, strip_prefix=False,
make_database_safe=False):
names = {}
for row in lines:
if strip_prefix:
row['name'] = row['name'][row['name'].find('-') + 1:]
if row['indexed_by'] is not None:
row['indexed_by']... |
{'id': '0', 'type': 'module', 'children': ['1']}, {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '6']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'do_help'}, {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self... | def do_help(self, arg):
if arg:
try:
func = getattr(self, 'help_' + arg)
except AttributeError:
try:
doc = getattr(self, 'do_' + arg).__doc__
if doc:
self.stdout.write("%s\n" % str(doc))
... |
{'id': '0', 'type': 'module', 'children': ['1']}, {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '12']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'make_echoicefield'}, {'id': '3', 'type': 'parameters', 'children': ['4', '5', '7', '10']}; {'id': '4', 'type': 'identifier', 'childre... | def make_echoicefield(echoices, *args, klass_name=None, **kwargs):
assert issubclass(echoices, EChoice)
value_type = echoices.__getvaluetype__()
if value_type is str:
cls_ = models.CharField
elif value_type is int:
cls_ = models.IntegerField
elif value_type is float:
cls_ = m... |
{'id': '0', 'type': 'module', 'children': ['1']}, {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '30']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'make_dummy'}, {'id': '3', 'type': 'parameters', 'children': ['4', '5', '8', '17', '20', '23', '26', '28']}; {'id': '4', 'type': 'iden... | def make_dummy(instance,
relations = {},
datetime_default = dt.strptime('1901-01-01','%Y-%m-%d'),
varchar_default = "",
integer_default = 0,
numeric_default = 0.0,
*args, **kwargs
):
init_data = {
... |
{'id': '0', 'type': 'module', 'children': ['1']}, {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '8']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'read_headers'}, {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': ... | def read_headers(rfile, hdict=None):
if hdict is None:
hdict = {}
while True:
line = rfile.readline()
if not line:
raise ValueError("Illegal end of headers.")
if line == CRLF:
break
if not line.endswith(CRLF):
raise ValueError("HTTP req... |
{'id': '0', 'type': 'module', 'children': ['1']}, {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'send_headers'}, {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self... | def send_headers(self):
hkeys = [key.lower() for key, value in self.outheaders]
status = int(self.status[:3])
if status == 413:
self.close_connection = True
elif "content-length" not in hkeys:
if status < 200 or status in (204, 205, 304):
pass
... |
{'id': '0', 'type': 'module', 'children': ['1']}, {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '9']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'setActivities'}, {'id': '3', 'type': 'parameters', 'children': ['4', '5', '7']}; {'id': '4', 'type': 'identifier', 'children': [], 'va... | def setActivities(self, *args, **kwargs):
def activityDate(activity):
try:
return activity['activity']['timestamp']
except KeyError as kerr:
return None
try:
activities = self.mambuactivitiesclass(groupId=self['encodedKey'], *args, **kw... |
{'id': '0', 'type': 'module', 'children': ['1']}, {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '9']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'connect'}, {'id': '3', 'type': 'parameters', 'children': ['4', '5', '7']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': ... | def connect(self, *args, **kwargs):
from copy import deepcopy
if args:
self.__args = deepcopy(args)
if kwargs:
for k,v in kwargs.items():
self.__kwargs[k] = deepcopy(v)
jsresp = {}
if not self.__urlfunc:
return
offset = ... |
{'id': '0', 'type': 'module', 'children': ['1']}, {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '37']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'GetDirections'}, {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6', '7', '10', '13', '16', '19', '22', '25', '28', '31', '... | def GetDirections(self, origin, destination, sensor = False, mode = None, waypoints = None, alternatives = None, avoid = None, language = None, units = None,
region = None, departure_time = None, arrival_time = None):
'''Get Directions Service
Pls refer to the Google Maps Web ... |
{'id': '0', 'type': 'module', 'children': ['1']}, {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'compactor'}, {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'conf'},... | def compactor(conf):
db = conf.get_database('compactor')
limit_map = LimitContainer(conf, db)
config = conf['compactor']
if get_int(config, 'max_updates', 0) <= 0:
LOG.warning("Compaction is not enabled. Enable it by "
"setting a positive integer value for "
... |
{'id': '0', 'type': 'module', 'children': ['1']}, {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '6']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'get'}, {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}, ... | def get(self, now):
with self.lock:
items = self.db.zrangebyscore(self.key, 0, now - self.min_age,
start=0, num=1)
if not items:
return None
item = items[0]
self.db.zrem(item)
return item |
{'id': '0', 'type': 'module', 'children': ['1']}, {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '6']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'get'}, {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}, ... | def get(self, now):
items = self.script(keys=[self.key], args=[now - self.min_age])
return items[0] if items else None |
{'id': '0', 'type': 'module', 'children': ['1']}, {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '4']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'main_cli'}, {'id': '3', 'type': 'parameters', 'children': []}; {'id': '4', 'type': 'block', 'children': ['5', '11', '17', '23', '29', ... | def main_cli():
args = _cli_argument_parser()
delta_secs = args.delay
i2cbus = args.bus
i2c_address = args.address
sensor_key = args.sensor
sensor_params = args.params
params = {}
if sensor_params:
def _parse_param(str_param):
key, value = str_param.split('=')
... |
{'id': '0', 'type': 'module', 'children': ['1']}, {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '9']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'variant_support'}, {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6']}; {'id': '4', 'type': 'identifier', 'children': [], '... | def variant_support(variants, allele_support_df, ignore_missing=False):
'''
Collect the read evidence support for the given variants.
Parameters
----------
variants : iterable of varcode.Variant
allele_support_df : dataframe
Allele support dataframe, as output by the varlens-allele-suppo... |
{'id': '0', 'type': 'module', 'children': ['1']}, {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '21', '25']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': '_wavReadData'}, {'id': '3', 'type': 'parameters', 'children': ['4', '5', '9', '13', '17']}; {'id': '4', 'type': 'identifier', '... | def _wavReadData(fid,
size:int,
channels:int,
encoding:str,
bigendian:bool) -> np.ndarray:
bits = int(encoding[3:])
if bits == 8:
data = np.fromfile(fid, dtype=np.ubyte, count=size)
if channels > 1:
data = data.r... |
{'id': '0', 'type': 'module', 'children': ['1']}, {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'refreshButton'}, {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'sel... | def refreshButton(self):
collapsed = self.isCollapsed()
btn = self._collapseButton
if not btn:
return
btn.setMaximumSize(MAX_SIZE, MAX_SIZE)
if self.orientation() == Qt.Vertical:
btn.setMaximumHeight(12)
else:
btn.setMaximumWi... |
{'id': '0', 'type': 'module', 'children': ['1']}, {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'applyCommand'}, {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self... | def applyCommand(self):
cursor = self.textCursor()
cursor.movePosition(cursor.EndOfLine)
line = projex.text.nativestring(cursor.block().text())
at_end = cursor.atEnd()
modifiers = QApplication.instance().keyboardModifiers()
mod_mode = at_end or... |
{'id': '0', 'type': 'module', 'children': ['1']}, {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '6']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'pager'}, {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}... | def pager(self, lines):
try:
line_count = 0
if self._output_filename:
print(f"Output is also going to '{self.output_file}'")
self._output_file = open(self._output_filename, "a+")
terminal_columns, terminal_lines = shutil.get_terminal_size(fallb... |
{'id': '0', 'type': 'module', 'children': ['1']}, {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'merge'}, {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'constraints... | def merge(constraints):
operators = defaultdict(set)
for constraint in constraints:
operators[constraint.operator].add(constraint.version)
if gt in operators:
gt_ver = sorted(operators[gt])[-1]
else:
gt_ver = None
if ge in operators:
ge_ver = sorted(operators[ge])[-1]... |
{'id': '0', 'type': 'module', 'children': ['1']}, {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'parse_baxter'}, {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'read... | def parse_baxter(reading):
initial = ''
medial = ''
final = ''
tone = ''
inienv = True
medienv = False
finenv = False
tonenv = False
inichars = "pbmrtdnkgnsyhzl'x"
chars = list(reading)
for char in chars:
if char in 'jw' and not finenv:
inienv,medienv,fine... |
{'id': '0', 'type': 'module', 'children': ['1']}, {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '10']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'create'}, {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6', '7']}; {'id': '4', 'type': 'identifier', 'children': [], 'val... | async def create(self, query, *, dc=None):
if "Token" in query:
query["Token"] = extract_attr(query["Token"], keys=["ID"])
response = await self._api.post("/v1/query",
params={"dc": dc}, data=query)
return response.body |
{'id': '0', 'type': 'module', 'children': ['1']}, {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '19']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'execute'}, {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6', '7', '10', '13', '16']}; {'id': '4', 'type': 'identifier', '... | async def execute(self, query, *,
dc=None, near=None, limit=None, consistency=None):
query_id = extract_attr(query, keys=["ID"])
response = await self._api.get(
"/v1/query/%s/execute" % query_id,
params={"dc": dc, "near": near, "limit": limit},
c... |
{'id': '0', 'type': 'module', 'children': ['1']}, {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '6']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'zip_process'}, {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'dictionary_splat_pattern', 'children': ['5']... | def zip_process(**kwargs):
str_localPath = ""
str_zipFileName = ""
str_action = "zip"
str_arcroot = ""
for k,v in kwargs.items():
if k == 'path': str_localPath = v
if k == 'action': str_action = v
if k == 'payloadFile': str_zipFile... |
{'id': '0', 'type': 'module', 'children': ['1']}, {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '6']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'base64_process'}, {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'dictionary_splat_pattern', 'children': ['... | def base64_process(**kwargs):
str_fileToSave = ""
str_fileToRead = ""
str_action = "encode"
data = None
for k,v in kwargs.items():
if k == 'action': str_action = v
if k == 'payloadBytes': data = v
if k ==... |
{'id': '0', 'type': 'module', 'children': ['1']}, {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '8']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'path_localLocationCheck'}, {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6']}; {'id': '4', 'type': 'identifier', 'children... | def path_localLocationCheck(self, d_msg, **kwargs):
b_pull = False
d_meta = d_msg['meta']
if 'do' in d_meta:
if d_meta['do'] == 'pull':
b_pull = True
if 'local' in d_meta:
d_local ... |
{'id': '0', 'type': 'module', 'children': ['1']}, {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'rebuild'}, {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}, {... | def rebuild(self):
table = self.tableType()
form = nativestring(self.filterFormat())
if not table and form:
if self.layout().count() == 0:
self.layout().addWidget(QLabel(form, self))
else:
self.layout().itemAt(0).widget().setText(fo... |
{'id': '0', 'type': 'module', 'children': ['1']}, {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '15']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'filters'}, {'id': '3', 'type': 'parameters', 'children': ['4', '7', '10', '13']}; {'id': '4', 'type': 'default_parameter', 'children'... | def filters(filter_directory=None, update=False, fmt='table', **kwargs):
if filter_directory is None:
filter_directory = resource_filename('svo_filters', 'data/filters/')
p_path = os.path.join(filter_directory, 'filter_list.p')
updated = False
if not os.path.isfile(p_path):
os.system('to... |
{'id': '0', 'type': 'module', 'children': ['1']}, {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '9']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'parse_unit'}, {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6']}; {'id': '4', 'type': 'identifier', 'children': [], 'value... | def parse_unit(prop, dictionary, dt=None):
'''Do a fuzzy match for `prop` in the dictionary, taking into account unit suffix.'''
try:
dt = timezone.parse_datetime(dictionary.get('date_time'))
except TypeError:
dt = None
matches = [k for k in dictionary.keys() if prop in k]
try:
... |
{'id': '0', 'type': 'module', 'children': ['1']}, {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'rebuild'}, {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}, {... | def rebuild( self ):
self.setUpdatesEnabled(False)
self.blockSignals(True)
for child in self.findChildren(QObject):
child.setParent(None)
child.deleteLater()
schema = self.schema()
if ( schema ):
self.setEnabled(True)
uifil... |
{'id': '0', 'type': 'module', 'children': ['1']}, {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'save'}, {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}, {'id... | def save( self ):
schema = self.schema()
if ( not schema ):
self.saved.emit()
return
record = self.record()
if not record:
record = self._model()
save_data = []
column_edits = self.findChildren(XOrbColumnEdit)
for w... |
{'id': '0', 'type': 'module', 'children': ['1']}, {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '6']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'register'}, {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'sel... | async def register(self, service):
response = await self._api.put("/v1/agent/service/register",
data=service)
return response.status == 200 |
{'id': '0', 'type': 'module', 'children': ['1']}, {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'save'}, {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}, {'id... | def save(self):
record = self.record()
if not record:
logger.warning('No record has been defined for %s.' % self)
return False
if not self.signalsBlocked():
self.aboutToSaveRecord.emit(record)
self.aboutToSave.emit()
values = self.s... |
{'id': '0', 'type': 'module', 'children': ['1']}, {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'prepare'}, {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}, {... | def prepare(self):
pixmap = self.property('pixmap')
if pixmap is not None:
return super(XWalkthroughSnapshot, self).prepare()
widget = self.property('widget')
if type(widget) in (unicode, str):
widget = self.findReference(widget)
if not widget:
... |
{'id': '0', 'type': 'module', 'children': ['1']}, {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '16']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'depends'}, {'id': '3', 'type': 'parameters', 'children': ['4', '7', '10', '13']}; {'id': '4', 'type': 'default_parameter', 'children'... | def depends(func=None, after=None, before=None, priority=None):
if not (func is None or inspect.ismethod(func) or inspect.isfunction(func)):
raise ValueError("depends decorator can only be used on functions or methods")
if not (after or before or priority):
raise ValueError("depends decorator ne... |
{'id': '0', 'type': 'module', 'children': ['1']}, {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '6']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': '_translate_language_name'}, {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children': [... | def _translate_language_name(self, language_name):
languages = self.languages()
language_id = None
for ideone_index, ideone_language in languages.items():
if ideone_language.lower() == language_name.lower():
return ideone_index
simple_languages = dict((k,v.spl... |
{'id': '0', 'type': 'module', 'children': ['1']}, {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'headerSortAscending'}, {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'identifier', 'children': [], 'value'... | def headerSortAscending( self ):
self.setSortingEnabled(True)
self.sortByColumn(self._headerIndex, QtCore.Qt.AscendingOrder) |
{'id': '0', 'type': 'module', 'children': ['1']}, {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'headerSortDescending'}, {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'identifier', 'children': [], 'value... | def headerSortDescending( self ):
self.setSortingEnabled(True)
self.sortByColumn(self._headerIndex, QtCore.Qt.DescendingOrder) |
{'id': '0', 'type': 'module', 'children': ['1']}, {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '8']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'from_api'}, {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6']}; {'id': '4', 'type': 'identifier', 'children': [], 'value':... | def from_api(cls, api, **kwargs):
if not cls._api_attrs:
raise NotImplementedError()
def resolve_attribute_type(attr_type):
while isinstance(attr_type, list):
attr_type = attr_type[0]
if attr_type == 'self':
attr_type = cls
... |
{'id': '0', 'type': 'module', 'children': ['1']}, {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'updateEditor'}, {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self... | def updateEditor( self ):
rule = self.currentRule()
operator = self.currentOperator()
widget = self.uiWidgetAREA.widget()
editorType = None
text = ''
if ( rule ):
editorType = rule.editorType(operator)
if ( widget and editorType ... |
{'id': '0', 'type': 'module', 'children': ['1']}, {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '7']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'StreamMetrics'}, {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6']}; {'id': '4', 'type': 'identifier', 'children': [], 'va... | def StreamMetrics(self, request_iterator, context):
LOG.debug("StreamMetrics called")
collect_args = (next(request_iterator))
max_metrics_buffer = 0
max_collect_duration = 0
cfg = Metric(pb=collect_args.Metrics_Arg.metrics[0])
try:
max_metrics_buffer = int(cfg... |
{'id': '0', 'type': 'module', 'children': ['1']}, {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'prepare_node'}, {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'data... | def prepare_node(data):
if not data:
return None, {}
if isinstance(data, str):
return data, {}
if all(field in data for field in ("Node", "Service", "Checks")):
return data["Node"]["Node"], data["Node"]
result = {}
if "ID" in data:
result["Node"] = data["ID"]
for ... |
{'id': '0', 'type': 'module', 'children': ['1']}, {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'prepare_service'}, {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'd... | def prepare_service(data):
if not data:
return None, {}
if isinstance(data, str):
return data, {}
if all(field in data for field in ("Node", "Service", "Checks")):
return data["Service"]["ID"], data["Service"]
if all(field in data for field in ("ServiceName", "ServiceID")):
... |
{'id': '0', 'type': 'module', 'children': ['1']}, {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'add_measurement'}, {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'm... | def add_measurement(measurement):
global _buffer_size
if not _enabled:
LOGGER.debug('Discarding measurement for %s while not enabled',
measurement.database)
return
if _stopping:
LOGGER.warning('Discarding measurement for %s while stopping',
... |
{'id': '0', 'type': 'module', 'children': ['1']}, {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '11']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'refresh'}, {'id': '3', 'type': 'parameters', 'children': ['4', '5', '8']}; {'id': '4', 'type': 'identifier', 'children': [], 'value':... | def refresh(self, reloadData=False, force=False):
if not (self.isVisible() or force):
self._refreshTimer.start()
return
if self.isLoading():
return
if reloadData:
self.refreshQueryRecords()
self._refreshTimer.stop()
self.wo... |
{'id': '0', 'type': 'module', 'children': ['1']}, {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '29']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'tornado_run'}, {'id': '3', 'type': 'parameters', 'children': ['4', '5', '8', '11', '14', '17', '20', '23', '26']}; {'id': '4', 'type'... | def tornado_run(app, port=5000, address="", use_gevent=False, start=True,
monkey_patch=None, Container=None,
Server=None, threadpool=None):
if Container is None:
from tornado.wsgi import WSGIContainer
Container = WSGIContainer
if Server is None:
from torna... |
{'id': '0', 'type': 'module', 'children': ['1']}, {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '23']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'tornado_combiner'}, {'id': '3', 'type': 'parameters', 'children': ['4', '5', '8', '11', '14', '17', '20']}; {'id': '4', 'type': 'iden... | def tornado_combiner(configs, use_gevent=False, start=True, monkey_patch=None,
Container=None, Server=None, threadpool=None):
servers = []
if monkey_patch is None:
monkey_patch = use_gevent
if use_gevent:
if monkey_patch:
from gevent import monkey
... |
{'id': '0', 'type': 'module', 'children': ['1']}, {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'rebuild'}, {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}, {... | def rebuild( self ):
navitem = self.currentItem()
if ( navitem ):
navitem.initialize()
self.setUpdatesEnabled(False)
self.scrollWidget().show()
self._originalText = ''
partsw = self.partsWidget()
for button in self._buttonGroup.buttons():
s... |
{'id': '0', 'type': 'module', 'children': ['1']}, {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '8']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'syncView'}, {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'sel... | def syncView(self, recursive=False):
gantt = self.ganttWidget()
tree = self.treeWidget()
if not gantt:
return
vwidget = gantt.viewWidget()
scene = vwidget.scene()
cell_w = gantt.cellWidth()
tree_offset_y = tree.header().height() + 1
t... |
{'id': '0', 'type': 'module', 'children': ['1']}, {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '18']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'nodes'}, {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6', '9', '12', '15']}; {'id': '4', 'type': 'identifier', 'children... | async def nodes(self, *,
dc=None, near=None, watch=None, consistency=None):
params = {"dc": dc, "near": near}
response = await self._api.get("/v1/catalog/nodes",
params=params,
watch=watch,
... |
{'id': '0', 'type': 'module', 'children': ['1']}, {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '28']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'keyphrases_graph'}, {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6', '9', '12', '15', '18', '21']}; {'id': '4', 'type': ... | def keyphrases_graph(keyphrases, texts, referral_confidence=0.6, relevance_threshold=0.25,
support_threshold=1, similarity_measure=None, synonimizer=None,
language=consts.Language.ENGLISH):
similarity_measure = similarity_measure or relevance.ASTRelevanceMeasure()
table... |
{'id': '0', 'type': 'module', 'children': ['1']}, {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '11']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': '_hm_verify_message_crc_uk'}, {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6', '7', '8', '9', '10']}; {'id': '4', 'type':... | def _hm_verify_message_crc_uk(
self,
thermostat_id,
protocol,
source,
expectedFunction,
expectedLength,
datal
):
badresponse = 0
if protocol == constants.HMV3_ID:
checksum = datal[len(datal) - ... |
{'id': '0', 'type': 'module', 'children': ['1']}, {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '19']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'checks'}, {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6', '7', '10', '13', '16']}; {'id': '4', 'type': 'identifier', 'c... | async def checks(self, service, *,
dc=None, near=None, watch=None, consistency=None):
service_id = extract_attr(service, keys=["ServiceID", "ID"])
params = {"dc": dc, "near": near}
response = await self._api.get("/v1/health/checks", service_id,
... |
{'id': '0', 'type': 'module', 'children': ['1']}, {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '9']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'get'}, {'id': '3', 'type': 'parameters', 'children': ['4', '5', '7']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'cap... | def get(cap, *args, **kwargs):
if 'READTHEDOCS' in os.environ:
return ''
if kwargs != {}:
raise TypeError("get(): No such argument %r" % kwargs.popitem()[0])
if _cache == {}:
try:
curses.setupterm()
except:
pass
s = _cache.get(cap)
if not s:
... |
{'id': '0', 'type': 'module', 'children': ['1']}, {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '6']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'draw'}, {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'canvas'... | def draw(canvas, mol):
mol.require("ScaleAndCenter")
mlb = mol.size2d[2]
if not mol.atom_count():
return
bond_type_fn = {
1: {
0: single_bond,
1: wedged_single,
2: dashed_wedged_single,
3: wave_single,
}, 2: {
0: cw_doub... |
{'id': '0', 'type': 'module', 'children': ['1']}, {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '9']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'salm2map'}, {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6', '7', '8']}; {'id': '4', 'type': 'identifier', 'children': []... | def salm2map(salm, s, lmax, Ntheta, Nphi):
if Ntheta < 2 or Nphi < 1:
raise ValueError("Input values of Ntheta={0} and Nphi={1} ".format(Ntheta, Nphi)
+ "are not allowed; they must be greater than 1 and 0, respectively.")
if lmax < 1:
raise ValueError("Input value of lma... |
{'id': '0', 'type': 'module', 'children': ['1']}, {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '7']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'map2salm'}, {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6']}; {'id': '4', 'type': 'identifier', 'children': [], 'value':... | def map2salm(map, s, lmax):
import numpy as np
map = np.ascontiguousarray(map, dtype=np.complex128)
salm = np.empty(map.shape[:-2]+(N_lm(lmax),), dtype=np.complex128)
if map.ndim>2:
s = np.ascontiguousarray(s, dtype=np.intc)
if s.ndim != map.ndim-2 or np.product(s.shape) != np.product(ma... |
{'id': '0', 'type': 'module', 'children': ['1']}, {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '21']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'get'}, {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6', '9', '12', '15', '18']}; {'id': '4', 'type': 'identifier', 'chil... | def get(self, url, store_on_error=False, xpath=None, rate_limit=None, log_hits=True, log_misses=True):
try:
cached = self._query(url, xpath).one()
if log_hits:
config.logger.info("Request cache hit: " + url)
if cached.status_code != requests.codes.ok:
... |
{'id': '0', 'type': 'module', 'children': ['1']}, {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '12']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'event'}, {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6', '9']}; {'id': '4', 'type': 'identifier', 'children': [], 'valu... | def event(self, event_data, priority="normal", event_method="EVENT"):
logger.debug("event: " + str(event_data))
euuid = uuid.uuid1()
logger.debug("<%s> <euuid:%s> Sending event data to server: "
"%s" % (str(self.cuuid), str(euuid), str(self.server)))
if not self.listener.l... |
{'id': '0', 'type': 'module', 'children': ['1']}, {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'run'}, {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}, {'id'... | def run(self):
import numpy as np
query = self.session.query(models.NUTS2Region.key,
models.NUTS2Region.id)
region_ids = self.client.df_query(query).set_index('key')['id'].to_dict()
data = next(self.requires()).load()
nuts = NUTS2GeoJSONInputFil... |
{'id': '0', 'type': 'module', 'children': ['1']}, {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '20']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'dapply'}, {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6', '9', '12', '15', '18']}; {'id': '4', 'type': 'identifier', 'c... | def dapply(self, fn, pairwise=False, symmetric=True, diagonal=False, block=None, **kwargs):
search_keys = [k for k, v in kwargs.items() if isinstance(v, list) and len(v) > 1]
functions = util.make_list(fn)
search = list(product(functions, util.dict_product(kwargs)))
results = []
for fn, kw in search... |
{'id': '0', 'type': 'module', 'children': ['1']}, {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': '_identifySuperGraph'}, {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'identifier', 'children': [], 'value'... | def _identifySuperGraph(self):
if self.debug:
sys.stdout.write("Condensing Graph: ")
start = time.clock()
G = nx.DiGraph()
G.add_edges_from(self.edges)
if self.short_circuit:
self.superNodes = G.nodes()
self.superArcs = G.edges()
... |
{'id': '0', 'type': 'module', 'children': ['1']}, {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '9']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': '_construct_nx_tree'}, {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6']}; {'id': '4', 'type': 'identifier', 'children': []... | def _construct_nx_tree(self, thisTree, thatTree=None):
if self.debug:
sys.stdout.write("Networkx Tree construction: ")
start = time.clock()
nxTree = nx.DiGraph()
nxTree.add_edges_from(thisTree.edges)
nodesOfThatTree = []
if thatTree is not None:
... |
{'id': '0', 'type': 'module', 'children': ['1']}, {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '7']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': '_process_tree'}, {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6']}; {'id': '4', 'type': 'identifier', 'children': [], 'va... | def _process_tree(self, thisTree, thatTree):
if self.debug:
sys.stdout.write("Processing Tree: ")
start = time.clock()
if len(thisTree.nodes()) > 1:
leaves = set(
[
v
for v in thisTree.nodes()
... |
{'id': '0', 'type': 'module', 'children': ['1']}, {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '10']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'get_project_content_commit_date'}, {'id': '3', 'type': 'parameters', 'children': ['4', '7']}; {'id': '4', 'type': 'default_parameter'... | def get_project_content_commit_date(root_dir='.', exclusions=None):
logger = logging.getLogger(__name__)
extensions = ('rst', 'ipynb', 'png', 'jpeg', 'jpg', 'svg', 'gif')
content_paths = []
for extname in extensions:
content_paths += get_filepaths_with_extension(
extname,
... |
{'id': '0', 'type': 'module', 'children': ['1']}, {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '6']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'get_table'}, {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'se... | def get_table(self, name):
if name is None:
assert self.active_table, "Can't get table without name unless an active table is set"
name = self.active_table.name
if self.active_worksheet:
table = self.active_worksheet.get_table(name)
assert tabl... |
{'id': '0', 'type': 'module', 'children': ['1']}, {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'assign_valence'}, {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'mo... | def assign_valence(mol):
for u, v, bond in mol.bonds_iter():
if bond.order == 2:
mol.atom(u).pi = 1
mol.atom(v).pi = 1
if mol.atom(u).symbol == "O" and not mol.atom(u).charge:
mol.atom(v).carbonyl_C = 1
if mol.atom(v).symbol == "O" and not mol.... |
{'id': '0', 'type': 'module', 'children': ['1']}, {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '8']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'assign_charge'}, {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children': [], 'value':... | def assign_charge(mol, force_recalc=False):
mol.require("Aromatic")
for i, nbrs in mol.neighbors_iter():
atom = mol.atom(i)
nbrcnt = len(nbrs)
if atom.symbol == "N":
if not atom.pi:
mol.atom(i).charge_phys = 1
elif nbrcnt == 1 and atom.pi == 2:
... |
{'id': '0', 'type': 'module', 'children': ['1']}, {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '6']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': '_get_alphabetical_members'}, {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children': ... | def _get_alphabetical_members(obj, predicate):
fields = dict(inspect.getmembers(obj, predicate))
keys = list(fields.keys())
keys.sort()
return {k: fields[k] for k in keys} |
{'id': '0', 'type': 'module', 'children': ['1']}, {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'run'}, {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}, {'id'... | def run(self):
request_cache = cache.get_request_cache()
session = client.get_client().create_session()
self.mark_incomplete()
universes = []
with session.no_autoflush:
movies = session.query(models.Movie).all()
for movie in movies:
article... |
{'id': '0', 'type': 'module', 'children': ['1']}, {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '8']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': '_argsort'}, {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'y_s... | def _argsort(y_score, k=None):
ranks = y_score.argsort()
argsort = ranks[::-1]
if k is not None:
argsort = argsort[0:k]
return argsort |
{'id': '0', 'type': 'module', 'children': ['1']}, {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'formula'}, {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'mol'}, {'... | def formula(mol):
mol.require("Valence")
mol.require("Topology")
total_cntr = Counter()
for m in sorted(mols_iter(mol), key=len, reverse=True):
cntr = Counter()
for i in m:
cntr += mol.atom(i).composition()
text = []
Cs = cntr.pop("C", 0)
if Cs:
... |
{'id': '0', 'type': 'module', 'children': ['1']}, {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '6']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': '_start_action_for_section'}, {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children': ... | def _start_action_for_section(self, section):
if section == "configuration":
return
Global.LOGGER.debug("starting actions for section " + section)
action_configuration = Global.CONFIG_MANAGER.sections[
section]
if len(action_configuration) == 0:
Global... |
{'id': '0', 'type': 'module', 'children': ['1']}, {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '14']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'check_completion'}, {'id': '3', 'type': 'parameters', 'children': ['4', '5', '8', '11']}; {'id': '4', 'type': 'identifier', 'children... | def check_completion(task, mark_incomplete=False, clear=False, return_stats=False):
to_clear = dict()
is_complete, stats = _check_completion(task,
mark_incomplete=mark_incomplete,
clear=clear,
... |
{'id': '0', 'type': 'module', 'children': ['1']}, {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '8']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'get_connection_string'}, {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children': [], ... | def get_connection_string(params, hide_password=True):
connection_string = params['driver'] + '://'
user = params.get('user', None)
password = params.get('password', None)
host = params.get('host', None)
port = params.get('port', None)
database = params.get('database', No... |
{'id': '0', 'type': 'module', 'children': ['1']}, {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '4']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'movie_network'}, {'id': '3', 'type': 'parameters', 'children': []}; {'id': '4', 'type': 'block', 'children': ['5', '14', '20', '28', '... | def movie_network():
template = jenv.get_template("movie_network.html")
context = dict()
cl = client.get_client()
session = cl.create_session()
query = session.query(models.Movie.id,
models.Movie.name,
models.Movie.url,
mo... |
{'id': '0', 'type': 'module', 'children': ['1']}, {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '19']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'better_exchook'}, {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6', '7', '10', '13', '16']}; {'id': '4', 'type': 'identif... | def better_exchook(etype, value, tb, debugshell=False, autodebugshell=True, file=None, with_color=None):
if file is None:
file = sys.stderr
def output(ln):
file.write(ln + "\n")
color = Color(enable=with_color)
output(color("EXCEPTION", color.fg_colors[1], bold=True))
all_locals, all... |
{'id': '0', 'type': 'module', 'children': ['1']}, {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '10']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'dump_all_thread_tracebacks'}, {'id': '3', 'type': 'parameters', 'children': ['4', '7']}; {'id': '4', 'type': 'default_parameter', 'ch... | def dump_all_thread_tracebacks(exclude_thread_ids=None, file=None):
if exclude_thread_ids is None:
exclude_thread_ids = []
if not file:
file = sys.stdout
import threading
if hasattr(sys, "_current_frames"):
print("", file=file)
threads = {t.ident: t for t in threading.enu... |
{'id': '0', 'type': 'module', 'children': ['1']}, {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '4']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': '_main'}, {'id': '3', 'type': 'parameters', 'children': []}; {'id': '4', 'type': 'block', 'children': ['5', '160', '210', '235', '272',... | def _main():
if sys.argv[1:] == ["test"]:
for k, v in sorted(globals().items()):
if not k.startswith("test_"):
continue
print("running: %s()" % k)
v()
print("ok.")
sys.exit()
elif sys.argv[1:] == ["debug_shell"]:
debug_shell(loc... |
{'id': '0', 'type': 'module', 'children': ['1']}, {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '7']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'mol_supplier'}, {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6']}; {'id': '4', 'type': 'identifier', 'children': [], 'val... | def mol_supplier(lines, no_halt, assign_descriptors):
def sdf_block(lns):
mol = []
opt = []
is_mol = True
for line in lns:
if line.startswith("$$$$"):
yield mol[:], opt[:]
is_mol = True
mol.clear()
opt.clear(... |
{'id': '0', 'type': 'module', 'children': ['1']}, {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '15']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'render_diagram'}, {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6', '9', '12']}; {'id': '4', 'type': 'identifier', 'child... | def render_diagram(root_task, out_base, max_param_len=20, horizontal=False, colored=False):
import re
import codecs
import subprocess
from ozelot import config
from ozelot.etl.tasks import get_task_name, get_task_param_string
lines = [u"digraph G {"]
if horizontal:
lines.append(u"ran... |
{'id': '0', 'type': 'module', 'children': ['1']}, {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '21']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'binarize'}, {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6', '9', '12', '15', '18']}; {'id': '4', 'type': 'identifier', ... | def binarize(df, category_classes, all_classes=True, drop=True,
astype=None, inplace=True, min_freq=None):
if type(category_classes) is not dict:
columns = set(category_classes)
category_classes = {column: df[column].unique() for column in columns}
else:
columns = category_c... |
{'id': '0', 'type': 'module', 'children': ['1']}, {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '8']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'find_package_docs'}, {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children': [], 'val... | def find_package_docs(package_dir, skippedNames=None):
logger = logging.getLogger(__name__)
if skippedNames is None:
skippedNames = []
doc_dir = os.path.join(package_dir, 'doc')
modules_yaml_path = os.path.join(doc_dir, 'manifest.yaml')
if not os.path.exists(modules_yaml_path):
raise... |
{'id': '0', 'type': 'module', 'children': ['1']}, {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '6']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'get_max_id'}, {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'c... | def get_max_id(cls, session):
id_base = None
for c in [cls] + list(cls.__bases__):
for base_class in c.__bases__:
if base_class.__name__ == 'Base':
if id_base is None:
id_base = c
else:
ra... |
{'id': '0', 'type': 'module', 'children': ['1']}, {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': '_insert_automodapi_configs'}, {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'identifier', 'children': [], ... | def _insert_automodapi_configs(c):
c['numpydoc_show_class_members'] = False
c['autosummary_generate'] = True
c['automodapi_toctreedirnm'] = 'py-api'
c['automodsumm_inherited_members'] = True
c['autodoc_inherit_docstrings'] = True
c['autoclass_content'] = "class"
c['autodoc_default_flags'] = ... |
{'id': '0', 'type': 'module', 'children': ['1']}, {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '9']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'build_pipelines_lsst_io_configs'}, {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6']}; {'id': '4', 'type': 'keyword_separa... | def build_pipelines_lsst_io_configs(*, project_name, copyright=None):
sys.setrecursionlimit(2000)
c = {}
c = _insert_common_sphinx_configs(
c,
project_name=project_name)
c = _insert_html_configs(
c,
project_name=project_name,
short_project_name=project_name)
c... |
{'id': '0', 'type': 'module', 'children': ['1']}, {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '11']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'event'}, {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6', '7', '8', '9', '10']}; {'id': '4', 'type': 'identifier', 'chil... | def event(self, cuuid, host, euuid, event_data, timestamp, priority):
response = None
if host in self.encrypted_hosts:
logger.debug("Encrypted!")
client_key = self.registry[cuuid]["encryption"]
else:
logger.debug("Not encrypted :<")
client_key = No... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.