query
stringlengths
10
2k
document
stringlengths
20
51.2k
metadata
dict
negatives
listlengths
0
101
negative_scores
listlengths
0
101
document_score
stringlengths
3
10
document_rank
stringclasses
102 values
Returns the set of all cells in self.cells known to be safe.
def known_safes(self): if self.count==0: return self.cells return set() #raise NotImplementedError
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def solved_cells(self) -> Set[Cell]:\n\t\treturn set(self.iter_solved_cells())", "def solved_cells(self) -> Set[Cell]:\n\t\treturn set(self.iter_solved_cells())", "def known_safes(self):\n if self.count == 0:\n return self.cells\n return set([])", "def unsolved_cells(self) -> Set[Cel...
[ "0.82547176", "0.82547176", "0.80680937", "0.79269296", "0.79269296", "0.77275", "0.7620657", "0.7600568", "0.73750263", "0.7241672", "0.7190588", "0.7186031", "0.7054763", "0.69567287", "0.69553417", "0.69521725", "0.6919826", "0.6766262", "0.6711385", "0.6693863", "0.668020...
0.8284027
0
Returns a function that maps each index in 0, 1, ..., n1 to a distinct RGB color; the keyword argument name must be a standard mpl colormap name.
def get_cmap(n, name="hsv"): return plt.cm.get_cmap(name, n)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_cmap(n, name='jet'):\n return plt.cm.get_cmap(name, n)", "def get_cmap(n, name='hsv'):\n return plt.cm.get_cmap(name, n)", "def get_cmap(n, name='hsv'):\n return plt.cm.get_cmap(name, n)", "def get_cmap(n, name='Paired'):\n return plt.cm.get_cmap(name, n)", "def palette_from_mpl_name(na...
[ "0.7026068", "0.6976218", "0.6976218", "0.69448614", "0.6720858", "0.6579991", "0.65112346", "0.64271647", "0.6360296", "0.632813", "0.6287646", "0.61822826", "0.61393833", "0.6113537", "0.60940754", "0.60432553", "0.6020549", "0.5991163", "0.5960054", "0.5959102", "0.5889199...
0.69281334
6
Creates and saves superuser
def create_superuser(self, email, password, **extra_fields): user = self.model( email = email, **extra_fields ) user.set_password(password) user.is_admin =True user.is_superuser=True ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_superuser(self, username, email, password):\n print(\"creating super user....\")\n user = self.create_user(\n\n username=username,\n password=password,\n email = email,\n commit=False,\n )\n user.is_staff = True\n user.is_sup...
[ "0.78882474", "0.7767618", "0.7689051", "0.76443464", "0.7641532", "0.7634694", "0.7537939", "0.75347817", "0.7533191", "0.75145555", "0.7504749", "0.7504258", "0.7481266", "0.74806815", "0.7478948", "0.747405", "0.74583846", "0.74548", "0.74541986", "0.7451179", "0.7429572",...
0.7288797
41
Initializes a ddimensional zero vector.
def __init__(self, d): self.d = d self.st = SeparateChainingHashST()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_zero_vector(self):\n self.vector = np.zeros(self.dimension, dtype = float)", "def zero():\n return Vec2d(0, 0)", "def zero_vector(cls):\r\n \"\"\" EXECUTE THIS FUNCTION IN THE FARM CLASS! \"\"\"\r\n cls.wzero = np.zeros((Turbine.N, ), dtype=float)", "def zerovec(self, X):\...
[ "0.8238639", "0.7784582", "0.7194983", "0.69601524", "0.6940882", "0.69110084", "0.6896798", "0.6761954", "0.66474175", "0.66068804", "0.6593529", "0.6593055", "0.65798867", "0.65771484", "0.65541494", "0.6538262", "0.65289855", "0.6444452", "0.643646", "0.6419278", "0.635499...
0.0
-1
Returns the dimension of this vector.
def dimension(self): return self.d
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dimensionality(self):\n if self.vector.shape is ():\n return 0\n if len(self.vector.shape) is 1:\n return 1\n _, dim = self.vector.shape\n return dim", "def dimension(self):\n return self.__N", "def dimension_size(self):\n return self._dim", ...
[ "0.8349469", "0.81491935", "0.8099088", "0.8046764", "0.8046764", "0.7996407", "0.7980214", "0.7917069", "0.7903344", "0.7840847", "0.7736552", "0.7735965", "0.7729883", "0.7722194", "0.7707985", "0.7706657", "0.76962733", "0.76683944", "0.7644512", "0.76262724", "0.76173997"...
0.7638886
19
Returns the inner product of this vector with the specified vector.
def dot(self, that): if(self.d != that.d): raise ValueError("Vector lengths disagree") sum = 0.0 #iterate over the vector with the fewest nonzeroes if(self.st.size() <= that.st.size()): for i in self.st.keys(): if(that.st.contains(i)): sum += self.get(i) * that.get(i) else: for i in that.st...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __mul__(self,v2):\n\t\tif(isinstance(v2,Vect2D)):\n\t\t\treturn np.dot(self._vec,v2._vec)\n\t\telse:\n\t\t\treturn Vect2D(v2*self._vec)", "def __mul__(self, other): \n if isinstance(other, Iterable):\n # dot product\n return self.x * other[0] + self.y * other[1]\n e...
[ "0.7083659", "0.69121635", "0.6874729", "0.6819827", "0.6791859", "0.6692083", "0.66700554", "0.66244394", "0.66066253", "0.65904295", "0.6588592", "0.65639216", "0.64912796", "0.64885056", "0.64755005", "0.64684004", "0.6450993", "0.6445346", "0.6438864", "0.6417873", "0.639...
0.5940959
74
Unit tests the SparseVector data type.
def main(): a = SparseVector(10) b = SparseVector(10) a.put(3, 0.50) a.put(9, 0.75) a.put(6, 0.11) a.put(6, 0.00) b.put(3, 0.60) b.put(4, 0.90) print("a = {}".format(a)) print("b = {}".format(b)) print("a dot b = {}".format(a.dot(b))) print("a + b = {}".format(a.plus(b)))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_check_sparse(self):\n x, x_rand, s = self.create_testdata()\n task = mmRDTR()\n #check that a dense array x is passed thru unchanged\n check = task.check_sparse(x)\n self.assertEqual(np.all(check==x),True)\n #check that a sparse matrix s is converted to a numpy ar...
[ "0.71696573", "0.70195407", "0.67112136", "0.65243787", "0.6498203", "0.6447236", "0.6415151", "0.6386647", "0.6335841", "0.63266677", "0.62929523", "0.6270987", "0.6235718", "0.6192848", "0.61555046", "0.61543816", "0.6071468", "0.6047504", "0.60388774", "0.6036317", "0.6016...
0.0
-1
Day as a string
def scheduled(self): return str(self.day) if self.day else '-'
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def day_str(day):\n return str(day) if day >= 10 else '0' + str(day)", "def day_str(day):\n return str(day) if day >= 10 else '0' + str(day)", "def day_str(day):\n return str(day) if day >= 10 else '0' + str(day)", "def day(dt: datetime.datetime) -> str:\n day: str = dt.strftime(\"%A\")\n retu...
[ "0.821943", "0.821943", "0.821943", "0.78934723", "0.7794438", "0.76618195", "0.76283866", "0.7328626", "0.7133244", "0.71326077", "0.71134984", "0.7050756", "0.6959545", "0.68635845", "0.6822653", "0.6822653", "0.6818522", "0.67665225", "0.6759033", "0.672896", "0.6699914", ...
0.6276366
45
Automatically schedule all active questions on dates newer than the newest in database or today. Affects only questions in category qotd.
def automatic(kls, qotd='qotd'): newest = Schedule.objects.aggregate(models.Max('day')) if not newest: return day = newest.get('day__max', date.today()) if day is None: day = date.today() - timedelta(days=1) day += timedelta(days=1) for q in Quest...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_escalate_questions_cron(self, submit_ticket):\n\n questions_to_escalate = [\n # Questions over 24 hours old without an answer.\n question(\n created=datetime.now() - timedelta(hours=24, minutes=10),\n save=True),\n question(\n ...
[ "0.59756124", "0.5786884", "0.5757276", "0.5609986", "0.55873525", "0.55781156", "0.55781156", "0.5570928", "0.5554793", "0.5554793", "0.5554793", "0.5554793", "0.5554793", "0.5554793", "0.5554793", "0.5554793", "0.5554793", "0.5554793", "0.5554793", "0.5554793", "0.5554793",...
0.71258444
0
Generate a random secret key string.
def get_random_secret_key(cls, size=None): if not size: size = cls.default_secret_key_size return os.urandom(size)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_random_secret_key():\n chars = 'abcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*(-_=+)'\n return get_random_string(50, chars)", "def _generateSecretKey():\n return ''.join(SystemRandom().choice(string.ascii_letters + string.digits) for _ in range(20))", "def gen_key():\n key = os.urando...
[ "0.86671764", "0.84700054", "0.812901", "0.8128564", "0.79986185", "0.79768044", "0.79696554", "0.789906", "0.7870437", "0.78370684", "0.7778444", "0.77211857", "0.7673698", "0.7627404", "0.75754064", "0.7559021", "0.75332165", "0.74592197", "0.74592197", "0.74298656", "0.742...
0.7680241
12
Get the 'gridrealm' section as an AttrDict.
def gridrealm(self): if self._gridrealm_cache: return self._gridrealm_cache gr_defaults = Section.gridrealm.value opt_dict = dict([(obj.name, obj.value) for obj in gr_defaults]) config_vals = self._section_as_dict(Section.gridrealm.name) opt_dict.update(config_vals) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_attributes_config(node):\n # attrs_config = {}\n keyable_attrs = get_keyable_attribute(node)\n config_data = init_table_config_data()\n if keyable_attrs:\n # attrs_config[\"_attrs\"] = keyable_attrs\n for attr in keyable_attrs:\n config = get_single_attribute_config(nod...
[ "0.53001577", "0.5295527", "0.5088781", "0.5066672", "0.5066381", "0.50215715", "0.5021443", "0.5019809", "0.5009393", "0.4989297", "0.49788192", "0.49455556", "0.49337557", "0.49257472", "0.49229", "0.4912207", "0.4912207", "0.48941183", "0.48860916", "0.48781717", "0.487349...
0.7410927
0
Initialize the Article instance, using the initialized Document instance. >>> from pagebot.document import Document >>> from pagebot.constants import A4 >>> from pagebot import getContext >>> context = getContext() >>> doc = Document(size=A4, context=context) >>> ad = 'First page has a large headline and one column tex...
def __init__(self, doc, artDirection, path=None, mdText=None, startPage=1, name=None, **kwargs): self.doc = doc # Reuired Document instance. Assummed to be initialized with size and styles. self.artDirection = artDirection self.path = path # Optional path to markdown file, if it has ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def typeset(self):\n if self.mdText:\n t = Typesetter(self.doc.context)\n tmpPath = '/tmp/PageBot-Article.xml'\n path = t.markDown2XmlFile(tmpPath, self.mdText)\n galley = t.typesetFile(path)\n os.remove(tmpPath)", "def __init__(self, txt='', unicodeE...
[ "0.6037154", "0.57262754", "0.57130617", "0.56775105", "0.5594592", "0.54564404", "0.54472625", "0.5388765", "0.5262887", "0.52373725", "0.5202586", "0.5200567", "0.5186474", "0.51540214", "0.5127671", "0.5088896", "0.5087881", "0.50845695", "0.5077472", "0.50692505", "0.5042...
0.612823
0
Envoie un lien de video youtube
async def video(self, ctx, *, arg: str): await ctx.send(site + self.extraire(search + self.traduire(arg.split(' ')), watch_))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_videos(playlist):\n surl = playlist['link']\n # 작은 playlist의 url을 surl에 저장\n soup = get_soup(surl)\n # 작은 플레이리스트의 html 파싱하여 soup에 저장\n print(f\" getting videos for playlist: {playlist['title']}\")\n\n videos = []\n\n # items are list of video a links from list\n items = soup('a',...
[ "0.69183725", "0.6748147", "0.6649559", "0.66352725", "0.6585036", "0.6513351", "0.64492846", "0.6367422", "0.63094103", "0.6307443", "0.63001394", "0.6276659", "0.6260478", "0.62230605", "0.6193979", "0.61927646", "0.6170016", "0.6157376", "0.6129525", "0.61073595", "0.60763...
0.64446914
7
Returns the Euclidian Distance between two vectors
def euclidianDistance(row1, row2): dist = 0.0 for i in range(len(row1)-1): dist += (row1[i] - row2[i])**2 return sqrt(dist)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_euclid_dist(vec_1, vec_2):\n\n\treturn np.sqrt(np.sum(np.fabs(vec_1 - vec_2), axis=1)).flatten()", "def _vector_dist(self, vec1, vec2):\r\n return sqrt(sum([(float(v1) - float(v2)) ** 2 for v1, v2 in\r\n zip(vec1, vec2)]))", "def euclidean_distance(vector_1: Vector, vecto...
[ "0.82027584", "0.8050358", "0.79546607", "0.7845527", "0.7830942", "0.77672946", "0.77365184", "0.77311885", "0.7660685", "0.7639188", "0.763131", "0.7624693", "0.7551486", "0.7531403", "0.7518708", "0.7506968", "0.74697196", "0.7435592", "0.7429169", "0.7396281", "0.7393302"...
0.0
-1
Returns whether or not the service_id is one of the referrers of this volume
def has_referrer(self, service_id): return next((True for r in self.referrers if r['service_id'] == service_id), False)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove_referrer(self, service_id):\n referrers = [r for r in self.referrers if r['service_id'] != service_id]\n if len(referrers) == len(self.referrers):\n logger.warning(\"%s did not have a reservation for %s\", service_id, self)\n return False\n else:\n s...
[ "0.68973345", "0.6556823", "0.6201173", "0.60871255", "0.60442793", "0.59163725", "0.58793366", "0.5798456", "0.57923764", "0.57693154", "0.5738627", "0.572707", "0.57227623", "0.5721128", "0.5715063", "0.56498003", "0.5643508", "0.56162953", "0.55504674", "0.5527296", "0.551...
0.75078917
0
Gets current ThreatInsight configuration
async def get_current_configuration( self, keep_empty_params=False ): http_method = "get".upper() api_url = format_url(f""" {self._base_url} /api/v1/threats/configuration """) body = {} headers = {} form = {} ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def insights_config(self) -> 'outputs.InsightsConfigResponse':\n return pulumi.get(self, \"insights_config\")", "def configuration(self):\n if self.integration is None:\n return None\n return self.integration.configuration", "def getConfiguration(self):\n return self._con...
[ "0.7482193", "0.6966864", "0.69412214", "0.6897329", "0.688329", "0.68567055", "0.6773435", "0.6718722", "0.6711819", "0.66385186", "0.6575838", "0.6573065", "0.656757", "0.655083", "0.65388983", "0.6534331", "0.64844656", "0.64792246", "0.64792246", "0.64792246", "0.64792246...
0.68075
6
Minimum pairwise distance between c1, c2.
def single_linkage(c1, c2, data, memo, distfn): c1_idxs = c1.get_idxs() c2_idxs = c2.get_idxs() mindist = None for i in c1_idxs: for j in c2_idxs: if i == j: continue dist = memo.get((i,j), None) if dist == None: dist = memo.get...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def minimalDistance(a1, a2, b1, b2):\n adir = a2 - a1\n bdir = b2 - b1\n amid = a1 + 0.5 * adir\n s = b1 - amid\n A = np.dot(bdir, bdir)\n B_2 = np.dot(bdir, s)\n lambda_beta = - B_2 / A\n bOpt = lambda_beta * bdir + b1\n s = a1 - bOpt\n A = np.dot(adir, adir)\n B_2 =...
[ "0.7045182", "0.7036399", "0.6957681", "0.6772592", "0.6728717", "0.6567478", "0.65408695", "0.645088", "0.64440423", "0.6423415", "0.64218247", "0.6415788", "0.6393093", "0.6384853", "0.6380619", "0.6366859", "0.6354364", "0.6349917", "0.63474315", "0.6325903", "0.6319494", ...
0.61893415
33
Maximum pairwise distance between c1, c2.
def complete_linkage(c1, c2, data, memo, distfn): c1_idxs = c1.get_idxs() c2_idxs = c2.get_idxs() maxdist = None for i in c1_idxs: for j in c2_idxs: if i == j: continue dist = memo.get((i,j), None) if dist == None: dist = memo.g...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def distance(self, c1, c2):\n if c1 > c2:\n c1, c2 = c2, c1\n clusterDistance = self.clusterDistanceCache.get((c1,c2), None)\n if clusterDistance is None:\n # Find the maximum distance between any two pairs in the clusters.\n #\n maxDistance = ConstantValueFeatureComparisonResult(0.0)\...
[ "0.7036551", "0.6633535", "0.6588129", "0.6531544", "0.64374155", "0.63673973", "0.6333472", "0.62865716", "0.62805694", "0.6267186", "0.6236113", "0.61886847", "0.61561215", "0.6143775", "0.6133854", "0.6107185", "0.61001253", "0.60967916", "0.60898113", "0.60802513", "0.607...
0.65735966
3
Gets a dictionary mapping component name to lists of vertex instances of that component in the topology graph with the specified reference.
def get_component_instance_lists( graph_client: GremlinClient, topology_id: str, topology_ref: str ) -> Dict[str, List[Vertex]]: sgt: GraphTraversalSource = graph_client.topology_subgraph( topology_id, topology_ref ) component_names: List[str] = sgt.V().values("component").dedup().toList() ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def list_vertices(self):\n return list(self.graph_dict.keys())", "def vertices(self):\r\n return list(self.__graph_dict.keys())", "def vertices(self):\n return list(self.graph_dict.keys())", "def vertices(self):\n return list(self.__graph_dict.keys())", "def vertices(self):\n ...
[ "0.6008714", "0.5979344", "0.5959931", "0.59250546", "0.59250546", "0.59250546", "0.5842037", "0.5757458", "0.5749627", "0.57164484", "0.5702582", "0.56712097", "0.564665", "0.55766124", "0.5575081", "0.5548141", "0.5543155", "0.5519122", "0.55157876", "0.5514925", "0.5509950...
0.83275044
0
The purpose of this function is to determine if the file contains any irregularities in its grouping of traces such that it cannot be treated as episodic. Even "continuous" recordings can be treated as singleepisode recordings and could be identified as safe by this function. Recordings in which the user has changed gr...
def _safe_to_treat_as_episodic(self): # First check: Old AxoGraph file formats do not contain enough metadata # to know for certain that the file is episodic. if self.info['format_ver'] < 3: self.logger.debug('Cannot treat as episodic because old format ' ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_invalid_flag_record(self):\n log.info(\"START INTEG TEST INVALID\")\n\n self.clear_sample_data()\n self.clear_async_data()\n\n # Made-up data with all flags except the first set to True.\n # First flag is not a zero or one.\n filename = \"A1000003.DEC\"\n s...
[ "0.5769933", "0.55606663", "0.54373896", "0.54362535", "0.53248245", "0.5324784", "0.5255731", "0.5255715", "0.52249795", "0.51726514", "0.50999194", "0.50902814", "0.50717276", "0.50683993", "0.50560623", "0.5054256", "0.50523937", "0.50458014", "0.5033371", "0.50257045", "0...
0.6939343
0
Should not be able to draw more cards than the deck has.
def test_draw(self): deck_size = 3 d = Deck(deck_size) for _ in range(deck_size): d.draw() self.assertRaises(ValueError, d.draw) d.shuffle_in([1]) d.draw() self.assertRaises(ValueError, d.draw)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_deal_insufficient_cards(self):\n cards = self.deck._deal(100)\n self.assertEqual(len(cards), 52)\n self.assertEqual(self.deck.count(), 0)", "def testDraw(self):\n self.initDeck([1,2,3,4,5,6,7,8,9,10])\n\n card = self.testDeck.draw()\n assert len(self.testDeck.de...
[ "0.7825125", "0.7766139", "0.75546825", "0.7535202", "0.74913603", "0.74258476", "0.7174996", "0.70795816", "0.7064645", "0.6902885", "0.689841", "0.68690825", "0.68515193", "0.68402046", "0.680997", "0.68012035", "0.66886955", "0.6684159", "0.66567373", "0.664671", "0.658313...
0.756325
2
Should be able to draw cards after they have been discarded.
def test_discard(self): deck_size = 3 d = Deck(deck_size) for _ in range(deck_size): d.draw() d.discard([1, 3]) drawn = d.draw(2) self.assertEqual(len(drawn), 2) self.assertIn(1, drawn) self.assertIn(3, drawn)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def draw(self):\n c = self.cards[0]\n self.cards = self.cards[1:]\n self.discards.append(c)\n return(c)", "def testDraw(self):\n self.initDeck([1,2,3,4,5,6,7,8,9,10])\n\n card = self.testDeck.draw()\n assert len(self.testDeck.deck) == 9, \"Test Deck did not reduce...
[ "0.7486688", "0.74782044", "0.7115886", "0.7073679", "0.7014115", "0.6967685", "0.687977", "0.68510664", "0.6804536", "0.6786305", "0.677374", "0.67620033", "0.6761554", "0.6742071", "0.67373544", "0.6732128", "0.6706749", "0.66286", "0.66264594", "0.6582424", "0.6581821", ...
0.7765175
0
Iterator that yields each group in provided parent and all its kids.
def all_groups(parent=None): if parent is None: parent = QgsProject.instance().layerTreeRoot() def do_a_group(grp, level=0): for child in grp.children(): if isinstance(child, QgsLayerTreeGroup): yield child do_a_group(child, level=level + 1) do_a...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def traverse(self):\n yield self\n for k in self._kids:\n for kk in k.traverse():\n yield kk", "def iter_groups(self):\n\t\treturn iter(self._groups)", "def child_ents(self) -> Iterator['Entity']:\n for ent in self.vmf.entities:\n if self.id in ent.visgroup_ids:\n ...
[ "0.67042893", "0.6437444", "0.62844825", "0.6282001", "0.6275961", "0.62499756", "0.6210878", "0.61913216", "0.6111999", "0.6083645", "0.60517937", "0.60327196", "0.6013189", "0.60099596", "0.6009243", "0.5991609", "0.5924109", "0.5902874", "0.5890214", "0.5823052", "0.581849...
0.63130563
2
Initialize a new Rectangle
def __init__(self, width, height, x=0, y=0, id=None): super().__init__(id) self.width = width self.height = height self.x = x self.y = y
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, height, width):\n\n\t\t# _width and _height are internal (private) Rectangle Instance's attributes. This is something\n\t\t# We keep to ourselves to make sure the User can't just update these attrs randomly and also\n\t\t# so that the code has backward compatibility.\n\t\tself._width = None\n\t\...
[ "0.7834529", "0.78256065", "0.75949436", "0.7264191", "0.72496116", "0.7239379", "0.71683043", "0.71683043", "0.6930802", "0.6921666", "0.6878381", "0.68678594", "0.6778704", "0.6776751", "0.6755098", "0.6743207", "0.6714232", "0.66832006", "0.6670062", "0.6668818", "0.666411...
0.62856084
48
This class get's both the first and last names of the user and forms a full name
def get_full_name(cls, user_id): u = cls.query.get_or_404(user_id) u_first = u.first_name u_last = u.last_name u_full = f"{u_first} {u_last}" return u_full
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_full_name(self):\n # The user is identified by their email address\n return self.first_name+' '+self.last_name", "def get_full_name(self):\n full_name = f'{self.first_name} {self.last_name}' if self.first_name and self.last_name else self.username\n return full_name.strip()", ...
[ "0.79608184", "0.7814575", "0.7783438", "0.7752318", "0.7694378", "0.7690714", "0.7685227", "0.7678176", "0.76225036", "0.76109666", "0.76073956", "0.760404", "0.7595049", "0.7582622", "0.75698763", "0.75322276", "0.75229156", "0.75219655", "0.7495364", "0.7468576", "0.745161...
0.7506271
18
Check if the filename starts with '.'.
def is_hidden(bucket, path): # TODO: Implement metadata on S3 to mark as hidden parts = path.split('/') return parts[-1].startswith('.')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _is_file_valid(name: str) -> bool:\n return not name.startswith(\".\")", "def is_dot(f):\n return f.startswith('.')", "def validfilename(self, filename):\n return not (filename == \"CVS\" or filename.startswith(\".\"))", "def check_allowed_extension(filename):\n return '.' in filename and f...
[ "0.77190995", "0.7555146", "0.74901253", "0.73902214", "0.7305673", "0.7305673", "0.7297658", "0.7257641", "0.7257641", "0.7255347", "0.7255347", "0.7255347", "0.7255347", "0.7255347", "0.7255347", "0.7255347", "0.7255347", "0.7255347", "0.7255347", "0.72414994", "0.71881187"...
0.0
-1
Returns a True if the notebook exists. Else, returns False.
def notebook_exists(self, name, path=''): os_path = self._get_os_path(name, path=path) return key_exists(self.bucket, os_path)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def HasNotebook(self):\r\n\r\n return self.notebook_id >= 0", "def is_notebook(filename):\n root, ext = os.path.splitext(filename)\n if ext == \".ipynb\":\n return os.path.exists(filename)", "def in_notebook():\n from IPython import get_ipython\n return get_ipython() is not None", "...
[ "0.783094", "0.7588069", "0.7325659", "0.70914716", "0.7054147", "0.6801889", "0.6639253", "0.6511504", "0.6470998", "0.63912725", "0.6366978", "0.63283736", "0.61827576", "0.6174819", "0.6151063", "0.61224484", "0.60806626", "0.6064784", "0.6046433", "0.6041688", "0.6035612"...
0.7897925
0
Get the child places for a place.
def api_parent_place(dcid): # In DataCommons knowledge graph, places has multiple containedInPlace # relation with parent places, but it might not be comprehensive. For # example, "Moutain View" is containedInPlace for "Santa Clara County" and # "California" but not "United States": https://browser.data...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getPlaces(self):\n return self.wrapper.getPlaces()", "def __get_place_handles(self, places):\n place_handles = [] \n for place_gid in places.split():\n place = self.database.get_place_from_gramps_id(place_gid)\n if place is not None:\n #place can be N...
[ "0.6944043", "0.65577054", "0.6258854", "0.61915475", "0.60052454", "0.596445", "0.59637725", "0.5939532", "0.59244084", "0.58332634", "0.5780296", "0.57200986", "0.57186574", "0.5686937", "0.56850696", "0.56850696", "0.56850696", "0.5673729", "0.56638", "0.5612541", "0.55808...
0.52672714
60
Add nonterminals into the set.
def add(self, *nonterminals): # type: (Iterable[Type[Nonterminal]]) -> None for nonterm in nonterminals: if nonterm in self: continue _NonterminalSet._control_nonterminal(nonterm) super().add(nonterm) self._assign_map[nonterm] = set()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def nonterminals(g):\n return g._categories.copy()", "def with_nonterminals(self, nonterminals):\n if self.methods is not None:\n for nt_def in nonterminals.values():\n assert nt_def.type is not None\n return Grammar(\n nonterminals,\n goal_nts=sel...
[ "0.61607057", "0.6099774", "0.60659105", "0.5839105", "0.5811535", "0.5798631", "0.5659714", "0.5615129", "0.5605916", "0.5590496", "0.55520964", "0.54399717", "0.52611053", "0.5178924", "0.51368254", "0.5062654", "0.49983808", "0.4963189", "0.4963189", "0.4959687", "0.494095...
0.83059305
0
Add a receipt to internal state. The receipt will be recallable by token, and, if present, by label. Internal use only; use handle_message instead.
def _add_receipt(self, msg, identity): self._receipt_identities[msg.get_token()] = identity self._receipts[msg.get_token()] = msg if msg.get_label(): self._receipt_labels[msg.get_label()] = msg
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_receipt(self, expense_id, receipt):\n url = base_url + expense_id + '/receipt'\n attachments = [{\n 'receipt': {\n 'filename': basename(receipt),\n 'content': open(receipt).read()\n }\n }]\n data = {...
[ "0.5916752", "0.5675391", "0.55731374", "0.5442303", "0.52593875", "0.52424407", "0.521719", "0.51736295", "0.5109758", "0.49168697", "0.49027428", "0.48780695", "0.48640293", "0.48612908", "0.4858887", "0.48483735", "0.48226878", "0.48066953", "0.47987196", "0.47987112", "0....
0.75338984
0
Given a capability token or label, a temporal scope, a dictionary of parameters, and an optional new label, derive a specification and send it to the appropriate destination.
def invoke_capability(self, cap_tol, when, params, relabel=None): (cap, spec) = self._spec_for(cap_tol, when, params, relabel) spec.validate() dst_url = cap.get_link() self.send_message(spec, dst_url) return spec
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _spec_for(self, cap_tol, when, params, relabel=None):\n cap = self.capability_for(cap_tol)\n spec = mplane.model.Specification(capability=cap)\n\n # set temporal scope\n spec.set_when(when)\n\n # fill in parameters\n # spec.set_single_values() # this is automatic now\n...
[ "0.56868184", "0.5171123", "0.4711958", "0.4625935", "0.45607388", "0.45518523", "0.45495617", "0.445999", "0.44456288", "0.4442746", "0.44139263", "0.43639717", "0.43372053", "0.4330416", "0.43201634", "0.43161088", "0.43155912", "0.43072394", "0.42999342", "0.42915013", "0....
0.57999367
0
Computes the accuracy over the k top predictions for the specified values of k
def accuracy(output, target, topk=(1,)): with torch.no_grad(): maxk = max(topk) batch_size = target.size(0) _, pred = output.topk(maxk, 1, True, True) pred = pred.t() correct = pred.eq(target.view(1, -1).expand_as(pred)) res = [] for k in topk: c...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def topk_accuracy(y, y_pred, k=2):\n pred = []\n for i in range(len(y)):\n if y[i] in y_pred[i][:k]:\n pred.append(1)\n else:\n pred.append(0)\n return sum(pred) / len(pred)", "def accuracy(y_pred, y_actual, topk=(1, )):\n maxk = max(topk)\n batch_size = y_actua...
[ "0.8330614", "0.8285004", "0.82375455", "0.8229273", "0.82195294", "0.8185992", "0.8184316", "0.8174685", "0.817106", "0.8169587", "0.8166069", "0.8164076", "0.816332", "0.816176", "0.816176", "0.816176", "0.816176", "0.816176", "0.816176", "0.816176", "0.816176", "0.816176...
0.78616923
70
Precision metric. Only computes a batchwise average of precision. Computes the precision, a metric for multilabel classification of how many selected items are relevant.
def precision(y_true, y_pred): true_positives = K.sum(K.round(K.clip(y_true * y_pred, 0, 1))) predicted_positives = K.sum(K.round(K.clip(y_pred, 0, 1))) precision = true_positives / (predicted_positives + K.epsilon()) return precision
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def precision(self):\n self.overall_precision = precision_score(\n self.y_true, self.y_pred, average = self.average_type).round(self.digits_count_fp)\n self.classes_precision = precision_score(\n self.y_true, self.y_pred, average = None).round(self.digits_count_fp)", "def comp...
[ "0.7489789", "0.7288577", "0.7160126", "0.71535283", "0.7066027", "0.69853693", "0.6965701", "0.69550425", "0.69127744", "0.6834017", "0.68179363", "0.6809387", "0.68049496", "0.68049496", "0.68049496", "0.68049496", "0.68049496", "0.68049496", "0.6785694", "0.67549634", "0.6...
0.67576426
23
Recall metric. Only computes a batchwise average of recall. Computes the recall, a metric for multilabel classification of how many relevant items are selected.
def recall(y_true, y_pred): true_positives = K.sum(K.round(K.clip(y_true * y_pred, 0, 1))) possible_positives = K.sum(K.round(K.clip(y_true, 0, 1))) recall = true_positives / (possible_positives + K.epsilon()) return recall
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def recall(y_true, y_pred, average, labels):\n\n y_true, y_pred = check_metric_args(y_true, y_pred, average, labels)\n\n result = None\n\n m = len(y_true)\n n = len(labels)\n\n confusion_matrix = get_confusion_matrix(y_true, y_pred, labels).T\n\n if average == \"micro\":\n numerator = np.t...
[ "0.7605524", "0.74488467", "0.7404089", "0.7280915", "0.72097343", "0.7165874", "0.7157609", "0.7145226", "0.7145226", "0.7145226", "0.7145226", "0.7145226", "0.7145226", "0.71317255", "0.71007556", "0.70970625", "0.70970625", "0.70970625", "0.70970625", "0.70970625", "0.7097...
0.70627505
39
Single weights node initialization
def test_single_initialization(self): # Single sum w1 = spn.Weights(tf.initializers.constant(3), num_weights=2) w2 = spn.Weights(tf.initializers.constant(0.3), num_weights=4) w3 = spn.Weights(tf.initializers.constant([0.4, 0.4, 1.2]), num_weights=3) # Multi sums w4 = spn....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_node_weight_init(self):\n n = Node(value=2.0)\n self.assertEqual(n.weights, None)", "def _initialize_weights(self):\n pass", "def __init__(self, weights):\n self._weights = weights", "def init_weights_(self):\n raise NotImplementedError", "def init_weights(self, ...
[ "0.78088313", "0.7614604", "0.7602124", "0.7485865", "0.73667747", "0.7364828", "0.7220855", "0.72090125", "0.72056407", "0.7126741", "0.7101997", "0.70542777", "0.70406544", "0.7008271", "0.70050055", "0.70019543", "0.6988151", "0.6959204", "0.6931775", "0.6924704", "0.68929...
0.0
-1
Group initialization of weights nodes
def test_group_initialization(self): v1 = spn.IVs(num_vars=1, num_vals=2) v2 = spn.IVs(num_vars=1, num_vals=4) v3 = spn.IVs(num_vars=1, num_vals=2) v4 = spn.IVs(num_vars=1, num_vals=2) # Sum s1 = spn.Sum(v1) s1.generate_weights(tf.initializers.constant([0.2, 0.3])...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initialize_weights(root, name=\"InitializeWeights\"):\n initialize_ops = []\n\n def initialize(node):\n if isinstance(node, Weights):\n initialize_ops.append(node.initialize())\n if isinstance(node, GaussianLeaf):\n initialize_ops.extend(node.initialize())\n\n with ...
[ "0.69794035", "0.678198", "0.67355925", "0.6731823", "0.67002326", "0.66903067", "0.66789675", "0.66703427", "0.663487", "0.6616375", "0.65712744", "0.6481883", "0.6477805", "0.647141", "0.64388835", "0.64247435", "0.6420177", "0.6381365", "0.6364974", "0.6348846", "0.6343704...
0.68317205
1
Returns euclidian distance (Frobenius norm) between two feature vectors.
def GetDist(feature_1, feature_2): return np.linalg.norm(feature_1 - feature_2)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def euclidean_distance(vec1, vec2):\n return numpy.linalg.norm(vec1 - vec2)", "def euclidean_distance(a, b):\n return np.linalg.norm(a - b)", "def _vector_dist(self, vec1, vec2):\r\n return sqrt(sum([(float(v1) - float(v2)) ** 2 for v1, v2 in\r\n zip(vec1, vec2)]))", "def...
[ "0.7579426", "0.7574507", "0.7536353", "0.7535983", "0.7535354", "0.7488607", "0.7417474", "0.7396157", "0.73755294", "0.7360084", "0.7289144", "0.72854906", "0.7278817", "0.7235038", "0.7227906", "0.72066176", "0.71888614", "0.7179744", "0.715848", "0.7098075", "0.70752966",...
0.7895188
0
returns a list of clientIDs server serves in job.
def clients(self, server): servers = coordinator.get_job_servers(self.job) for sid, name in servers.iteritems(): if name == server: # assuming sid is zero-based and all sid < number of servers: clpsv = (self.numclients + len(servers) - 1) / len(servers) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_server_job_ids(self):\n self.server_job_ids = list()\n for server in self.servers:\n if server != 'local':\n with SSHClient(server) as ssh:\n self.server_job_ids.extend(ssh.check_running_jobs_ids())\n else:\n self.server_j...
[ "0.7471263", "0.7046936", "0.6457601", "0.6426025", "0.6426025", "0.63822436", "0.63252646", "0.6306062", "0.6298902", "0.62646514", "0.6258621", "0.62564933", "0.62270117", "0.6224972", "0.62159467", "0.6213349", "0.6194145", "0.6183434", "0.61817163", "0.6146069", "0.613771...
0.792856
0
The database against which the aggregation command is run.
def _database(self): ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def database(self):\n return self._database", "def database(self):\n return self._database", "def database(self):\n return self._database", "def database(self):\n return self._database", "def get_database(self):\n return self.database", "def database(self) -> pulumi.Inp...
[ "0.7232126", "0.7232126", "0.7232126", "0.7232126", "0.72295964", "0.70903516", "0.70870066", "0.70870066", "0.70608133", "0.70608133", "0.69322", "0.69302887", "0.6859931", "0.6821391", "0.67796963", "0.67692703", "0.67665756", "0.6765075", "0.6670747", "0.6669837", "0.66518...
0.5897471
70
Return the name of the sensor.
def name(self): return self._name
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def name(self):\n return self._sensor.name", "def get_sensor_name(self):\n return self.data[1]", "def name(self):\n return self.device.device_data[self.device_id]['name'] + \\\n f' {self._sensor_type}'", "def name(self):\n return f\"{self._name} {SENSOR_TYPES[self.senso...
[ "0.91896784", "0.9168378", "0.890185", "0.8770976", "0.8511273", "0.8479953", "0.844435", "0.8299758", "0.8186503", "0.8105667", "0.8079737", "0.8066149", "0.8049647", "0.7700968", "0.7612295", "0.7611456", "0.7600605", "0.7600605", "0.7600605", "0.75392073", "0.75166553", ...
0.0
-1
Return the state class of this entity.
def state_class(self): if self._state_characteristic in ( STAT_MIN_AGE, STAT_MAX_AGE, STAT_QUANTILES, ): return None return STATE_CLASS_MEASUREMENT
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def state_class(self) -> SensorStateClass | str | None:\n if hasattr(self, \"_attr_state_class\"):\n return self._attr_state_class\n if hasattr(self, \"entity_description\"):\n return self.entity_description.state_class\n return None", "def _model_state_class():\n\n ...
[ "0.8629248", "0.7599054", "0.697592", "0.6961116", "0.6930336", "0.6925137", "0.6867529", "0.6736368", "0.6721267", "0.67026275", "0.66721535", "0.66450566", "0.66450566", "0.65895265", "0.65895265", "0.65895265", "0.65895265", "0.65895265", "0.65676445", "0.65491563", "0.654...
0.7025339
2
Return the state attributes of the sensor.
def extra_state_attributes(self): if self.is_binary: return None return self.attr
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def device_state_attributes(self):\r\n return self.attributes", "def device_state_attributes(self):\r\n return self._attributes", "def device_state_attributes(self):\n return self.attr", "def device_state_attributes(self):\n return self.attr", "def device_state_attributes(self) ...
[ "0.84178215", "0.8248618", "0.8242616", "0.8242616", "0.8199547", "0.81679296", "0.81679296", "0.8158863", "0.8158863", "0.81448156", "0.81448156", "0.81448156", "0.81448156", "0.81448156", "0.81448156", "0.81448156", "0.81448156", "0.81448156", "0.81448156", "0.81448156", "0...
0.0
-1
Remove states which are older than self._samples_max_age.
def _purge_old(self): now = dt_util.utcnow() _LOGGER.debug( "%s: purging records older then %s(%s)", self.entity_id, dt_util.as_local(now - self._samples_max_age), self._samples_max_age, ) while self.ages and (now - self.ages[0]) > self._...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _remove_lost_detections(self, age_threshold=8):\n\n keep_detections = []\n for detection in self.detections:\n if detection.frames_undetected < self.delete_after and \\\n not (detection.is_hidden and detection.age < age_threshold):\n keep_detections.ap...
[ "0.59337246", "0.5827249", "0.5745498", "0.56858295", "0.5640609", "0.56251603", "0.56220967", "0.56054664", "0.5602948", "0.55971086", "0.54795706", "0.5435903", "0.5435709", "0.53906727", "0.5388803", "0.5379447", "0.5323996", "0.5295664", "0.52084166", "0.51887524", "0.516...
0.7262178
0
Set rightLimit for player
def assign_rightLimit(): player.rect.x = WIDTH - 75
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def assign_leftLimit():\r\n player.rect.x = 25", "def assign_downLimit():\r\n player.rect.y = 100", "def assign_upLimit():\r\n player.rect.y = 25", "def player_right(self) -> None:\n self._routes[self._current_route_key][\"RIGHT\"] += 1\n new_pos = self._player.x + self.MOVE_INC\n ...
[ "0.74786675", "0.72668225", "0.7260041", "0.6175794", "0.59865075", "0.5870041", "0.5826005", "0.58249944", "0.5654244", "0.5632131", "0.56218606", "0.5610547", "0.5608248", "0.55937934", "0.55500174", "0.5539018", "0.55057216", "0.54971546", "0.54699177", "0.5462369", "0.545...
0.83479255
0
Updating self every turn and randomizing self's position in beginning of game once
def update(self): if self.__randomize: self.rect.x = random.randrange(75, WIDTH - 125) self.rect.y = random.randrange(25, HEIGHT - 100) self.__randomize = False self.image.blit(window, (self.rect.x, self.rect.y))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update(self):\n if self.x<0:\n self.x = 0\n\n if self.y <0:\n self.y = 0\n\n if bool(randint(0, 1))==True:\n if self.walker == True:\n self.x += randint(-2, 2)\n self.y += randint(-2, 2)", "def move(self):\n if random....
[ "0.7598363", "0.7199339", "0.7077895", "0.6851121", "0.6839801", "0.67165154", "0.6706185", "0.6702597", "0.66857135", "0.66033804", "0.65996116", "0.6574611", "0.65735203", "0.65107536", "0.6475178", "0.6459747", "0.6451661", "0.642474", "0.64114106", "0.6407091", "0.6403537...
0.60438895
66
svn_diff_diff(void diff_baton, svn_diff_fns_t diff_fns, apr_pool_t pool) > svn_error_t
def svn_diff_diff(*args): return _diff.svn_diff_diff(*args)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def svn_client_diff(apr_array_header_t_diff_options, char_path1, svn_opt_revision_t_revision1, char_path2, svn_opt_revision_t_revision2, svn_boolean_t_recurse, svn_boolean_t_ignore_ancestry, svn_boolean_t_no_diff_deleted, apr_file_t_outfile, apr_file_t_errfile, svn_client_ctx_t_ctx, apr_pool_t_pool): # real signat...
[ "0.76889503", "0.759377", "0.7541254", "0.73342055", "0.72938746", "0.7247497", "0.7182617", "0.7107036", "0.70319104", "0.6998972", "0.6932435", "0.6927589", "0.6919205", "0.6899022", "0.68638873", "0.6787968", "0.6703951", "0.67031974", "0.6657434", "0.659968", "0.6554684",...
0.8039328
0
svn_diff_diff3_2(void diff_baton, svn_diff_fns2_t diff_fns, apr_pool_t pool) > svn_error_t
def svn_diff_diff3_2(*args): return _diff.svn_diff_diff3_2(*args)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def svn_diff_diff3(*args):\n return _diff.svn_diff_diff3(*args)", "def svn_client_diff3(apr_array_header_t_diff_options, char_path1, svn_opt_revision_t_revision1, char_path2, svn_opt_revision_t_revision2, svn_boolean_t_recurse, svn_boolean_t_ignore_ancestry, svn_boolean_t_no_diff_deleted, svn_boolean_t_ignore...
[ "0.8128958", "0.77862436", "0.77663904", "0.77593523", "0.7159", "0.7076977", "0.7031755", "0.7010591", "0.6954132", "0.6952666", "0.6916522", "0.69029796", "0.6864301", "0.6616684", "0.6608643", "0.6582322", "0.6562615", "0.6560773", "0.65311325", "0.65228826", "0.64100254",...
0.8109475
1
svn_diff_diff3(void diff_baton, svn_diff_fns_t diff_fns, apr_pool_t pool) > svn_error_t
def svn_diff_diff3(*args): return _diff.svn_diff_diff3(*args)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def svn_diff_file_diff3(*args):\n return _diff.svn_diff_file_diff3(*args)", "def svn_client_diff3(apr_array_header_t_diff_options, char_path1, svn_opt_revision_t_revision1, char_path2, svn_opt_revision_t_revision2, svn_boolean_t_recurse, svn_boolean_t_ignore_ancestry, svn_boolean_t_no_diff_deleted, svn_boolea...
[ "0.786344", "0.7859776", "0.7858998", "0.75371605", "0.7157951", "0.71286494", "0.7087196", "0.7055487", "0.7025724", "0.697152", "0.6791941", "0.67373097", "0.6674438", "0.6652791", "0.66304404", "0.6623619", "0.6579607", "0.64963216", "0.6457961", "0.6386723", "0.6380353", ...
0.82420737
0
svn_diff_output2(svn_diff_t diff, void output_baton, svn_diff_output_fns_t output_fns, svn_cancel_func_t cancel_func) > svn_error_t
def svn_diff_output2(diff, output_baton, output_fns, cancel_func): return _diff.svn_diff_output2(diff, output_baton, output_fns, cancel_func)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def svn_diff_output(diff, output_baton, output_fns):\n return _diff.svn_diff_output(diff, output_baton, output_fns)", "def svn_diff_file_output_merge2(*args):\n return _diff.svn_diff_file_output_merge2(*args)", "def svn_diff_file_output_unified2(*args):\n return _diff.svn_diff_file_output_unified2(*ar...
[ "0.8327311", "0.74597603", "0.726367", "0.71994615", "0.71931356", "0.7160324", "0.71589833", "0.7073768", "0.701439", "0.69915897", "0.68361396", "0.68031865", "0.67311144", "0.6713882", "0.65529233", "0.64137167", "0.63629717", "0.6358067", "0.63497907", "0.62244606", "0.62...
0.9232155
0
svn_diff_file_options_create(apr_pool_t pool) > svn_diff_file_options_t
def svn_diff_file_options_create(*args): return _diff.svn_diff_file_options_create(*args)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def svn_diff_file_options_parse(*args):\n return _diff.svn_diff_file_options_parse(*args)", "def __init__(self):\n this = _diff.new_svn_diff_file_options_t()\n try:\n self.this.append(this)\n except __builtin__.Exception:\n self.this = this", "def svn_client_diff(a...
[ "0.71705943", "0.6928227", "0.68095946", "0.6783222", "0.6740334", "0.6540124", "0.6520473", "0.6357256", "0.6353917", "0.63143504", "0.63106793", "0.62188953", "0.62014216", "0.6139928", "0.6087769", "0.6072304", "0.60126734", "0.59975225", "0.59916836", "0.5985896", "0.5966...
0.8128022
0
svn_diff_file_diff_2(char const original, char const modified, svn_diff_file_options_t options, apr_pool_t pool) > svn_error_t
def svn_diff_file_diff_2(*args): return _diff.svn_diff_file_diff_2(*args)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def svn_diff_file_diff(*args):\n return _diff.svn_diff_file_diff(*args)", "def svn_client_diff2(apr_array_header_t_diff_options, char_path1, svn_opt_revision_t_revision1, char_path2, svn_opt_revision_t_revision2, svn_boolean_t_recurse, svn_boolean_t_ignore_ancestry, svn_boolean_t_no_diff_deleted, svn_boolean_...
[ "0.7937261", "0.78287894", "0.7811356", "0.77393734", "0.76436055", "0.7441029", "0.7408587", "0.74080104", "0.73955595", "0.73083323", "0.72564185", "0.72010434", "0.71530855", "0.7145206", "0.71068466", "0.7046226", "0.69050634", "0.6785158", "0.6729162", "0.67161703", "0.6...
0.80658334
0
svn_diff_file_output_merge3(svn_stream_t output_stream, svn_diff_t diff, char const original_path, char const modified_path, char const latest_path, char const conflict_original, char const conflict_modified, char const conflict_latest, char const conflict_separator, svn_diff_conflict_display_style_t conflict_style, sv...
def svn_diff_file_output_merge3(*args): return _diff.svn_diff_file_output_merge3(*args)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def svn_diff_file_output_unified3(*args):\n return _diff.svn_diff_file_output_unified3(*args)", "def svn_diff_file_diff3(*args):\n return _diff.svn_diff_file_diff3(*args)", "def svn_diff_file_diff3_2(*args):\n return _diff.svn_diff_file_diff3_2(*args)", "def svn_diff_file_output_merge(*args):\n r...
[ "0.7045657", "0.691441", "0.6885362", "0.68369275", "0.68339694", "0.6772713", "0.6610849", "0.6591813", "0.6580356", "0.65418196", "0.6456866", "0.61972195", "0.6161685", "0.6131182", "0.61219406", "0.60142654", "0.5989425", "0.5879229", "0.57875335", "0.5693674", "0.5687219...
0.80872387
0
svn_diff_mem_string_diff3(svn_string_t const original, svn_string_t const modified, svn_string_t const latest, svn_diff_file_options_t options, apr_pool_t pool) > svn_error_t
def svn_diff_mem_string_diff3(*args): return _diff.svn_diff_mem_string_diff3(*args)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def svn_diff_mem_string_diff(*args):\n return _diff.svn_diff_mem_string_diff(*args)", "def svn_diff_mem_string_diff4(*args):\n return _diff.svn_diff_mem_string_diff4(*args)", "def svn_diff_mem_string_output_unified3(*args):\n return _diff.svn_diff_mem_string_output_unified3(*args)", "def svn_diff_me...
[ "0.8111812", "0.79990304", "0.758437", "0.74697125", "0.73730516", "0.7177419", "0.707012", "0.70039517", "0.6933621", "0.6837697", "0.68373895", "0.66513973", "0.6506935", "0.64944434", "0.64764404", "0.6419348", "0.63535494", "0.6340954", "0.6275352", "0.62615377", "0.62178...
0.8774169
0
svn_diff_mem_string_output_merge3(svn_stream_t output_stream, svn_diff_t diff, svn_string_t const original, svn_string_t const modified, svn_string_t const latest, char const conflict_original, char const conflict_modified, char const conflict_latest, char const conflict_separator, svn_diff_conflict_display_style_t sty...
def svn_diff_mem_string_output_merge3(*args): return _diff.svn_diff_mem_string_output_merge3(*args)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def svn_diff_file_output_merge3(*args):\n return _diff.svn_diff_file_output_merge3(*args)", "def svn_diff_mem_string_output_unified3(*args):\n return _diff.svn_diff_mem_string_output_unified3(*args)", "def svn_diff_mem_string_output_merge(*args):\n return _diff.svn_diff_mem_string_output_merge(*args)"...
[ "0.73719686", "0.7070374", "0.7007905", "0.6918336", "0.6859007", "0.67635494", "0.65288013", "0.6467441", "0.6430865", "0.64159477", "0.64059186", "0.6357754", "0.6317542", "0.6214312", "0.61747193", "0.61257714", "0.61016846", "0.60952544", "0.6087071", "0.60317034", "0.602...
0.8022921
0
svn_diff_parse_next_patch(svn_patch_file_t patch_file, svn_boolean_t reverse, svn_boolean_t ignore_whitespace, apr_pool_t result_pool, apr_pool_t scratch_pool) > svn_error_t
def svn_diff_parse_next_patch(*args): return _diff.svn_diff_parse_next_patch(*args)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def process_patch(patch_string):\n patch = DiffParser(patch_string.splitlines())\n for filename, diff in patch.files.iteritems():\n file_extension = os.path.splitext(filename)[1]\n line_numbers = set()\n\n def error_for_patch(filename, line_number, category, confidence, message):\n ...
[ "0.64611214", "0.6038647", "0.5921678", "0.59172624", "0.5860167", "0.5802429", "0.57040906", "0.56646025", "0.5606436", "0.5604954", "0.55760014", "0.556378", "0.556378", "0.55517733", "0.55387294", "0.55033314", "0.5483189", "0.5475828", "0.5358181", "0.53410465", "0.530781...
0.82186615
0
svn_diff_fns2_invoke_datasources_open(svn_diff_fns2_t _obj, void diff_baton, apr_off_t prefix_lines, apr_off_t suffix_lines, svn_diff_datasource_e const datasources, apr_size_t datasources_len) > svn_error_t
def svn_diff_fns2_invoke_datasources_open(_obj, diff_baton, prefix_lines, suffix_lines, datasources, datasources_len): return _diff.svn_diff_fns2_invoke_datasources_open(_obj, diff_baton, prefix_lines, suffix_lines, datasources, datasources_len)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def svn_diff_fns_invoke_datasource_open(_obj, diff_baton, datasource):\n return _diff.svn_diff_fns_invoke_datasource_open(_obj, diff_baton, datasource)", "def svn_diff_fns2_invoke_datasource_close(_obj, diff_baton, datasource):\n return _diff.svn_diff_fns2_invoke_datasource_close(_obj, diff_baton, datasour...
[ "0.8224848", "0.66814715", "0.6642759", "0.59207124", "0.57092494", "0.5561241", "0.5516187", "0.54673254", "0.5462957", "0.5432094", "0.5366137", "0.53450596", "0.5329648", "0.5237665", "0.5233191", "0.52068263", "0.5180924", "0.51693696", "0.51653093", "0.51599056", "0.5124...
0.9563534
0
Absolute URL of a quote detail. Used for generic create/update views & model forms
def get_absolute_url(self): return reverse('quotes:detail', kwargs={'pk': self.pk})
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_absolute_url(self):\n return reverse('quotation', kwargs={'pk': self.pk})", "def get_absolute_url(self):\n return reverse(\"jewelry_detail\", args = [str(self.id)])", "def get_absolute_url(self):\n return reverse('market:product-detail', args=[str(self.id)])", "def get_absolute_u...
[ "0.75064033", "0.69442934", "0.69337445", "0.68749124", "0.6859436", "0.6837219", "0.6825075", "0.6825075", "0.67738765", "0.6764152", "0.67622966", "0.6749151", "0.6744055", "0.6721201", "0.6710878", "0.66912764", "0.6679064", "0.66712195", "0.6664706", "0.66564023", "0.6650...
0.8081473
0
Patch a resource of specific kind. Either the namespace+name should be specified, or the body, which is used only to get namespace+name identifiers. Unlike the object listing, the namespaced call is always used for the namespaced resources, even if the operator serves the whole cluster (i.e. is not namespacerestricted)...
async def patch_obj(*, resource, patch, namespace=None, name=None, body=None): if body is not None and (name is not None or namespace is not None): raise TypeError("Either body, or name+namespace can be specified. Got both.") namespace = body.get('metadata', {}).get('namespace') if body is not None el...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def patch_resource(self, namespace: \"str\" = None):\n names = [\"patch_namespaced_csistorage_capacity\", \"patch_csistorage_capacity\"]\n\n _kube_api.execute(\n action=\"patch\",\n resource=self,\n names=names,\n namespace=namespace,\n api_clien...
[ "0.62466234", "0.60731876", "0.59504855", "0.5835475", "0.57989323", "0.5772389", "0.5759131", "0.5701994", "0.5697849", "0.5692272", "0.5684222", "0.5661823", "0.5653843", "0.5648338", "0.5635371", "0.56125104", "0.56113046", "0.5610724", "0.5607602", "0.55997473", "0.557862...
0.7657775
0
Uses boto3 to load the current account id
def load_aws_account_id() -> str: client: STSClient = fetch_boto3_client("sts") return client.get_caller_identity()["Account"]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def accountId():\n # save the lookup if we set the account to the environment\n if \"AWS_ACCOUNT_ID\" in os.environ:\n return os.environ[\"AWS_ACCOUNT_ID\"]\n conn = iamConn()\n funcs = [\n lambda: conn.get_user().get('get_user_response')\\\n .get('get_user_result').get('user')...
[ "0.72974396", "0.7200079", "0.69505954", "0.69505954", "0.69505954", "0.69505954", "0.69505954", "0.69505954", "0.69505954", "0.69505954", "0.6931177", "0.66451806", "0.66317916", "0.65786314", "0.64685696", "0.6461276", "0.6461276", "0.6461276", "0.6425657", "0.6421983", "0....
0.82096547
0
Method to calculate topk error
def error_topk(y_pred, y_true, k=1): error = tf.nn.in_top_k(predictions=y_pred, targets=y_true, k=k) return tf.reduce_mean(tf.cast(error, dtype=tf.float32))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def topk_errors(preds, labels, ks):\n num_topks_correct = topks_correct(preds, labels, ks)\n return [(1.0 - x / preds.size(0)) * 100.0 for x in num_topks_correct]", "def more_than_just_topk(result_table, k, metric):\n num_rows = result_table.shape[0]\n\n # No suggestion if all rows already in the res...
[ "0.75135124", "0.6585889", "0.6478001", "0.6354352", "0.63294613", "0.6321031", "0.61997634", "0.6145212", "0.61054796", "0.6050026", "0.5983311", "0.5927316", "0.5854193", "0.5853278", "0.5787029", "0.57743174", "0.576324", "0.5744714", "0.5744714", "0.5733121", "0.5724901",...
0.7276402
1
Method to approximate Dice score loss function Dice (formal) = 2 x (y_pred UNION y_true) | y_pred | + | y_true | Dice (approx) = 2 x (y_pred y_true) + d | y_pred | + | y_true | + d where d is small delta == 1e7 added both to numerator/denominator to prevent division by zero.
def loss_dice(y_pred, y_true): # --- Loop over the channels channels = y_pred.shape.as_list()[-1] losses = {} for ch in range(channels): num = 2 * tf.reduce_sum(y_pred[..., ch] * y_true[..., ch]) den = tf.reduce_sum(y_pred[..., ch]) + tf.reduce_sum(y_true[..., ch]) losses[ch] = (...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dice_loss(y_true, y_pred, smooth=1e-6):\n y_true=tf.cast(y_true,tf.float32)\n y_pred=tf.cast(y_pred,tf.float32)\n y_true_f = K.flatten(y_true)\n y_pred_f = K.flatten(y_pred)\n intersection = K.sum(y_true_f * y_pred_f)\n dice = (2. * intersection + smooth) / (K.sum(y_true_f) + K.sum(y_pred_f) ...
[ "0.78528905", "0.7837016", "0.7710869", "0.76676464", "0.7552756", "0.74738693", "0.7433946", "0.71641695", "0.71638596", "0.71616846", "0.71107954", "0.7068915", "0.6996462", "0.69832444", "0.69491345", "0.6940761", "0.6872801", "0.6856605", "0.68507284", "0.68400353", "0.68...
0.74844646
5
Oversee the creation of product and its required productversion. Probably not strictly RESTful.
def obj_create(self, bundle, request=None, **kwargs): request = request or bundle.request pv_required_msg = str("The 'productversions' key must exist, " + "must be a list, and the list must contain " + "at least one entry.") # pull the product...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_product():\n mongo = MongoClient(Config.MONGO_URI)\n db_operations = mongo.db.product\n data = request.get_json(force=True) or {}\n if 'title' not in data or 'description' not in data or 'params' not in data:\n return bad_request(t['empty_field'])\n new_prod...
[ "0.7364007", "0.72687584", "0.6958533", "0.6930921", "0.6840897", "0.68135524", "0.67779756", "0.672301", "0.6710722", "0.66721904", "0.6624727", "0.66173303", "0.65955323", "0.6576922", "0.6535188", "0.65284353", "0.6497526", "0.6482536", "0.6447935", "0.64148897", "0.639993...
0.7096737
2
Instantiates the InceptionResNet v2 architecture. Optionally loads weights pretrained on ImageNet. Note that when using TensorFlow, for best performance you should
def InceptionResNetV2(include_top=True, weights='imagenet', input_tensor=None, input_shape=None, pooling=None, classes=1000): if not (weights in {'imagenet', None} or os.path.exists(weights)): raise Value...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def resnet18(pretrained=False, **kwargs):\n model = ResNet(BasicBlock, [2, 2, 2, 2], **kwargs)\n if pretrained:\n model.load_state_dict(model_zoo.load_url(model_urls['resnet18']))\n return model", "def resnet18(pretrained=False, **kwargs):\n model = ResNet(BasicBlock, [2, 2, 2, 2], **kwargs)\n...
[ "0.6662604", "0.6662604", "0.6662604", "0.6662604", "0.6662604", "0.6642718", "0.6613701", "0.6591158", "0.6554573", "0.65274006", "0.6503056", "0.6451534", "0.64370483", "0.64316267", "0.6429523", "0.6390223", "0.6390223", "0.6390223", "0.63858616", "0.63532346", "0.63379335...
0.7307566
0
Number of clusters in the current clustering.
def n_clusters(self): return self.model.n_clusters
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_cluster_count(self) -> int:\n return len(self.get_all_cluster_ids())", "def n_clusters(self):\n return len(self.clusters)", "def cluster_count(self) -> int:\n cluster_count = max(1, round(16**3 * (self.vein.purity / 100.0) / self.cluster_size))\n return self.distribution.sca...
[ "0.8934617", "0.88803107", "0.8576278", "0.8378564", "0.7647902", "0.7465167", "0.7461923", "0.73421085", "0.73242253", "0.73063827", "0.72755283", "0.7265687", "0.7245335", "0.7217564", "0.714121", "0.71149176", "0.71126807", "0.7055073", "0.70300144", "0.7026207", "0.702236...
0.8602019
2
Create a Document from a json file
def from_json(file_name): if not file_name.endswith('.json'): template = 'Need json file, got {}' message = template.format(file_name) raise InvalidDocumentException(message) data = file_ops.read_json_utf8(file_name) return Document(file_name=file_name, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_json_document(f):\n return json.load(f)", "def from_json_file(cls, json_file):\r\n with open(json_file, \"r\", encoding='utf-8') as reader:\r\n text = reader.read()\r\n return cls.from_dict(json.loads(text))", "def from_json_file(cls, json_file):\n with open(json_fil...
[ "0.7159523", "0.68280095", "0.6817549", "0.6808757", "0.6808757", "0.6808757", "0.6796111", "0.67926675", "0.67188674", "0.671701", "0.6674545", "0.6624859", "0.6610792", "0.65804857", "0.6531627", "0.64746547", "0.64555746", "0.6397898", "0.63938826", "0.63926595", "0.634399...
0.78922427
0
Get the body of the file
def raw_body(self): return file_ops.read_utf8(self.raw_file_name)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def body(self):\r\n self._body.seek(0)\r\n return self._body", "def __get_post_body(self):\n content_len = int(self.headers.getheader('content-length', 0))\n return self.rfile.read(content_len)", "def read_content(self):\n return self.file.read()", "def create_body(file: st...
[ "0.7574371", "0.7568536", "0.7398367", "0.7386038", "0.7297609", "0.7170546", "0.71484894", "0.68977135", "0.68683213", "0.6801134", "0.6791077", "0.67858434", "0.6781124", "0.67771345", "0.6739879", "0.67169297", "0.6681095", "0.6678546", "0.66202563", "0.6574715", "0.656632...
0.8100076
0
Email address of the authenticated creator.
def creator(self) -> str: return pulumi.get(self, "creator")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def email(self, instance):\r\n return instance.user.email", "def technical_owner_email(self):\n return self._technical_owner_email", "def email(self) -> str:\n return pulumi.get(self, \"email\")", "def email(self) -> str:\n return pulumi.get(self, \"email\")", "def email(self) -...
[ "0.7815762", "0.75931144", "0.7549924", "0.7549924", "0.7549924", "0.7528969", "0.7507501", "0.74667436", "0.7465198", "0.74259377", "0.7424905", "0.74161667", "0.7388009", "0.7388009", "0.7388009", "0.7388009", "0.73559034", "0.7284987", "0.72582865", "0.72493917", "0.723437...
0.7121414
36
Number of executions created for this job.
def execution_count(self) -> int: return pulumi.get(self, "execution_count")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def count(self):\n # no auth?\n return self.app.db.jobs.count()", "def count(self):\n return len(self._runs)", "def get_number_executors(self):\n with self.__threads_lock:\n return self.__number_executors", "def execution_count(self):\n if not self._execution_cou...
[ "0.7733015", "0.7669226", "0.76680493", "0.75497705", "0.7476357", "0.72266144", "0.72013986", "0.71815115", "0.71419793", "0.70962477", "0.707108", "0.70417094", "0.7025729", "0.70065355", "0.697565", "0.68904924", "0.68904924", "0.68904924", "0.68653095", "0.68612796", "0.6...
0.7974728
0
Name of the last created execution.
def latest_created_execution(self) -> 'outputs.GoogleCloudRunV2ExecutionReferenceResponse': return pulumi.get(self, "latest_created_execution")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def testrun_name():\n now = datetime.utcnow()\n return 'Automated Run {}'.format(now.strftime(DT_FORMAT))", "def call_name(self):\n return str(self.executable.name)", "def last_operation_name(self) -> Optional[str]:\n return pulumi.get(self, \"last_operation_name\")", "def task_name(self)...
[ "0.69279855", "0.6922148", "0.68860584", "0.68009895", "0.67015207", "0.67015207", "0.67015207", "0.67015207", "0.6603419", "0.6579569", "0.65738213", "0.65601915", "0.6554155", "0.6549773", "0.6540761", "0.6532203", "0.6510878", "0.6508139", "0.6508139", "0.6508139", "0.6508...
0.0
-1
The Condition of this Job, containing its readiness status, and detailed error information in case it did not reach the desired state.
def terminal_condition(self) -> 'outputs.GoogleCloudRunV2ConditionResponse': return pulumi.get(self, "terminal_condition")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _check_job_status(self) -> str:\n self._assert_job_created()\n\n r = requests.post(\n f'https://{cc.ROUTE_PREFIX}.stratodem.com/jobs/status',\n headers=dict(\n Authorization=f'Bearer {get_api_token()}',\n ),\n json=dict(job_id=self._job_i...
[ "0.646661", "0.6248669", "0.6137206", "0.6039368", "0.59286374", "0.59042215", "0.5861603", "0.57893836", "0.5769013", "0.5759555", "0.5759555", "0.5759555", "0.5759555", "0.5759555", "0.5759555", "0.5728253", "0.5674985", "0.56692475", "0.5631522", "0.5604345", "0.5604345", ...
0.586114
7
magic from rllab for computing discounted cumulative sums of vectors.
def discount_cumsum(x, discount): return scipy.signal.lfilter([1], [1, float(-discount)], x[::-1], axis=0)[::-1]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _discounted_cumsum(self, rewards, rate=None):\n # HINT1: note that each entry of the output should now be unique,\n # because the summation happens over [t, T] instead of [0, T]\n # HINT2: it is possible to write a vectorized solution, but a solution\n # using a for loop is also fin...
[ "0.6544189", "0.6466892", "0.64333206", "0.64266914", "0.63281584", "0.6318136", "0.63127834", "0.62610054", "0.62226504", "0.6218116", "0.621468", "0.62063485", "0.61723727", "0.61337787", "0.61141855", "0.60977477", "0.6010351", "0.59978455", "0.59516114", "0.5951461", "0.5...
0.6339804
9
Returns a dictlike object that contains all the scopes in the ProtectedCapability model.
def get_all_scopes(self): return dict(ProtectedCapability.objects.values_list('slug', 'title'))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_default_scopes(self, application=None, request=None, *args, **kwargs):\n # at the moment we assume that the default scopes are all those availables\n return list(ProtectedCapability.objects.filter(default=True).values_list('slug', flat=True))", "def get_available_scopes(self, application=No...
[ "0.6558831", "0.65453875", "0.63340497", "0.6249794", "0.60817003", "0.6070908", "0.6070908", "0.6028665", "0.59566724", "0.58552665", "0.58166957", "0.57739407", "0.57652587", "0.57494295", "0.5734125", "0.5681918", "0.5607605", "0.5600457", "0.5600457", "0.5600457", "0.5600...
0.8117854
0
Supply a reliable return value for the Configuration.get() method.
def mock_config(temp_dir): get_config_mock = Mock() config = base_config() config['skills']['priority_skills'] = ['foobar'] config['data_dir'] = str(temp_dir) config['server']['metrics'] = False config['enclosure'] = {} get_config_mock.return_value = config return get_config_mock
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _fake_safe_get(self, value):\n try:\n val = getattr(self.configuration, value)\n except AttributeError:\n val = None\n return val", "def config_value(name):\n def get():\n try:\n return config.get('yourls', name)\n except (NoOptionError, ...
[ "0.75257397", "0.73074025", "0.71559346", "0.7101901", "0.70706314", "0.70496935", "0.6976172", "0.6976172", "0.6976172", "0.6976172", "0.6976172", "0.6976172", "0.6976172", "0.6976172", "0.6976172", "0.6976172", "0.6976172", "0.6976172", "0.6976172", "0.6976172", "0.6976172"...
0.0
-1
Replace URLs found in a text string with nothing (i.e. it will remove the URL from the string).
def remove_url(txt): return " ".join(re.sub("([^0-9A-Za-z \t])|(\w+:\/\/\S+)", "", txt).split())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove_urls(text):\n pass", "def remove_urls(text):\n text = re.sub('(?P<url>https?://[^\\s]+)', '', text)\n return text", "def remove_urls(self, text):\n return re.sub(r'http.?://[^\\s]+[\\s]?', '', text)", "def _remove_urls(self, text: str) -> str:\n pattern = r\"http\\S+...
[ "0.8422449", "0.8374669", "0.8312422", "0.81358033", "0.8085995", "0.8057459", "0.79618174", "0.7951415", "0.7834034", "0.77034914", "0.76446146", "0.7549235", "0.73450565", "0.7276105", "0.71740913", "0.71552026", "0.7122175", "0.7064335", "0.7057012", "0.6891155", "0.685302...
0.7401897
12
Sets the learning rate to the initial LR decayed by schedule
def adjust_learning_rate(optimizer, epoch, lr, schedule, gamma): if epoch in schedule: lr *= gamma for param_group in optimizer.param_groups: param_group['lr'] = lr return lr
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initialize_learning_rate(self):\n\n if (self.FLAGS.learning_rate_decay is \"exponential\"):\n self.learning_rate = tf.train.exponential_decay(\n self.FLAGS.learning_rate,\n self.global_step,\n self....
[ "0.7852887", "0.7700881", "0.76748174", "0.756743", "0.7560571", "0.75442725", "0.7534079", "0.7519826", "0.7519784", "0.74939126", "0.7484822", "0.7483746", "0.7482854", "0.7480121", "0.74770564", "0.74770564", "0.74551284", "0.7446404", "0.7424797", "0.74222237", "0.7417072...
0.7537521
7
Main site page page.
def index(request): LOGGER.debug('socialprofile_demo.views.index') response_data = {} return render_to_response('index.html', response_data, context_instance=RequestContext(request))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def main_page():\n return render_template(\"index.html\")", "def main_page():\n return render_template(\"main_page.html\")", "def main():\n\n return render_template(\"index.html\", title=\"Home\", heading=\"Dublin Bus\")", "def home():\n return render_template('Main_Page.html')", "def main():\n...
[ "0.7605377", "0.75931984", "0.7416024", "0.74143827", "0.72895986", "0.72281426", "0.7225789", "0.72122484", "0.7199378", "0.7175249", "0.713477", "0.70800596", "0.7079004", "0.70520896", "0.7041542", "0.7036038", "0.70346624", "0.7021409", "0.69845974", "0.69750005", "0.6972...
0.0
-1
Extract last hidden state from output of lstm
def extract_last_hidden_state(hidden_state): seq_len, hidden_size = hidden_state.size() assert hidden_size % 2 == 0 split_point = hidden_size // 2 last_hidden_state = torch.cat( [hidden_state[-1, :split_point], hidden_state[0, split_point:]], dim=0 ) return last_hidden_state
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def extract_hidden_states(self, output):\n \n # Extracting the forward and backward hidden states from the last BiLSTM layer\n # output (batch_size, sequence length, 2 * hidden dim)\n output_fw = output[:,:,0:self._hidden_size]\n output_bw = output[:,:,self._hidden_size:]\n ...
[ "0.731287", "0.72596717", "0.7113969", "0.6686127", "0.64504004", "0.6409524", "0.63662976", "0.63348883", "0.6331786", "0.62904716", "0.62328166", "0.6162072", "0.61315686", "0.6120656", "0.6120656", "0.6086838", "0.6086746", "0.607317", "0.60633767", "0.60581803", "0.602836...
0.7847306
0
Use torch.gather for efficient retrieving last hidden states
def extract_last_hidden_state_batched(hidden_state, lengths, bidirectional): bs, seq_len, hidden_size = hidden_state.size() assert bs == len(lengths) assert hidden_size % 2 == 0 split_point = hidden_size // 2 length_v = torch.stack(lengths, dim=0) if bidirectional: last_idx = (length_v ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def extract_hidden_states(self, output):\n # Intermediate hidden states\n output_fw_intermediate = output[:,:-1,0:self._hidden_size]\n output_bw_intermediate = output[:,1:,self._hidden_size:] \n \n # Last hidden states\n output_fw = output[:,-1,0:self._hidden_size]\n ...
[ "0.67791975", "0.6540315", "0.6460809", "0.64193594", "0.64193594", "0.63510245", "0.6349617", "0.6322756", "0.6322756", "0.6322756", "0.61592877", "0.6126712", "0.61177367", "0.6112487", "0.6112487", "0.6099688", "0.6099688", "0.6081144", "0.6081098", "0.60705185", "0.607051...
0.5632198
57
Convenience function to load a json file; replacing some escaped characters.
def load_json(jsonfile): with open(jsonfile) as f: return json.load(f)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _loadf(fname):\n with open(fname, encoding=\"ISO-8859-1\") as f:\n return json.load(f)", "def load_from_json_file(filename):\n with open(filename, 'r') as f:\n json_string = json.load(f)\n return json_string", "def load_from_json_file(filename):\n with open(filename, encoding=...
[ "0.69898105", "0.6446229", "0.6410821", "0.6395228", "0.6358606", "0.63439757", "0.6339141", "0.63355476", "0.6297283", "0.62436426", "0.624272", "0.62292147", "0.62168247", "0.6182956", "0.6163181", "0.6150294", "0.614397", "0.61395746", "0.6137789", "0.61315197", "0.6099809...
0.60256827
25
Load yaml file into a dictionary.
def load_yaml(yml_file): with open(yml_file) as src: cfg = yaml.load(src, Loader=yaml.Loader) return cfg
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_yaml(file_path: str) -> dict:\n assert file_path.endswith(\".yaml\")\n with open(file_path) as file:\n return yaml.load(file, Loader=yaml.FullLoader)", "def load_yaml(path: str) -> Dict[str, Any]:\n with open(path, \"r\", encoding=\"utf8\") as fp:\n data = yaml.safe_load(fp)\n ...
[ "0.82136375", "0.8058277", "0.80454195", "0.79535586", "0.794867", "0.7932453", "0.7909011", "0.7891217", "0.7841622", "0.7834395", "0.7747135", "0.7701002", "0.7691033", "0.7516474", "0.7432293", "0.7432007", "0.7403125", "0.7397374", "0.73946506", "0.73741156", "0.7356898",...
0.75453746
13
r""" Check if automorphism mod `p^k` lifts to automorphism over `\ZZ`. Checks whether an element that is an automorphism of ``rational_function`` modulo `p^k` for various `p` s and `k` s can be lifted to an automorphism over `\ZZ`. It uses the fact that every automorphism has height at most ``ht_bound``
def valid_automorphisms(automorphisms_CRT, rational_function, ht_bound, M, return_functions=False): z = rational_function.parent().gen(0) valid_auto = [] for A in automorphisms_CRT: init_lift = [x.lift() for x in A.list()] # lift coefficients of A # multiply lift by...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def automorphism_group_QQ_CRT(rational_function, prime_lower_bound=4, return_functions=True, iso_type=False):\n if rational_function.parent().is_field():\n K = rational_function.parent()\n R = K.ring()\n else:\n R = rational_function.parent()\n K = R.fraction_field()\n\n F = R....
[ "0.56338507", "0.55300605", "0.54255825", "0.53710145", "0.5158235", "0.5156502", "0.5102196", "0.50654346", "0.5053438", "0.50163954", "0.49781635", "0.4975559", "0.49608102", "0.49501315", "0.49278697", "0.49118054", "0.4897155", "0.48926264", "0.48914677", "0.48809507", "0...
0.55055964
2
Saves the maximum intensity projection of the stack.
def save_projection(self, outputfile, axis=1): filelib.make_folders([os.path.dirname(outputfile)]) maxproj = np.max(self.image, axis=axis) io.imsave(outputfile, maxproj.astype(np.uint8))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save_projection(self, filepath: str | Path) -> None:\n extension = Path(filepath).suffix\n if extension.lower() in IMAGE_TYPES:\n projection = self.get_projection()\n projection = 255 * projection / projection.max()\n cv2.imwrite(filepath, projection.astype(int))\...
[ "0.6401459", "0.59101903", "0.5883825", "0.58102137", "0.5704479", "0.55999213", "0.55868596", "0.5535292", "0.55091345", "0.55073005", "0.5429834", "0.54032594", "0.5395095", "0.53535837", "0.5342881", "0.5339227", "0.52953464", "0.5249621", "0.5243728", "0.52317804", "0.522...
0.7179804
0
Search for a minimizer of 'fun'.
def Optimize(fun, dimensions = 10, dataType = float64, lowerDomain = -5.0, upperDomain = 5.0, constrainToLower = False, constrainToUpper = False, maxMutations = 3, maxIndexe...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def minimize(fun: Callable[..., float],\n x0: np.ndarray,\n args: Tuple = (),\n method: Optional[str] = None,\n **kwargs) -> scipy.optimize.OptimizeResult:\n if method.lower() in OPTIMIZERS:\n optimizer = OPTIMIZERS[method.lower()]\n return optimizer...
[ "0.6238611", "0.61422455", "0.5931987", "0.5888649", "0.58717644", "0.56827825", "0.564708", "0.5544118", "0.5520576", "0.5519069", "0.551651", "0.54757136", "0.5466511", "0.54410505", "0.5427136", "0.5427136", "0.54071116", "0.5406038", "0.53223604", "0.52974635", "0.5269756...
0.4974941
50
Blur an image patch
def blurImgPatch(self,inputImg): [height,width,channels] = inputImg.shape blurKernel = width if width > self.kernelSZ and height > self.kernelSZ: blurKernel = self.kernelSZ else: if blurKernel > height: blurKernel = height outputImg = cv2...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def blur(img):\n\n # We modify a copy of the original image, because we don't want blurred\n # pixels to affect the blurring of subsequent pixels.\n\n target = copy(img)\n\n for y in range(1, get_height(img) - 1):\n for x in range(1, get_width(img) - 1):\n \n rTotal = bTota...
[ "0.75199", "0.7412393", "0.73693836", "0.7347014", "0.7347014", "0.7212999", "0.7152126", "0.7055315", "0.7051717", "0.7027446", "0.7012652", "0.69874287", "0.6834427", "0.6824453", "0.6787434", "0.67055076", "0.66974074", "0.66789067", "0.6666601", "0.66559553", "0.66362816"...
0.8045729
0
if width or height is 0, blurred the whole image. if width or height is bigger than 0, first change the ROI based on enlargeRatio. Then blur region that are notwithin roi
def blurImg(self,inputImg,x,y,width,height,xLEnlarge,xREnlarge,yTEnlarge,yBEnlarge): if width == 0 or height ==0: blurredImg = self.blurImgPatch(inputImg) return[blurredImg,0,0,0,0] if width>0 or height>0: [imgH,imgW,chanles] = inputImg.shape [newX,newY,ne...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def blurImgPatch(self,inputImg):\n [height,width,channels] = inputImg.shape\n blurKernel = width\n if width > self.kernelSZ and height > self.kernelSZ:\n blurKernel = self.kernelSZ\n else:\n if blurKernel > height:\n blurKernel = height \n ou...
[ "0.70842516", "0.6674974", "0.6674974", "0.6602175", "0.6446212", "0.6436527", "0.63996315", "0.63675183", "0.63180053", "0.6268712", "0.62288404", "0.62036306", "0.62015957", "0.6155323", "0.6103302", "0.6096085", "0.6047469", "0.6009214", "0.6004916", "0.59972864", "0.59861...
0.72510856
0
Creates a Lambda Service InvalidRequestContent Response
def invalid_request_content(message): exception_tuple = LambdaErrorResponses.InvalidRequestContentException return BaseLocalService.service_response( LambdaErrorResponses._construct_error_response_body(LambdaErrorResponses.USER_ERROR, message), LambdaErrorResponses._construct_he...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def invalid_response():\n return Response(\n '{\"error\": \"Invalid request\"}',\n status=400,\n mimetype='application/json'\n )", "def create_400_response() -> bytes:\n content_data = HttpServer.get_content_data(\"/bad_request.html\")\n date = datetime.datetime.now(d...
[ "0.7102297", "0.62798995", "0.6269985", "0.62464947", "0.6213035", "0.62122625", "0.62122625", "0.62061197", "0.61978716", "0.61828256", "0.6159508", "0.6112786", "0.6110622", "0.60876316", "0.6057778", "0.60353935", "0.601649", "0.6012238", "0.59565294", "0.5940328", "0.5939...
0.7196143
0
Creates a Lambda Service Generic MethodNotAllowed Response
def generic_method_not_allowed(*args): exception_tuple = LambdaErrorResponses.MethodNotAllowedException return BaseLocalService.service_response( LambdaErrorResponses._construct_error_response_body( LambdaErrorResponses.LOCAL_SERVICE_ERROR, "MethodNotAllowedException" ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def method_not_allowed(error): # pylint: disable=unused-argument\n response = jsonify(\n {\"success\": False, \"error_code\": 405, \"message\": \"Method Not Allowed\"}\n )\n return response, 405", "def response_method_not_allowed():\n\n return b\"HTTP/1.1 405 Method Not Allowed\\r\\n\"", "d...
[ "0.708164", "0.6957019", "0.6849334", "0.6825316", "0.67849696", "0.6732903", "0.65486395", "0.6508789", "0.63655883", "0.6280046", "0.62509525", "0.62502444", "0.6249433", "0.62151664", "0.62121105", "0.6206517", "0.60536444", "0.6022093", "0.59897363", "0.5938604", "0.59379...
0.759363
0
Ensure cbc is correct size and values
def validate_cbc(self, change): value = change["value"] if self.block_count and len(value.array) != np.prod(self.block_count): raise properties.ValidationError( "cbc must have length equal to the product of block_count", prop="cbc", instance=se...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test02(self):\n dtype = np.dtype(\"f4,f8\")\n a = np.ones(30000, dtype=dtype)\n ac = bcolz.carray(a, dtype=dtype)\n self.assertTrue(ac.dtype == dtype)\n self.assertTrue(a.dtype == ac.dtype)\n # print \"ac-->\", `ac`\n assert_array_equal(a, ac[:], \"Arrays are no...
[ "0.6685446", "0.65553933", "0.6547658", "0.6496419", "0.64295065", "0.64147234", "0.6404772", "0.64018273", "0.63549703", "0.63176316", "0.6285494", "0.6271671", "0.6254252", "0.624962", "0.624916", "0.62422884", "0.6231113", "0.62255526", "0.62001216", "0.61935747", "0.61608...
0.6512563
3
Ensure cbc is correct size and values
def validate_cbc(self, change): value = change["value"] if not self.parent_block_count: pass elif len(value.array) != np.prod(self.parent_block_count): raise properties.ValidationError( "cbc must have length equal to the product of parent_block_count", ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test02(self):\n dtype = np.dtype(\"f4,f8\")\n a = np.ones(30000, dtype=dtype)\n ac = bcolz.carray(a, dtype=dtype)\n self.assertTrue(ac.dtype == dtype)\n self.assertTrue(a.dtype == ac.dtype)\n # print \"ac-->\", `ac`\n assert_array_equal(a, ac[:], \"Arrays are no...
[ "0.6685446", "0.65553933", "0.6547658", "0.6512563", "0.6496419", "0.64295065", "0.64147234", "0.6404772", "0.64018273", "0.63549703", "0.63176316", "0.6285494", "0.6271671", "0.6254252", "0.624962", "0.624916", "0.62422884", "0.6231113", "0.62255526", "0.61935747", "0.616085...
0.62001216
19
Ensure cbc is correct size and values
def validate_cbc(self, change): value = change["value"] if not self.parent_block_count: pass elif len(value.array) != np.prod(self.parent_block_count): raise properties.ValidationError( "cbc must have length equal to the product of parent_block_count", ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test02(self):\n dtype = np.dtype(\"f4,f8\")\n a = np.ones(30000, dtype=dtype)\n ac = bcolz.carray(a, dtype=dtype)\n self.assertTrue(ac.dtype == dtype)\n self.assertTrue(a.dtype == ac.dtype)\n # print \"ac-->\", `ac`\n assert_array_equal(a, ac[:], \"Arrays are no...
[ "0.6685446", "0.6547658", "0.6512563", "0.6496419", "0.64295065", "0.64147234", "0.6404772", "0.64018273", "0.63549703", "0.63176316", "0.6285494", "0.6271671", "0.6254252", "0.624962", "0.624916", "0.62422884", "0.6231113", "0.62255526", "0.62001216", "0.61935747", "0.616085...
0.65553933
1
Ensure cbc is correct size and values
def validate_cbc(self, change): value = change["value"] if not self.parent_block_count: pass elif len(value.array) != np.prod(self.parent_block_count): raise properties.ValidationError( "cbc must have length equal to the product of parent_block_count", ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test02(self):\n dtype = np.dtype(\"f4,f8\")\n a = np.ones(30000, dtype=dtype)\n ac = bcolz.carray(a, dtype=dtype)\n self.assertTrue(ac.dtype == dtype)\n self.assertTrue(a.dtype == ac.dtype)\n # print \"ac-->\", `ac`\n assert_array_equal(a, ac[:], \"Arrays are no...
[ "0.6685446", "0.65553933", "0.6547658", "0.6512563", "0.6496419", "0.64295065", "0.64147234", "0.6404772", "0.64018273", "0.63549703", "0.63176316", "0.6285494", "0.6271671", "0.6254252", "0.624916", "0.62422884", "0.6231113", "0.62255526", "0.62001216", "0.61935747", "0.6160...
0.624962
14
Convet date string into datatime
def str_2_date( sdate ): if isinstance( sdate, str ): for fmt in ( "%Y-%m-%d", "%m/%d/%Y" ): try: return datetime.strptime( sdate, fmt ).date() except ValueError: pass else: return sdate
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def str2date(s):\n return datetime.strptime(s.decode(), \"%Y-%m-%d %H:%M:%S\")", "def to_datetime(date_string):\n return dt.strptime(date_string, '%Y-%m-%d')", "def convert_str2date(date):\n import datetime\n date = str(date)\n year = int(date[0:4])\n month = int(date[4:6])\n day = int...
[ "0.77682054", "0.7404678", "0.73018855", "0.72948354", "0.72912806", "0.7272908", "0.7261246", "0.7252554", "0.72475135", "0.7233508", "0.7219192", "0.71932834", "0.71557796", "0.7137902", "0.7061531", "0.7032363", "0.7027367", "0.7014714", "0.70046353", "0.700098", "0.699589...
0.697747
22
return boxplot of desidered column
def plot_boxplot(df, colname = None, title = 'Out of the ordinary billion dollar funded proposal\n', vertical_line=9): # set parameters for the box plot _=plt.rcParams['figure.figsize'] = [14,6] _=plt.style.use(['fivethirtyeight']) # use log transform to plot the award...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def plot_box(df, column_name):\n df.boxplot(column=column_name)\n plt.show()", "def check_outliers(df, col, cat):\n \n if len(cat) == 0:\n boxplot = df.boxplot(column=[col], rot = 90)\n else:\n for c in cat:\n boxplot = df.boxplot(column=[col], by=[c], rot = 90)", "def p...
[ "0.71451867", "0.6665482", "0.6602079", "0.6444729", "0.6206091", "0.6195572", "0.61714244", "0.6150998", "0.61054677", "0.60654145", "0.5997369", "0.5949316", "0.5885669", "0.5885103", "0.5850617", "0.5818628", "0.5809483", "0.58035576", "0.5798477", "0.5774535", "0.57618845...
0.6282541
4
conv2d returns a 2d convolution layer with full stride.
def conv2d(x, W): return tf.nn.conv2d(x, W, strides=[1, 1, 1, 1], padding='SAME')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_conv2d():\n img = np.array([\n [0.3, 0.5, 0.7, 0.9],\n [0.1, 0.3, 0.5, 0.7],\n [0.9, 0.7, 0.5, 0.3],\n ])\n template = np.array([\n [1, 0],\n [1, 0],\n ])\n template = np.flipud(np.fliplr(template))\n return fftconvolve(img, template, mode='valid')", ...
[ "0.7629538", "0.7627165", "0.7579147", "0.7463493", "0.74578935", "0.74578935", "0.7386576", "0.7337714", "0.7330282", "0.73295087", "0.7313963", "0.73015827", "0.7296284", "0.72696656", "0.72463566", "0.72321266", "0.72088444", "0.7196564", "0.71902525", "0.7187835", "0.7152...
0.7426121
6
weight_variable generates a weight variable of a given shape.
def weight_variable(shape): initial = tf.truncated_normal(shape, stddev=0.1) return tf.Variable(initial)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def weight_variable(shape):\n initial = tf.truncated_normal(shape, stddev=0.1)\n return tf.get_variable(\n 'weight', initializer=initial, regularizer=tf.nn.l2_loss)", "def weight_variable(shape):\n initial = tf.truncated_normal(shape)\n return tf.Variable(initial)", "def create_weight_variable(shape):...
[ "0.82682097", "0.8235508", "0.8158841", "0.8156995", "0.81399417", "0.81399417", "0.81399417", "0.8137802", "0.812119", "0.80655366", "0.7983301", "0.79793143", "0.79584336", "0.79206425", "0.777795", "0.7553387", "0.7533732", "0.75042933", "0.73055935", "0.7289978", "0.72055...
0.81348443
13
Returns the response data for both the login and refresh views. Override to return a custom response such as including the serialized representation of the User.
def jwt_response_payload_handler(token, user=None, request=None): return { 'token': token }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get(self, request):\n user = request.user\n serializer = self.serializer_class(user)\n return response.Response({\"user\": serializer.data})", "def get(self, request):\n serializer = UserSerializer(request.user)\n return Response(serializer.data, status=status.HTTP_200_OK)"...
[ "0.71477854", "0.7042849", "0.70153284", "0.69196826", "0.6801839", "0.67474884", "0.6719735", "0.6637985", "0.66109943", "0.6546731", "0.6451097", "0.6448765", "0.6432371", "0.6409321", "0.6401796", "0.638653", "0.6378032", "0.6340211", "0.63187706", "0.63144183", "0.6294784...
0.0
-1
All projects in this module are UNLOCKED Emulates that it found logged_user as the SOLE user of this project and returns the ProjectState indicating his as owner
def mocks_on_projects_api(mocker, logged_user) -> None: nameparts = logged_user["name"].split(".") + [""] state = ProjectState( locked=ProjectLocked( value=False, owner=Owner( user_id=logged_user["id"], first_name=nameparts[0], last...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_user_only_sees_own_project_state(self):\n self.client.force_authenticate(self.global_user_1)\n data = self.client.get(self.api_project_detail_url, {'user': 'current'}).data\n self.assertTrue(data.get('enrolled'))\n\n not_enrolled_user = get_user_model().objects.annotate(\n ...
[ "0.63406867", "0.593039", "0.5854211", "0.56678814", "0.5425527", "0.54105276", "0.539254", "0.53627026", "0.5341819", "0.53308934", "0.5299552", "0.52942896", "0.52891177", "0.5286757", "0.5283151", "0.5268569", "0.5216464", "0.5214507", "0.51549286", "0.5139442", "0.510455"...
0.6656319
0
Computes the precision of SIATECH by using other_output as the ground truth.
def compute_fraction_in_output(siatechf_output, other_output): count = 0 for tec in other_output: if tec in siatechf_output: count += 1 return count / len(other_output)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def precision(classifier_output, true_labels):\n\n # TODO: finish this.\n conf_matrix = confusion_matrix(classifier_output, true_labels)\n return conf_matrix[0][0]/(conf_matrix[0][0] + conf_matrix[1][0])", "def precision(ground_truth, prediction):\n ground_truth = remove_duplicates(ground_truth)\n ...
[ "0.6081986", "0.5938014", "0.58727837", "0.5698068", "0.5515423", "0.55059355", "0.54723775", "0.546638", "0.54405594", "0.5405584", "0.5404393", "0.5398009", "0.53976107", "0.53976107", "0.53976107", "0.53976107", "0.53976107", "0.53976107", "0.53976107", "0.53976107", "0.53...
0.6582182
0
Searches a column in an openpyxl sheet for a specific value. This is to stop the script from breaking if users add/remove rows when entering variables etc.
def search_col(sheet, start, value, limit=200): # first, split column letter from row number in start variable re_str = re.compile('[^a-zA-Z]') # will identify all non letters col = re_str.sub('', start) # get our column re_int = re.compile('[^0-9]') # will identify all non integers row = int(re...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_cell(sheet,name,i,max_col):\n for rows in sheet.iter_rows(min_row=i, max_row = i+1, min_col=1,max_col=max_col):\n for cell in rows:\n if name == cell.value:\n return cell", "def _col_match(sheet, row, value):\r\n for cell in sheet[row]:\r\n if cell.value == v...
[ "0.69581926", "0.69426215", "0.616242", "0.60265464", "0.59252965", "0.590594", "0.590191", "0.5893661", "0.5824546", "0.57441264", "0.5664028", "0.5630745", "0.56166", "0.55592704", "0.55473524", "0.5525248", "0.5514061", "0.54953766", "0.5431573", "0.5431549", "0.541189", ...
0.72758317
0
input x of shape (batch_size, seq_len). Output Tensor same shape with positions 1 to seq_len where padding tokens set to zero.
def calc_pos(x): a = torch.arange(1, x.shape[1] + 1).unsqueeze(0).to(x.device) p = a.expand(x.shape[0], -1) mask = (x != 0).long() return p * mask
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_padding_mask(seq):\r\n seq = tf.cast(tf.math.equal(seq, 0), tf.float32)\r\n return seq[:, tf.newaxis, tf.newaxis, :] # (batch_size, 1, 1, seq_len)\r", "def transform(self, x): # takes no other parameters (use fields initialized in constructor instead).\n if self.do_clean:\n x...
[ "0.69919807", "0.6808035", "0.66209394", "0.6454651", "0.6430529", "0.63178974", "0.6281539", "0.6180782", "0.6120763", "0.6101304", "0.60437137", "0.60340756", "0.599827", "0.5995828", "0.59464383", "0.59333456", "0.5821633", "0.58181113", "0.58008766", "0.5775751", "0.57553...
0.0
-1