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
Test the bug 'assign_member' view only accepts POST requests
def test_bug_assign_member_view_POST_only(self): res = self.client.get(self.assign_member_url) self.assertEqual(res.status_code, 405) res = self.client.patch(self.assign_member_url) self.assertEqual(res.status_code, 405) res = self.client.put(self.assign_member_url) sel...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_bug_assign_member_view_errors(self):\n non_project_member = utils.sample_member(email='nproject@mail.com')\n\n res = self.client.post(self.assign_member_url)\n self.assertEqual(res.status_code, 400)\n self.assertFalse(self.bug.assigned_members.exists())\n\n res = self.cl...
[ "0.78135335", "0.7699334", "0.6931803", "0.67067534", "0.66953826", "0.6625153", "0.66099083", "0.6606047", "0.65935016", "0.65577227", "0.65527207", "0.65482426", "0.64971805", "0.64903325", "0.6486054", "0.6485556", "0.6455471", "0.6430178", "0.64242357", "0.63872576", "0.6...
0.89465696
0
Test the message create view only accepts POST requests
def test_message_create_view_only_POST_allowed(self): self.client.force_login(self.superuser) res = self.client.post(self.message_create_url) self.assertNotEqual(res.status_code, 405) for method in ['get', 'put', 'patch', 'delete']: res = getattr(self.client, method)(self.m...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_message_create_view_invalid_payload(self):\n self.client.force_login(self.member)\n\n res = self.client.post(self.message_create_url)\n self.assertEqual(res.status_code, 400)\n self.assertFalse(Message.objects.exists())\n\n res = self.client.post(self.message_create_url,...
[ "0.7623476", "0.72007394", "0.71899897", "0.7140314", "0.68065584", "0.6786898", "0.6748828", "0.6746726", "0.67278314", "0.6722454", "0.6720828", "0.67056894", "0.66988444", "0.6661745", "0.6655922", "0.6648539", "0.66266155", "0.6616475", "0.65631425", "0.65500396", "0.6534...
0.86013865
0
Test the permission for the create_message view are correct
def test_message_create_view_permissions(self): res = self.client.post(self.message_create_url) self.assertRedirects( res, reverse('members:login') + f'?next=/bugs/{self.bug.id}/create_message' ) self.client.force_login(self.non_member) res = ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_message_create_view_only_POST_allowed(self):\n self.client.force_login(self.superuser)\n\n res = self.client.post(self.message_create_url)\n self.assertNotEqual(res.status_code, 405)\n\n for method in ['get', 'put', 'patch', 'delete']:\n res = getattr(self.client, me...
[ "0.73216784", "0.72957015", "0.7027278", "0.69246733", "0.68605125", "0.6686811", "0.65915465", "0.65741324", "0.65647155", "0.65585095", "0.6504228", "0.6496201", "0.6472825", "0.6455776", "0.64047194", "0.6381254", "0.6374335", "0.63566136", "0.6355623", "0.6316971", "0.629...
0.8341991
0
Softmax loss function, naive implementation (with loops) Inputs have dimension D, there are C classes, and we operate on minibatches of N examples.
def softmax_loss_naive(W, X, y, reg): num_classes = W.shape[1] num_train = X.shape[0] # Initialize the loss and gradient to zero. loss = 0.0 dW = np.zeros_like(W) ############################################################################# # TODO: Compute the softmax loss and its gradien...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def softmax(input, dim=None):\n return F.softmax(input, dim)", "def softmax_loss_naive(W, X, y, reg):\n # Initialize the loss and gradient to zero.\n D, C = W.shape\n N, D = X.shape\n full_row_idx = np.arange(N)\n loss = 0.0\n dW = np.zeros_like(W)\n\n probas = np.zeros((N, C))\n #####...
[ "0.7406137", "0.7333247", "0.71821284", "0.71701396", "0.7151511", "0.7111546", "0.7103919", "0.7085301", "0.707027", "0.7028531", "0.6994329", "0.69871503", "0.69471174", "0.69437945", "0.6914787", "0.6914153", "0.6893428", "0.68440956", "0.6839134", "0.6831578", "0.67881626...
0.67973727
20
Softmax loss function, vectorized version. Inputs and outputs are the same as softmax_loss_naive.
def softmax_loss_vectorized(W, X, y, reg): # Initialize the loss and gradient to zero. num_train = X.shape[0] ############################################################################# # TODO: Compute the softmax loss and its gradient using no explicit loops. # # Store the loss in loss and the ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def softmax_loss(x, y):\n N = x.shape[0]\n x = np.reshape(x, (N, -1))\n probs = np.exp(x - np.max(x, axis=1, keepdims=True))\n probs /= np.sum(probs, axis=1, keepdims=True)\n loss = -np.sum(np.log(probs[np.arange(N), y])) / N\n dx = probs.copy()\n dx[np.arange(N), y] -= 1\n dx /= N # shape(dx):...
[ "0.76206565", "0.756382", "0.75555336", "0.75555336", "0.75555336", "0.75367427", "0.7519078", "0.75091046", "0.74490833", "0.7438407", "0.7435818", "0.7429511", "0.74113464", "0.74097174", "0.7406732", "0.7402778", "0.7402517", "0.74010026", "0.73977923", "0.73950636", "0.73...
0.7169599
69
This builds a url string with a Coralized address.
def __build_url(host,fname): # make the host does not contain 'http://' or 'ftp://' host = host.replace("ftp://", "") host = host.replace("http://", "") #coral requires that the directory be separated from the host name dir="" dpos=host.find("/") if dpos!=-1: dir=host[dpos:]...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def build_url(self, lat: float, lon: float) -> str:\n context = self.request.query.get('context', '')\n if context:\n context = f';context={context}'\n return (f'https://places.cit.api.here.com/places/v1/browse{context}'\n f'?app_id={APP_ID}'\n f'&app_c...
[ "0.6874583", "0.6837194", "0.6677545", "0.65385", "0.65249205", "0.6468755", "0.6301522", "0.6289309", "0.62676424", "0.6263234", "0.62628615", "0.6239043", "0.6191422", "0.618636", "0.6137723", "0.6136481", "0.61317956", "0.6130243", "0.61254907", "0.61108863", "0.61108863",...
0.57200366
78
Eliminates Nones in timeline so other software don't error. Extra lists are built for the vars with nones, each list with one point for each None in the form (wall_time, prev_value).
def timeline_postprocessing(timeline): current_time_nones = [] audio_time_nones = [] old_current_time = 0 old_audio_time = 0 filtered_timeline = [] for wall_time, pt, audio_time, current_time, fnum, rt in timeline: if current_time is None: current_time = old_current_time ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fill_blanks_timeseries(self):\n\n for i in range(self.updates.keys()[-1] + 1):\n self.updates[i]\n self.announcements[i]\n self.withdrawals[i]\n self.max_prefix[i]\n self.mean_prefix[i]\n self.implicit_withdrawals_dpath[i]\n se...
[ "0.5544514", "0.540945", "0.53869885", "0.53687483", "0.5363259", "0.53251207", "0.53230184", "0.5246572", "0.52381724", "0.51846695", "0.51189977", "0.5109089", "0.51018673", "0.5098589", "0.50886244", "0.50847745", "0.5080633", "0.5077254", "0.5068812", "0.50649464", "0.502...
0.6840098
0
Generator that yields set of wshingles
def _w_shingles_generator(doc_generator, size=DEFAULT_SHINGLE_SIZE): for doc in doc_generator: if doc: #step 1: tokenize string tokens = tuple(strings_utils.tokenize(doc)) #step 2: remove punctuation, make string lower case tokens = tuple(map(strings_utils.n...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _k_shingles_generator(doc_generator, size=DEFAULT_SHINGLE_SIZE):\n\n for doc in doc_generator:\n if doc:\n #step 1: remove all white space from the string\n cleaned_doc = strings_utils.remove_all_whitespace(doc)\n\n #step 2: remove punctuation and make all lower case\...
[ "0.70617795", "0.68742543", "0.6716685", "0.622437", "0.60729855", "0.58709794", "0.58239096", "0.5810262", "0.57684535", "0.5702593", "0.57006025", "0.57006025", "0.56940556", "0.56892484", "0.5675941", "0.5629693", "0.56072885", "0.55990374", "0.55810344", "0.55589056", "0....
0.68177575
2
It initializes a multithreaded program by setting locations to 0, adding IDs to threads and events and setting threads for events and registers.
def initialize(self, bound=1): #### add initialization of regs unrolledThreads = list() for t in self.threads: newT = t.unroll(bound) unrolledThreads.append(newT) self.threads = unrolledThreads ### It adds events initializing the locations to 0 loc...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __setup():\n thread = threading.Thread(target=__thread)\n thread.daemon = True\n thread.start()", "def __init__(self):\n self._thread = threading.Thread(target=self.job)\n self._stop_threads = threading.Event()\n self._active_status = False\n self._registers = dict()", ...
[ "0.65738493", "0.62300205", "0.61753553", "0.6137095", "0.6128463", "0.5952492", "0.5946313", "0.59231836", "0.59037125", "0.58862007", "0.5814968", "0.5814968", "0.5814968", "0.5814968", "0.5814968", "0.5807515", "0.58030814", "0.5791874", "0.57803464", "0.5766973", "0.57617...
0.64608675
1
Get a list of all orders made by this user
def get_order_history_demo(login): order_list = api.get_order_history(**login) pprint(order_list)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_all_user_orders(self, user_id): # add tests\n orders_list = []\n for order in orders:\n if order['user_id'] == user_id:\n orders_list.append(order)\n return orders_list", "def get_user_orders(self, user_id):\n return models.Order.query.find({'user_id...
[ "0.84151214", "0.82196355", "0.8103194", "0.7591635", "0.7384558", "0.72747236", "0.7237511", "0.7230329", "0.7214187", "0.7108872", "0.7108872", "0.7061672", "0.69945806", "0.69030344", "0.68540937", "0.68304783", "0.68215495", "0.68215495", "0.6793251", "0.67601734", "0.674...
0.0
-1
Compute the Root Mean Square Error between 2 ndimensional vectors.
def RMSE(a,b): return np.sqrt(np.mean((a-b)**2))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rmse(vector, mean):\n return np.sqrt(np.sum((vector-mean)**2))", "def root_mean_squared_error(true, pred):\n mse = mean_squared_error(true, pred)\n rmse = np.sqrt(mse)\n return rmse", "def rmse ( a, b ): \n return np.sqrt(np.mean((a - b) ** 2))", "def root_mean_square(n...
[ "0.6959059", "0.679065", "0.66959584", "0.6692432", "0.6679831", "0.66678303", "0.6613208", "0.6606675", "0.65988195", "0.65713996", "0.65685135", "0.64180905", "0.6417293", "0.6390888", "0.63136184", "0.6257598", "0.6253917", "0.6235881", "0.6225569", "0.6214538", "0.6207073...
0.69871587
0
Display text at the correct location
def text(self, location, text, color=None): color = color or self._default_color self._draw.text(location, text, fill=color)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show_text(self, text, upper=False, lower=False):\n x = self.margin\n y_up = x\n y_lo = self.board_size * self.cell_size + self.margin\n label = self.font.render(text, True, Display.colours[\"text\"])\n if upper:\n self.screen.blit(label, (x, y_up))\n if lowe...
[ "0.75634974", "0.7356025", "0.71544063", "0.6995898", "0.6971007", "0.69331634", "0.6905255", "0.69028205", "0.68950754", "0.6885067", "0.6857788", "0.68479574", "0.68190354", "0.6818127", "0.6757104", "0.6746533", "0.6742461", "0.6719279", "0.67169195", "0.6711682", "0.67028...
0.0
-1
Initialize the player in the db
def initPlayer(self, userid): # If it is ready only, stops storing the player db if self.readonly: return False userid = int(userid) uniqueid = self.identifyPlayer(userid) # if it's a bot, stops storing the player into the db if uniqueid == "BOT": ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initialize_player(self):\n self.player.user_name()", "def init_new_player(player):\n # the FIRST_LOGIN flags are necessary for the system to call \n # the relevant first-login hooks. \n if player.character:\n player.character.db.FIRST_LOGIN = True \n playe...
[ "0.73482615", "0.71916854", "0.69703156", "0.696792", "0.6878742", "0.68601847", "0.68530583", "0.6628341", "0.65791214", "0.64875495", "0.64813054", "0.64664686", "0.64664686", "0.64664686", "0.64664686", "0.64664686", "0.6436073", "0.64159155", "0.6391451", "0.6385775", "0....
0.68908256
4
Returns the project that queries and exports will be billed to.
def _get_project(self): project = self.options.view_as(GoogleCloudOptions).project if isinstance(project, vp.ValueProvider): project = project.get() if self.temp_dataset: return self.temp_dataset.projectId if not project: project = self.project return project
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ex_get_project(self):\n response = self.connection.request('', method='GET').object\n return self._to_project(response)", "def project(self) -> Any:\n return pulumi.get(self, \"project\")", "def get_project(self):\n project_name = self.projects_combo_box.currentText()\n f...
[ "0.64833665", "0.6476297", "0.63481295", "0.6310118", "0.63095707", "0.6220107", "0.6220107", "0.6185363", "0.6185363", "0.6185363", "0.6185363", "0.6185363", "0.6185363", "0.6185363", "0.6185363", "0.6185363", "0.6185363", "0.6185363", "0.6185363", "0.6185363", "0.6185363", ...
0.6427833
2
Initialize a StorageWriteToBigQuery transform.
def __init__( self, table, create_disposition=BigQueryDisposition.CREATE_IF_NEEDED, write_disposition=BigQueryDisposition.WRITE_APPEND, triggering_frequency=0, use_at_least_once=False, with_auto_sharding=False, expansion_service=None): super().__init__() self._tab...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(\n self,\n table,\n dataset=None,\n project=None,\n schema=None,\n create_disposition=BigQueryDisposition.CREATE_IF_NEEDED,\n write_disposition=BigQueryDisposition.WRITE_APPEND,\n kms_key=None,\n batch_size=None,\n max_file_size=None,\n max_files_...
[ "0.690763", "0.6845858", "0.64759535", "0.6460644", "0.612752", "0.61065155", "0.609946", "0.60159373", "0.5983015", "0.59603107", "0.59392375", "0.5876481", "0.5839043", "0.5451173", "0.54329836", "0.5429121", "0.5413056", "0.54015267", "0.53983253", "0.537159", "0.5302036",...
0.584234
12
Generates a version id based off the current time.
def GenerateVersionId(datetime_getter=datetime.datetime.now): return datetime_getter().isoformat().lower().translate(None, ':-')[:15]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def gen_code_and_version(self):\n return uuid.uuid1().time, self.DEFAULT_VERSION", "def versioneer(self):\n datetime_string = datetime.now().strftime(\"%Y%m%d%H%M%S\")\n random_hash = uuid.uuid4().hex[:6].upper()\n\n # Example output: '20191009135240_D246ED'\n return datetime_s...
[ "0.7675895", "0.7497458", "0.7155104", "0.70939684", "0.6901147", "0.68239146", "0.6733762", "0.66654503", "0.66440415", "0.66278976", "0.6615553", "0.6569468", "0.6557082", "0.642644", "0.63449574", "0.634247", "0.63071173", "0.62981933", "0.6288715", "0.62645507", "0.623394...
0.7497838
1
Gets the name of this source version.
def GetSourceName(): return 'Google-appcfg-{0}'.format(config.CLOUD_SDK_VERSION)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def source_name(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"source_name\")", "def name(self):\n if self._name is None:\n self._name = self.source.name\n return self._name", "def version_name(self) -> pulumi.Output[Optional[str]]:\n return pulumi.get(self, \"v...
[ "0.7800416", "0.7781852", "0.7718619", "0.7543155", "0.7496921", "0.7496921", "0.7496921", "0.74472415", "0.744384", "0.7316108", "0.72848344", "0.72848344", "0.7200912", "0.72003114", "0.7192017", "0.7190088", "0.7190088", "0.7190088", "0.7174829", "0.7161567", "0.7152475", ...
0.0
-1
Determines the value of the 'Useragent' header to use for HTTP requests.
def GetUserAgent(): product_tokens = [] # SDK version product_tokens.append(config.CLOUDSDK_USER_AGENT) # Platform product_tokens.append(platforms.Platform.Current().UserAgentFragment()) # Python version python_version = '.'.join(str(i) for i in sys.version_info) product_tokens.append('Python/%s' % p...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def user_agent(self) -> str:\n return self[\"requestContext\"][\"http\"][\"userAgent\"]", "def user_agent(self):\n return self.__user_agent", "def get_user_agent():\n\n global _user_agent\n\n return _user_agent", "def user_agent(self) -> Optional[str]:\n return self[\"requestContex...
[ "0.82537967", "0.82080144", "0.8161342", "0.81480485", "0.80301636", "0.7994401", "0.7889829", "0.7801145", "0.7727039", "0.76692075", "0.75897276", "0.75778055", "0.7558719", "0.7405633", "0.72687656", "0.7246019", "0.72384644", "0.72250456", "0.7181339", "0.7145696", "0.713...
0.58362716
62
Returns the current time in microseconds.
def GetCurrentTimeUsec(self): return int(round(self.time_func() * 1000 * 1000))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def current_milli_time():\n return round(time() * 1000)", "def current_time():\n return round(time.time() * 1000)", "def get_current_time(self) -> float:\n raise NotImplementedError", "def current_second():\n return round(time.time())", "def time_in_ms():\n return int(time.time() * 1...
[ "0.7872089", "0.7710902", "0.7596841", "0.7565461", "0.753128", "0.73908895", "0.7329546", "0.7289451", "0.7286098", "0.7286098", "0.7286098", "0.7274926", "0.72041684", "0.7201523", "0.7159681", "0.7158291", "0.7140124", "0.71314627", "0.7121721", "0.71153736", "0.70948356",...
0.7793654
1
Generate random colors. To get visually distinct colors, generate them in HSV space then convert to RGB.
def random_colors(N, bright=True): brightness = 1.0 if bright else 0.7 hsv = [(i / N, 1, brightness) for i in range(N)] colors = list(map(lambda c: colorsys.hsv_to_rgb(*c), hsv)) random.shuffle(colors) return colors
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def random_color():\n return hsv2rgb(random.random(), 1, 1)", "def rand_color():\n return Color(random.random(), 1, 1, mode='hsv').rgba", "def gen_colors(num_colors):\n import random\n import colorsys\n\n hsvs = [[float(x) / num_colors, 1., 0.9] for x in range(num_colors)]\n random.seed(2333)...
[ "0.82263637", "0.8009424", "0.76796615", "0.7653313", "0.7626682", "0.7566228", "0.7474421", "0.74454963", "0.74120694", "0.73645425", "0.73583955", "0.7326555", "0.731997", "0.72697955", "0.72612923", "0.7253349", "0.7252907", "0.72257847", "0.7209227", "0.7179143", "0.71765...
0.7322576
19
Creates a block and include all transactions in self.pending_transactions.
def create_block(self): # create transaction merkle tree and get the root transaction_tree = ZeroMerkleTree(self.pending_transactions) transaction_root = transaction_tree.root_hash block_header = BlockHeader(height = self.block_height, previous_hash = ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new_block(self, transaction_sender_id, transaction_recipient_id, amount, proof, prev_hash=None):\n \n block = Block(\n timestamp=datetime.now(),\n transaction_sender_id=transaction_sender_id,\n transaction_recipient_id=transaction_recipient_id,\n transa...
[ "0.726304", "0.70552623", "0.6984103", "0.68803114", "0.6862523", "0.68608266", "0.6860025", "0.6850966", "0.6755274", "0.66689706", "0.6537406", "0.65016985", "0.6454476", "0.6416374", "0.6368132", "0.6366679", "0.63395464", "0.6333963", "0.6319474", "0.6318658", "0.6312661"...
0.6495819
12
Verify if a given chain is valid.
def verify_chain(block_headers: list, transactions: list): if len(block_headers) != len(transactions) and len(block_headers) == 0: return False # an valid chain contains only the genesis block if len(block_headers) == 1: return True # validate the all the rest o...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def valid_chain(self, chain):\n\n logger.error(\"Checking validity.\")\n\n previous_block = chain[0]\n block_index = 1\n\n while block_index < len(chain):\n current_block = chain[block_index]\n if current_block['previous_hash'] != Blockchain.hash(previous_block):\n...
[ "0.83854455", "0.8160956", "0.8058361", "0.8008761", "0.7980719", "0.7949302", "0.793977", "0.7850016", "0.78407425", "0.7826784", "0.7822156", "0.78028", "0.7719232", "0.76984936", "0.7673911", "0.7544276", "0.74310845", "0.72950786", "0.72612876", "0.7255712", "0.72300243",...
0.6665297
28
Copies a local file to a GCS path.
def upload_file( local_file_path: str, remote_file_path: str, ) -> str: subprocess.check_output( ["gsutil", "cp", local_file_path, remote_file_path], encoding="UTF-8" ) return remote_file_path
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _copy_file_from_gcs(file_path):\n logger.info('Downloading %s' % file_path)\n with file_io.FileIO(file_path, mode='rb') as input_f:\n basename = os.path.basename(file_path)\n local_path = os.path.join('/tmp', basename)\n with file_io.FileIO(local_path, mode='w+') as output_f:\n ...
[ "0.8411938", "0.80997974", "0.7248681", "0.6972772", "0.6886771", "0.67966855", "0.67259914", "0.6647485", "0.6637526", "0.66255534", "0.6621239", "0.65289897", "0.6436796", "0.64327973", "0.642108", "0.6377348", "0.63763493", "0.6372159", "0.6339403", "0.62677866", "0.626729...
0.7112688
3
Gets the next byte of the HMAC.
def crack_next_byte(known, file): expected_delay = DELAY * len(known) expected_delay += DELAY * 0.75 for i in range(5): time_request(file, c1.asciitohex(b'abnsbsuoabna')) for i in range(256): mac = known + bytes([i]) + bytes([0] * (19 - len(known))) t = time_request(file, c1....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def hmac(self):\n return binascii.hexlify(self._token[HMAC_START:HMAC_END])", "def nextByte(self):\n rv=self.parts[self.used]\n self.used=self.used+1\n return rv", "def _nextCTRByte(self):\r\n b = ord(self._ctr_cks[self._ctr_pos])\r\n self._ctr_pos += 1\r\n \r\n ...
[ "0.659288", "0.65917253", "0.6413407", "0.620968", "0.5980914", "0.5948417", "0.59422165", "0.5870238", "0.58584094", "0.5824148", "0.58118206", "0.5693958", "0.5663196", "0.55934876", "0.5590463", "0.55695665", "0.55486006", "0.5541926", "0.55187047", "0.548699", "0.54818505...
0.55368865
18
Grab the current TLE time
def get_tle_time(): return r.get("iss_tle_time")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def TLGetTime() -> float:\n pass", "def time():\n return tnow", "def getTime(self):\n\t\treturn self.t + (timeit.default_timer() - self.time)", "def get_time():\n return time.time()", "def time(self):\n return self.t", "def get_current_time(self) -> float:\n raise NotImplementedErr...
[ "0.7778892", "0.77736026", "0.77216995", "0.75050235", "0.7410993", "0.7401699", "0.737473", "0.73579216", "0.7340539", "0.73379284", "0.73240167", "0.7294817", "0.72455066", "0.7233601", "0.7219037", "0.72002774", "0.7178682", "0.71744674", "0.7174012", "0.7170514", "0.71594...
0.75080824
3
convert milliseconds to seconds
def ms(milliseconds:int) -> float: return milliseconds/1000
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def millis_to_seconds(millis) -> float:\n\n return millis / 1000", "def ts_to_ms(ts):\n return int(ts * 1e3)", "def ms_from_timedelta(td):\n return (td.seconds * 1000) + (td.microseconds / 1000.0)", "def timedelta_to_seconds(td):\r\n return (td.microseconds + (td.seconds + td.days * 24 * 3600...
[ "0.8073588", "0.7358216", "0.72966576", "0.704579", "0.704579", "0.70207584", "0.70086956", "0.70054716", "0.700307", "0.69982547", "0.69832355", "0.69603556", "0.6947396", "0.6934074", "0.6902944", "0.6891637", "0.6888017", "0.68729335", "0.6868368", "0.6864232", "0.6847582"...
0.6960863
11
Returns the height of the terminal
def height(self): return self.__height
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_terminal_height(fd=1):\n if os.isatty(fd):\n height = get_terminal_size(fd)[0]\n else:\n height = 999\n\n return height", "def get_height(self) -> int:\n return curses.LINES", "def terminal_size():\n import termios, fcntl, struct, sys\n s = struct.pack(\"HHHH\", 0, 0...
[ "0.7886938", "0.78311914", "0.7511298", "0.74440783", "0.7282792", "0.7187416", "0.7187416", "0.71296895", "0.7125466", "0.71221846", "0.71121377", "0.7087493", "0.7078799", "0.70773214", "0.704931", "0.7043209", "0.70389766", "0.70303", "0.702085", "0.7013019", "0.7008642", ...
0.69470173
40
Move x characters to the left of the cursor
def move_left(units = 1): raw_print(t.move_left(units))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def moveLeftOneCharacter(self):\r\n self.SendScintilla(QsciScintilla.SCI_CHARLEFT)", "def move_left(n: int):\n return Cursor.escape(\"[{}D\", n)", "def moveCursorWordLeft(self):\r\n self.SendScintilla(QsciScintilla.SCI_WORDLEFT)", "def cursorLeft(amount):\n print(ESC + f\"[{amount}D\"...
[ "0.78996444", "0.78199744", "0.7361807", "0.7268693", "0.6948246", "0.6941601", "0.6932837", "0.6923383", "0.69089437", "0.68939996", "0.67490137", "0.6645555", "0.6614578", "0.6528097", "0.652346", "0.65233344", "0.6497776", "0.64910334", "0.6484211", "0.6458293", "0.6434189...
0.61913234
38
Move x characters to the left of the cursor
def move_right(units = 1): raw_print(t.move_right(units))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def moveLeftOneCharacter(self):\r\n self.SendScintilla(QsciScintilla.SCI_CHARLEFT)", "def move_left(n: int):\n return Cursor.escape(\"[{}D\", n)", "def moveCursorWordLeft(self):\r\n self.SendScintilla(QsciScintilla.SCI_WORDLEFT)", "def cursorLeft(amount):\n print(ESC + f\"[{amount}D\"...
[ "0.7898661", "0.78193", "0.7361717", "0.72679657", "0.694777", "0.6941207", "0.69325143", "0.69236225", "0.69081724", "0.68944037", "0.6748272", "0.66435987", "0.6613019", "0.6527423", "0.6523478", "0.6523205", "0.6496607", "0.64900553", "0.64825094", "0.64580274", "0.6433489...
0.0
-1
Set the cursor's x position
def move_x(x): raw_print(t.move_x(x))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_cursor_x(self, x):\n\n if x >= 0 and x <= self.server.server_info.get(\"screen_width\"):\n self.cursor_x = x\n self.server.request(\"screen_set %s cursor_x %i\" % (self.ref, self.cursor_x))", "def setCursor(self, pos=(0, 0)):\n x, y = pos\n self.cursor = (x, y)"...
[ "0.8723949", "0.7993288", "0.7837947", "0.7578283", "0.7476161", "0.744976", "0.7429874", "0.73933727", "0.73798347", "0.7293286", "0.71158534", "0.7069746", "0.7024816", "0.7021617", "0.6990195", "0.6990195", "0.69795233", "0.69340336", "0.69304353", "0.69304353", "0.6919949...
0.61768806
70
Clear the whole screen.
def clear(): raw_print(t.clear)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def clear(self):\n\n self.screen.fill((255, 255, 255))", "def clear(self):\n self.virt_screen.fill((0, 0, 0))", "def clear_screen(self):\n self.screen.fill(self.dead_color)", "def clear_screen(self):\n self.MAIN_SURF.fill((220, 200, 210))", "def clear_screen(self):\n os.s...
[ "0.90387315", "0.896812", "0.88549536", "0.8817575", "0.8790113", "0.86357635", "0.85098475", "0.85002047", "0.8475139", "0.84749544", "0.837181", "0.836163", "0.8353968", "0.8343266", "0.83397686", "0.8311828", "0.8290788", "0.82815874", "0.82702476", "0.8259573", "0.8240074...
0.7145252
71
Return cursor and clear screen
def clear_all(): raw_print(t.clear + t.home)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def clear(self):\n self._stdout.write(TerminalCodes.ERASE_SCREEN)\n self._stdout.write(TerminalCodes.CURSOR_GOTO(0, 0))", "def clearlinefromcursor(self):\n self._command(\"[0K\")", "def __exit__(self, *args):\n os.system(\"setterm -cursor on\")\n sys.stdout.write(\"\\n\")", ...
[ "0.8105648", "0.7975582", "0.7924171", "0.78802747", "0.7832043", "0.7773098", "0.7764121", "0.77131534", "0.7476044", "0.7412753", "0.738998", "0.7364561", "0.7361771", "0.7358985", "0.73536026", "0.7347896", "0.7340347", "0.7329334", "0.730653", "0.72774553", "0.72639775", ...
0.0
-1
Append an object to the queue.
def queue_append(self, object): self.queue.append(object)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def push(self, obj):\n\n self.in_queue.append(obj)", "def add(self, element):\n self.__queue.append(element)", "def push(self, obj):\n self._data.append(obj)", "def queue(self, item):\n self._queue.append(item)", "def add(self, obj: object)-> None:\n self._storage.append(...
[ "0.8351138", "0.7682278", "0.7641625", "0.75871736", "0.7427679", "0.73250085", "0.7312265", "0.7261281", "0.7261281", "0.72469467", "0.7205968", "0.71211874", "0.7107321", "0.71003145", "0.7093135", "0.70408374", "0.70084053", "0.69985497", "0.69764775", "0.69758207", "0.697...
0.93421
0
Convert process into flat list of words representation
def flat(s): # TODO refactor this to have all the length in the front, like in ye olden times # This makes checking for mutability easier keys = [len(s[KEYS])] + list(s[KEYS]) code = [] for instruction in s[CODE]: code += [len(instruction)] code += instruction data = [] for d in s[DATA]: data += [len(d)]...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def process(self, to_process):\n assert(isinstance(to_process, list))\n for t in to_process:\n # run text\n words = self._make_wordbag(t)\n words = [w for w in words if self._check_unwanted(w) and w not in self._ignore]\n self.masterbag += words", "def _t...
[ "0.6778939", "0.6339342", "0.62729096", "0.62457573", "0.62023234", "0.6159363", "0.61525345", "0.6150051", "0.60536224", "0.6026912", "0.5980686", "0.5980463", "0.5949738", "0.59404737", "0.59336317", "0.5931789", "0.58884645", "0.58754784", "0.5873685", "0.58665156", "0.584...
0.0
-1
Parses a datetime object from a raw date string.
def _parse_datetime(self, raw_date): # has format 'Sun, 16 Sep 2012 21:11:41 +0000' fmt = '%a, %d %b %Y %H:%M:%S +0000' return datetime(*strptime(raw_date, fmt)[:6])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_datetime(s: str) -> datetime:\n DATETIME_FORMAT = r\"%d/%m/%Y %H:%M\"\n\n return datetime.strptime(s, DATETIME_FORMAT)", "def parse_datetime(date_str):\n return datetime.strptime(date_str, '%Y-%m-%d %H:%M')", "def parse_datetime_string(input):\n result = parser.parse(input)\n return re...
[ "0.7571399", "0.75175625", "0.7433559", "0.7264811", "0.7232286", "0.7217503", "0.7206681", "0.72045356", "0.7201746", "0.7192589", "0.7173797", "0.714757", "0.71448725", "0.7096396", "0.7046319", "0.704293", "0.70399255", "0.70010084", "0.6987247", "0.69772285", "0.695435", ...
0.77085865
0
Check if in an addition of two fractions returns zero.
def add_zero_checker(cls, fraction1, fraction2): # Discard invalid arguments type # First argument if not isinstance(fraction1, str) and fraction1 != 0: print("The first argument isn't a fraction") return None # Second argument elif not isinstance(fracti...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sub_zero_checker(cls, fraction1, fraction2):\n\n # Discard invalid arguments type\n # First argument\n if not isinstance(fraction1, str) and fraction1 != 0:\n print(\"The first argument isn't a fraction\")\n return None\n\n # Second argument\n elif not i...
[ "0.69888705", "0.69211507", "0.68007565", "0.6590917", "0.6530848", "0.64454865", "0.6281331", "0.6278761", "0.62201864", "0.61807823", "0.61525726", "0.60914433", "0.60835224", "0.60768855", "0.6045896", "0.6022371", "0.6013043", "0.6010533", "0.6004922", "0.6001805", "0.596...
0.74889666
0
Dump rendered yaml file.
def dump_yaml(data, filename): with open(filename, 'w') as yaml_file: yaml.dump(data, yaml_file, default_flow_style=False)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dump(self):\n print(yaml.dump(self.toYaml(), width=float(\"inf\")))", "def dump(self):\n with open(self.path, \"w\") as f:\n yaml.dump(self.data, f)", "def dump_yaml(tables, args):\n\n # this is to output dict keys in the same order they were added to the dicts\n # (assuming ...
[ "0.76257616", "0.7595799", "0.6909338", "0.6839806", "0.6716476", "0.6712225", "0.67011297", "0.6605678", "0.6593909", "0.65875435", "0.65789396", "0.6578451", "0.65477353", "0.65334046", "0.65086377", "0.65000707", "0.6490183", "0.6444907", "0.643288", "0.63784", "0.63771164...
0.6822718
4
Create a Kitti3dObjectDetectionMetric object.
def __init__(self, node, result_folder, ground_truth_folder, output_folder): super(Kitti3dObjectDetectionMetric, self).__init__(result_folder, output_folder) self._ground_truth_folder = ground_truth_folder self.node = node
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def New(*args, **kargs):\n obj = itkExpectationBasedPointSetToPointSetMetricv4PSD3.__New_orig__()\n import itkTemplate\n itkTemplate.New(obj, *args, **kargs)\n return obj", "def New(*args, **kargs):\n obj = itkMeanReciprocalSquareDifferenceImageToImageMetricID3ID3.__New_orig__(...
[ "0.575754", "0.56961346", "0.56929624", "0.5676633", "0.56405795", "0.5630063", "0.56221706", "0.5606191", "0.55786073", "0.5556323", "0.5485301", "0.5480496", "0.54097193", "0.54007435", "0.54007435", "0.5400055", "0.5389762", "0.5323695", "0.5323695", "0.53123695", "0.53026...
0.6156344
0
Computes the accuracy over the k top predictions for the specified values of k
def accuracy(output, target, topk=(1,)): with torch.no_grad(): maxk = max(topk) batch_size = target.size(0) _, pred = output.topk(maxk, 1, True, True) pred = pred.t() correct = pred.eq(target.view(1, -1).expand_as(pred)) res = [] for k in topk: c...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def accuracy(y_pred, y_actual, topk=(1, )):\n maxk = max(topk)\n batch_size = y_actual.size(0)\n\n _, pred = y_pred.topk(maxk, 1, True, True)\n pred = pred.t()\n correct = pred.eq(y_actual.view(1, -1).expand_as(pred))\n\n res = []\n for k in topk:\n correct_k = correct[:k].view(-1).floa...
[ "0.8284662", "0.8263996", "0.8210357", "0.82097954", "0.819159", "0.81795794", "0.8175413", "0.8175173", "0.8170473", "0.81684375", "0.81622064", "0.81622064", "0.81622064", "0.81622064", "0.81622064", "0.81622064", "0.81622064", "0.81622064", "0.81622064", "0.81622064", "0.8...
0.78618157
72
render the about page
def about(): return render_template("about.html")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def about():\n\n return render_template('about_page/about.html')", "def about():\n return render_template('about.html', title='About')", "def about():\n return render_template('about.html', title='About')", "def about(request):\n\treturn render_to_response('aboutus.html')", "def about():\n logg...
[ "0.86589855", "0.8547488", "0.8547488", "0.8546761", "0.8543982", "0.8536842", "0.8536842", "0.8524548", "0.85216635", "0.8519387", "0.8484584", "0.8484584", "0.8484584", "0.8484584", "0.8484584", "0.8484584", "0.8484584", "0.8484584", "0.8484584", "0.8484584", "0.8484584", ...
0.8802272
0
render the quick start page
def quickstart(): return render_template("quickstart.html")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show_start():\n return render_template('start.html')", "def main():\n\n return render_template('index.html')", "def start(request):\n return render(request, 'base.html', {})", "def main():\n\n return render_template('main.html')", "def _start(self, *args, **kwargs):\n Welcome...
[ "0.7567128", "0.7092295", "0.69905734", "0.6947278", "0.68673545", "0.68442863", "0.67830485", "0.67763406", "0.6761918", "0.6753156", "0.6751", "0.67235374", "0.67204785", "0.6712506", "0.67066795", "0.6682712", "0.66822", "0.6679978", "0.6679768", "0.66696477", "0.6648649",...
0.8719074
0
Return matrix to rotate about axis defined by point and direction. >>> R = rotation_matrix(math.pi/2, [0, 0, 1], [1, 0, 0]) >>> np.allclose(np.dot(R, [0, 0, 0, 1]), [1, 1, 0, 1]) True >>> angle = (random.random() 0.5) (2math.pi) >>> direc = np.random.random(3) 0.5 >>> point = np.random.random(3) 0.5 >>> R0 = rotation_m...
def mat4_rotate(angle, direction, point=None): sina = sin(angle) cosa = cos(angle) direction = vec3(direction[:3]) # rotation matrix around unit vector R = np.diag([cosa, cosa, cosa]) R += np.outer(direction, direction) * (1.0 - cosa) direction *= sina R += np.array( [[ 0.0, -di...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rotation_matrix(angle, direction, point=None):\n sina = math.sin(angle)\n cosa = math.cos(angle)\n direction = unit_vector(direction[:3])\n # rotation matrix around unit vector\n R = np.diag([cosa, cosa, cosa])\n R += np.outer(direction, direction) * (1.0 - cosa)\n direction *= sina\n R...
[ "0.8252512", "0.71686643", "0.7122998", "0.70378834", "0.70216554", "0.70207876", "0.7017173", "0.6961719", "0.6931359", "0.68544716", "0.6821704", "0.6819628", "0.67700297", "0.6726694", "0.6707387", "0.66932404", "0.6683812", "0.66579515", "0.6634722", "0.66250134", "0.6607...
0.7771841
1
Return homogeneous rotation matrix from Euler angles and axis sequence.
def mat4_from_euler(ai, aj, ak, axes='sxyz'): try: firstaxis, parity, repetition, frame = _AXES2TUPLE[axes] except (AttributeError, KeyError): _TUPLE2AXES[axes] # noqa: validation firstaxis, parity, repetition, frame = axes i = firstaxis j = _NEXT_AXIS[i+parity] k = _NEXT_A...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def euler2mat(angle):\n\n if len(angle.size()) == 1:\n x, y, z = angle[0], angle[1], angle[2]\n _dim = 0\n _view = [3, 3]\n elif len(angle.size()) == 2:\n b, _ = angle.size()\n x, y, z = angle[:, 0], angle[:, 1], angle[:, 2]\n _dim = 1\n _view = [b, 3, 3]\n\n ...
[ "0.7482787", "0.73391783", "0.73391783", "0.7185548", "0.7094209", "0.7055884", "0.701043", "0.69919616", "0.69634247", "0.6960123", "0.6960123", "0.69130486", "0.68787235", "0.6871928", "0.687075", "0.6870524", "0.6842103", "0.6815873", "0.6800039", "0.6793052", "0.67736584"...
0.0
-1
Return homogeneous rotation matrix from quaternion. >>> M = mat4_from_quat([0.99810947, 0.06146124, 0, 0]) >>> np.allclose(M, rotation_matrix(0.123, [1, 0, 0])) True >>> M = mat4_from_quat([1, 0, 0, 0]) >>> np.allclose(M, np.identity(4)) True >>> M = mat4_from_quat([0, 1, 0, 0]) >>> np.allclose(M, np.diag([1, 1, 1, 1])...
def mat4_from_quat(quaternion): q = np.array(quaternion, dtype=np.float64, copy=True) n = np.dot(q, q) if n < _EPS: return np.identity(4) q *= sqrt(2.0 / n) q = np.outer(q, q) return np.array([ [1.0-q[2, 2]-q[3, 3], q[1, 2]-q[3, 0], q[1, 3]+q[2, 0], 0.0], [ q[1...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def quat2mat(quat):\n norm_quat = quat\n norm_quat = norm_quat/norm_quat.norm(p=2, dim=1, keepdim=True)\n w, x, y, z = norm_quat[:,0], norm_quat[:,1], norm_quat[:,2], norm_quat[:,3]\n\n B = quat.size(0)\n\n w2, x2, y2, z2 = w.pow(2), x.pow(2), y.pow(2), z.pow(2)\n wx, wy, wz = w*x, w*y, w*z\n ...
[ "0.76572925", "0.7654437", "0.75758356", "0.7562886", "0.7547756", "0.7449879", "0.74453515", "0.740069", "0.73676443", "0.72693336", "0.7230482", "0.7189083", "0.7157854", "0.7057949", "0.68459207", "0.67977375", "0.66957045", "0.6592107", "0.65164447", "0.64077365", "0.6372...
0.836443
0
Return inverse of square transformation matrix. >>> M0 = random_rotation_matrix() >>> M1 = inverse_matrix(M0.T) >>> np.allclose(M1, np.linalg.inv(M0.T)) True
def mat4_inverse(matrix): return np.linalg.inv(matrix)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def invMatrixM(M):\n if M.shape[0] % 2 == 0 or M.shape[1] % 2 == 0 or M.ndim > 2:\n raise ValueError(\"Cannot invert matrix with even number of columns or rows\")\n #So, numpy have a special matrix object which can be created directly from array like object,\n #and this matrix object have exponents...
[ "0.80304044", "0.7938884", "0.7820265", "0.7772412", "0.7762266", "0.77369934", "0.76161677", "0.75605536", "0.7556975", "0.75470215", "0.75421786", "0.74676794", "0.7431296", "0.7409288", "0.736399", "0.73152244", "0.72620225", "0.7245112", "0.7196302", "0.7077307", "0.70226...
0.7977862
1
Return matrix to project onto plane defined by point and normal. Using either perspective point, projection direction, or none of both. If pseudo is True, perspective projections will preserve relative depth such that Perspective = dot(Orthogonal, PseudoPerspective). >>> P = mat4_projection([0, 0, 0], [1, 0, 0])
def mat4_projection( point, normal, direction=None, perspective=None, pseudo=False ): M = np.identity(4) point = np.array(point[:3], dtype=np.float64, copy=False) normal = vec3(normal[:3]) if perspective is not None: # perspective projection perspective = np.a...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def perspective4P(image, points):\n P = None\n image = imvalidate(image)\n if not image is None:\n # order four corner points\n src = numpy.float32(points)\n src = sort4P(src)\n \n # calculate maximum width and height of the bounding rectangle\n # formed by the fo...
[ "0.6528731", "0.644015", "0.63853264", "0.6080713", "0.603693", "0.59934556", "0.59542996", "0.59382105", "0.5937211", "0.5878349", "0.58518016", "0.5844182", "0.57726604", "0.57329136", "0.5705762", "0.56765956", "0.5671924", "0.56626546", "0.56330633", "0.56285864", "0.5616...
0.87153316
0
Returns all filenames that are directly under path directory or subdirectories.
def get_all_filenames(self, path: str) -> List[str]: walk_gen = os.walk(path, topdown=False) walks = [] for walk in walk_gen: walks += [os.path.join(walk[0], x) for x in walk[2] if not self.check_ignored(walk[0])] return walks
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_files(path):\n paths = os.walk(os.path.abspath(path))\n files = list()\n for fpath, _, afiles in paths:\n for afile in afiles:\n files.append(os.path.join(fpath, afile))\n else:\n return files", "def _get_filenames_in_directory_(path, labe...
[ "0.79283404", "0.7773269", "0.7737053", "0.77226526", "0.76814485", "0.76235515", "0.7575478", "0.75528646", "0.7548317", "0.754797", "0.75162655", "0.7510345", "0.7488296", "0.7478349", "0.7429581", "0.73838246", "0.738213", "0.7379761", "0.73786956", "0.735209", "0.73490715...
0.75178057
10
Remove ticks from axis.
def remove_ticks(ax, x=False, y=False): if x: ax.xaxis.set_ticks_position("none") if y: ax.yaxis.set_ticks_position("none") return ax
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove_ticks(ax):\n ax.set_xticklabels([])\n ax.set_yticklabels([])\n ax.set_xticks([])\n ax.set_yticks([])", "def clean_ticks(self):\n self.axes.xaxis.set_ticks_position('none')\n self.axes.yaxis.set_ticks_position('none')", "def clean_axis(ax):\n ax.get_xaxis().set_ticks([])\n ax....
[ "0.85731703", "0.8529529", "0.82195574", "0.77267885", "0.7652609", "0.76371866", "0.7502885", "0.7451956", "0.7181028", "0.7117976", "0.70795155", "0.6911892", "0.6540788", "0.6411508", "0.63962597", "0.63950753", "0.63948345", "0.636222", "0.63147056", "0.63147056", "0.6255...
0.82306105
2
Return the length of the snake
def length (self): return len(self.position)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def current_score():\n # @4.4 Return the current score, which is equal to the snake's length\n # minus its starting length.\n return 0", "def length(self):\n result = 0\n for seg in self.segments:\n result += seg.length \n return result", "def get_length(dna):\n \n ...
[ "0.6623829", "0.6576592", "0.655497", "0.6506879", "0.6506879", "0.6506879", "0.64484495", "0.6404168", "0.6404168", "0.6404168", "0.63319176", "0.625326", "0.6234592", "0.622479", "0.62206435", "0.6189354", "0.61786634", "0.61592484", "0.6152083", "0.613865", "0.6135538", ...
0.5960892
41
Change the snake's direction to that specified. Note that it is not possible to turn 180 degrees
def change_direction(self, new_direction): # @2.1 Update self.direction with the new direction specified. # # Only do this if moving in the new direction doesn't take us back to # where we just came from. (The next_space() method with the # appropriate direction will show where w...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def change_direction(self, new_direction: str):\n if new_direction == 'UP' and self.snake_direction != 'DOWN':\n self.snake_direction = 'UP'\n if new_direction == 'DOWN' and self.snake_direction != 'UP':\n self.snake_direction = 'DOWN'\n if new_direction == 'LEFT' and sel...
[ "0.7695549", "0.7321596", "0.728853", "0.72316706", "0.70387584", "0.7013992", "0.6998288", "0.6761892", "0.67381144", "0.6728066", "0.6671955", "0.65986246", "0.6585846", "0.6574341", "0.65454656", "0.6541439", "0.65256697", "0.64828134", "0.64684016", "0.643561", "0.6424175...
0.62291574
32
Set the speed at which the snake moves to a new value
def set_speed(self, new_speed): self.speed = new_speed pygame.time.set_timer(EVENT_MOVE_SNAKE, new_speed)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_speed(self, speed):\r\n self.speed = speed", "def speed(self, new_speed):\n self.__speed = float(new_speed)", "def set_speed(self, speed) :\n self.speed = speed", "def set_speed(self, v):\n self.v = v", "def set_speed(self, speed):\n self.__speed = speed", "def ...
[ "0.75948757", "0.7503179", "0.74421495", "0.73486507", "0.7321511", "0.73145634", "0.7268784", "0.7260159", "0.72266775", "0.7218873", "0.720592", "0.7116834", "0.70746624", "0.70711213", "0.7033627", "0.6953858", "0.6952899", "0.6949349", "0.69070685", "0.6852046", "0.684422...
0.8419078
0
Reset the size and position of the snake to the starting point
def reset_position(self): self.position = [] for x in range(INITIAL_LENGTH): self.position.insert(0,(x,1)) self.direction = EAST self.set_speed(INITIAL_SPEED)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reset(cls):\n cls.score = 0\n cls.snake = Snake()\n cls.set_apple_pos()\n Screen.draw_apple(cls.apple)\n Screen.display_btm_msg(f\"Score: {cls.score}\")", "def reset(self):\n x_0, y_0 = self.board.get_size()\n x_0 = x_0 // 2\n y_0 = y_0 // 2\n se...
[ "0.715966", "0.71337557", "0.6981957", "0.68545157", "0.6827657", "0.66786027", "0.66538763", "0.66520286", "0.66495603", "0.6646382", "0.6644565", "0.6643205", "0.6642242", "0.66110563", "0.66009283", "0.6529785", "0.65029144", "0.6497298", "0.6470575", "0.6466463", "0.64411...
0.6185324
40
Reset the grid such that all the squares are empty
def clear_grid(self): self.grid = [[self.EMPTY for x in range(self.width)] for y in range(self.height)]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reset(self):\n self._grid = [[ 0 for dummy_col in range(self._grid_width)] \n for dummy_row in range(self._grid_height)]\n if self.count_empty() > 0:\n self.new_tile()\n if self.count_empty() > 0:\n self.new_tile()", "def reset(self):\n s...
[ "0.8835447", "0.87549335", "0.8719405", "0.8628823", "0.86262184", "0.8592497", "0.85899097", "0.8567881", "0.85601884", "0.8552268", "0.8486785", "0.8290881", "0.8258776", "0.81637686", "0.814973", "0.79389787", "0.7936506", "0.7894354", "0.78849596", "0.7842001", "0.7801937...
0.89396125
0
Reset the specified cell in the grid
def clear_cell(self, cell): self.set_cell(cell, self.EMPTY)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reset_cell(self, cell):\n cell.current_index = 0\n cell.number = 0\n self.puzzle[cell.row][cell.column] = 0", "def reset(self):\n self.cells = [[0 for _ in range(self.cols)] for _ in range(self.rows)]", "def reset(self):\n self._grid = [[row*0 + col*0 for col in range(sel...
[ "0.83879334", "0.7229915", "0.71524405", "0.7147442", "0.706657", "0.7059238", "0.7045568", "0.69292325", "0.6928324", "0.69109184", "0.6894737", "0.68826157", "0.687509", "0.6867792", "0.6829596", "0.6816677", "0.68090594", "0.68071944", "0.6791828", "0.6665921", "0.6625242"...
0.7105864
4
Check if the given cell (x,y) is within the grid
def within_grid(self, cell): # @3.1 Return True if the cell is within the grid, False otherwise # First unpack the cell into its constituent x,y parts x,y = cell return True
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_inside_grid(self, coord: tuple[int, int]) -> bool:\n x, y = coord\n if x < 0 or x >= self.gridWidth or \\\n y < 0 or y >= self.gridHeight:\n return False\n return True", "def check_cell_neighbors (self,row,col,grid):\n x_min = max (0,col-1)\n x_max =...
[ "0.8154893", "0.7901628", "0.76677406", "0.76666486", "0.7469186", "0.7441914", "0.74229294", "0.7403626", "0.7348667", "0.73368686", "0.7256103", "0.72554284", "0.7243072", "0.7242115", "0.7223639", "0.7191433", "0.7185073", "0.7162115", "0.71564955", "0.7155784", "0.7151253...
0.8918928
0
Return the current score
def current_score(): # @4.4 Return the current score, which is equal to the snake's length # minus its starting length. return 0
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_current_score(self):\n return int(self.current_score)", "def get_score(self):\n pass", "def get_score(self):\n return self._score", "def get_score(self) -> float:\n pass", "def score(self):\n return self.__score", "def score(self):\n return self._score", ...
[ "0.8764956", "0.83778006", "0.8353461", "0.83346105", "0.82803035", "0.8258041", "0.8258041", "0.8258041", "0.8258041", "0.8258041", "0.8258041", "0.8258041", "0.82101554", "0.82101554", "0.81238145", "0.809642", "0.7980735", "0.7878124", "0.7846485", "0.7814719", "0.7809497"...
0.7963639
17
Write text to the screen.
def draw_text(text, x=None, y=None, font=default_font, color=BLACK): textobj = font.render(text, 1, color) textrect = textobj.get_rect() if x == None or y == None: (center_x, center_y) = center_rect(textrect.width, textrect.height) if x == None: x = center_x if y == None:...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def WriteText(self, text):\n print(text)", "def write(self, text): \n if self.frame is None:\n if not wx.Thread_IsMain():\n wx.CallAfter(self.CreateOutputWindow, text)\n else:\n self.CreateOutputWindow(text)\n else:\n if not w...
[ "0.7992049", "0.7601747", "0.7596669", "0.75086516", "0.7399598", "0.73528385", "0.73498464", "0.7346609", "0.73081946", "0.72350097", "0.72003776", "0.7181574", "0.71809113", "0.7134164", "0.70921546", "0.7082048", "0.7080068", "0.70573175", "0.7051879", "0.7051786", "0.7036...
0.0
-1
Draw the screen to display when the game ends
def draw_game_over_screen(): draw_text('Game Over', font=large_font, color=RED) draw_text('Press Space to Continue', y=300, color=RED) # @5.5 If the current score is equal to the top score then display a # message to tell the player how awesome they are for getting the top score # Switch to the...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def drawEndGame(self):\n xmid = self.dims[\"lb_width\"]/2\n ymid = self.dims[\"lb_height\"]/2\n\n self.game_canvas.create_text((xmid, ymid),\n font=(\"Arial\", 30),\n fill = 'green',\n t...
[ "0.7727658", "0.7641411", "0.7587754", "0.756631", "0.74459296", "0.74424714", "0.7436776", "0.73968637", "0.73767465", "0.73751193", "0.73577875", "0.7306261", "0.73030925", "0.73021346", "0.72423714", "0.7233502", "0.7225903", "0.7197973", "0.7197973", "0.7196667", "0.71945...
0.0
-1
Load shopping data from a CSV file `filename` and convert into a list of evidence lists and a list of labels. Return a tuple (evidence, labels). evidence should be a list of lists, where each list contains the
def load_data(filename): data_evidence_result = [] data_labels_result = [] with open(filename) as file: csv_data = csv.reader(file) next(csv_data) months = {name:num for num, name in enumerate(calendar.month_abbr) if num} for line in csv_data: total_cols = len(...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_data(filename):\n f = open(filename).read().strip()\n f = f.replace(\"FALSE\", \"0\")\n f = f.replace(\"TRUE\", \"1\")\n f = f.replace(\"Returning_Visitor\", \"1\")\n f = f.replace(\"Other\", \"0\")\n f = f.replace(\"New_Visitor\", \"0\")\n months = [\"Jan\", \"Feb\", \"Mar\", \"Apr\"...
[ "0.67623764", "0.67367417", "0.62972516", "0.62808233", "0.6142092", "0.61267024", "0.6100213", "0.6076474", "0.5963351", "0.59068155", "0.5874391", "0.5790788", "0.57722855", "0.57580566", "0.575677", "0.5744936", "0.57336193", "0.5687361", "0.56731856", "0.5665522", "0.5653...
0.6922172
0
No teams are displayed if the queryset is empty.
def test_team_list_with_no_teams(self): self.client.login(username='user1', password='password') response = self.client.get(reverse('teams:teamList')) self.assertQuerysetEqual(response.context['team_list'], []) self.assertContains(response, 'No teams yet.')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_getall_teams_no_teams_exist(self):\n response = self.client.get(\"/teams/getall/{}/\".format(self.trainer_id_0))\n self.assertEqual(response.status_code, 204)", "def test_team_get_no_teams(self):\n user = PlayerFactory()\n\n client = APIClient()\n client.force_authenti...
[ "0.6492063", "0.63224804", "0.62927026", "0.6136545", "0.6022084", "0.6008542", "0.5950118", "0.59115887", "0.5865067", "0.5831145", "0.58270895", "0.571192", "0.563265", "0.5619786", "0.55973065", "0.5557472", "0.5555419", "0.555095", "0.5549166", "0.5528488", "0.55238044", ...
0.73091364
0
No swimmers are displayed if the queryset is empty.
def test_swimmer_list_with_no_swimmers(self): self.client.login(username='user1', password='password') team = test.create_team(user=self.user1) response = self.client.get(reverse('teams:swimmerList', kwargs={'abbr': team.abbr})) self.assertQuerysetEqual(response.context['swimmer_list'], ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def no_query_found(self):\n return self.searchqueryset.all()", "def filter_queryset(self, _qs):\n if not self.form.is_valid():\n return _qs.none()\n return super().filter_queryset(_qs)", "def test_empty_supplier_review_list_view(self):\n s1 = create_supplier(\"Supplier A\...
[ "0.62167734", "0.5765334", "0.55739975", "0.5573351", "0.55296844", "0.55242777", "0.5494955", "0.5488167", "0.5398552", "0.53702646", "0.53463686", "0.5326403", "0.53211343", "0.5290192", "0.5288167", "0.5267846", "0.5200761", "0.5191597", "0.51699585", "0.5164923", "0.51613...
0.5644462
2
Only .png and .jpg images are valid.
def test_swimmer_form_image_upload(self): with open('/Users/hgridley/Documents/Code/projects/CoachMate/teams/tests/test_files/CFILE01.CL2', 'rb') as f: self.client.login(username='user', password='password') swimmer = test.create_swimmer(self.team) swimmer.set_age() ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def validate_image(value):\n\n valid_extensions = ['png', 'jpg', 'jpeg']\n valid = False\n for ending in valid_extensions:\n if value.name.endswith(ending):\n valid = True\n if value.name == '':\n valid = True\n if not valid:\n raise ValidationError(\n u'Fi...
[ "0.77499145", "0.7440292", "0.7401541", "0.737819", "0.7375332", "0.7315725", "0.73080724", "0.7269488", "0.7128007", "0.71204776", "0.70979255", "0.70636845", "0.7026947", "0.7023552", "0.7017149", "0.70097244", "0.69709456", "0.6953841", "0.6948863", "0.6931903", "0.6875392...
0.0
-1
Initialize frame and components.
def __init__(self, master): super(InputListener, self).__init__(master) master.title("KeyTest") self.keepRunning = True # the frame frame = tkinter.Frame(master, width=300, height=300) frame.configure(bg = "orangered") self.passEvents(frame) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _initialize(self):\n self._frame = ttk.Frame(master=self._root)\n\n self._create_header()\n self._create_footer()\n\n self._frame.grid_columnconfigure(1, weight=1, minsize=250)", "def mainFramesInit(self):\n self._titleFrame.pack(side=DEFAULT_DIRECTION, fill='both')\n ...
[ "0.76615804", "0.7427013", "0.73425525", "0.72121495", "0.7037913", "0.7008554", "0.6903036", "0.68384653", "0.6836797", "0.6835612", "0.6815162", "0.6772632", "0.6743792", "0.67186934", "0.67094123", "0.6707496", "0.6638764", "0.6604728", "0.6601376", "0.6596031", "0.6547178...
0.0
-1
Determines if a valid batch can be produced from the current buffer.
def can_sample(self): return len(self.memory) > self.batch_size
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def buffer_is_valid(self):\n i = 0\n for params in self._group_dict.values():\n for param_dict in params:\n p = param_dict[\"params\"][0]\n data_ptr = self.data_pointers[i]\n grad_ptr = self.grad_pointers[i]\n if (p.data.data_ptr(...
[ "0.7428882", "0.70650494", "0.69397235", "0.67997926", "0.6737576", "0.6663766", "0.66556394", "0.66042674", "0.66023576", "0.6559411", "0.6524484", "0.64408475", "0.6365395", "0.6360433", "0.62925607", "0.62782276", "0.62782276", "0.6242202", "0.6224823", "0.6211486", "0.618...
0.6908686
3
Initialize a RNNReplayBuffer object. The buffer_size determines the number of episodes of experience whic are stored. Each episode may have an arbitrary length. Params ======
def __init__(self, action_size, buffer_size, batch_size, seq_len, seed): self.action_size = action_size self.memory = deque(maxlen=buffer_size) self.memory.append([]) self.batch_size = batch_size self.seq_len = seq_len self.experience = namedtuple("Experience", field_name...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def def_replay_buffer(self): \r\n\r\n self.replay_buffer = tf_uniform_replay_buffer.TFUniformReplayBuffer(\r\n data_spec = self.agent.collect_data_spec,\r\n batch_size = self.train_env.batch_size,\r\n max_length = self.replay_buffer_max_length\r\n )", "def setup_rep...
[ "0.7273948", "0.7089557", "0.70669883", "0.70437574", "0.69483864", "0.69420016", "0.68630594", "0.6606847", "0.66067004", "0.6406538", "0.64013165", "0.6389133", "0.63762045", "0.63614535", "0.6331297", "0.630324", "0.6284739", "0.62771314", "0.62563294", "0.62226546", "0.61...
0.5927444
26
Determines if a valid batch can be produced from the current buffer. Returns True if at least one episode contains enough transitions. True otherwise.
def can_sample(self): for episode in self.memory: if len(episode) >= self.seq_len: return True return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def has_full_next_batch(self):\n return self.current_idx + self.batch_size <= self.count", "def buffer_is_valid(self):\n i = 0\n for params in self._group_dict.values():\n for param_dict in params:\n p = param_dict[\"params\"][0]\n data_ptr = self.dat...
[ "0.7329475", "0.69679356", "0.69105", "0.6806201", "0.6701575", "0.67012584", "0.6599983", "0.65848094", "0.6563047", "0.64175004", "0.63988364", "0.62695915", "0.6236899", "0.620791", "0.62072057", "0.6163994", "0.6112861", "0.60722786", "0.6009797", "0.6001164", "0.59945405...
0.6624145
6
Set up the Matrix bot component.
def setup(hass: HomeAssistant, config: ConfigType) -> bool: config = config[DOMAIN] try: bot = MatrixBot( hass, os.path.join(hass.config.path(), SESSION_FILE), config[CONF_HOMESERVER], config[CONF_VERIFY_SSL], config[CONF_USERNAME], ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setUp(self):\n self.matrix = array(\n [[1, 2, 3, 4], [5, 6, 7, 8], [9, 10, 11, 12], [13, 14, 15, 16]]\n )\n self.cells = [(0, 1), (1, 3)]\n self.cells2 = [(0, 2), (2, 3)]", "def setup(self):\n self.set_players()\n self.board = Board()", "def setup(bot: B...
[ "0.63231456", "0.61794275", "0.6113224", "0.60310364", "0.5914042", "0.5882807", "0.5837465", "0.58369094", "0.5827705", "0.5819802", "0.58036613", "0.57982504", "0.5791944", "0.5781563", "0.5771213", "0.57682097", "0.5755151", "0.5700463", "0.568181", "0.56811", "0.56671864"...
0.59059983
5
Creates and saves a User with the given username, email and password.
def create_user(self, username, email=None, password=None, **extra_fields): email = BaseUserManager.normalize_email(email) user = self.model(username=username, email=email, is_staff=False, is_active=True, is_superuser=False) user.set_password(password) user.save(using=se...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def signup(cls, username, email, password):\n\n hashed_pwd = bcrypt.generate_password_hash(password).decode('UTF-8')\n\n user = User(\n username=username,\n email=email,\n password=hashed_pwd,\n )\n\n db.session.add(user)\n return user", "def cr...
[ "0.8518126", "0.84787375", "0.8407231", "0.84065926", "0.84065926", "0.8399214", "0.83924615", "0.83923566", "0.83923566", "0.83923566", "0.83923566", "0.8347358", "0.8323179", "0.8283871", "0.8281719", "0.8258777", "0.8233607", "0.8226486", "0.8220151", "0.82150054", "0.8206...
0.0
-1
Estimates the expectation value of the given circuit with respect to the operator based on its individual Pauli terms. If the QubitPauliOperator has symbolic values the expectation value will also be symbolic. The input circuit must belong to the default qubit register and have contiguous qubit ordering.
def get_operator_expectation_value( state_circuit: Circuit, operator: QubitPauliOperator, backend: "Backend", n_shots: Optional[int] = None, partition_strat: Optional[PauliPartitionStrat] = None, colour_method: GraphColourMethod = GraphColourMethod.LargestFirst, **kwargs: KwargTypes, ) -> co...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_pauli_expectation_value(\n state_circuit: Circuit,\n pauli: QubitPauliString,\n backend: \"Backend\",\n n_shots: Optional[int] = None,\n) -> complex:\n if not n_shots:\n if not backend.valid_circuit(state_circuit):\n state_circuit = backend.get_compiled_circuit(state_circui...
[ "0.61091155", "0.5926761", "0.5688554", "0.5512709", "0.5388161", "0.5294475", "0.5282216", "0.52455956", "0.5169849", "0.51487494", "0.5133103", "0.5084486", "0.5081324", "0.5019082", "0.5009275", "0.49686873", "0.4862066", "0.48403776", "0.4823138", "0.48197758", "0.4779234...
0.6407966
0
Set up the test environment.
def setUp(self): def _set_required(opts, required): for opt in opts: opt.required = required # Initialize Cinder and avoid checking driver options. rest_required_opts = [ opt for opt in hbsd_rest.REST_VOLUME_OPTS if opt.required] common_required_o...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setUp(self):\n self._setup_config_files()\n self._setup_env()\n self._initialize_forchestrator()", "def setUp(self):\n global g_myEnv\n if not g_myEnv:\n # Setup environment\n params = type('obj', (object,), {'installDir' : resource_filename(\"nupic\", \"\")})\n g_my...
[ "0.8009401", "0.78129977", "0.76823884", "0.756491", "0.75564754", "0.74917865", "0.7489988", "0.7404715", "0.7373485", "0.7372317", "0.73286", "0.7309694", "0.7306211", "0.729289", "0.72863", "0.72863", "0.7260791", "0.72243017", "0.7174563", "0.7171514", "0.71576375", "0....
0.0
-1
Retrieve a configuration value avoiding throwing an exception.
def _fake_safe_get(self, value): try: val = getattr(self.configuration, value) except AttributeError: val = None return val
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __getValue(self , config , key , default = None):\n try:\n return config[key]\n except KeyError:\n return default", "def get_value(self, key):\n\n value = self.data[\"config\"][key]\n if value is None:\n print (\"The key '%s' does not exist in th...
[ "0.73299694", "0.72198415", "0.7191237", "0.71122384", "0.7025395", "0.69098866", "0.6904722", "0.6899984", "0.6877334", "0.686537", "0.68390954", "0.6746714", "0.67446977", "0.6721382", "0.6704163", "0.666446", "0.66621906", "0.6576559", "0.6560148", "0.65373814", "0.6535188...
0.7781865
0
Convert time in this format hhmm into minutes passed sind 0000 0830>510 1345>825
def time_to_min(time): minutes = time%100 hours = time//100 return hours*60+minutes
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_minutes(hours, minutes):\n return hours * 60 + minutes", "def time_to_hour_minute_second(time):\n\treturn str(time)[8:14]", "def time2minute( turn, timetable ):\n Depart, Arrival = timetable.split()\n hDepart, mDepart = [ int(e) for e in Depart.split(\":\") ]\n hArrival, mArrival = [ int(...
[ "0.750792", "0.744741", "0.69760644", "0.695678", "0.682803", "0.6823841", "0.6690987", "0.6683041", "0.6678748", "0.6671157", "0.6660773", "0.66555834", "0.66411424", "0.6618059", "0.6591266", "0.65606546", "0.6531855", "0.65224683", "0.65163916", "0.65008426", "0.6462337", ...
0.64678335
20
Convert from minutes to time, opposite to time_to_min
def min_to_time(mins): assert mins < 1441 minutes = mins%60 hours = mins//60 return hours*100+minutes
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def time_to_min(time):\n minutes = time%100\n hours = time//100\n return hours*60+minutes", "def to_minutes(hours, minutes):\n return hours * 60 + minutes", "def seconds_to_minutes(self):\n\n unmasked_seconds = 1 - ma.getmaskarray(self.times[..., 5])\n unmasked_minutes = 1 - ma.getmas...
[ "0.7464451", "0.7170402", "0.6938571", "0.6681983", "0.6680028", "0.6544714", "0.64729846", "0.6457575", "0.64070123", "0.6393299", "0.6377487", "0.6343281", "0.6319228", "0.63024354", "0.6298576", "0.62966263", "0.62957704", "0.6292631", "0.62874895", "0.6281602", "0.627596"...
0.7616792
0
Return spesific placemark's real and fixed demand from database.
def get_demands(placemark_id): demand_types = ['demand', 'fixed_demand'] redis_key = ":".join(('placemark', str(placemark_id), 'polygon')) demands = dict.fromkeys(demand_types) # Get demands from db. for demand_type in demand_types: temp_redis_key = ":".join((redis_key, demand_type)) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def place_text(self):\n place_dict = {\n 1: \"1st\",\n 2: \"2nd\",\n 3: \"3rd\",\n }\n if self.place <= 3:\n return place_dict[self.place]\n else:\n return \"%dth\" % self.place", "def get_description(self):\n\n if self.cou...
[ "0.56200975", "0.52485204", "0.5199902", "0.51861227", "0.5117533", "0.5074268", "0.50308573", "0.49706587", "0.49342868", "0.49339113", "0.49024233", "0.48980176", "0.48838443", "0.48770437", "0.48659924", "0.4852503", "0.48456928", "0.48339173", "0.48216793", "0.48133275", ...
0.5262573
1
Calculate nth weekday of a month. For each element of the period index `pi` take the month when this element begins. Starting from this point go to the Mth month (number M is given by `month`) and find the Nth `weekday` within that month (number N is given by `week`). If `shift` is specified, shift the result by the co...
def nth_weekday_of_month(pi, month, week, weekday, shift=None, **kwargs): # TODO: (Prio: LOW) Optimize performance # Creating model timeline '3-DoW-per-M' (compound workshifts on daily frame # with marks on 3 weekdays per month) takes ~1 sec for 100 years, # ~1,8 sec for 278 years. # Counting per wo...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def weekday(year, month, day):\n a = (14 - month) / 12\n a = int(a)\n y = year - a\n m = month + 12 * a - 2\n week = (day + y + int(y / 4) - int(y / 100) + int(y / 400) + int((31 * m) / 12)) % 7;\n week = week + 1\n sinWeek = (1 + np.sin(((week - 1) / 7) * (2 * np.pi))) * 0.5\n return [week...
[ "0.58458114", "0.57179075", "0.5155311", "0.5131709", "0.5029148", "0.49386674", "0.49330306", "0.48725897", "0.48718777", "0.4856353", "0.4790938", "0.4755812", "0.4744775", "0.47391737", "0.4729297", "0.46612975", "0.46606553", "0.4542364", "0.45139194", "0.44996828", "0.44...
0.8102593
0
Returns the classes of the model
def classes_(self): return self.clf.classes_
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_classes(self):\n return self.classes", "def all_models():\n return list(_MODEL_CLASSES)", "def get_model_detection_classes(self):\n return self.detection_graph.get_tensor_by_name('detection_classes:0')", "def classes(self):\n return self._classes", "def classes(self):\n ret...
[ "0.7855982", "0.77928025", "0.769301", "0.7540428", "0.751015", "0.7454768", "0.7377282", "0.73226964", "0.727877", "0.7266292", "0.7195624", "0.7123238", "0.7071831", "0.70486736", "0.70291644", "0.70291483", "0.70289886", "0.70146537", "0.7007973", "0.6903333", "0.688514", ...
0.71858823
11
Returns ``True`` if at least one item in the list is checked.
def get_selected(self) -> bool: selected = False for item in self.children: if item.selected: selected = True break return selected
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def allItemsChecked(self):\n return len(self.ChecklistItems.Query(ChecklistItem.status != self.TypeDefinition.rating_state)) == 0", "def any(items):\n return any(items)", "def has_items(self):\n return len(list(self)) > 0", "def isEmpty(self):\n return (self.items == [])", "def isEm...
[ "0.702521", "0.6739426", "0.66533905", "0.661681", "0.65797365", "0.6571084", "0.65159345", "0.6482775", "0.6471116", "0.6455305", "0.6455305", "0.6419745", "0.6419745", "0.6356066", "0.6341674", "0.6325097", "0.62839615", "0.6246384", "0.6214294", "0.6180273", "0.6174147", ...
0.0
-1
Returns True if self equals other, or False otherwise.
def __eq__(self, other): if self is other: return True if type(self) != type(other): return False # Courses could be retaken to get better grade. However no 2 classes w/ same # term-subject-course_number should ever be taken in the same term. if self.term != other.ter...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _eq(self, other):\n return True", "def __eq__(self, other):\n return self._data() == other", "def __eq__(self, other):\n\n return self.value() == other.value()", "def __eq__(self, other):\n\n return self.__check_and_execute(other, \"==\")", "def __eq__(self, other):\n ...
[ "0.8674256", "0.8623069", "0.86197275", "0.8597576", "0.8539695", "0.8538231", "0.85362875", "0.8509379", "0.85024935", "0.84812593", "0.84812593", "0.8456041", "0.8451685", "0.8445286", "0.8431373", "0.8424591", "0.84028536", "0.8398579", "0.83815163", "0.83724254", "0.83639...
0.0
-1
Get the path for persistent domain configuration storage
def get_xend_domains_path(self): return self.get_config_string("xend-domains-path", self.xend_domains_path_default)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getPersistentPath():\n raise NotImplementedError", "def get_xend_storage_path(self):\n return self.get_config_string(\"xend-storage-path\", self.xend_storage_path_default)", "def configpath(self):\n # the answer is in my store\n return self['pyre.configpath']", "def _GetConfig...
[ "0.7520068", "0.73172307", "0.70057994", "0.6906911", "0.67368734", "0.67224723", "0.67224723", "0.67221725", "0.67213005", "0.66210395", "0.64137197", "0.6388781", "0.63877165", "0.63853085", "0.63853085", "0.63848126", "0.637656", "0.6371449", "0.6371449", "0.6371449", "0.6...
0.6350791
29
Get the path for persistent domain configuration storage
def get_xend_state_path(self): return self.get_config_string("xend-state-path", self.xend_state_path_default)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getPersistentPath():\n raise NotImplementedError", "def get_xend_storage_path(self):\n return self.get_config_string(\"xend-storage-path\", self.xend_storage_path_default)", "def configpath(self):\n # the answer is in my store\n return self['pyre.configpath']", "def _GetConfig...
[ "0.7520068", "0.73172307", "0.70057994", "0.6906911", "0.67368734", "0.67224723", "0.67224723", "0.67221725", "0.67213005", "0.66210395", "0.64137197", "0.6388781", "0.63877165", "0.63853085", "0.63853085", "0.63848126", "0.637656", "0.6371449", "0.6371449", "0.6371449", "0.6...
0.0
-1
Get the path for persistent domain configuration storage
def get_xend_storage_path(self): return self.get_config_string("xend-storage-path", self.xend_storage_path_default)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getPersistentPath():\n raise NotImplementedError", "def configpath(self):\n # the answer is in my store\n return self['pyre.configpath']", "def _GetConfigPath():\n return '/etc/mongod.conf'", "def get_config_path(self):\n return self.config_path", "def config_file_path(self...
[ "0.75183296", "0.7007218", "0.6908632", "0.67392075", "0.67241997", "0.67241997", "0.6723898", "0.67230266", "0.66198987", "0.6414282", "0.6387764", "0.63861597", "0.63837475", "0.63837475", "0.6383258", "0.6375774", "0.6373676", "0.6373676", "0.6373676", "0.6373676", "0.6373...
0.73151845
1
Get the path for security state
def get_xend_security_path(self): return self.get_config_string("xend-security-path", self.xend_security_path_default)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_path(self):\n\t\treturn self.path", "def get_path(self):\n return self.path", "def get_path(self):\n return self.path", "def path(self) -> str:\n return pulumi.get(self, \"path\")", "def path(self) -> str:\n return pulumi.get(self, \"path\")", "def path(self) -> str:\n...
[ "0.67980945", "0.66863877", "0.66863877", "0.6627687", "0.6627687", "0.6627687", "0.6627687", "0.6627687", "0.6627687", "0.6627687", "0.6627687", "0.6627687", "0.6627687", "0.6627687", "0.6627687", "0.6627687", "0.6627687", "0.6627687", "0.6627687", "0.6627687", "0.6620833", ...
0.6866403
0
Get the XenAPI server configuration.
def get_xen_api_server(self): return self.get_config_value('xen-api-server', self.xen_api_server_default)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get():\n response = None\n try:\n response = app.config['API_CONF']\n except Exception:\n abort(http_codes.SERVER_ERROR, \"Erreur interne lors de la récupération de la configuration\")\n\n return _success(response)", "def getServerConfiguration(self):\n ...
[ "0.68675244", "0.6792767", "0.65966165", "0.659156", "0.65380836", "0.651062", "0.6485216", "0.6472955", "0.63871783", "0.6376421", "0.62866765", "0.62383115", "0.61579317", "0.615028", "0.61323327", "0.61063665", "0.6102086", "0.6089028", "0.60878795", "0.60769236", "0.60707...
0.82012093
0
Get the Xen Security Module name.
def get_xsm_module_name(self): return self.get_config_string('xsm_module_name', self.xsm_module_default)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def module_name(self):\n return self._unique_name", "def name(self):\n return self._snmp_data.get('sys_name')", "def module_name(self) -> str:\n return utils.to_snake_case(self.name)", "def name(cls):\n return MODULE_NAME", "def module_name(self):\n return self._config['m...
[ "0.646718", "0.6431569", "0.63955796", "0.6388835", "0.6354228", "0.6347493", "0.6318994", "0.6257039", "0.6169458", "0.6103479", "0.6084709", "0.60817146", "0.6014114", "0.5989956", "0.5964706", "0.593951", "0.59253347", "0.58748937", "0.5835916", "0.5777234", "0.57539016", ...
0.71168905
0
Returns Date Now at time of coputation, local time, Gregorian callendar, as a date tuple.
def nowdate(): return datetime.datetime.now().timetuple()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_today() -> tuple:\n today = datetime.datetime.now(pytz.timezone(\"America/New_York\")).strftime(\n \"%Y-%m-%d\"\n )\n today_split = today.split(\"-\")\n year = today_split[0]\n month = today_split[1]\n day = today_split[2]\n\n return today, year, month, day", "def now_tuple():...
[ "0.7078522", "0.68381935", "0.6650415", "0.6628075", "0.6548387", "0.65312773", "0.64490294", "0.63925815", "0.63735837", "0.6349912", "0.62972957", "0.62810636", "0.6272761", "0.61448514", "0.6113596", "0.60960317", "0.6087875", "0.60601294", "0.60282445", "0.6019678", "0.60...
0.6927049
1
Test that removing the training data and rebuilding it succeeds.
def test_messageRetraining(self): self.testMessageTraining() self.df.forgetTraining()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_droughts():\n test_path = tempfile.mkdtemp()\n x_train, metadata = droughts(test_path)\n try:\n assert x_train.shape == (2042, 2)\n except:\n shutil.rmtree(test_path)\n raise()", "def resetTest():\n # remove artifacts from past tests, if they exist\n shutil.rmtree(benign_path, ignore_...
[ "0.6882385", "0.6736018", "0.67341644", "0.6558815", "0.6542194", "0.64827204", "0.64399296", "0.6408099", "0.6329924", "0.6295455", "0.6244634", "0.6243714", "0.624027", "0.6223501", "0.6221711", "0.621639", "0.61925733", "0.6191267", "0.61502326", "0.61434376", "0.6133167",...
0.73887724
0
pad each sequence(context and response) to the same length
def pad(context_list, response_list, word2idx, max_turn=hp.max_turn, max_uttr_len=hp.max_uttr_len): if not(len(context_list) and len(response_list)): Log.info("invalid data: context_size = {:d}, response_size = {:d}".format(len(context_list), len(response_list))) return None, None, None, None, None ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _pad_to_length(self, sequence, path):\n left_pad = sequence[0]\n if self.sequence_length is not None:\n while len(sequence) < self.sequence_length:\n sequence.insert(0, left_pad)\n return sequence", "def _pad_seq(self, seq):\n padded_seq = []\n if len(seq)...
[ "0.63835114", "0.63751286", "0.62926286", "0.62428707", "0.61758375", "0.6098399", "0.6088084", "0.6076915", "0.6048508", "0.6039091", "0.6009401", "0.5996526", "0.598826", "0.5986497", "0.598638", "0.59853786", "0.597845", "0.59107125", "0.58955216", "0.58875686", "0.5880055...
0.64426017
0
Get user This endpoint get single user details.
def get_user(user_id): response_object = { 'status': 'fail', 'msg': 'User does not exist', 'data': {}, } try: UUID(user_id, version=4) except ValueError: # If it's a value error, then the string # is not a valid hex code for a UUID. return response...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_user(self):\n return self.client.get(self.get_url)", "def get_user():\n res = user.details()\n if res.ok:\n return res.json()\n\n return res.text, res.status_code", "def get(self):\n user = get_logged_in_user(request)\n if not user:\n api.abort(403)\n ...
[ "0.85673755", "0.82443196", "0.81903696", "0.8118671", "0.8038048", "0.7997435", "0.7989545", "0.79250777", "0.79249114", "0.7913806", "0.7898135", "0.7890695", "0.7881272", "0.7879316", "0.7861043", "0.7814537", "0.7807455", "0.7793944", "0.77760375", "0.77242696", "0.771799...
0.0
-1
given a die coordinates, make a list containing all of the legal coordinates for the next die
def possible_moves(self, die: Tuple): lst = [(die[0] + 1, die[1]), (die[0] + 1, die[1] + 1), (die[0] + 1, die[1] - 1), (die[0] - 1, die[1]), (die[0] - 1, die[1] - 1), (die[0] - 1, die[1] + 1), (die[0], die[1] + 1), (die[0], die[1] - 1), (die[0], die[1])] ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_district_coordinates():\n return list(product(range(5), repeat=2))", "def create_coordinates(self):\n\n # Defines multiple variables, lists and dictionaries.\n random_list = self.create_list_house()\n coordinates = []\n valid_set = {}\n original_length = len(random_l...
[ "0.6769149", "0.6258716", "0.60799253", "0.60205567", "0.598441", "0.59190625", "0.58540154", "0.5822906", "0.57652736", "0.57195365", "0.5697402", "0.56862134", "0.5684139", "0.5668266", "0.5660503", "0.56458056", "0.5604616", "0.5537829", "0.5526451", "0.5522871", "0.549999...
0.65610707
1
Build sampler for data loader.
def build_sampler(sampler_cfg, dataset, batch_size, shuffle=True, dist=True, seed=1): if sampler_cfg is not None: sampler = sampler_cfg['type'] if dist and 'Distributed' not in sampler: sampler_cfg[...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setup_sampler(self):\n pass", "def build_dataloader(root, params):\n dataset = HARdataset(root)\n\n length = dataset.length\n\n train_sampler, val_sampler = dataset.split_ind(val_split=params[\"split\"],\n shuffle=True)\n #print(train_sampl...
[ "0.69873226", "0.6794938", "0.6757683", "0.6722265", "0.6684458", "0.66147083", "0.6608222", "0.6546116", "0.6531382", "0.6405787", "0.6384965", "0.6331411", "0.63312906", "0.63251036", "0.6293028", "0.62848055", "0.62534255", "0.6221611", "0.6220013", "0.6219214", "0.6148579...
0.66505206
5
Returns an iterator that simultaneously returns batches from each dataset. Specifically, it returns batches of [(B_0, 0), (B_1, 1), ..., (B_k, k)] from datasets (D_0, ..., D_k),
def __iter__(self): return zip_batches( *[ zip(iter(l), repeat(loader_num)) for loader_num, l in enumerate(self.loaders) ], use_all=self.use_all, )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def make_batches(dataset, batch_size):\n for i in range(0, len(dataset), batch_size):\n yield dataset[i:i + batch_size]", "def iter_batches(self, dataset, batch_size):\n # TODO batch_size = -1 should yield the entire dataset\n num_batches = int(dataset.num_images / batch_size)\n fo...
[ "0.7625739", "0.7456107", "0.73090494", "0.72511506", "0.71472627", "0.71472627", "0.7116253", "0.70996153", "0.7082358", "0.7073325", "0.69965655", "0.6994046", "0.69604975", "0.6948114", "0.6945745", "0.69457245", "0.69247276", "0.69188994", "0.69095665", "0.68965185", "0.6...
0.0
-1
Return string from integer day.
def day_str(day): return str(day) if day >= 10 else '0' + str(day)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_formatted_day(date):\n return date.strftime(\"%y%m%d\")", "def day_name(num):\n if num == 0:\n return \"Sunday\"\n if num == 1:\n return \"Monday\"\n if num == 2:\n return \"Tuesday\"\n if num == 3:\n return \"Wednesday\"\n if num == 4:\n return \"Thur...
[ "0.73217165", "0.7320032", "0.71002364", "0.7027302", "0.702363", "0.69343126", "0.69295514", "0.69247884", "0.681787", "0.6780096", "0.6627719", "0.6593381", "0.6570594", "0.6544553", "0.65426064", "0.6510888", "0.6480031", "0.64760995", "0.6471417", "0.64640653", "0.6444332...
0.84579986
0
The input sample should already be preprocessed and we assume the image is a tensor
def draw_bounding_box(image, bbox, save_path): # if the image is a Float tensor type.. img = copy.deepcopy(image) img = img.numpy() img = img.transpose((1,2,0)) image = Image.fromarray(img) bbox = copy.copy(bbox) bbox = bbox.cpu().detach().numpy() draw = ImageDraw.Draw(image)...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __call__(self, sample, context=None):\n\n samples = sample\n batch_input = True\n if not isinstance(samples, Sequence):\n batch_input = False\n samples = [samples]\n for sample in samples:\n im = sample['image']\n if not isinstance(im, np....
[ "0.6967352", "0.68840134", "0.67845875", "0.67451096", "0.6732757", "0.66876507", "0.66813856", "0.66765356", "0.664801", "0.6634024", "0.66243744", "0.6570976", "0.6567161", "0.65587026", "0.6551778", "0.6541916", "0.6536608", "0.65036553", "0.6500855", "0.6486735", "0.64794...
0.0
-1
Page slug should only contain characters defined in
def testRFC3986Characters(self): test_page = Page( title="New Page", slug="a/A/1/./~/-/_", created_by=self.editor, modified_by=self.editor, ) try: test_page.full_clean() except ValidationError as e: self.fail(str(e))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _SlugCheck(slug, allow=''):\n if not slug == CleanText(unicode(slug),\n banned=(CleanText.NONDNS.replace(allow, ''))\n ).clean:\n raise ValueError(_('Invalid URL slug: %s') % slug)\n return slug.lower()", "def slug(self) -> str:\n ti...
[ "0.7379282", "0.7297361", "0.71670574", "0.7086802", "0.70222706", "0.6974022", "0.68817157", "0.6872772", "0.68138397", "0.6731799", "0.6661586", "0.6633459", "0.6541159", "0.6538491", "0.6486787", "0.647297", "0.6431843", "0.64251035", "0.6407542", "0.637038", "0.6366979", ...
0.5895249
54
Create a new user with encrypted password and return it
def create(self, validated_data): # **validated_data passes all JSON from the http POST to create user # return get_user_model().objects.create_user(**validated_data)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_user(username, password):\n new_user = User(username, password)\n return new_user", "def create_user(self, **kwargs):\n kwargs['password'] = encrypt_password(kwargs.pop('password'))\n user = self.user_model(**self._prepare_create_user_args(**kwargs))\n\n return self.put(user...
[ "0.81364167", "0.80482763", "0.79459125", "0.7938326", "0.79248244", "0.7886925", "0.7853959", "0.7847127", "0.7815487", "0.77890974", "0.77809185", "0.775996", "0.77534", "0.775254", "0.76776963", "0.76422167", "0.76201755", "0.7608958", "0.7595769", "0.75903577", "0.7579728...
0.0
-1
Creates MobilenetEdgeTPUV2 ModelConfig based on tuning parameters.
def mobilenet_edgetpu_v2_base( width_coefficient: float = 1.0, depth_coefficient: float = 1.0, stem_base_filters: int = 64, stem_kernel_size: int = 5, top_base_filters: int = 1280, group_base_size: int = 64, dropout_rate: float = 0.2, drop_connect_rate: float = 0.1, filter_size_overr...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mobilenet_edgetpu_v2_tiny() -> ModelConfig:\n stem_base_filters = 32\n stem_kernel_size = 5\n top_base_filters = 1280\n filter_sizes = [16, 32, 48, 80, 112, 160, 192]\n filter_size_overrides = {\n k: v for (k, v) in zip(range(len(filter_sizes)), filter_sizes)\n }\n block_op_overrides = {\n 2: ...
[ "0.70175457", "0.68658745", "0.6347283", "0.61927235", "0.60151106", "0.58902055", "0.5857662", "0.58488894", "0.57905996", "0.5785542", "0.57739264", "0.5764907", "0.57541555", "0.5648986", "0.56410843", "0.56114906", "0.5609222", "0.5598828", "0.5572019", "0.5568656", "0.55...
0.60833335
4
Round number of filters based on width coefficient.
def round_filters(filters: int, config: ModelConfig) -> int: width_coefficient = config.width_coefficient min_depth = config.min_depth divisor = config.depth_divisor orig_filters = filters if not width_coefficient: return filters filters *= width_coefficient min_depth = min_depth o...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def round_filters(filters,\n config):\n width_coefficient = config.width_coefficient\n min_depth = divisor = 8\n orig_filters = filters\n\n if not width_coefficient:\n return filters\n\n filters *= width_coefficient\n min_depth = min_depth or divisor\n new_filters = max(min_depth, int(fi...
[ "0.80200917", "0.79520774", "0.79368365", "0.790443", "0.78554845", "0.78323996", "0.7790349", "0.7738434", "0.6992489", "0.6160635", "0.6097962", "0.60272264", "0.6008903", "0.593725", "0.5759182", "0.5749993", "0.57117367", "0.5707148", "0.5701069", "0.5694127", "0.56756335...
0.7969592
1
A conv2d followed by batch norm and an activation.
def conv2d_block_as_layers( conv_filters: Optional[int], config: ModelConfig, kernel_size: Any = (1, 1), strides: Any = (1, 1), use_batch_norm: bool = True, use_bias: bool = False, activation: Any = None, depthwise: bool = False, kernel_initializer: InitializerType = None, name: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def batch_norm_conv2d(inputs, is_training, bn_decay, scope, reuse=None):\n return batch_norm_template(inputs, is_training, scope, [0, 1, 2], bn_decay,\n reuse=reuse)", "def _add_conv_block(self):\n # conv2d -> batch norm -> relu\n block = nn.Sequential(\n ...
[ "0.7445615", "0.6710668", "0.67095935", "0.65665865", "0.65285033", "0.6527303", "0.65136474", "0.6508533", "0.65058434", "0.6469193", "0.64395285", "0.6439019", "0.6433951", "0.6433951", "0.6432999", "0.64325273", "0.63917077", "0.6382217", "0.6379321", "0.63690984", "0.6365...
0.0
-1
Transform dict to class instance with attribute access.
def dotize(data): data = dotdict(data) for k, v in data.items(): if isinstance(v, dict): data[k] = dotdict(v) return data
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def from_dict(cls, dict_):\n obj = cls.__new__(cls)\n obj.__dict__.update(dict_)\n return obj", "def dict_to_obj(dict):\n obj=object.__new__(dict[\"__class__\"])\n obj.__dict__.update(dict)\n return obj", "def create_from_dict(cls, dic):\n bar = cls()\n b...
[ "0.72134936", "0.7045572", "0.7005743", "0.7000639", "0.686664", "0.6831771", "0.6831771", "0.6831771", "0.6831771", "0.6831771", "0.6831771", "0.6831771", "0.6831771", "0.6831771", "0.6831771", "0.6831771", "0.6831771", "0.6831771", "0.6831771", "0.6831771", "0.6831771", "...
0.0
-1
returns the first element of the linked list (without removing it) element of the first node
def get_first(self): return self.head.element
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def first(self):\r\n if self.head is not None:\r\n return self.head.elem\r\n return None", "def first(self):\n if self.is_empty():\n raise ValueError('List is empty')\n return self._head._element", "def first(self):\n if self.is_empty():\n ret...
[ "0.83016294", "0.8085021", "0.7796199", "0.7626267", "0.7562178", "0.75580066", "0.7516371", "0.74776417", "0.7419002", "0.739233", "0.7360119", "0.7320803", "0.7286997", "0.72863626", "0.72498614", "0.723823", "0.723387", "0.71942466", "0.7144122", "0.7130354", "0.7092403", ...
0.7554182
6