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
Home page for admins.
def admin_dashboard(request): data = request.GET.copy() if "assigned_to" not in data: data["assigned_to"] = request.user.id assignment_form = AssignmentForm(data) assigned_to: Optional[Person] = None if assignment_form.is_valid(): assigned_to = assignment_form.cleaned_data["assigned_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index():\n aaa.require(fail_redirect='/login')\n return 'Welcome! <a href=\"/admin\">Admin page</a> <a href=\"/logout\">Logout</a>'", "def homepage():\n form = LoginForm()\n return render_template(\"admin/index.html\", title=\"Admin\", form=form)", "def a_homepage():\n\n\treturn render_template...
[ "0.7945342", "0.7898725", "0.7846889", "0.7805137", "0.7791227", "0.7730001", "0.7614066", "0.75273144", "0.75050336", "0.7444577", "0.738299", "0.73468536", "0.7344059", "0.7305742", "0.7301848", "0.72301584", "0.72245437", "0.7212336", "0.71198", "0.7115693", "0.7096103", ...
0.0
-1
Calculates the effective distance between two particles using periodic BCs and the minimum image convention.
def radial_distance(x_i, y_i, z_i, x_j, y_j, z_j, box_length): delta_x = min(((x_i - x_j) % box_length), ((x_j - x_i) % box_length)) delta_y = min(((y_i - y_j) % box_length), ((y_j - y_i) % box_length)) delta_z = min(((z_i - z_j) % box_length), ((z_j - z_i) % box_length)) return np.sqrt(delta_x ** 2 + d...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pbc_distance(s, p1, p2):\n if not np:\n raise PysimmError('pysimm.calc.pbc_distance function requires numpy')\n frac_x1 = p1.x / s.dim.dx\n frac_y1 = p1.y / s.dim.dy\n frac_z1 = p1.z / s.dim.dz\n\n frac_x2 = p2.x / s.dim.dx\n frac_y2 = p2.y / s.dim.dy\n frac_z2 = p2.z / s.dim.dz\n\n...
[ "0.6819718", "0.6360672", "0.63151395", "0.6140009", "0.6072757", "0.60339713", "0.59786314", "0.5944743", "0.594401", "0.59171224", "0.5889983", "0.58717775", "0.585234", "0.5792233", "0.577857", "0.57664967", "0.57584375", "0.5754176", "0.575309", "0.5723716", "0.57102215",...
0.0
-1
Returns if the stack is empty
def is_empty(self): return len(self.container) == 0
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_empty(self):\n return len(self.the_stack) == 0", "def is_empty(self):\n return len(self.stack) == 0", "def empty(self):\r\n return len(self.stack) == 0", "def empty(self):\n return len(self.stack) == 0", "def empty(self):\n return len(self.stack) == 0", "def empt...
[ "0.9136745", "0.90912586", "0.90169245", "0.89676744", "0.89676744", "0.89301693", "0.88711935", "0.8862364", "0.8785459", "0.8762482", "0.8744913", "0.87208045", "0.8718943", "0.8693003", "0.86820203", "0.86569405", "0.8606521", "0.8605344", "0.8552922", "0.8552922", "0.8525...
0.7291189
78
Get the value of the SETTINGSPATH variable.
def get_cached_setting_path(): rainmeterpath = get_cached_program_path() if not rainmeterpath: return # Check if Rainmeter.ini is in Rainmeter program directory if os.path.exists(rainmeterpath + "Rainmeter.ini"): logger.info("Rainmeter.ini found in " + rainmeterpath) return rai...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def settings():\n return _get_settings()[1]", "def get_setting_value(self, key, default = None):\n \n if not \"settings\" in self.configuration or not key in self.configuration['settings']:\n return default\n \n return self.configuration['settings'][key]", "def get(self):\n ...
[ "0.6842992", "0.6335857", "0.6275449", "0.62593746", "0.61901927", "0.61545557", "0.61496544", "0.6009818", "0.59938174", "0.5986768", "0.594463", "0.5913869", "0.590535", "0.58822876", "0.58606815", "0.58568335", "0.5844235", "0.58172464", "0.581597", "0.5799968", "0.5781500...
0.56823087
31
Return a random name from list of first names.
def get_first_name(gender=None): if gender is None: gender = choice(['male', 'female', 'unisex']) if gender == 'male': return male_first_names[randrange(0, len(male_first_names))] elif gender == 'female': return female_first_names[randrange(0, len(female_first_names))] else: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def name_generator():\n firsts = [\"Albrecht\", \"Lysa\", \"Yvette\", \"Jésus\", \"Amanitus\"]\n lasts = [\"Andersson\", \"Natt och Dag\", \"av Pommern\", \"Krusmynta\"]\n\n random.seed()\n first = firsts[random.randint(0, len(firsts)-1)]\n last = lasts[random.randint(0, len(lasts)-1)]\n\n name =...
[ "0.72883177", "0.72351474", "0.7131942", "0.71283317", "0.6977561", "0.68691576", "0.6837589", "0.6833064", "0.68179077", "0.6741488", "0.67375314", "0.67335725", "0.6717533", "0.66350204", "0.66245836", "0.6591185", "0.6561171", "0.65499014", "0.6546788", "0.6540144", "0.653...
0.7050155
4
Pick a random last name that probably fits the first name.
def get_last_name(first_name): """Order last names so that names closest to first name are first. For example first name "Kikke" -> last names should be "Kilari", "Kolari", [all other names by random]""" def name_comparator(last_name): """Return a number describing how close the two names ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def last_name():\n return dice.choice(names.lastname)", "def get_random_lastname_nameson ():\n name = db.get_database(DB_LAST_NAMESON).random_pop()\n if not name:\n return get_random_lastname_simple()\n if name.endswith('s'):\n if coinflip():\n return name\n else:\n ...
[ "0.8678248", "0.8173135", "0.7954444", "0.79304785", "0.79118353", "0.78715104", "0.78149456", "0.7704602", "0.7629675", "0.75052506", "0.7468169", "0.74461704", "0.7433679", "0.74214315", "0.7402955", "0.7387465", "0.72566813", "0.72295713", "0.71193695", "0.7050415", "0.702...
0.7657594
8
Return a number describing how close the two names are.
def name_comparator(last_name): score = 0 # check if first n letters of first and last name matches for i in range(1, 4): if len(first_name) >= i and len(last_name) >= 2: # if previous letter does not match, don't continue if i > 1 and score > (i - 1)...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def name_similarity(name_1, name_2, nickname_2=None):\n name_similarity = string_similarity(name_1, name_2)\n nickname_similarity = 0\n if nickname_2:\n nickname_similarity = string_similarity(name_1, nickname_2)\n return max(name_similarity, nickname_similarity)", "def distance(a, b):\n a ...
[ "0.62964356", "0.61376125", "0.599902", "0.59363335", "0.58911693", "0.5889284", "0.5876149", "0.5876149", "0.585003", "0.5835335", "0.5828301", "0.5825897", "0.577654", "0.57711357", "0.57382655", "0.5733739", "0.57252467", "0.5716687", "0.5715054", "0.57138366", "0.57008845...
0.54135513
61
Get an element from a particular position. Assume the first position is "1". Return "None" if position is not in the list.
def get_position(self, pos): element = self.head count = 1 if pos == 1: return element elif pos > 1 and self.head: while count < pos: element = element.next count += 1 if element is None: break ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def element_at(ll, position):\n curr = ll.head\n i = 1\n while curr != None:\n if i == position:\n break\n i += 1\n curr = curr.link\n\n if curr == None:\n return \"Index out of range\"\n else:\n return curr.data", "def get_element(self, pos):\n ...
[ "0.7621666", "0.7285017", "0.6938286", "0.6937017", "0.6791626", "0.66411597", "0.6605957", "0.65727466", "0.65107065", "0.6480833", "0.647763", "0.6356108", "0.6347845", "0.63478374", "0.62554276", "0.6244375", "0.6207665", "0.6198558", "0.6186882", "0.60619885", "0.6058011"...
0.72734886
2
Convert str to list.
def _convert_str_to_list(cls, v: Union[List[str], str]) -> List[str]: if isinstance(v, str): return v.split(",") return v # cov: ignore
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def str2list(input):\n if isinstance(input, str):\n return [input]\n\n else:\n return input", "def test_string_to_list_string(self):\n\n assert_equals(\n str_to_list('a, b, c'),\n ['a', 'b', 'c']\n )", "def test_string_to_list_string(self):\n asser...
[ "0.8150113", "0.80779827", "0.80618197", "0.7610309", "0.7434237", "0.7415106", "0.7388331", "0.7299494", "0.72993934", "0.72633165", "0.7252828", "0.72253144", "0.7216637", "0.7199655", "0.719531", "0.71830726", "0.71489763", "0.7148251", "0.713953", "0.71065813", "0.7087192...
0.8037864
3
set up user before each testing
def setUp(self): db.drop_all() db.create_all() self.uid = 1000 # create category cat = Category.retrieve_or_add('Business') self.cat = cat # create user u = User.signup('testuser', 'test@test.com', 'password', cat.id) u.id = self.uid db....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setup_user(self):\r\n self.email = 'foo@test.com'\r\n self.password = 'bar'\r\n self.username = 'test'\r\n self.create_account(self.username,\r\n self.email, self.password)\r\n self.activate_user(self.email)\r\n self.login(self.email, self.pa...
[ "0.80820966", "0.8079363", "0.79862964", "0.79581815", "0.7953772", "0.79460496", "0.7928231", "0.79086274", "0.79053104", "0.7889239", "0.7861746", "0.7844081", "0.7792283", "0.779073", "0.7788672", "0.77838326", "0.77736706", "0.7771921", "0.77512485", "0.7727645", "0.77250...
0.0
-1
Check if proper custom 404 is returned
def test_custom_404(self): c = Client() response = c.get("/apimock/mocked/non_exsitng-url") self.assertEqual(response.status_code, 404) self.assertEqual('MockedApi 404', response.content)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def not_found():\n return HttpError(404)", "def error_404(error):\n return '404 Error'", "def handleStatus_404(self):\n log.err('HTTP Error 404')", "def resource_not_found(exc, request):\r\n request.response_status = \"404 Not Found\"\r\n return {'message': str(exc)}", "def error_404(err...
[ "0.78583574", "0.76247245", "0.76133496", "0.7507876", "0.7484881", "0.74388623", "0.7351893", "0.73385626", "0.73268235", "0.732348", "0.73057055", "0.729766", "0.72964656", "0.72913116", "0.72688", "0.7229831", "0.7215828", "0.72096294", "0.72059107", "0.72011703", "0.72007...
0.7423476
6
check if proper 403 is returned when user use GET for post mocked apis
def test_custom_403(self): c = Client() response = c.get("/apimock/mocked/mocked_post?format=json") self.assertEqual(response.status_code, 403) self.assertEqual( "wrong used test Data,this is api for POST", response.content)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_get(self):\n self.assertEqual(403, self.response.status_code)", "def test_custom_403(self):\n c = Client()\n response = c.post(\"/apimock/mocked/mocked_get\", data={\"post\": \"data\"})\n self.assertEqual(response.status_code, 403)\n self.assertEqual(\"wrong used test ...
[ "0.8477762", "0.83405644", "0.7795127", "0.77946997", "0.7675098", "0.76543826", "0.76290435", "0.7548493", "0.75284475", "0.75284475", "0.75284475", "0.75284475", "0.73769194", "0.7370787", "0.73403263", "0.73308927", "0.73085845", "0.7304792", "0.72927475", "0.7281341", "0....
0.8427522
1
remove punctuation and split sentence.return list of words
def sentence_split(sentence, max_length): # sentence = re.sub("[\s+\.\!\/_,$%^*(+\"\')]+|[+——()?【】“”!,。?、~@#¥%……&*()]+'", "", sentence) sentence = [x for x in sentence if x not in string.punctuation] sentence = ''.join(sentence) words = sentence.split() if max_length == 0: return words e...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sent_to_words(sent: str) -> List[str]:\n return [word for word in sent.split() if word not in string.punctuation]", "def _get_words_and_punctiation(sentence: str) ->List[str]:\n return sum((_separate_word_and_punctiation(word) for word in sentence.strip().split()), [])", "def tokenize(sentence):\n ...
[ "0.83839446", "0.8066631", "0.79742265", "0.78544116", "0.7682107", "0.76210004", "0.76034623", "0.75280344", "0.7510194", "0.74988544", "0.74941933", "0.7485036", "0.7485036", "0.74718326", "0.7460968", "0.74501824", "0.7443969", "0.7443314", "0.74393404", "0.74151", "0.7412...
0.701618
78
Test that the root path redirects to index.html
def test_index_endpoint(client): result = client.get('/') assert result.status_code == 302 assert result.headers['Location'] == 'http://localhost/index.html'
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def testindex(self):\n rv = self.app.get('/')\n self.assertEqual(rv.status_code, 302, \"homepage didnot load\")", "def test_root(self):\n response = self.app.test_client().get('/test/')\n self.assertEqual(response.status_code, 200)\n self.assert_template_used('test/index.html')...
[ "0.84035623", "0.8303994", "0.7996202", "0.78507525", "0.7787608", "0.76489866", "0.7591511", "0.7524224", "0.7486674", "0.74832886", "0.74512833", "0.73959297", "0.737639", "0.7368546", "0.7368546", "0.73294044", "0.7328998", "0.7309737", "0.728753", "0.71861535", "0.7151073...
0.77129084
5
Gives a string representation of the marked object.
def __unicode__(self): return unicode(self.obj)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __str__(self):\n return f\"Marker at {super().__repr__()}\"", "def __str__(self):\n return str(self.obj)", "def __str__(self):\n return str(self.__dict__['_obj'])", "def __str__(self):\n return repr(self)", "def as_string(self):\n return self.__repr__()", "d...
[ "0.7030285", "0.70226294", "0.6991926", "0.68982446", "0.683817", "0.6819721", "0.67960805", "0.6724537", "0.6721131", "0.6717878", "0.6716096", "0.6707017", "0.6702228", "0.6702228", "0.6702228", "0.6702228", "0.6702228", "0.6701693", "0.6696457", "0.66909206", "0.66909206",...
0.0
-1
Compares this marked object with another.
def __eq__(self, other): if isinstance(other, self.__class__): return ( other.obj == self.obj and other.color_tag == self.color_tag )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __eq__(self, other):\n return (type(other) == type(self) and\n self._marker == other._marker and self._marker_set == other._marker_set)", "def __eq__(self, other):\n return (type(self) == type(other) and\n self._marker == other._marker and\n self._ma...
[ "0.7151024", "0.7135169", "0.71309316", "0.7119663", "0.70084184", "0.70066905", "0.7001026", "0.6926195", "0.69216704", "0.6881256", "0.6881256", "0.6881256", "0.6881256", "0.6881256", "0.6881256", "0.6881256", "0.6881256", "0.6881256", "0.6881256", "0.6881256", "0.6881256",...
0.6900158
9
The type of this server.
def server_type(self): ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def server_type(self):\n return self._server_type", "def server_type(self, im_self):\n parameter = im_self.instance_manager.config\n server_type = parameter.get(\"server_type\")\n if not server_type:\n server_type = im_self.instance_manager.instance_type\n return ser...
[ "0.8977932", "0.8341313", "0.80476475", "0.7869499", "0.7573198", "0.7485838", "0.74465495", "0.74465495", "0.74465495", "0.74465495", "0.74465495", "0.74465495", "0.74465495", "0.74465495", "0.74465495", "0.74465495", "0.74465495", "0.74465495", "0.74465495", "0.74465495", "...
0.8303305
2
The server type as a human readable string.
def server_type_name(self): ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def type_as_string(self):\n return self.properties.get('TypeAsString', None)", "def server_type(self):\n return self._server_type", "def getTypeString(self):\n return '_'.join(self.types)", "def __str__(self) -> str:\n return self.type", "def type(self) -> str:\n return s...
[ "0.7344737", "0.7315298", "0.7287256", "0.72538835", "0.7240325", "0.71924686", "0.7166505", "0.7153453", "0.7153453", "0.7153453", "0.7153453", "0.7153453", "0.7153453", "0.7153453", "0.7153453", "0.7153453", "0.7153453", "0.7153453", "0.7153453", "0.7153453", "0.7153453", ...
0.77974
0
Replica set name or None.
def replica_set_name(self): ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def api_entity_set_name(self) -> Optional[str]:\n return pulumi.get(self, \"api_entity_set_name\")", "def configuration_set_name(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(self, \"configuration_set_name\")", "def mmo_config_server_replset_name(self, mmo_connection):\n replse...
[ "0.6721763", "0.6476262", "0.64114815", "0.6346835", "0.6346835", "0.6346835", "0.6225589", "0.61065835", "0.6106579", "0.6015119", "0.58811915", "0.5877517", "0.58760566", "0.58623224", "0.58623224", "0.58278364", "0.58278364", "0.58278364", "0.58278364", "0.58278364", "0.58...
0.819173
0
Returns the connection state
def get_connection_state(self): return self.connection_state
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def state(self):\n return pn_connection_state(self._impl)", "def get_status(self):\n return self._conn_state", "def connection_status(self):\n return self._connection_status", "def getConnectionStatus(self): \n return getI1ProConnectionStatus()", "def status(self) -> Optional[...
[ "0.85136414", "0.85054743", "0.83113176", "0.77379775", "0.7107713", "0.7093966", "0.7051949", "0.70308185", "0.6925545", "0.6915965", "0.6915965", "0.68942153", "0.6871416", "0.6871416", "0.6871416", "0.6871416", "0.6871416", "0.68663585", "0.68611425", "0.68611425", "0.6857...
0.91785175
0
Get whether node represents a commutative operation.
def is_commutative(self, node): return node.name in commutative_operations
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_commutative(self):\n try:\n return self.universe().is_commutative()\n except Exception:\n # This is not the mathematically correct default, but agrees with\n # history -- we've always assumed factored things commute\n return True", "def is_commutat...
[ "0.8167537", "0.74395525", "0.7198252", "0.6474786", "0.6446182", "0.6431138", "0.591396", "0.5809449", "0.5718351", "0.57041776", "0.57041776", "0.57041776", "0.5683571", "0.5662683", "0.5659182", "0.5600629", "0.5599179", "0.5581757", "0.55292344", "0.551807", "0.55148786",...
0.9061283
0
Attempt to simplify the value of a symbol.
def visit_Symbol(self, node): symbol = self.symbol_table.lookup(node.name) if not symbol: raise IRError('Symbol "%s" was not declared.' % node.name) value = symbol.value # Constant value. if get_const(value): return value # Try to evaluate and/or ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def simplify(self, expr):\n return sy.simplify(expr)", "def _simplify(expr):\n from sympy.simplify.simplify import simplify\n return simplify(expr)", "def auto_simplify(expression):\n return simplify(expression, auto_identify_var=True)", "def _hill_normalize_symbol(symb):\n symb = ptab...
[ "0.6652284", "0.65075713", "0.60143065", "0.5866851", "0.58293575", "0.5721947", "0.5650128", "0.5627729", "0.5622254", "0.5523318", "0.5513863", "0.5506159", "0.55028325", "0.5501252", "0.54781353", "0.539576", "0.5358264", "0.52991414", "0.52785933", "0.5242953", "0.5227516...
0.5514455
10
Check if the client is running.
def is_geth_running(self) -> bool: command = 'docker exec -t %s geth attach ipc://root/abc/geth.ipc --exec "admin.nodeInfo"' % self.name result = self.ip.exec_command(command) return False if result.split(':')[0] == 'Fatal' else True
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def has_client(self):\n \n return len(self._clients) > 0", "def has_client(self):\n \n return len(self._clients) > 0", "def is_instance_running(self):\n try:\n self.instance.wait(timeout=1)\n except psutil.TimeoutExpired:\n pass\n return se...
[ "0.7637825", "0.7637825", "0.7622727", "0.7618487", "0.7616242", "0.7595961", "0.7573939", "0.7555208", "0.75325614", "0.7527952", "0.7525759", "0.7478436", "0.74713784", "0.745852", "0.7454764", "0.7443805", "0.743943", "0.74381196", "0.7428633", "0.7428633", "0.7428633", ...
0.0
-1
expects a byterepresentation of a RR in dns payload format, and returns the corresponding python class _type The DNS type of this resource record; one of { RR.TYPE_A (DNS A record), RR.TYPE_NS (DNS NS record), RR.TYPE_CNAME (DNS CNAME record), RR.TYPE_SOA (DNS startofauthority record), RR.TYPE_PTR (DNS PTR record), RR....
def get_record_type(rr, offset=0): (generic_type, _) = RR.fromData(rr,offset) return { RR.TYPE_A : RR_A, RR.TYPE_AAAA : RR_AAAA, RR.TYPE_NS : RR_NS, RR.TYPE_CNAME : RR_CNAME }[generic_type._type]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getRecord(self, rr):\n\t\tif rr.type == 1: return {'type': 'a', 'ipv4': socket.inet_ntoa(rr.rdata), 'hostname': rr.name}\n\t\telif rr.type == 28: return {'type': 'aaaa', 'ipv6': socket.inet_ntop(socket.AF_INET6, rr.rdata), 'hostname': rr.name}\n\t\telif rr.type == 5: return {'type': 'cname', 'hostname': rr.nam...
[ "0.7146565", "0.6015138", "0.59709066", "0.5865239", "0.57867783", "0.5784424", "0.5748848", "0.57329434", "0.5726262", "0.5657405", "0.563685", "0.56225747", "0.5615846", "0.55962235", "0.55931425", "0.55123085", "0.5488842", "0.54651594", "0.54462713", "0.5410197", "0.54101...
0.7728938
0
Takes an rgb tuple and returns a binary mask of size im.shape[0] x im.shape[1] indicated where each color is present.
def getClassMask(self, rgb, im): # Colour mask if len(rgb) == 3: r, g, b = rgb r_mask = im[:,:, 0] == r g_mask = im[:,:, 1] == g b_mask = im[:,:, 2] == b mask = r_mask & g_mask & b_mask return mask # 8-bit mask retur...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def apply_mask(im, mask, color=(1, 0, 0)):\n masked = np.zeros(im.shape)\n for x, y in mask: masked[x][y] = color\n return masked", "def get_binary_mask(self,index):\n mask = self.load_mask_png(index)\n (rows,cols) = np.where(mask>0)[0:2] #pixels in mask disregarding the color\n new...
[ "0.6462228", "0.6456575", "0.6320458", "0.6254598", "0.6254598", "0.6254598", "0.6125386", "0.611335", "0.6102216", "0.6047716", "0.6037275", "0.6013088", "0.6007022", "0.59658015", "0.5934", "0.5929794", "0.5925482", "0.58822155", "0.5871266", "0.5869979", "0.5854807", "0....
0.6874078
0
Returns a matplotlib color map of the list of RGB values
def getColorMap(colors): # Normalise RGBs norm_colors = [] for color in colors: norm_colors.append([val / 255. for val in color]) # create color map cmap = cols.ListedColormap(norm_colors) return cmap
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def assigning_colors():\n rgb_colors = {}\n for name, hex in matplotlib.colors.cnames.items():\n color = []\n # So the values are from 0-255 and not 0-1\n for i in matplotlib.colors.to_rgb(hex):\n color.append(int(i * 255))\n\n color = tuple(color)\n rgb_colors[n...
[ "0.73338586", "0.7123635", "0.7009928", "0.7005373", "0.7005373", "0.7005373", "0.7005373", "0.6996131", "0.6992776", "0.6970794", "0.69396114", "0.6931149", "0.6913004", "0.69088805", "0.68760693", "0.6846079", "0.68284696", "0.67972285", "0.6796453", "0.6758509", "0.6719535...
0.7553803
0
Gets examples for a particular split of the data.
def get_examples(self, split: dataset_split.DatasetSplit, examples_filename: str = '', max_action_length: int = -1) -> Dict[str, instruction_example.InstructionExample]: if examples_filename and split != dataset_split.DatasetSplit.SPECIFIED: raise ValueError('Providing a list of...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _read_examples(self, split: base.Split) -> tf.data.Dataset:\n if split == base.Split.TEST:\n return tf.data.Dataset.range(self._num_test_examples)\n if split == base.Split.TRAIN:\n return tf.data.Dataset.range(self._num_train_examples)\n if split == base.Split.VAL:\n return tf.data.Data...
[ "0.73122287", "0.67325944", "0.6605971", "0.65933925", "0.6404626", "0.62684566", "0.62538815", "0.62517047", "0.6237795", "0.6213785", "0.62136585", "0.6192596", "0.619241", "0.6184776", "0.61600727", "0.61085635", "0.61026376", "0.6099065", "0.60929734", "0.6082335", "0.607...
0.6468429
4
Test that correct phone fields are returned.
def test_parse_phone(self): phone_dict = parse_phone('800-555-1234') self.assertTrue(str(phone_dict), "{'area_code': '800', 'exchange': '555', 'number': '1234'}")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_get_phone(self, raw, expected):\n\n field_mapper = FieldMapper(Row([raw], ['Mobile_Phone']))\n actual = field_mapper.get_phone()\n self.assertEqual(expected, actual)", "def test_good_phone():\n good_phone = \"213-555-1212\"\n m = CannedRe.PHONE.match(good_phone)\n# print ge...
[ "0.78902483", "0.77011335", "0.7565504", "0.742881", "0.72397625", "0.72144276", "0.7206304", "0.72054046", "0.70200855", "0.70098495", "0.69413275", "0.69135946", "0.69070965", "0.68357646", "0.68008983", "0.67564094", "0.6741974", "0.674195", "0.66709137", "0.6645231", "0.6...
0.7411666
4
Convert UTC date to milliseconds If using offset strings add "UTC" to date string e.g. "now UTC", "11 hours ago UTC"
def date_to_milliseconds(date_str): # get epoch value in UTC epoch = datetime.utcfromtimestamp(0).replace(tzinfo=pytz.utc) # parse our date string d = dateparser.parse(date_str) # if the date is not timezone aware apply UTC timezone if d.tzinfo is None or d.tzinfo.utcoffset(d) is None: d...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def localtime2utc(date):\n return date + (datetime.utcnow() - datetime.now())", "def utctime(stamp):\n return stamp + utc_offset", "def utc_offset_convert(utc_offset):\n offset=abs(utc_offset)\n hour=str(offset//3600)\n if len(hour)==1:\n hour=str(0)+hour\n\n minute=str(offset%3600//60...
[ "0.6446677", "0.6346229", "0.625572", "0.60407746", "0.60031015", "0.5981766", "0.5963632", "0.5949372", "0.59012514", "0.5856362", "0.5855448", "0.581893", "0.581748", "0.5801755", "0.5787033", "0.5773822", "0.5726361", "0.5695116", "0.56902283", "0.5687754", "0.56733453", ...
0.58231986
11
Gets the item comparer that is used to order items.
def item_comparer(self): return self.item_comparer_value
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def comparer(self):\n return self._comparer", "def comparator(self) -> Operator:\n return self.__comparator", "def item_comparer(self, value):\n self.item_comparer_value = value", "def __init__(self, ItemComparer):\n self.item_comparer = ItemComparer", "def GetColumnSorter(self)...
[ "0.7346395", "0.6112753", "0.5877187", "0.58676106", "0.55384547", "0.53525156", "0.53254044", "0.52932197", "0.5243416", "0.5220343", "0.5213987", "0.5188067", "0.5131104", "0.51247746", "0.50830907", "0.5064183", "0.5050168", "0.5008177", "0.4956598", "0.4949665", "0.493541...
0.7915967
0
Sets the item comparer that is used to order items. This accessor is private.
def item_comparer(self, value): self.item_comparer_value = value
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, ItemComparer):\n self.item_comparer = ItemComparer", "def comparer(self, comparer):\n\n self._comparer = comparer", "def item_comparer(self):\n return self.item_comparer_value", "def setComparator(self, comparator: dict):\n self._comparator = comparator", "def...
[ "0.7277674", "0.71829635", "0.6343587", "0.6016225", "0.5760831", "0.54588", "0.54257405", "0.52485543", "0.524176", "0.524176", "0.51975363", "0.50860065", "0.5061594", "0.4965343", "0.48539245", "0.48519886", "0.4775578", "0.47488", "0.47465944", "0.4732256", "0.4712985", ...
0.7183429
1
Convert centimeters to inches.
def cm2inch(x: Union[float, Sequence[float], NDArray]) -> Sequence[float]: return list(np.array(x) / 2.54)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cm(feet = 0, inches = 0):\n inches_to_cm = inches * 2.54 # first convert inches to centimeters\n feet_to_cm = feet * 12 * 2.54 # second convert feet to centimeters\n return inches_to_cm + feet_to_cm # return the combined value", "def inches(n):\n return n * 25.4", "def to_inch(self):\r\n ...
[ "0.7358527", "0.70733035", "0.68702555", "0.67868674", "0.6738843", "0.66157645", "0.66157645", "0.66157645", "0.65993744", "0.657683", "0.6419552", "0.63573724", "0.62438345", "0.6163968", "0.6145196", "0.61289", "0.6084606", "0.6059373", "0.5987743", "0.5962294", "0.5929526...
0.57971716
29
Finetunes the model and returns the evaluation metrics.
def finetune_eval_fn( # The pytype below must be Any, because the code below uses internal # methods only present on tff.learning.from_keras_model-derived TFF # models. model: Any, train_data: tf.data.Dataset, test_data: tf.data.Dataset, ) -> _MetricsType: @tf.function def...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def evaluate(self) -> Dict[str, float]:\n eval_dataloader = self.get_eval_dataloader()\n\n output = self._prediction_loop(eval_dataloader, description=\"Evaluation\")\n return output.metrics", "def get_model_evaluation(self):\n\n self.log(f\"{self.cur_file_path}\\t\\tInfo: model_evalu...
[ "0.72446775", "0.6894538", "0.674218", "0.66708136", "0.6661943", "0.66338927", "0.66305417", "0.66270137", "0.65659064", "0.65552974", "0.6544573", "0.65429556", "0.6516525", "0.6499402", "0.6477105", "0.6445807", "0.64454544", "0.64248323", "0.6423813", "0.64059997", "0.639...
0.5921781
97
Returns ResourceClass to use for import.
def get_import_resource_class(self): return self.process_import_resource(self.get_resource_class(usage='import'))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def resource_class(self):\n resource_module = '.'.join(self.resource_class_path.split('.')[:-1])\n resource_class_name = self.resource_class_path.split('.')[-1]\n return getattr(import_module(resource_module), resource_class_name)", "def resource_class(self):\n resource_module = '.'.j...
[ "0.86719483", "0.86719483", "0.7573302", "0.7015757", "0.6969775", "0.6809705", "0.65794307", "0.6526749", "0.6355615", "0.6277873", "0.62616104", "0.62057745", "0.6130109", "0.6109219", "0.6109036", "0.60920113", "0.608657", "0.60275835", "0.60185117", "0.5947448", "0.593220...
0.884566
0
Returns ResourceClass to use for export.
def get_export_resource_class(self): return self.get_resource_class(usage='export')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def resource_class(self):\n resource_module = '.'.join(self.resource_class_path.split('.')[:-1])\n resource_class_name = self.resource_class_path.split('.')[-1]\n return getattr(import_module(resource_module), resource_class_name)", "def resource_class(self):\n resource_module = '.'.j...
[ "0.82890314", "0.82890314", "0.71752095", "0.7044426", "0.68798715", "0.682433", "0.67421925", "0.6483761", "0.6474645", "0.6411973", "0.6409136", "0.6273383", "0.6259031", "0.6208785", "0.6195442", "0.6189932", "0.61473525", "0.6113397", "0.60728467", "0.6046759", "0.6036942...
0.9006655
0
Returns export queryset. Default implementation respects applied search and filters.
def get_export_queryset(self, request, context): # scope = self.request.POST.get('_select_across', False) == '1' scope = request.GET.get('scope') select_across = request.GET.get('_select_across', False) == '1' selected = request.GET.get('_selected_actions', '') if scope == 'all':...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_export_data(self, file_format, queryset, *args, **kwargs):\n request = kwargs.pop(\"request\")\n resource_class = self.get_export_resource_class()\n data = resource_class(**self.get_export_resource_kwargs(request)).export(queryset, *args, **kwargs)\n export_data = file_format.ex...
[ "0.674311", "0.6561824", "0.6263021", "0.6244378", "0.6241748", "0.62395173", "0.6235357", "0.61820793", "0.61617005", "0.6147979", "0.60977685", "0.60643476", "0.60567623", "0.6035673", "0.6030903", "0.6000085", "0.599213", "0.59599274", "0.5955045", "0.59484184", "0.5945437...
0.7629562
0
Return class name. Examples >>> from fatools.utils.kernel import getclassname >>> getclassname(int) 'int' >>> getclassname(10) 'int'
def getclassname(instance_or_cls): return getclass(instance_or_cls).__name__
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_classname(cls):\n return cls.__name__", "def get_python_classname(raw_classname):\n class_name = raw_classname.replace(\" \",\"\")\n class_name = class_name.replace(\"-\",\"\")\n return class_name", "def getClassName(self):\n n = type(self).__name__\n return n", "def cl...
[ "0.82510936", "0.78094375", "0.7685309", "0.76009846", "0.7562451", "0.75341207", "0.7530777", "0.74995875", "0.74995875", "0.7376611", "0.7370639", "0.7370639", "0.7362193", "0.72855425", "0.72668725", "0.7263191", "0.7225884", "0.7195422", "0.71907735", "0.7102305", "0.7059...
0.7948883
1
Generate and/or return a string qualifier for the given class. This function permits to generate a wellformatted string representation or qualifier of a class by removing specified namespace (e.g. FAMissingArgumentValidationError > missing_argument).
def getqualifier(instance_or_cls, prefix='', suffix=''): cls = getclass(instance_or_cls) if not hasattr(cls, '__qualifier__'): pattern = r'(?i)^{}|{}$'.format(prefix, suffix) return underscore(re.sub(pattern, '', getclassname(cls))) return cls.__qualifier__
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def string(rxn_class):\n spin_str = '' if spin(rxn_class) is None else spin(rxn_class)\n radrad_str = '' if not radrad(rxn_class) else 'radical-radical'\n isc_str = '' if not isc(rxn_class) else 'intersystem-crossing'\n cls_str = typ(rxn_class)\n\n out_str = ''\n for str_ in (isc_str, radrad_str,...
[ "0.60095584", "0.5952729", "0.5900185", "0.57794887", "0.5744986", "0.56393874", "0.5585056", "0.54529244", "0.54246944", "0.5400065", "0.53167903", "0.53167045", "0.5298352", "0.52833426", "0.52833426", "0.5274134", "0.524753", "0.52393705", "0.521951", "0.52148604", "0.5193...
0.56238306
6
given the output of the network before the softmax activation, this function rescales the output with a temperature parameter T, and then applies the softmax
def temperature_scaling(x,t): n,d = x.shape res = np.copy(x) res *= (1./t) for i in range(n): res[i] = softmax(res[i]) return(res)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def softmax_with_temperature(tensor, tau):\n result = torch.exp(tensor / tau)\n result = torch.div(result, torch.sum(result, 1).unsqueeze(1).expand_as(result))\n\n return result", "def get_output(self, X):\n return softmax(X)", "def masked_temperature_softmax(x:torch.Tensor, idx:int, T:float=0....
[ "0.6891345", "0.6750831", "0.6632418", "0.6503837", "0.6494113", "0.6441375", "0.6440242", "0.642667", "0.640349", "0.6371454", "0.63693345", "0.6348861", "0.6345295", "0.6345295", "0.63417363", "0.632438", "0.6306204", "0.6277868", "0.6262068", "0.6252431", "0.62497884", "...
0.7188124
0
given the output of the network before the softmax activation, this function finds the best scaling parameter to calibrate the network based on the ECE metric. This metric evaluates how the distribution of the accuracy and the distribution of confidence are close to each other. This is done by binning samples over ther...
def optimal_scale(n,pred,true): def ECE(n,pred,true): n_bins = n bins = [[] for i in range(n_bins)] # computing the bins for i in range(pred.shape[0]): for j in range(n_bins): if pred[i].max()>j*(1./n_bins) and pred[i].max()<=(j+1)*(1./n_bins): ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def tuned_for_ec():\n # TODO(theosanderson): update these to true SOTA values\n hparams = contrib_training.HParams()\n hparams.add_hparam('gradient_clipping_decay', 0.9999)\n hparams.add_hparam('batch_style', 'bucket')\n hparams.add_hparam('batch_size', 34)\n hparams.add_hparam('dilation_rate', 5)\n hparams...
[ "0.589516", "0.5888406", "0.57540005", "0.56096977", "0.55524147", "0.5488556", "0.54688215", "0.54688215", "0.5462197", "0.54485106", "0.5447489", "0.5447489", "0.54443187", "0.54059774", "0.5395289", "0.53876567", "0.53870165", "0.5380205", "0.5373043", "0.5372311", "0.5357...
0.687683
0
Validates submitted username by checking if it already exists.
def check_username(username): try: message = ( 'Validating submitted username.' ) logger.info(message) invalid = ( not username.isalnum() ) if invalid: raise PlantalyticsDataException(USER_INVALID) exists = cassy.check_user...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def validate_username(form, field):\n if User.query.filter_by(username=form.username.data).first():\n form.username.errors.append(\"Username already taken!\")\n raise ValidationError", "def validate_username(self, username):\n if username.data != current_user.username:\n ...
[ "0.8547638", "0.85336185", "0.85105103", "0.84952825", "0.8492514", "0.84165967", "0.8413248", "0.83822393", "0.8341977", "0.8258525", "0.8233863", "0.8147325", "0.8105981", "0.8063714", "0.80386084", "0.8005238", "0.79696953", "0.7912737", "0.79038393", "0.78933007", "0.7886...
0.7359425
32
Return a constant cast to the common type of both args
def pick_const(self, x, y, c): return self.cast(syntax_helpers.wrap_if_constant(c), x.type.combine(y.type))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def make_constant(args):\r\n def conv(a):\r\n if a is None:\r\n return a\r\n elif isinstance(a, slice):\r\n return slice(conv(a.start),\r\n conv(a.stop),\r\n conv(a.step))\r\n elif isinstance(a...
[ "0.6223595", "0.615116", "0.6001213", "0.59773034", "0.5943", "0.5929951", "0.5878498", "0.586908", "0.58632815", "0.5816097", "0.5801477", "0.57909465", "0.5747653", "0.5723516", "0.57092535", "0.56745964", "0.5647284", "0.5647227", "0.5631813", "0.55974543", "0.559138", "...
0.6635002
0
return size of font in (PS) points
def getsize_pt(self): # The factor 16L/16777216L=2**(-20) converts a fix_word (here self.q) # to the corresponding float. Furthermore, we have to convert from TeX # points to points, hence the factor 72/72.27. return 72/72.27 * 16*self.q/16777216
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def GetPointSize(*args, **kwargs):\n return _gdi_.Font_GetPointSize(*args, **kwargs)", "def get_text_size(self):\n return self.__text_surface.get_width(), self.__text_surface.get_height()", "def calc_text_size(self, text, font):\n w = 0\n for c in text:\n o = ord(c)\n ...
[ "0.7997476", "0.73112166", "0.72210884", "0.7067783", "0.6999792", "0.69906664", "0.695286", "0.6915472", "0.67388356", "0.6638124", "0.650517", "0.64952", "0.6459819", "0.63468456", "0.6332723", "0.6311031", "0.6295665", "0.6282401", "0.6282401", "0.6282401", "0.62809324", ...
0.7915691
1
Return user entity from DB by user' id from Session
def get_user(self): user_session = self.get() if not user_session: return None us = ServiceLocator.resolve(ServiceLocator.USERS) return us.single(user_session.login)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getByID(session, id):\n return session.query(User).filter(User.id == id).first()", "def get_user_by_id(id):\n user = session.query(User).get(id)\n return user", "def find_resource(self, id, session):\n return session.query(self.User).filter_by(id=id).first()", "def get(id):\n r...
[ "0.79946387", "0.77526927", "0.75301576", "0.7472878", "0.74707335", "0.7441999", "0.73626685", "0.7342645", "0.73159486", "0.73018354", "0.73018354", "0.73018354", "0.73018354", "0.7289189", "0.72667587", "0.7238319", "0.7224496", "0.7224496", "0.7224496", "0.7224496", "0.71...
0.7046211
33
The set of arguments for constructing a NodeDriver resource.
def __init__(__self__, *, active: pulumi.Input[bool], builtin: pulumi.Input[bool], url: pulumi.Input[str], annotations: Optional[pulumi.Input[Mapping[str, Any]]] = None, checksum: Optional[pulumi.Input[str]] = None, de...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(__self__,\n resource_name: str,\n args: NodeDriverArgs,\n opts: Optional[pulumi.ResourceOptions] = None):\n ...", "def __init__(__self__, *,\n args: Optional[Sequence[str]] = None,\n envs: Optional[Sequence['outpu...
[ "0.7385681", "0.6413467", "0.63339955", "0.6319318", "0.6310019", "0.619939", "0.6120441", "0.6071734", "0.6064132", "0.6043223", "0.60160923", "0.6013345", "0.59925526", "0.5975183", "0.5970823", "0.59503937", "0.5948395", "0.593484", "0.593484", "0.59075284", "0.590217", ...
0.0
-1
Name of the node driver (string)
def name(self) -> Optional[pulumi.Input[str]]: return pulumi.get(self, "name")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def driver_name(self):\n return self._driver_name", "def get_name(cls):\n return DRIVER_NAME", "def driverName(self):\n return Cbytestring2Python(\n self.Rf2Scor.mVehicles[self.__playersDriverNum()].mDriverName)", "def DRIVER():\n return \"podman\"", "def driver(self) -> ...
[ "0.77391726", "0.7635934", "0.72920996", "0.68523234", "0.68218017", "0.68144864", "0.66561395", "0.66541845", "0.6563893", "0.6557984", "0.6521331", "0.64999884", "0.64845276", "0.64620376", "0.6456838", "0.6433347", "0.64064795", "0.6376755", "0.63515335", "0.63274395", "0....
0.0
-1
Name of the node driver (string)
def name(self) -> Optional[pulumi.Input[str]]: return pulumi.get(self, "name")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def driver_name(self):\n return self._driver_name", "def get_name(cls):\n return DRIVER_NAME", "def driverName(self):\n return Cbytestring2Python(\n self.Rf2Scor.mVehicles[self.__playersDriverNum()].mDriverName)", "def DRIVER():\n return \"podman\"", "def driver(self) -> ...
[ "0.77391726", "0.7635934", "0.72920996", "0.68523234", "0.68218017", "0.68144864", "0.66561395", "0.66541845", "0.6563893", "0.6557984", "0.6521331", "0.64999884", "0.64845276", "0.64620376", "0.6456838", "0.6433347", "0.64064795", "0.6376755", "0.63515335", "0.63274395", "0....
0.0
-1
Name of the node driver (string)
def name(self) -> pulumi.Output[str]: return pulumi.get(self, "name")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def driver_name(self):\n return self._driver_name", "def get_name(cls):\n return DRIVER_NAME", "def driverName(self):\n return Cbytestring2Python(\n self.Rf2Scor.mVehicles[self.__playersDriverNum()].mDriverName)", "def DRIVER():\n return \"podman\"", "def driver(self) -> ...
[ "0.77391726", "0.7635934", "0.72920996", "0.68523234", "0.68218017", "0.68144864", "0.66561395", "0.66541845", "0.6563893", "0.6557984", "0.6521331", "0.64999884", "0.64845276", "0.64620376", "0.6456838", "0.6433347", "0.64064795", "0.6376755", "0.63515335", "0.63274395", "0....
0.0
-1
Initialize the biases of the first set of visible units.
def _initialize_visbiasX(self, nvisx): self.visbiasX = sharedX( numpy.zeros(nvisx), name='vbX', borrow=True )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_biases(self, biases):\n\n if not np.any(biases):\n return\n\n v_rest = self.config.getfloat('cell', 'v_rest')\n v_thresh = self.config.getfloat('cell', 'v_thresh')\n cm = self.config.getfloat('cell', 'cm')\n\n i_offset = biases * cm * (v_thresh - v_rest) / self...
[ "0.6282527", "0.6128374", "0.609574", "0.5999751", "0.5993798", "0.5987679", "0.59627664", "0.594262", "0.5937578", "0.5937578", "0.5937578", "0.59092265", "0.5891151", "0.5850626", "0.5845811", "0.57750964", "0.57680875", "0.5762199", "0.5727633", "0.57106346", "0.5686148", ...
0.58917755
12
Initialize the biases of the second set of visible units.
def _initialize_visbiasY(self, nvisy): self.visbiasY = sharedX( numpy.zeros(nvisy), name='vbY', borrow=True )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_biases(self, biases):\n\n if not np.any(biases):\n return\n\n v_rest = self.config.getfloat('cell', 'v_rest')\n v_thresh = self.config.getfloat('cell', 'v_thresh')\n cm = self.config.getfloat('cell', 'cm')\n\n i_offset = biases * cm * (v_thresh - v_rest) / self...
[ "0.6159462", "0.60665685", "0.5874306", "0.5769551", "0.57693255", "0.57529324", "0.57316107", "0.5722331", "0.56849", "0.56696975", "0.5666353", "0.5665825", "0.5656636", "0.5621862", "0.5620453", "0.5612794", "0.56081927", "0.5602863", "0.5600926", "0.5600926", "0.5600926",...
0.6631387
0
This just aliases the `_hidden_activation()` function for syntactic sugar/convenience.
def __call__(self, inputs): return self._hidden_activation(inputs)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _hidden_activation(self, inputs):\n if self.act_enc is None:\n act_enc = lambda x: x\n else:\n act_enc = self.act_enc\n return act_enc(self._mappings(inputs))", "def hiddenActivationFunctions(self):\n\n\t\treturn self._hiddenActivationFunctions", "def detach_hidde...
[ "0.77394813", "0.6683904", "0.6229149", "0.6081252", "0.60071355", "0.59147495", "0.58034134", "0.5701112", "0.5701112", "0.56708264", "0.56449056", "0.56338257", "0.56338257", "0.56260717", "0.56075263", "0.558269", "0.558269", "0.55625343", "0.5524134", "0.5501547", "0.5448...
0.65234965
2
Update the values of this list to the items which the identifiers represent. They are either found in the cache or rebuilt and added to the cache.
def _unpack_items(self): # Prevent the unpack operation from occurring more than once. if hasattr(self, '_unpack'): delattr(self, '_unpack') else: return # The list contains identifiers that will be unpacked into real items. # Copy them so they won't be ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update(self):\r\n self.data = [self.make_item_tuple(i) for i in self.query]\r\n self._fetched = True\r\n query_cache.set(self.iden, self.data)", "def rebuild_items(self, identifiers):\n raise NotImplementedError", "def UpdateIds(self):\r\n removed = set(self.item_itemId.k...
[ "0.733629", "0.6737713", "0.64389145", "0.6383842", "0.631411", "0.6072356", "0.6003232", "0.59895205", "0.5956111", "0.59273905", "0.58785665", "0.5807145", "0.5806297", "0.5785758", "0.5703914", "0.569786", "0.5689722", "0.5685826", "0.5685826", "0.5673615", "0.5673615", ...
0.7314278
1
Returns that this acquisition has gradients
def has_gradients(self) -> bool: return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pass_gradients(self):\n return self.last_grads", "def grad_flag(self):\n return self._executor.grad_flag()", "def _has_coordinates_and_gradient(self) -> bool:\n return self._coords is not None and self._coords.g is not None", "def get_grad(self):\n\n return self._get_grad", ...
[ "0.69658977", "0.6871751", "0.6821024", "0.66551507", "0.62166953", "0.6216592", "0.61686945", "0.61482483", "0.60806304", "0.6077991", "0.6059268", "0.6044907", "0.5935032", "0.5910638", "0.58293706", "0.578321", "0.5781418", "0.5766832", "0.576197", "0.5761597", "0.5758231"...
0.8053909
0
Route to find all recipes in the database.
def recipes(): recipes = mongo.db.recipes.find() return render_template("recipes.html", recipes=recipes)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def recipes():\n recipes = mongo.db.recipes.find()\n return render_template(\"recipes/list.html\", recipes=recipes)", "def recipes():\n # pylint: disable=redefined-outer-name\n recipes = list(mongo.db.recipes.find().sort('_id', -1))\n return render_template(\n \"recipes.html\", page_title=\...
[ "0.7090384", "0.68743455", "0.6744186", "0.66791874", "0.6626614", "0.6456226", "0.641272", "0.62470245", "0.61982894", "0.61672604", "0.6135907", "0.6122078", "0.6121207", "0.6060903", "0.6031717", "0.60242033", "0.59946465", "0.59769696", "0.5955646", "0.5938045", "0.593245...
0.6901074
1
Return a boolean indicating whether given items are in sorted order.
def is_sorted(items): # Check that all adjacent items are in order, return early if so # RANGE current = 0 right = 1 while right < len(items): if items[current] > items[right]: return False else: current += 1 right += 1 return True
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_sorted(items):\n # TODO: Check that all adjacent items are in order, return early if so\n for x in range(len(items)):\n if x < len(items)-1:\n if items[x+1] < items[x]:\n return False\n return True", "def is_sorted(items):\n # TODO: Running time: ??? Why and un...
[ "0.8400566", "0.8218438", "0.7429284", "0.73970175", "0.7260254", "0.71971154", "0.7079509", "0.70403665", "0.69723743", "0.6970533", "0.69469947", "0.69445795", "0.69440234", "0.68967813", "0.68493915", "0.6838795", "0.6747174", "0.6713568", "0.6712401", "0.6677618", "0.6598...
0.82054013
2
Navigate to the Setup Home via URL and switch to the new window
def _go_to_page(self): self.salesforce.go_to_setup_home() self.eda.wait_for_new_window("Home | Salesforce") self.selenium.switch_window("Home | Salesforce") self.salesforce.wait_until_loading_is_complete()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def go_to_setup_home(self):\n url = self.cumulusci.org.lightning_base_url\n self.selenium.go_to(url + \"/lightning/setup/SetupOneHome/home\")\n self.wait_until_loading_is_complete()", "def setup(self, url, browser_config):\n\n # navigate to the front page\n browser.open_url(url...
[ "0.76352006", "0.69018626", "0.6579151", "0.6526525", "0.6521439", "0.6509866", "0.6499276", "0.6497629", "0.6475006", "0.6460118", "0.6450165", "0.6429295", "0.6367125", "0.6318727", "0.62630916", "0.6262099", "0.62261695", "0.6212473", "0.6146195", "0.6143358", "0.6091257",...
0.76130325
1
Obtain the packge version from a python file e.g. pkg/__init__.py
def version(path): here = os.path.abspath(os.path.dirname(__file__)) with open(os.path.join(here, path), encoding='utf-8') as f: version_file = f.read() version_match = re.search(r"""^__version__ = ['"]([^'"]*)['"]""", version_file, re.M) if version_match: r...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_version_from_package() -> str:\n path = join(dirname(__file__), \"__init__.py\")\n path = normpath(abspath(path))\n with open(path) as f:\n for line in f:\n if line.startswith(\"__version__\"):\n token, version = line.split(\" = \", 1)\n version = ve...
[ "0.8098132", "0.78036577", "0.7788621", "0.7786128", "0.7721909", "0.77142954", "0.76969755", "0.76737046", "0.76677996", "0.76677996", "0.76413524", "0.75396377", "0.7531866", "0.75206137", "0.75206137", "0.75206137", "0.75206137", "0.75206137", "0.75206137", "0.75206137", "...
0.7143225
36
Hide y label ticks
def hide_y_ticks(): ax = plt.gca() ax.axes.get_yaxis().set_ticks([])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def hide_tick_labels(ax):\n ax.xaxis.set_ticklabels([])\n ax.yaxis.set_ticklabels([])", "def _hide_labels(self):\n for x in 'xy':\n # \"Shared\" axis and tick labels\n axis = getattr(self, x + 'axis')\n share = getattr(self, '_share' + x)\n if share is not...
[ "0.8009869", "0.78519833", "0.75279313", "0.73258257", "0.7226455", "0.7089349", "0.68632615", "0.6786225", "0.67296594", "0.6665032", "0.6650659", "0.65572584", "0.65466464", "0.64889884", "0.64779055", "0.64520323", "0.6410577", "0.6373474", "0.6241033", "0.62297374", "0.62...
0.8717864
0
String for representing the Model object.
def __str__(self): return self.name
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __str__(self):\n return super().__str__() + self.model.__str__()", "def __str__(self):\n return \"DataModel(name={},attributes={},description={})\".format(\n self.name, {a.name: str(a) for a in self.attributes}, self.description\n )", "def __str__(self):\n \n res =...
[ "0.82368803", "0.79901737", "0.7849152", "0.78468513", "0.77520275", "0.7625378", "0.7625378", "0.76225406", "0.76225406", "0.75483394", "0.7522958", "0.7470355", "0.7469358", "0.7447144", "0.7447144", "0.74314755", "0.7427648", "0.7389925", "0.7351721", "0.73424315", "0.7322...
0.0
-1
Register a dataset to detectron2's DatasetCatalog and MetadataCatalog.
def register_dataset_split(dataset_name, split_dict): _DATASET_TYPE_LOAD_FUNC_MAP = { "COCODataset": _register_extended_coco, "COCOText": _register_coco_text, "COCOTextDataset": _register_coco_text, "LVISDataset": _register_extended_lvis, } factory = split_dict.get("DS_TYPE...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def register_coco_instances(name, metadata, json_file, image_root):\n assert isinstance(name, str), name\n assert isinstance(json_file, (str, os.PathLike)), json_file\n assert isinstance(image_root, (str, os.PathLike)), image_root\n # 1. register a function which returns dicts\n DatasetCatalog.regis...
[ "0.5972804", "0.5917516", "0.5755455", "0.56592935", "0.5643858", "0.56398594", "0.56140465", "0.5561898", "0.55498135", "0.5549534", "0.55383843", "0.54713476", "0.5428343", "0.5411628", "0.53786457", "0.5377964", "0.52977103", "0.5264852", "0.5255716", "0.52494437", "0.5211...
0.60153633
0
Create the log_sum_revenue column.
def _make_log_sum_revenue(self, df): # Get revenue and fill NaN with zero train_df = df.copy(deep=False) train_df['revenue'] = train_df['totals.transactionRevenue'] train_df['revenue'] = train_df['revenue'].astype('float').fillna(0) # Group by visitor and sum, log train...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new_revenue(self) -> float:\n revenue_collections = self.demand_served() * self.inputs.revenue_per_m3\n return revenue_collections + self.revenue_landfill()", "def add_log_col(df, vars_=['payann', 'emp', 'rcppdemp']):\n for var in vars_:\n log_var = var + '_log'\n df[log_var] =...
[ "0.5613659", "0.5476433", "0.538938", "0.5327569", "0.5272793", "0.5144333", "0.5117337", "0.5008627", "0.49998322", "0.49690253", "0.4921758", "0.4904856", "0.48761925", "0.46690014", "0.4612967", "0.4602953", "0.45813045", "0.4574377", "0.45304602", "0.4522125", "0.45040387...
0.7972304
0
Check if a point is inside a rectangle
def point_in_rectangle(point: Vector, rect_min: Vector, rect_max: Vector) -> bool: return rect_min[0] <= point[0] <= rect_max[0] and rect_min[1] <= point[1] <= rect_max[1]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def inside(point, rectangle):\n\n ll = rectangle.getP1() # assume p1 is ll (lower left)\n ur = rectangle.getP2() # assume p2 is ur (upper right)\n\n return ll.getX() < point.getX() < ur.getX() and ll.getY() < point.getY() < ur.getY()", "def inside(point, rectangle):\r\n\r\n ll = rectangle.getP1() # assu...
[ "0.87203145", "0.86962503", "0.8587021", "0.83528066", "0.82300776", "0.7856668", "0.7856668", "0.7839887", "0.7818943", "0.7791772", "0.7761235", "0.75828373", "0.7576052", "0.75561845", "0.7555581", "0.75462985", "0.75441206", "0.75441206", "0.751482", "0.750778", "0.750054...
0.82337064
4
Check if rect1 has a corner inside rect2
def has_corner_inside(rect1: Tuple[Vector, float, float, float], rect2: Tuple[Vector, float, float, float]) -> bool: return any([point_in_rotated_rectangle(p1, *rect2) for p1 in rect_corners(*rect1, include_midpoints=True, include_center=True)])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rectContains(rect1, rect2):\n x1, y1, w1, h1 = rect1\n x2, y2, w2, h2 = rect2\n\n if x2 >= x1 and y2 >= y1 and x2 <= x1 + w1 and y2 <= y1 + h1 and x2 + w2 <= x1 + w1 and y2 + h2 <= y1 + h1:\n return True\n return False", "def rotated_rectangles_intersect(rect1: Tuple[Vector, float, float, ...
[ "0.80720145", "0.7651487", "0.7532963", "0.7526755", "0.7490907", "0.74233925", "0.7416546", "0.7360747", "0.72379965", "0.72046345", "0.7201246", "0.72000355", "0.7142006", "0.70629597", "0.698272", "0.6941168", "0.6916124", "0.6890406", "0.68846136", "0.6882513", "0.6859654...
0.83674794
0
Checks if the two polygons are intersecting.
def are_polygons_intersecting(a: Vector, b: Vector, displacement_a: Vector, displacement_b: Vector) \ -> Tuple[bool, bool, Optional[np.ndarray]]: intersecting = will_intersect = True min_distance = np.inf translation, translation_axis = None, None for polygon in [a,...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def doPolygonsOverlap(xPolygon1, yPolygon1, xPolygon2, yPolygon2):\n\n # How to determine if two polygons overlap.\n # If a vertex of one of the polygons is inside the other polygon\n # then they overlap.\n \n n1 = len(xPolygon1)\n n2 = len(xPolygon2)\n isin = False\n\n # Loop through all v...
[ "0.7185346", "0.7017247", "0.70009", "0.6912585", "0.67519367", "0.6725485", "0.66971207", "0.6688837", "0.6642681", "0.6636284", "0.66332245", "0.662366", "0.65192974", "0.64661586", "0.64603025", "0.64284694", "0.64248365", "0.6418822", "0.6399602", "0.6308955", "0.6303537"...
0.7008411
2
Get the current date and return it as a tuple, list, or dictionary.
def currentDate(returnType='tuple'): from datetime import datetime if returnType == 'tuple': return (datetime.now().month, datetime.now().day, datetime.now().year) elif returnType == 'list': return [datetime.now().month, datetime.now().day, datetime.now().year] return { 'day':da...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getdate():\r\n import datetime\r\n return datetime.datetime.now()", "def get_date():\n return datetime.datetime.now()", "def _get_date():\n return datetime.datetime.now()", "def get_date():\n now=datetime.now()\n s=\"%s%s%s\" % (now.year, str(now.month).zfill(2), str(now.day).zfill(2))\...
[ "0.7283352", "0.71636516", "0.71437573", "0.6966127", "0.678609", "0.6777098", "0.67649007", "0.6636762", "0.65807486", "0.6576049", "0.6570178", "0.6556513", "0.6555511", "0.6533455", "0.65169805", "0.6501438", "0.6460086", "0.6430666", "0.6387305", "0.63806504", "0.6353164"...
0.7960773
0
Initialize this parameter object and store the bounds. Nondynamic default values are checked against the bounds.
def __init__(self,default=0.0,bounds=None,softbounds=None,allow_None=False,inclusive_bounds=(True,True),**params): super(Number,self).__init__(default=default,**params) self.set_hook = identity_hook self.bounds = bounds self.inclusive_bounds = inclusive_bounds self._soft...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_bounds(self, **kwargs):\n for name, bounds in kwargs.items():\n if name not in self._parameters:\n raise AttributeError('Unknown parameter %s for %s' % (name, self.__class__.__name__))\n param = self._parameters[name]\n # Set bounds\n lower_...
[ "0.72875106", "0.72611755", "0.70492107", "0.6974394", "0.68097657", "0.6805416", "0.670014", "0.6690044", "0.66605467", "0.66088027", "0.6601743", "0.6586223", "0.655976", "0.65551555", "0.65551555", "0.6541142", "0.64883584", "0.64755344", "0.6459153", "0.6454773", "0.64121...
0.683097
4
Return the values of all the attribs, as a list.
def __get__(self,obj,objtype): if not obj: return [getattr(objtype,a) for a in self.attribs] else: return [getattr(obj,a) for a in self.attribs]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_attribute_list(self):\n attributes = [attr for attr in vars(self.entries[0]) if not attr.startswith('__')]\n return attributes", "def values(self):\n return [getattr(self, a.name) for a in self.__attrs_attrs__]", "def _get_all_attributes(self):\n\n attributes= []\n fo...
[ "0.7600489", "0.7542089", "0.7463349", "0.7426498", "0.73747647", "0.7330783", "0.7323719", "0.7303131", "0.7272093", "0.72531927", "0.7189308", "0.714414", "0.7138238", "0.7040391", "0.70358604", "0.69374007", "0.6921936", "0.6900526", "0.68914586", "0.6874408", "0.674725", ...
0.0
-1
Return an absolute, normalized path (see resolve_path).
def __get__(self, obj, objtype): raw_path = super(Path,self).__get__(obj,objtype) return self._resolve(raw_path)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def absolute_path(path):\n return os.path.abspath(os.path.normpath(path))", "def to_absolute_path(path):\n if not os.path.isabs(path):\n return os.path.join(os.getcwd(), path)\n else:\n return path", "def _normalized_path(path):\n return os.path.abspath(os.path.expanduser(path))", "de...
[ "0.80481297", "0.78671706", "0.7780171", "0.76240396", "0.7551522", "0.7489793", "0.73904884", "0.72874206", "0.72763586", "0.7259056", "0.7245979", "0.71996784", "0.716857", "0.71599245", "0.7144065", "0.7121783", "0.70502967", "0.70184374", "0.70073473", "0.6988148", "0.698...
0.0
-1
Check if a metric is cached.
def cache_has(self, metric_name): hit = self._cache_has(metric_name) if hit: self._hits.inc() else: self._misses.inc() return hit
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _cache_has(self, metric_name):\n pass", "def _cache_has(self, metric_name):\n with self._lock:\n return metric_name in self.__cache", "def has_cache(self):\n try:\n cache = self.get_cache()\n return True\n except (KeyError, AttributeError):\n ...
[ "0.8222015", "0.813497", "0.7524204", "0.73798305", "0.7332484", "0.73264915", "0.7232857", "0.7186088", "0.7117072", "0.7067605", "0.7023249", "0.6810627", "0.6766037", "0.669529", "0.66370684", "0.6610605", "0.6593504", "0.6558046", "0.6557223", "0.65064347", "0.6503571", ...
0.7142004
8
Create a metric definition from a Metric.
def create_metric(self, metric, metric_name=None): metric_name = metric_name or metric.name with self._accessor_lock: self._accessor.create_metric(metric) self._cache_set(metric_name, metric)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_metric(self) -> EvalMetric:\n pass", "def make_metric(name):\n return {\n \"type\": \"Metric\",\n \"name\": name,\n \"value\": \"\",\n \"units\": \"\",\n \"rating\": \"\",\n \"notes\": \"\",\n \"comment\": \"\",\n }", "def Create(cls, gro...
[ "0.6944055", "0.6712065", "0.6679818", "0.66660076", "0.64240557", "0.64240557", "0.6276566", "0.6157871", "0.606228", "0.5989692", "0.5905152", "0.5868609", "0.5690938", "0.561546", "0.5612439", "0.5600052", "0.55597", "0.5520944", "0.5510418", "0.54859287", "0.5439366", "...
0.69375783
1
Check if a metric exists. The result is cached and can be stale. Call get_metric() if you want to go to the database on a miss.
def has_metric(self, metric_name): found = self._cache_has(metric_name) if not found: with self._accessor_lock: found = self._accessor.has_metric(metric_name) if found: # The metric was found in the database but not cached, let's # ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _cache_has(self, metric_name):\n pass", "def _cache_has(self, metric_name):\n encoded_metric_name = self._encode(metric_name)\n with self.__env.begin(self.__metric_to_metadata_db, write=False) as txn:\n payload = txn.get(encoded_metric_name)\n return payload is not ...
[ "0.7540989", "0.71988845", "0.7098115", "0.6968137", "0.6825556", "0.6634043", "0.6520056", "0.6513618", "0.64166945", "0.64002836", "0.63259506", "0.62737966", "0.60692406", "0.58906114", "0.5718779", "0.56986123", "0.5669384", "0.5660284", "0.5644366", "0.5628651", "0.56234...
0.7597345
0
Create a MetricMetadata from a json string.
def metadata_from_str(self, metadata_str): with self._json_cache_lock: metadata = self._json_cache.get(metadata_str) if not metadata: metadata = bg_metric.MetricMetadata.from_json(metadata_str) self._json_cache[metadata_str] = metadata return metad...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def FromJSONString(json_string):\n return CBuildbotMetadata(json.loads(json_string))", "def from_json(cls, string):\n dct = json.loads(string)\n return cls.from_dict(dct)", "def _json_to_obj(cls, serialized_str):\n json_dict = json.loads(serialized_str)\n if 'metadata' in json_di...
[ "0.7502706", "0.68811846", "0.67781067", "0.6559267", "0.6453952", "0.6425313", "0.6405278", "0.6224901", "0.6186608", "0.6186608", "0.6081329", "0.60165477", "0.5931099", "0.5898107", "0.5821939", "0.58142257", "0.58042085", "0.5780468", "0.5776728", "0.57476217", "0.5729911...
0.76429695
0
Check if metric is cached.
def _cache_has(self, metric_name): pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _cache_has(self, metric_name):\n with self._lock:\n return metric_name in self.__cache", "def has_cache(self):\n try:\n cache = self.get_cache()\n return True\n except (KeyError, AttributeError):\n return False", "def get_has_cache_stats():\n...
[ "0.79615253", "0.7405175", "0.73571295", "0.7341608", "0.7276078", "0.727512", "0.7085741", "0.70806277", "0.70744467", "0.7055574", "0.7053281", "0.7002912", "0.6771968", "0.6750528", "0.6654063", "0.6644912", "0.66162485", "0.6608278", "0.659631", "0.65766203", "0.65699166"...
0.83716035
0
Check if metric is cached.
def _cache_has(self, metric_name): with self._lock: return metric_name in self.__cache
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _cache_has(self, metric_name):\n pass", "def has_cache(self):\n try:\n cache = self.get_cache()\n return True\n except (KeyError, AttributeError):\n return False", "def get_has_cache_stats():\n return len(get_memcached_hosts()) > 0", "def _check_ca...
[ "0.83716035", "0.7405175", "0.73571295", "0.7341608", "0.7276078", "0.727512", "0.7085741", "0.70806277", "0.70744467", "0.7055574", "0.7053281", "0.7002912", "0.6771968", "0.6750528", "0.6654063", "0.6644912", "0.66162485", "0.6608278", "0.659631", "0.65766203", "0.65699166"...
0.79615253
1
Check if metric is cached.
def _cache_has(self, metric_name): encoded_metric_name = self._encode(metric_name) with self.__env.begin(self.__metric_to_metadata_db, write=False) as txn: payload = txn.get(encoded_metric_name) return payload is not None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _cache_has(self, metric_name):\n pass", "def _cache_has(self, metric_name):\n with self._lock:\n return metric_name in self.__cache", "def has_cache(self):\n try:\n cache = self.get_cache()\n return True\n except (KeyError, AttributeError):\n ...
[ "0.83716035", "0.79615253", "0.7405175", "0.73571295", "0.7341608", "0.7276078", "0.7085741", "0.70806277", "0.70744467", "0.7055574", "0.7053281", "0.7002912", "0.6771968", "0.6750528", "0.6654063", "0.6644912", "0.66162485", "0.6608278", "0.659631", "0.65766203", "0.6569916...
0.727512
6
Take out file name from complete path
def filename_extractor(string): temp_string = "" new_string = string[::-1] for i in new_string: if i == '/': break temp_string = temp_string + i return_string = temp_string[::-1] if return_string == "": return "No File Selected" else: return...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getfilename(path):\r\n return path.split('\\\\').pop().split('/').pop().rsplit('.', 1)[0]", "def get_filename(path):\n return path.split('/')[-1]", "def file_name(path):\n return os.path.basename(path).split('.')[0]", "def get_file_name(path):\n return os.path.basename(path)", "def name_fro...
[ "0.8379049", "0.82220775", "0.8168034", "0.8154311", "0.8119395", "0.80719167", "0.80106807", "0.7839132", "0.7820245", "0.7818492", "0.77810633", "0.77498657", "0.77367085", "0.7723964", "0.77061415", "0.77045894", "0.7701809", "0.7677652", "0.7620609", "0.7589442", "0.75395...
0.0
-1
Creates subplots of boxplots.
def plot_subs(df, cols): plt.figure(figsize=(16,20)) for i, col in enumerate(cols): plot_number = i + 1 plt.subplot(5,3,plot_number) plt.title(col) sns.boxplot(data=df[col])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def boxplots(self, groups, nrows, ncols, type):\n fig, axs = plt.subplots(nrows=nrows, ncols=ncols, figsize=(6, 9.3), sharey=\"row\")\n\n fig.subplots_adjust(left=0.03, right=0.97, hspace=0.3, wspace=0.05)\n\n for ax, (effs, dat) in zip(axs, groups):\n ax[0].boxplot(dat[\"perm\"])\n...
[ "0.7636536", "0.72874635", "0.6975144", "0.6894078", "0.68246", "0.6797714", "0.6793948", "0.65351105", "0.6515755", "0.6511984", "0.65116656", "0.6500134", "0.647604", "0.6379428", "0.62263393", "0.6187914", "0.61696327", "0.6159692", "0.61552346", "0.6091196", "0.6069067", ...
0.7143129
2
Converts string object to datetime object.
def convert_to_datetime(df, column): datetime_format = '%Y-%m-%d' return pd.to_datetime(df[column], format=datetime_format)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def str2date(s):\n return datetime.strptime(s.decode(), \"%Y-%m-%d %H:%M:%S\")", "def str_to_datetime(str):\n\n\treturn (datetime.strptime(str, \"%Y-%m-%dT%H:%M:%S.%fZ\"))", "def str_to_datetime(str):\n if not str:\n return str\n return datetime.datetime.strptime(str.split(\".\")[0], DEFAUL...
[ "0.75882417", "0.7516862", "0.7487343", "0.7444026", "0.74312633", "0.7403802", "0.7393285", "0.7333917", "0.73092276", "0.7302257", "0.72918135", "0.7264575", "0.7228345", "0.71684045", "0.713922", "0.713686", "0.7131866", "0.71293163", "0.70635504", "0.70485246", "0.7047800...
0.0
-1
Converts to UTC time.
def set_utc(df, locale): return df.tz_localize('utc').tz_convert(None)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def utcTime():\r\n return calendar.timegm(time.gmtime())", "def utcnow(cls):\n t = _time.time()\n return cls.utcfromtimestamp(t)", "def localtime2utc(date):\n return date + (datetime.utcnow() - datetime.now())", "def localize_time_utc(non_utc_time):\n return pytz.utc.localize(non_utc_t...
[ "0.74266875", "0.6850634", "0.68498313", "0.68315065", "0.68315065", "0.673754", "0.6724337", "0.6724337", "0.6724337", "0.6720853", "0.67180747", "0.6649456", "0.6582751", "0.65598536", "0.64982295", "0.64800894", "0.6476663", "0.6465265", "0.64603305", "0.64560413", "0.6453...
0.5641102
100
Convenient function for initializing bulk analyzer and potentially temporary writer instance as well.
def analyzer(auth, writer, threads=1, bulk_size=100, base_url=ANACODE_API_URL): if hasattr(writer, 'init') and hasattr(writer, 'close') and \ hasattr(writer, 'write_bulk'): pass elif isinstance(writer, str) and os.path.isdir(writer): writer = writers.CSVWriter(writer) elif isinst...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initAnalyzer():\n return controller.initAnalyzer()", "def init():\n # analyzer es utilizado para interactuar con el modelo\n analyzer = model.newAnalyzer()\n return analyzer", "def __init__(self, output_mediator):\n super(ElasticSearchOutputModule, self).__init__(output_mediator)\n self._...
[ "0.6169681", "0.57261974", "0.5681573", "0.5625423", "0.5565878", "0.55336565", "0.5476804", "0.5457576", "0.54335713", "0.5420156", "0.5373717", "0.53513443", "0.53240496", "0.53207177", "0.52762216", "0.5271671", "0.5269698", "0.52589464", "0.5258619", "0.5251077", "0.52409...
0.6283078
0
Generate an empty Series/DataFrame of shape `shape` and fill with `fill_value`.
def empty(cls, shape, fill_value=np.nan, **kwargs): if not isinstance(shape, tuple) or (isinstance(shape, tuple) and len(shape) == 1): return pd.Series(np.full(shape, fill_value), **kwargs) return pd.DataFrame(np.full(shape, fill_value), **kwargs)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def full(shape, fill_value, dtype=None):\n\n assert(type(shape) == int)\n if not dtype:\n val_type = type(fill_value)\n dtype = __get_default_dtype(val_type)\n if dtype not in q_consts.supported_dtypes:\n raise Exception(\"dtype %s is not supported\" % dtype)\n\n # call wrapper fun...
[ "0.6388866", "0.6336653", "0.61048824", "0.6013044", "0.6005841", "0.59674233", "0.5956783", "0.57934695", "0.57091224", "0.5651737", "0.5644221", "0.5623805", "0.55585754", "0.55506957", "0.554639", "0.5546177", "0.54639655", "0.54618245", "0.5454117", "0.54130054", "0.54082...
0.83254737
0
Convert to 1dim NumPy array See `vectorbt.base.reshape_fns.to_1d`.
def to_1d_array(self): return reshape_fns.to_1d(self._obj, raw=True)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _asarray1d(arr, copy=False):\n if copy:\n return asarray(arr).flatten()\n else:\n return asarray(arr).ravel()", "def flatten_numpy(ndarray):\n return np.reshape(ndarray, (-1,), 'F')", "def retrun_1(x):\n ret = np.ones(len(x))\n return ret", "def atleast_1d(*ar...
[ "0.7098976", "0.67357755", "0.64856166", "0.64067394", "0.63216096", "0.63006026", "0.62734145", "0.6220479", "0.621372", "0.6115314", "0.60521525", "0.6033167", "0.60088646", "0.59750557", "0.5973289", "0.5969628", "0.5950387", "0.59297097", "0.5929625", "0.59274524", "0.592...
0.8326128
0
See `vectorbt.base.reshape_fns.repeat`. Set `axis` to 1 for columns and 0 for index. Use `keys` as the outermost level.
def repeat(self, n, keys=None, axis=1, wrap_kwargs=None): repeated = reshape_fns.repeat(self._obj, n, axis=axis) if keys is not None: if axis == 1: new_columns = index_fns.combine_indexes(self.wrapper.columns, keys) return repeated.vbt.wrapper.wrap( ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def th_repeat(a, repeats, axis=0):\r\n assert len(a.size()) == 1\r\n return th_flatten(torch.transpose(a.repeat(repeats, 1), 0, 1))", "def repeat(x, repeats, axis=None):\r\n return RepeatOp(axis=axis)(x, repeats)", "def repeat(a, repeats, axis=None):\n return afnumpy.asarray(a).repeat(repeats, axis...
[ "0.63793075", "0.6377329", "0.63297457", "0.62661374", "0.61368436", "0.61301655", "0.6089389", "0.6014493", "0.5904056", "0.58987075", "0.5894042", "0.5858454", "0.5846022", "0.5787487", "0.5656077", "0.5609169", "0.5550347", "0.55086964", "0.54717916", "0.5429241", "0.54152...
0.7445277
0
Apply `apply_func` `ntimes` times and concatenate the results along columns. See `vectorbt.base.combine_fns.apply_and_concat_one`. Arguments `args` and `kwargs` will be directly passed to `apply_func`. If `to_2d` is True, 2dimensional NumPy arrays will be passed, otherwise as is. Use `keys` as the outermost level. !!! ...
def apply_and_concat(self, ntimes, *args, apply_func=None, to_2d=False, keys=None, wrap_kwargs=None, **kwargs): checks.assert_not_none(apply_func) # Optionally cast to 2d array if to_2d: obj_arr = reshape_fns.to_2d(self._obj, raw=True) else: obj_arr = np.asarray(s...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def combine_with_multiple(self, others, *args, combine_func=None, to_2d=False,\n concat=False, broadcast_kwargs=None, keys=None, wrap_kwargs=None, **kwargs):\n others = tuple(map(lambda x: x._obj if isinstance(x, BaseAccessor) else x, others))\n checks.assert_not_none(com...
[ "0.53002065", "0.49870136", "0.48061094", "0.47277665", "0.4686993", "0.45683253", "0.45633015", "0.45625657", "0.44872788", "0.4484643", "0.44801491", "0.43743894", "0.4359397", "0.42907768", "0.42822254", "0.42776448", "0.42577285", "0.42413628", "0.4233831", "0.42333815", ...
0.78522676
0
Combine both using `combine_func` into a Series/DataFrame of the same shape. All arguments will be broadcast using `vectorbt.base.reshape_fns.broadcast` with `broadcast_kwargs`. Arguments `args` and `kwargs` will be directly passed to `combine_func`. If `to_2d` is True, 2dimensional NumPy arrays will be passed, otherwi...
def combine_with(self, other, *args, combine_func=None, to_2d=False, broadcast_kwargs=None, wrap_kwargs=None, **kwargs): if isinstance(other, BaseAccessor): other = other._obj checks.assert_not_none(combine_func) if broadcast_kwargs is None: broadcast...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def combine_with_multiple(self, others, *args, combine_func=None, to_2d=False,\n concat=False, broadcast_kwargs=None, keys=None, wrap_kwargs=None, **kwargs):\n others = tuple(map(lambda x: x._obj if isinstance(x, BaseAccessor) else x, others))\n checks.assert_not_none(com...
[ "0.60931116", "0.5965886", "0.5823825", "0.5560539", "0.5405561", "0.5405561", "0.53269756", "0.513355", "0.5124779", "0.5056548", "0.4865788", "0.4813407", "0.48010135", "0.47926942", "0.46322632", "0.4589916", "0.4566965", "0.4528144", "0.451689", "0.4509853", "0.45035762",...
0.65199083
0
Model of the device.
def model(self): return self.device.settings["device"]["type"]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def model(self):\n return self._device.device_data[self._uuid]['model']", "def model(self) -> str:\n return self.camera_info[\"device_model\"]", "def model(self):\n version_data = self._raw_version_data()\n if self._model is None:\n self._model = version_data[\"hardware\"...
[ "0.8620829", "0.82269067", "0.812973", "0.8119504", "0.7650294", "0.76046336", "0.74667424", "0.7441954", "0.7293107", "0.72844976", "0.72534275", "0.7157819", "0.7123393", "0.7097503", "0.70936763", "0.70566696", "0.7052714", "0.70236874", "0.69942963", "0.6985194", "0.69302...
0.8004806
5
Return unique ID of entity.
def unique_id(self): return f"{self.wrapper.mac}-{self.block.index}"
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def entity_id(self) -> str:\n return self._entity_id", "def entity_id(self):\n return self._entity_id", "def entity_id(self):\n return self._entity_id", "def entity_id(self):\n return self._entity_id", "def entity_id(self):\n return self._entity_id", "def entity_id(self...
[ "0.80639595", "0.7946084", "0.7946084", "0.7946084", "0.7946084", "0.7946084", "0.7525028", "0.7525028", "0.7510159", "0.7407671", "0.7375605", "0.735266", "0.735266", "0.735266", "0.735266", "0.735266", "0.735266", "0.735266", "0.735266", "0.7295382", "0.729204", "0.728534...
0.0
-1
Unload a config entry.
async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry): unload_ok = all( await asyncio.gather( *[ hass.config_entries.async_forward_entry_unload(entry, component) for component in PLATFORMS ] ) ) if unload_ok: awa...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def async_unload_entry(hass, config_entry):\n unload_ok = await hass.config_entries.async_forward_entry_unload(\n config_entry, \"climate\"\n )\n return unload_ok", "async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:\n hass.data.pop(DOMAIN)\n return True", ...
[ "0.697284", "0.6888074", "0.6779855", "0.6747459", "0.6689002", "0.6657831", "0.66162205", "0.6603433", "0.65925974", "0.65595686", "0.65411645", "0.6507643", "0.6507643", "0.6507643", "0.6507643", "0.64977276", "0.64931643", "0.6486601", "0.6486601", "0.6486601", "0.6486601"...
0.6242181
56
Create a new trial from a dictionary
def from_dict(cls, data: Dict[str, any]): return cls(**data)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def createTrialDict(trial, block):\n trial_type = ''\n\n if trial.visual_file:\n visual_file = trial.visual_file.url\n vftype = trial.visual_file.filetype\n if 'video' in vftype.lower():\n trial_type = 'video'\n else:\n trial_type = 'image'\n else:\n ...
[ "0.66543335", "0.61677146", "0.6128852", "0.6128852", "0.61097956", "0.586822", "0.5831493", "0.5791853", "0.5763711", "0.5738182", "0.56239104", "0.5620787", "0.55740124", "0.553433", "0.55199337", "0.54700017", "0.5461201", "0.5456476", "0.54554296", "0.5448272", "0.5446891...
0.5075755
45
Create TensorFlow summary writer
def create_writer(self, session: tf.Session): self.logger.writer = tf.summary.FileWriter(str(self.info.summary_path), session.graph)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _summary_writer(self):\n # Initialize on first use, so that subclasses can override the\n # implementation without creating a default FileWriter in the constructor.\n if self._summary_writer_obj is None:\n if py_utils.IsEagerMode():\n self._summary_writer_obj = tf.compat.v2.summary.create_...
[ "0.75326926", "0.7471221", "0.7452849", "0.7381409", "0.7356681", "0.7309545", "0.73006314", "0.72912574", "0.72776914", "0.7185314", "0.7096004", "0.7084335", "0.7030004", "0.69981813", "0.68756056", "0.6841139", "0.68354034", "0.6811794", "0.6811668", "0.68054557", "0.67736...
0.71035725
10
Return the duration in seconds.
def duration(self): with audioread.audio_open(self.path) as f: return f.duration
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def duration_in_seconds(self):\n return self.get_data(\"duration_in_seconds\")", "def get_duration(self):\n return self.duration", "def duration(self):\n # type: () -> int\n return self._duration", "def get_duration(self):\n return self._duration", "def duration_seconds(s...
[ "0.8713738", "0.83115613", "0.82827324", "0.82567537", "0.8170784", "0.8160436", "0.8160436", "0.8160436", "0.8160436", "0.8160436", "0.8160436", "0.8160436", "0.8160436", "0.80946755", "0.8087415", "0.8075245", "0.8068312", "0.8064459", "0.80440575", "0.80235493", "0.8003588...
0.75721675
61
Replaces each instance of to_replace in s with replacement
def replace_instance(s, to_replace, replacement): index=0 matchedIndeces=0 while index<len(s): if s[index]==to_replace[matchedIndeces]: matchedIndeces+=1 if matchedIndeces>=len(to_replace): s=s[:index-(matchedIndeces-1)]+replacement+s[index+1:] index-=matchedIndeces-1 match...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _replace_from_sentence_tokens(sentence_tokens, to_replace, replacement):\n return [token.replace(to_replace, replacement)\n for token in sentence_tokens]", "def replace_substrings(s, mapping):\n for (s1, repl) in mapping:\n s = s.replace(s1, repl)\n return s", "def myrepl...
[ "0.7069161", "0.69914424", "0.68885654", "0.6761526", "0.67252433", "0.67186224", "0.6593439", "0.64455026", "0.634721", "0.63438404", "0.6324849", "0.6298007", "0.6297119", "0.62713486", "0.6269009", "0.6223917", "0.6223917", "0.6210245", "0.6189383", "0.61742", "0.6166972",...
0.7066902
1
Given a set of tuples, this function creates a dictionary that maps each unique tuple to a unique integer, starting from 1.
def tuple_int_translator(tuples): currentIndex=0 d={} for t in tuples: if t not in d.keys(): d[t]=currentIndex currentIndex+=1 return d
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def convertSumsToMap(arr, values):\n num_map = {}\n for item in values:\n num_map[item] = []\n\n for i in range(len(arr)):\n num_map[i+1] = setFromValues(arr[i])\n\n return num_map", "def _tally(tuples):\n\t\n\tres = { }\n\t\n\tfor k, v in tuples:\n\t\tlist = res.get(k)\n\t\t\n\t\tif li...
[ "0.65062726", "0.64183307", "0.62990284", "0.6251819", "0.6194757", "0.5891163", "0.58699566", "0.5868341", "0.58637005", "0.58243626", "0.5821907", "0.5821907", "0.58191603", "0.5818293", "0.5794407", "0.5746055", "0.57076067", "0.5676899", "0.5676211", "0.5660242", "0.56436...
0.7632544
0
Convert an ASCII field into the corresponding list of Unicode strings. The (input) ASCII field is a Unicode string containing one or more ASCII codepoints (``00xx`` or ``U+00xx`` or an ASCII string not starting with ``00`` or ``U+``), separated by a space.
def convert_ascii_field(string): values = [] for codepoint in [s for s in string.split(DATA_FILE_CODEPOINT_SEPARATOR) if (s != DATA_FILE_VALUE_NOT_AVAILABLE) and (len(s) > 0)]: #if DATA_FILE_CODEPOINT_JOINER in codepoint: # values.append(u"".join([hex_to_unichr(c) for c in codepoint.split(DAT...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def convert_unicode_field(string):\n values = []\n for codepoint in [s for s in string.split(DATA_FILE_CODEPOINT_SEPARATOR) if (s != DATA_FILE_VALUE_NOT_AVAILABLE) and (len(s) > 0)]:\n values.append(u\"\".join([hex_to_unichr(c) for c in codepoint.split(DATA_FILE_CODEPOINT_JOINER)]))\n return values...
[ "0.6822895", "0.6218159", "0.6008463", "0.58626574", "0.5727826", "0.5664015", "0.5630331", "0.5539801", "0.553216", "0.5495362", "0.5451055", "0.5442446", "0.5367531", "0.5319138", "0.5315917", "0.5312308", "0.52929664", "0.52925754", "0.52925754", "0.52925754", "0.52925754"...
0.75908273
0
Returns the list of all concrete persistent classes that are subclasses of Entity.
def all_entity_classes(): persistent_classes = Entity._decl_class_registry.values() # with sqlalchemy 0.8 _decl_class_registry holds object that are not classes return [ cls for cls in persistent_classes if isclass(cls) and issubclass(cls, Entity) ]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def all_entities_classes():\n return [\n PersonEntity, CustomAttributeEntity, ProgramEntity, ControlEntity,\n AuditEntity, AssessmentEntity, AssessmentTemplateEntity, IssueEntity,\n CommentEntity]", "def inheritors(cls):\n subclasses = set()\n work = [cls]\n while work:\n ...
[ "0.79642683", "0.6667462", "0.65783757", "0.6542915", "0.6495072", "0.645888", "0.6381729", "0.63680446", "0.63475776", "0.6331751", "0.63004184", "0.63004184", "0.6287399", "0.6253546", "0.6245696", "0.62321705", "0.618346", "0.6135454", "0.61274767", "0.6125897", "0.6110939...
0.8667143
0
Fetch User by id.
def get_user(self, user): # type: (dict) -> dict self.request_url = "{0}/{1}/{2}".format(self.API_URL, self.USER_ENDPOINT, user['id']) return self.__create_request(payload={}, request_type=self.REQUEST_GET, version="v2")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def fetch_user(self, id: utils.Intable) -> User | None:\n id64 = make_id64(id=id, type=Type.Individual)\n return await self._connection.fetch_user(id64)", "async def fetch_user(self, id: str):\n user = await self.http.get_user(id)\n return User(state=self.http, data=user)", "d...
[ "0.86329454", "0.85858303", "0.8305507", "0.8236119", "0.8208473", "0.81682533", "0.81682533", "0.81682533", "0.81682533", "0.81678796", "0.8123786", "0.81163377", "0.81114507", "0.80899274", "0.8017578", "0.79646474", "0.79548013", "0.7927167", "0.79247195", "0.79228395", "0...
0.0
-1
Loads a json file from the speicfied path An equivalent Dict is returned
def load_data_file(path): with open(path, encoding='utf-8') as f: return json.load(f)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def json_load(path):\n with open(path) as f:\n dictionary = json.load(f)\n return dictionary", "def load_json(file_path):\n\n \n with open(file_path, 'r') as json_file:\n # print(file_path)\n dictionary = json.loads(json_file.read())\n\n return dictionary", "def json_dict(pa...
[ "0.8506003", "0.8413598", "0.8343037", "0.8298749", "0.82849276", "0.824982", "0.8244039", "0.82136303", "0.8188824", "0.8162068", "0.8124717", "0.808365", "0.8026357", "0.7986474", "0.7982451", "0.79650027", "0.7958395", "0.79507804", "0.7927113", "0.7922306", "0.7902976", ...
0.7771964
31
Returns a random lowercase string with specified amount of characters
def random_str(length): digits = ''.join([str(num) for num in list(range(10))]) res = ''.join(random.choice(ascii_lowercase + digits) for i in range(length)) return res
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def string_lower(self, string_length=8):\n letters= string.ascii_lowercase\n return ''.join(random.sample(letters, string_length))", "def _rand_str(size=16):\n return \"\".join(random.SystemRandom().choices(string.ascii_lowercase, k=size))", "def loweralphanum(ctx, nchars=\"8\"):\n # deprec...
[ "0.81520295", "0.81037605", "0.79440933", "0.79230976", "0.780106", "0.77873605", "0.7749738", "0.7696665", "0.76826453", "0.7682522", "0.7674827", "0.7672788", "0.7670208", "0.7665211", "0.76637703", "0.76499087", "0.7626382", "0.7626382", "0.7616818", "0.7612078", "0.760714...
0.74445474
50
Loads random currencies from ./mock_data/first_names.json
def load_first_names(data): first_name_objects = [FirstName(data=first_name) for first_name in data] FirstName.objects.bulk_create(first_name_objects)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_data(name):\n with open(f\"tests/data/{name}.json\", \"r\") as json_file:\n return json.load(json_file)", "def getRandomCard(cost):\n with open(\"./cmcs/\"+str(cost)+\".json\", \"r\", encoding=\"utf-8\") as read_file:\n data = json.load(read_file)\n return random.choice(list(d...
[ "0.6122706", "0.6016462", "0.5916546", "0.5823494", "0.5820365", "0.5679162", "0.56641555", "0.56539863", "0.5483861", "0.5402985", "0.5360192", "0.53553", "0.5340869", "0.5338735", "0.5319375", "0.52921355", "0.5271678", "0.5249636", "0.52489835", "0.5244103", "0.5208608", ...
0.51624167
24
Asks user to specify a city, month, and day to analyze.
def get_filters(): print('Hello! Let\'s explore some US bikeshare data!') # get user input for city (chicago, new york city, washington). HINT: Use a while loop to handle invalid inputs city = str(input("Please enter the city name: \n(Chicago or New york city or Washington)")).lower() while city not in ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def Raw_Data(city,month,day):\n print(\"The city you have entered is: \",city)\n print(\"The month you have entered is: \",month)\n print(\"The day you have entered is: \",day)", "def get_filters():\n city = None\n month = None\n day = None\n while day == None:\n # TO DO: get user input f...
[ "0.66714007", "0.65354675", "0.64593667", "0.6374057", "0.6348314", "0.63097656", "0.62868035", "0.6259136", "0.62316", "0.62130964", "0.62050414", "0.6181105", "0.6171822", "0.61686903", "0.6158568", "0.61582303", "0.61532456", "0.61444426", "0.6131269", "0.610484", "0.61025...
0.0
-1