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
Download the COCO dataset/annotations if requested.
def auto_download(self, dataDir, dataType, dataYear): # Setup paths and file names if dataType == "minival" or dataType == "valminusminival": imgDir = "{}/{}{}".format(dataDir, "val", dataYear) imgZipFile = "{}/{}{}.zip".format(dataDir, "val", dataYear) imgURL = "htt...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def download_coco_dataset():\n # Create file structure\n os.makedirs(os.path.join(\"data\", \"coco\", \"train\"), exist_ok=True)\n os.makedirs(os.path.join(\"data\", \"coco\", \"dev\"), exist_ok=True)\n os.makedirs(os.path.join(\"data\", \"coco\", \"test\"), exist_ok=True)\n # Download the train, de...
[ "0.72907704", "0.71969664", "0.64465344", "0.633483", "0.61967856", "0.61923695", "0.59949607", "0.59754235", "0.5947754", "0.5928412", "0.5897793", "0.5720691", "0.5706716", "0.56930333", "0.56358683", "0.5610616", "0.5585786", "0.55818254", "0.553139", "0.55226374", "0.5510...
0.51952803
50
Load instance masks for the given image. Different datasets use different ways to store masks. This function converts the different mask format to one format in the form of a bitmap [height, width, instances].
def load_mask(self, image_id): # If not a COCO image, delegate to parent class. image_info = self.image_info[image_id] if image_info["source"] != "coco": return super(ExtendedCocoDataset, self).load_mask(image_id, common.COCO_NUM_CLASSES) # NOTE: this calls ActivityDataset.load_mask(...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_mask(self, image_id):\n info = self.image_info[image_id]\n # Get mask directory from image path\n mask_dir = os.path.join(os.path.dirname(os.path.dirname(info['path'])), \"masks\")\n\n # Read mask files from .png image\n mask = []\n # for f in next(os.walk(mask_di...
[ "0.75807637", "0.75707793", "0.7464837", "0.74508286", "0.73990464", "0.7395329", "0.73903126", "0.733224", "0.72805625", "0.72684896", "0.72458494", "0.7228455", "0.7193414", "0.71730536", "0.7096771", "0.70429015", "0.69910985", "0.688985", "0.6886687", "0.6880056", "0.6802...
0.6600161
30
Updates this store's current state with incoming data from the network. data should be a mapping containing 'metacontacts', 'order', and 'info' structures (see comment at top of file)
def update_data(self, data): rebuild = False # This method needs to substitute some defaultdicts for the normal # dictionaries that come back from the server. # Metacontact information #if data['metacontacts'] mc_dict = data.get('metacontacts', {}) if...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def on_state_notification(self, data):\n\n self.channel_data.update(data)\n\n # synchronize DataManager data with processed update & entity data\n self.sync_data_update_ha()", "def update(self, data):\n logging.info('update state', data)\n self._client.update_state(data)\n\n ...
[ "0.6476063", "0.62110347", "0.61491877", "0.6079043", "0.6079043", "0.6079043", "0.6079043", "0.60150313", "0.59856397", "0.592851", "0.5848428", "0.58295083", "0.58125436", "0.579534", "0.5732395", "0.5716034", "0.56988144", "0.5688092", "0.5683766", "0.5636451", "0.5636451"...
0.70325893
0
Get the front element.
def peek(self): return self.queue[0]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getFront(self):\n\t\tfront = self.queue[self.front]\n\t\treturn front\n\t\tpass", "def getFront(self):\n if not self.isEmpty():\n return self._data[0]\n else:\n return -1", "def front(self):\n return self.queue[0] if not self.empty() else None", "def peek_front(...
[ "0.82009244", "0.79261875", "0.7852642", "0.7791182", "0.77886623", "0.75723046", "0.752337", "0.7510604", "0.7478953", "0.7379256", "0.7379256", "0.734284", "0.7323573", "0.7320296", "0.7291721", "0.72772557", "0.7269801", "0.72657627", "0.7253295", "0.72355044", "0.72213495...
0.66313344
60
Returns whether the queue is empty.
def empty(self): return self.queue == []
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_empty(self):\n return len(self.the_queue) == 0", "def is_empty(self):\n return len(self.__queue) > 0", "def is_empty(self):\n return len(self.queue) == 0", "def is_empty(self):\n return len(self.queue) == 0", "def is_empty(self):\n return self.queue == []", "def ...
[ "0.9270249", "0.92506766", "0.923635", "0.923635", "0.9155843", "0.9098441", "0.9095006", "0.90922606", "0.90731245", "0.9053733", "0.89205354", "0.89137155", "0.8877591", "0.88436323", "0.88436323", "0.88038146", "0.8758203", "0.87577534", "0.87310195", "0.86462456", "0.8628...
0.8835949
15
Get the last code indentation index tracked as reference.
def GetIfIndex(self): return self.indentindex[-1]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def last_index(self) -> int:\n return self._last_index", "def indentation_level(self):\n return self._indentation_levels[-1]", "def last_sequence_ind(self,):\n return self.last_sequence_ind_", "def _get_last_code_line():\n return max(_code_lines) + 2", "def get_last_index(self):\n ...
[ "0.6989419", "0.68731844", "0.67984694", "0.65894204", "0.64901143", "0.64773256", "0.63904345", "0.6377186", "0.6306196", "0.6305273", "0.62961644", "0.62961644", "0.62961644", "0.62961644", "0.62961644", "0.62961644", "0.6286268", "0.62604773", "0.6259666", "0.61679256", "0...
0.66052157
3
Ensure that kafka actions are not overwritten in the IAM definition
def test_kafka_action_names_overlap_issue(self): # Kafka actions used to be in two pages but are now one. This verifies the current state. # results = get_actions_for_service("kafka") # print(results) actions = [ "kafka:BatchAssociateScramSecret", "kafka:BatchDisa...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def legal_actions(self):\n raise NotImplementedError", "def get_actions(self, request):\n actions = super().get_actions(request)\n if not settings.PUBLISHER_CODE:\n del actions['create_cwr']\n if 'delete_selected' in actions:\n del actions['delete_selected']\n ...
[ "0.57733667", "0.5674129", "0.5623118", "0.55654687", "0.54859173", "0.5416407", "0.53971905", "0.5386766", "0.5313959", "0.5262459", "0.52369434", "0.5227309", "0.5218352", "0.5207143", "0.51959413", "0.51855755", "0.5174657", "0.51633334", "0.51326454", "0.51265115", "0.506...
0.67827463
0
View function that handles inserting new/editing previously existing comments via Ajax
def post_comment(request, send_signal=True): # Based on variables passed in we get the comment the user is attempting to create/edit try: comment, previous_version = get_comment(request) except InvalidCommentException as e: transaction.rollback() return JsonResponse({ 'ok...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save_comments():\n potential_deal_id = int(request.form.get(\"id\"))\n action = request.form.get(\"action\")\n if action.lower() == \"none\":\n action = None\n comments = request.form.get(\"comments\")\n db_handler = DBHandler()\n db_handler.update_by_id(potential_deal_id, action, comm...
[ "0.67972344", "0.6647041", "0.663194", "0.66208017", "0.65695584", "0.6565645", "0.6551287", "0.65155035", "0.6482362", "0.6476776", "0.6422695", "0.6392417", "0.6366266", "0.6361407", "0.63019305", "0.6271926", "0.6269781", "0.6195616", "0.61950845", "0.61534417", "0.6148189...
0.6193762
19
Returns the output tensor at the given index.
def get_output_tensor(self, index): output_details = self.interpreter.get_output_details()[index] tensor = np.squeeze(self.interpreter.get_tensor(output_details['index'])) return tensor
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_output_tensor(index):\n output_details = interpreter.get_output_details()[index]\n tensor = np.squeeze(interpreter.get_tensor(output_details['index']))\n return tensor", "def get_output_tensor(self, index):\n output_details = self.model.get_output_details()[index]\n tensor = np.squ...
[ "0.88110566", "0.8773681", "0.86581725", "0.8473132", "0.8446493", "0.8446493", "0.8446493", "0.75534517", "0.7171569", "0.68134344", "0.6715133", "0.6542007", "0.65397805", "0.65058136", "0.6436549", "0.6430624", "0.63161963", "0.6215072", "0.6104049", "0.6095873", "0.608248...
0.87153566
2
returns True if employee has rejoined otherwise False
def is_rejoinee(self): return len(self._start_date) > 1
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_employee():\n return _is_member('uw_employee')", "def is_expired(self):\n expiration_date = datetime.timedelta(days=settings.ACCOUNT_ACTIVATION_DAYS)\n return (self.date_joined + expiration_date <= datetime.datetime.now())", "def is_expired(self):\n expiration_date = datetime.tim...
[ "0.6680365", "0.587085", "0.58500487", "0.57760894", "0.5741819", "0.57230127", "0.56929135", "0.56781346", "0.56605685", "0.5577466", "0.55369276", "0.5530934", "0.55146056", "0.55014586", "0.54542553", "0.5392969", "0.5388207", "0.53847474", "0.5377452", "0.53713554", "0.53...
0.61320335
1
Return a string for the |cmd| list w/reasonable quoting.
def cmdstr(cmd): if isinstance(cmd, str): return cmd quoted = [] for arg in cmd: if isinstance(arg, Path): arg = str(arg) if ' ' in arg: arg = '"%s"' % (arg,) quoted.append(arg) return ' '.join(quoted)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cmdify(self):\n return \" \".join(\n itertools.chain(\n [_quote_if_contains(self.command, r\"[\\s^()]\")],\n (_quote_if_contains(arg, r\"[\\s^]\") for arg in self.args),\n )\n )", "def command_list_to_str(command):\n return \" \".join(pipes...
[ "0.7206458", "0.7059188", "0.6501883", "0.6480349", "0.6454796", "0.6273626", "0.6229917", "0.620037", "0.61765164", "0.6134786", "0.610084", "0.6098873", "0.60828114", "0.6048522", "0.6045765", "0.602606", "0.6023066", "0.6018371", "0.5999344", "0.59954375", "0.59915906", ...
0.67177594
2
Align trigger on display (> 0 is right of center, < 0 is left of center)
def hpos(self, offset_sec = None): if offset_sec is not None: if not isinstance(offset_sec, (int, float)): raise TypeError('delay_sec must be numeric value') self.command(f'SET Horizontal Offset of Trigger {-offset_sec} sec {"LEFT" if offset_sec < 0 else "RIGHT"} of cent...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def center(self):\n if self.pos != 0.0:\n self.pos = 0.0", "def center_ava(self):\n\t\tself.rect.midbottom = self.screen_rect.midbottom\n\t\tself.x = float(self.rect.x)", "def center(self):\n cp = self.dat.flowsheet.getCenter()\n self.centerOn(cp[0], cp[1])", "def centerAxis()...
[ "0.61338747", "0.60391134", "0.5984671", "0.5806344", "0.57887024", "0.57887024", "0.57887024", "0.57887024", "0.5788586", "0.5779757", "0.5755072", "0.5707836", "0.57064337", "0.57064337", "0.5662579", "0.5656464", "0.5644351", "0.5622311", "0.5614773", "0.5609005", "0.56051...
0.0
-1
Return current sample rate in Sa/s
def sample_rate(self): return self.query_float('ENTER Current Sample Rate (Sa/s)')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sample_rate(self):\r\n return self.config.sample_rate", "def sample_rate(self):\n return self._sample_rate", "def sample_rate(self):\n return self._sample_rate", "def sample_rate(self):\n return self._sample_rate", "def sample_rate(self, sr=None):\n return self._sample_ra...
[ "0.81212515", "0.8000023", "0.8000023", "0.7969299", "0.7864392", "0.7847092", "0.782177", "0.7783444", "0.7727639", "0.76789045", "0.763086", "0.74798954", "0.7479725", "0.7386037", "0.7357198", "0.73316765", "0.7272404", "0.72663385", "0.7222648", "0.70849174", "0.6931208",...
0.86877906
0
The constructor for Particle Class
def __init__(self, position=np.array([0,0,0], dtype=float), velocity=np.array([0,0,0], dtype=float), acceleration=np.array([0,0,0], dtype=float), name='A Particle', restMass=1.0, charge=const.elementary_charge): self.name = name self.position = np.array(position, dtype=float) self.vel...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, particles):\n self.particles = particles", "def __init__(self,particle):\n self.par = particle", "def particle(self) -> Particle:\n return Particle()", "def particle(self) -> Particle:\n return Particle()", "def __init__(self, init_pos_1, init_pos_2, M_1, M_2,...
[ "0.846487", "0.8411835", "0.7966551", "0.7966551", "0.7707181", "0.76299787", "0.74913836", "0.7429638", "0.73224574", "0.72718245", "0.7198867", "0.699789", "0.6965769", "0.6918702", "0.6917369", "0.68837965", "0.68785137", "0.68018293", "0.67048806", "0.6683209", "0.6675657...
0.7450836
7
Method that returns the Lorentz Factor of the particle.
def LorentzFactor(self): # Use of abs() and x ** 0.5 provides a more stable calculation of lorentz # factor than math.sqrt() at high velocities. return 1 / abs( 1 - Particle.BetaVelocity(self) * Particle.BetaVelocity(self))**0.5
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def L(self) -> float:\n return self._L", "def Lorentz(x, x0, A, B, d):\n return B + A / (((x - x0) / d) ** 2 + 1)", "def lorentz(x, gamma):\n return 1 / cs.pi * 0.5 * gamma / ((0.5 * gamma**2) + x**2)", "def relu(z: float) -> float:\n return z if z > 0 else 0.01 * z", "def lorentz(x, x0...
[ "0.65476906", "0.65036815", "0.6469627", "0.638012", "0.6348522", "0.6347106", "0.6341828", "0.6334289", "0.6333599", "0.63280964", "0.62715966", "0.62416214", "0.6189796", "0.61773413", "0.61520237", "0.6139124", "0.6098995", "0.60558134", "0.60534275", "0.5988797", "0.59480...
0.8493009
0
Method that returns the total energy of the particle
def TotalEnergy(self): return (math.sqrt((Particle.RestEnergy(self) ** 2) + (np.linalg.norm(Particle.Momentum(self)) * const.speed_of_light) ** 2))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def energy(self):\n energy = -0.5*np.sum(self.phi)+0.5*np.sum(self.mass*np.sqrt(self.particles.momentum[:,0]**2+self.particles.momentum[:,1]**2)**2)\n return energy", "def calcEnergy(self):\n speed_light = constants.physical_constants[\"speed of light in vacuum\"][0]#m/sec by default\n if sel...
[ "0.84132123", "0.8266951", "0.7991302", "0.7920243", "0.7864987", "0.7718018", "0.76988596", "0.76899403", "0.76686484", "0.76565665", "0.76121676", "0.7568719", "0.7546202", "0.75326943", "0.75047314", "0.7501236", "0.74609464", "0.7411283", "0.7411283", "0.74109715", "0.738...
0.821929
2
Plots the extraction region.
def show_rgn(ax, rgn, **kwargs): alpha = 0.1 #lw = 0.1 if rgn['shape'] == 'box': ax.plot([rgn['params']['blcx']]*2, [rgn['params']['blcy'],rgn['params']['trcy']], 'r-', **kwargs) ax.plot([rgn['params']['blcx'],rgn['params']['trcx']], [rgn['params...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def plot(self):\n pass", "def plot(self):\n\t\tself.plotOfXray().plot()", "def show(self):\n \n \n \n \n \n \n r = 4\n f, axarr = plt.subplots(r, r, figsize=(8,8))\n counter = 0\n for i in range(r):\n for j in range(r):\n ...
[ "0.64836633", "0.63798314", "0.63485694", "0.63415164", "0.62981063", "0.6228685", "0.6214679", "0.61689097", "0.6165796", "0.61613774", "0.611915", "0.60805905", "0.60388714", "0.6032662", "0.6006002", "0.5967216", "0.5963205", "0.59328747", "0.5918682", "0.59050053", "0.589...
0.0
-1
Splits text from digits in a string.
def split_str(str): logger = logging.getLogger(__name__) logger.debug('{0}'.format(str)) match = re.match(r"([0-9]+.?\d{0,32}?)(d|m|s)", str) if match: items = match.groups() return items[0], items[1]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def split_str_digit(s):\n res = []\n for m in re.finditer('(\\d*)(\\D*)', s):\n for g in m.groups():\n if g != '':\n try:\n res.append(int(g))\n except ValueError:\n res.append(g)\n return tuple(res)", "def split_num(s...
[ "0.69932103", "0.69409627", "0.6516405", "0.6497158", "0.6497158", "0.6333978", "0.62500066", "0.62345093", "0.6181007", "0.61332566", "0.6114605", "0.60910285", "0.6013863", "0.59716225", "0.59670913", "0.59426206", "0.59077483", "0.5873073", "0.58616483", "0.58398443", "0.5...
0.6069437
12
Get the current status of the pool.
def get_pool_status(self, mission): # initialize node status states = dict( idle=0, rebooting=0, reimaging=0, running=0, unusable=0, creating=0, starting=0, waiting_for_start_task=0, start_task_failed=0, unknown=0, leaving_pool=0, offline=0, preempted=0) # i...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_pool_status():\n pools_status = split_status_pools(fork_and_get_output(\"zpool status\".split()))\n pools = []\n for p in pools_status:\n pools.append(status.PoolStatus(p))\n return pools", "def status(self):\n self._refresh_state()\n return self._data.get('status')", "...
[ "0.75640756", "0.7310082", "0.73063296", "0.7286715", "0.7214205", "0.7214205", "0.7214205", "0.72092366", "0.71747327", "0.71360385", "0.7126846", "0.71214384", "0.7102766", "0.7091428", "0.70774436", "0.70774436", "0.7071764", "0.70652586", "0.70541", "0.70418775", "0.70287...
0.71968305
8
Get a string for the status of the storage container.
def get_storage_container_overview_string(self, mission): status = self.get_storage_container_status(mission) s = "Storage container status: {}".format(status) return s
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def container_status(self) -> str:\n return pulumi.get(self, \"container_status\")", "def storage_bytes_status(self) -> str:\n return pulumi.get(self, \"storage_bytes_status\")", "def status(self) -> str:\n return pulumi.get(self, \"status\")", "def status(self) -> str:\n return p...
[ "0.8081375", "0.7568696", "0.72568953", "0.72568953", "0.72568953", "0.72568953", "0.72568953", "0.72568953", "0.72568953", "0.72568953", "0.72568953", "0.72568953", "0.72568953", "0.72568953", "0.72568953", "0.72568953", "0.72568953", "0.72568953", "0.72568953", "0.72568953", ...
0.7668451
1
Shows a simple scatterplot of X, colored by the classes in y. Technically, this shows the 1st three principal components of X if X has more than 3 dimensions. If X only has 2 dimensions, then just a 2dimensional scatterplot is returned. This will not produce a plot for 1 dimensional data.
def plot_data(X, y): x_dim = X.shape[1] # Ignore 1 dimensional data if x_dim == 1: print("plot_data not gonna bother with 1 dimensional data") return # For 2 dimensional data, just plot it if x_dim == 2: plt.scatter(X[:,0], X[:,1], c=y) plt.show() return ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def scatter_plot(self):\n\n X = self.reduce_dimension(n_components=2)\n\n plt.figure()\n plt.scatter(X[:,0], X[:,1])\n\n return plt", "def plot_dataset(X, classes):\n data = pd.DataFrame(X, columns=['x', 'y'])\n data['dataset'] = classes\n sns.lmplot('x', 'y', data=data, hue=...
[ "0.68430007", "0.66364133", "0.6596344", "0.6580677", "0.65084815", "0.645392", "0.6410972", "0.6298724", "0.6219223", "0.621192", "0.61827666", "0.61542743", "0.6125981", "0.60232717", "0.59843695", "0.590425", "0.59014237", "0.5894517", "0.58731264", "0.58717024", "0.586803...
0.7091436
0
This function tokenizes the input text and performs necessary cleaning.
def tokenize(text): url_regex = 'http[s]?://(?:[a-zA-Z]|[0-9]|[$-_@.&+]|[!*\(\),]|(?:%[0-9a-fA-F][0-9a-fA-F]))+' detected_urls = re.findall(url_regex, text) for url in detected_urls: text = text.replace(url, "urlplaceholder") tokens = word_tokenize(text) lemmatizer = WordNetLemmatizer() ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def clean_text(text):\n global cleaned_text\n # remove numbers\n text_nonum = re.sub(r'\\d+', '', text)\n # remove punctuations and convert characters to lower case\n text_nopunct = \"\".join([char.lower() for char in text_nonum if char not in string.punctuation]) \n # sub...
[ "0.75570065", "0.7090177", "0.7041805", "0.7033546", "0.6981678", "0.696288", "0.6919464", "0.691603", "0.6914198", "0.6900118", "0.6900118", "0.6900118", "0.6900118", "0.6900118", "0.6900118", "0.68975586", "0.6874092", "0.6874056", "0.6841664", "0.6819344", "0.6789257", "...
0.0
-1
Get current date and time string.
def now_short(_format="%Y%m%d-%H%M%S"): return time.strftime(_format, time.localtime()) + "\t"
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_current_datetime_string ( ) :\n return get_current_datetime( ).strftime( \"%Y%m%d-%H%M%S\" )", "def get_current_time():\n return time.strftime(\"%Y-%m-%d-%H-%M-%S\", time.localtime())", "def get_now():\r\n now = dt.datetime.now()\r\n now_str = now.strftime(\"%d/%m %H:%M\")\r\n return now_...
[ "0.8746683", "0.8295901", "0.8274269", "0.8213029", "0.81925744", "0.81858903", "0.8185167", "0.81688607", "0.80856556", "0.8042373", "0.7992371", "0.78575885", "0.7848898", "0.78472054", "0.78358054", "0.779838", "0.7789519", "0.77884716", "0.77856934", "0.7751212", "0.77394...
0.0
-1
Number of days left.
def ssl_valid_time_remaining(domainname): expires = ssl_expiry_date(domainname) return expires - datetime.datetime.utcnow().date()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_number_days(self):\r\n return 1", "def elapsed_days(self) -> int:\n return (datetime.today() - self.release_datetime).days", "def remaining_days_in_current_period(self):\n try:\n return self.count_days_from_now(self.current_period_ends_at)\n except AttributeError:...
[ "0.7505091", "0.7279096", "0.7158447", "0.71100044", "0.7087657", "0.70665115", "0.7026382", "0.7017739", "0.6946899", "0.69389665", "0.6917387", "0.6910316", "0.6885656", "0.68470883", "0.6816302", "0.6804258", "0.6734145", "0.670508", "0.6679895", "0.6673183", "0.66385496",...
0.0
-1
In the initialization of the blanc canvas the number of rows and columns can be defined, finally the canvas is placed into the parent frame.
def __init__(self, parent, rows=1, columns=1, set_grid_propagate=False, *args, **kwargs): super().__init__(parent, highlightthickness=0, *args, **kwargs) self.grid_propagate(set_grid_propagate) self.set_num_of_rows(rows) self.set_num_of_columns(columns) self.grid...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setup_canvas(self):\n # create frame to contain canvas\n self.world_container = tk.Frame(self,\n width = self.world_size[1],\n height = self.world_size[0])\n self.world_container.grid(row = 1, column = 0, sticky ...
[ "0.7390701", "0.7325227", "0.7284718", "0.7152517", "0.7130581", "0.7130581", "0.7130581", "0.70996016", "0.6822051", "0.6757563", "0.67494226", "0.66495013", "0.66449696", "0.6612262", "0.66097903", "0.65810424", "0.6549738", "0.6528398", "0.6521471", "0.64550036", "0.644386...
0.6334319
26
Checks whether the given ISBN10 code is valid. >>> isISBN10('9971502100') True >>> isISBN10('9971502108') False
def isISBN10(code): # helper function for computing ISBN-10 check digit def check_digit(code): # compute check digit check = sum((i + 1) * int(code[i]) for i in range(9)) % 11 # convert check digit into its string representation return 'X' if check == 10 else str(check) #...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def isISBN(code):\n if not (\n isinstance(code, str) and # code must be a string\n len(code) == 10 and # code must contain 10 characters\n code[:9].isdigit() # first nine characters must be digits\n ):\n return False\n\n # check the check digit\n return check...
[ "0.82796675", "0.8265154", "0.7875872", "0.76414096", "0.7556362", "0.734542", "0.73319346", "0.72045577", "0.7138764", "0.7138109", "0.704493", "0.64504737", "0.6407236", "0.6328351", "0.63012135", "0.6227752", "0.6151876", "0.60880727", "0.60821617", "0.60790056", "0.601290...
0.8820598
0
>>> isISBN('9789027439642', False) False >>> isISBN('9789027439642', True) True >>> isISBN('9789027439642') True >>> isISBN('080442957X') False >>> isISBN('080442957X', False) True
def isISBN(code, isbn13=True): return isISBN13(code) if isbn13 else isISBN10(code)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_isbn(val):\n if is_isbn10(val) or is_isbn13(val):\n if val[0:3] in [\"978\", \"979\"] or not is_ean13(val):\n return True\n return False", "def isISBN(code):\n if not (\n isinstance(code, str) and # code must be a string\n len(code) == 10 and # code must co...
[ "0.7865637", "0.7720685", "0.7428631", "0.7180673", "0.71515095", "0.7052291", "0.68789357", "0.6845327", "0.6841594", "0.6841162", "0.6837004", "0.6813746", "0.68048567", "0.675236", "0.66869426", "0.6474136", "0.64726096", "0.64508146", "0.640185", "0.6327851", "0.621259", ...
0.7591935
2
>>> codes = ['0012345678', '0012345679', '9971502100', '080442957X', 5, True, 'The Practice of Computing Using Python', '9789027439642', '5486948320146'] >>> areISBN(codes) [False, True, True, True, False, False, False, True, False] >>> areISBN(codes, True) [False, False, False, False, False, False, False, True, False]...
def areISBN(codes, isbn13=None): # initialize list of checks checks = [] # construct list of checks for code in codes: if isinstance(code, str): if isbn13 is None: checks.append(isISBN(code, len(code) == 13)) else: checks.append(isISBN(...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_isbn(val):\n if is_isbn10(val) or is_isbn13(val):\n if val[0:3] in [\"978\", \"979\"] or not is_ean13(val):\n return True\n return False", "def isISBN(code, isbn13=True):\n\n return isISBN13(code) if isbn13 else isISBN10(code)", "def isISBN(code):\n if not (\n isinst...
[ "0.74519074", "0.72815156", "0.7090671", "0.65742284", "0.65578085", "0.6463269", "0.63166803", "0.6275632", "0.6265059", "0.62025166", "0.6028817", "0.59755796", "0.58285195", "0.5798127", "0.5781443", "0.5775947", "0.570381", "0.563113", "0.5504642", "0.54982454", "0.548243...
0.8204821
0
Calculates a one's complement integer from the given input value's bits
def ones_complement(x, bits=16): return x ^ ((1 << bits) - 1)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ones_complement(val):\n #mask = (1 << val.bit_length()) - 1\n #return int(hex(val ^ mask), 16)\n b = bin(val)\n b = b.replace('0', 'x')\n b = b.replace('1', '0')\n b = b.replace('x', '1')\n b = b.replace('1b', '0b')\n return int(b, 2)", "def complement(...
[ "0.80567867", "0.7861335", "0.75720483", "0.7485613", "0.7387961", "0.73278314", "0.7293334", "0.70973384", "0.6932238", "0.6895889", "0.68579566", "0.6638871", "0.663495", "0.66179526", "0.6587711", "0.6580346", "0.6573302", "0.6573302", "0.6572931", "0.6572931", "0.6572931"...
0.75856197
2
Clears the prefix dictionary, this needs to be done before creating a new typecode for a message (ie. before, and after creating a new message typecode)
def _resetPrefixDict(self): self._getPrefixDict().clear()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reset(self):\n self.footnotes = OrderedDict()\n self.unique_prefix += 1", "def remove_prefix(self, state_dict, prefix):\n print('remove prefix \\'{}\\''.format(prefix))\n f = lambda x: x.split(prefix, 1)[-1] if x.startswith(prefix) else x # 去除带有prefix的名字\n return {f(key): ...
[ "0.661214", "0.6500577", "0.6333235", "0.60439557", "0.6028406", "0.60041296", "0.5998321", "0.59930265", "0.59643847", "0.59600914", "0.59294903", "0.5922057", "0.5883665", "0.5853302", "0.58453923", "0.5836675", "0.5826535", "0.5804847", "0.5762894", "0.5750483", "0.5747566...
0.8281239
0
Visit assignment node with at least one compound target.
def visit_compound_assign(self, node): # Determine number of values (arity) of compound assignment. nvalues = { len(target.elts) for target in node.targets if is_sequence_node(target) } if len(nvalues) > 1: # A multiple, compound assignment with different arities...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def visit_Assign(self, node):\n self.generic_visit(node)\n is_multiple = len(node.targets) > 1\n is_compound = any(map(is_sequence_node, node.targets))\n is_simple = not is_compound\n if is_simple and is_multiple:\n return self.visit_simple_assign(node)\n elif i...
[ "0.7261902", "0.6757224", "0.64843816", "0.63659924", "0.624103", "0.62127984", "0.6177989", "0.61282015", "0.60786444", "0.604624", "0.60448", "0.5942896", "0.59183824", "0.5750465", "0.57303625", "0.5648947", "0.55960566", "0.5571266", "0.5543112", "0.5511169", "0.5493238",...
0.7176904
1
Returns a Python value contained in this atomic element.
def value(self): return toml2py.deserialize(self._tokens[self._value_token_index()])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getvalue(self):\n return BytesIO.getvalue(self)", "def value(self):\n\n\t\treturn self.__value", "def value(self):\n return self._read()", "def value(self) -> Any:\n return self._value", "def value(self):\n return self.__value", "def value(self):\n return self.__val...
[ "0.75496817", "0.7389974", "0.7359954", "0.7347043", "0.733962", "0.733962", "0.7327104", "0.7327104", "0.7303945", "0.7303945", "0.7303945", "0.7290579", "0.7290579", "0.7290579", "0.7290579", "0.7290579", "0.7290579", "0.7290579", "0.7290579", "0.7290579", "0.7290579", "0...
0.68537635
87
Returns an interator of sentences being read from disk.
def get_sentences(self, batch=None): # loop through the paragraph stream for this document database for paragraph in self.get_paragraphs(batch): # loop through the sentences for sentence in paragraph["sentences"]: # yield the individual tokens yield sentence["tokens"]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_sentences(path):\n sentences = []\n sentence = []\n num = 0\n with codecs.open(path, 'r', 'utf8') as fread:\n # n_lines = len(fread)\n print(\"Read from {:s}\".format(path))\n # pbar = progressbar.ProgressBar(max_value=n_lines)\n for line_idx, line in enumerate(frea...
[ "0.691375", "0.6559297", "0.6529974", "0.647818", "0.64719594", "0.6423339", "0.6421859", "0.640695", "0.63902426", "0.63782775", "0.6366519", "0.630013", "0.62926716", "0.61867374", "0.6146142", "0.60801035", "0.60796994", "0.6057292", "0.60563534", "0.605594", "0.605538", ...
0.5305037
78
Returns the ``BatchStats`` for a specific batch.
def get_batch_stats(self, batch): return self.batch_stats[batch]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def build_batch_stats():\n\n # We use the moving mean as an estimate of the mean in order to perform\n # a more numerically stable calculation of the batch mean.\n # Copy for better stability.\n shift = tf.add(self._moving_mean, 0)\n counts, shifted_sum_x, shifted_sum_x2, _ = tf.nn.suffici...
[ "0.65609884", "0.65114206", "0.65014577", "0.6211535", "0.59668744", "0.5954246", "0.58340657", "0.5821755", "0.57448745", "0.57334435", "0.57184416", "0.5670613", "0.56242794", "0.560072", "0.55778915", "0.5565209", "0.55386823", "0.5498818", "0.54651314", "0.5450578", "0.54...
0.89985496
0
Return a usable Boto object without creating a class around it. In the context of a krux.cli (or similar) interface the 'args', 'logger' and 'stats' objects should already be present. If you don't have them, however, we'll attempt to provide usable ones for the boto setup. (If you omit the add_boto_cli_arguments() call...
def get_boto(args=None, logger=None, stats=None): return Boto(**__get_arguments(args, logger, stats))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_boto3(args=None, logger=None, stats=None):\n return Boto3(**__get_arguments(args, logger, stats))", "def __get_arguments(args=None, logger=None, stats=None):\n\n if not args:\n parser = get_parser()\n add_boto_cli_arguments(parser)\n # Parse only the known arguments added by ad...
[ "0.7120333", "0.6446755", "0.53901947", "0.53732514", "0.5315737", "0.5265874", "0.5252197", "0.522644", "0.5211605", "0.521066", "0.5205573", "0.51422757", "0.5054793", "0.5037921", "0.5032993", "0.50301266", "0.49558958", "0.49513885", "0.49364442", "0.491438", "0.49119216"...
0.81121886
0
cleans data by lowers cases and removing accentuated chars then extracts word tokens of at least 2 chars
def cleanData(s): # extract only word tokens of at least 2 chars re.compile(r"\b\w\w + \b", re.U).findall(s) # xml_dict = {';': '', '&lt': '<', '&amp': '&', '&gt': '>', '&quot': '"', # '&apos': '\''} # for key, value in xml_dict.iteritems(): # s = s.replace(key, value) s.tr...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def processes_and_tokenize(raw_document):\n\ttokenizer = RegexpTokenizer(r'\\w+')\n\ttokens = tokenizer.tokenize(raw_document.lower())\t\t# tokens = nltk.word_tokenize(corpus.lower()) # without removing punctiation\n\n\t#remove stop words\n\tstop_words = set(nltk.corpus.stopwords.words('english'))\n\t#stop_words =...
[ "0.6861259", "0.6852118", "0.67767626", "0.6744147", "0.67203104", "0.6711012", "0.6704925", "0.66891634", "0.66849273", "0.6602998", "0.6546478", "0.65269834", "0.65201867", "0.65182596", "0.64966595", "0.6496125", "0.64865", "0.6471367", "0.6440876", "0.64231676", "0.640726...
0.60811347
61
Construct and return an empty network model.
def empty_network(network_id=NETWORK_ID): return make_net_model({"id": network_id, "subnets": [], "ports": [], "tenant_id": "calico", "mtu": neutron_constants.DEFAULT_NETWORK_MTU})
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_model():\n\n class Net(nn.Cell):\n def construct(self, x, y):\n return x\n\n net = Net()\n model_simple = Model(net)\n\n return model_simple", "def create_network(self):\n\n print ('Creating network, changing data will have no effect beyond this point.')\n n...
[ "0.703458", "0.6730677", "0.6650045", "0.66165984", "0.65974486", "0.65902346", "0.6558993", "0.645672", "0.6456341", "0.6397473", "0.6397053", "0.63881767", "0.6345971", "0.6332582", "0.63210064", "0.62721264", "0.62575936", "0.6252461", "0.62491995", "0.6246717", "0.6237882...
0.749267
0
Construct and return a copy of an existing network model.
def copy_network(source_net): return make_net_model({"id": source_net.id, "subnets": source_net.subnets, "ports": source_net.ports, "tenant_id": source_net.tenant_id, "mtu": source_net.mtu})
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def copy(self):\n new_model = Model(\n name=self.name,\n functions=copy.deepcopy(self.functions),\n domain=self.domain.copy(),\n density=self.density.copy(),\n )\n new_model.update()\n\n return new_model", "def clone(self):\n return _...
[ "0.7690615", "0.7457661", "0.7384238", "0.7347668", "0.69865394", "0.6961353", "0.6951828", "0.6855561", "0.6832441", "0.6813686", "0.6811424", "0.6808021", "0.66637117", "0.66387904", "0.66021425", "0.6570278", "0.65329057", "0.65179616", "0.6502068", "0.64940655", "0.644854...
0.68326706
8
Get data for the specified subnet.
def get_subnet(self, subnet_id): LOG.debug("Get subnet %s", subnet_id) if subnet_id not in self.subnets_by_id: return None data = self.subnets_by_id[subnet_id] LOG.debug("Subnet data: %s", data) # Convert to form expected by NetModel. ip_version = 6 if ':' ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show_subnet(self, subnet, **_params):\r\n return self.get(self.subnet_path % (subnet), params=_params)", "def get_subnet_details(self, subnet_name=\"dummy_subnet\", subnet_id=None):\n _url = \"http://\" + self.host_ip + \":9696/v2.0/subnets\"\n _headers = {'x-auth-token': self.project_in...
[ "0.65944624", "0.6546326", "0.64507025", "0.61743736", "0.6011078", "0.6010956", "0.58433086", "0.58370644", "0.57784945", "0.57641536", "0.5734289", "0.57341164", "0.5653118", "0.56335646", "0.556625", "0.556153", "0.5557205", "0.54509723", "0.54425985", "0.5385783", "0.5367...
0.6255019
3
>>> isinstance(lab8_q3(), str) True
def lab8_q3(): return """ YOUR EXPLANATION HERE """
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _is_string(data):\n return len(data) and isinstance(_to_ndarray(data).flat[0], str)", "def _is_string(arg):\n return isinstance(arg, types.StringTypes)", "def is_str ( self, s ):\r\n\t\treturn isinstance ( s, type( str () ) )", "def test_is_str_rep_string(self):\n self.assertIsInstance(cardu...
[ "0.69046277", "0.66528326", "0.6531326", "0.6531229", "0.6520508", "0.6515218", "0.6508465", "0.6506103", "0.64962703", "0.64860326", "0.647134", "0.6461159", "0.64014983", "0.636057", "0.6318982", "0.63128656", "0.6281687", "0.6279039", "0.626913", "0.6251587", "0.6250445", ...
0.0
-1
>>> isinstance(lab9_q3(), str) True
def lab9_q3(): return """ YOUR EXPLANATION HERE """
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_str(x):\n return isinstance(x, str)", "def test_is_str_rep_string(self):\n self.assertIsInstance(cardutils.Card(10,1).__str__(), str)", "def isString(x):\n if type(x) == str:\n return True\n else:\n return False", "def _is_string(data):\n return len(data) and isinstanc...
[ "0.67149335", "0.66803926", "0.66799915", "0.66795844", "0.6666466", "0.6657703", "0.662522", "0.6536551", "0.64925563", "0.6467223", "0.64577836", "0.64136744", "0.64020425", "0.6394686", "0.63700676", "0.63617307", "0.63562024", "0.6313202", "0.62957275", "0.6292955", "0.62...
0.0
-1
>>> isinstance(lab10_q3(), str) True
def lab10_q2(): return """ Make a 'total' to add up the total revenue as while loop plays. item = qvm.dispense, makes it so item is the juice. While item: because if there is a juice this while loop will continue. If there aren't two fruits, there wont be a juice so while loop stops. total += qvm.collect_mo...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_is_str_rep_string(self):\n self.assertIsInstance(cardutils.Card(10,1).__str__(), str)", "def is_str(x):\n return isinstance(x, str)", "def isString(x):\n if type(x) == str:\n return True\n else:\n return False", "def is_str ( self, s ):\r\n\t\treturn isinstance ( s, typ...
[ "0.6767156", "0.662008", "0.65915257", "0.65897584", "0.6570212", "0.6540568", "0.6512019", "0.6466866", "0.6387287", "0.6369226", "0.634048", "0.6340179", "0.6338254", "0.633478", "0.6307848", "0.6269958", "0.6269275", "0.6240808", "0.6229523", "0.62286043", "0.62249273", ...
0.0
-1
If an iteriter_op is given an iterator as input, no exception should be thrown, and we should return the wrapped function's output.
def test_iteriter_op_1(): @ops.iteriter_op def f(x): return iter([4, 5, 6]) result = f(iter([1, 2, 3])) # Passing in an iterator, as expected assert(isinstance(result, collections.abc.Iterator)), f"{result}" assert(list(result) == [4, 5, 6])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_iteriter_op_3():\n\n @ops.iteriter_op\n def f(x):\n return [4, 5, 6] # Returning a list instead of an iterator\n\n with pytest.raises(ValueError):\n result = f(iter([1, 2, 3]))", "def test_iteriter_op_2():\n\n @ops.iteriter_op\n def f(x):\n return iter([4, 5, 6])\n\n...
[ "0.734651", "0.7288327", "0.6928596", "0.6799886", "0.66857606", "0.6591529", "0.6551025", "0.6511721", "0.63353145", "0.59754914", "0.5973058", "0.59268594", "0.5852119", "0.58467436", "0.5843037", "0.583689", "0.57858115", "0.5740564", "0.5712443", "0.56730723", "0.5633042"...
0.74068475
0
If an iteriter_op returns something besides an iterator as output, raise a ValueError.
def test_iteriter_op_3(): @ops.iteriter_op def f(x): return [4, 5, 6] # Returning a list instead of an iterator with pytest.raises(ValueError): result = f(iter([1, 2, 3]))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_iteriter_op_2():\n\n @ops.iteriter_op\n def f(x):\n return iter([4, 5, 6])\n\n with pytest.raises(ValueError):\n f([1, 2, 3]) # Passing in a list instead of an iterator", "def test_listiter_op_2():\n\n @ops.listiter_op\n def f(x):\n return iter([4, 5, 6])\n\n with...
[ "0.76426315", "0.73116994", "0.7197692", "0.69156325", "0.6845044", "0.6789451", "0.63753885", "0.6361283", "0.62555766", "0.6095181", "0.6085253", "0.59735376", "0.5929287", "0.5857033", "0.58470154", "0.58267", "0.57885355", "0.57856303", "0.57807213", "0.576038", "0.573720...
0.7515847
1
If a listlist_op is given something besides a list as input, raise a ValueError.
def test_listlist_op_2(): @ops.listlist_op def f(x): return [4, 5, 6] with pytest.raises(ValueError): f(iter([1, 2, 3])) # Passing in an iterator instead of an list
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_listlist_op_3():\n\n @ops.listlist_op\n def f(x):\n return iter([4, 5, 6]) # Returning an iterator instead of an list\n\n with pytest.raises(ValueError):\n result = f([1, 2, 3])", "def is_listing(op):\n return isinstance(op, (list, tuple))", "def test_neg_operate_list_invalid_...
[ "0.6896146", "0.6843723", "0.6687192", "0.66674805", "0.6584861", "0.650589", "0.64047855", "0.6385669", "0.6318132", "0.62996775", "0.6293289", "0.62533414", "0.6251247", "0.62425464", "0.62239265", "0.62199765", "0.6166311", "0.61608076", "0.6119108", "0.6056942", "0.600924...
0.71428686
0
If a listiter_op is given something besides a list as input, raise a ValueError.
def test_listiter_op_2(): @ops.listiter_op def f(x): return iter([4, 5, 6]) with pytest.raises(ValueError): f(iter([1, 2, 3])) # Passing in an iterator instead of a list
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_listlist_op_2():\n\n @ops.listlist_op\n def f(x):\n return [4, 5, 6]\n\n with pytest.raises(ValueError):\n f(iter([1, 2, 3])) # Passing in an iterator instead of an list", "def test_iterlist_op_2():\n\n @ops.iterlist_op\n def f(x):\n return [4, 5, 6]\n\n with pyte...
[ "0.76405627", "0.7451966", "0.7407579", "0.73711157", "0.7272287", "0.6842472", "0.67784035", "0.6713179", "0.65655285", "0.6331", "0.62677497", "0.62505025", "0.6126729", "0.6060513", "0.60524344", "0.60413057", "0.5994478", "0.5923151", "0.5910163", "0.5815476", "0.5803793"...
0.75528175
1
If a listiter_op returns something besides an iterator as output, raise a ValueError.
def test_listiter_op_3(): @ops.listiter_op def f(x): return [4, 5, 6] # Returning a list instead of an iterator with pytest.raises(ValueError): result = f([1, 2, 3])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_listiter_op_2():\n\n @ops.listiter_op\n def f(x):\n return iter([4, 5, 6])\n\n with pytest.raises(ValueError):\n f(iter([1, 2, 3])) # Passing in an iterator instead of a list", "def test_iterlist_op_3():\n\n @ops.iterlist_op\n def f(x):\n return iter([4, 5, 6]) # Re...
[ "0.800803", "0.7905361", "0.77610767", "0.77083707", "0.77032125", "0.75699127", "0.7554352", "0.70976245", "0.70190036", "0.67172563", "0.6027455", "0.58875996", "0.5732145", "0.57207274", "0.57120436", "0.57120436", "0.5675813", "0.5638414", "0.5630779", "0.5580102", "0.555...
0.77557844
3
If an iterlist_op is given an iterator as input, no exception should be thrown, and we should return the wrapped function's output.
def test_iterlist_op_1(): @ops.iterlist_op def f(x): return [4, 5, 6] result = f(iter([1, 2, 3])) # Passing in an iterator, as expected assert(isinstance(result, list)), f"{result}" assert(result == [4, 5, 6])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_listiter_op_2():\n\n @ops.listiter_op\n def f(x):\n return iter([4, 5, 6])\n\n with pytest.raises(ValueError):\n f(iter([1, 2, 3])) # Passing in an iterator instead of a list", "def test_listiter_op_1():\n\n @ops.listiter_op\n def f(x):\n return iter([4, 5, 6])\n\n ...
[ "0.76466507", "0.76008874", "0.7570353", "0.7508546", "0.74234086", "0.7396815", "0.7382202", "0.73407215", "0.7291801", "0.72297966", "0.6824224", "0.666192", "0.6128793", "0.60040385", "0.5923186", "0.58794075", "0.58676404", "0.57020146", "0.56718487", "0.5595165", "0.5567...
0.76173055
1
If an iterlist_op is given something besides an iterator as input, raise a ValueError.
def test_iterlist_op_2(): @ops.iterlist_op def f(x): return [4, 5, 6] with pytest.raises(ValueError): f([1, 2, 3]) # Passing in a list instead of an iterator
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_listiter_op_2():\n\n @ops.listiter_op\n def f(x):\n return iter([4, 5, 6])\n\n with pytest.raises(ValueError):\n f(iter([1, 2, 3])) # Passing in an iterator instead of a list", "def test_iterlist_op_3():\n\n @ops.iterlist_op\n def f(x):\n return iter([4, 5, 6]) # Re...
[ "0.78835404", "0.7705365", "0.7613191", "0.7498913", "0.7423901", "0.74038625", "0.73198646", "0.67817676", "0.6730599", "0.6505109", "0.5887717", "0.5857515", "0.58052135", "0.5753452", "0.5708452", "0.5689192", "0.56823623", "0.5681861", "0.56544685", "0.56081665", "0.56028...
0.7661832
2
If an iterlist_op returns something besides a list as output, raise a ValueError.
def test_iterlist_op_3(): @ops.iterlist_op def f(x): return iter([4, 5, 6]) # Returning an iterator instead of a list with pytest.raises(ValueError): result = f(iter([1, 2, 3]))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_listlist_op_2():\n\n @ops.listlist_op\n def f(x):\n return [4, 5, 6]\n\n with pytest.raises(ValueError):\n f(iter([1, 2, 3])) # Passing in an iterator instead of an list", "def test_listlist_op_3():\n\n @ops.listlist_op\n def f(x):\n return iter([4, 5, 6]) # Returni...
[ "0.77509636", "0.76935655", "0.76132554", "0.7517712", "0.7484861", "0.7235555", "0.70362914", "0.7030836", "0.6869668", "0.66613793", "0.6354757", "0.630842", "0.6297937", "0.61403257", "0.60431194", "0.6029395", "0.6019079", "0.6019079", "0.59903765", "0.5965533", "0.595312...
0.75992316
3
Constant evaluation should ignore the existing fitness function and set the fitness of all individuals to the same value.
def test_const_evaluate(): pop = test_population pop = ops.const_evaluate(pop, value=123456789.0) for ind in pop: assert(pytest.approx(123456789.0) == ind.fitness)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _recompute_fitness(self):\n for cur in self.population:\n if cur['fitness'] is None:\n cur['fitness'] = self.op.fitness(cur['individual'])", "def fitness(self):\n pass", "def evaluate(self, fitness):\n self.fitness = fitness(self.phenotype)", "def fitness_sh...
[ "0.74931896", "0.7079468", "0.69477665", "0.6825639", "0.67214495", "0.6705714", "0.6655073", "0.6554352", "0.6519272", "0.6481715", "0.6447769", "0.62911665", "0.61991894", "0.6193287", "0.6174193", "0.6151497", "0.6150842", "0.6150842", "0.610781", "0.60786945", "0.607092",...
0.6333001
11
Builds an projection block as described in Deep Residual Learning for Image Recognition (2015) You can assume the input data will have shape (224, 224, 3) All convolutions inside and outside the blocks should be followed by batch normalization along the channels axis and a rectified linear activation (ReLU), respective...
def resnet50(): initializer = K.initializers.he_normal(seed=None) X = K.Input(shape=(224, 224, 3)) # conv1 layer = K.layers.Conv2D(filters=64, kernel_size=(7, 7), strides=(2, 2), padding='same', ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _building_block_v1(inputs, filters, training, projection_shortcut, strides,\n data_format):\n shortcut = inputs\n\n if projection_shortcut is not None:\n shortcut = projection_shortcut(inputs)\n shortcut = batch_norm(inputs=shortcut, training=training,\n d...
[ "0.6879483", "0.6712965", "0.6681837", "0.6617764", "0.65615404", "0.65488005", "0.6432119", "0.64201134", "0.6342974", "0.6342974", "0.63249046", "0.63225436", "0.62239516", "0.6200089", "0.6196667", "0.6185265", "0.61718935", "0.6138998", "0.61151755", "0.6111726", "0.60973...
0.57862914
74
Data loader. Note that batchsize is the local (per GPU) batchsize.
def build_data_loader(dataset, micro_batch_size, num_workers, drop_last, task_collate_fn=None): # Sampler. world_size = mpu.get_data_parallel_world_size() rank = mpu.get_data_parallel_rank() sampler = torch.utils.data.distributed.DistributedSampler( dataset, num_replicas=world_size, ran...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def data_loader(\n self, batch_size: int = 1, iter_steps: int = 0, batch_as_list: bool = True\n ) -> DataLoader:\n data = self.data\n datasets = []\n\n for _, dat in data.items():\n datasets.append(dat.dataset())\n\n if len(datasets) < 1:\n raise FileNotF...
[ "0.7391102", "0.7355233", "0.7307113", "0.7191186", "0.7188778", "0.71511465", "0.7052301", "0.69866663", "0.6968007", "0.69573814", "0.6949311", "0.69279605", "0.6880958", "0.68485147", "0.6814167", "0.68017983", "0.6782323", "0.6779926", "0.67751354", "0.67704856", "0.67450...
0.6592258
37
Get absolute path to resource, works for dev and for PyInstaller
def resource_path(relative_path): try: # PyInstaller creates a temp folder and stores path in _MEIPASS base_path = sys._MEIPASS except Exception: base_path = os.path.abspath(".") return os.path.join(base_path, relative_path)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_resource_path():\n return os.path.join(os.path.dirname(__file__), \"resources\") + os.path.sep", "def resourcePath(relative):\r\n try:\r\n # PyInstaller creates a temp folder and stores path in _MEIPASS\r\n base_path = sys._MEIPASS\r\n except Exception:\r\n base_path = os.pa...
[ "0.8370706", "0.8281029", "0.8249505", "0.81395245", "0.81143504", "0.80990154", "0.8094557", "0.8080119", "0.8068112", "0.8067861", "0.806291", "0.806291", "0.806291", "0.806291", "0.806291", "0.806291", "0.806291", "0.80574095", "0.80550015", "0.80407953", "0.80257154", "...
0.8045328
29
Returns isoformat string of beginning of past x day(s). Assumes Europe/Amsterdam locale.
def get_timestamp(self, days=1): offset = datetime.datetime.utcnow().date() - datetime.timedelta(days=days-1) # est = tz.gettz('Europe/Amsterdam') # temporary dirty fix for timezone: timezone = '+02:00' start = datetime.datetime(offset.year, offset.month, offset.day) retu...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_past_date(self, days):\n past_date = datetime.now() - timedelta(days=days)\n return past_date.isoformat()", "def xlDateISO(xdate):\n # QuantLib doesn't support dates prior to 1901\n # which saves us from dealing with the leap year problem\n if xdate < 367:\n return \"#Dat...
[ "0.58592373", "0.57152444", "0.57139474", "0.55301887", "0.5470207", "0.5442907", "0.5421798", "0.54160655", "0.53812414", "0.53812414", "0.5367235", "0.5362113", "0.5331076", "0.5325458", "0.5298497", "0.5294768", "0.5270717", "0.5265063", "0.52353704", "0.5232425", "0.52232...
0.5205546
22
Checks if the shards_metadata is compatible with the provided tensor dims.
def check_tensor(shards_metadata, tensor_dims) -> None: # If the tensor's volume matches the total volume of all shards and # all shard boundaries are within tensor dims, we have a compatible # sharding spec for this tensor. Note that we have already verified # we don't have overlapping shards. ten...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def has_dims(xobj, dims, kind):\n if isinstance(dims, str):\n dims = [dims]\n\n if not all(dim in xobj.dims for dim in dims):\n raise DimensionError(\n f'Your {kind} object must contain the '\n f'following dimensions at the minimum: {dims}'\n )\n return True", ...
[ "0.70428336", "0.6533978", "0.6469752", "0.6321749", "0.6268698", "0.6185657", "0.6185021", "0.605668", "0.5926702", "0.5918645", "0.5908207", "0.58480775", "0.57827824", "0.5772328", "0.5762425", "0.57193136", "0.57082486", "0.5685897", "0.5651482", "0.5640664", "0.562222", ...
0.83699447
0
Push the item in the front of the deque
def enqueue_front(self, item): self._items.insert(0, item)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def push(self, item):\n super().add_item_to_front(item)", "def push_front(self, e):\n if(self.size_ >= self.capacity_):#If our Deque is full we need to resize it first\n self.resize_front()\n self.data_[self.front_]= e#New Front\n self.size_+=1\n # print(\...
[ "0.7934391", "0.79339534", "0.7679568", "0.74891657", "0.74482065", "0.7417094", "0.7404675", "0.7363072", "0.7294415", "0.72747624", "0.7242487", "0.7242487", "0.72093624", "0.71174246", "0.707182", "0.7052566", "0.70389926", "0.70353955", "0.701858", "0.70012", "0.6997899",...
0.8026828
0
Return True if the deque is empty.
def is_empty(self): return len(self._items) == 0
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_empty(self):\n return len(self.deque) == 0", "def empty(self) -> bool:\n return len(self._deque) == 0", "def empty(self) -> bool:\n return self.que == []", "def is_empty(self) -> bool:\n return self.peek(1) == []", "def is_empty(self):\n return len(self.the_queue) ...
[ "0.92402023", "0.9101068", "0.86111414", "0.8478603", "0.8439654", "0.83985174", "0.83917534", "0.83707136", "0.83707136", "0.8296455", "0.8283977", "0.8280236", "0.8280236", "0.8274057", "0.82652426", "0.8263581", "0.8238711", "0.8222698", "0.82093155", "0.82078135", "0.8205...
0.0
-1
Return the length of the deque.
def __len__(self): return len(self._items)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __len__(self):\n return len(self.deque)", "def __len__(self):\r\n return len(self.deque)", "def __len__(self) -> int:\n return len(self._data_queue)", "def __len__(self):\n return len(self.cumulative_length)", "def length(self):\n return len(self.container)", "def _...
[ "0.86527514", "0.86125225", "0.74804485", "0.7163367", "0.7139454", "0.7136019", "0.7052766", "0.7052766", "0.70522916", "0.7034566", "0.7034566", "0.70223486", "0.70223486", "0.7014049", "0.7014049", "0.7014049", "0.7014049", "0.70028573", "0.6997984", "0.6995006", "0.698651...
0.0
-1
Return the representation of the deque
def __repr__(self): return "Front -> " + repr(self._items) + " <- Rear"
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __repr__(self):\n return 'Deque([{0}])'.format(','.join(str(item) for item in self))", "def __repr__(self):\n return 'Deque([{0}])'.format(','.join(str(item) for item in self))", "def __str__(self):\n return str(self.deque)", "def __repr__(self):\n return 'Deque({})'.format(se...
[ "0.82023656", "0.82023656", "0.7984831", "0.7795593", "0.6640371", "0.6613635", "0.65820986", "0.64977366", "0.6457218", "0.64357615", "0.6344762", "0.6335218", "0.63308865", "0.6327256", "0.6327256", "0.6296222", "0.62726325", "0.62721485", "0.6218142", "0.61443806", "0.6133...
0.60730755
29
Returns the full path for a relative path
def relative_path(__file__, path): return os.path.abspath(os.path.join(os.path.dirname(__file__), path))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_relative_path(path: str):\n return os.path.relpath(path, get_project_root())", "def relative(self, path):\n return re.sub(self.path_regex, '', path).lstrip(os.sep)", "def get_path(relative_path=None):\n\n root_path = os.path.dirname(os.path.dirname(__file__))\n\n if relative_path is Non...
[ "0.8088731", "0.8012601", "0.7939858", "0.7906186", "0.78002477", "0.77519965", "0.77290946", "0.76823074", "0.7662462", "0.76563984", "0.76526093", "0.76337326", "0.7589994", "0.7561121", "0.7560908", "0.7560908", "0.7560908", "0.7560908", "0.7560908", "0.755059", "0.7486504...
0.7933692
3
Returns an array of full paths for a relative path with globs
def expand_path(__file__, path_with_globs): return glob.glob(relative_path(__file__, path_with_globs))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_paths(file_path):\n return glob(path.join(file_path, '*'))", "def glob(path: str) -> list[str]:\n fs, relative_path = url_to_fs(path)\n return cast(list[str], fs.glob(relative_path))", "def get_paths(pattern):\n if not in_source_tree:\n pattern = '../' + pattern\n\n files = glob.g...
[ "0.78830874", "0.74837524", "0.73281705", "0.7273039", "0.7240019", "0.7209716", "0.7107599", "0.7090277", "0.70357305", "0.69723034", "0.69063663", "0.68546826", "0.68303967", "0.6820884", "0.68082666", "0.6802939", "0.6779365", "0.67275643", "0.6712124", "0.67007935", "0.66...
0.7740084
1
Merge dictionaries, presumes no overlap in keys
def merge_dicts(listDicts) : return dict(itertools.chain.from_iterable([x.items() for x in listDicts]))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dict_merge(dict1, dict2):\n combined = dict(dict1)\n combined.update(dict2)\n return combined", "def dict_merge(dict1, dict2):\n combined = dict(dict1)\n combined.update(dict2)\n return combined", "def merge(dict1: dict, dict2: dict):\n if dict1 is None or dict2 is None:\n retur...
[ "0.76170945", "0.76170945", "0.7527569", "0.749968", "0.7440527", "0.7404144", "0.73930734", "0.73853135", "0.73769873", "0.73720855", "0.7343238", "0.72534424", "0.7251481", "0.72268325", "0.7226796", "0.72029424", "0.7192793", "0.71703434", "0.7158246", "0.71368694", "0.712...
0.6827089
59
Sets the id of this EscrowTransactionResponse.
def id(self, id): self._id = id
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_id(self, id):\n self.data['id'] = id", "def set_id(self, id):\n self.__id = id", "def SetId(self, id):\n self.id = int(id)", "def set_id(self, id_):\n\n self.id_ = id_", "def set_id(self, id):\n\n\t\tif id is not None and not isinstance(id, int):\n\t\t\traise SDKExceptio...
[ "0.7112411", "0.68683225", "0.6860865", "0.6837625", "0.6821203", "0.67498773", "0.6711314", "0.6711314", "0.6711314", "0.6711314", "0.6711314", "0.6605837", "0.6605837", "0.6605837", "0.6605837", "0.6605837", "0.6605837", "0.6605837", "0.6605837", "0.6605837", "0.6605837" ]
0.6603375
92
Sets the payee_wallet_id of this EscrowTransactionResponse.
def payee_wallet_id(self, payee_wallet_id): self._payee_wallet_id = payee_wallet_id
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def payer_wallet_id(self, payer_wallet_id):\n\n self._payer_wallet_id = payer_wallet_id", "def payor_id(self, payor_id):\n\n self._payor_id = payor_id", "def payee_zip(self, payee_zip):\n\n self._payee_zip = payee_zip", "def set_merchant_transaction_id(self, transaction_id):\n sel...
[ "0.7311907", "0.573136", "0.54004514", "0.53062975", "0.53006345", "0.5269258", "0.5153421", "0.5153421", "0.4994353", "0.4974469", "0.49704325", "0.49286303", "0.49132255", "0.4910477", "0.4855245", "0.48479044", "0.48479044", "0.48479044", "0.48202246", "0.47650665", "0.474...
0.81508285
0
Sets the payer_wallet_id of this EscrowTransactionResponse.
def payer_wallet_id(self, payer_wallet_id): self._payer_wallet_id = payer_wallet_id
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def payee_wallet_id(self, payee_wallet_id):\n\n self._payee_wallet_id = payee_wallet_id", "def payor_id(self, payor_id):\n\n self._payor_id = payor_id", "def set_merchant_transaction_id(self, transaction_id):\n self.merchant_transaction_id = transaction_id", "def merchant_id(self, mercha...
[ "0.7696529", "0.60767055", "0.56332916", "0.56299317", "0.5272401", "0.5272401", "0.5213051", "0.5161533", "0.51283133", "0.5097511", "0.4929194", "0.48645753", "0.48536748", "0.48232916", "0.4775775", "0.47211295", "0.47165722", "0.4694163", "0.46884617", "0.4682201", "0.465...
0.84063405
0
Sets the record_status of this EscrowTransactionResponse.
def record_status(self, record_status): self._record_status = record_status
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _set_status(self):\n result = self._get_status()\n if result and result[0]['state'] == 'aborted':\n raise Exception(\"Aborted because the status flag is set to 'aborted' in dynamodb\")\n\n # record the status\n self.status['timestamp'] = time.strftime(\"%Y-%m-%dT%H:%M:%SZ...
[ "0.5884911", "0.5822956", "0.5775433", "0.56188405", "0.56188405", "0.56188405", "0.561294", "0.55961376", "0.5581018", "0.5559708", "0.5559708", "0.5559708", "0.5559708", "0.5559708", "0.5559708", "0.5559708", "0.5553998", "0.5553998", "0.5553998", "0.5553998", "0.5553998", ...
0.783832
0
Returns true if both objects are equal
def __eq__(self, other): if not isinstance(other, EscrowTransactionResponse): return False return self.__dict__ == other.__dict__
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __eq__(self, other):\n return are_equal(self, other)", "def __eq__(self, other):\n return are_equal(self, other)", "def __eq__(self,other):\n try: return self.object==other.object and isinstance(self,type(other))\n except: return False", "def __eq__(self, other):\n if i...
[ "0.8088132", "0.8088132", "0.8054589", "0.7982687", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", ...
0.0
-1
Returns true if both objects are not equal
def __ne__(self, other): return not self == other
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __ne__(self, other: object) -> bool:\n if self.__eq__(other):\n return False\n return True", "def __ne__(self, other: object) -> bool:\n return not self.__eq__(other)", "def __ne__(self, other) -> bool:\n return not self.__eq__(other)", "def __eq__(self, other):\n ...
[ "0.845611", "0.8391477", "0.8144138", "0.81410587", "0.8132492", "0.8093973", "0.80920255", "0.80920255", "0.80920255", "0.8085325", "0.8085325", "0.8076365", "0.8076365", "0.8065748" ]
0.0
-1
This function prints and plots the confusion matrix. Normalization can be applied by setting `normalize=True`.
def plot_confusion_matrix(self, y_test, y_pred, normalize=False, title='Confusion matrix', cmap=plt.cm.Blues): target_names = ['Thông thường', 'Đầu cơ'] cm = confusion_matrix(y_test, y_pred) plt.imshow(cm, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def plot_confusion_matrix(cm, classes=[0,1], normalize=False, title='Confusion matrix', print_matrix=False):\n\n if normalize:\n cm = cm.astype('float') / cm.sum(axis=1)[:, np.newaxis]\n print(\"Normalized confusion matrix\")\n else:\n print('Confusion matrix, without normalization')\n\n...
[ "0.8194862", "0.80949175", "0.8029915", "0.8019153", "0.79941195", "0.7991258", "0.7980955", "0.7976606", "0.79610753", "0.79590565", "0.79378676", "0.7934962", "0.7934504", "0.79313844", "0.7926313", "0.7924577", "0.79241234", "0.7923211", "0.7923023", "0.7921931", "0.791787...
0.0
-1
Removes strings starting with http
def _remove_urls(self, text: str) -> str: pattern = r"http\S+" return re.sub(pattern, " ", str(text))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove_URL(sample):\n return re.sub(r\"http\\S+\", \"\", sample)", "def remove_urls(self, text):\n return re.sub(r'http.?://[^\\s]+[\\s]?', '', text)", "def remove_url(txt):\n\n return \" \".join(re.sub(\"([^0-9A-Za-z \\t])|(\\w+:\\/\\/\\S+)\", \"\", txt).split())", "def remove_url(text):\n...
[ "0.78006214", "0.7698079", "0.7578181", "0.74963003", "0.7458265", "0.74112725", "0.73307616", "0.72641194", "0.72031736", "0.7188069", "0.71281874", "0.70712876", "0.7058085", "0.7049562", "0.7030817", "0.69787", "0.6963308", "0.69407505", "0.6912276", "0.68773633", "0.68092...
0.780052
1
Replaces accents with plain alphabets
def _remove_diacritics(self, text: str) -> str: nfkd_form = unicodedata.normalize("NFKD", text) return "".join([char for char in nfkd_form if not unicodedata.combining(char)])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _replace_accented(text: str) -> str:\n return unidecode.unidecode(text)", "def remove_accented_chars(text):\n text = unidecode.unidecode(text)\n return text", "def replace_accented(input_str):\n nkfd_form = unicodedata.normalize('NFKD', input_str)\n return u\"\".join([c for c in nkfd_form if...
[ "0.7602486", "0.7276023", "0.7271902", "0.7019935", "0.6963169", "0.6874722", "0.682965", "0.67585826", "0.66468215", "0.6607765", "0.6562943", "0.6530856", "0.64882517", "0.6410148", "0.640093", "0.63787353", "0.628986", "0.6249889", "0.6244368", "0.6241801", "0.61995006", ...
0.6086533
31
Removes stopwords as defined by self.stop_words
def _remove_stopwords(self, text: str) -> str: pattern = r""" (?x) # Set flag to allow verbose regexps \w+(?:-\w+)* # Words with optional internal hyphens | \s* # Any space | []...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove_stopwords_fun(self):\n tokens = str(self.doc).split()\n cleaned_tokens = [token for token in tokens\n if token.lower() not in self.stopword_list]\n self.doc = ' '.join(cleaned_tokens)", "def rm_stop_words(self, words):\n return [word for word in wor...
[ "0.85951626", "0.8196474", "0.8164273", "0.813838", "0.81174606", "0.80364287", "0.80274475", "0.7989631", "0.7988493", "0.7958696", "0.79517734", "0.7930331", "0.7930331", "0.7930331", "0.7930331", "0.7913143", "0.7845168", "0.7843913", "0.7841652", "0.7822895", "0.7813601",...
0.7446543
40
Removes tabs, newlines and any kind of space characters
def _remove_whitespaces(self, text: str) -> str: return " ".join(re.sub("\xa0", " ", str(text)).split())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def clean_whitespace(text):\n return text\n #return re.sub(r'\\r\\n|\\n', \"\\t\", text)", "def clean(text):\n new = text.replace(\"\\r\", \"\")\n new = new.replace(\"\\t\", \"\")\n new = new.replace(\"\\n\", \"\")\n new = new.replace(\"- \", \"-\")\n new = new.replace(\" \", \" \")\n re...
[ "0.8449928", "0.7658336", "0.73809946", "0.7345701", "0.7265191", "0.726251", "0.7227112", "0.7216958", "0.7216958", "0.7206436", "0.72063667", "0.7186538", "0.71344566", "0.7107262", "0.70810986", "0.7080624", "0.7078933", "0.6926076", "0.6899674", "0.68935776", "0.6882423",...
0.6948386
17
Reduces multiple whitespaces to single whitespace
def _remove_extra_whitespaces(self, text: str) -> str: return re.sub(" +", " ", text)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def removeMultipleSpaces(self) -> None:\n self.text = re.sub('\\s+', ' ', self.text)", "def condense_whitespace(css):\n log.debug(\"Condensing all unnecessary white spaces.\")\n return re.sub(r\"\\s+\", \" \", css)", "def normalize_whitespace(text):\n return NORMALIZE_WHITESPACE_REGEX.sub(' ', ...
[ "0.80924445", "0.7733814", "0.77270997", "0.7487072", "0.7446078", "0.73546934", "0.7331565", "0.73040843", "0.72991526", "0.72107947", "0.7194275", "0.7159008", "0.7136506", "0.7133596", "0.71249396", "0.70942706", "0.70841247", "0.70305616", "0.70219487", "0.69447887", "0.6...
0.68979657
22
Fix Flask environment according to ``XForwarded_`` headers.
def wsgi_proxyfix(factory=None): def create_wsgi(app, **kwargs): wsgi_app = factory(app, **kwargs) if factory else app.wsgi_app num_proxies = app.config.get("WSGI_PROXIES") proxy_config = app.config.get("PROXYFIX_CONFIG") if proxy_config and not WERKZEUG_GTE_014: return ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fixProxiedRequest( self, REQUEST ):\n # mod_proxy: X-Forwarded-Server\n # mod_accel: X-Host, X-Real-IP, X-URI, X-Method\n server = REQUEST.get('SERVER_URL')\n real_host = REQUEST.get('HTTP_X_FORWARDED_SERVER') or REQUEST.get('HTTP_X_HOST')\n real_addr = REQUEST.get('HTTP_X_RE...
[ "0.57845724", "0.5618568", "0.53275186", "0.5303353", "0.529868", "0.5294957", "0.52365404", "0.5180683", "0.5151824", "0.51268667", "0.5117508", "0.5112825", "0.5058677", "0.5011258", "0.5004951", "0.5002801", "0.49961042", "0.49657816", "0.49571234", "0.4935363", "0.4928755...
0.5541965
2
Renders the about page.
def about(): return render_template( 'about.html', title='About', year=datetime.now().year, message='about page.' )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def about():\n return render_template('about.html', title='About')", "def about():\n\n return render_template('about_page.html', title='About')", "def about():\n\n\treturn render_template(\"about.html\")", "def on_about(self):\n render_about_window()", "def about():\r\n return render_te...
[ "0.85650355", "0.85034525", "0.84489655", "0.84044397", "0.82935613", "0.82709616", "0.82709616", "0.82709616", "0.82709616", "0.82709616", "0.82709616", "0.82709616", "0.82709616", "0.82709616", "0.82709616", "0.82709616", "0.82709616", "0.82709616", "0.82680845", "0.8243358",...
0.8394454
4
Post endpoint to delete item. Redirects to home.
def delete_item(item_name, catagory_name): try: item = Item.fetch_by_name_and_catagory_name(item_name, catagory_name) except NoResultFound: abort(404) item.delete() return redirect(url_for('home'))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete_item(request):\n if request.json_body[u'type'] == u'post':\n if DBSession.query(Post).filter(Post.name==request.json_body[u'name']).delete() == 1:\n return {\"deletion_status\":\"success\"}\n import ipdb; impdb.set_trace()\n return {\"deletion_statu...
[ "0.7321518", "0.7296745", "0.7259978", "0.7202219", "0.70292133", "0.70238733", "0.70196456", "0.6984477", "0.69794494", "0.6974444", "0.6911067", "0.68968356", "0.6894365", "0.68761015", "0.6870689", "0.6862545", "0.6816911", "0.6768796", "0.6750122", "0.674466", "0.6742463"...
0.680767
17
Set Log category name to be used.
def set_category(self, category_name): try: module_name = get_module_name_from_log_category(category_name) log_yang_module = importlib.import_module('gi.repository.' + module_name) if not log_yang_module: logger.error("Module %s is not found to be added as log...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rider_category_name(self, rider_category_name):\n\n self._rider_category_name = rider_category_name", "def category(self, category: str):\n\n self._category = category", "def set_scribe_category(category):\r\n LogOptions._SCRIBE_CATEGORY = category", "def set_category(self, category):\n\...
[ "0.71033996", "0.656124", "0.6451363", "0.64011025", "0.63785875", "0.6319959", "0.6303118", "0.6279708", "0.6278118", "0.61796457", "0.608429", "0.608429", "0.608429", "0.608429", "0.608429", "0.60362625", "0.6006342", "0.59686434", "0.5840249", "0.57967573", "0.57849914", ...
0.7935372
0
No real implementation necessary. Only for heapq.
def __lt__(self, other): return True
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def heapify(x):\n pass", "def test_pop_decreases_size(sample_priorityq):\n for i in range(5):\n sample_priorityq.insert([i, i + 3])\n sample_priorityq.pop()\n assert len(sample_priorityq.heap_list) == 4\n sample_priorityq.pop()\n assert len(sample_priorityq.heap_list) == 3\n sample_pr...
[ "0.73582697", "0.7054749", "0.6949152", "0.6781712", "0.67741895", "0.6711578", "0.6673364", "0.6665171", "0.66525424", "0.66385454", "0.65639687", "0.6450138", "0.64492726", "0.6448973", "0.6430282", "0.6409417", "0.639338", "0.639338", "0.639338", "0.6392037", "0.63643914",...
0.0
-1
Tests that the testuser was found.
def test_user_list(self): response = self.client.get('/tests/dashboard/') self.assertEqual(response.status_code, 200) self.assertContains(response, 'testuser', html=True) self.assertContains(response, 'none@nowhere.none', html=True)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_user(self):\n return True", "def test_contains_user(self):\n print('(' + self.test_contains_user.__name__+')',\n self.test_contains_user.__doc__)\n self.assertTrue(self.connection.contains_user(PATIENT_USERNAME))\n self.assertTrue(self.connection.contains_user(DO...
[ "0.76748985", "0.7660696", "0.7656335", "0.75119334", "0.7449909", "0.73115385", "0.72937554", "0.72691184", "0.72514313", "0.7239464", "0.7218272", "0.71586215", "0.7152206", "0.71307015", "0.71049184", "0.7088999", "0.70759594", "0.7050742", "0.70313215", "0.7025326", "0.70...
0.6536369
86
Return an shellescaped version of the string using double quotes. Reliably quote a string which may contain unsafe characters (e.g. space or quote characters), while retaining some shell features such as variable interpolation. The returned value can be used in a shell command line as one token that gets to be further ...
def DoubleQuote(s): if not s: return '""' elif all(c in _SafeShellChars for c in s): return s else: return '"' + s.replace('"', '\\"') + '"'
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def shlex_quote(s):\n if not s:\n return \"''\"\n if _find_unsafe(s) is None:\n return s\n\n # use single quotes, and put single quotes into double quotes\n # the string $'b is then quoted as '$'\"'\"'b'\n return \"'\" + s.replace(\"'\", \"'\\\"'\\\"'\") + \"'\"", "def shlex_quote(s)...
[ "0.7271046", "0.7253869", "0.72336555", "0.7229503", "0.70458126", "0.6944718", "0.6929941", "0.69232047", "0.69232047", "0.6779495", "0.67524135", "0.6597111", "0.65538913", "0.6536574", "0.65330154", "0.65087634", "0.6507119", "0.64975196", "0.64822", "0.646473", "0.644913"...
0.7298411
0
If a new email address is posted, remember it.
def _set_user_email_address(self, request): if request.method == 'POST': form = EmailForm(request.POST) if form.is_valid(): request.session[SESSION_VAR_EMAIL_ADDRESS] = form.cleaned_data['email'] else: return form
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_duplicate_email(self, email):\r\n request = self.req_factory.post('unused_url', data={\r\n 'new_email': email,\r\n 'password': 'test',\r\n })\r\n request.user = self.user\r\n self.assertFailedRequest(self.run_request(request), 'An account with this e-mail...
[ "0.65422535", "0.64260054", "0.63118654", "0.63064903", "0.60563016", "0.6038557", "0.6014613", "0.5898787", "0.58314365", "0.5781677", "0.577932", "0.5769288", "0.575497", "0.5719079", "0.57139456", "0.5708547", "0.5708547", "0.5700854", "0.5699276", "0.56723505", "0.5661490...
0.6590844
0
update learning rate of optimizers
def updatelearningrate(self, epoch): self.lr = getlearningrate(epoch=epoch, opt=self.opt) # update learning rate of model optimizer if isinstance(self.model, list): count = 0 for param_group in self.optimzer.param_groups: # if type(model) is <list> then up...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _update_learning_rate(self):\r\n\r\n self.n_steps += 1\r\n lr = self.factor * self._get_lr_scale()\r\n for param_group in self._optimizer.param_groups:\r\n param_group['lr'] = lr", "def update_learning_rate(self):\n self.scheduler.step()\n lr = self.optimizer.par...
[ "0.82430375", "0.8091104", "0.8081948", "0.8057003", "0.7882125", "0.7729992", "0.7728464", "0.7728464", "0.77180463", "0.7680515", "0.7672647", "0.7670474", "0.76550764", "0.76442766", "0.762199", "0.76109266", "0.7595715", "0.758477", "0.7532394", "0.7522077", "0.75184435",...
0.81921303
1
get list of available actions
def get_actions(self, ally: Set['Entity'], enemy: Set['Entity']) -> Tuple[ Set['Action'], Set['Entity'], Set['Entity']]: available_actions = set() for action in self.actions: if action.cool_down.name not in [effect.name for effect in self.effects.effects]: available_a...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_available_actions(self):\n return self.actions", "def get_actions(self):\n return []", "def get_list_of_actions(self):\n return self.actions", "def actions(self):\n return self._action_list", "def get_available_actions(self, state):\n pass", "def _get_actions(self):...
[ "0.88604504", "0.8727885", "0.8649391", "0.8512479", "0.8356988", "0.8249469", "0.8249469", "0.8249469", "0.8200832", "0.80950415", "0.80412275", "0.7978333", "0.7978333", "0.7912648", "0.7903887", "0.7893374", "0.78658706", "0.77716225", "0.77087396", "0.7706551", "0.7704463...
0.0
-1
Return a full name, neatly formatted.
def get_formatted_name(first_name, last_name, middle_name=''): if middle_name: full_name = first_name + ' ' + middle_name + ' ' + last_name else: full_name = first_name + ' ' + last_name return full_name.title()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_full_name(self):\n full_name = '{0} {1} {2}'.format(self.last_name, self.first_name, self.patronymic)\n return full_name.strip()", "def get_full_name(self):\n\t\tfull_name = '%s %s' % (self.first_name, self.last_name)\n\t\treturn full_name.strip()", "def get_full_name(self):\r\n fu...
[ "0.87166595", "0.86399925", "0.860218", "0.860218", "0.8595642", "0.8579464", "0.8579464", "0.8579464", "0.8579464", "0.8579464", "0.8579464", "0.8579464", "0.8579464", "0.8579464", "0.8579464", "0.8579464", "0.8579464", "0.8579464", "0.8579464", "0.8579464", "0.8579464", "...
0.8130383
83
Test if the path holder contains a shot render.
def test(cls, pathHolder, parentCrawler): if not super(ShotRenderCrawler, cls).test(pathHolder, parentCrawler): return False renderType = pathHolder.baseName().split(".")[0].split("_")[-1] return renderType == "sr"
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def point_is_shot(self, point: Point):\n return point in self.shot_locations", "def test(cls, pathHolder, parentCrawler):\n if not super(TurntableCrawler, cls).test(pathHolder, parentCrawler):\n return False\n\n renderType = pathHolder.baseName().split(\".\")[0].split(\"_\")[-1]\n...
[ "0.66429377", "0.6288864", "0.6145428", "0.6053248", "0.6007993", "0.5842656", "0.5803181", "0.5795196", "0.57627773", "0.5747576", "0.56485415", "0.56485415", "0.5615542", "0.55867237", "0.5571235", "0.55255395", "0.55035883", "0.54886705", "0.5453938", "0.545361", "0.542327...
0.7443225
0
Plot an image along with its histogram and cumulative histogram.
def plot_img_and_hist(image, axes, bins=256): image = img_as_float(image) ax_img, ax_hist = axes ax_cdf = ax_hist.twinx() # Display image ax_img.imshow(image, cmap=plt.cm.gray) ax_img.set_axis_off() # Display histogram ax_hist.hist(image.ravel(), bins=bins, histtype='step', color='blac...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def plot_img_and_hist(image, axes, bins=256):\n# image = img_as_float(image)\n ax_img, ax_hist = axes\n ax_cdf = ax_hist.twinx()\n\n # Display image\n ax_img.imshow(image, cmap=plt.cm.gray);\n ax_img.set_axis_off()\n\n # Display histogram\n ax_hist.hist(image.ravel(), bins=bins, histtype='...
[ "0.7969631", "0.78266644", "0.7776819", "0.74996084", "0.7412575", "0.72977114", "0.68852156", "0.6873014", "0.6869999", "0.668876", "0.66544735", "0.66544735", "0.66544735", "0.66200167", "0.652162", "0.6493563", "0.64923745", "0.6483739", "0.64781225", "0.6413293", "0.63585...
0.7809336
3
Recursively searches for 'datacubedefinition.prj' in a level2 directory and returns its parent directory.
def _get_datacubeprj_dir(directory): prj_path = [] for path in Path(directory).rglob('datacube-definition.prj'): prj_path.append(path) if len(prj_path) < 1: raise FileNotFoundError(f"'datacube-definition.prj' not found in {directory}") elif len(prj_path) > 1: raise RuntimeError...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_parent_path(self):\n return os.path.join(os.getcwd(), \"src\", \"data\", \"genes\")", "def find_in_parent_dir(fname):\n p = os.path.abspath(os.path.curdir)\n \n while not os.path.exists(os.path.join(p, project_conf_name)):\n oldp, p = p, os.path.dirname(p)\n if p == oldp:\n...
[ "0.59310746", "0.5910224", "0.5907544", "0.56730086", "0.567043", "0.54829234", "0.5468787", "0.5349158", "0.53045815", "0.52922255", "0.52142084", "0.52010685", "0.519746", "0.51958925", "0.51642823", "0.5158747", "0.51506376", "0.51362514", "0.5133889", "0.51276433", "0.511...
0.72337234
0
Instantiate a Missing Data Error.
def __init__(self, message: str) -> None: super().__init__( "Data requested from a class could not be found: {}".format(message) )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, message=\"\"):\n super(DataError, self).__init__(message)", "def data_missing(data):\n return type(data)._from_sequence([None, data[0]])", "def test_create_data_lookup_error(self):\n with self.assertRaises(LookupError):\n _ = create_data({\"name\": \"fake_data\"})...
[ "0.7335149", "0.65505475", "0.65356326", "0.62742686", "0.62742686", "0.62742686", "0.6204105", "0.6189645", "0.6147461", "0.6143845", "0.6142353", "0.6132027", "0.60576224", "0.60308665", "0.6008944", "0.5981049", "0.5965471", "0.5946241", "0.5938257", "0.59336597", "0.58896...
0.60894585
12
Determines the convective heat transfer coefficient, either free, or forced. In the absence of any wind, the "free" wind_heat_transfer_coefficient is returned. If there is wind present, then this parameter is known as the "forced" wind_heat_transfer_coefficient.
def wind_heat_transfer_coefficient(self) -> float: return 3.8 + 2 * self.wind_speed # return 4.5 + 2.9 * self.wind_speed
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def thermalConductivity(self, Tk=None, Tc=None):\n Tk = getTk(Tc, Tk)\n self.checkPropertyTempRange(\"thermal conductivity\", Tk)\n thermalConductivity = (\n 2.13014e-08 * Tk**3\n - 6.31916e-05 * Tk**2\n + 1.11629e-01 * Tk\n - 2.00043e00\n )\n...
[ "0.6343963", "0.59971076", "0.59249985", "0.5791971", "0.576443", "0.5683115", "0.565232", "0.55878526", "0.5570194", "0.54607165", "0.5381237", "0.52986056", "0.5273817", "0.5269059", "0.5203606", "0.5199913", "0.5169069", "0.5163147", "0.5161178", "0.51067317", "0.510497", ...
0.69990456
0
Names of exogenous variables
def exog_names(self): return self.data.xnames
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def variable_names(self):\n \n return [x['variable'] for x in self.variable_dicts()]", "def get_all_variables_names(self):\n return self.project.get_variable_names() + self.design.get_variable_names()", "def get_variable_names(self):\n return [var[1] for var in self.variables]", "...
[ "0.69048613", "0.6785922", "0.67740816", "0.6711591", "0.6687262", "0.6663156", "0.6635133", "0.66310126", "0.6589906", "0.6581961", "0.6580228", "0.6575236", "0.6552368", "0.6544824", "0.6535504", "0.6525284", "0.6511582", "0.64991194", "0.64609987", "0.641673", "0.6381078",...
0.5873568
61
Initialize (possibly reinitialize) a Model instance. For instance, the design matrix of a linear model may change and some things must be recomputed.
def initialize(self): pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initialize_model(self):\n pass", "def init_model(self):\n pass", "def initialize(self, model):\n pass", "def __init__(self, model: Model1D):\n self._model = model", "def re_init(self):\n self.latent.re_init()\n if 're_init' in dir(self.inference_model):\n ...
[ "0.7124921", "0.6987733", "0.6885349", "0.6875176", "0.68088514", "0.67898726", "0.6724793", "0.6722912", "0.66522413", "0.6631922", "0.6631922", "0.66145754", "0.66093516", "0.66029775", "0.65747577", "0.65733886", "0.65632457", "0.6534131", "0.6534131", "0.6534131", "0.6534...
0.0
-1
Returns the confidence interval of the fitted parameters.
def conf_int(self, alpha=.05, cols=None, method=None): if method is not None: # pragma: no cover raise NotImplementedError("`method` argument is not actually " "supported. Upstream silently ignores " "it.") bse = s...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def confidence(self) -> float:\n return self._confidence", "def confidence(self):\n return self._confidence", "def confidence(self):\n return self._confidence", "def confidence(self) -> float:\n return float(self.class_scores[self.class_num])", "def calculate_confidence_interval...
[ "0.68219185", "0.6498113", "0.6498113", "0.64727414", "0.6388635", "0.6311576", "0.62752163", "0.6229275", "0.6110395", "0.60803914", "0.60660297", "0.60526866", "0.6051802", "0.6024401", "0.60003996", "0.590071", "0.5890141", "0.58519065", "0.5841124", "0.58395547", "0.57960...
0.51247424
73
Takes a list of words and returns a string formatted to camel case.
def _camelify(words): newText = '' for word in words: if newText == '': newText = word[:1].lower() + word[1:] else: newText = '%s%s' % (newText, word.capitalize()) return newText
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def render_camel(var_words):\n return ''.join([word.capitalize() for word in var_words])", "def format_camel(text):\r\n\toutput = \"\"\r\n\tfor i,w in enumerate(text.split(\" \")):\r\n\t\tif i > 0:\r\n\t\t\toutput += w[0].upper() + w[1:]\r\n\t\telse:\r\n\t\t\toutput += w\r\n\treturn output", "def camel_case...
[ "0.8251883", "0.7825327", "0.7563968", "0.7526195", "0.7506611", "0.7506611", "0.7482835", "0.72373885", "0.7220596", "0.7182877", "0.7105976", "0.7050961", "0.70338947", "0.7015833", "0.70085067", "0.6960694", "0.6957555", "0.6947957", "0.69223166", "0.69102275", "0.6900598"...
0.8511594
0
Cleans up the text before formatting to camel, pascal or snake case. Removes dashes, underscores, single quotes (apostrophes) and replaces them with a space character. Multiple spaces, tabs or new line characters are collapsed to one space character. Returns the result as a string.
def _cleanup_text(text): prefixChars = "" suffixChars = "" if text.startswith("-"): prefixChars += "-" if text.startswith("_"): prefixChars += "_" if text.endswith("-"): suffixChars += "-" if text.endswith("_"): suffixChars += "_" text = text.strip() text ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def clean_review(self, text):\n text = text.lower() # lowercase capital letters\n\n if self.remove_stopwords:\n text = self.remove_stopwords_f(text, keep_neg_words=True)\n\n text = re.sub('[^a-zA-Z]+', ' ', text) # select only alphabet characters (letters only)\n # text = r...
[ "0.6987627", "0.69115055", "0.68299866", "0.68170524", "0.6792189", "0.6779221", "0.6683785", "0.6663541", "0.66497254", "0.661544", "0.66122067", "0.6598049", "0.65703285", "0.6562379", "0.6545204", "0.6541442", "0.6536878", "0.6534535", "0.6511388", "0.64796376", "0.6465856...
0.7590578
0
Returns the device to be used for training.
def device() -> str: import torch if torch.cuda.is_available() and torch.cuda.device_count() > 0: if hasattr(Config().trainer, 'parallelized') and Config().trainer.parallelized: device = 'cuda' else: device = 'cuda:' + str( ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def device(self) -> torch.device:\n for param in self.parameters():\n return param.device\n return get_device(\"cpu\")", "def get_device():\n import torch\n\n if torch.cuda.is_available():\n return torch.device('cuda')\n return torch.device('cpu')", "def...
[ "0.8276948", "0.8204713", "0.81753296", "0.80565923", "0.79779685", "0.79452527", "0.79452527", "0.79452527", "0.79452527", "0.79452527", "0.78916585", "0.78675044", "0.7835675", "0.77565765", "0.77542937", "0.77542937", "0.77542937", "0.77542937", "0.7713507", "0.7709037", "...
0.8220512
1
return True if the number_str can be truncated from both left and right and always be prime, e.g. 3797
def is_left_right_truncatable(number_str, prime_str_set): l = len(number_str) #left truncatable? for i in range(l): if number_str[i:] not in prime_str_set or number_str[:l-i] not in prime_str_set: return False return True
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_truncatable(number: int):\n\n str_number = str(number)\n index = 0\n\n # Left shift:\n while index < len(str_number):\n if not is_prime(int(str_number[index:])):\n return False\n\n index += 1\n\n # Right shift:\n index = len(str_number)\n while index > 0:\n ...
[ "0.8172049", "0.72789836", "0.69700235", "0.6308689", "0.61999017", "0.6155211", "0.6115153", "0.6111989", "0.6109884", "0.6073659", "0.6044184", "0.6039048", "0.60375977", "0.60341597", "0.60208774", "0.6020748", "0.601937", "0.60004914", "0.5998233", "0.5982962", "0.5968794...
0.7736553
1
Determine fixed modifications in case the reference shift is not at zero. Needs localization.
def determine_fixed_mods_nonzero(reference, locmod_df, data): utils.internal('Localizations for %s: %s', reference, locmod_df.at[reference, 'localization']) loc = get_fix_mod_from_l10n(reference, locmod_df) label = reference data_dict = data.ms_stats().copy() while loc is None: del data_dict...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def determine_fixed_mods_zero(aastat_result, data, params_dict):\n fix_mod_zero_thresh = params_dict['fix_mod_zero_thresh']\n min_fix_mod_pep_count_factor = params_dict['min_fix_mod_pep_count_factor']\n\n fix_mod_dict = {}\n reference = utils.mass_format(0)\n aa_rel = aastat_result[reference][2]\n ...
[ "0.61892533", "0.6004834", "0.5786946", "0.5511628", "0.54182035", "0.5341413", "0.52645195", "0.5253012", "0.5237", "0.5225602", "0.52148324", "0.5205912", "0.5189934", "0.5129188", "0.51038384", "0.51002914", "0.5086002", "0.50812876", "0.49967453", "0.4983229", "0.49150836...
0.59622836
2
Determine fixed modifications in case the reference shift is at zero. Does not need localization.
def determine_fixed_mods_zero(aastat_result, data, params_dict): fix_mod_zero_thresh = params_dict['fix_mod_zero_thresh'] min_fix_mod_pep_count_factor = params_dict['min_fix_mod_pep_count_factor'] fix_mod_dict = {} reference = utils.mass_format(0) aa_rel = aastat_result[reference][2] utils.inte...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def determine_fixed_mods_nonzero(reference, locmod_df, data):\n utils.internal('Localizations for %s: %s', reference, locmod_df.at[reference, 'localization'])\n loc = get_fix_mod_from_l10n(reference, locmod_df)\n label = reference\n data_dict = data.ms_stats().copy()\n while loc is None:\n de...
[ "0.6245811", "0.5993922", "0.58981633", "0.54384756", "0.5420952", "0.5370132", "0.5319682", "0.52733696", "0.52633834", "0.5207875", "0.5174516", "0.5168301", "0.5162118", "0.5160096", "0.5155298", "0.5127173", "0.5121005", "0.50911295", "0.49932376", "0.4955329", "0.4909749...
0.63415945
0