body_hash stringlengths 64 64 | body stringlengths 23 109k | docstring stringlengths 1 57k | path stringlengths 4 198 | name stringlengths 1 115 | repository_name stringlengths 7 111 | repository_stars float64 0 191k | lang stringclasses 1
value | body_without_docstring stringlengths 14 108k | unified stringlengths 45 133k |
|---|---|---|---|---|---|---|---|---|---|
a5643fe6df11b4e8e844da93b1662c993eb0487eb69c2b57d7e7959861ea5e7a | def lookahead(self, element, table=None, fields=None, tree=None, directory=None, lookup=None):
'\n Find referenced elements in the tree\n\n Args:\n element: the element\n table: the DB table\n fields: the FK fields in the table\n tree... | Find referenced elements in the tree
Args:
element: the element
table: the DB table
fields: the FK fields in the table
tree: the import tree
directory: a dictionary to lookup elements in the tree
(will be filled in by this function) | modules/s3/s3import.py | lookahead | annehaley/eden | 205 | python | def lookahead(self, element, table=None, fields=None, tree=None, directory=None, lookup=None):
'\n Find referenced elements in the tree\n\n Args:\n element: the element\n table: the DB table\n fields: the FK fields in the table\n tree... | def lookahead(self, element, table=None, fields=None, tree=None, directory=None, lookup=None):
'\n Find referenced elements in the tree\n\n Args:\n element: the element\n table: the DB table\n fields: the FK fields in the table\n tree... |
6a3e26105efb27c827aa7a3fcf5591127743d1576ad85ca2a453cb7f4452d72a | def load_item(self, row):
'\n Load an item from the item table (counterpart to add_item\n when restoring a job from the database)\n '
item = S3ImportItem(self)
if (not item.restore(row)):
self.error = item.error
if (item.load_parent is None):
self.err... | Load an item from the item table (counterpart to add_item
when restoring a job from the database) | modules/s3/s3import.py | load_item | annehaley/eden | 205 | python | def load_item(self, row):
'\n Load an item from the item table (counterpart to add_item\n when restoring a job from the database)\n '
item = S3ImportItem(self)
if (not item.restore(row)):
self.error = item.error
if (item.load_parent is None):
self.err... | def load_item(self, row):
'\n Load an item from the item table (counterpart to add_item\n when restoring a job from the database)\n '
item = S3ImportItem(self)
if (not item.restore(row)):
self.error = item.error
if (item.load_parent is None):
self.err... |
1052cb6431831c4ad1d62a236184c64f550d3ce1a22eeef8b8240e23620a62a3 | def resolve(self, item_id, import_list):
'\n Resolve the reference list of an item\n\n Args:\n item_id: the import item UID\n import_list: the ordered list of items (UIDs) to import\n '
item = self.items[item_id]
if (item.lock or (item.accepted is F... | Resolve the reference list of an item
Args:
item_id: the import item UID
import_list: the ordered list of items (UIDs) to import | modules/s3/s3import.py | resolve | annehaley/eden | 205 | python | def resolve(self, item_id, import_list):
'\n Resolve the reference list of an item\n\n Args:\n item_id: the import item UID\n import_list: the ordered list of items (UIDs) to import\n '
item = self.items[item_id]
if (item.lock or (item.accepted is F... | def resolve(self, item_id, import_list):
'\n Resolve the reference list of an item\n\n Args:\n item_id: the import item UID\n import_list: the ordered list of items (UIDs) to import\n '
item = self.items[item_id]
if (item.lock or (item.accepted is F... |
b278f44114dda66695f3253ee12a00fc82acb88ad66020c4fe1701a9b7102395 | def commit(self, ignore_errors=False, log_items=None):
'\n Commit the import job to the DB\n\n Args:\n ignore_errors: skip any items with errors\n (does still report the errors)\n log_items: callback function to log import items\n ... | Commit the import job to the DB
Args:
ignore_errors: skip any items with errors
(does still report the errors)
log_items: callback function to log import items
before committing them | modules/s3/s3import.py | commit | annehaley/eden | 205 | python | def commit(self, ignore_errors=False, log_items=None):
'\n Commit the import job to the DB\n\n Args:\n ignore_errors: skip any items with errors\n (does still report the errors)\n log_items: callback function to log import items\n ... | def commit(self, ignore_errors=False, log_items=None):
'\n Commit the import job to the DB\n\n Args:\n ignore_errors: skip any items with errors\n (does still report the errors)\n log_items: callback function to log import items\n ... |
ff36fc835e2899a009f6107ae7dd1a7a17609add00bed2d22fc1e680d3cf208c | def __define_tables(self):
'\n Define the database tables for jobs and items\n '
self.job_table = self.define_job_table()
self.item_table = self.define_item_table() | Define the database tables for jobs and items | modules/s3/s3import.py | __define_tables | annehaley/eden | 205 | python | def __define_tables(self):
'\n \n '
self.job_table = self.define_job_table()
self.item_table = self.define_item_table() | def __define_tables(self):
'\n \n '
self.job_table = self.define_job_table()
self.item_table = self.define_item_table()<|docstring|>Define the database tables for jobs and items<|endoftext|> |
e4e4a576c37fa842cff275d92e594846b511eb6885194fe799e4fcf53ca79768 | def store(self):
'\n Store this job and all its items in the job table\n '
db = current.db
self.__define_tables()
jobtable = self.job_table
query = (jobtable.job_id == self.job_id)
row = db(query).select(jobtable.id, limitby=(0, 1)).first()
if row:
record_id = row.i... | Store this job and all its items in the job table | modules/s3/s3import.py | store | annehaley/eden | 205 | python | def store(self):
'\n \n '
db = current.db
self.__define_tables()
jobtable = self.job_table
query = (jobtable.job_id == self.job_id)
row = db(query).select(jobtable.id, limitby=(0, 1)).first()
if row:
record_id = row.id
else:
record_id = None
record =... | def store(self):
'\n \n '
db = current.db
self.__define_tables()
jobtable = self.job_table
query = (jobtable.job_id == self.job_id)
row = db(query).select(jobtable.id, limitby=(0, 1)).first()
if row:
record_id = row.id
else:
record_id = None
record =... |
ba088a0fd8cc0fc0d19034b2bbc12ba887371966d5546616a78b6b2620728330 | def get_tree(self):
'\n Reconstruct the element tree of this job\n '
if (self.tree is not None):
return self.tree
xml = current.xml
ATTRIBUTE = xml.ATTRIBUTE
UID = xml.UID
root = etree.Element(xml.TAG.root)
for item in self.items.values():
element = item.ele... | Reconstruct the element tree of this job | modules/s3/s3import.py | get_tree | annehaley/eden | 205 | python | def get_tree(self):
'\n \n '
if (self.tree is not None):
return self.tree
xml = current.xml
ATTRIBUTE = xml.ATTRIBUTE
UID = xml.UID
root = etree.Element(xml.TAG.root)
for item in self.items.values():
element = item.element
if ((element is not None) a... | def get_tree(self):
'\n \n '
if (self.tree is not None):
return self.tree
xml = current.xml
ATTRIBUTE = xml.ATTRIBUTE
UID = xml.UID
root = etree.Element(xml.TAG.root)
for item in self.items.values():
element = item.element
if ((element is not None) a... |
f1f99c4ec0f9e2e69241886db828eb4a87c165161e3c96e05306e06881958639 | def delete(self):
'\n Delete this job and all its items from the job table\n '
db = current.db
self.__define_tables()
db((self.item_table.job_id == self.job_id)).delete()
db((self.job_table.job_id == self.job_id)).delete() | Delete this job and all its items from the job table | modules/s3/s3import.py | delete | annehaley/eden | 205 | python | def delete(self):
'\n \n '
db = current.db
self.__define_tables()
db((self.item_table.job_id == self.job_id)).delete()
db((self.job_table.job_id == self.job_id)).delete() | def delete(self):
'\n \n '
db = current.db
self.__define_tables()
db((self.item_table.job_id == self.job_id)).delete()
db((self.job_table.job_id == self.job_id)).delete()<|docstring|>Delete this job and all its items from the job table<|endoftext|> |
f26705673a06cdfda925dd94d45b2f3b2000c06749049a27b21211f707144d8a | def restore_references(self):
"\n Restore the job's reference structure after loading items\n from the item table\n "
db = current.db
UID = current.xml.UID
for item in self.items.values():
for citem_id in item.load_components:
if (citem_id in self.items):... | Restore the job's reference structure after loading items
from the item table | modules/s3/s3import.py | restore_references | annehaley/eden | 205 | python | def restore_references(self):
"\n Restore the job's reference structure after loading items\n from the item table\n "
db = current.db
UID = current.xml.UID
for item in self.items.values():
for citem_id in item.load_components:
if (citem_id in self.items):... | def restore_references(self):
"\n Restore the job's reference structure after loading items\n from the item table\n "
db = current.db
UID = current.xml.UID
for item in self.items.values():
for citem_id in item.load_components:
if (citem_id in self.items):... |
562633de282e6132b3e37c0565dfca05092878d992eb8e09838fdae8b3174ca0 | def __init__(self, obj):
'\n Constructor\n\n @param obj: the object to inspect (parsed)\n '
self.obj = obj
self._refs = None
self._objs = None | Constructor
@param obj: the object to inspect (parsed) | modules/s3/s3import.py | __init__ | annehaley/eden | 205 | python | def __init__(self, obj):
'\n Constructor\n\n @param obj: the object to inspect (parsed)\n '
self.obj = obj
self._refs = None
self._objs = None | def __init__(self, obj):
'\n Constructor\n\n @param obj: the object to inspect (parsed)\n '
self.obj = obj
self._refs = None
self._objs = None<|docstring|>Constructor
@param obj: the object to inspect (parsed)<|endoftext|> |
52d61efbc11904cb09b6fa1472796e7f43ad971594f612f41a4366adf94483cb | @property
def refs(self):
'\n List of references discovered in the object (lazy property)\n\n @returns: a list of tuples (tablename, uidtype, uid)\n '
if (self._refs is None):
self._refs = []
self._objs = {}
self._traverse(self.obj)
return self._refs | List of references discovered in the object (lazy property)
@returns: a list of tuples (tablename, uidtype, uid) | modules/s3/s3import.py | refs | annehaley/eden | 205 | python | @property
def refs(self):
'\n List of references discovered in the object (lazy property)\n\n @returns: a list of tuples (tablename, uidtype, uid)\n '
if (self._refs is None):
self._refs = []
self._objs = {}
self._traverse(self.obj)
return self._refs | @property
def refs(self):
'\n List of references discovered in the object (lazy property)\n\n @returns: a list of tuples (tablename, uidtype, uid)\n '
if (self._refs is None):
self._refs = []
self._objs = {}
self._traverse(self.obj)
return self._refs<|doc... |
18ae37263bf2eddd7163666b9f044b87aa4b86b4eaedb0e55300bf822f9ce84c | @property
def objs(self):
'\n A dict with pointers to the references inside the object\n\n @returns: a dict {(tablename, uidtype, uid): (obj, key)}\n '
if (self._objs is None):
self._refs = []
self._objs = {}
self._traverse(self.obj)
return self._objs | A dict with pointers to the references inside the object
@returns: a dict {(tablename, uidtype, uid): (obj, key)} | modules/s3/s3import.py | objs | annehaley/eden | 205 | python | @property
def objs(self):
'\n A dict with pointers to the references inside the object\n\n @returns: a dict {(tablename, uidtype, uid): (obj, key)}\n '
if (self._objs is None):
self._refs = []
self._objs = {}
self._traverse(self.obj)
return self._objs | @property
def objs(self):
'\n A dict with pointers to the references inside the object\n\n @returns: a dict {(tablename, uidtype, uid): (obj, key)}\n '
if (self._objs is None):
self._refs = []
self._objs = {}
self._traverse(self.obj)
return self._objs<|do... |
ab5d20ce68e57396a3bd43d1b4b28b95b06a720d5d1ad4aee5de3847aa6512e1 | def _traverse(self, obj):
'\n Traverse a (possibly nested) object and find all references,\n populates self.refs and self.objs\n\n @param obj: the object to inspect\n '
refs = self._refs
objs = self._objs
if (type(obj) is list):
for item in obj:
... | Traverse a (possibly nested) object and find all references,
populates self.refs and self.objs
@param obj: the object to inspect | modules/s3/s3import.py | _traverse | annehaley/eden | 205 | python | def _traverse(self, obj):
'\n Traverse a (possibly nested) object and find all references,\n populates self.refs and self.objs\n\n @param obj: the object to inspect\n '
refs = self._refs
objs = self._objs
if (type(obj) is list):
for item in obj:
... | def _traverse(self, obj):
'\n Traverse a (possibly nested) object and find all references,\n populates self.refs and self.objs\n\n @param obj: the object to inspect\n '
refs = self._refs
objs = self._objs
if (type(obj) is list):
for item in obj:
... |
c5c7bf4bd199ea764a593a9db96b0c5bf419a777663b4c45a154959a63721965 | def resolve(self, tablename, uidtype, uid, value):
'\n Resolve a reference in self.obj with the given value; will\n resolve all occurences of the reference\n\n @param tablename: the referenced table\n @param uidtype: the type of uid (uuid or tuid)\n @param uid:... | Resolve a reference in self.obj with the given value; will
resolve all occurences of the reference
@param tablename: the referenced table
@param uidtype: the type of uid (uuid or tuid)
@param uid: the uuid or tuid
@param value: the value to resolve the reference | modules/s3/s3import.py | resolve | annehaley/eden | 205 | python | def resolve(self, tablename, uidtype, uid, value):
'\n Resolve a reference in self.obj with the given value; will\n resolve all occurences of the reference\n\n @param tablename: the referenced table\n @param uidtype: the type of uid (uuid or tuid)\n @param uid:... | def resolve(self, tablename, uidtype, uid, value):
'\n Resolve a reference in self.obj with the given value; will\n resolve all occurences of the reference\n\n @param tablename: the referenced table\n @param uidtype: the type of uid (uuid or tuid)\n @param uid:... |
209588e27c0aca2bb8dfc4c1ecd7bcf79100537aaab536175404f767a8aeb334 | def __init__(self, primary=None, secondary=None, ignore_case=True, ignore_deleted=False, noupdate=False):
'\n Args:\n primary: list or tuple of primary fields to find a\n match, must always match (mandatory, defaults\n to "name" field)\n ... | Args:
primary: list or tuple of primary fields to find a
match, must always match (mandatory, defaults
to "name" field)
secondary: list or tuple of secondary fields to
find a match, must match if values are
present in the import item
ignore_case: ignor... | modules/s3/s3import.py | __init__ | annehaley/eden | 205 | python | def __init__(self, primary=None, secondary=None, ignore_case=True, ignore_deleted=False, noupdate=False):
'\n Args:\n primary: list or tuple of primary fields to find a\n match, must always match (mandatory, defaults\n to "name" field)\n ... | def __init__(self, primary=None, secondary=None, ignore_case=True, ignore_deleted=False, noupdate=False):
'\n Args:\n primary: list or tuple of primary fields to find a\n match, must always match (mandatory, defaults\n to "name" field)\n ... |
8108ea2d4d184189ae60045b0b90974433cabf8a834b98b72f833608bb986c6f | def __call__(self, item):
"\n Entry point for importer\n\n Args:\n item: the import item\n\n Returns:\n The duplicate Row if match found, otherwise None\n\n Raises:\n SyntaxError: if any of the query fields doesn't exist\n ... | Entry point for importer
Args:
item: the import item
Returns:
The duplicate Row if match found, otherwise None
Raises:
SyntaxError: if any of the query fields doesn't exist
in the item table | modules/s3/s3import.py | __call__ | annehaley/eden | 205 | python | def __call__(self, item):
"\n Entry point for importer\n\n Args:\n item: the import item\n\n Returns:\n The duplicate Row if match found, otherwise None\n\n Raises:\n SyntaxError: if any of the query fields doesn't exist\n ... | def __call__(self, item):
"\n Entry point for importer\n\n Args:\n item: the import item\n\n Returns:\n The duplicate Row if match found, otherwise None\n\n Raises:\n SyntaxError: if any of the query fields doesn't exist\n ... |
fe75602da6b453b51fda65a4c4d421d77f89a51b05edc039e359bf8984089adc | def match(self, field, value):
'\n Helper function to generate a match-query\n\n Args:\n field: the Field\n value: the value\n\n Returns:\n a Query\n '
ftype = str(field.type)
ignore_case = self.ignore_case
if (ignore_c... | Helper function to generate a match-query
Args:
field: the Field
value: the value
Returns:
a Query | modules/s3/s3import.py | match | annehaley/eden | 205 | python | def match(self, field, value):
'\n Helper function to generate a match-query\n\n Args:\n field: the Field\n value: the value\n\n Returns:\n a Query\n '
ftype = str(field.type)
ignore_case = self.ignore_case
if (ignore_c... | def match(self, field, value):
'\n Helper function to generate a match-query\n\n Args:\n field: the Field\n value: the value\n\n Returns:\n a Query\n '
ftype = str(field.type)
ignore_case = self.ignore_case
if (ignore_c... |
71d785f1ef3791bded256fbadd7b526478a64e01e2588388f4f1ceba303fa704 | def load_descriptor(self, path):
'\n Load the descriptor file and then all the import tasks in that file\n into the task property.\n The descriptor file is the file called tasks.cfg in path.\n The file consists of a comma separated list of:\n module, resource n... | Load the descriptor file and then all the import tasks in that file
into the task property.
The descriptor file is the file called tasks.cfg in path.
The file consists of a comma separated list of:
module, resource name, csv filename, xsl filename. | modules/s3/s3import.py | load_descriptor | annehaley/eden | 205 | python | def load_descriptor(self, path):
'\n Load the descriptor file and then all the import tasks in that file\n into the task property.\n The descriptor file is the file called tasks.cfg in path.\n The file consists of a comma separated list of:\n module, resource n... | def load_descriptor(self, path):
'\n Load the descriptor file and then all the import tasks in that file\n into the task property.\n The descriptor file is the file called tasks.cfg in path.\n The file consists of a comma separated list of:\n module, resource n... |
5db1f4d42699fb3f8837b341eb4ce68cf1493b1af218988219812b793c9c246e | def extract_csv_import_line(self, path, details):
'\n Extract the details for a CSV Import Task\n '
argCnt = len(details)
if ((argCnt == 4) or (argCnt == 5)):
mod = details[0].strip('" ')
res = details[1].strip('" ')
folder = current.request.folder
csvFileNa... | Extract the details for a CSV Import Task | modules/s3/s3import.py | extract_csv_import_line | annehaley/eden | 205 | python | def extract_csv_import_line(self, path, details):
'\n \n '
argCnt = len(details)
if ((argCnt == 4) or (argCnt == 5)):
mod = details[0].strip('" ')
res = details[1].strip('" ')
folder = current.request.folder
csvFileName = details[2].strip('" ')
if (c... | def extract_csv_import_line(self, path, details):
'\n \n '
argCnt = len(details)
if ((argCnt == 4) or (argCnt == 5)):
mod = details[0].strip('" ')
res = details[1].strip('" ')
folder = current.request.folder
csvFileName = details[2].strip('" ')
if (c... |
b5e6c319df51a1efa6b566542ef145eb45287f1379b57e40c1ca9ca02e963d30 | def extract_other_import_line(self, path, details):
'\n Store a single import job into the tasks property\n *,function,filename,*extraArgs\n '
function = details[1].strip('" ')
filepath = None
if (len(details) >= 3):
filename = details[2].strip('" ')
if (file... | Store a single import job into the tasks property
*,function,filename,*extraArgs | modules/s3/s3import.py | extract_other_import_line | annehaley/eden | 205 | python | def extract_other_import_line(self, path, details):
'\n Store a single import job into the tasks property\n *,function,filename,*extraArgs\n '
function = details[1].strip('" ')
filepath = None
if (len(details) >= 3):
filename = details[2].strip('" ')
if (file... | def extract_other_import_line(self, path, details):
'\n Store a single import job into the tasks property\n *,function,filename,*extraArgs\n '
function = details[1].strip('" ')
filepath = None
if (len(details) >= 3):
filename = details[2].strip('" ')
if (file... |
f311e09996473d0b38cf54d5494f2ed468931d370d43a0c265985552fa8a1cc1 | def execute_import_task(self, task):
'\n Execute each import job, in order\n '
current.auth.ignore_min_password_length()
start = datetime.datetime.now()
if (task[0] == 1):
s3db = current.s3db
response = current.response
error_string = 'prepopulate error: file %s... | Execute each import job, in order | modules/s3/s3import.py | execute_import_task | annehaley/eden | 205 | python | def execute_import_task(self, task):
'\n \n '
current.auth.ignore_min_password_length()
start = datetime.datetime.now()
if (task[0] == 1):
s3db = current.s3db
response = current.response
error_string = 'prepopulate error: file %s missing'
view = response... | def execute_import_task(self, task):
'\n \n '
current.auth.ignore_min_password_length()
start = datetime.datetime.now()
if (task[0] == 1):
s3db = current.s3db
response = current.response
error_string = 'prepopulate error: file %s missing'
view = response... |
74927155da24de2cba86c51875cabe63f4412bb3a5309b701f284c31ea5c2146 | def execute_special_task(self, task):
'\n Execute import tasks which require a custom function,\n such as import_role\n '
start = datetime.datetime.now()
s3 = current.response.s3
if (task[0] == 2):
fun = task[1]
filepath = task[2]
extraArgs = task[3]
... | Execute import tasks which require a custom function,
such as import_role | modules/s3/s3import.py | execute_special_task | annehaley/eden | 205 | python | def execute_special_task(self, task):
'\n Execute import tasks which require a custom function,\n such as import_role\n '
start = datetime.datetime.now()
s3 = current.response.s3
if (task[0] == 2):
fun = task[1]
filepath = task[2]
extraArgs = task[3]
... | def execute_special_task(self, task):
'\n Execute import tasks which require a custom function,\n such as import_role\n '
start = datetime.datetime.now()
s3 = current.response.s3
if (task[0] == 2):
fun = task[1]
filepath = task[2]
extraArgs = task[3]
... |
0708c86588ab264801a5891b67dc3673c40a3fdf4eeb08e6bddea62b45418513 | @staticmethod
def _lookup_pe(entity):
'\n Convert an Entity to a pe_id\n - helper for import_role\n - assumes org_organisation.name unless specified\n - entity needs to exist already\n '
if ('=' in entity):
(pe_type, value) = entity.split('=')
else:... | Convert an Entity to a pe_id
- helper for import_role
- assumes org_organisation.name unless specified
- entity needs to exist already | modules/s3/s3import.py | _lookup_pe | annehaley/eden | 205 | python | @staticmethod
def _lookup_pe(entity):
'\n Convert an Entity to a pe_id\n - helper for import_role\n - assumes org_organisation.name unless specified\n - entity needs to exist already\n '
if ('=' in entity):
(pe_type, value) = entity.split('=')
else:... | @staticmethod
def _lookup_pe(entity):
'\n Convert an Entity to a pe_id\n - helper for import_role\n - assumes org_organisation.name unless specified\n - entity needs to exist already\n '
if ('=' in entity):
(pe_type, value) = entity.split('=')
else:... |
b690f7c98983520c0f53d5cb9440211f7536b9ce3355a52c93072e8f4e49167c | def import_role(self, filename):
'\n Import Roles from CSV\n '
try:
open_file = open(filename, 'r', encoding='utf-8')
except IOError:
return ('Unable to open file %s' % filename)
auth = current.auth
acl = auth.permission
create_role = auth.s3_create_role
de... | Import Roles from CSV | modules/s3/s3import.py | import_role | annehaley/eden | 205 | python | def import_role(self, filename):
'\n \n '
try:
open_file = open(filename, 'r', encoding='utf-8')
except IOError:
return ('Unable to open file %s' % filename)
auth = current.auth
acl = auth.permission
create_role = auth.s3_create_role
def parseACL(_acl):
... | def import_role(self, filename):
'\n \n '
try:
open_file = open(filename, 'r', encoding='utf-8')
except IOError:
return ('Unable to open file %s' % filename)
auth = current.auth
acl = auth.permission
create_role = auth.s3_create_role
def parseACL(_acl):
... |
7b4ecbb1287b53b44321860f77580ce9d4f75133bec471b6a0391478da1fa17c | def import_user(self, filename):
'\n Import Users from CSV with an import Prep\n '
current.response.s3.import_prep = current.auth.s3_import_prep
current.s3db.add_components('auth_user', auth_masterkey='user_id')
user_task = [1, 'auth', 'user', filename, os.path.join(current.request.fol... | Import Users from CSV with an import Prep | modules/s3/s3import.py | import_user | annehaley/eden | 205 | python | def import_user(self, filename):
'\n \n '
current.response.s3.import_prep = current.auth.s3_import_prep
current.s3db.add_components('auth_user', auth_masterkey='user_id')
user_task = [1, 'auth', 'user', filename, os.path.join(current.request.folder, 'static', 'formats', 's3csv', 'auth'... | def import_user(self, filename):
'\n \n '
current.response.s3.import_prep = current.auth.s3_import_prep
current.s3db.add_components('auth_user', auth_masterkey='user_id')
user_task = [1, 'auth', 'user', filename, os.path.join(current.request.folder, 'static', 'formats', 's3csv', 'auth'... |
c805b445d55eeee1b5cdfd3f4311325f44a1e723b800d717826169959098238c | def import_feed(self, filename):
'\n Import RSS Feeds from CSV with an import Prep\n '
stylesheet = os.path.join(current.request.folder, 'static', 'formats', 's3csv', 'msg', 'rss_channel.xsl')
from s3db.pr import pr_import_prep
current.response.s3.import_prep = pr_import_prep
user_... | Import RSS Feeds from CSV with an import Prep | modules/s3/s3import.py | import_feed | annehaley/eden | 205 | python | def import_feed(self, filename):
'\n \n '
stylesheet = os.path.join(current.request.folder, 'static', 'formats', 's3csv', 'msg', 'rss_channel.xsl')
from s3db.pr import pr_import_prep
current.response.s3.import_prep = pr_import_prep
user_task = [1, 'pr', 'contact', filename, stylesh... | def import_feed(self, filename):
'\n \n '
stylesheet = os.path.join(current.request.folder, 'static', 'formats', 's3csv', 'msg', 'rss_channel.xsl')
from s3db.pr import pr_import_prep
current.response.s3.import_prep = pr_import_prep
user_task = [1, 'pr', 'contact', filename, stylesh... |
556b6ee3965758a5a86f70eee6affdb8b8308885434f0be98b002933de0333c5 | def import_image(self, filename, tablename, idfield, imagefield):
'\n Import images, such as a logo\n\n Args:\n filename: a CSV list of records and filenames\n tablename: the name of the table\n idfield: the field used to identify the record\n ... | Import images, such as a logo
Args:
filename: a CSV list of records and filenames
tablename: the name of the table
idfield: the field used to identify the record
imagefield: the field to where the image will be added
Example:
bi.import_image ("org_logos.csv", "org_organisation", "name", "logo")
... | modules/s3/s3import.py | import_image | annehaley/eden | 205 | python | def import_image(self, filename, tablename, idfield, imagefield):
'\n Import images, such as a logo\n\n Args:\n filename: a CSV list of records and filenames\n tablename: the name of the table\n idfield: the field used to identify the record\n ... | def import_image(self, filename, tablename, idfield, imagefield):
'\n Import images, such as a logo\n\n Args:\n filename: a CSV list of records and filenames\n tablename: the name of the table\n idfield: the field used to identify the record\n ... |
a4d4e0dd3db9943e0b211e17bc6a194834f96426ca92052d3da35233ccd1d24b | def import_pr_image(self, filename):
'\n Import person images from CSV\n\n Example:\n bi.import_pr_image("pr_image.csv")\n and the file pr_image.csv may look as follows\n First Name,Middle Name,Last Name,Image,Profile,Type\n John,,Doe... | Import person images from CSV
Example:
bi.import_pr_image("pr_image.csv")
and the file pr_image.csv may look as follows
First Name,Middle Name,Last Name,Image,Profile,Type
John,,Doe,jdoe.jpg,Y,
Type should be an integer If empty then uses default (usually 1 (Photograph)) | modules/s3/s3import.py | import_pr_image | annehaley/eden | 205 | python | def import_pr_image(self, filename):
'\n Import person images from CSV\n\n Example:\n bi.import_pr_image("pr_image.csv")\n and the file pr_image.csv may look as follows\n First Name,Middle Name,Last Name,Image,Profile,Type\n John,,Doe... | def import_pr_image(self, filename):
'\n Import person images from CSV\n\n Example:\n bi.import_pr_image("pr_image.csv")\n and the file pr_image.csv may look as follows\n First Name,Middle Name,Last Name,Image,Profile,Type\n John,,Doe... |
ef1d35be5c410ddfed4fc576ee187f6ad6a89aac51a4700f9e43390e1eb13b67 | @staticmethod
def import_font(url):
'\n Install a Font\n '
if (url == 'unifont'):
url = 'http://unifoundry.com/pub/unifont/unifont-14.0.01/font-builds/unifont-14.0.01.ttf'
filename = 'unifont.ttf'
extension = 'ttf'
else:
filename = url.split('/')[(- 1)]
... | Install a Font | modules/s3/s3import.py | import_font | annehaley/eden | 205 | python | @staticmethod
def import_font(url):
'\n \n '
if (url == 'unifont'):
url = 'http://unifoundry.com/pub/unifont/unifont-14.0.01/font-builds/unifont-14.0.01.ttf'
filename = 'unifont.ttf'
extension = 'ttf'
else:
filename = url.split('/')[(- 1)]
(filename,... | @staticmethod
def import_font(url):
'\n \n '
if (url == 'unifont'):
url = 'http://unifoundry.com/pub/unifont/unifont-14.0.01/font-builds/unifont-14.0.01.ttf'
filename = 'unifont.ttf'
extension = 'ttf'
else:
filename = url.split('/')[(- 1)]
(filename,... |
27017537cb59cca7c0c1e46e94bf638235b30b0e5f454373f52ebd1b45ce1d39 | def import_remote_csv(self, url, prefix, resource, stylesheet):
' Import CSV files from remote servers '
extension = url.split('.')[(- 1)]
if (extension not in ('csv', 'zip')):
current.log.error(('error importing remote file %s: invalid extension' % url))
return
cwd = os.getcwd()
os_... | Import CSV files from remote servers | modules/s3/s3import.py | import_remote_csv | annehaley/eden | 205 | python | def import_remote_csv(self, url, prefix, resource, stylesheet):
' '
extension = url.split('.')[(- 1)]
if (extension not in ('csv', 'zip')):
current.log.error(('error importing remote file %s: invalid extension' % url))
return
cwd = os.getcwd()
os_path = os.path
os_path_exists = ... | def import_remote_csv(self, url, prefix, resource, stylesheet):
' '
extension = url.split('.')[(- 1)]
if (extension not in ('csv', 'zip')):
current.log.error(('error importing remote file %s: invalid extension' % url))
return
cwd = os.getcwd()
os_path = os.path
os_path_exists = ... |
a453defa407816075310f7de9defd5899adaac86a3c2e4b6404cf0f41a7c1260 | @staticmethod
def import_script(filename):
'\n Run a custom Import Script\n\n TODO:\n Report Errors during Script run to console better\n '
from gluon.cfs import getcfs
from gluon.compileapp import build_environment
from gluon.restricted import restricted
... | Run a custom Import Script
TODO:
Report Errors during Script run to console better | modules/s3/s3import.py | import_script | annehaley/eden | 205 | python | @staticmethod
def import_script(filename):
'\n Run a custom Import Script\n\n TODO:\n Report Errors during Script run to console better\n '
from gluon.cfs import getcfs
from gluon.compileapp import build_environment
from gluon.restricted import restricted
... | @staticmethod
def import_script(filename):
'\n Run a custom Import Script\n\n TODO:\n Report Errors during Script run to console better\n '
from gluon.cfs import getcfs
from gluon.compileapp import build_environment
from gluon.restricted import restricted
... |
aef3bcec138f73a344b1a6101a6f1ac9b0387768c397617358479afb851798d0 | def import_task(self, task_name, args_json=None, vars_json=None):
'\n Import a Scheduled Task\n '
bulk = current.response.s3.bulk
current.response.s3.bulk = True
validator = IS_JSONS3()
if args_json:
(task_args, error) = validator(args_json)
if error:
se... | Import a Scheduled Task | modules/s3/s3import.py | import_task | annehaley/eden | 205 | python | def import_task(self, task_name, args_json=None, vars_json=None):
'\n \n '
bulk = current.response.s3.bulk
current.response.s3.bulk = True
validator = IS_JSONS3()
if args_json:
(task_args, error) = validator(args_json)
if error:
self.errorList.append(err... | def import_task(self, task_name, args_json=None, vars_json=None):
'\n \n '
bulk = current.response.s3.bulk
current.response.s3.bulk = True
validator = IS_JSONS3()
if args_json:
(task_args, error) = validator(args_json)
if error:
self.errorList.append(err... |
b79002a2298b291e470989c4bb46ae47a6991d759a7ef1f9b7f04ca3804dabe4 | def import_xml(self, filepath, prefix, resourcename, dataformat, source_type=None):
'\n Import XML data using an XSLT: static/formats/<dataformat>/import.xsl\n Setting the source_type is possible\n '
prefix = prefix.strip('" ')
resourcename = resourcename.strip('" ')
try:
... | Import XML data using an XSLT: static/formats/<dataformat>/import.xsl
Setting the source_type is possible | modules/s3/s3import.py | import_xml | annehaley/eden | 205 | python | def import_xml(self, filepath, prefix, resourcename, dataformat, source_type=None):
'\n Import XML data using an XSLT: static/formats/<dataformat>/import.xsl\n Setting the source_type is possible\n '
prefix = prefix.strip('" ')
resourcename = resourcename.strip('" ')
try:
... | def import_xml(self, filepath, prefix, resourcename, dataformat, source_type=None):
'\n Import XML data using an XSLT: static/formats/<dataformat>/import.xsl\n Setting the source_type is possible\n '
prefix = prefix.strip('" ')
resourcename = resourcename.strip('" ')
try:
... |
19730f550d959a188d220c97adfecfdc93d88ceb0c82958367a7fd94cdff6daf | def perform_tasks(self, path):
'\n Load and then execute the import jobs that are listed in the\n descriptor file (tasks.cfg)\n '
self.load_descriptor(path)
for task in self.tasks:
if (task[0] == 1):
self.execute_import_task(task)
elif (task[0] == 2):... | Load and then execute the import jobs that are listed in the
descriptor file (tasks.cfg) | modules/s3/s3import.py | perform_tasks | annehaley/eden | 205 | python | def perform_tasks(self, path):
'\n Load and then execute the import jobs that are listed in the\n descriptor file (tasks.cfg)\n '
self.load_descriptor(path)
for task in self.tasks:
if (task[0] == 1):
self.execute_import_task(task)
elif (task[0] == 2):... | def perform_tasks(self, path):
'\n Load and then execute the import jobs that are listed in the\n descriptor file (tasks.cfg)\n '
self.load_descriptor(path)
for task in self.tasks:
if (task[0] == 1):
self.execute_import_task(task)
elif (task[0] == 2):... |
061276582014b8615d2c9714ae63c7495d359e8d74b570697794bee775743912 | def schedule(reference):
' Schedule a referenced item for implicit import '
entry = reference.entry
if (entry and (entry.element is not None) and (not entry.item_id)):
item_id = add_item(element=entry.element)
if item_id:
entry.item_id = item_id | Schedule a referenced item for implicit import | modules/s3/s3import.py | schedule | annehaley/eden | 205 | python | def schedule(reference):
' '
entry = reference.entry
if (entry and (entry.element is not None) and (not entry.item_id)):
item_id = add_item(element=entry.element)
if item_id:
entry.item_id = item_id | def schedule(reference):
' '
entry = reference.entry
if (entry and (entry.element is not None) and (not entry.item_id)):
item_id = add_item(element=entry.element)
if item_id:
entry.item_id = item_id<|docstring|>Schedule a referenced item for implicit import<|endoftext|> |
94fa78dc9383c4688af0b90b35e352aed2c0a93aa2d05c1a6e2b99c90e802220 | def convertDataForPlot(self, data):
'\n Return the proper units on the x-values to be used for plotting.\n Takes the desired values from the GUI selection.\n :param data:\n :return:\n '
x = data[(:, 0)].copy()
xType = [str(i.text()) for i in self.menuSpecX.actions() if i.i... | Return the proper units on the x-values to be used for plotting.
Takes the desired values from the GUI selection.
:param data:
:return: | hsganalysis/UIAnalysis.py | convertDataForPlot | SherwinGroup/HSG-turbo | 1 | python | def convertDataForPlot(self, data):
'\n Return the proper units on the x-values to be used for plotting.\n Takes the desired values from the GUI selection.\n :param data:\n :return:\n '
x = data[(:, 0)].copy()
xType = [str(i.text()) for i in self.menuSpecX.actions() if i.i... | def convertDataForPlot(self, data):
'\n Return the proper units on the x-values to be used for plotting.\n Takes the desired values from the GUI selection.\n :param data:\n :return:\n '
x = data[(:, 0)].copy()
xType = [str(i.text()) for i in self.menuSpecX.actions() if i.i... |
5518b8a6eb5f36d3c3ecce615df10e2045378fb5fcfd5ea44ea7bc4327e69155 | def updateTitle(self, bool=True, path=None):
'\n Update the window title, either called from signals\n from the menu (where bool=False is due to the signals\n being sent with a value)\n Can be called direclty\n :param bool:\n :param path: list of heirarchy to set title valu... | Update the window title, either called from signals
from the menu (where bool=False is due to the signals
being sent with a value)
Can be called direclty
:param bool:
:param path: list of heirarchy to set title value to
:return: | hsganalysis/UIAnalysis.py | updateTitle | SherwinGroup/HSG-turbo | 1 | python | def updateTitle(self, bool=True, path=None):
'\n Update the window title, either called from signals\n from the menu (where bool=False is due to the signals\n being sent with a value)\n Can be called direclty\n :param bool:\n :param path: list of heirarchy to set title valu... | def updateTitle(self, bool=True, path=None):
'\n Update the window title, either called from signals\n from the menu (where bool=False is due to the signals\n being sent with a value)\n Can be called direclty\n :param bool:\n :param path: list of heirarchy to set title valu... |
45403e681cac4222477c0112877ed45f38aede1b96622216af8379b3e281cb29 | def dragEnterEvent(self, event):
'\n\n :param event:\n :type event: QtWidgets.QDragEnterEvent\n :return:\n '
event.accept() | :param event:
:type event: QtWidgets.QDragEnterEvent
:return: | hsganalysis/UIAnalysis.py | dragEnterEvent | SherwinGroup/HSG-turbo | 1 | python | def dragEnterEvent(self, event):
'\n\n :param event:\n :type event: QtWidgets.QDragEnterEvent\n :return:\n '
event.accept() | def dragEnterEvent(self, event):
'\n\n :param event:\n :type event: QtWidgets.QDragEnterEvent\n :return:\n '
event.accept()<|docstring|>:param event:
:type event: QtWidgets.QDragEnterEvent
:return:<|endoftext|> |
a50295c2a93cbff408eb92f922379a2bfa22a776b337f03cda8fbf77123f3637 | def drop(self, event):
'\n :param event:\n :type event: QtWidgets.QDropEvent\n :return:\n '
global fileList
if (not event.mimeData().hasUrls()):
event.reject()
return
event.setDropAction(QtCore.Qt.CopyAction)
if (event.keyboardModifiers() & QtCore.Qt.Shift... | :param event:
:type event: QtWidgets.QDropEvent
:return: | hsganalysis/UIAnalysis.py | drop | SherwinGroup/HSG-turbo | 1 | python | def drop(self, event):
'\n :param event:\n :type event: QtWidgets.QDropEvent\n :return:\n '
global fileList
if (not event.mimeData().hasUrls()):
event.reject()
return
event.setDropAction(QtCore.Qt.CopyAction)
if (event.keyboardModifiers() & QtCore.Qt.Shift... | def drop(self, event):
'\n :param event:\n :type event: QtWidgets.QDropEvent\n :return:\n '
global fileList
if (not event.mimeData().hasUrls()):
event.reject()
return
event.setDropAction(QtCore.Qt.CopyAction)
if (event.keyboardModifiers() & QtCore.Qt.Shift... |
63d5eada3c55916ca70ce60ea3268abed5782ef1dccd711e4f041a1918be3a9c | def handleFitDragEvent(self, obj, val):
'\n called when the plot of fit results is dragged/dropped\n :param obj: The thing dragged\n :param val: the pyqtgraph coordinate of the drop point\n :return:\n '
if (self.dataObj is None):
return
d = self.fitsPlot.getData()... | called when the plot of fit results is dragged/dropped
:param obj: The thing dragged
:param val: the pyqtgraph coordinate of the drop point
:return: | hsganalysis/UIAnalysis.py | handleFitDragEvent | SherwinGroup/HSG-turbo | 1 | python | def handleFitDragEvent(self, obj, val):
'\n called when the plot of fit results is dragged/dropped\n :param obj: The thing dragged\n :param val: the pyqtgraph coordinate of the drop point\n :return:\n '
if (self.dataObj is None):
return
d = self.fitsPlot.getData()... | def handleFitDragEvent(self, obj, val):
'\n called when the plot of fit results is dragged/dropped\n :param obj: The thing dragged\n :param val: the pyqtgraph coordinate of the drop point\n :return:\n '
if (self.dataObj is None):
return
d = self.fitsPlot.getData()... |
2e954c353fcede23e5adf68baaf851c581dd952d14a80384ba0d14ba5ebe3d5c | def handleSpecDragEvent(self, obj, val):
'\n See comments on handleFitDragEvent\n :param obj:\n :param val:\n :return:\n '
if (self.dataObj is None):
return
self.createCompWindow(data=self.convertDataForPlot(self.dataObj.proc_data), p=val) | See comments on handleFitDragEvent
:param obj:
:param val:
:return: | hsganalysis/UIAnalysis.py | handleSpecDragEvent | SherwinGroup/HSG-turbo | 1 | python | def handleSpecDragEvent(self, obj, val):
'\n See comments on handleFitDragEvent\n :param obj:\n :param val:\n :return:\n '
if (self.dataObj is None):
return
self.createCompWindow(data=self.convertDataForPlot(self.dataObj.proc_data), p=val) | def handleSpecDragEvent(self, obj, val):
'\n See comments on handleFitDragEvent\n :param obj:\n :param val:\n :return:\n '
if (self.dataObj is None):
return
self.createCompWindow(data=self.convertDataForPlot(self.dataObj.proc_data), p=val)<|docstring|>See comments ... |
d866316b67db4de080c7bef37a157e8e11d6825a559b24155b09898c090829a5 | def genParametersOldFormat(self, **kwargs):
'\n Generate parameter tree from old version of the head file. Force/coerce header\n information to match what we currently need.\n :param kwargs:\n :return:\n '
newDict = dict(kwargs)
if isinstance(kwargs.get('fieldStrength', {}... | Generate parameter tree from old version of the head file. Force/coerce header
information to match what we currently need.
:param kwargs:
:return: | hsganalysis/UIAnalysis.py | genParametersOldFormat | SherwinGroup/HSG-turbo | 1 | python | def genParametersOldFormat(self, **kwargs):
'\n Generate parameter tree from old version of the head file. Force/coerce header\n information to match what we currently need.\n :param kwargs:\n :return:\n '
newDict = dict(kwargs)
if isinstance(kwargs.get('fieldStrength', {}... | def genParametersOldFormat(self, **kwargs):
'\n Generate parameter tree from old version of the head file. Force/coerce header\n information to match what we currently need.\n :param kwargs:\n :return:\n '
newDict = dict(kwargs)
if isinstance(kwargs.get('fieldStrength', {}... |
12a1134f9d609e95526b04eadba075b8e76f260a482588fe1ff9dbfb7ff39f8f | def handleSpecDragEvent(self, obj, val):
'\n See comments on handleFitDragEvent\n :param obj:\n :param val:\n :return:\n '
if (self.dataObj is None):
return
self.createCompWindow(data=self.dataObj.proc_data, p=val) | See comments on handleFitDragEvent
:param obj:
:param val:
:return: | hsganalysis/UIAnalysis.py | handleSpecDragEvent | SherwinGroup/HSG-turbo | 1 | python | def handleSpecDragEvent(self, obj, val):
'\n See comments on handleFitDragEvent\n :param obj:\n :param val:\n :return:\n '
if (self.dataObj is None):
return
self.createCompWindow(data=self.dataObj.proc_data, p=val) | def handleSpecDragEvent(self, obj, val):
'\n See comments on handleFitDragEvent\n :param obj:\n :param val:\n :return:\n '
if (self.dataObj is None):
return
self.createCompWindow(data=self.dataObj.proc_data, p=val)<|docstring|>See comments on handleFitDragEvent
:pa... |
a8d7d18ee5561cc0eb6ff5d2d3d0b9b518b762dc4faf772cb3e4f046b287f49a | def containsPoint(self, p):
'\n Calculates whether a specified QPoint (in abs coords) is\n within the bounds of myself\n :param p: the q point\n :return: True if it is within my bounds, else false\n '
return self.frameGeometry().contains(p) | Calculates whether a specified QPoint (in abs coords) is
within the bounds of myself
:param p: the q point
:return: True if it is within my bounds, else false | hsganalysis/UIAnalysis.py | containsPoint | SherwinGroup/HSG-turbo | 1 | python | def containsPoint(self, p):
'\n Calculates whether a specified QPoint (in abs coords) is\n within the bounds of myself\n :param p: the q point\n :return: True if it is within my bounds, else false\n '
return self.frameGeometry().contains(p) | def containsPoint(self, p):
'\n Calculates whether a specified QPoint (in abs coords) is\n within the bounds of myself\n :param p: the q point\n :return: True if it is within my bounds, else false\n '
return self.frameGeometry().contains(p)<|docstring|>Calculates whether a spe... |
17771ba3a8a20558a70f83f3d88780b23943669b8507f466e4d4526a0f25d4b4 | def handleMouseClick(self, obj, pos=None):
"\n Handle highlighting curves when they're clicked\n :param obj: a PlotCurveitem if a line is selected, else\n the ViewBox item of the gPlot\n :param pos: If line selected, None\n Else, the position of the click\n... | Handle highlighting curves when they're clicked
:param obj: a PlotCurveitem if a line is selected, else
the ViewBox item of the gPlot
:param pos: If line selected, None
Else, the position of the click
:return: | hsganalysis/UIAnalysis.py | handleMouseClick | SherwinGroup/HSG-turbo | 1 | python | def handleMouseClick(self, obj, pos=None):
"\n Handle highlighting curves when they're clicked\n :param obj: a PlotCurveitem if a line is selected, else\n the ViewBox item of the gPlot\n :param pos: If line selected, None\n Else, the position of the click\n... | def handleMouseClick(self, obj, pos=None):
"\n Handle highlighting curves when they're clicked\n :param obj: a PlotCurveitem if a line is selected, else\n the ViewBox item of the gPlot\n :param pos: If line selected, None\n Else, the position of the click\n... |
081cd4360d084649b49f3a9156380caa784102fb56b06644b086f4b8a1eb98b6 | def handleAnglesDragEvent(self, obj, val):
'\n See comments on handleFitDragEvent\n :param obj:\n :param val:\n :return:\n '
if (self.dataObj is None):
return
self.createCompWindow(data=self.fitDict, p=val) | See comments on handleFitDragEvent
:param obj:
:param val:
:return: | hsganalysis/UIAnalysis.py | handleAnglesDragEvent | SherwinGroup/HSG-turbo | 1 | python | def handleAnglesDragEvent(self, obj, val):
'\n See comments on handleFitDragEvent\n :param obj:\n :param val:\n :return:\n '
if (self.dataObj is None):
return
self.createCompWindow(data=self.fitDict, p=val) | def handleAnglesDragEvent(self, obj, val):
'\n See comments on handleFitDragEvent\n :param obj:\n :param val:\n :return:\n '
if (self.dataObj is None):
return
self.createCompWindow(data=self.fitDict, p=val)<|docstring|>See comments on handleFitDragEvent
:param obj:... |
1ee8f8f081652e4ee6bfc37973ac474a3fe0744bd63c751bf097d18a4fecb57d | def check_dynamic_sql(this, args, callee):
'Check for the use of non-static strings when creating/exeucting SQL\n statements.'
if ((len(args) >= 1) and (not args[0].is_clean_literal)):
this.traverser.warning(err_id=('js', 'instanceactions', 'executeSimpleSQL_dynamic'), warning='SQL statements should ... | Check for the use of non-static strings when creating/exeucting SQL
statements. | validator/testcases/javascript/performance.py | check_dynamic_sql | kmaglione/amo-validator | 1 | python | def check_dynamic_sql(this, args, callee):
'Check for the use of non-static strings when creating/exeucting SQL\n statements.'
if ((len(args) >= 1) and (not args[0].is_clean_literal)):
this.traverser.warning(err_id=('js', 'instanceactions', 'executeSimpleSQL_dynamic'), warning='SQL statements should ... | def check_dynamic_sql(this, args, callee):
'Check for the use of non-static strings when creating/exeucting SQL\n statements.'
if ((len(args) >= 1) and (not args[0].is_clean_literal)):
this.traverser.warning(err_id=('js', 'instanceactions', 'executeSimpleSQL_dynamic'), warning='SQL statements should ... |
369bd781510350e56d1439c10e7c76464b485ebf83ba8c5cba0a3edb8427c909 | def createStatement(this, args, callee):
'Handle calls to `createStatement`, returning an object which emits\n warnings upon calls to `execute` and `executeStep` rather than\n `executeAsync`.'
check_dynamic_sql(this, args, callee)
return this.traverser.wrap().query_interface('mozIStorageBaseSt... | Handle calls to `createStatement`, returning an object which emits
warnings upon calls to `execute` and `executeStep` rather than
`executeAsync`. | validator/testcases/javascript/performance.py | createStatement | kmaglione/amo-validator | 1 | python | def createStatement(this, args, callee):
'Handle calls to `createStatement`, returning an object which emits\n warnings upon calls to `execute` and `executeStep` rather than\n `executeAsync`.'
check_dynamic_sql(this, args, callee)
return this.traverser.wrap().query_interface('mozIStorageBaseSt... | def createStatement(this, args, callee):
'Handle calls to `createStatement`, returning an object which emits\n warnings upon calls to `execute` and `executeStep` rather than\n `executeAsync`.'
check_dynamic_sql(this, args, callee)
return this.traverser.wrap().query_interface('mozIStorageBaseSt... |
bd1f41c121c2bfc7f0320b6aa81aa8097886b55f618b8ed16127116fc20fd404 | @Hook.on_call
def executeSimpleSQL(this, args, callee):
'Handle calls to `executeSimpleSQL`, warning that asynchronous\n methods should be used instead. '
check_dynamic_sql(this, args, callee)
return {'err_id': ('js', 'instanceactions', 'executeSimpleSQL'), 'warning': 'Synchronous SQL should not be u... | Handle calls to `executeSimpleSQL`, warning that asynchronous
methods should be used instead. | validator/testcases/javascript/performance.py | executeSimpleSQL | kmaglione/amo-validator | 1 | python | @Hook.on_call
def executeSimpleSQL(this, args, callee):
'Handle calls to `executeSimpleSQL`, warning that asynchronous\n methods should be used instead. '
check_dynamic_sql(this, args, callee)
return {'err_id': ('js', 'instanceactions', 'executeSimpleSQL'), 'warning': 'Synchronous SQL should not be u... | @Hook.on_call
def executeSimpleSQL(this, args, callee):
'Handle calls to `executeSimpleSQL`, warning that asynchronous\n methods should be used instead. '
check_dynamic_sql(this, args, callee)
return {'err_id': ('js', 'instanceactions', 'executeSimpleSQL'), 'warning': 'Synchronous SQL should not be u... |
1386871f4017fea0624df8571e9f44eba476c66e6bfa81b6a89e97f9613be27e | @Hook.on_call
def open(this, args, callee):
'Check that XMLHttpRequest.open is not called synchronously.'
if ((len(args) >= 3) and (not args[2].as_bool())):
return 'Synchronous HTTP requests can cause serious UI performance problems, especially for users with slow network connections.' | Check that XMLHttpRequest.open is not called synchronously. | validator/testcases/javascript/performance.py | open | kmaglione/amo-validator | 1 | python | @Hook.on_call
def open(this, args, callee):
if ((len(args) >= 3) and (not args[2].as_bool())):
return 'Synchronous HTTP requests can cause serious UI performance problems, especially for users with slow network connections.' | @Hook.on_call
def open(this, args, callee):
if ((len(args) >= 3) and (not args[2].as_bool())):
return 'Synchronous HTTP requests can cause serious UI performance problems, especially for users with slow network connections.'<|docstring|>Check that XMLHttpRequest.open is not called synchronously.<|endof... |
2c9cbc6755873cbcd7343b5274f758239a9e144af8b76fd8a97d370f14526d4c | def load_embeddings(emb_path, emb_dims):
'Load the embeddings from a text file\n \n :param emb_path: Path of the text file\n :param emb_dims: Embedding dimensions\n \n :return emb_tensor: tensor containing all word embeedings\n :return word_to_indx: dictionary with word:index.'... | Load the embeddings from a text file
:param emb_path: Path of the text file
:param emb_dims: Embedding dimensions
:return emb_tensor: tensor containing all word embeedings
:return word_to_indx: dictionary with word:index. | evalution/embeddings.py | load_embeddings | esantus/evalution2 | 1 | python | def load_embeddings(emb_path, emb_dims):
'Load the embeddings from a text file\n \n :param emb_path: Path of the text file\n :param emb_dims: Embedding dimensions\n \n :return emb_tensor: tensor containing all word embeedings\n :return word_to_indx: dictionary with word:index.'... | def load_embeddings(emb_path, emb_dims):
'Load the embeddings from a text file\n \n :param emb_path: Path of the text file\n :param emb_dims: Embedding dimensions\n \n :return emb_tensor: tensor containing all word embeedings\n :return word_to_indx: dictionary with word:index.'... |
61773fbbc54015d0b43d3da42f933f4e219fd65b6803f67cc284763c82e20d50 | def get_direction(self, direction: int):
' returns the GossmapHalfchannel if known by channel_update '
if (not (0 <= direction <= 1)):
raise ValueError('direction can only be 0 or 1')
return self.half_channels[direction] | returns the GossmapHalfchannel if known by channel_update | contrib/pyln-client/pyln/client/gossmap.py | get_direction | lightning-developer/lightning | 2,288 | python | def get_direction(self, direction: int):
' '
if (not (0 <= direction <= 1)):
raise ValueError('direction can only be 0 or 1')
return self.half_channels[direction] | def get_direction(self, direction: int):
' '
if (not (0 <= direction <= 1)):
raise ValueError('direction can only be 0 or 1')
return self.half_channels[direction]<|docstring|>returns the GossmapHalfchannel if known by channel_update<|endoftext|> |
bbf70aab77966cbccabd38c5e2c4aa59416d225a3323bec17301c274b2fada32 | def _set_channel_amount(self, rec: bytes):
' Sets channel capacity of last added channel '
(sats,) = struct.unpack('>Q', rec[2:])
self.channels[self._last_scid].satoshis = sats | Sets channel capacity of last added channel | contrib/pyln-client/pyln/client/gossmap.py | _set_channel_amount | lightning-developer/lightning | 2,288 | python | def _set_channel_amount(self, rec: bytes):
' '
(sats,) = struct.unpack('>Q', rec[2:])
self.channels[self._last_scid].satoshis = sats | def _set_channel_amount(self, rec: bytes):
' '
(sats,) = struct.unpack('>Q', rec[2:])
self.channels[self._last_scid].satoshis = sats<|docstring|>Sets channel capacity of last added channel<|endoftext|> |
900dda1a49fc72820a11460deac07d612bd7c96bdd614df39281c4f75c931d72 | def get_channel(self, short_channel_id: ShortChannelId):
' Resolves a channel by its short channel id '
if isinstance(short_channel_id, str):
short_channel_id = ShortChannelId.from_str(short_channel_id)
return self.channels.get(short_channel_id) | Resolves a channel by its short channel id | contrib/pyln-client/pyln/client/gossmap.py | get_channel | lightning-developer/lightning | 2,288 | python | def get_channel(self, short_channel_id: ShortChannelId):
' '
if isinstance(short_channel_id, str):
short_channel_id = ShortChannelId.from_str(short_channel_id)
return self.channels.get(short_channel_id) | def get_channel(self, short_channel_id: ShortChannelId):
' '
if isinstance(short_channel_id, str):
short_channel_id = ShortChannelId.from_str(short_channel_id)
return self.channels.get(short_channel_id)<|docstring|>Resolves a channel by its short channel id<|endoftext|> |
15222249ae043fbfb8c35458ae99dfbe4e9ac7ed5380b78d750c832e9d867039 | def get_node(self, node_id: Union[(GossmapNodeId, str)]):
' Resolves a node by its public key node_id '
if isinstance(node_id, str):
node_id = GossmapNodeId.from_str(node_id)
return self.nodes.get(cast(GossmapNodeId, node_id)) | Resolves a node by its public key node_id | contrib/pyln-client/pyln/client/gossmap.py | get_node | lightning-developer/lightning | 2,288 | python | def get_node(self, node_id: Union[(GossmapNodeId, str)]):
' '
if isinstance(node_id, str):
node_id = GossmapNodeId.from_str(node_id)
return self.nodes.get(cast(GossmapNodeId, node_id)) | def get_node(self, node_id: Union[(GossmapNodeId, str)]):
' '
if isinstance(node_id, str):
node_id = GossmapNodeId.from_str(node_id)
return self.nodes.get(cast(GossmapNodeId, node_id))<|docstring|>Resolves a node by its public key node_id<|endoftext|> |
d7339f8f18e35d4aff1b488a4a9b0afd7b246e641c7c9fece06f4cce2c0ef90c | def reopen_store(self):
'FIXME: Implement!'
assert False | FIXME: Implement! | contrib/pyln-client/pyln/client/gossmap.py | reopen_store | lightning-developer/lightning | 2,288 | python | def reopen_store(self):
assert False | def reopen_store(self):
assert False<|docstring|>FIXME: Implement!<|endoftext|> |
1aebab2b28668523a38ce4a4b8321100f6232f54de9ee83432d589e055fb8db3 | def _pull_bytes(self, length: int) -> bool:
'Pull bytes from file into our internal buffer'
if (len(self.store_buf) < length):
self.store_buf += self.store_file.read((length - len(self.store_buf)))
return (len(self.store_buf) >= length) | Pull bytes from file into our internal buffer | contrib/pyln-client/pyln/client/gossmap.py | _pull_bytes | lightning-developer/lightning | 2,288 | python | def _pull_bytes(self, length: int) -> bool:
if (len(self.store_buf) < length):
self.store_buf += self.store_file.read((length - len(self.store_buf)))
return (len(self.store_buf) >= length) | def _pull_bytes(self, length: int) -> bool:
if (len(self.store_buf) < length):
self.store_buf += self.store_file.read((length - len(self.store_buf)))
return (len(self.store_buf) >= length)<|docstring|>Pull bytes from file into our internal buffer<|endoftext|> |
43b9813dfcf0d49f778877a8296b1d20c5fc4b2cdb54c23d98e7253669f6604f | def _read_record(self) -> Optional[bytes]:
'If a whole record is not in the file, returns None.\n If deleted, returns empty.'
if (not self._pull_bytes(12)):
return None
hdr = GossipStoreHeader(self.store_buf[:12])
if (not self._pull_bytes((12 + hdr.length))):
return None
self.... | If a whole record is not in the file, returns None.
If deleted, returns empty. | contrib/pyln-client/pyln/client/gossmap.py | _read_record | lightning-developer/lightning | 2,288 | python | def _read_record(self) -> Optional[bytes]:
'If a whole record is not in the file, returns None.\n If deleted, returns empty.'
if (not self._pull_bytes(12)):
return None
hdr = GossipStoreHeader(self.store_buf[:12])
if (not self._pull_bytes((12 + hdr.length))):
return None
self.... | def _read_record(self) -> Optional[bytes]:
'If a whole record is not in the file, returns None.\n If deleted, returns empty.'
if (not self._pull_bytes(12)):
return None
hdr = GossipStoreHeader(self.store_buf[:12])
if (not self._pull_bytes((12 + hdr.length))):
return None
self.... |
01788f1659ac38ebae40e25b598f4770609f0172458a95bdf0feb4d2c07f283d | def refresh(self):
'Catch up with any changes to the gossip store'
while True:
off = self.bytes_read
rec = self._read_record()
if (rec is None):
break
if (len(rec) == 0):
continue
(rectype,) = struct.unpack('>H', rec[:2])
if (rectype == cha... | Catch up with any changes to the gossip store | contrib/pyln-client/pyln/client/gossmap.py | refresh | lightning-developer/lightning | 2,288 | python | def refresh(self):
while True:
off = self.bytes_read
rec = self._read_record()
if (rec is None):
break
if (len(rec) == 0):
continue
(rectype,) = struct.unpack('>H', rec[:2])
if (rectype == channel_announcement.number):
self._ad... | def refresh(self):
while True:
off = self.bytes_read
rec = self._read_record()
if (rec is None):
break
if (len(rec) == 0):
continue
(rectype,) = struct.unpack('>H', rec[:2])
if (rectype == channel_announcement.number):
self._ad... |
b8292bf00e41de9b78a19f1129a03ab0fb97a9dc5f2a18bb971a73ee618f8527 | def __init__(self, token: str=''):
" This is the Base Class for the AniApi wrapper.\n This class will only contain the resources given at the docs,\n oauth will be extended by the other classes.\n\n In this class you will find other than the standard requests the `auth me` requests,\n wh... | This is the Base Class for the AniApi wrapper.
This class will only contain the resources given at the docs,
oauth will be extended by the other classes.
In this class you will find other than the standard requests the `auth me` requests,
when you want them oAuth stuff please use the :class:`AniApiOAuth` class,
it's a... | wrapper.py | __init__ | exersalza/AniAPI-pywrapper | 0 | python | def __init__(self, token: str=):
" This is the Base Class for the AniApi wrapper.\n This class will only contain the resources given at the docs,\n oauth will be extended by the other classes.\n\n In this class you will find other than the standard requests the `auth me` requests,\n when... | def __init__(self, token: str=):
" This is the Base Class for the AniApi wrapper.\n This class will only contain the resources given at the docs,\n oauth will be extended by the other classes.\n\n In this class you will find other than the standard requests the `auth me` requests,\n when... |
321ade4dff21bac1f5a47df285eaa7117d253b0be5071cf4d03449ff1b269de3 | def get_requests(self, _id, url, params, obj) -> dict:
' For development method. this method will be used later to make it easier\n to implement new endpoints.\n\n Parameters\n ----------\n _id : [:class:`int`]\n The id for the url for a specific endpoint e.s. `/anime/{id}`.\n... | For development method. this method will be used later to make it easier
to implement new endpoints.
Parameters
----------
_id : [:class:`int`]
The id for the url for a specific endpoint e.s. `/anime/{id}`.
url : [:class:`str`]
The url identifier for the endpoint e.s. `anime`.
params : [:class:`dict`]
The ... | wrapper.py | get_requests | exersalza/AniAPI-pywrapper | 0 | python | def get_requests(self, _id, url, params, obj) -> dict:
' For development method. this method will be used later to make it easier\n to implement new endpoints.\n\n Parameters\n ----------\n _id : [:class:`int`]\n The id for the url for a specific endpoint e.s. `/anime/{id}`.\n... | def get_requests(self, _id, url, params, obj) -> dict:
' For development method. this method will be used later to make it easier\n to implement new endpoints.\n\n Parameters\n ----------\n _id : [:class:`int`]\n The id for the url for a specific endpoint e.s. `/anime/{id}`.\n... |
c5ef3f595c750c7a522e28ed69794ae5af58b50de124bbcc5e1f8de109eec9ae | def get_anime(self, anime_id: int='', **kwargs) -> Ctx:
" Get an Anime object list from the API.\n You can provide an ID or query parameters to get a single AnimeObject (:class:`Anime`) or an :class:`list`\n of objects.\n\n Parameters:\n ----------\n anime_id : Optional[:class:`in... | Get an Anime object list from the API.
You can provide an ID or query parameters to get a single AnimeObject (:class:`Anime`) or an :class:`list`
of objects.
Parameters:
----------
anime_id : Optional[:class:`int`]
The ID for the Anime you want to get. Beware it's **not** the mal_id,
tmdb_id or the anilist_id ... | wrapper.py | get_anime | exersalza/AniAPI-pywrapper | 0 | python | def get_anime(self, anime_id: int=, **kwargs) -> Ctx:
" Get an Anime object list from the API.\n You can provide an ID or query parameters to get a single AnimeObject (:class:`Anime`) or an :class:`list`\n of objects.\n\n Parameters:\n ----------\n anime_id : Optional[:class:`int`... | def get_anime(self, anime_id: int=, **kwargs) -> Ctx:
" Get an Anime object list from the API.\n You can provide an ID or query parameters to get a single AnimeObject (:class:`Anime`) or an :class:`list`\n of objects.\n\n Parameters:\n ----------\n anime_id : Optional[:class:`int`... |
643a0bd0c2dd5d6b042b437f4e4cca14a62fe6933f6f978f38e80338d35533fc | def get_random_anime(self, count: int=1, nsfw: bool=False) -> Ctx:
" Get one or more random Animes from the API.\n\n Parameters\n ----------\n count : :class:`int`\n The amount of Animes you want to get. Value should be between 1 and 50.\n\n nsfw : :class:`bool`\n I... | Get one or more random Animes from the API.
Parameters
----------
count : :class:`int`
The amount of Animes you want to get. Value should be between 1 and 50.
nsfw : :class:`bool`
If you want to get NSFW Animes. Default is False.
Returns
-------
:class:`Ctx`
Context object with the query returns and the ... | wrapper.py | get_random_anime | exersalza/AniAPI-pywrapper | 0 | python | def get_random_anime(self, count: int=1, nsfw: bool=False) -> Ctx:
" Get one or more random Animes from the API.\n\n Parameters\n ----------\n count : :class:`int`\n The amount of Animes you want to get. Value should be between 1 and 50.\n\n nsfw : :class:`bool`\n I... | def get_random_anime(self, count: int=1, nsfw: bool=False) -> Ctx:
" Get one or more random Animes from the API.\n\n Parameters\n ----------\n count : :class:`int`\n The amount of Animes you want to get. Value should be between 1 and 50.\n\n nsfw : :class:`bool`\n I... |
77eacf38bd777dde7e12484b83c38ae65ce7edd2baae2d6e42ac3caa1f18cc08 | def get_episode(self, episode_id: int='', **kwargs) -> Ctx:
" Get an Episode from the API.\n\n Parameters\n ----------\n episode_id : Optional[:class:`int`]\n Give an ID to get a Specific Episode, note that all other\n parameters get dumped when you provide an ID.\n\n ... | Get an Episode from the API.
Parameters
----------
episode_id : Optional[:class:`int`]
Give an ID to get a Specific Episode, note that all other
parameters get dumped when you provide an ID.
**kwargs :
Apply filter like `anime_id` or enter a `pagination` valid filter
can be found inside the `utils.fla... | wrapper.py | get_episode | exersalza/AniAPI-pywrapper | 0 | python | def get_episode(self, episode_id: int=, **kwargs) -> Ctx:
" Get an Episode from the API.\n\n Parameters\n ----------\n episode_id : Optional[:class:`int`]\n Give an ID to get a Specific Episode, note that all other\n parameters get dumped when you provide an ID.\n\n ... | def get_episode(self, episode_id: int=, **kwargs) -> Ctx:
" Get an Episode from the API.\n\n Parameters\n ----------\n episode_id : Optional[:class:`int`]\n Give an ID to get a Specific Episode, note that all other\n parameters get dumped when you provide an ID.\n\n ... |
388197ce62b639d06585c7fed7f8126f1e1c817e9303984cf8fa7f926e02e508 | def get_song(self, song_id: int='', **kwargs) -> Ctx:
' Get from 1 up to 100 songs at the time from the Api\n\n Parameters\n ----------\n song_id : Optional[:class:`int`]\n Give an ID to get a Specific Song, note that all other parameters\n get dumped when you provide an I... | Get from 1 up to 100 songs at the time from the Api
Parameters
----------
song_id : Optional[:class:`int`]
Give an ID to get a Specific Song, note that all other parameters
get dumped when you provide an ID.
kwargs : Optional[:class:`dict`]
Apply filter like `anime_id` or enter a `pagination` valid filter... | wrapper.py | get_song | exersalza/AniAPI-pywrapper | 0 | python | def get_song(self, song_id: int=, **kwargs) -> Ctx:
' Get from 1 up to 100 songs at the time from the Api\n\n Parameters\n ----------\n song_id : Optional[:class:`int`]\n Give an ID to get a Specific Song, note that all other parameters\n get dumped when you provide an ID.... | def get_song(self, song_id: int=, **kwargs) -> Ctx:
' Get from 1 up to 100 songs at the time from the Api\n\n Parameters\n ----------\n song_id : Optional[:class:`int`]\n Give an ID to get a Specific Song, note that all other parameters\n get dumped when you provide an ID.... |
8fe5c882d27f8ee04443c9c95da05fb1b751687a1fb1c6f3df1d2b974ac57ac1 | def get_random_song(self, count: int=1) -> Ctx:
"\n It's the same as get_random_anime but for another endpoint and without nsfw tag.\n\n Parameters\n ----------\n count : :class:`int`\n The amount of songs you want to get. Value should be between 1 and 50.\n When yo... | It's the same as get_random_anime but for another endpoint and without nsfw tag.
Parameters
----------
count : :class:`int`
The amount of songs you want to get. Value should be between 1 and 50.
When you go over the value you get 50 at max. so I set a cap at 50.
Returns
-------
:class:`Ctx`
Context object... | wrapper.py | get_random_song | exersalza/AniAPI-pywrapper | 0 | python | def get_random_song(self, count: int=1) -> Ctx:
"\n It's the same as get_random_anime but for another endpoint and without nsfw tag.\n\n Parameters\n ----------\n count : :class:`int`\n The amount of songs you want to get. Value should be between 1 and 50.\n When yo... | def get_random_song(self, count: int=1) -> Ctx:
"\n It's the same as get_random_anime but for another endpoint and without nsfw tag.\n\n Parameters\n ----------\n count : :class:`int`\n The amount of songs you want to get. Value should be between 1 and 50.\n When yo... |
70c044e33815bc269c52d2fe2b66eb1fb348ae09307822682095032f5f8e138f | def get_resources(self, version: float, _type: int) -> Ctx:
' Get the resources of the AniApi\n\n Parameters\n ----------\n version : :class:`float`\n The version from the resource.\n\n _type : :class:`int`\n The type of resource you want to get.\n 0 = An... | Get the resources of the AniApi
Parameters
----------
version : :class:`float`
The version from the resource.
_type : :class:`int`
The type of resource you want to get.
0 = Anime Genres,
1 = Locales
Returns
-------
:class:`Ctx`
A context object with the query returns and the rate limit informatio... | wrapper.py | get_resources | exersalza/AniAPI-pywrapper | 0 | python | def get_resources(self, version: float, _type: int) -> Ctx:
' Get the resources of the AniApi\n\n Parameters\n ----------\n version : :class:`float`\n The version from the resource.\n\n _type : :class:`int`\n The type of resource you want to get.\n 0 = An... | def get_resources(self, version: float, _type: int) -> Ctx:
' Get the resources of the AniApi\n\n Parameters\n ----------\n version : :class:`float`\n The version from the resource.\n\n _type : :class:`int`\n The type of resource you want to get.\n 0 = An... |
04cd67c73b4fd06da37f5950a5141c7eee661641b1792ae70dc34ad33501ea43 | def get_user_story(self, story_id: int='', **kwargs) -> Ctx:
' Get a list or specific UserStory from the API\n\n Parameters\n ----------\n story_id : [:class:`int`]\n The UserStory id to get, note: when you provide an id.\n\n kwargs\n Include filter for the List req... | Get a list or specific UserStory from the API
Parameters
----------
story_id : [:class:`int`]
The UserStory id to get, note: when you provide an id.
kwargs
Include filter for the List request
Returns
-------
:class:`Ctx`
Ctx object with the response from the get request | wrapper.py | get_user_story | exersalza/AniAPI-pywrapper | 0 | python | def get_user_story(self, story_id: int=, **kwargs) -> Ctx:
' Get a list or specific UserStory from the API\n\n Parameters\n ----------\n story_id : [:class:`int`]\n The UserStory id to get, note: when you provide an id.\n\n kwargs\n Include filter for the List reque... | def get_user_story(self, story_id: int=, **kwargs) -> Ctx:
' Get a list or specific UserStory from the API\n\n Parameters\n ----------\n story_id : [:class:`int`]\n The UserStory id to get, note: when you provide an id.\n\n kwargs\n Include filter for the List reque... |
4deed6d3623bfb06808d49936a724e26239a5ed9877b0604d4157671a9b58e4e | def create_user_story(self, user_id: int, anime_id: int, status: int, **kwargs) -> Ctx:
" This will create a UserStory based on the given parameters.\n\n Parameters\n ----------\n user_id : :class:`int`\n The User ID for the UserStory's bind.\n\n anime_id : :class:`int`\n ... | This will create a UserStory based on the given parameters.
Parameters
----------
user_id : :class:`int`
The User ID for the UserStory's bind.
anime_id : :class:`int`
The UserStory's Anime ID.
status : :class:`int`
The UserStory's watching status.
kwargs : Optional
These are the optional parameters.... | wrapper.py | create_user_story | exersalza/AniAPI-pywrapper | 0 | python | def create_user_story(self, user_id: int, anime_id: int, status: int, **kwargs) -> Ctx:
" This will create a UserStory based on the given parameters.\n\n Parameters\n ----------\n user_id : :class:`int`\n The User ID for the UserStory's bind.\n\n anime_id : :class:`int`\n ... | def create_user_story(self, user_id: int, anime_id: int, status: int, **kwargs) -> Ctx:
" This will create a UserStory based on the given parameters.\n\n Parameters\n ----------\n user_id : :class:`int`\n The User ID for the UserStory's bind.\n\n anime_id : :class:`int`\n ... |
2adfbe9ef9fde523064db90aa217331a4ef41a9234c5017d5fe3139dacab331d | def update_user_story(self, story_id: int, user_id: int, anime_id: int, status: int, ce: int, cet: int) -> Ctx:
"\n Update a UserStory\n\n Parameters\n ----------\n story_id : [:class:`int`]\n -> id, on the docs.\n The UserStory's unique identifier.\n\n user_... | Update a UserStory
Parameters
----------
story_id : [:class:`int`]
-> id, on the docs.
The UserStory's unique identifier.
user_id : [:class:`int`]
-> user_id, on the docs.
The userid that is related to the UserStory.
anime_id : [:class:`int`]
-> anime_id, on the docs
The UserStory's anime id.... | wrapper.py | update_user_story | exersalza/AniAPI-pywrapper | 0 | python | def update_user_story(self, story_id: int, user_id: int, anime_id: int, status: int, ce: int, cet: int) -> Ctx:
"\n Update a UserStory\n\n Parameters\n ----------\n story_id : [:class:`int`]\n -> id, on the docs.\n The UserStory's unique identifier.\n\n user_... | def update_user_story(self, story_id: int, user_id: int, anime_id: int, status: int, ce: int, cet: int) -> Ctx:
"\n Update a UserStory\n\n Parameters\n ----------\n story_id : [:class:`int`]\n -> id, on the docs.\n The UserStory's unique identifier.\n\n user_... |
adf9581a6937a73e6fc09d8f44574612029b573d44d57c6343e86a8773170f07 | def delete_user_story(self, _id: int) -> Ctx:
'\n Deletes a UserStory on the provided unique identifier.\n\n Parameters\n ----------\n _id : [:class:`int`]\n The id from the UserStory that wanted to be deleted.\n\n Returns\n -------\n :class:`Ctx`\n ... | Deletes a UserStory on the provided unique identifier.
Parameters
----------
_id : [:class:`int`]
The id from the UserStory that wanted to be deleted.
Returns
-------
:class:`Ctx`
Context obj with the response inside it
Notes
-----
You should only use the endpoint when the User has 0 linked trackers, otherwi... | wrapper.py | delete_user_story | exersalza/AniAPI-pywrapper | 0 | python | def delete_user_story(self, _id: int) -> Ctx:
'\n Deletes a UserStory on the provided unique identifier.\n\n Parameters\n ----------\n _id : [:class:`int`]\n The id from the UserStory that wanted to be deleted.\n\n Returns\n -------\n :class:`Ctx`\n ... | def delete_user_story(self, _id: int) -> Ctx:
'\n Deletes a UserStory on the provided unique identifier.\n\n Parameters\n ----------\n _id : [:class:`int`]\n The id from the UserStory that wanted to be deleted.\n\n Returns\n -------\n :class:`Ctx`\n ... |
49630a6f8923094c7a2ffa89db0ce92de32a075c9bbff5b3916b219bb794bfcf | def get_user(self, user_id: int='', **kwargs) -> Ctx:
"\n Get user list of users or when you provide a user_id to get a specific user\n\n Parameters\n ----------\n user_id : [:class:`int`]\n A UserID for specified search of user.\n\n kwargs\n Bring up paginat... | Get user list of users or when you provide a user_id to get a specific user
Parameters
----------
user_id : [:class:`int`]
A UserID for specified search of user.
kwargs
Bring up pagination or currently two arguments for filtering:
username: is not case-sensitive, it searches for substrings in the usernam... | wrapper.py | get_user | exersalza/AniAPI-pywrapper | 0 | python | def get_user(self, user_id: int=, **kwargs) -> Ctx:
"\n Get user list of users or when you provide a user_id to get a specific user\n\n Parameters\n ----------\n user_id : [:class:`int`]\n A UserID for specified search of user.\n\n kwargs\n Bring up paginatio... | def get_user(self, user_id: int=, **kwargs) -> Ctx:
"\n Get user list of users or when you provide a user_id to get a specific user\n\n Parameters\n ----------\n user_id : [:class:`int`]\n A UserID for specified search of user.\n\n kwargs\n Bring up paginatio... |
eb69310d0f2d492c859e1094690988cfcb8947c5c5325087ebc3fea0bb3682af | def update_user(self, user_id: int, gender: int, **kwargs) -> Ctx:
" This method will update user information, please read the notes.\n\n Parameters\n ----------\n user_id : [:class:`int`]\n The unique identifier for the user that you want to edit.\n\n gender : [:class:`int`]\... | This method will update user information, please read the notes.
Parameters
----------
user_id : [:class:`int`]
The unique identifier for the user that you want to edit.
gender : [:class:`int`]
The gender of the user that will be changed or not.
kwargs
Other settings to change on the user's acc, lists ca... | wrapper.py | update_user | exersalza/AniAPI-pywrapper | 0 | python | def update_user(self, user_id: int, gender: int, **kwargs) -> Ctx:
" This method will update user information, please read the notes.\n\n Parameters\n ----------\n user_id : [:class:`int`]\n The unique identifier for the user that you want to edit.\n\n gender : [:class:`int`]\... | def update_user(self, user_id: int, gender: int, **kwargs) -> Ctx:
" This method will update user information, please read the notes.\n\n Parameters\n ----------\n user_id : [:class:`int`]\n The unique identifier for the user that you want to edit.\n\n gender : [:class:`int`]\... |
14d0e6894658f6aa8a82d81cd101c3a4a83707ff6e392a31042787e8eccf8a32 | def delete_user(self, _id: int) -> Ctx:
'\n This method will delete the user with the given id.\n Parameters\n ----------\n _id : [:class:`int`]\n The unique identifier for the user that you want to delete.\n\n Returns\n -------\n :class:`Ctx`\n ... | This method will delete the user with the given id.
Parameters
----------
_id : [:class:`int`]
The unique identifier for the user that you want to delete.
Returns
-------
:class:`Ctx`
A Ctx object with the return object | wrapper.py | delete_user | exersalza/AniAPI-pywrapper | 0 | python | def delete_user(self, _id: int) -> Ctx:
'\n This method will delete the user with the given id.\n Parameters\n ----------\n _id : [:class:`int`]\n The unique identifier for the user that you want to delete.\n\n Returns\n -------\n :class:`Ctx`\n ... | def delete_user(self, _id: int) -> Ctx:
'\n This method will delete the user with the given id.\n Parameters\n ----------\n _id : [:class:`int`]\n The unique identifier for the user that you want to delete.\n\n Returns\n -------\n :class:`Ctx`\n ... |
ae74379eacedc79671e3b0ff44cf5d8316d7da3d05120a2171b651c7c3729341 | def auth_me(self, jwt: str) -> Ctx:
'\n This method will test the given token and return the user\n information (if it exists and its valid).\n\n Parameters\n ----------\n jwt : :class:`str`\n The JWT token to test.\n\n Returns\n -------\n :class:`C... | This method will test the given token and return the user
information (if it exists and its valid).
Parameters
----------
jwt : :class:`str`
The JWT token to test.
Returns
-------
:class:`Ctx`
A context object with the response. If the token is invalid you
will get a status code of 401. | wrapper.py | auth_me | exersalza/AniAPI-pywrapper | 0 | python | def auth_me(self, jwt: str) -> Ctx:
'\n This method will test the given token and return the user\n information (if it exists and its valid).\n\n Parameters\n ----------\n jwt : :class:`str`\n The JWT token to test.\n\n Returns\n -------\n :class:`C... | def auth_me(self, jwt: str) -> Ctx:
'\n This method will test the given token and return the user\n information (if it exists and its valid).\n\n Parameters\n ----------\n jwt : :class:`str`\n The JWT token to test.\n\n Returns\n -------\n :class:`C... |
868aa9cdf2291379750e9354134860ec4462ff278adb73bf5d5df38ad7406d61 | @property
@decorators.Cache
def misc_web_contents_backend(self):
'Access to chrome://oobe/login page.'
return misc_web_contents_backend.MiscWebContentsBackend(self) | Access to chrome://oobe/login page. | telemetry/telemetry/internal/backends/chrome/cros_browser_backend.py | misc_web_contents_backend | Murka96/catapult | 0 | python | @property
@decorators.Cache
def misc_web_contents_backend(self):
return misc_web_contents_backend.MiscWebContentsBackend(self) | @property
@decorators.Cache
def misc_web_contents_backend(self):
return misc_web_contents_backend.MiscWebContentsBackend(self)<|docstring|>Access to chrome://oobe/login page.<|endoftext|> |
cf2f64ddc8220571815eab43db085c5d7472570d4837380b0a8f459a4c3c1769 | def _GetLoginStatus(self):
'Returns login status. If logged in, empty string is returned.'
status = ''
if (not self._IsCryptohomeMounted()):
status += 'Cryptohome not mounted. '
if (not self.HasDevToolsConnection()):
status += "Browser didn't launch. "
if self.oobe_exists:
st... | Returns login status. If logged in, empty string is returned. | telemetry/telemetry/internal/backends/chrome/cros_browser_backend.py | _GetLoginStatus | Murka96/catapult | 0 | python | def _GetLoginStatus(self):
status =
if (not self._IsCryptohomeMounted()):
status += 'Cryptohome not mounted. '
if (not self.HasDevToolsConnection()):
status += "Browser didn't launch. "
if self.oobe_exists:
status += 'OOBE not dismissed.'
return status | def _GetLoginStatus(self):
status =
if (not self._IsCryptohomeMounted()):
status += 'Cryptohome not mounted. '
if (not self.HasDevToolsConnection()):
status += "Browser didn't launch. "
if self.oobe_exists:
status += 'OOBE not dismissed.'
return status<|docstring|>Retur... |
7532b615df20506e1dd8bc4b344fd36808fa39077207960c97800e51bb5e45bc | def _IsLoggedIn(self):
'Returns True if cryptohome has mounted, the browser is\n responsive to devtools requests, and the oobe has been dismissed.'
return (not self._GetLoginStatus()) | Returns True if cryptohome has mounted, the browser is
responsive to devtools requests, and the oobe has been dismissed. | telemetry/telemetry/internal/backends/chrome/cros_browser_backend.py | _IsLoggedIn | Murka96/catapult | 0 | python | def _IsLoggedIn(self):
'Returns True if cryptohome has mounted, the browser is\n responsive to devtools requests, and the oobe has been dismissed.'
return (not self._GetLoginStatus()) | def _IsLoggedIn(self):
'Returns True if cryptohome has mounted, the browser is\n responsive to devtools requests, and the oobe has been dismissed.'
return (not self._GetLoginStatus())<|docstring|>Returns True if cryptohome has mounted, the browser is
responsive to devtools requests, and the oobe has been dis... |
af367f9a508893455ff4410f6af4ce3644f30f911067b2e25e7a428a1f8b7828 | def _SymbolizeMinidump(self, minidump_path):
'Symbolizes the given minidump.\n\n Args:\n minidump_path: the path to the minidump to symbolize\n\n Return:\n A tuple (valid, output). |valid| is True if the minidump was symbolized,\n otherwise False. |output| contains an error message if |valid| i... | Symbolizes the given minidump.
Args:
minidump_path: the path to the minidump to symbolize
Return:
A tuple (valid, output). |valid| is True if the minidump was symbolized,
otherwise False. |output| contains an error message if |valid| is False,
otherwise it contains the symbolized minidump. | telemetry/telemetry/internal/backends/chrome/cros_browser_backend.py | _SymbolizeMinidump | Murka96/catapult | 0 | python | def _SymbolizeMinidump(self, minidump_path):
'Symbolizes the given minidump.\n\n Args:\n minidump_path: the path to the minidump to symbolize\n\n Return:\n A tuple (valid, output). |valid| is True if the minidump was symbolized,\n otherwise False. |output| contains an error message if |valid| i... | def _SymbolizeMinidump(self, minidump_path):
'Symbolizes the given minidump.\n\n Args:\n minidump_path: the path to the minidump to symbolize\n\n Return:\n A tuple (valid, output). |valid| is True if the minidump was symbolized,\n otherwise False. |output| contains an error message if |valid| i... |
7b99cd64d7964ade87464b70d7470cec955e012e2aaedf5ceb9fd15997b9036a | def _GetStackFromMinidump(self, minidump):
'Gets the stack trace from the given minidump.\n\n Args:\n minidump: the path to the minidump on disk\n\n Returns:\n None if the stack could not be retrieved for some reason, otherwise a\n string containing the stack trace.\n '
dump_symbolizer =... | Gets the stack trace from the given minidump.
Args:
minidump: the path to the minidump on disk
Returns:
None if the stack could not be retrieved for some reason, otherwise a
string containing the stack trace. | telemetry/telemetry/internal/backends/chrome/cros_browser_backend.py | _GetStackFromMinidump | Murka96/catapult | 0 | python | def _GetStackFromMinidump(self, minidump):
'Gets the stack trace from the given minidump.\n\n Args:\n minidump: the path to the minidump on disk\n\n Returns:\n None if the stack could not be retrieved for some reason, otherwise a\n string containing the stack trace.\n '
dump_symbolizer =... | def _GetStackFromMinidump(self, minidump):
'Gets the stack trace from the given minidump.\n\n Args:\n minidump: the path to the minidump on disk\n\n Returns:\n None if the stack could not be retrieved for some reason, otherwise a\n string containing the stack trace.\n '
dump_symbolizer =... |
678b11c2e62962269a3fc028c75b78be8eb56a16b744129ff5798ee201ff0bba | def __init__(self):
'\n Newton-Raphson algorithm.\n '
OptSolver.__init__(self)
self.parameters = OptSolverNR.parameters.copy()
self.linsolver = None
self.problem = None | Newton-Raphson algorithm. | optalg/opt_solver/nr.py | __init__ | ttinoco/OPTALG | 10 | python | def __init__(self):
'\n \n '
OptSolver.__init__(self)
self.parameters = OptSolverNR.parameters.copy()
self.linsolver = None
self.problem = None | def __init__(self):
'\n \n '
OptSolver.__init__(self)
self.parameters = OptSolverNR.parameters.copy()
self.linsolver = None
self.problem = None<|docstring|>Newton-Raphson algorithm.<|endoftext|> |
edc5e4325e9303e4b8f56e46b3aa5d3cabf8fc1b20d1a124035edca833791f9b | def query(client, wid, query_contents, dialect='postgresql', limit=None):
'Query metadata.'
if (limit is None):
kwargs = dict(per_page=100)
limit = sys.maxsize
else:
kwargs = dict(per_page=min(limit, 100))
query_obj = {'dialect': dialect, 'query': query_contents}
if (wid is N... | Query metadata. | quetzal/client/helpers/query.py | query | dojeda/quetzal-client | 2 | python | def query(client, wid, query_contents, dialect='postgresql', limit=None):
if (limit is None):
kwargs = dict(per_page=100)
limit = sys.maxsize
else:
kwargs = dict(per_page=min(limit, 100))
query_obj = {'dialect': dialect, 'query': query_contents}
if (wid is None):
que... | def query(client, wid, query_contents, dialect='postgresql', limit=None):
if (limit is None):
kwargs = dict(per_page=100)
limit = sys.maxsize
else:
kwargs = dict(per_page=min(limit, 100))
query_obj = {'dialect': dialect, 'query': query_contents}
if (wid is None):
que... |
23e6a7fecb3c9ea6de257d5e051ad3fd14f1ea527e2ab229e41e5619fb602721 | def __init__(self):
'\n Creates the himesis graph representing the AToM3 model HNeg_CountryCity_CompleteLHS.\n '
self.is_compiled = True
super(HNeg_CountryCity_CompleteLHS, self).__init__(name='HNeg_CountryCity_CompleteLHS', num_nodes=0, edges=[])
self['mm__'] = []
self... | Creates the himesis graph representing the AToM3 model HNeg_CountryCity_CompleteLHS. | ExFamToPerson/contracts/HNeg_CountryCity_CompleteLHS.py | __init__ | levilucio/SyVOLT | 3 | python | def __init__(self):
'\n \n '
self.is_compiled = True
super(HNeg_CountryCity_CompleteLHS, self).__init__(name='HNeg_CountryCity_CompleteLHS', num_nodes=0, edges=[])
self['mm__'] = []
self['MT_constraint__'] = "#============================================================... | def __init__(self):
'\n \n '
self.is_compiled = True
super(HNeg_CountryCity_CompleteLHS, self).__init__(name='HNeg_CountryCity_CompleteLHS', num_nodes=0, edges=[])
self['mm__'] = []
self['MT_constraint__'] = "#============================================================... |
674f48a1f359291fd94c92ea8faa51ce88d36074b686f9ecbd5575e1ce620260 | def constraint(self, PreNode, graph):
'\n Executable constraint code.\n @param PreNode: Function taking an integer as parameter\n and returns the node corresponding to that label.\n '
return True | Executable constraint code.
@param PreNode: Function taking an integer as parameter
and returns the node corresponding to that label. | ExFamToPerson/contracts/HNeg_CountryCity_CompleteLHS.py | constraint | levilucio/SyVOLT | 3 | python | def constraint(self, PreNode, graph):
'\n Executable constraint code.\n @param PreNode: Function taking an integer as parameter\n and returns the node corresponding to that label.\n '
return True | def constraint(self, PreNode, graph):
'\n Executable constraint code.\n @param PreNode: Function taking an integer as parameter\n and returns the node corresponding to that label.\n '
return True<|docstring|>Executable c... |
23c035ea440c6463b748a9ee1d29f6652b94abd416d541e0efe66301bc56b3e2 | def __init__(self, mha_node: BaseNode):
'\n Extract MHA params from layer attributes\n Args:\n mha_node: MHA node\n '
if (BATCH_FIRST in mha_node.framework_attr.keys()):
if (mha_node.framework_attr[BATCH_FIRST] is not True):
raise Exception('Only batch first n... | Extract MHA params from layer attributes
Args:
mha_node: MHA node | model_compression_toolkit/core/pytorch/graph_substitutions/substitutions/multi_head_attention_decomposition.py | __init__ | reuvenperetz/model_optimization | 42 | python | def __init__(self, mha_node: BaseNode):
'\n Extract MHA params from layer attributes\n Args:\n mha_node: MHA node\n '
if (BATCH_FIRST in mha_node.framework_attr.keys()):
if (mha_node.framework_attr[BATCH_FIRST] is not True):
raise Exception('Only batch first n... | def __init__(self, mha_node: BaseNode):
'\n Extract MHA params from layer attributes\n Args:\n mha_node: MHA node\n '
if (BATCH_FIRST in mha_node.framework_attr.keys()):
if (mha_node.framework_attr[BATCH_FIRST] is not True):
raise Exception('Only batch first n... |
c8b426896275625242138a3d5870702de77eb01dd07242d65957b58a79ffcd08 | def __init__(self):
'\n Matches MultiHeadAttention node.\n '
super().__init__(matcher_instance=NodeOperationMatcher(nn.MultiheadAttention)) | Matches MultiHeadAttention node. | model_compression_toolkit/core/pytorch/graph_substitutions/substitutions/multi_head_attention_decomposition.py | __init__ | reuvenperetz/model_optimization | 42 | python | def __init__(self):
'\n \n '
super().__init__(matcher_instance=NodeOperationMatcher(nn.MultiheadAttention)) | def __init__(self):
'\n \n '
super().__init__(matcher_instance=NodeOperationMatcher(nn.MultiheadAttention))<|docstring|>Matches MultiHeadAttention node.<|endoftext|> |
b464395b7aaaee3661c9e578f75f871609784e1ab69dd2c6f15694a5fd4ed625 | def _project_input(self, graph: Graph, mha_node: BaseNode, params: MHAParams) -> List[BaseNode]:
'\n This method creates the nodes required to project q, k, v\n We implement the projection as Conv1d\n Due to the above we add transpose node to each of the inputs in order to swap the channel axis... | This method creates the nodes required to project q, k, v
We implement the projection as Conv1d
Due to the above we add transpose node to each of the inputs in order to swap the channel axis according
to Conv1d expected input shape
We describe below the shape transformation of each input (q, k, v) from the input shape,... | model_compression_toolkit/core/pytorch/graph_substitutions/substitutions/multi_head_attention_decomposition.py | _project_input | reuvenperetz/model_optimization | 42 | python | def _project_input(self, graph: Graph, mha_node: BaseNode, params: MHAParams) -> List[BaseNode]:
'\n This method creates the nodes required to project q, k, v\n We implement the projection as Conv1d\n Due to the above we add transpose node to each of the inputs in order to swap the channel axis... | def _project_input(self, graph: Graph, mha_node: BaseNode, params: MHAParams) -> List[BaseNode]:
'\n This method creates the nodes required to project q, k, v\n We implement the projection as Conv1d\n Due to the above we add transpose node to each of the inputs in order to swap the channel axis... |
d5949f2e21c4f32df122799a06a6722acbc51b281f8fc68e227901beaa3813c0 | @staticmethod
def _arrange_before_split(graph: Graph, mha_node: BaseNode, q_node: BaseNode, k_node: BaseNode, v_node: BaseNode, params: MHAParams) -> List[BaseNode]:
'\n This method creates the nodes required for arranging the shapes of q, k, v, after\n the input projection, before the split by head o... | This method creates the nodes required for arranging the shapes of q, k, v, after
the input projection, before the split by head operation.
Args:
graph: Graph to apply the substitution on.
mha_node: MHA node.
q_node: query node after input projection.
k_node: key node after input projection.
v_node... | model_compression_toolkit/core/pytorch/graph_substitutions/substitutions/multi_head_attention_decomposition.py | _arrange_before_split | reuvenperetz/model_optimization | 42 | python | @staticmethod
def _arrange_before_split(graph: Graph, mha_node: BaseNode, q_node: BaseNode, k_node: BaseNode, v_node: BaseNode, params: MHAParams) -> List[BaseNode]:
'\n This method creates the nodes required for arranging the shapes of q, k, v, after\n the input projection, before the split by head o... | @staticmethod
def _arrange_before_split(graph: Graph, mha_node: BaseNode, q_node: BaseNode, k_node: BaseNode, v_node: BaseNode, params: MHAParams) -> List[BaseNode]:
'\n This method creates the nodes required for arranging the shapes of q, k, v, after\n the input projection, before the split by head o... |
72e3b99dab22a2699dcf2a3f66fe4116b98c9ac62812a7282c029273e0b1d0c3 | @staticmethod
def _split_projected(graph: Graph, name: str, q_transpose_node: BaseNode, k_reshape_node: BaseNode, v_transpose_node: BaseNode, params: MHAParams) -> List[BaseNode]:
'\n This method creates the nodes required for splitting q, k, v to query, key and value per head\n (total of num_heads q,... | This method creates the nodes required for splitting q, k, v to query, key and value per head
(total of num_heads q, k and v).
Args:
graph: Graph to apply the substitution on.
name: MHA node name.
q_transpose_node: query node after shape arranging.
k_reshape_node: key node after shape arranging.
v_... | model_compression_toolkit/core/pytorch/graph_substitutions/substitutions/multi_head_attention_decomposition.py | _split_projected | reuvenperetz/model_optimization | 42 | python | @staticmethod
def _split_projected(graph: Graph, name: str, q_transpose_node: BaseNode, k_reshape_node: BaseNode, v_transpose_node: BaseNode, params: MHAParams) -> List[BaseNode]:
'\n This method creates the nodes required for splitting q, k, v to query, key and value per head\n (total of num_heads q,... | @staticmethod
def _split_projected(graph: Graph, name: str, q_transpose_node: BaseNode, k_reshape_node: BaseNode, v_transpose_node: BaseNode, params: MHAParams) -> List[BaseNode]:
'\n This method creates the nodes required for splitting q, k, v to query, key and value per head\n (total of num_heads q,... |
ca0c4fd983a6c7ea40b4f3a5cdff6d58c17effb88c4a29c9556ea4564b7f19b8 | @staticmethod
def _calc_attention_head(graph: Graph, q_in_node: BaseNode, k_in_node: BaseNode, v_in_node: BaseNode, mha_node: BaseNode, head_index: int, params: MHAParams) -> BaseNode:
'\n This method creates the nodes required for attention calc by head\n\n Args:\n graph: Graph to apply th... | This method creates the nodes required for attention calc by head
Args:
graph: Graph to apply the substitution on.
q_in_node: query node after shape arranging.
k_in_node: key node after shape arranging.
v_in_node: value node after shape arranging.
mha_node: MHA node.
head_index: index of the he... | model_compression_toolkit/core/pytorch/graph_substitutions/substitutions/multi_head_attention_decomposition.py | _calc_attention_head | reuvenperetz/model_optimization | 42 | python | @staticmethod
def _calc_attention_head(graph: Graph, q_in_node: BaseNode, k_in_node: BaseNode, v_in_node: BaseNode, mha_node: BaseNode, head_index: int, params: MHAParams) -> BaseNode:
'\n This method creates the nodes required for attention calc by head\n\n Args:\n graph: Graph to apply th... | @staticmethod
def _calc_attention_head(graph: Graph, q_in_node: BaseNode, k_in_node: BaseNode, v_in_node: BaseNode, mha_node: BaseNode, head_index: int, params: MHAParams) -> BaseNode:
'\n This method creates the nodes required for attention calc by head\n\n Args:\n graph: Graph to apply th... |
c02649fa1b9038429bf099b42679d80739e1b598b2a1213d5471cc6a04638a24 | @staticmethod
def _cat_heads_reshape(graph: Graph, name: str, att_head_output_nodes: List[BaseNode], params: MHAParams) -> BaseNode:
'\n This method creates the nodes required for concatenating all heads after attention\n\n Args:\n graph: Graph to apply the substitution on.\n nam... | This method creates the nodes required for concatenating all heads after attention
Args:
graph: Graph to apply the substitution on.
name: MHA node name.
att_head_output_nodes: list of nodes after attention.
params: MHAnode params.
Returns:
Node after cat and reshape. | model_compression_toolkit/core/pytorch/graph_substitutions/substitutions/multi_head_attention_decomposition.py | _cat_heads_reshape | reuvenperetz/model_optimization | 42 | python | @staticmethod
def _cat_heads_reshape(graph: Graph, name: str, att_head_output_nodes: List[BaseNode], params: MHAParams) -> BaseNode:
'\n This method creates the nodes required for concatenating all heads after attention\n\n Args:\n graph: Graph to apply the substitution on.\n nam... | @staticmethod
def _cat_heads_reshape(graph: Graph, name: str, att_head_output_nodes: List[BaseNode], params: MHAParams) -> BaseNode:
'\n This method creates the nodes required for concatenating all heads after attention\n\n Args:\n graph: Graph to apply the substitution on.\n nam... |
e596b327b2e9a66dfea4876472dcc13f0d575cb6fd35f201a5044cd32176ce4e | def _project_output(self, graph: Graph, mha_node: BaseNode, attn_reshape_node: BaseNode, params: MHAParams) -> BaseNode:
'\n This method creates the nodes required for output projecting\n\n Args:\n graph: Graph to apply the substitution on.\n mha_node: MHA node.\n attn... | This method creates the nodes required for output projecting
Args:
graph: Graph to apply the substitution on.
mha_node: MHA node.
attn_reshape_node: attention node.
params: MHAnode params.
Returns:
Node after projection. | model_compression_toolkit/core/pytorch/graph_substitutions/substitutions/multi_head_attention_decomposition.py | _project_output | reuvenperetz/model_optimization | 42 | python | def _project_output(self, graph: Graph, mha_node: BaseNode, attn_reshape_node: BaseNode, params: MHAParams) -> BaseNode:
'\n This method creates the nodes required for output projecting\n\n Args:\n graph: Graph to apply the substitution on.\n mha_node: MHA node.\n attn... | def _project_output(self, graph: Graph, mha_node: BaseNode, attn_reshape_node: BaseNode, params: MHAParams) -> BaseNode:
'\n This method creates the nodes required for output projecting\n\n Args:\n graph: Graph to apply the substitution on.\n mha_node: MHA node.\n attn... |
b3c340f72878e1f1176546040ab8c0d2dfd6a920658bb1abcce9f910e7fd08ad | @staticmethod
def _connect_to_graph(graph: Graph, mha_node: BaseNode, q_node: BaseNode, k_node: BaseNode, v_node: BaseNode, output_permute_node: BaseNode):
'\n connect subgraph to input graph\n Args:\n graph: input graph\n mha_node: MHA node to substitute inputs and outputs with\... | connect subgraph to input graph
Args:
graph: input graph
mha_node: MHA node to substitute inputs and outputs with
q_node: 1st input to MHA node
k_node: 2nd input to MHA node
v_node: 3rd input to MHA node
output_permute_node: output node of MHA node | model_compression_toolkit/core/pytorch/graph_substitutions/substitutions/multi_head_attention_decomposition.py | _connect_to_graph | reuvenperetz/model_optimization | 42 | python | @staticmethod
def _connect_to_graph(graph: Graph, mha_node: BaseNode, q_node: BaseNode, k_node: BaseNode, v_node: BaseNode, output_permute_node: BaseNode):
'\n connect subgraph to input graph\n Args:\n graph: input graph\n mha_node: MHA node to substitute inputs and outputs with\... | @staticmethod
def _connect_to_graph(graph: Graph, mha_node: BaseNode, q_node: BaseNode, k_node: BaseNode, v_node: BaseNode, output_permute_node: BaseNode):
'\n connect subgraph to input graph\n Args:\n graph: input graph\n mha_node: MHA node to substitute inputs and outputs with\... |
91262c8c70d024e8ca5cad2dae6ab8eea023b474a4ed4e06f8cee9f0b8515d41 | def substitute(self, graph: Graph, mha_node: BaseNode) -> Graph:
'\n connect subgraph to input graph\n Args:\n graph: input graph\n mha_node: MHA node to substitute inputs and outputs with\n Returns:\n Graph after applying the substitution.\n '
if mha... | connect subgraph to input graph
Args:
graph: input graph
mha_node: MHA node to substitute inputs and outputs with
Returns:
Graph after applying the substitution. | model_compression_toolkit/core/pytorch/graph_substitutions/substitutions/multi_head_attention_decomposition.py | substitute | reuvenperetz/model_optimization | 42 | python | def substitute(self, graph: Graph, mha_node: BaseNode) -> Graph:
'\n connect subgraph to input graph\n Args:\n graph: input graph\n mha_node: MHA node to substitute inputs and outputs with\n Returns:\n Graph after applying the substitution.\n '
if mha... | def substitute(self, graph: Graph, mha_node: BaseNode) -> Graph:
'\n connect subgraph to input graph\n Args:\n graph: input graph\n mha_node: MHA node to substitute inputs and outputs with\n Returns:\n Graph after applying the substitution.\n '
if mha... |
ddb1462a2a8cace7e123b6e2474c09d3dc1a398e4baa93c275d61dcbadda1771 | def get_rot_matrix(theta):
'\n returns the rotation matrix given a theta value(radians)\n '
return np.asarray([[np.cos(theta), (- np.sin(theta))], [np.sin(theta), np.cos(theta)]]) | returns the rotation matrix given a theta value(radians) | envs/gridworld_drone.py | get_rot_matrix | ranok92/deepirl | 2 | python | def get_rot_matrix(theta):
'\n \n '
return np.asarray([[np.cos(theta), (- np.sin(theta))], [np.sin(theta), np.cos(theta)]]) | def get_rot_matrix(theta):
'\n \n '
return np.asarray([[np.cos(theta), (- np.sin(theta))], [np.sin(theta), np.cos(theta)]])<|docstring|>returns the rotation matrix given a theta value(radians)<|endoftext|> |
e7525739d22209ae7bf567cb7ecc34d1dc3ac123ccb9e8e1275d22861aa535d6 | def draw_obstacle(self, obs):
'\n ped_position : [row, col]\n '
font = pygame.freetype.Font(None, 15)
index = (int(obs['id']) % len(self.ped_images))
self.gameDisplay.blit(self.ped_images[index], ((obs['position'][1] - (self.obs_width / 2)), (obs['position'][0] - (self.obs_width / 2))))
... | ped_position : [row, col] | envs/gridworld_drone.py | draw_obstacle | ranok92/deepirl | 2 | python | def draw_obstacle(self, obs):
'\n \n '
font = pygame.freetype.Font(None, 15)
index = (int(obs['id']) % len(self.ped_images))
self.gameDisplay.blit(self.ped_images[index], ((obs['position'][1] - (self.obs_width / 2)), (obs['position'][0] - (self.obs_width / 2))))
font.render_to(self.gam... | def draw_obstacle(self, obs):
'\n \n '
font = pygame.freetype.Font(None, 15)
index = (int(obs['id']) % len(self.ped_images))
self.gameDisplay.blit(self.ped_images[index], ((obs['position'][1] - (self.obs_width / 2)), (obs['position'][0] - (self.obs_width / 2))))
font.render_to(self.gam... |
2903be17202abd69537513eb2d7f44dcff1a581e6baa96bb03bd69f57792a960 | def generate_annotation_list(self):
'\n Reads lines from an annotation file and creates a list\n '
if (self.annotation_file is not None):
if (not os.path.isfile(self.annotation_file)):
print('The annotation file does not exist.')
exit()
with open(self.annota... | Reads lines from an annotation file and creates a list | envs/gridworld_drone.py | generate_annotation_list | ranok92/deepirl | 2 | python | def generate_annotation_list(self):
'\n \n '
if (self.annotation_file is not None):
if (not os.path.isfile(self.annotation_file)):
print('The annotation file does not exist.')
exit()
with open(self.annotation_file) as f:
for line in f:
... | def generate_annotation_list(self):
'\n \n '
if (self.annotation_file is not None):
if (not os.path.isfile(self.annotation_file)):
print('The annotation file does not exist.')
exit()
with open(self.annotation_file) as f:
for line in f:
... |
55d50b9bf5e2d3f8406261f4082e22b70e29ad70cec63cf42e491c0572eeda4f | def generate_pedestrian_dict(self):
"\n Unlike the annotation dict, where the frames are the keys and the information is stored\n based on each frame. Here the information is stored based on the pedestrians i.e. each pedestrian\n corresponds to a key in the dictionary and the corresponding to t... | Unlike the annotation dict, where the frames are the keys and the information is stored
based on each frame. Here the information is stored based on the pedestrians i.e. each pedestrian
corresponds to a key in the dictionary and the corresponding to that key is a list consisting of the
trajectory information of that pa... | envs/gridworld_drone.py | generate_pedestrian_dict | ranok92/deepirl | 2 | python | def generate_pedestrian_dict(self):
"\n Unlike the annotation dict, where the frames are the keys and the information is stored\n based on each frame. Here the information is stored based on the pedestrians i.e. each pedestrian\n corresponds to a key in the dictionary and the corresponding to t... | def generate_pedestrian_dict(self):
"\n Unlike the annotation dict, where the frames are the keys and the information is stored\n based on each frame. Here the information is stored based on the pedestrians i.e. each pedestrian\n corresponds to a key in the dictionary and the corresponding to t... |
55813f2100740293981bf3a6fc51d9edb5457d2fd0ca67e6764fa5340a971a02 | def generate_annotation_dict_universal(self):
'\n Reads information from files with the following (general) format\n frame , id, y_coord, x_coord\n '
print('Loading information. . .')
subject_final_frame = (- 1)
for entry in self.annotation_list:
if (self.cur_ped is not Non... | Reads information from files with the following (general) format
frame , id, y_coord, x_coord | envs/gridworld_drone.py | generate_annotation_dict_universal | ranok92/deepirl | 2 | python | def generate_annotation_dict_universal(self):
'\n Reads information from files with the following (general) format\n frame , id, y_coord, x_coord\n '
print('Loading information. . .')
subject_final_frame = (- 1)
for entry in self.annotation_list:
if (self.cur_ped is not Non... | def generate_annotation_dict_universal(self):
'\n Reads information from files with the following (general) format\n frame , id, y_coord, x_coord\n '
print('Loading information. . .')
subject_final_frame = (- 1)
for entry in self.annotation_list:
if (self.cur_ped is not Non... |
c6a4f32e91fc97cbddd993b32380726b0bc6910e104db4f5cfc6f9d9f1add71b | def get_state_from_frame_universal(self, frame_info):
'\n For processed datasets\n '
self.obstacles = []
for element in frame_info:
if (float(element[1]) not in self.skip_list):
obs = self.pedestrian_dict[element[1]][str(self.current_frame)]
obs['id'] = element[... | For processed datasets | envs/gridworld_drone.py | get_state_from_frame_universal | ranok92/deepirl | 2 | python | def get_state_from_frame_universal(self, frame_info):
'\n \n '
self.obstacles = []
for element in frame_info:
if (float(element[1]) not in self.skip_list):
obs = self.pedestrian_dict[element[1]][str(self.current_frame)]
obs['id'] = element[1]
self.ob... | def get_state_from_frame_universal(self, frame_info):
'\n \n '
self.obstacles = []
for element in frame_info:
if (float(element[1]) not in self.skip_list):
obs = self.pedestrian_dict[element[1]][str(self.current_frame)]
obs['id'] = element[1]
self.ob... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.