query
stringlengths
9
3.4k
document
stringlengths
9
87.4k
metadata
dict
negatives
listlengths
4
101
negative_scores
listlengths
4
101
document_score
stringlengths
3
10
document_rank
stringclasses
102 values
User or group that owns a resource are granted full access to it.
def __acl__(self): # type: () -> AccessControlListType acl = [] if self.owner_user_id: acl.append((Allow, self.owner_user_id, ALL_PERMISSIONS)) if self.owner_group_id: acl.append((Allow, "group:%s" % self.owner_group_id, ALL_PERMISSIONS)) return acl
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def raise_for_ownership(self, resource: Model) -> None:\n\n # pylint: disable=import-outside-toplevel\n from superset import db\n\n if self.is_admin():\n return\n\n # Set of wners that works across ORM models.\n owners: List[User] = []\n\n orig_resource = db.ses...
[ "0.68418175", "0.6817819", "0.6789879", "0.6402916", "0.63664275", "0.63395506", "0.62749887", "0.62603414", "0.6227944", "0.61531776", "0.61475277", "0.6117667", "0.6108478", "0.6108478", "0.60827714", "0.6073788", "0.6063891", "0.6059636", "0.6057281", "0.6044391", "0.60342...
0.0
-1
List all groups a user belongs to, filtered by UserGroup status type.
def get_groups_by_status(self, status, db_session=None): # type: (UserGroupStatus, Session) -> Set[Str] from magpie.api.management.user.user_utils import get_user_groups_checked cur_session = get_db_session(session=db_session) if db_session else get_db_session(obj=self) group_names = s...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_groups_by_status(self, status, db_session=None):\n # type: (UserGroupStatus, Session) -> List[Str]\n return []", "def list_user_groups(self, user_id):\n resp, body = self.get('users/%s/groups' % user_id)\n self.expected_success(200, resp.status)\n body = json.loads(body...
[ "0.7415561", "0.73563224", "0.7105298", "0.6973147", "0.69514817", "0.69147885", "0.6911052", "0.6895397", "0.6881288", "0.6803313", "0.67458916", "0.6714019", "0.6666444", "0.66410464", "0.662373", "0.66146386", "0.6581608", "0.65467393", "0.6506116", "0.6485276", "0.6473893...
0.74114037
1
Unique identifier of user.
def id(self): # pylint: disable=C0103,invalid-name # considered too short return sa.Column(sa.Integer, primary_key=True, autoincrement=True)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def user_id(self):\n return text_type(hash(self.username))", "def user_id(self):\n # type: () -> string_types\n return self._user_id", "def user_id(self) -> str:\n return self._user_id", "def user_id(self) -> str:\n return self._user_id", "def user_id(self) -> pulumi.Outp...
[ "0.83980703", "0.83578485", "0.82583636", "0.82583636", "0.80136585", "0.79326326", "0.793035", "0.7891192", "0.7879836", "0.787526", "0.787526", "0.78698146", "0.78698146", "0.78485024", "0.78485024", "0.78485024", "0.7817112", "0.7817112", "0.7817112", "0.77998596", "0.7780...
0.0
-1
Password hash of the user.
def user_password(self): return sa.Column(sa.Unicode(256), nullable=False)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _hash_password(self, password):\n passwordhash = bcrypt.hashpw(password.encode('utf8'), bcrypt.gensalt())\n return passwordhash", "def get_password_hash(password):\n\n return pwd_context.hash(password)", "def hash_password(self):\n self.__password = self.str_to_hash(self.__password)...
[ "0.8001551", "0.78925467", "0.78462327", "0.77544147", "0.77429557", "0.76942587", "0.76517755", "0.7613748", "0.75445867", "0.75285655", "0.7505567", "0.74446845", "0.7390829", "0.73609084", "0.7333976", "0.73171544", "0.73148537", "0.73145485", "0.7168403", "0.7168022", "0....
0.0
-1
Email of the user.
def email(self): return sa.Column(sa.Unicode(100), nullable=False, unique=True)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def log_useremail(self):\n return self.user.email", "def get_user_email(self):\n member = self.get_user()\n if member:\n return member.getProperty('email')", "def user_email(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"user_email\")", "def email(self, instan...
[ "0.85852766", "0.8581432", "0.85670006", "0.85598457", "0.8300198", "0.8293188", "0.8293188", "0.8293188", "0.8182699", "0.81291264", "0.8074925", "0.8074925", "0.8074925", "0.8074925", "0.8064869", "0.80555576", "0.7989175", "0.797051", "0.79486954", "0.7945147", "0.79444593...
0.0
-1
Date of user's registration.
def registered_date(self): return sa.Column(sa.TIMESTAMP(timezone=False), default=datetime.datetime.utcnow, server_default=sa.func.now())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def register_date(self):\n\n return self._register_date", "def getUserSignupDate(self):\r\n userinfo = self.getUserInfo()\r\n timestamp = int(float(userinfo[\"signupTimeSec\"]))\r\n return time.strftime(\"%m/%d/%Y %H:%M\", time.gmtime(timestamp))", "def date_registered(self) -> date...
[ "0.77629924", "0.7628828", "0.75674725", "0.7104303", "0.7104303", "0.7104303", "0.7044613", "0.6900152", "0.6883736", "0.6846401", "0.67712206", "0.6744589", "0.65643835", "0.6496458", "0.637149", "0.637149", "0.637149", "0.637149", "0.6331268", "0.6331268", "0.6331268", "...
0.72349703
3
Pending user status is enforced.
def status(self): return UserStatuses.Pending.value
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_set_user_status(self):\n pass", "def user_requested_access(user):\r\n user = CourseCreator.objects.get(user=user)\r\n if user.state != CourseCreator.GRANTED:\r\n user.state = CourseCreator.PENDING\r\n user.save()", "def add_user_with_status_unrequested(user):\r\n _add_use...
[ "0.6903818", "0.6896614", "0.67338765", "0.65549946", "0.6512543", "0.64965606", "0.64672786", "0.6448087", "0.63479024", "0.6328773", "0.62876517", "0.6279613", "0.6199937", "0.6159553", "0.6128632", "0.60768175", "0.60722935", "0.60538155", "0.6050738", "0.60454774", "0.604...
0.7320671
0
Pending user is not a member of any group.
def groups(self): return []
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_user_is_group_member_status_is_not_approved(self):\n group = mommy.make('groups.Group', moderated=True)\n thread = self.create_thread(group=group)\n message = thread.first_message\n message.status = 'pending'\n message.save()\n user = self.create_user()\n u...
[ "0.7792742", "0.7228106", "0.7156203", "0.68756753", "0.6828929", "0.66670585", "0.6643753", "0.66180396", "0.6471787", "0.6458959", "0.6455422", "0.63878495", "0.6336446", "0.63234437", "0.6303333", "0.62873536", "0.6276098", "0.62558997", "0.62484837", "0.6246418", "0.62415...
0.0
-1
Pending user is not a member of any group. Avoid error in case this method gets accessed when simultaneously
def get_groups_by_status(self, status, db_session=None): # type: (UserGroupStatus, Session) -> List[Str] return []
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_user_is_group_member_status_is_not_approved(self):\n group = mommy.make('groups.Group', moderated=True)\n thread = self.create_thread(group=group)\n message = thread.first_message\n message.status = 'pending'\n message.save()\n user = self.create_user()\n u...
[ "0.76340216", "0.7207143", "0.7110575", "0.704016", "0.6954512", "0.6781277", "0.66747254", "0.6671615", "0.6658352", "0.6614824", "0.6579499", "0.6539072", "0.65362036", "0.6525634", "0.6504851", "0.6461988", "0.64528805", "0.63386667", "0.63307506", "0.6271585", "0.62596774...
0.0
-1
Representation of all flags combined.
def all(cls): # type: () -> UserStatuses return UserStatuses(sum(cls.values()))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def flags(self):\n flags = self.Flags\n return [x for x in self.FLAGS_VALUES if flags & x]", "def get_flags(self):\n\n if self.raw.flags not in [0, 1, 2, 3]:\n raise ValueError(\"Invalid raw flags: {}\".format(self.raw.flags))\n\n flags = set()\n\n if (self.raw.flags...
[ "0.72928613", "0.7054312", "0.7045637", "0.69635427", "0.69510907", "0.686271", "0.6807425", "0.646746", "0.6458346", "0.6447968", "0.6439035", "0.63748443", "0.63699955", "0.62179524", "0.6199411", "0.6160184", "0.61336243", "0.6100112", "0.60833067", "0.6059165", "0.6054686...
0.0
-1
Retrieves the user matching the given name.
def by_user_name(cls, user_name, status=None, db_session=None): # pylint: disable=W0237,W0221 # type: (Str, Optional[UserStatuses], Optional[Session]) -> Optional[AnyUser] if status is None or UserStatuses.Pending not in status: return super(UserSearchService, cls).by_user_name(user_name, d...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_user(self, instance, name):\n return instance.get_user(name)", "def get_user(name):\n try:\n return User.objects.get(name=name)\n except ObjectDoesNotExist:\n raise ObjectDoesNotFound(\"There is no user '{}'.\".format(name))", "def get_user(self, name):\n try:\n ...
[ "0.8306725", "0.82802016", "0.81780684", "0.8119794", "0.8105071", "0.8051432", "0.8029481", "0.7894524", "0.78694415", "0.778063", "0.7762436", "0.77618915", "0.7470238", "0.7445575", "0.7416449", "0.74154556", "0.73773164", "0.7369097", "0.7361986", "0.73617166", "0.7350588...
0.7004488
43
Retrieves the first matched user by either name or email, whichever comes first.
def by_name_or_email(cls, user_name, email, status=None, db_session=None): # type: (Str, Str, Optional[UserStatuses], Optional[Session]) -> Optional[AnyUser] db_session = get_db_session(db_session) if status is None or UserStatuses.Pending not in status: query = db_session.query(cls....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_by_name_or_email(self, name_or_email):\n User = tables.User\n user = (\n self.session\n .query(User)\n .filter(or_(\n func.lower(User.user_name) == name_or_email.lower(),\n func.lower(User.email) == name_or_email.lower()\n ...
[ "0.7823106", "0.7675339", "0.7577323", "0.7559361", "0.75093603", "0.7479534", "0.7464798", "0.74502665", "0.7408632", "0.738302", "0.73796195", "0.72978586", "0.72766876", "0.72718614", "0.72718614", "0.72500736", "0.7216743", "0.71987", "0.7193397", "0.71775645", "0.7133463...
0.7112545
22
Administrators have all permissions, user/groupspecific permissions added if user is logged in.
def __acl__(self): # type: () -> AccessControlListType user = self.request.user # allow if role MAGPIE_ADMIN_PERMISSION is somehow directly set instead of inferred via members of admin-group acl = [(Allow, get_constant("MAGPIE_ADMIN_PERMISSION", self.request), ALL_PERMISSIONS)] a...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def has_super_access():\n current_user = frappe.get_doc('User', frappe.session.user)\n roles = set([role.role for role in current_user.roles])\n return bool(roles & {'Administrator', 'Instructor', 'Education Manager', 'System Manager', 'Academic User'})", "def canDo(self,request):\n request.needA...
[ "0.6800246", "0.6705577", "0.6697742", "0.6697566", "0.6669926", "0.66422534", "0.6610092", "0.66090006", "0.6608209", "0.6583466", "0.6532305", "0.64970964", "0.64970964", "0.64784324", "0.6450758", "0.64066356", "0.640475", "0.640475", "0.63832355", "0.6371056", "0.6360135"...
0.7004168
0
Configuration modifiers for parsing access to resources and permissions.
def configuration(self): return sa.Column(sa.JSON(), nullable=True)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __acl__():", "def __base_acl__(self) -> list:\n _acls = [\n (Allow, 'g:professionals', ['list', 'view', 'edit']),\n ]\n return _acls", "def permissions():\n pass", "def __acl__(self):\n yield 'Allow', 'system.Everyone', 'none'\n yield security.DENY_ALL", "def __...
[ "0.6182829", "0.6077709", "0.607764", "0.596731", "0.5722942", "0.57069737", "0.5703722", "0.5693177", "0.56347257", "0.5550067", "0.55394423", "0.55283564", "0.55238104", "0.5513653", "0.5499519", "0.54761636", "0.5459978", "0.5409127", "0.5384876", "0.5371545", "0.53407276"...
0.0
-1
\ Create a sourmash.MinHash object.
def __init__( self, n, ksize, *, is_protein=False, dayhoff=False, hp=False, track_abundance=False, seed=MINHASH_DEFAULT_SEED, max_hash=0, mins=None, scaled=0, ): # support max_hash in constructor, for now. ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_min_hash(shingles: set) -> MinHash:\n track_min_hash = MinHash(num_perm=128)\n for shin in shingles:\n track_min_hash.update(str(shin).encode('utf-8'))\n return track_min_hash", "def _new_lsh_index(self):\n minhashes = {}\n lsh = MinHashLSH(self._config.threshold, self._conf...
[ "0.6668846", "0.6138378", "0.60524726", "0.5971202", "0.58725375", "0.57037383", "0.564662", "0.55130583", "0.5496498", "0.5492963", "0.5479173", "0.54515046", "0.53829676", "0.53736293", "0.5366463", "0.52517533", "0.52490145", "0.52490145", "0.52197444", "0.52121085", "0.51...
0.5461433
11
Convert sequence to hashes without adding to the sketch. If input sequence is DNA and this is a protein, dayhoff, or hp MinHash, translate the DNA appropriately before hashing. If input sequence is protein, set is_protein=True. If `force = True` and `bad_kmers_as_zeroes = True`, invalid kmers hashes will be represented...
def seq_to_hashes(self, sequence, *, force=False, bad_kmers_as_zeroes=False, is_protein=False): if is_protein and self.moltype not in ("protein", "dayhoff", "hp"): raise ValueError("cannot add protein sequence to DNA MinHash") if bad_kmers_as_zeroes and not force: raise ValueEr...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def kmers_and_hashes(self, sequence, *, force=False, is_protein=False):\n import screed\n\n bad_kmers_as_zeroes = False\n if force:\n bad_kmers_as_zeroes = True\n\n sequence = sequence.upper()\n hashvals = self.seq_to_hashes(sequence,\n ...
[ "0.70536274", "0.52695596", "0.4618468", "0.46054563", "0.45912695", "0.45135024", "0.45131776", "0.44705614", "0.4454002", "0.441342", "0.43388784", "0.43345582", "0.4292265", "0.42891702", "0.4284157", "0.42824477", "0.42541516", "0.42230168", "0.4209773", "0.42078424", "0....
0.79699576
0
Convert sequence into (kmer, hashval) tuples without adding it to the sketch. If input sequence is DNA and this is a protein, dayhoff, or hp MinHash, translate the DNA appropriately before hashing. If input sequence is protein, set is_protein=True. If 'force' is True, invalid kmers will be represented with 'None'.
def kmers_and_hashes(self, sequence, *, force=False, is_protein=False): import screed bad_kmers_as_zeroes = False if force: bad_kmers_as_zeroes = True sequence = sequence.upper() hashvals = self.seq_to_hashes(sequence, force=for...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def seq_to_hashes(self, sequence, *, force=False, bad_kmers_as_zeroes=False, is_protein=False):\n\n if is_protein and self.moltype not in (\"protein\", \"dayhoff\", \"hp\"):\n raise ValueError(\"cannot add protein sequence to DNA MinHash\")\n\n if bad_kmers_as_zeroes and not force:\n ...
[ "0.72178686", "0.46786237", "0.4610649", "0.44296953", "0.43184823", "0.43025377", "0.42989746", "0.42802525", "0.42648515", "0.4238355", "0.41944683", "0.41212335", "0.4107931", "0.40976414", "0.40808073", "0.40715283", "0.4070102", "0.40576768", "0.40311107", "0.4011284", "...
0.7367316
0
Add many hashes to the sketch at once. ``hashes`` can be either an iterable (list, set, etc.), or another ``MinHash`` object.
def add_many(self, hashes): if isinstance(hashes, MinHash): self._methodcall(lib.kmerminhash_add_from, hashes._objptr) else: self._methodcall(lib.kmerminhash_add_many, list(hashes), len(hashes))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def insert_hashes(self, song_id: int, hashes, batch_size: int = 1000):\n values = [(song_id, hsh, int(offset)) for hsh, offset in hashes]\n for index in range(0, len(hashes), batch_size):\n helpers.bulk(self.cursor, self.gen_dicts(values[index: index + batch_size]))", "def add_geo_hashes...
[ "0.7200702", "0.6982986", "0.6840817", "0.6506755", "0.6467743", "0.644392", "0.58145267", "0.5784946", "0.56172", "0.5566877", "0.55600774", "0.55239296", "0.54653585", "0.5456146", "0.54462945", "0.5420798", "0.54167813", "0.5377261", "0.5369092", "0.5362217", "0.5318342", ...
0.86459774
0
Remove many hashes from a sketch at once. ``hashes`` can be either an iterable (list, set, etc.), or another ``MinHash`` object.
def remove_many(self, hashes): if isinstance(hashes, MinHash): self._methodcall(lib.kmerminhash_remove_from, hashes._objptr) else: self._methodcall(lib.kmerminhash_remove_many, list(hashes), len(hashes))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete_from_directory_by_hashes(directory, hashes):\n files = os.listdir(directory)\n if hashes == '*':\n for f in files:\n os.unlink(os.path.join(directory, f))\n for f in files:\n for h in hashes:\n if h in f:\n os.unlink(os.path.join(directory, f))...
[ "0.6154905", "0.5956718", "0.58561975", "0.5804606", "0.57617533", "0.5427621", "0.5317934", "0.52789366", "0.5230689", "0.5153228", "0.51266813", "0.5125787", "0.5074242", "0.50469494", "0.4990306", "0.49507", "0.49342737", "0.4907175", "0.48971403", "0.48789588", "0.4843024...
0.87233436
0
Return list of hashes or if ``with_abundance`` a list of (hash, abund).
def get_mins(self, with_abundance=False): mins = self.hashes if not with_abundance: return mins.keys() return mins
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getAbundances(self, species): \n return self.abundance_df[self.abundance_df[self.tax_levels[0]]==species]", "def get_fingerprintable_for_scope(self, bottom_scope, include_passthru=False):\n pairs = []\n if include_passthru:\n pu_args = self.passthru_args_for_scope(bottom_scope)\n ...
[ "0.5129425", "0.5110695", "0.4949431", "0.49324703", "0.48975635", "0.48139", "0.4699067", "0.46907076", "0.46503294", "0.46276388", "0.46026292", "0.4587694", "0.45864993", "0.45608535", "0.45470384", "0.45394257", "0.45306677", "0.44996083", "0.44410548", "0.44238195", "0.4...
0.41494182
79
\ Return the number of hashes in common between ``self`` and ``other``. Optionally downsample ``scaled`` objects to highest ``scaled`` value.
def count_common(self, other, downsample=False): if not isinstance(other, MinHash): raise TypeError("Must be a MinHash!") return self._methodcall(lib.kmerminhash_count_common, other._get_objptr(), downsample)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def contained_by(self, other, downsample=False):\n if not (self.scaled and other.scaled):\n raise TypeError(\"Error: can only calculate containment for scaled MinHashes\")\n denom = len(self)\n if not denom:\n return 0.0\n total_denom = float(denom * self.scaled) #...
[ "0.6858488", "0.58855665", "0.5778567", "0.55397224", "0.54475987", "0.5431119", "0.53659403", "0.53243905", "0.52780986", "0.52514344", "0.5219435", "0.5210827", "0.5207767", "0.5174138", "0.51515955", "0.5135636", "0.51316446", "0.5123332", "0.5106239", "0.5092781", "0.5088...
0.7180194
0
Copy this object and downsample new object to either `num` or `scaled`.
def downsample(self, *, num=None, scaled=None): # first, evaluate provided parameters -- # at least one must be specified! if num is None and scaled is None: raise ValueError('must specify either num or scaled to downsample') # both cannot be specified if num is not...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def downsample(self, number):\n for num, ss in enumerate(self.samples):\n self.samples[num], self.extra_kwargs[num] = _downsample(\n ss, number, extra_kwargs=self.extra_kwargs[num]\n )", "def downsample(self, number):\n self.samples, self.extra_kwargs = _downsam...
[ "0.64299905", "0.6275884", "0.6191262", "0.59493554", "0.5921856", "0.5814289", "0.5767988", "0.5739846", "0.56866455", "0.56520945", "0.55760133", "0.5561418", "0.5542622", "0.55036783", "0.54945916", "0.54945916", "0.54655623", "0.54654604", "0.5453377", "0.5451266", "0.541...
0.7158274
0
If track_abundance=True, return a new flattened MinHash.
def flatten(self): if self.track_abundance: # create new object: a = MinHash( self.num, self.ksize, is_protein=self.is_protein, dayhoff=self.dayhoff, hp=self.hp, track_abundance=False, seed=self.seed, max_hash=self._max_hash ) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def inflate(self, from_mh):\n if not self.track_abundance and from_mh.track_abundance:\n orig_abunds = from_mh.hashes\n abunds = { h: orig_abunds.get(h, 0) for h in self.hashes }\n\n abund_mh = from_mh.copy_and_clear()\n\n abund_mh.downsample(scaled=self.scaled)\n...
[ "0.718268", "0.5613122", "0.48945636", "0.48383635", "0.47822806", "0.46781078", "0.4643958", "0.46218306", "0.4583534", "0.45498845", "0.4548925", "0.45155597", "0.45114824", "0.45092195", "0.4481805", "0.44715574", "0.44415337", "0.4435643", "0.4407659", "0.43675295", "0.43...
0.81907636
0
Calculate similarity of two sketches. If the sketches are not abundance weighted, or ignore_abundance=True, compute Jaccard similarity. If the sketches are abundance weighted, calculate the angular similarity, a distance metric based on the cosine similarity. Note, because the term frequencies (tfidf weights) cannot be...
def similarity(self, other, ignore_abundance=False, downsample=False): return self._methodcall(lib.kmerminhash_similarity, other._get_objptr(), ignore_abundance, downsample)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def jacaard(clusters_a, clusters_b):\n return jaccard_similarity_score(clusters_a, clusters_b)", "def jaccard_similarity_score(x, y):\n intersection_cardinality = len(set(x).intersection(set(y)))\n union_cardinality = len(set(x).union(set(y)))\n return intersection_cardinality / float(union_cardi...
[ "0.66255057", "0.65805817", "0.656553", "0.656553", "0.6544001", "0.64989215", "0.6419974", "0.64119095", "0.6368101", "0.634537", "0.63030934", "0.62782055", "0.6275815", "0.6216541", "0.6167886", "0.61136615", "0.60486466", "0.60355633", "0.6034516", "0.6033509", "0.601564"...
0.6267294
13
Calculate how much of self is contained by other.
def contained_by(self, other, downsample=False): if not (self.scaled and other.scaled): raise TypeError("Error: can only calculate containment for scaled MinHashes") denom = len(self) if not denom: return 0.0 total_denom = float(denom * self.scaled) # would be bet...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def compare(self, other):\n return len(self & other) / max(len(self | other), 1)", "def measure_overlap(self, other):\n return np.dot(self.vector, other.vector)", "def belongs_to(self, other):\n #if isinstance(other, line.Line):\n print other, other.p1, other.p2\n v1 = Vector...
[ "0.7142372", "0.7042324", "0.70301497", "0.66929966", "0.6680324", "0.66532564", "0.6617386", "0.6563072", "0.6559819", "0.6547346", "0.6523871", "0.6453149", "0.64438856", "0.6440018", "0.6414049", "0.64024335", "0.63960457", "0.6393788", "0.63170385", "0.6314169", "0.630946...
0.73098785
0
Calculate average containment ANI.
def avg_containment_ani(self, other, *, downsample=False, prob_threshold=1e-3): if not (self.scaled and other.scaled): raise TypeError("Error: can only calculate ANI for scaled MinHashes") a1 = self.containment_ani(other, downsample=downsample, prob_threshold=prob_threshold).ani a2 =...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def calc_adv_anisotropy(self):\n num_atoms = 0\n adv_aniso = 0.0\n\n for atm in self:\n try:\n adv_aniso += atm.calc_anisotropy()\n except ZeroDivisionError:\n pass\n else:\n num_atoms += 1\n\n return adv_anis...
[ "0.6131125", "0.61068237", "0.6103669", "0.59636074", "0.59305656", "0.5822768", "0.5814111", "0.58053005", "0.5790873", "0.5778367", "0.5771074", "0.57672966", "0.5677806", "0.567333", "0.5669914", "0.56641656", "0.56623226", "0.5660298", "0.56546426", "0.5651552", "0.564000...
0.65388435
0
Set abundances for hashes from ``values``, where ``values[hash] = abund`` If ``abund`` value is set to zero, the ``hash`` will be removed from the sketch. ``abund`` cannot be set to a negative value.
def set_abundances(self, values, clear=True): if self.track_abundance: hashes = [] abunds = [] for h, v in values.items(): hashes.append(h) if v < 0: raise ValueError("Abundance cannot be set to a negative v...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fill(self, value, indices=None):\n # TODO deal with underflow and overflow and do the doc + optimize the function\n\n # change the value array to an array of Histogram index to be modified\n hist_indices = ((value - self.bin_edges[0]) // self.bin_width).astype(int)\n\n # treat overf...
[ "0.49861008", "0.49133873", "0.4886975", "0.48074695", "0.47927505", "0.4771163", "0.4770385", "0.4706151", "0.47045323", "0.46872026", "0.46551254", "0.46551254", "0.46293232", "0.46113256", "0.4601353", "0.4601353", "0.45550853", "0.45334214", "0.45271662", "0.45200193", "0...
0.8501885
0
return a new MinHash object with abundances taken from 'from_mh'
def inflate(self, from_mh): if not self.track_abundance and from_mh.track_abundance: orig_abunds = from_mh.hashes abunds = { h: orig_abunds.get(h, 0) for h in self.hashes } abund_mh = from_mh.copy_and_clear() abund_mh.downsample(scaled=self.scaled) a...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def flatten(self):\n if self.track_abundance:\n # create new object:\n a = MinHash(\n self.num, self.ksize,\n is_protein=self.is_protein, dayhoff=self.dayhoff, hp=self.hp,\n track_abundance=False, seed=self.seed, max_hash=self._max_hash\n ...
[ "0.6652322", "0.5897634", "0.56669325", "0.5633293", "0.55306464", "0.5507406", "0.53579575", "0.5319949", "0.52097255", "0.5134658", "0.511404", "0.5101854", "0.5089661", "0.5068611", "0.4992265", "0.49728736", "0.49419758", "0.49392864", "0.49388367", "0.48303932", "0.48239...
0.7799836
0
Approximate total number of hashes (num_hashes scaled).
def unique_dataset_hashes(self): if not self.scaled: raise TypeError("can only approximate unique_dataset_hashes for scaled MinHashes") # TODO: replace set_size with HLL estimate when that gets implemented return len(self) * self.scaled # + (self.ksize - 1) for bp estimation
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def totalhashes(self):\n return np.sum(self.counts)", "def num_hashes(self):\n # see comment in constructor for self.hashes\n return self.config.num_hashes", "def get_total_rehashes(self):\n return self.count_rehashes", "def getSize(hash) -> int:\r\n sum = 0\r\n i = 0\r\n while i...
[ "0.80154234", "0.7362063", "0.71793133", "0.67978984", "0.66877574", "0.6673941", "0.6402338", "0.6303968", "0.62771624", "0.6252882", "0.6237176", "0.6233178", "0.61219335", "0.6053896", "0.6004548", "0.59454817", "0.5944629", "0.58806014", "0.58799136", "0.58773786", "0.587...
0.6069469
13
Init POE client with Client.
def __init__(self, client): self.__route_tag = "wallet-ng" self.__path = "poe" self.__client = client
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def client_setup(self):\n self.client = Client()", "def init_client(self, client):\n self.client = client", "def init_client():\n init_config()\n begin_sending_packets()", "def __init__(self, client):\n\n self.client = client", "def __init__(self, client):\n self._client =...
[ "0.7610452", "0.71959406", "0.6672331", "0.66443336", "0.6611263", "0.6593158", "0.6565757", "0.6509013", "0.6351874", "0.6317083", "0.631571", "0.6284267", "0.62508565", "0.62507164", "0.62332183", "0.61497575", "0.6126292", "0.6111684", "0.61055666", "0.6097409", "0.6090317...
0.6434195
8
Set wallet client header
def __set_header(self, header): if APIKEYHEADER not in header: header[APIKEYHEADER] = self.__client.get_apikey() if ROUTETAG not in header: header[ROUTETAG] = self.__route_tag if FABIOROUTETAGHEADER not in header: header[FABIOROUTETAGHEADER] = self.__route_ta...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_header( name, value ):", "def setHeader(k, v):", "def SetHeader(self, window):\n window.SetName(\"header\")\n window.SetBackgroundColour(wx.GetApp().settings.header_bg_color)\n window.SetForegroundColour(wx.GetApp().settings.header_fg_color)\n window.SetFont(wx.GetApp().sett...
[ "0.63789934", "0.6275574", "0.61759233", "0.61481667", "0.6141458", "0.6005986", "0.59728193", "0.5948228", "0.5886777", "0.5886777", "0.57172865", "0.57135797", "0.5706888", "0.5656401", "0.5647001", "0.5627201", "0.55987096", "0.5559345", "0.55211395", "0.55181426", "0.5504...
0.61821043
2
Create a POE with ed25519 signed body.
def create_with_sign(self, header, creator, created, privateB64, payload, nonce=""): payload = json.dumps(payload) req_path = "create" method = self.__client.do_post signature = build_signature_body( creator, created, nonce, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def make_pose(self, position, orientation, frame):\n\n pose = PoseStamped()\n pose.header.frame_id = frame\n pose.pose.position.x = position[0]\n pose.pose.position.y = position[1]\n pose.pose.position.z = position[2]\n pose.pose.orientation.w = orientation[0]\n pose.pose.orientation.x = orien...
[ "0.536952", "0.5362856", "0.5151448", "0.5143484", "0.51104677", "0.5083384", "0.50697607", "0.50141406", "0.4996712", "0.49757397", "0.49587664", "0.49465784", "0.48925436", "0.48520038", "0.4849136", "0.48143065", "0.48096073", "0.48053464", "0.47664648", "0.47503638", "0.4...
0.45374873
38
Update a POE with ed25519 signed body.
def update_with_sign(self, header, creator, created, privateB64, payload, nonce=""): payload = json.dumps(payload) req_path = "update" method = self.__client.do_put signature = build_signature_body( creator, created, nonce, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update(self, es, **kwargs):\n pass", "def PUT(self):\n # Check upload size\n body = self.request.get('BODYFILE')\n checkUploadSize(self.context, body)\n\n # If the module is published, do a transparent checkout\n if self.context.state == 'published':\n sel...
[ "0.5396008", "0.5233669", "0.51176083", "0.5099346", "0.50415975", "0.5001394", "0.48802826", "0.48533717", "0.48500893", "0.48342696", "0.48286116", "0.47969967", "0.47862893", "0.476743", "0.47657263", "0.47657263", "0.47657263", "0.47657263", "0.4737093", "0.47227287", "0....
0.51079416
3
Fit an LDA on corpus of reviews, apply to corpus of labeled reviews, show a heatmap comparing the two, and print the best ROC AUC scores associated with each topic.
def compareToManual(reviews, vectorized_revs, coded_reviews_df, vectorized_coded_revs, n_topics=20, alpha=0.1, eta=0.01): n = n_topics a = alpha b = eta print "Topics: {}, Alpha: {}, Beta: {}".format(n, a, b) ldalda = lda.LDA(n_topics=n, alpha=a, eta=b, refresh=1000, random_stat...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def compareToManual2(reviews, vectorized_revs, coded_reviews_df,\n vectorized_coded_revs, n_topics=20, alpha=0.1, eta=0.01):\n n = n_topics\n a = alpha\n b = eta\n print \"Topics: {}, Alpha: {}, Beta: {}\".format(n, a, b)\n\n ldalda = lda.LDA(n_topics=n, alpha=a, eta=b, refresh=1...
[ "0.7269275", "0.6819381", "0.66611135", "0.63078994", "0.6253986", "0.6162204", "0.59881806", "0.5941095", "0.5862071", "0.5853435", "0.5849609", "0.58387995", "0.5799318", "0.57985353", "0.57822347", "0.57719165", "0.5741003", "0.57404876", "0.5738016", "0.5728622", "0.56738...
0.71987164
1
Fit an LDA on corpus of reviews, apply to corpus of labeled reviews, show a heatmap comparing the two, and print the best average precision scores associated with each topic.
def compareToManual2(reviews, vectorized_revs, coded_reviews_df, vectorized_coded_revs, n_topics=20, alpha=0.1, eta=0.01): n = n_topics a = alpha b = eta print "Topics: {}, Alpha: {}, Beta: {}".format(n, a, b) ldalda = lda.LDA(n_topics=n, alpha=a, eta=b, refresh=1000, random_st...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def compareToManual(reviews, vectorized_revs, coded_reviews_df,\n vectorized_coded_revs, n_topics=20, alpha=0.1, eta=0.01):\n n = n_topics\n a = alpha\n b = eta\n print \"Topics: {}, Alpha: {}, Beta: {}\".format(n, a, b)\n\n ldalda = lda.LDA(n_topics=n, alpha=a, eta=b, refresh=100...
[ "0.6815605", "0.6638938", "0.6487869", "0.64365166", "0.631679", "0.6159404", "0.6149328", "0.61167663", "0.60183966", "0.59977394", "0.59427494", "0.5931884", "0.5887719", "0.5854915", "0.58348775", "0.5807241", "0.57867366", "0.57603186", "0.5757726", "0.5748361", "0.574495...
0.7218424
0
Fit an LDA on corpus of reviews, apply to corpus of labeled reviews, show a heatmap comparing the two, and print the best ROC AUC scores associated with each topic.
def compareToManualNoPrint(reviews, vectorized_revs, coded_reviews_df, vectorized_coded_revs, n_topics=20, alpha=0.1, eta=0.01): n = n_topics a = alpha b = eta ldalda = lda.LDA(n_topics=n, alpha=a, eta=b, refresh=1000, random_state=1) ldalda.fit(vectorized_revs) cat_array =...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def compareToManual2(reviews, vectorized_revs, coded_reviews_df,\n vectorized_coded_revs, n_topics=20, alpha=0.1, eta=0.01):\n n = n_topics\n a = alpha\n b = eta\n print \"Topics: {}, Alpha: {}, Beta: {}\".format(n, a, b)\n\n ldalda = lda.LDA(n_topics=n, alpha=a, eta=b, refresh=1...
[ "0.72696346", "0.71990746", "0.66610795", "0.63089925", "0.6251594", "0.61621875", "0.598813", "0.5940928", "0.5862699", "0.5852273", "0.5847392", "0.58371717", "0.58000183", "0.5799821", "0.57811666", "0.5771259", "0.5742007", "0.57394266", "0.57394177", "0.5728231", "0.5671...
0.68196964
2
Fit an LDA on corpus of reviews, apply to corpus of labeled reviews, show a heatmap comparing the two, and print the best average precision scores associated with each topic.
def compareToManual2(reviews, vectorized_revs, coded_reviews_df, vectorized_coded_revs, n_topics=20, alpha=0.1, eta=0.01): n = n_topics a = alpha b = eta ldalda = lda.LDA(n_topics=n, alpha=a, eta=b, refresh=1000, random_state=1) ldalda.fit(vectorized_revs) cat_array = ldal...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def compareToManual2(reviews, vectorized_revs, coded_reviews_df,\n vectorized_coded_revs, n_topics=20, alpha=0.1, eta=0.01):\n n = n_topics\n a = alpha\n b = eta\n print \"Topics: {}, Alpha: {}, Beta: {}\".format(n, a, b)\n\n ldalda = lda.LDA(n_topics=n, alpha=a, eta=b, refresh=1...
[ "0.7218726", "0.6816323", "0.6489072", "0.6436522", "0.631909", "0.6159944", "0.6148784", "0.61179227", "0.60166854", "0.599941", "0.59446496", "0.5932613", "0.5886966", "0.58527917", "0.5836098", "0.5808099", "0.5787791", "0.5760561", "0.5759848", "0.5748608", "0.57465607", ...
0.6640452
2
Return a dictionary with the best topic(s) for each manuallycoded category in a given LDA implementation.
def bestTopics(lda_imlementation, vectorized_coded_revs, coded_reviews_df): cat_array = lda_imlementation.transform(vectorized_coded_revs) topic_array = [] for i in range(lda_imlementation.n_topics): coded_reviews_df['topic_'+str(i)] = cat_array[:, i] topic_array += ['topic_'+str(i)] be...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def classify(listOfTopics):\n result = []\n\n def catForTop(regexes, topic):\n for pattern in regexes:\n if re.match(pattern, topic):\n return True\n return False\n\n for category, regexes in categ.iteritems():\n for topic in listOfTopics:\n if cat...
[ "0.62541837", "0.615619", "0.59741247", "0.5844138", "0.5826542", "0.56770694", "0.5632976", "0.56197286", "0.5603382", "0.5563707", "0.55546796", "0.5553891", "0.55335194", "0.54931045", "0.5483634", "0.54618126", "0.5451501", "0.5444643", "0.5411199", "0.54071236", "0.54065...
0.62596416
0
Print the ROC and PrecisionRecall curves for a given manuallycoded topic
def getCurves(lda_imlementation, vectorized_coded_revs, column, best_tops, coded_reviews_df): cat_array = lda_imlementation.transform(vectorized_coded_revs) topic_array = [] for i in range(lda_imlementation.n_topics): coded_reviews_df['topic_'+str(i)] = cat_array[:, i] topic_a...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def metrics(labels, preds_proba, print_metrics=True, plot=False, threshold=0.5, rounded=4):\n \n\n test_fpr, test_tpr, test_thresholds = roc_curve(labels, preds_proba)\n roc_auc = auc(test_fpr, test_tpr)\n preds = preds_proba_to_preds_class(preds_proba,threshold)\n precision = precision_score(labels...
[ "0.6867683", "0.65134686", "0.64943665", "0.6467826", "0.6446851", "0.6406306", "0.63933426", "0.6356165", "0.6293545", "0.6268827", "0.626617", "0.62420744", "0.62159014", "0.61956275", "0.61634284", "0.61632425", "0.6136987", "0.6112013", "0.6014178", "0.601159", "0.5978724...
0.65519303
1
Get the threshold associated with the lowest distance from (0,1) on the ROC curve on the test set of data
def bestThreshold(lda_imlementation, vectorized_coded_revs, column, best_tops, coded_reviews_df): cat_array = lda_imlementation.transform(vectorized_coded_revs) topic_array = [] for i in range(lda_imlementation.n_topics): coded_reviews_df['topic_'+str(i)] = cat_array[:, i] ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_threshold(true_values, predictions, target_fpr=None, target_tpr=None):\n if target_fpr is None and target_tpr is None:\n raise AttributeError('Specify one of TPR and FPR')\n if target_fpr and target_tpr:\n raise AttributeError('Specify only one of TPR and FPR')\n prev_threshold = Non...
[ "0.66580945", "0.6444057", "0.6400157", "0.63673306", "0.63546443", "0.6320526", "0.63043606", "0.63043606", "0.6285651", "0.6224342", "0.6223859", "0.6221799", "0.614567", "0.6099748", "0.6095427", "0.6085509", "0.60432005", "0.6024577", "0.6018095", "0.6017837", "0.60176045...
0.6188567
12
Get the threshold associated with the lowest distance from (1,1) on the PR curve on the test set of data
def bestThreshold2(lda_imlementation, vectorized_coded_revs, column, best_tops, coded_reviews_df): cat_array = lda_imlementation.transform(vectorized_coded_revs) topic_array = [] for i in range(lda_imlementation.n_topics): coded_reviews_df['topic_'+str(i)] = cat_array[:, i] ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def selectThreshold(yval, pval):\n bestEpsilon = 0\n bestF1 = 0\n F1 = 0\n\n stepsize = (pval.max()-pval.min())/1000\n for epsilon in np.arange(pval.min(), pval.max()+stepsize/2, stepsize):\n predictions = (pval < epsilon)\n tp = ((predictions == 1) & (yval == 1)).sum()\n fp = (...
[ "0.6609041", "0.6518175", "0.6476939", "0.64539623", "0.6442797", "0.6442797", "0.64084864", "0.6396371", "0.63451254", "0.62821597", "0.62765723", "0.6247047", "0.6234266", "0.6234266", "0.6234266", "0.6234266", "0.6234266", "0.62273365", "0.6191945", "0.61529285", "0.614345...
0.0
-1
Get the threshold associated with the highest precision score with a recall over 0.5 on the test set.
def bestThreshold3(lda_imlementation, vectorized_coded_revs, column, best_tops, coded_reviews_df): cat_array = lda_imlementation.transform(vectorized_coded_revs) topic_array = [] for i in range(lda_imlementation.n_topics): coded_reviews_df['topic_'+str(i)] = cat_array[:, i] ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sensitivity(\n targets: List[int], preds: List[float], threshold: float = 0.5\n) -> float:\n return recall(targets, preds, threshold)", "def compute_average_precision_with_recall_thresholds(precision, recall, recall_thresholds):\n average_precision = 0.\n for t in recall_thresholds:\n p = ...
[ "0.6814696", "0.67940784", "0.67078286", "0.66985404", "0.6654105", "0.66287464", "0.662756", "0.6626417", "0.6616618", "0.6520469", "0.6428051", "0.6424526", "0.64114165", "0.6362104", "0.63491356", "0.6346132", "0.63300794", "0.6323249", "0.63190925", "0.6309129", "0.628664...
0.609557
36
Return the accuracy, precision, and recall scores for the LDA best topics at a specified threshold.
def restaurantSummary(lda_imlementation, vectorized_coded_revs, column, best_tops, coded_reviews_df, threshold): cat_array = lda_imlementation.transform(vectorized_coded_revs) topic_array = [] for i in range(lda_imlementation.n_topics): coded_reviews_df['topic_'+str(i)] = cat_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def accuracy(targets: List[int], preds: List[float], threshold: float = 0.5) -> float:\n hard_preds = [1 if p > threshold else 0 for p in preds]\n return accuracy_score(targets, hard_preds)", "def accuracy(targets: List[int], preds: Union[List[float], List[List[float]]], \n threshold: float = 0...
[ "0.64222395", "0.6375575", "0.63511735", "0.63081896", "0.62514776", "0.6224346", "0.6222285", "0.62132895", "0.6194228", "0.60833067", "0.60274947", "0.59365594", "0.58683616", "0.5866562", "0.5864479", "0.5833923", "0.58299327", "0.5820002", "0.57736564", "0.57727057", "0.5...
0.0
-1
Helper function to parse FASTA format.
def _parseHelper(fastaInput): desc, sequence = "", [] for rline in fastaInput: line = rline.rstrip() if not line: break elif line[0] == ">": if sequence: yield desc, ''.join(sequence) sequence = [] desc = line[1:] ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse(record):\n\n #Extract individual parts of the FASTA record\n\n identifier = record.id #The sequence's Id\n sequence = record.seq #The sequence itself\n sequence = sequence.upper() #Turns all the nucleotides to upper case\n\n return identifier, sequence", "def fasta_parser(filename):\n ...
[ "0.7274786", "0.69850767", "0.68240386", "0.681288", "0.67535675", "0.67449456", "0.6639561", "0.6625132", "0.6602403", "0.6532851", "0.6463741", "0.64551425", "0.6444978", "0.64182776", "0.64099056", "0.6380498", "0.6380498", "0.6379367", "0.6350089", "0.6333042", "0.6317286...
0.6463049
11
Takes a file or stdin of FASTA format and returns a generator of tuples of the form (description, sequence).
def parse(f=None): f = f if f else sys.stdin return _parseHelper(f)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fasta_read_generator(file_handler):\r\n seq = []\r\n name = ''\r\n for line in file_handler:\r\n if line[0] == '>':\r\n sequence = ''.join(seq)\r\n if name: # only yield when we already have all data for the first sequence\r\n yield name, sequence\r\n ...
[ "0.7582308", "0.75391984", "0.74770594", "0.74419016", "0.7362299", "0.7289525", "0.72521764", "0.72396266", "0.71881384", "0.7154771", "0.7140987", "0.7096524", "0.705887", "0.7015823", "0.6997083", "0.6976023", "0.695372", "0.67821014", "0.67700106", "0.6726168", "0.6718865...
0.0
-1
Takes a string in FASTA format and returns a generator of tuples of the form (description, sequence).
def parseStr(s): return _parseHelper(s.split("\n"))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _parseHelper(fastaInput):\n\n desc, sequence = \"\", []\n\n for rline in fastaInput:\n line = rline.rstrip()\n if not line:\n break\n elif line[0] == \">\":\n if sequence: \n yield desc, ''.join(sequence)\n sequence = []\n ...
[ "0.7326887", "0.7128683", "0.7113521", "0.7091112", "0.69642293", "0.6934219", "0.6915862", "0.69089323", "0.6875257", "0.6860623", "0.6812091", "0.6750901", "0.6702442", "0.6691692", "0.66584575", "0.66439056", "0.65764606", "0.65017074", "0.6489449", "0.6401183", "0.6375456...
0.0
-1
Get absolute path to resource, works for dev and for PyInstaller
def resource_path(relative_path): try: # PyInstaller creates a temp folder and stores path in _MEIPASS base_path = sys._MEIPASS except Exception: base_path = os.path.abspath(".") return os.path.join(base_path, relative_path)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_resource_path():\n return os.path.join(os.path.dirname(__file__), \"resources\") + os.path.sep", "def resourcePath(relative):\r\n try:\r\n # PyInstaller creates a temp folder and stores path in _MEIPASS\r\n base_path = sys._MEIPASS\r\n except Exception:\r\n base_path = os.pa...
[ "0.8369502", "0.82807344", "0.82486343", "0.8139249", "0.81141466", "0.80987823", "0.8094279", "0.8079923", "0.8067883", "0.80675626", "0.806267", "0.806267", "0.806267", "0.806267", "0.806267", "0.806267", "0.806267", "0.8057104", "0.8054725", "0.8040472", "0.802546", "0.8...
0.8045005
30
creation d'une matrice TF
def create_Tf_matrix( corpus, filename_npz="../data/tfidf/data_tf.npz", filename_features="../data/tfidf/data_feature_names.pkl", ): vectorizer = CountVectorizer(max_features=len(corpus)) X = vectorizer.fit_transform(corpus) print("-Vectorized matrix, ", X.toarray().shape) print(" first lin...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __create_tf_matrix(alpha, a, d, q):\n\n tf_matrix = Matrix([[cos(q), -sin(q), 0., a],\n [sin(q) * cos(alpha), cos(q) * cos(alpha), -sin(alpha), -sin(alpha) * d],\n [sin(q) * sin(alpha), cos(q) * sin(alpha), cos(alpha), cos(alpha) * d],\n ...
[ "0.65090847", "0.6471617", "0.63259995", "0.6289696", "0.6289696", "0.61118096", "0.60890025", "0.5977189", "0.59724253", "0.5962874", "0.59621626", "0.59424025", "0.59026086", "0.5890263", "0.5879501", "0.5878053", "0.5868499", "0.58639187", "0.5857934", "0.5849375", "0.5841...
0.61494327
5
clean dataset and create tf and tfidf
def load_clean_and_generate_tf_idf(fname="../data/tfidf/data_gbif.json"): print(" load dataset, and clean") dataset = read_clean_dataset(fname) print("- Verification:") display(dataset.head()) dataset["freq"] = dataset["terms"].apply(lambda x: FreqDist(x)) # fdist1 : frequence dans le tableau...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def calculate_tfidf(self):\n\n # Add extra columns to clean_dataset from orignial's one\n self.clean_dataframe['overview'], self.clean_dataframe['id'] = self.original_dataframe['overview'], self.original_dataframe['id']\n\n # Define a TF-IDF Vectorizer Object\n tfidf = TfidfVectorizer(s...
[ "0.7173557", "0.7045647", "0.67401963", "0.6647575", "0.6620768", "0.65987486", "0.6561512", "0.65604633", "0.6551854", "0.6520853", "0.65108556", "0.6459472", "0.64554656", "0.644694", "0.64379877", "0.6422224", "0.6319287", "0.63025856", "0.6291027", "0.62812567", "0.628116...
0.6759573
2
Load tfidf weights function
def load_tfidf( filename_npz="../data/tfidf/data_tfidf.npz", filename_features="../data/tfidf/data_tfidf_feature_names.pkl", vectorizer_path="../data/tfidf/tfidf_vectorizer.pickle", transform_example=True, ): """ Input filenames: tfidf, feature names, vectorizer Output: - data name...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fwordweights(self):\n return self.prefix + 'wordweights.txt'", "def tf_idf_weight(self, term: str, doc_path: str) -> float:\n return self.tf(term, doc_path) * self.idf(term)", "def compute_tfidf_weights(train_set, test_set, vocab_size):\n\n transformer = TfidfTransformer()\n\n # fit idf...
[ "0.65269595", "0.63434577", "0.62860996", "0.62207264", "0.6178997", "0.6118679", "0.60200256", "0.59942776", "0.59112453", "0.5907915", "0.58879375", "0.5880849", "0.5867318", "0.5844076", "0.5825634", "0.57969457", "0.5782009", "0.57659227", "0.57593393", "0.57479084", "0.5...
0.6539936
0
transform query in vector
def transform_query(vectorizer_model, query): x_request = vectorizer_model.transform(query) x0 = x_request.toarray() return x0
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_vector(self, query: list):\n if len(query) == 0:\n raise BadQueryParameter(\"Query (list) can not be empty.\")\n\n return self.vectorizer.transform(query)", "def _to_full_vector(self, query_vector: List[Tuple[str, float]]) -> np.array:\n terms = list(self.index.get_terms()...
[ "0.7272707", "0.7058692", "0.67857337", "0.66777563", "0.6566718", "0.59476966", "0.5946633", "0.5905197", "0.58603555", "0.58545816", "0.5836491", "0.58132166", "0.5806235", "0.5802026", "0.57763594", "0.5758559", "0.5726149", "0.5724695", "0.5701889", "0.56733346", "0.56565...
0.7367226
0
Makes a Java method signature dictionary from an index name.
def index_signature(self, name, max_occurs, level, dummy=False): sig = super(Java, self).index_signature(name, max_occurs, level, dummy) sig['argtype'] = 'int' return sig
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _index_key(self, sig, codegen):\n return (sig, codegen.magic_tuple())", "def _index_key(self, sig, codegen):\n codebytes = self._py_func.__code__.co_code\n if self._py_func.__closure__ is not None:\n cvars = tuple([x.cell_contents for x in self._py_func.__closure__])\n ...
[ "0.6284271", "0.60923684", "0.5586627", "0.53634715", "0.5330007", "0.5301372", "0.5275142", "0.52688384", "0.52358294", "0.51993", "0.51993", "0.51993", "0.51993", "0.51993", "0.51993", "0.51993", "0.51993", "0.51993", "0.51993", "0.51993", "0.51993", "0.51993", "0.51993...
0.6338364
0
Create a language by name.
def create(language, namespace, templatepath): lang = None if language == "Java": lang = Java(namespace, templatepath) else: raise ModelProcessingError( "Invalid language: %s" % language) return lang
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def newlang(self, context, *args):\n if not can_manage_roles(context):\n await context.channel.send(MODO_FORBIDDEN)\n elif len(args) < 1:\n await context.channel.send(LANG_MISSING)\n else:\n server = context.message.guild\n lang = normalize(arg...
[ "0.6586048", "0.6550716", "0.6433656", "0.6432657", "0.6195935", "0.61141795", "0.59539646", "0.58287704", "0.57442343", "0.56215405", "0.55952775", "0.5560401", "0.5523971", "0.54916435", "0.5489181", "0.5480538", "0.54681754", "0.5450814", "0.5428346", "0.5425264", "0.54123...
0.69454414
0
that takes a string k and an int OR float v as arguments and returns a tuple. The first element of the tuple is the string k. The second element is the square of the int/float v and should be annotated as a float.
def to_kv(k: str, v: typing.Union[int, float]) -> typing.Tuple[str, float]: return k, v * v
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_kv(k: str, v: Union[int, float]) -> Tuple[str, float]:\n my_tuple = (k, v*v)\n\n return my_tuple", "def to_kv(k: str, v: Union[int, float]) -> Tuple[str, float]:\n return (k, v**2)", "def to_kv(k: str, v: Union[int, float]) -> Tuple[str, float]:\n return (k, pow(v, 2))", "def scale_tuple(t...
[ "0.75295675", "0.7492524", "0.7131809", "0.618519", "0.57764864", "0.577548", "0.57631207", "0.5656854", "0.56116706", "0.5492086", "0.54710186", "0.54518414", "0.54417", "0.5429412", "0.5414349", "0.53929144", "0.53553355", "0.5290045", "0.5274288", "0.5266954", "0.52394044"...
0.7365849
2
Generates a reasonable testname for parameterized function tests
def name_func(func, num, params): return "%s_%s_%s" % ( func.__name__, int(num), parameterized.to_safe_name('_'.join((params.args[0].__name__, params.args[1].__name__))) )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _generate_test_name(source):\n out = source.replace(' ', '_').replace(':', '').replace(',', '').lower()\n return \"test_%s\" % out", "def _testcase_name(testcase):\n name = os.path.splitext(os.path.basename(testcase))[0]\n name = name.replace('-', '_')\n name = 'test_{name}'.format(name=name)\...
[ "0.7779143", "0.76314366", "0.71898866", "0.70460093", "0.6980619", "0.6900053", "0.68684584", "0.68013304", "0.6687702", "0.66859245", "0.6642913", "0.65910894", "0.6530609", "0.6525812", "0.6522183", "0.6518864", "0.64357144", "0.63761574", "0.63758713", "0.63667077", "0.63...
0.61440754
30
Expected to be close to fairly high accuracy
def test_t(self): assert np.isclose(self.stepper.t, self.final_t)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def accuracy(self):", "def test_compute_unnormalized_scores(self):\n # todo: implement this test!\n pass", "def get_expected_cost(self):", "def test_calculate_all_metrics_precision():\n pass", "def test_analytical_vs_numerical():\n pass", "def test_a_variety_of_precisions(self):\n\n ...
[ "0.7370364", "0.6453732", "0.6180218", "0.61739737", "0.61366445", "0.61108375", "0.6097134", "0.5979966", "0.59543765", "0.5939013", "0.59265757", "0.5920299", "0.5920299", "0.58981127", "0.58981127", "0.58801347", "0.5879768", "0.5876902", "0.58555824", "0.5842415", "0.5839...
0.0
-1
Expected to be close, but only within a few digits
def test_q(self): assert np.allclose(self.stepper.q, self.ODE.exact(self.stepper.t), rtol=1e-3, atol=1e-5)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def testConvert(self):\n for i in range(100):\n AB = 10 + i/10.0\n wave = 1000 + 100*i\n f = (10**(-2.406/2.5))*(10**(-0.4*AB))/(wave**2)\n AB_new = -2.5*math.log10(f) - 5*math.log10(wave) - 2.406\n #print \"AB=\",AB,\" wave=\",wave, \" f=\",f, \" AB_...
[ "0.6254778", "0.6233245", "0.62250596", "0.6141581", "0.6082517", "0.60696006", "0.6049742", "0.60286385", "0.6021646", "0.6015881", "0.6014569", "0.60016376", "0.60005903", "0.5984762", "0.5972035", "0.59383065", "0.59322846", "0.59322846", "0.5924956", "0.59069437", "0.5893...
0.0
-1
Tests whether the rate of convergence is close enough to what's expected
def test_convergence(ODE, alg, expected_rate): final_t = 5*ODE.dt_init dts = [ODE.dt_init/2**i for i in range(4)] steppers = [alg(0, dt, ODE.q_init, ODE.A) for dt in dts] for s in steppers: s.stepUntil(final_t) errs = [np.linalg.norm(s.q - ODE.exact(s.t), ord=np.inf) for s in steppers] ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_convergenceRates():\n dt_start = 1.0; num_dt = 10\n E_values = zeros(num_dt)\n T = 10.; g = 9.81; m = 50.; Cd = 1.2; rho = 1.0; A = 0.5;\n a = Cd*rho*A/(2.*m)\n \n dt = zeros(num_dt); dt[0] = dt_start\n for i in range(1,len(dt)):\n dt[i] = dt[i-1]/2.\n \n D = -0.39; B = 0...
[ "0.73033756", "0.71997285", "0.70893884", "0.67220837", "0.6642169", "0.66098773", "0.6596448", "0.6596448", "0.6596448", "0.65688455", "0.6530523", "0.65262824", "0.6523298", "0.64186007", "0.64098674", "0.64098674", "0.6359748", "0.6358357", "0.62825835", "0.62649417", "0.6...
0.72973317
1
Implicit algorithms will detect whether or not A is sparse and build an identity matrix that matches. This may fail.
def test_sparsity_detection(ODE, alg): stepper = alg(0, ODE.dt_init, ODE.q_init, ODE.A) assert ODE.__name__.startswith('Sparse') == sp.issparse(stepper.I)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _identity_sparse(d, stype=\"csr\", dtype=complex):\n return sp.eye(d, dtype=dtype, format=stype)", "def test_build_classification_matrix_sparse():\n import scnym\n\n # generate a sparse matrix with ~10% of elements filled\n B = np.zeros((100, 10))\n ridx = np.random.choice(B.size, size=100, re...
[ "0.68242675", "0.6718077", "0.66813797", "0.64510334", "0.6438231", "0.6424529", "0.63288724", "0.6323402", "0.6150004", "0.61323166", "0.61043763", "0.60686755", "0.60384846", "0.60135704", "0.59981954", "0.5988093", "0.59876406", "0.59853727", "0.5976748", "0.5964551", "0.5...
0.0
-1
Look for (letter) that does not follow a reasonable pattern A reasonable pattern here is 1,2,3...22,1,2,3 Report on lines that go "off" This can be done by subtracting both indices. If the result % 22 is not 1 and the second index is not 1, then an issue can be reported.
def reasonble_order(index_a, index_b): if (index_b - index_a) % 22 != 1: if index_b != 1: return False return True
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sticky_count_wrapper(fwd_str):\n length = len(fwd_str)\n count = 0\n rev_index = length-1\n for index in range(length/2):\n # print fwd_str[index], \" \", fwd_str[rev_index - index]\n if get_opposite_character(fwd_str, index) is not fwd_str[rev_index-index]:\n # print \"Bre...
[ "0.5752483", "0.5689012", "0.5653587", "0.5587004", "0.54908335", "0.5340193", "0.5302039", "0.53004813", "0.5293347", "0.52346474", "0.5197106", "0.5185929", "0.51823324", "0.5180201", "0.5173208", "0.5169704", "0.5165643", "0.5148156", "0.5119101", "0.5116015", "0.51105726"...
0.6369563
0
Locate Potential Siman transitions in source file.
def find_transitions(self): def transition(index_a, index_b): if None in (index_a, index_b): return False return (index_b - index_a) % 22 != 1 and index_b == 1 simanim = [] seif_values = (None, None) siman_start, count = 0, 0 new_seif_ref ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def FindSourceForPath(self, path):\n ret = self._FindSourceForPathInternal(path)\n if not ret and path not in self._unmatched_paths:\n if self.unmatched_paths_count < 10:\n logging.warning('Could not find source path for %s', path)\n self._unmatched_paths.add(path)\n return ret", "def m...
[ "0.49302799", "0.48568365", "0.47693655", "0.46251163", "0.4614407", "0.46104053", "0.45840618", "0.4575503", "0.45740053", "0.45691812", "0.45679146", "0.45640233", "0.45638812", "0.4530316", "0.45296425", "0.452781", "0.4522902", "0.4509619", "0.44888696", "0.44862807", "0....
0.54480284
0
1) Get number of Seifim in each siman from base 2) Find locations where a split can be made 3) For each split location calculate deviation from base text 4) Get location with lowest deviation 5) Check that the split is within a reasonable distance from expected 6) Make the split
def resolve_merge(self, merge_index, max_diff=3): merged_siman = self.commentary_simanim[merge_index] expected_refs = (self.base_simanim[merge_index]['total_refs'], self.base_simanim[merge_index+1]['total_refs']) split_locations, count = [], 0 for line_num, line in enumerate(self.source_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def minimum_spanning_arborescence(sol):", "def get_split_positions(read, min_gap):\n cigar = read.cigar\n # Cigar string is a list of tuples:\n if len(read.cigar) <= 1:\n return [] # no break points = empty list of break point positions\n\n ##\n # read has break points if cigar string is lo...
[ "0.58702636", "0.58141214", "0.56263816", "0.56098175", "0.56064355", "0.5591489", "0.5505442", "0.54941434", "0.5477648", "0.546505", "0.5457885", "0.5432776", "0.54293835", "0.54233766", "0.53762805", "0.5371227", "0.53563607", "0.5327634", "0.53155303", "0.530765", "0.5300...
0.0
-1
Creates directories for each interval if it doesn't exist.
def create_directories(intervals): if not os.path.exists(DIR_PATH): os.mkdir(DIR_PATH) for interval in intervals: path_to_interval = os.path.join(DIR_PATH, interval) if not os.path.exists(path_to_interval): os.mkdir(path_to_interval)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_dirs(self):\n for new_directory in [self.event_dir, self.event_dir / 'videos']:\n new_directory.mkdir(exist_ok=self.overwrite)\n logger.debug('Dir {} created', new_directory)", "def create_directories(working_dir, timesteps):\n\tfor time in timesteps:\n\t\tpath = working_d...
[ "0.6597959", "0.6580007", "0.65335095", "0.63984984", "0.6259434", "0.62133235", "0.61995745", "0.61928344", "0.6172793", "0.6109969", "0.6108993", "0.60512817", "0.6040164", "0.60076576", "0.5994967", "0.5981499", "0.5962351", "0.5959587", "0.5959587", "0.59394664", "0.59265...
0.862203
0
Requests the data from the binance API and save them into a csv file.
def request_binance_data(tickers_intervals, starting_date, ending_date): for ticker, interval in tickers_intervals: print( "Getting historical data for the ticker {} with {} interval".format( ticker, interval ) ) try: csvfile = open( ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def run(self):\n page = self.fetch_data(self.url)\n stock_list = self.pop_stock_list(page)\n self.write_csv(stock_list)", "def get_tweet_data(session, analytics_account, start_time, end_time, user_agent):\n\n export_url = \"https://analytics.twitter.com/user/\" + analytics_account + \"/tw...
[ "0.6569897", "0.6283327", "0.62760055", "0.61615914", "0.61234707", "0.6120113", "0.6115126", "0.6093527", "0.6017526", "0.5874016", "0.58038586", "0.5790349", "0.5780595", "0.5764296", "0.57519084", "0.5732458", "0.5716796", "0.5682941", "0.5639221", "0.56356066", "0.5628201...
0.62043154
3
Requests the data from the binance API and updates the corresponding csv file.
def update_binance_data(tickers_intervals): for ticker, interval in tickers_intervals: try: path_to_file = os.path.join(DIR_PATH, interval, f"{ticker}.csv") csvfile = pd.read_csv(path_to_file, index_col=False, delimiter=",") starting_date = datetime.utcfromtimestamp( ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def run(self):\n page = self.fetch_data(self.url)\n stock_list = self.pop_stock_list(page)\n self.write_csv(stock_list)", "def update(self):\n try:\n response = requests.get(\n self.API_URL, headers=self.API_HEADERS, timeout=15)\n except requests.excep...
[ "0.6643283", "0.66069555", "0.6505497", "0.6037143", "0.60138357", "0.5998581", "0.5954024", "0.5906363", "0.578054", "0.5707935", "0.5688188", "0.565734", "0.5653172", "0.5602184", "0.55642736", "0.5554812", "0.5539957", "0.5532375", "0.55239487", "0.5520941", "0.5510955", ...
0.6307683
3
Return a pandas.DataFrame index by (bid, cid) that describes all bundles sent by this generator
def list_bundles(self): if not self.monitor or len(self.sent) == 0: idx = pd.MultiIndex(levels=[[],[]], labels=[[],[]], names=['bid', 'cid']) df = pd.DataFrame(index=idx) else: df = pd.DataFrame([b.to_dict() for b in self.sent]) if self.monitor else pd.DataFrame() ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def bc_records_dataframe(self, run_idxs):\n\n return pd.DataFrame(self.bc_records(run_idxs))", "def bidlist_dataset_0():\n\n bm = BidManager()\n bm.add_bid(1, 3, 0, True, 0)\n bm.add_bid(2, 4, 1, True, 0)\n bm.add_bid(5, 1, 2, True, 0)\n\n bm.add_bid(4, 2, 3, False, 0)\n bm.add_bid(1, 1,...
[ "0.5892857", "0.5550518", "0.55504996", "0.54173326", "0.54075223", "0.53586096", "0.52566284", "0.52546877", "0.5214352", "0.5155566", "0.51374453", "0.51234156", "0.5113576", "0.49608386", "0.49301657", "0.4924111", "0.49180183", "0.49081022", "0.48970145", "0.48886904", "0...
0.8060786
0
The predicted data volume [bits] that this generator should generate over the course of the simulation
def predicted_data_vol(self): pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def predicted_data_vol(self):\n return sum(f['DataRate']*((f['EndTime']-f['StartTime']).total_seconds())\n for f in self.flows.values())", "def generated_data_vol(self):\n return sum(b.data_vol for b in self.sent) if self.monitor else -1", "def get_bias(self):", "def predictio...
[ "0.6459967", "0.62028074", "0.5957427", "0.5926649", "0.5706994", "0.5704624", "0.56800926", "0.56749916", "0.5606429", "0.5591035", "0.5588136", "0.5583251", "0.55683047", "0.5554941", "0.55469924", "0.55372185", "0.55228543", "0.55228543", "0.5499534", "0.54864234", "0.5485...
0.74574953
0
Return the total data volume in [bits] generated during the simulation
def generated_data_vol(self): return sum(b.data_vol for b in self.sent) if self.monitor else -1
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def total_volume(self):", "def total_volume(self):\n return self.length * self.width * self.height", "def total_volume(self):\n v = self.cell_edges\n v = np.abs(v[-1] - v[0])\n return v", "def volume(self):\n return sum([x[\"counter_volume\"] for x in self.usage])", "def ...
[ "0.7522965", "0.7364082", "0.6998253", "0.67592776", "0.6741069", "0.6725422", "0.6710091", "0.6601255", "0.6586164", "0.6522993", "0.6516385", "0.63422596", "0.63369596", "0.6237777", "0.620324", "0.6192584", "0.61785847", "0.6159002", "0.61426187", "0.61349785", "0.60980326...
0.6779526
3
Determines whether a digraph has an Eulerian cycle using necessary
def __satisfies_necessary_and_sufficient_conditions(g): # Condition 0: at least 1 Edge if g.get_E() == 0: return False # Condition 1: indegree(v) == outdegree(v) for every vertex for v in range(g.get_V()): if g.outdegree() != g.indegree(v): return ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def IsEulerGraph(self):\n\n for node in self.nodes:\n if ((len(node.neighbours) % 2) == 1) or (len(node.neighbours) == 0):\n return False\n return True", "def has_cycle(self):\n traversed = dict()\n for i in self.adj_list:\n traversed[i] = False\n\...
[ "0.7150784", "0.6967263", "0.6805899", "0.66196024", "0.65940124", "0.6437873", "0.6399398", "0.6397124", "0.6361732", "0.6266571", "0.6244261", "0.6220773", "0.62039936", "0.6185866", "0.6182098", "0.61817515", "0.6156103", "0.61271423", "0.6117882", "0.61110204", "0.6077214...
0.0
-1
Applies the transformation to the given record (each channel individually).
def __call__(self, record): filtered_signal = self.filter_signal(record.p_signal, record.fs) record.p_signal = filtered_signal return record
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def transform(self, record):\n if not record:\n return None\n\n # If we've got a list, hope it's a list of records. Recurse,\n # calling transform() on each of the list elements in order and\n # return the resulting list.\n if type(record) is list:\n results...
[ "0.682318", "0.6734652", "0.5955765", "0.5545773", "0.55429924", "0.5540069", "0.5540069", "0.55038536", "0.5415301", "0.533934", "0.53311086", "0.5329576", "0.532138", "0.5289746", "0.523335", "0.52302307", "0.51941043", "0.5190431", "0.51837724", "0.51816636", "0.5160706", ...
0.5125071
23
Initializes the lowpass filter transform.
def __init__(self, filter_order=DEFAULT_ORDER, cutoff_freq_hz=DEFAULT_CUTOFF_HZ, zero_phase=False): self.filter_order = filter_order self.cutoff_freq_hz = cutoff_freq_hz self.zero_phase = zero_phase
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initialize_filter(self):\n shape = self.filter_size + (self.input_shape[-1], self.channels)\n self.filter = self.filter_initializer(shape)", "def init_lowpass(self, lowpass_cutoff, lowpass_order):\n if lowpass_cutoff > 0 or self._fs_out < self._fs_in:\n nyquist = self._fs_out / 2\n ...
[ "0.71257824", "0.69304144", "0.6555534", "0.6120017", "0.6084653", "0.60113204", "0.5995528", "0.59895056", "0.5938458", "0.59226346", "0.5891828", "0.5877485", "0.58576745", "0.5845463", "0.5776792", "0.5764046", "0.5754724", "0.5754182", "0.57263845", "0.5714722", "0.571025...
0.54970545
38
Applies the transformation to the given record (each channel individually).
def __call__(self, record): fs = record.fs signal = record.p_signal filtered_signal = self.filter_signal(signal, fs) record.p_signal = filtered_signal return record
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def transform(self, record):\n if not record:\n return None\n\n # If we've got a list, hope it's a list of records. Recurse,\n # calling transform() on each of the list elements in order and\n # return the resulting list.\n if type(record) is list:\n results...
[ "0.68219125", "0.6733875", "0.59566206", "0.5545259", "0.55415004", "0.55399793", "0.55399793", "0.55021054", "0.5416756", "0.53393054", "0.5331073", "0.532867", "0.5321212", "0.5288621", "0.52311057", "0.5193767", "0.51904297", "0.51828617", "0.5181918", "0.5160857", "0.5149...
0.5231336
14
Encodes a tree to a single string.
def serialize(self, root): output = [] stack = [] depth = self.depth(root) if depth == 0: return [] if depth == 1: return [root.val] nodes = sum([ pow(2, i) for i in range(depth)]) #print(depth, nodes) stack.append(root) whi...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def tree_to_string(tree):\n if type(tree) == Tree:\n return sum(list(map(tree_to_string, tree.children)), [])\n else:\n return [str(tree)]", "def serialize(node, tree=\"\"):\n \n \n if (not node): #Base case\n tree += \"# \"\n return tree\n tree += (str(node.val) + \" ...
[ "0.72254354", "0.7174656", "0.70803744", "0.706792", "0.7032909", "0.7030312", "0.7020698", "0.69704413", "0.6961067", "0.69334626", "0.692108", "0.6879218", "0.6797347", "0.6790119", "0.6790119", "0.6789466", "0.67704153", "0.6743968", "0.6743425", "0.6740732", "0.67361337",...
0.0
-1
Decodes your encoded data to tree.
def deserialize(self, data): if len(data) == 0: return None levels = math.log(len(data) + 1)/math.log(2) #print("Total levels", levels) root = TreeNode(data[0]) stack = [root] curr_elem = 1 if levels == 1: return root while len(stac...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def deserialize(self, data):\n # if data:\n # root = TreeNode(data.pop(0))\n # # root.val = data.pop\n if not data:\n return None\n data = data.split(' ')\n data = iter(data)\n\n def resucsbuild():\n try:\n val = next(dat...
[ "0.75936663", "0.7466042", "0.70945126", "0.7064568", "0.70590705", "0.7052731", "0.7051215", "0.70471644", "0.70444036", "0.7037396", "0.6991945", "0.6987029", "0.69762975", "0.6933306", "0.6910262", "0.6891147", "0.68765485", "0.6839685", "0.6830137", "0.6817978", "0.681678...
0.6914585
14
[push Uart cmd from tx queue] low level thread will pop from queue and send out through UART
def ll_uart_write(self,payload): self._uart_tx_queue.put(payload)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _writeloop(self):\r\n while self._ll_alive:\r\n ## Add a thread lock\r\n if not self._uart_tx_queue.empty():\r\n data = self._uart_tx_queue.get()\r\n #clear the response list before send the command\r\n #self._uart_rx_queue.clear()\r\n ...
[ "0.66928667", "0.6398725", "0.63527435", "0.62069845", "0.61590314", "0.6157856", "0.60016", "0.5952931", "0.5904423", "0.5897935", "0.588016", "0.5866585", "0.58618385", "0.5804746", "0.5801713", "0.5795519", "0.57902974", "0.57520497", "0.5742806", "0.5721507", "0.570523", ...
0.7002497
0
[read UART cmd response from rx queue] low level thread will push the cmd response to cmd response queue read response timeout {[int]} is defined in uart_set_cmd_timeout
def ll_uart_read(self,length): data='' time_begin = time.time() while True: #time_cnt = time.time() - time_begin # if int(time_cnt) >= self._ll_rx_timeout: # print(time_cnt) # print(len(data)) # r...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read_response(self):\n counter = 0\n rx_pkt_done = 0\n while not rx_pkt_done:\n uart_status, tx_buff_full, tx_buff_empty, rx_buff_full, rx_buff_empty, rx_pkt_done = self.x10g_rdma.read_uart_status()\n counter += 1\n if counter == 15001:\n pri...
[ "0.7008674", "0.66590804", "0.65142477", "0.6502266", "0.6422981", "0.6408763", "0.63308805", "0.631603", "0.62394845", "0.62173307", "0.6190415", "0.6115748", "0.60996723", "0.6096799", "0.6092437", "0.60453486", "0.59815246", "0.5939977", "0.5918316", "0.5904503", "0.589894...
0.66863877
1
[Set the UART cmd response timeout in seconds]
def ll_uart_set_cmd_timeout(self,timeout = 10): self._ll_rx_timeout = timeout
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ll_uart_get_cmd_timeout(self):\r\n\r\n return self._ll_rx_timeout", "def timeout_soft_cmd(cmd, timeout):\n return \"timeout %us stdbuf -o0 -e0 %s\" % (timeout, cmd)", "def set_timeout(self, timeout):\n self.timeout = timeout", "def settimeout(self,timeout=10):\r\n # Update\r\n self.tim...
[ "0.66830313", "0.6530053", "0.64408445", "0.62874025", "0.62863076", "0.6161473", "0.6140921", "0.6140921", "0.61132824", "0.61115474", "0.6086067", "0.60817987", "0.6053637", "0.60268223", "0.60268223", "0.6000394", "0.59900683", "0.5971973", "0.5971272", "0.5958285", "0.595...
0.8114786
0
[Get the UART cmd response timeout in seconds]
def ll_uart_get_cmd_timeout(self): return self._ll_rx_timeout
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_timeout(self) -> int:", "def ReceiveTimeout(self) -> int:", "def ReceiveTimeout(self) -> int:", "def PortStatResponseTimeOut(self):\n\t\treturn self._get_attribute('portStatResponseTimeOut')", "def gettimeout(self):\r\n return self.sock.gettimeout()", "def gettimeout(self):\r\n retu...
[ "0.7125122", "0.7082056", "0.7082056", "0.6860464", "0.6838888", "0.6838888", "0.67672056", "0.67672056", "0.67382956", "0.66543394", "0.66427517", "0.6604122", "0.66004556", "0.65860885", "0.658583", "0.6533469", "0.6510287", "0.65024114", "0.6463812", "0.6463812", "0.645507...
0.83621186
0
Stops the read thread, waits for it to exit cleanly, then closes the underlying serial port
def ll_uart_close(self): self._ll_alive = False self._rxThread.join(0.5) self._txThread.join(0.5) self._uart_rx_queue.queue.clear() self._uart_tx_queue.queue.clear()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def stop(self):\n self._stop.set()\n self.logger.debug('stop reading from serial port')\n if self.is_alive():\n self.join()\n self.logger.info('reader has terminated')", "def stop_read_thread(self):\r\n\r\n if self._serial_thread is not None:\r\n self._rea...
[ "0.83227324", "0.81050825", "0.80037993", "0.76284707", "0.74462587", "0.72237104", "0.6966307", "0.68550265", "0.6703806", "0.6591638", "0.6576251", "0.65576845", "0.6527528", "0.6520647", "0.65014255", "0.6499536", "0.6498317", "0.64452666", "0.64118624", "0.6409018", "0.63...
0.64197177
18
Read thread main loop Reads data from the connected device
def _readloop(self): while self._ll_alive: with self._rx_lock: data = self._Random(1) if len(data) != 0: # check for timeout self._uart_rx_queue.put(data)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _read_thread(self):\r\n\r\n while self._reading and self._serial_object:\r\n if self._serial_object.in_waiting:\r\n try:\r\n (raw_data, parsed_data) = self._ubxreader.read()\r\n # if raw_data:\r\n # ...
[ "0.7554161", "0.7444901", "0.70899904", "0.7055979", "0.69975317", "0.69514054", "0.6769293", "0.6760793", "0.6735775", "0.6703721", "0.6666021", "0.6625009", "0.66217315", "0.66095257", "0.6576406", "0.6538009", "0.6517359", "0.6484256", "0.6460147", "0.644426", "0.64310706"...
0.70762557
3
Read cmd from TX FIFO queue and send to DUT through UART write the cmd to the connected device
def _writeloop(self): while self._ll_alive: ## Add a thread lock if not self._uart_tx_queue.empty(): data = self._uart_tx_queue.get() #clear the response list before send the command #self._uart_rx_queue.clear() #self...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def comTxRx(self, cmd, dataOut, length):\n if DEBUG > 1: sys.stderr.write(\"* comTxRx()\\n\")\n txFrame = b''\n rxHeader = 0\n rxNum = 0\n\n #Transmitting part ----------------------------------------\n #Prepare data for transmit\n if (length % 2) != 0:...
[ "0.65904266", "0.6548552", "0.651658", "0.64164895", "0.6373682", "0.6316957", "0.6248871", "0.62212783", "0.61636835", "0.6133203", "0.6131311", "0.60935014", "0.6089493", "0.59446883", "0.58937997", "0.5891209", "0.5850071", "0.58347493", "0.57909673", "0.57822806", "0.5753...
0.6315484
6
http request post method decorator
def post_required(func): def post_wrapper(request,*args,**kwds): res = http.ResponseBuilder() if request.method != 'POST': return res.error("post is required").build_json() return func(request,*args,**kwds) return post_wrapper
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def http_post(self, **kwargs):\n return self.rabjcallable.post(**kwargs)", "def _post(self, *args, **kwargs):\n return self._request('post', *args, **kwargs)", "def post(self, *args, **kwargs):\n self.request(\"post\", *args, **kwargs)", "def post(url):\n url = add_slash(url)\n\n d...
[ "0.7253687", "0.7175989", "0.7127153", "0.7121864", "0.71176344", "0.6982174", "0.6923865", "0.6902044", "0.6831165", "0.680928", "0.6719412", "0.66592175", "0.6649926", "0.6649604", "0.663869", "0.66328883", "0.65493155", "0.654111", "0.6518876", "0.6516656", "0.6516092", ...
0.7152784
2
Register two NIFTI volumes containing landmarks
def register_landmarks(fname_src, fname_dest, dof, fname_affine='affine.txt', verbose=1, path_qc='./'): from msct_image import Image # open src label im_src = Image(fname_src) # coord_src = im_src.getNonZeroCoordinates(sorting='value') # landmarks are sorted by value coord_src = im_src.getCoordinat...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_registered_image_layers(\n viewer: napari.Viewer, *, registration_directory: pathlib.Path\n) -> Tuple[napari.layers.Image, napari.layers.Labels]:\n layers: List[LayerDataTuple] = []\n\n meta_file = (registration_directory / \"brainreg.json\").resolve()\n if meta_file.exists():\n with ope...
[ "0.50881785", "0.5056109", "0.49519038", "0.4912301", "0.4879457", "0.4813697", "0.4787528", "0.4785143", "0.46455887", "0.46359158", "0.46346763", "0.46140108", "0.45900747", "0.4589501", "0.45878723", "0.45546374", "0.4543802", "0.45378584", "0.45247677", "0.45247677", "0.4...
0.54319185
0
Compute sum of squared error between pairwise landmarks
def SSE(pointsA, pointsB): return sum(array(pointsA[:, 0:3]-pointsB[:, 0:3])**2.0)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mse(self):\n xs, ys = self.R.nonzero()\n predicted = self.full_matrix()\n error = 0\n for x, y in zip(xs, ys):\n # print(predicted[x, y], self.R[x, y] )\n error += pow(self.R[x, y] - predicted[x, y], 2)\n return np.sqrt(error)", "def rmse2 (a, p) :\n ...
[ "0.65895677", "0.6588133", "0.6415059", "0.6338098", "0.6315696", "0.631417", "0.6205466", "0.6133671", "0.6129634", "0.6095342", "0.608772", "0.6043297", "0.60194534", "0.6008844", "0.5990452", "0.59714705", "0.59372824", "0.59342045", "0.5901768", "0.58844507", "0.5880896",...
0.0
-1
Cost function to minimize
def minimize_transform(params, points_dest, points_src, constraints): # initialize dof dof = [0, 0, 0, 0, 0, 0, 1, 1, 1] # initialize dictionary to relate constraints index to dof dict_dof = {'Tx': 0, 'Ty': 1, 'Tz': 2, 'Rx': 3, 'Ry': 4, 'Rz': 5, 'Sx': 6, 'Sy': 7, 'Sz': 8} # extract constraints l...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def costFun(self, S, x):", "def cost(self) -> float:", "def compute_cost(AL, Y):\n pass", "def compute_cost(AL, Y):\n pass", "def costFun(self, x):\n\ttmp = x.reshape(self.inp_shape)\n\tc = np.float64(self.calcCost(np.asarray(tmp,dtype=np.float32))) + self.alpha * np.dot(x.T, x)\n\treturn c", "...
[ "0.7898446", "0.71774364", "0.71197855", "0.7037681", "0.7032501", "0.6972743", "0.69694555", "0.6966542", "0.6868792", "0.68444115", "0.68282765", "0.6827418", "0.67984587", "0.6764421", "0.6761392", "0.6750837", "0.67058235", "0.66833335", "0.66763395", "0.6667288", "0.6642...
0.0
-1
Compute affine transformation to register landmarks
def getRigidTransformFromLandmarks(points_dest, points_src, constraints='Tx_Ty_Tz_Rx_Ry_Rz', verbose=0, path_qc='./'): # TODO: check input constraints from scipy.optimize import minimize # initialize default parameters init_param = [0, 0, 0, 0, 0, 0, 1, 1, 1] # initialize parameters for optimizer ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def transform(self,image,landmarks,s0=None):\n if s0 is None:\n s0 = np.array([[127.6475, 227.8161], [79.1608, 87.0376], [176.8392, 87.0376]], np.float32)\n idx = [8,36,45] #\"\"\"Anchor points\"\"\"\n pts = np.float32(landmarks[idx,:])\n M = cv2.getAffineTransform(pts,s0)\n ...
[ "0.6571072", "0.641823", "0.6383142", "0.634022", "0.62523025", "0.62054753", "0.62054753", "0.61710006", "0.6121375", "0.6112866", "0.6077915", "0.6075933", "0.60051006", "0.5994395", "0.59378403", "0.59053254", "0.58875793", "0.58756226", "0.5864575", "0.5862957", "0.583515...
0.0
-1
This is the identity block
def identity_block(self,X,stage,block): conv_name_base='res'+str(stage)+block+'_branch' bn_name_base='bn'+str(stage)+block+'_branch' #retrieve the filters #F1,F2,F3=filters X_shortcut=X #first component of main path X=Conv3D(self.filter,...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def makeIdentity(self) -> None:\n ...", "def setIdentity(self) -> None:\n ...", "def test_create_identity(self):\n pass", "def identity(cls):\n return super().identity(4, 4)", "def confirm_identity(self):\n self.__not_implemented()", "def next_identity(self) -> UserId:\...
[ "0.71393317", "0.65090305", "0.6266525", "0.6132871", "0.6096772", "0.60785687", "0.6077503", "0.6056983", "0.6046447", "0.59905106", "0.5987439", "0.5978849", "0.5946789", "0.5917424", "0.5910534", "0.589202", "0.58327717", "0.5799545", "0.57756495", "0.5773348", "0.57540077...
0.0
-1
Onehot encoding is applied to columns specified in a pandas DataFrame.
def encode_onehot(df, cols): vec = DictVectorizer() vec_data = pd.DataFrame(vec.fit_transform(df[cols].to_dict(orient='records')).toarray()) vec_data.columns = vec.get_feature_names() vec_data.index = df.index df = df.drop(cols, axis=1) df = df.join(vec_data) return df
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def one_hot_encode(df, colnames):\r\n for col in colnames:\r\n oh_df = get_dummies(df[col], prefix=col)\r\n df = concat([oh_df, df], axis=1)\r\n df = df.drop([col], axis=1)\r\n return df", "def one_hot(input_df, columns):\n df = input_df.copy()\n\n for col in columns:\n du...
[ "0.83890945", "0.83782166", "0.8353686", "0.8352055", "0.83429927", "0.83196855", "0.8312187", "0.8312064", "0.82263744", "0.8203636", "0.78942597", "0.7849938", "0.78145325", "0.7612664", "0.7542009", "0.7526136", "0.75124633", "0.7379414", "0.7350976", "0.72332495", "0.7226...
0.8227697
8
execute all ci stages in one run
def all_(tag, field_tests, img_passwd_file, registry, install_server_hostname, quiet, builder): manager = Manager( 'all', tag, registry_url=registry, field_tests=field_tests, img_passwd_file=img_passwd_file, install_server_hostname=install_server_hostname, verbose=not quiet, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _run_ci_test():\n _run_install(False)\n _run_coverage_html(False)\n _run_typecheck_xml(False)\n _run_lint(True)", "def run(self):\n self._build_docker_images()\n self._build_docker_image_test()\n self._run_workflow_in_matrix_of_envs()", "def _run_ci_publish():\n _run_ins...
[ "0.7215023", "0.6739235", "0.67389643", "0.6676614", "0.63964593", "0.6364255", "0.6358811", "0.6307575", "0.62078595", "0.5984018", "0.5947946", "0.59442085", "0.59306777", "0.5906521", "0.5804627", "0.57899594", "0.5749922", "0.57092535", "0.56613225", "0.56181085", "0.5615...
0.0
-1
build one or more images
def build(images, tag, quiet): # images to build build_images = None # list of available images image_list = build_image_map().keys() # image specified: check if it exists if images: build_images = [] for check_name in images: if check_name in image_list: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def build_filler_images(self):", "def _build_docker_images(self):\n print(f\"+ building {len(self.neurodocker_specs)} Docker images\")\n self.docker_status = []\n for sha1, neurodocker_dict in self.neurodocker_specs.items():\n try:\n print(\"++ building image: {}\"....
[ "0.7279872", "0.7093156", "0.7073595", "0.6907964", "0.67056745", "0.66842973", "0.66243804", "0.66157806", "0.6573795", "0.651644", "0.64935124", "0.64864373", "0.6419387", "0.63917524", "0.63883257", "0.63883257", "0.63883257", "0.6385622", "0.637723", "0.63701296", "0.6363...
0.7616135
0
execute the cleanup stage
def cleanup(tag, keepimg, builder): manager = Manager('cleanup', tag, keepimg=keepimg, builder_hostname=builder) manager.run()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cleanup():", "def cleanup(self):\r\n logging.info(\"entered the cleanup\")", "def cleanup(self):", "def cleanup(self):", "def cleanup(self):", "def cleanup(self):\n\n pass", "def cleanup(self):\n pass", "def cleanup(self):\n pass", "def cleanup(self):\n pass",...
[ "0.8597375", "0.8467043", "0.8215665", "0.8215665", "0.8215665", "0.81636655", "0.81482863", "0.81482863", "0.81482863", "0.81482863", "0.81482863", "0.81482863", "0.81482863", "0.81482863", "0.81482863", "0.81482863", "0.81482863", "0.81438214", "0.8142126", "0.8112586", "0....
0.0
-1
execute the client integration tests
def clitest(tag, field_tests, img_passwd_file, install_server_hostname, custom_cli_subnet, custom_db_subnet, builder): manager = Manager( 'clitest', tag, field_tests=field_tests, img_passwd_file=img_passwd_file, install_server_hostname=install_server_hostname, custom_cli_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_for_client():", "def runTests(self):\n \n pass", "def runtest(self):", "def test_basic_execution(self):", "def test_integration1(self):\n self._test_integration(1)", "def run_integration_tests():\n run_pytest('integration')\n return redirect(url_for('main.test_reports', re...
[ "0.7719503", "0.7161856", "0.7011778", "0.69300866", "0.6815633", "0.67563385", "0.67350364", "0.6734357", "0.6718839", "0.6702629", "0.6696539", "0.6628397", "0.65992844", "0.65992844", "0.6576469", "0.65701425", "0.65472716", "0.65330935", "0.6529378", "0.6528179", "0.65236...
0.0
-1
start and keep services running until manually stopped
def run(tag, devmode, img_passwd_file, install_server_hostname, custom_cli_subnet, custom_db_subnet, clitests, builder): manager = Manager( 'run', tag, devmode=devmode, img_passwd_file=img_passwd_file, install_server_hostname=install_server_hostname, custom_cli_subnet=custom_cli_subn...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ensure_running_service_daemon(context):\n svc = Management()\n if svc._check_if_its_up(usutil.UBERSERVER):\n context.temp_service_daemon = None\n else:\n svc.start()\n context.temp_service_daemon = svc", "def startServices():\n # dnsmasq\n out_dnsmasq = subprocess.run([\"s...
[ "0.7066118", "0.6894916", "0.6701344", "0.66644454", "0.6636169", "0.6594103", "0.65772367", "0.6504517", "0.6455384", "0.64464915", "0.6408886", "0.6372164", "0.63390625", "0.63344496", "0.6302941", "0.6277452", "0.62744546", "0.62490195", "0.6241172", "0.62357146", "0.62187...
0.0
-1
list the docker images available for build
def list_images(): image_map = build_image_map() click.echo('') click.echo('List of available images (Name - Description)') click.echo('') for name in image_map: click.echo('{} -> {}'.format(name, image_map[name]))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def list_docker_images():\n raw_result = subprocess.getstatusoutput('docker images')\n return result_handler(raw_result)", "def _build_docker_images(self):\n print(f\"+ building {len(self.neurodocker_specs)} Docker images\")\n self.docker_status = []\n for sha1, neurodocker_dict in sel...
[ "0.79035133", "0.75807214", "0.7104596", "0.6980693", "0.69144505", "0.6904989", "0.6883383", "0.6788377", "0.6781191", "0.67198014", "0.6546041", "0.653512", "0.6484546", "0.6475429", "0.642328", "0.6303564", "0.63027793", "0.62536365", "0.6235247", "0.6217119", "0.6206234",...
0.691039
5
list the available ci stages for execution
def list_stages(): for name in Manager.STAGES: click.echo('{}'.format(name))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def stages() -> List[Tuple[str, str]]:\n return [TestStatus.preparation, TestStatus.testing, TestStatus.completed]", "def stage_list(args):\n\n for stage in args.stages:\n print stage", "def stages(self):\n return self._stages", "def stages(self):\n return self._stages", "def...
[ "0.71553665", "0.6959344", "0.67542017", "0.67542017", "0.6622961", "0.6178401", "0.6178401", "0.6178401", "0.6153931", "0.6117432", "0.60700995", "0.59009725", "0.5881856", "0.5803326", "0.57920223", "0.5780718", "0.57623285", "0.5628671", "0.56034106", "0.5523403", "0.55116...
0.75736964
0
push images to a docker registry
def push(images, tag, registry): manager = Manager('push', tag, images=images, registry_url=registry) manager.run()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def push_image(image):\n\n subprocess.check_call(['docker', 'push', image])", "def run_docker_push(image_list, docker_client):\n logger.info(\"--- push image to registry ---\")\n if runtime == Runtime.local:\n logger.info(\"Detected local runtime, stop here.\")\n return\n\n if not len(s...
[ "0.7688454", "0.76087564", "0.72781956", "0.718321", "0.715713", "0.7090948", "0.7030179", "0.6809519", "0.6794375", "0.6744697", "0.65739185", "0.6560774", "0.6509127", "0.6483394", "0.6415379", "0.6381899", "0.6256319", "0.6209923", "0.6139788", "0.61235374", "0.6070284", ...
0.82243633
0
execute unit test on docker images
def unittest(tag, path, custom_cli_subnet, custom_db_subnet, builder): manager = Manager( 'unittest', tag, images=['server'], custom_cli_subnet=custom_cli_subnet, custom_db_subnet=custom_db_subnet, unittest_path=path, builder_hostname=builder) manager.run()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test(params=''):\n docker_exec('py.test {}'.format(params))", "def test_units(container):\n short_image_name = container.image_name[container.image_name.rfind(\"/\") + 1 :]\n host_data_dir = os.path.join(THIS_DIR, f\"../{short_image_name}/test/units\")\n LOGGER.info(f\"Searching for units tests i...
[ "0.7846933", "0.7412047", "0.7258366", "0.72149086", "0.7151974", "0.71193075", "0.7115684", "0.6868198", "0.6772459", "0.67464954", "0.6740845", "0.66953695", "0.6591307", "0.6566432", "0.64860165", "0.64527285", "0.6415776", "0.640852", "0.6380202", "0.6326416", "0.6318264"...
0.60226077
34
Entry point, executes the root group.
def main(): logging.basicConfig( level=logging.DEBUG, format="%(levelname)s: %(message)s") root.add_command(all_) root.add_command(build) root.add_command(cleanup) root.add_command(clitest) root.add_command(run) root.add_command(push) root.add_command(unittest) root.add_comma...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def run(self, root):\r\n pass", "def root():\n pass", "async def _group(self, ctx):\r\n\t\tif ctx.invoked_subcommand is None:\r\n\t\t\tprint (\"Ryhmä komento annettiin ilman alakomentoa\")", "def exec(self):\n if self._root.master is None:\n self._root.mainloop()", "def execute(...
[ "0.7180917", "0.6376066", "0.6170935", "0.6146936", "0.60530406", "0.60025346", "0.59464896", "0.59450406", "0.5913414", "0.590124", "0.58364505", "0.574756", "0.5686958", "0.5659579", "0.5629004", "0.5579367", "0.5568521", "0.556469", "0.5518852", "0.55107117", "0.54983646",...
0.62378114
2
This function allows for fancy object assigment.
def __lt__(self, other): name, value = other self[name] = value
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _from_other(cls, obj):", "def obj(self) -> object:\n pass", "def new(self, obj):\n pass", "def add(obj):", "def _setup_object(self) -> object:\n raise NotImplementedError", "def __setitem__(self, name, obj):", "def __setattr__(*args):", "def __setattr__(*args):", "def __set...
[ "0.68794894", "0.6405043", "0.63679534", "0.63675547", "0.63258046", "0.6255525", "0.62520456", "0.62520456", "0.62520456", "0.62520456", "0.62520456", "0.62520456", "0.62520456", "0.62520456", "0.62520456", "0.62520456", "0.62520456", "0.62520456", "0.62520456", "0.62520456", ...
0.0
-1
This decorator adds an object instance when the object is initiated.
def register_instance(cls): @functools.wraps(cls) def wrapper_decorator(*args, **kwargs): instance = cls(*args, **kwargs) Register[cls.__name__] = instance return instance return wrapper_decorator
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, decoratedObj):\n\n self.__decoratedObj = decoratedObj", "def register_instance(self, obj):\n self.__instances.append(obj)\n self._proxy_class_methods(obj)", "def register_instance(self, instance):\n self.instance = instance", "def register_object(self, obj):\n ...
[ "0.70706284", "0.687097", "0.6671335", "0.6357395", "0.6352234", "0.6292987", "0.62336093", "0.62336093", "0.62336093", "0.6214509", "0.62070495", "0.62070495", "0.61912227", "0.61553884", "0.6097399", "0.60896945", "0.6085249", "0.6073874", "0.6045348", "0.6041891", "0.60417...
0.6157864
13