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
camphorBlendedStacks.SetTimeFrame(t) Sets the time frame of the blended stack to the specified time frame
def setTimeFrame(self, t): for s in self.stack: s.setTimeFrame(t)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setTimeFrame(self, t):\n print(t)\n if self.numberOfTimeFrames > 1:\n if t+1 > self.numberOfTimeFrames:\n if self.displayMode==0:\n self.importer[0].SetImportVoidPointer(self.tdata[-1])\n elif self.displayMode==1:\n se...
[ "0.6658556", "0.5853788", "0.5771886", "0.56952643", "0.5691793", "0.5652499", "0.56454307", "0.56112504", "0.55843544", "0.5578491", "0.5574892", "0.5569229", "0.5543523", "0.55137384", "0.5422857", "0.54157764", "0.54049253", "0.53852516", "0.5356254", "0.5314721", "0.53022...
0.82817763
0
Check that `Edistr` dataframe raises wanrning because of non linlin interpolation
def test_from_endf6_warning_nonlinlin_interp(text_edistr_2): tape = sandy.endf6.Endf6.from_text(text_edistr_2) chi = pfns.from_endf6(tape) assert chi.empty
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_extrapolation_none(self):\n interpolator, _, _ = self.setup_linear(\n 'none', EXTRAPOLATION_RANGE, big_values=False, small_values=False, uneven_spacing=False\n )\n for i in range(len(self.xsamples_in_bounds)):\n with self.assertRaises(\n ValueE...
[ "0.61084425", "0.60941106", "0.60829264", "0.58311653", "0.58298075", "0.5766786", "0.5554892", "0.5488133", "0.5479748", "0.54606384", "0.54582494", "0.54550457", "0.5363778", "0.5354933", "0.5338005", "0.53177357", "0.53003925", "0.5203766", "0.51920474", "0.5185091", "0.51...
0.0
-1
Split a long line into several lines.
def formatchunks(val, chnklen, chnkspacelen): chunks = [] avalwork = val while avalwork: chunkstr = avalwork[:chnklen] avalwork = avalwork[chnklen:] if ' ' in avalwork: wrapped = avalwork[:avalwork.index(' ')] chunkstr = chunkst...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _split(self, line):\n raise NotImplementedError", "def splitlines(self, *args, **kwargs): # real signature unknown\n pass", "def _splitLine(line_number, line, allow_change=False):\n delimiter = '->' if (allow_change and '->' in line) else '='\n if delimiter not in line:\n raise TimingSyn...
[ "0.6668069", "0.6358954", "0.6198404", "0.6101087", "0.60102034", "0.5950868", "0.59441274", "0.58782035", "0.58280474", "0.57128334", "0.5700333", "0.5695021", "0.5673301", "0.56644267", "0.5663051", "0.5659877", "0.56344", "0.5630361", "0.56283647", "0.5603473", "0.56016165...
0.0
-1
Retrieves an objects simple JSON representation. Keyword arguments are the same as do_object_info().
def do_object_json(ident, model, attrs): obj = get_object(ident, model, attrs=attrs) mname = model.__name__ if not obj: print_notfound(ident, model, attrs) return 1 headerstr = get_headerstr(obj) try: jsonstr = get_object_json(obj, model) except Exception as ex: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def json(self, obj):\n dd = {}\n if '__json__' in dir(obj):\n dd = obj.__json__()\n else:\n dd = obj.__dict__\n\n res = simplejson.dumps( dd )\n return res", "def dumps(self, obj):\n return simplejson.dumps(obj)", "def serialize(obj):\n r...
[ "0.6618999", "0.6596352", "0.6564987", "0.65563506", "0.64491624", "0.63797766", "0.6341222", "0.63257515", "0.6311158", "0.62954134", "0.6222159", "0.62001604", "0.61867625", "0.61860627", "0.61701196", "0.6167822", "0.6152918", "0.6139723", "0.6133116", "0.61061716", "0.609...
0.6809853
0
Return simple json representation of an objects attributes.
def get_object_json(obj): data = {} model = obj.__class__ for fieldname in get_model_fields(model): data[fieldname] = str(getattr(obj, fieldname)) return json.dumps(data)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def json(self):\n json_dict = {}\n for attr in [\"id\"] + list(self.JSON_ATTRIBUTES):\n raw_val = getattr(self, attr) or self.__class__.__dict__.get(attr, None)\n if raw_val is None:\n continue\n val = raw_val() if callable(raw_val) else raw_val\n ...
[ "0.7706252", "0.7513807", "0.7429916", "0.74296415", "0.73991597", "0.73102987", "0.72512436", "0.722639", "0.7209757", "0.7149166", "0.71249634", "0.71090364", "0.7052662", "0.7022909", "0.7017454", "0.6998003", "0.6975361", "0.69351655", "0.6910498", "0.6910498", "0.6898485...
0.0
-1
Returns a pickle string for this object.
def get_object_pickle(obj): try: pstr = pickle.dumps(obj) return pstr except Exception as ex: print('Unable to pickle that object!\n{}'.format(ex)) return ''
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def serialize(self):\n\n return pickle.dumps(self)", "def serialize(self) -> str:\n # Convert it to a plain string so that it can be included as JSON metadata\n # in Trainer checkpoints.\n return base64.b64encode(pickle.dumps(self)).decode(\"ascii\")", "def serialize_me(self):\n ...
[ "0.76474196", "0.761759", "0.75129896", "0.71210337", "0.70951295", "0.7039388", "0.6998219", "0.6955773", "0.6923814", "0.6867037", "0.68639183", "0.68491584", "0.6846885", "0.6803721", "0.67791444", "0.6744389", "0.6714677", "0.66782945", "0.665841", "0.66493833", "0.662329...
0.69093627
9
Initializes the data needed to run the control code on one of our robot. The hope is that, using this function will allow us to design code that can be used on future robot with different configurations, with a minimal amount of rework.
def robotDataCreation(self, robotType, numModules): self.robotData = {} self.robotData['numModules'] = copy(numModules) self.robotData['robotType'] = copy(robotType) self.robotData['modules'] = np.linspace(1, numModules, num=numModules) sel...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def robotInit(self):\n\n #**************Camera Initialization********************\n #Networktables.initialize('server=roborio.5970-frc.local')\n #wpilib.CameraServer.launch()\n #wpilib.CameraServer.launch('vision.py:main')\n\n #**************Robot-Side Initialization*************...
[ "0.72354853", "0.70248085", "0.6951976", "0.69489706", "0.6896224", "0.6876855", "0.68424195", "0.6781426", "0.6722684", "0.6718469", "0.66663605", "0.6617556", "0.6609008", "0.65336347", "0.65106386", "0.6509194", "0.6491957", "0.6490167", "0.64411455", "0.64407516", "0.6435...
0.6115278
63
Get switch state. Assume switch is on.
def is_on(self): return self.status not in (CONST.STATUS_OFF, CONST.STATUS_OFFLINE)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def state(self):\n if self.__pin.state == ON_STATE:\n return switch_state.ON\n return switch_state.OFF", "def read_switch(self):\n switch = GPIO.input(SWITCH_PIN)\n\n if (switch == 0):\n switch=1\n else:\n switch=0\n\n return switch", "...
[ "0.80371153", "0.7851795", "0.78517914", "0.7753204", "0.7542454", "0.7288713", "0.71434057", "0.71379966", "0.70707667", "0.70311755", "0.695295", "0.68192846", "0.6805338", "0.6779661", "0.66709965", "0.66697925", "0.6617406", "0.6608954", "0.6539302", "0.653781", "0.647826...
0.0
-1
Returns a DataCleaner Object with the passed DataFrame Data set as its own DataFrame
def __init__(self, df: pd.DataFrame, deep=False) -> None: if(deep): self.df = df.copy(deep=True) else: self.df = df
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_data_frame(self):\n self.create_dataframe()\n return self.df", "def PrepareData(df):\n df = (df\n .pipe(CleanData)\n .pipe(AddValidity)\n )\n return df", "def make_data_frame(self):\n names = []\n names.extend(self.SETTABLE_PARAM_NAMES)\n names.extend(s...
[ "0.6516227", "0.64228183", "0.6408896", "0.6380711", "0.6358676", "0.62524784", "0.6136308", "0.610793", "0.6095836", "0.6009404", "0.59750646", "0.5937841", "0.58928716", "0.5891597", "0.5852206", "0.5850123", "0.58271366", "0.5786323", "0.57801247", "0.57478845", "0.5729348...
0.5749912
19
Returns a DataFrame where the specified columns in the list are removed
def remove_unwanted_columns(self, columns: list) -> pd.DataFrame: self.df.drop(columns, axis=1, inplace=True) return self.df
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def deleteCols(df, colList):\n for c in colList:\n del df[c]\n return df", "def remove_columns(df, args):\n rm = args.remove.split(',')\n cols = [f\"X['{col}']\" for col in df.columns if col not in rm]\n cols = ', '.join(cols) \n return df >> select(eval(cols))", "def data_preparatio...
[ "0.7880486", "0.75426114", "0.7026441", "0.6864332", "0.67593974", "0.67144364", "0.6643487", "0.66409594", "0.6635428", "0.65904015", "0.65755975", "0.654415", "0.6499167", "0.6473139", "0.6444521", "0.64145386", "0.6366254", "0.6352453", "0.62902516", "0.62902516", "0.62832...
0.7519041
2
Returns a DataFrame where the specified columns is split to date and time new columns adding a prefix string to both
def separate_date_time_column(self, column: str, col_prefix_name: str) -> pd.DataFrame: try: self.df[f'{col_prefix_name}Date'] = pd.to_datetime( self.df[column]).dt.date self.df[f'{col_prefix_name}Time'] = pd.to_datetime( self.df[column]).dt.time ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def extract_split_columns(df):\n\n # Adding a new column: date\n df = df.withColumn('date', F.to_date(df['create_date']))\n\n # Adding a new column: date\n df = df.withColumn('weekday', F.dayofweek(df['create_date']))\n\n # Adding a new column: time\n df_dt_tm = df.withColumn('hour', F.hour(df['c...
[ "0.6427127", "0.5959132", "0.58066845", "0.5804303", "0.5785959", "0.57698023", "0.5676989", "0.565649", "0.5538185", "0.5523098", "0.5518163", "0.5505365", "0.55020297", "0.544454", "0.542725", "0.5402822", "0.5353313", "0.53342247", "0.5314018", "0.5302742", "0.52686906", ...
0.6749336
0
Returns a DataFrame where columns with a single value are removed
def remove_single_value_columns(self, unique_value_counts: pd.DataFrame) -> pd.DataFrame: drop_cols = list( unique_value_counts.loc[unique_value_counts['Unique Value Count'] == 1].index) return self.df.drop(drop_cols, axis=1, inplace=True)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _rm_empty_cols(df: pd.DataFrame) -> pd.DataFrame:\n n_distinct = df.nunique()\n return df.drop( n_distinct[ n_distinct <= 1].index, axis=1)", "def remove_constant_cols(df):\n return df.loc[:, (df != df.iloc[0]).any()]", "def extract_remove_columns(df):\n\n return df.drop(\"parameters\")...
[ "0.7411146", "0.72918427", "0.7149351", "0.6953374", "0.6872606", "0.686817", "0.6803692", "0.66892046", "0.6644029", "0.66093135", "0.66090983", "0.6559149", "0.6554472", "0.65193015", "0.65182024", "0.6468587", "0.64043844", "0.639888", "0.6392047", "0.6371164", "0.6348579"...
0.744195
0
Returns a DataFrame where duplicate rows are removed
def remove_duplicates(self) -> pd.DataFrame: removables = self.df[self.df.duplicated()].index return self.df.drop(index=removables, inplace=True)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def clean_data(df):\n df.drop_duplicates(inplace=True)\n return df", "def remove_duplicates(data: pd.DataFrame) -> pd.DataFrame:\n validate_data_is_type(data, pd.DataFrame)\n return data.drop_duplicates().reset_index(drop=True)", "def remove_duplicates(df):\n cache = set()\n\n def is_unique(r...
[ "0.7776188", "0.7721413", "0.7423212", "0.7305289", "0.69668883", "0.676696", "0.6714914", "0.6687384", "0.65952873", "0.65635675", "0.6553435", "0.6531036", "0.65301776", "0.6449503", "0.64462143", "0.6444923", "0.6443063", "0.63630587", "0.6348834", "0.6276044", "0.6271408"...
0.8175928
0
Returns optimal control input for the given parameter x.
def __call__(self,x): u,_,_,t = self.__oracle.P_theta(x) return u,t
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getBestFitModel(self, x=None):\n\n assert(self.param is not None)\n\n if x is None:\n x = self.x\n\n try:\n len(x)\n except TypeError:\n x = np.asarray([x])\n\n par = self.param\n bestFit = np.zeros( (len(x)))\n for i in range(se...
[ "0.6705297", "0.6549329", "0.6277774", "0.6215964", "0.61533517", "0.61087364", "0.609009", "0.60182554", "0.60069954", "0.595825", "0.59397477", "0.59373295", "0.58926487", "0.5858492", "0.5836421", "0.57908225", "0.57832235", "0.5771347", "0.5771042", "0.575989", "0.5757153...
0.0
-1
Rotate points by quaternions.
def quat_rotate(X, q): # repeat q along 2nd dim ones_x = X[[0], :, :][:, :, [0]] * 0 + 1 q = torch.unsqueeze(q, 1) * ones_x q_conj = torch.cat([q[:, :, [0]], -1 * q[:, :, 1:4]], dim=-1) X = torch.cat([X[:, :, [0]] * 0, X], dim=-1) X_rot = hamilton_product(q, hamilton_product(X, q_conj)) re...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rotateFromQuat(self, qb):\n\n self.put(range(4),self.product(self,qb))", "def rotate3(origin, point, angle):\n\n return qx, qy", "def rotate(self,v):\n q = Quat(self)\n q.normalize()\n\n v0 = (1.0 - 2.0 * (q[1] * q[1] + q[2] * q[2]))*v[0] + (2.0 * (q[0] * q[1] - q[2] * q[3]))...
[ "0.6932855", "0.68318313", "0.66628003", "0.6601777", "0.6565507", "0.6509371", "0.6485", "0.6428414", "0.636477", "0.636133", "0.63553286", "0.6339782", "0.6328516", "0.63110536", "0.62519974", "0.62519974", "0.62400997", "0.62065315", "0.6162693", "0.61591846", "0.61591846"...
0.6789267
2
Get this OCISDKError representation. Returns str The error message.
def __str__(self): return str(self._message)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def error_string(self) -> str:\n return self._msg", "def get_error_message(self) -> str:\n return self._error_msg", "def error_message(self) -> str:\n return self._error_message", "def __str__(self):\n return self.error_message", "def error_message(self):\n\n return self....
[ "0.7795934", "0.7556215", "0.74050003", "0.7386164", "0.7354146", "0.7329203", "0.7329203", "0.7310175", "0.729485", "0.72933304", "0.7284307", "0.711916", "0.70253575", "0.6978312", "0.6952845", "0.69392365", "0.68480325", "0.67626685", "0.66441983", "0.65926355", "0.6535256...
0.6188243
45
Parse the command line arguments and return an object representing the command line (as returned by argparse's parse_args()). Returns The commandline argparse namespace.
def get_args_parser(): parser = argparse.ArgumentParser(prog='oci-iscsi-config', description='Utility for listing or configuring iSCSI devices on an OCI instance.' ) subparser = parser.add_subparsers(dest='command') # # usage ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_args() -> Any:\n return get_parser().parse_args()", "def _parse_args():\n parser = argparse.ArgumentParser(description=\"\")\n options = parser.parse_args()\n\n return options", "def parse_args() -> argparse.Namespace:\n parser = argparse.ArgumentParser()\n parser.add_argument(\n ...
[ "0.6892788", "0.68918455", "0.6872342", "0.6833687", "0.68235564", "0.6816217", "0.6764533", "0.6745464", "0.6744126", "0.66650754", "0.66527903", "0.6642865", "0.66359556", "0.6610606", "0.65776527", "0.6568373", "0.6554572", "0.6504066", "0.65018123", "0.6493927", "0.648992...
0.0
-1
Set the column lenghts.
def get_columns(details, mode, column_lengths): _logger.debug('%s', where_am_i()) columns = list() if details: columns.append(['Target', column_lengths['target']+2, 'target']) columns.append(['Volume Name', column_lengths['name']+2, 'name']) if details: columns.append(['Volume OCID',...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rf_columnSize(self):\n self.twVar.resizeColumnToContents(0)\n self.twVar.resizeColumnToContents(1)\n self.twVar.resizeColumnToContents(3)", "def set_size_columns(self, nom_propi_list):\n propi = util.get_frame_title(self)\n propi += nom_propi_list\n valor = wx.GetApp...
[ "0.75251526", "0.6915082", "0.68566096", "0.6807124", "0.6741227", "0.6508123", "0.64196646", "0.6409947", "0.6402027", "0.6387881", "0.6342158", "0.63302225", "0.6321791", "0.621432", "0.62100035", "0.61956775", "0.6112159", "0.6112159", "0.6095622", "0.60888064", "0.6054547...
0.0
-1
Get the instance name the volume is attached to.
def _get_attached_instance_name(_, volume): global _this_instance_ocid if not volume.is_attached(): return '-' _vol_instance_attach_to = volume.get_instance() if _vol_instance_attach_to.get_ocid() == _this_instance_ocid: return "this instance" pip = _vol_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def instance_name(self) -> str:\n return pulumi.get(self, \"instance_name\")", "def instance_name(self) -> str:\n return pulumi.get(self, \"instance_name\")", "def instance_name(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"instance_name\")", "def instance_name(self) -> Option...
[ "0.78436476", "0.78436476", "0.76413465", "0.7377061", "0.73643017", "0.72918683", "0.72918683", "0.72918683", "0.72811484", "0.725253", "0.6995029", "0.6990073", "0.6807851", "0.6739456", "0.668811", "0.6617696", "0.65907115", "0.65622276", "0.6511397", "0.63325244", "0.6332...
0.8558626
0
Get the compartment name.
def _get_comp_name(_, volume): _map = getattr(_get_comp_name, 'c_id_to_name', {}) if volume.get_compartment_id() not in _map: _map[volume.get_compartment_id()] = volume.get_compartment().get_display_name() setattr(_get_comp_name, 'c_id_to_name', _map) return _map[volume.get_c...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_name(self):\n return CPX_PROC.getobjname(self._env._e, self._cplex._lp,\n self._env._apienc)", "def _get_comp_name(_,volume):\n _map = getattr(_get_comp_name,'c_id_to_name',{})\n if volume.get_compartment_id() not in _map:\n _map[volume.ge...
[ "0.73869675", "0.73483664", "0.71693176", "0.7063999", "0.7063999", "0.7063999", "0.7001963", "0.69958335", "0.6961439", "0.6961439", "0.6961439", "0.6961439", "0.6961439", "0.6961439", "0.6961439", "0.6961439", "0.6961439", "0.6961439", "0.6961439", "0.6961439", "0.6961439",...
0.7705519
0
Get the ocid of the current instance, via the api or via the metadata.
def get_this_instance_ocid(session): _logger.debug('%s', where_am_i()) if bool(session): if bool(session.this_instance()): return session.this_instance().get_ocid() _logger.error('Failed to retrieve instance information.') sys.exit(1) else: return get_instance_oci...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_instance_ocid():\n return InstanceMetadata().refresh()['instance']['id']", "def get_instance_ocid():\n return InstanceMetadata().refresh()['instance']['id']", "def odata_id(self):\n return self._odata_id", "def instance_id(self) -> str:\n return pulumi.get(self, \"instance_id\")",...
[ "0.71462893", "0.71462893", "0.6402029", "0.6399058", "0.6399058", "0.6399058", "0.6399058", "0.6399058", "0.6399058", "0.6399058", "0.6348073", "0.62890124", "0.626582", "0.6239199", "0.6239199", "0.61385334", "0.61385334", "0.6126731", "0.6126731", "0.6126731", "0.6126731",...
0.6526811
2
Get the compatibility mode, compat = 0.11.
def get_compatibility_mode(args): _logger.debug('%s', where_am_i()) if 'compat' in args and args.compat is True: # Display information as version 0.11 for compatibility reasons for few settings. output_mode = 'compat' details = True compat_mode = 'compat' else: compat...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def proc_compat_mode(self):\n return self._get_val_str(_BP_CURRENT_PROC_MODE)", "def _get_mode(self):\n raise NotImplementedError()", "def _get_mode(self):\n return self.__mode", "def _get_mode(self):\n return self.__mode", "def _get_mode(self):\n return self.__mode", "def _get_mod...
[ "0.69162446", "0.631299", "0.6278357", "0.6278357", "0.6278357", "0.627819", "0.627819", "0.627819", "0.6230124", "0.6223067", "0.6174339", "0.6159548", "0.6146191", "0.61155295", "0.609986", "0.6057637", "0.6024683", "0.60135126", "0.6007982", "0.59821856", "0.595209", "0....
0.78435063
0
Initializes a sidpy dataset from an arraylike object (i.e. numpy array) All metadata will be set to be generically.
def from_array(cls, x, chunks=None, name=None, lock=False): # override this as a class method to allow sub-classes to return # instances of themselves # ensure array-like x = ensure_array_like(x) if hasattr(cls, 'check_input_data'): cls.check_input_data(x) #...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, data_array):\n # warn(\"Images and get_images are deprecated. Use Header.data(), \"\n # \"Header.xarray() or Header.xarray_dask() instead.\", stacklevel=3)\n self._data_array = data_array\n self._dtype = data_array.dtype\n self._shape = data_array.shape[1:...
[ "0.6647376", "0.6314116", "0.6283471", "0.6244524", "0.62232584", "0.6193558", "0.6061517", "0.60592496", "0.60373867", "0.60315204", "0.59913045", "0.59464896", "0.5913508", "0.5885144", "0.5876484", "0.58707637", "0.58670175", "0.58401734", "0.583273", "0.58303756", "0.5829...
0.60727805
6
Returns the ground truth annotations. Returns a dict with fields 'annot2', 'annot3', 'univ_annot3'
def train_ground_truth(sub, seq, fix_incorrect=True): annot = load(os.path.join(MPII_3DHP_PATH, "S%d" % sub, "Seq%d" % seq, "annot.mat")) annot2 = list( [ x[0].reshape((-1, 28, 2))[:, MUPOTS_RELEVANT_JOINTS].astype("float32") for x in annot["annot2"] ] ) a...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def annotations(self) -> Dict[str, Any]:\n if self._annotations is None:\n self._annotations = self.source._annotations(self._data)\n self._annotations.update(self._external_annotations)\n return self._annotations", "def createGroundTruthDictionary(original_images_dir, ground_...
[ "0.6245224", "0.6193796", "0.61918014", "0.61722785", "0.6159169", "0.6159169", "0.61471707", "0.6146966", "0.61176276", "0.60979736", "0.5998261", "0.59339917", "0.59339917", "0.5870913", "0.58481574", "0.58481574", "0.58481574", "0.58481574", "0.58481574", "0.58481574", "0....
0.0
-1
Reverses a number and returns the reversed number
def reverseInteger(self, n): result = 0 while n != 0: digit = n % 10 result += digit n /= 10 if n != 0: result *= 10 return result
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reverseNumber(number):\n if number < 10:\n return number\n\n \"\"\"\n general case\n reverseNumber(123) == 321\n\n general case closer to base case\n reverseNumber(12) = 21\n\n general case closer to base\n reverseNumber(1) = 1\n \"\"\"\n return conc...
[ "0.8085229", "0.79614884", "0.78875226", "0.74781543", "0.7423184", "0.7421715", "0.7391683", "0.7315321", "0.722142", "0.71471244", "0.68876815", "0.676433", "0.67589384", "0.67321086", "0.67177576", "0.6717208", "0.6646858", "0.6517361", "0.6465901", "0.6462642", "0.6438936...
0.7697207
3
Returns true or false depending on if the user can access the package. refreshaccess MUST be called before using this method.
def checkaccess(uuid): if 'id' in session: if session['type'] > 0: return True if uuid in session['access']: return True if uuid in globalaccess: return True return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def access_check(self):\n self.__cursor.execute(\"exec [payment].[Access_Check]\")\n access = self.__cursor.fetchone()\n # check AccessType and isSuperUser\n if access and (access[0] in (1, 2, 3) or access[1]):\n return True", "def _check_access(self):\r\n return sel...
[ "0.70871335", "0.70401263", "0.69094294", "0.69094294", "0.68437034", "0.66887236", "0.6608467", "0.6557536", "0.6534491", "0.6499788", "0.6465032", "0.64496034", "0.64496034", "0.64496034", "0.64496034", "0.64496034", "0.6416769", "0.639688", "0.6395023", "0.63755333", "0.63...
0.6044168
64
Returns a selection for content_type.
def content_type_selection(cls): default_types = [ ('html', 'HTML'), ('plain', 'Plain Text') ] if markdown: default_types.append(('markdown', 'Markdown')) if publish_parts: default_types.append(('rst', 'reStructured TeXT')) return...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def content_type(self) -> Optional[str]:\n return pulumi.get(self, \"content_type\")", "def content_type(self) -> Optional[str]:\n return pulumi.get(self, \"content_type\")", "def content_type(self) -> Optional[str]:\n return pulumi.get(self, \"content_type\")", "def get_content_type(sel...
[ "0.67842007", "0.67842007", "0.67842007", "0.6702025", "0.6698948", "0.6678254", "0.6678254", "0.6630097", "0.6544086", "0.6505059", "0.64263785", "0.6417432", "0.6402434", "0.6400939", "0.6366848", "0.6234769", "0.6198588", "0.6193439", "0.6148514", "0.613453", "0.60631317",...
0.7481511
0
Returns the article's publish date with timezone set as UTC
def atom_publish_date(self): return pytz.utc.localize( datetime.combine(self.published_on, datetime.min.time()) )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def publish_date(self):\n pass", "def pub_date(self):\n pub_date = getattr(self, 'PUBLISH_DATE', None)\n if not pub_date:\n pub_date = self.package.get('date')\n else:\n pub_date = datetime.fromisoformat(str(pub_date))\n\n return pub_date", "def __get_ut...
[ "0.7144798", "0.71314096", "0.68822443", "0.67269605", "0.6700088", "0.66903794", "0.6528048", "0.6491543", "0.64633167", "0.6441666", "0.6418921", "0.6414844", "0.6414844", "0.6414844", "0.6414844", "0.6413079", "0.6398737", "0.63855004", "0.63855004", "0.63855004", "0.63855...
0.7968329
0
Creates a Board object and connects to the physical board.
def __init__(self, ser_port=False, verbose=True): self.servo1 = 0 self.servo2 = 1 self.led1 = 2 self.led2 = 3 self.pot = 4 self.photo = 5 self.photo_min = 30 self.photo_max = 210 self.pot_min = 0.25 self.pot_max = 234 self.min_se...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_board():\n db.session.add(\n Board(\n name='board_name',\n url=f\"https://trello.com/b/{default_board_id}\",\n trello_board_id=default_board_id\n )\n )", "def create_board(self, context, board_obj, location_obj, topic=None):\n cctxt = self.cl...
[ "0.71168894", "0.6868745", "0.67524976", "0.6669997", "0.6599002", "0.6572575", "0.6455824", "0.62565094", "0.6191773", "0.61483866", "0.6084053", "0.60040987", "0.5934102", "0.5904426", "0.59033716", "0.5879579", "0.5842641", "0.5797672", "0.5781407", "0.5749169", "0.5739148...
0.0
-1
Gets the normalized level of the photocell.
def get_photo(self): photo = self.device.get_position(self.photo) photo = util.normalize(photo, self.photo_min, self.photo_max) return photo
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_level(self):\r\n \r\n return self.level", "def get_level(self):\r\n \r\n return self.level", "def get_level(self):\n return self.level", "def get_level(self):\n return self.level", "def GetLuminosity(self):\n return self._lumi", "def GetLevel(self...
[ "0.6724022", "0.6719574", "0.6645291", "0.6645291", "0.6561495", "0.652182", "0.652182", "0.64907366", "0.6379767", "0.6345278", "0.6345278", "0.6345278", "0.63296443", "0.6325932", "0.62843037", "0.62775767", "0.62723124", "0.6263792", "0.6201518", "0.61931616", "0.6178845",...
0.0
-1
Get the normalized level of the potentiometer.
def get_pot(self): pot = self.device.get_position(self.pot) pot = 1 - util.normalize(pot, self.pot_min, self.pot_max) return pot
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_raw():\n # TODO: Find out why this could often fail when plugged.\n battery = ps.sensors_battery()\n if battery is None:\n return None\n plugged = battery.power_plugged\n percent = int(battery.percent)\n\n if plugged:\n return Level.PLUGGED, percent\n for threshold, level...
[ "0.64825064", "0.6383464", "0.637209", "0.63685584", "0.6367175", "0.63559663", "0.63553", "0.63553", "0.6301267", "0.6265663", "0.6261121", "0.62389284", "0.62342876", "0.6218474", "0.6217822", "0.6216103", "0.6195013", "0.6195013", "0.61461955", "0.6124762", "0.6122612", ...
0.64309204
1
Function to calibrate the potentiometer. A number of measurements will be taken. The recorded minimum and maximum values are used to normalize subsequent measurements.
def calibrate_pot(self): print('Calibrating pot', end='') mn, mx = self.calibrate_channel(self.pot, 10) self.pot_min = mn self.pot_max = mx return mn, mx
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def scale_and_calibrate_data(cls, data, min_voltage, max_voltage, calib):\n slope, offset = calib\n full_scale = max_voltage - min_voltage\n cal_data = data * float(slope) + offset\n return (cal_data / cls.max_counts) * full_scale + min_voltage", "def caliberateMagApprox(self):\n\n\t\...
[ "0.67539376", "0.6620612", "0.6496768", "0.64744884", "0.62818915", "0.6125373", "0.6064287", "0.606392", "0.6022021", "0.5948087", "0.5696387", "0.56133795", "0.5593272", "0.55342853", "0.5518593", "0.5514391", "0.55140376", "0.54973304", "0.5464038", "0.5441289", "0.5435439...
0.7331789
0
Constructs all the necessary attributes for the Book object.
def __init__(self, author, title): self.author = author self.title = title
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, title, author=\"\"):\n self.title = title.strip()\n self.author = author.strip()\n self.highlights = [] # array of Highlight objects for this book\n self.notes = [] # array of Note objects for this book\n self.bookmarks = [] # array of Bookmark objects fo...
[ "0.6633125", "0.63589317", "0.6097438", "0.60237527", "0.59778875", "0.5962193", "0.5933252", "0.59011024", "0.58880776", "0.5854666", "0.5849335", "0.5779639", "0.5764465", "0.5740271", "0.5740271", "0.5728261", "0.56912315", "0.56623757", "0.56577533", "0.56321466", "0.5613...
0.58488524
11
Partition the grid with the given polygons. Each node (not element) will be assigned with an integer ID which is the index of the polygons. If some polygons overlap, the latter one will trump the former one. The area that are not covered by any of the given polygons will have a default negative one attribute.
def apply_polygons(self, polygons, default): mesh = self.mesh if default is None: # Use depth attr = np.copy(mesh.nodes[:, 2]) else: # Fill default values val = float(default) attr = np.empty(mesh.n_nodes()) attr.fill(val) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_prop_partitioning(self, prop_fname, polygons, default):\n # option_name = 'default'\n # # default = polygon_data[option_name]\n # polygons = polygon_data['polygons']\n # attr = self._partition_nodes_with_polygons(polygons, default)\n attr = self.apply_polygons(polygons...
[ "0.6169566", "0.58743316", "0.5839235", "0.5590016", "0.5577185", "0.5546009", "0.55235314", "0.5494252", "0.5365927", "0.5364703", "0.52698153", "0.5215449", "0.5196684", "0.5174251", "0.5165703", "0.5150928", "0.5148725", "0.5127414", "0.5124237", "0.5080956", "0.5071533", ...
0.5833047
3
Convert FWHM to sigma.
def fwhm_to_sigma(fwhm): return fwhm/np.sqrt(8.*np.log(2.))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fwhm_to_sigma(fwhm):\n return fwhm/2.3548200450309493", "def fwhm2sigma(fwhm):\n return fwhm / F2S", "def fwhm2sigma(fwhm):\r\n sigma = fwhm / np.sqrt(8 * np.log(2))\r\n\r\n return sigma", "def fwhm2sigma(fwhm):\n fwhm = np.asarray(fwhm)\n return fwhm / np.sqrt(8 * np.log(2))", "def s...
[ "0.87909365", "0.8611886", "0.8523744", "0.83599085", "0.787207", "0.7799253", "0.7529526", "0.7503916", "0.74758697", "0.735287", "0.6900201", "0.6841092", "0.683774", "0.66094327", "0.65992236", "0.65763885", "0.657233", "0.6511022", "0.64781094", "0.64465815", "0.64358073"...
0.8598816
2
Replaces the given line with new content
def replace_line(self, line_no, content): lines = self.source.split('\n') lines[line_no - 1] = content self.source = '\n'.join(lines) return self
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def replace_line(self, position, line):\n position = self.positive_position(position)\n\n new_line = deepcopy(line)\n if self.starting_line_number != -1:\n new_line.line_number = position + self.starting_line_number - 1\n\n self.lines[position - 1] = new_line\n self.re...
[ "0.7693365", "0.7474239", "0.7226491", "0.7138802", "0.7096281", "0.70855737", "0.6946077", "0.69018763", "0.6809908", "0.67997456", "0.6789797", "0.6743306", "0.67295516", "0.6672248", "0.6609853", "0.65764624", "0.65386593", "0.6468915", "0.64524615", "0.6443832", "0.641973...
0.84776294
0
Removes a consistent amount of leading whitespace from the front of each line so that at least one line is leftjustified.
def left_justify(self): lines = self.source.split('\n') leads = [len(line) - len(line.lstrip()) for line in lines if \ len(line.strip())] if not leads: # only blank lines, do nothing return min_lead = min(leads) output = [] for line in...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def calculateLeadingSpaces(self, lines : list):\n return [len(line) - len(line.lstrip()) for line in lines]", "def _lstrip_common_spaces(self, lines):\n result = lines\n space_counters = [len(re.findall(r'^ +', line)[0])\n for line in result\n ...
[ "0.69915", "0.69257736", "0.6830057", "0.6687389", "0.64307046", "0.63484776", "0.62568676", "0.6230539", "0.60550237", "0.6050083", "0.6050083", "0.60272443", "0.59978396", "0.59921896", "0.5981439", "0.5924336", "0.5914546", "0.5912686", "0.5912686", "0.5894476", "0.5874706...
0.78437006
0
Compute metrics using `policy` on the `environment`.
def compute(metrics, environment, policy, num_episodes=1): for metric in metrics: metric.reset() time_step = environment.reset() policy_state = policy.get_initial_state(environment.batch_size) driver = py_driver.PyDriver( environment, policy, observers=metrics, max_steps=None, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def policy_improvement(env, policy_eval_fn=policy_eval, discount_factor=1.0):\r\n\r\n def one_step_lookahead(state, value):\r\n A = np.zeros(env.nA)\r\n for action in range(env.nA):\r\n for prob, next_state, reward, done in env.P[state][action]:\r\n A[action] += reward + ...
[ "0.63020283", "0.627283", "0.6271702", "0.6266049", "0.61902726", "0.61738807", "0.61683685", "0.6135458", "0.6050462", "0.6050462", "0.60479426", "0.60088176", "0.596", "0.5935327", "0.5928812", "0.59174", "0.59082043", "0.5882533", "0.58671594", "0.5856935", "0.58405864", ...
0.6930345
0
Compute metrics using `policy` on the `environment` and logs summaries.
def compute_summaries( metrics, environment, policy, num_episodes=1, global_step=None, tf_summaries=True, log=False, callback=None, ): results = compute(metrics, environment, policy, num_episodes) if tf_summaries: py_metric.run_summaries(metrics) if log: log_metrics(metrics...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def compute(metrics, environment, policy, num_episodes=1):\n for metric in metrics:\n metric.reset()\n\n time_step = environment.reset()\n policy_state = policy.get_initial_state(environment.batch_size)\n\n driver = py_driver.PyDriver(\n environment,\n policy,\n observers=metrics,\n max_...
[ "0.6582819", "0.61635566", "0.5851859", "0.58326507", "0.57591605", "0.57539207", "0.57516176", "0.57424545", "0.5643185", "0.56361204", "0.5616474", "0.56083167", "0.5572986", "0.5562487", "0.5561402", "0.5550704", "0.55041313", "0.5495346", "0.5488028", "0.54854304", "0.546...
0.6555621
1
Compute metrics using `policy` on the `environment`.
def eager_compute( metrics, environment, policy, num_episodes=1, train_step=None, summary_writer=None, summary_prefix='', use_function=True, ): for metric in metrics: metric.reset() time_step = environment.reset() policy_state = policy.get_initial_state(environment.batch_size)...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def compute(metrics, environment, policy, num_episodes=1):\n for metric in metrics:\n metric.reset()\n\n time_step = environment.reset()\n policy_state = policy.get_initial_state(environment.batch_size)\n\n driver = py_driver.PyDriver(\n environment,\n policy,\n observers=metrics,\n max_...
[ "0.6929332", "0.6298381", "0.62705183", "0.6270459", "0.6262302", "0.6188892", "0.6171186", "0.6166935", "0.6134776", "0.6048643", "0.6048643", "0.6046618", "0.60081244", "0.5959026", "0.5934324", "0.5926076", "0.59164935", "0.59057283", "0.5880923", "0.58651364", "0.5856046"...
0.5498534
49
Normalizes a serial Will uppercase it, remove its dashes and strip any whitespace
def normalize_serial(serial): return serial.upper().replace("-", "").strip()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _normalize(str_data):\n return str_data.lower()", "def get_normalized_data(self, data):\n return unicodedata.normalize('NFKD', data).encode('ascii', 'ignore').decode('utf-8')", "def to_flat_case(input):\n return input.replace(\"_\", \"\")", "def normalize_name (cls, n):\n n = n.re...
[ "0.6381578", "0.5997318", "0.59630084", "0.5901779", "0.588999", "0.58846784", "0.5846494", "0.5811267", "0.5805237", "0.5804368", "0.57859105", "0.57034767", "0.56597793", "0.56505096", "0.5642506", "0.5639749", "0.56366545", "0.5632387", "0.5629907", "0.5613008", "0.5591695...
0.7036912
0
Formatage correct de nombre d'un produit.
def facteur(a): if a < 0 : retour = "(" + str(a) + ")" else : retour = a return retour # vive le type dynamique de python !!
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __str__(self):\n return '%s (%s) %s %s' % (self.inventario.producto.nombre, self.cantidad, self.precio, self.importe)", "def __str__(self):\n return '%s (%s) %s %s' % (self.factura, self.proveedor.nombre, self.fecha, self.total)", "def getNom(self):\r\n if ( self.Valeur > 1 and self.Va...
[ "0.62850875", "0.6271982", "0.619661", "0.61556184", "0.60553724", "0.6021913", "0.60210603", "0.60124606", "0.591143", "0.5877077", "0.58365726", "0.5765221", "0.57481307", "0.57379824", "0.56851256", "0.56813073", "0.5664062", "0.56473666", "0.56418467", "0.56402", "0.56354...
0.0
-1
Move right gripper to position with max_effort
def go_right_gripper(self, position, max_effort): ope = Pr2GripperCommand() ope.position = position ope.max_effort = max_effort self.r_gripper_pub.publish(ope)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def right(self):\r\n self.set_position(2, self.currentPosition[2] - self.rightOffset, 1000, wait=True)\r\n sleep(0.8)", "def move_right(self):\n # We use the global walking action array to keep track of current walking action\n # and we also use it to move back and forth between diffe...
[ "0.66955024", "0.66008776", "0.6562718", "0.6540695", "0.65159184", "0.65126646", "0.64930165", "0.64521885", "0.6427928", "0.639325", "0.6365123", "0.6339545", "0.6331302", "0.63253725", "0.6304755", "0.62741435", "0.62607193", "0.6197969", "0.61945117", "0.61567307", "0.614...
0.70668936
0
Raise exception if value is not a String type.
def validate_ipaddress(cls, value: str, field: ModelField) -> str: try: ipaddress.ip_address(value) except ValueError as ex: raise InvalidInput(field.name, f'Invalid IP Address provided ({value}).') from ex return value
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _checkstr(x):\n if not isinstance(x, str):\n raise ValueError(\"%r is not a str.\" % (x,))", "def value_is_string(value) -> bool:\n return isinstance(value, str)", "def check_validity(self, field_name, value):\n if not isinstance(value, str):\n raise ValidationError(f'{field_...
[ "0.757534", "0.7479632", "0.746383", "0.7385244", "0.7209079", "0.7126734", "0.7110839", "0.7061432", "0.7011436", "0.69551337", "0.6940708", "0.6854039", "0.67933524", "0.6782876", "0.6779923", "0.6748794", "0.67320544", "0.67296916", "0.6721011", "0.66843677", "0.66757345",...
0.0
-1
Resize the img to given width and height
def Resize(src, width, height): new = cv2.resize(src, (width, height)) return new
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def resize_image(img, width, height):\n return resize_image_from_to(img, {\n 'width': {'min': width, 'max': width},\n 'height': {'min': height, 'max': height},\n })", "def resize_image(image, width, height):\n return image.resize([width, height], Image.BILINEAR)", "def resize(img, height...
[ "0.8257691", "0.7954674", "0.781877", "0.7805153", "0.7730518", "0.7669794", "0.76075876", "0.7554872", "0.7481041", "0.7464274", "0.7428062", "0.74065465", "0.7397972", "0.73655397", "0.73602736", "0.73234093", "0.73050404", "0.7260735", "0.7247877", "0.72444373", "0.7237279...
0.7414144
11
Returns a dict representing this LatexStringSvgImageDimensions domain object.
def to_dict(self): return { 'encoded_height_string': self.encoded_height_string, 'encoded_width_string': self.encoded_width_string, 'encoded_vertical_padding_string': ( self.encoded_vertical_padding_string) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_dict(self):\n return {\n 'raw_image': self.raw_image,\n 'latex_string_svg_image_dimensions': (\n self.latex_string_svg_image_dimensions.to_dict()),\n }", "def GetDimensions(self):\n ...", "def GetDimensions(self):\n ...", "def to_diction...
[ "0.7781249", "0.6081751", "0.6081751", "0.6056569", "0.6038611", "0.5849872", "0.58409786", "0.5799568", "0.5795404", "0.5777126", "0.5773527", "0.5762246", "0.5745803", "0.5744036", "0.57427984", "0.5697348", "0.56935185", "0.56924814", "0.56918603", "0.56616473", "0.5661183...
0.52544814
65
Returns the number of ones in the byte array
def _count_set_bits(b): # type: (bytes) -> int raise DeprecationWarning("This method is as it stands not functional... there is no way to reconcile this.")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def onesNumber(self):\n onemask = self.onmask & ~self.dcmask\n ones_number = 0\n while onemask > 0:\n ones_number += onemask & 1\n onemask >>= 1\n return ones_number", "def byte_count(a, frac=False):\n\n a = _cast_uint8_ndarray(a)\n\n count = numpy.zeros((2...
[ "0.7161704", "0.6900766", "0.68521476", "0.6711122", "0.66316956", "0.66283804", "0.66163915", "0.65956986", "0.6573969", "0.6489232", "0.6464627", "0.63792443", "0.6366417", "0.6357207", "0.63568884", "0.6352645", "0.63013977", "0.6266338", "0.6238004", "0.622288", "0.621884...
0.6020901
46
Convert a tuple to torch.FloatTensor.
def get(self, tpl): if self.use_semantic and self.use_visual: tpl_s = self.semantic_data(tpl) tpl_v = self.visual_data(tpl) return tpl_v, tpl_s if self.use_visual: return self.visual_data(tpl) if self.use_semantic: return self.semantic_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def numpy2floattensor(arrays, device_):\n\n if isinstance(arrays, tuple): # check Tuple or not\n tensors = []\n for array in arrays:\n tensor = torch.from_numpy(array).to(device_, non_blocking=True).float()\n tensors.append(tensor)\n return tuple(tensors)\n tensor ...
[ "0.73923284", "0.66227317", "0.6460512", "0.61993295", "0.6196491", "0.6196491", "0.6055947", "0.6020667", "0.6000439", "0.5981488", "0.59303606", "0.5923798", "0.5922098", "0.59028226", "0.588354", "0.5835076", "0.5831835", "0.5830118", "0.58256614", "0.57731366", "0.5743912...
0.0
-1
Return the size of dataset.
def __len__(self): return dict( TupleOnly=self.num_posi, PosiOnly=self.num_posi, # all positive tuples NegaOnly=self.ratio * self.num_posi, # all negative tuples PairWise=self.ratio * self.num_posi, )[self.param.data_mode]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_dataset_size(self):\n return len(self.dataset)", "def __len__(self):\n return self.dataset_size", "def __len__(self):\n return self.dataset_size", "def getSize(self, dataset):\n dic = {'train': 'X_train', 'val': 'X_val', 'test': 'X_test'}\n dataset_= dic[dataset]\n ...
[ "0.9161218", "0.85280144", "0.85280144", "0.8220189", "0.8203053", "0.8189529", "0.80502176", "0.80147016", "0.79941183", "0.79878557", "0.79358596", "0.79221326", "0.79221326", "0.7878539", "0.7857059", "0.7810753", "0.77710104", "0.77424186", "0.7738813", "0.7736823", "0.77...
0.0
-1
Get number of samples.
def num_sample(self): return len(self.dataset)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def GetNumberOfSamples(self):\n ...", "def n_samples(self):\n return self.__n_samples", "def n_samples(self):\n return self.__n_samples", "def num_samples(self):\n return self.samples.shape[0]", "def getSampleCount(self): # real signature unknown; restored from __doc__\n ...
[ "0.8846206", "0.8465307", "0.8465307", "0.82769805", "0.8193804", "0.8080354", "0.8061074", "0.805161", "0.8008568", "0.7988444", "0.78586465", "0.7826503", "0.7803582", "0.7787834", "0.7765732", "0.77228546", "0.7718289", "0.77150196", "0.76827115", "0.76726484", "0.7631111"...
0.83601123
4
Set the mode for generating negative outfits.
def set_nega_mode(self, mode): self.dataset.set_nega_mode(mode) return self
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_nega_mode(self, mode):\n assert mode in [\n \"RandomOnline\",\n \"RandomFix\",\n \"HardOnline\",\n \"HardFix\", # not implemented\n ], \"Unknown negative mode.\"\n if self.param.data_mode == \"PosiOnly\":\n LOGGER.warning(\n ...
[ "0.6964418", "0.6105478", "0.5990641", "0.58394384", "0.58174586", "0.5809393", "0.57892066", "0.5764205", "0.56632954", "0.5612319", "0.5591388", "0.5562804", "0.5548994", "0.5541847", "0.55230755", "0.55181223", "0.55181223", "0.5512454", "0.548829", "0.54316723", "0.541931...
0.52377576
46
Return the size of dataset.
def __len__(self): return len(self.fitb) * self.param.num_cand
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_dataset_size(self):\n return len(self.dataset)", "def __len__(self):\n return self.dataset_size", "def __len__(self):\n return self.dataset_size", "def getSize(self, dataset):\n dic = {'train': 'X_train', 'val': 'X_val', 'test': 'X_test'}\n dataset_= dic[dataset]\n ...
[ "0.91626865", "0.8529227", "0.8529227", "0.8219621", "0.82037693", "0.81893665", "0.80497956", "0.80138797", "0.7993073", "0.79875517", "0.79349107", "0.79234165", "0.79234165", "0.78787535", "0.7857298", "0.7812368", "0.77708775", "0.774228", "0.7740162", "0.7737073", "0.770...
0.0
-1
Get number of samples.
def num_sample(self): return len(self.dataset)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def GetNumberOfSamples(self):\n ...", "def n_samples(self):\n return self.__n_samples", "def n_samples(self):\n return self.__n_samples", "def num_samples(self):\n return self.samples.shape[0]", "def getSampleCount(self): # real signature unknown; restored from __doc__\n ...
[ "0.88440776", "0.8463131", "0.8463131", "0.82760346", "0.8192188", "0.80811447", "0.80602217", "0.8050014", "0.80090463", "0.798936", "0.7857164", "0.7824543", "0.7802626", "0.7787179", "0.7763743", "0.77231544", "0.7717394", "0.7713488", "0.7680124", "0.76724714", "0.7630795...
0.8360195
3
Return cluster id assigned to specified image.
def classifier(image_path: str, vae_model_path: str, kmeans_model_path: str) -> str: _classifier = _Classifier(vae_model_path, kmeans_model_path) return _classifier.classify_image(image_path)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cluster_id(self) -> str:\n return pulumi.get(self, \"cluster_id\")", "def cluster_id(self) -> str:\n return pulumi.get(self, \"cluster_id\")", "def cluster_id(self) -> str:\n return pulumi.get(self, \"cluster_id\")", "def cluster_id(self) -> str:\n return pulumi.get(self, \"cl...
[ "0.72174215", "0.72174215", "0.72174215", "0.72174215", "0.72174215", "0.72174215", "0.7102279", "0.6966505", "0.6912915", "0.69094265", "0.6874374", "0.67815155", "0.6760238", "0.672631", "0.66966355", "0.6668058", "0.66253114", "0.6623453", "0.65879154", "0.65735954", "0.65...
0.0
-1
Load image as gray scale image and resize it to 100 x 100 while keeping aspect ratio. Return tensor representing the image.
def load_image_as_tensor(path): image = Image.open(path).convert('L') im_size = 100 # Resize image, keeping aspect ratio, such that # smaller side of the image is set to 100 px. width, height = image.size if width > height: ratio = width / height new_w, new_h = (int(0.5 + im_si...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_img(img_path):\n img = Image.open(img_path)\n img = transforms.Resize((256, 256))(img)\n img = transforms.ToTensor()(img)\n return img", "def load_img(self, path_to_img):\n max_dim = 512\n image = tf.io.read_file(path_to_img)\n image = tf.image.decode_jpeg(image)\n ...
[ "0.7058954", "0.6932628", "0.65625477", "0.64995563", "0.64741063", "0.6422165", "0.62962884", "0.6286053", "0.62706417", "0.6249273", "0.6232124", "0.62274325", "0.61894214", "0.6167747", "0.61574787", "0.6118154", "0.6092273", "0.60463214", "0.6044613", "0.6023309", "0.6005...
0.6725482
2
Get the instance type
def instance_type(self) -> str: return self._instance_type
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_instance_type(self):\n return self._instance_type", "def instance_type(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"instance_type\")", "def instance_type(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"instance_type\")", "def instance_type(self) -> Optional[s...
[ "0.8907175", "0.86248016", "0.86248016", "0.85710084", "0.84573114", "0.8371172", "0.8371172", "0.8250385", "0.8229767", "0.8099546", "0.8094105", "0.80683523", "0.79907584", "0.79907584", "0.7970997", "0.7930776", "0.7927685", "0.7927685", "0.7927685", "0.7927685", "0.792768...
0.8816196
1
Convert bounding box to format `(center x, center y, aspect ratio, height)`, where the aspect ratio is `width / height`.
def tlwh_to_xyah(tlwh): ret = np.asarray(tlwh).copy() ret[:2] += ret[2:] / 2 ret[2] /= (ret[3] + 1e-6) return ret
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def bbox_to_dimensions(self, boundingBox):\n vertices = {'x': [vertex['x'] for vertex in boundingBox['vertices']],\n 'y': [vertex['y'] for vertex in boundingBox['vertices']]}\n top_left = (min(vertices['x']), min(vertices['y']))\n bottom_right = (max(vertices['x']), max(vert...
[ "0.7188477", "0.6849131", "0.6754527", "0.66521955", "0.66163313", "0.6610305", "0.6584023", "0.6584023", "0.65675825", "0.6565043", "0.6523915", "0.647625", "0.64595157", "0.6455091", "0.64283204", "0.6421567", "0.64020556", "0.6364129", "0.6336139", "0.63341564", "0.6311825...
0.0
-1
Returns a gid, given a group name.
def _get_gid(self, name): # Stolen from the python3 shutil lib if getgrnam is None or name is None: return None try: result = getgrnam(name) except KeyError: result = None if result is not None: return result[2] return None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def group_from_name_or_id(gname):\n\n if RE_INT.match(gname):\n try:\n gid = int(gname)\n group = Group.objects.get(id=gid)\n return group\n except Group.DoesNotExist:\n print(\"group with id {} does not exist.\".format(str(gid)))\n return Non...
[ "0.749295", "0.74705285", "0.7273469", "0.72665864", "0.7107558", "0.7080037", "0.7075105", "0.70249957", "0.69255805", "0.68836504", "0.6857298", "0.6817446", "0.6778141", "0.6685691", "0.66415805", "0.65568244", "0.6503734", "0.6502485", "0.6360332", "0.63008904", "0.628631...
0.76161134
0
Return the path of the scikitmine data home directory. This folder is used by some large dataset loaders to avoid downloading data several times. By default, ``data_home`` is ./scikit_mine_data/ Alternatively, it can be set by the SCIKIT_MINE_DATA environment variable or programmatically by giving an explicit folder pa...
def get_data_home(data_home=None): import skmine sk_path = skmine.__file__ # example sk_path = '/home/username/codes/sk_root/skmine/__init__.py' sk_root = os.path.dirname(os.path.dirname(sk_path)) # sk_root = '/home/username/codes/sk_root if data_home is None: data_home = os.environ.get("SCIK...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_data_home(data_home: Optional[str] = None):\n if data_home is None:\n data_home = environ.get('SCIKIT_NETWORK_DATA',\n join('~', 'scikit_network_data'))\n data_home = expanduser(data_home)\n if not exists(data_home):\n makedirs(data_home)\n return da...
[ "0.82743496", "0.8263821", "0.8162122", "0.74213564", "0.7210149", "0.68548757", "0.6844865", "0.67610925", "0.6722368", "0.6605745", "0.66038185", "0.65850574", "0.65668154", "0.65541804", "0.6550587", "0.6442231", "0.64392656", "0.64312416", "0.64306676", "0.639628", "0.637...
0.8812833
0
Check for collisions with the bullets and zombies and handle the collision called in director in update method
def bullet_zombie_collision(self, player_sprites, zombie_modifier): player = player_sprites['player'][0][0] bullet_list = player_sprites['bullet'][0] zombie_list = player_sprites['zombie'][0] walls = player_sprites['wall'][0] zombie_count = zombie_modifier[0] move_modifie...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_collisions(self):\r\n\r\n # NOTE: This assumes you named your targets list \"targets\"\r\n\r\n for asteroid in self.asteroids:\r\n\r\n # Make sure they are both alive before checking for a collision\r\n if self.ship.alive and asteroid.alive:\r\n too_...
[ "0.76836866", "0.73810965", "0.7304763", "0.72763944", "0.71915096", "0.71859676", "0.71041405", "0.7102643", "0.7090513", "0.7039563", "0.7034033", "0.69768476", "0.6967274", "0.69275916", "0.68919235", "0.68844086", "0.6836411", "0.67326176", "0.663936", "0.6629563", "0.662...
0.7479595
1
This method moves the cursor relatively from the current
def mvc(self, i, refresh=True): if i == 0: return False y, x = self.scr.getyx() if self.is_end_of_the_line and i < 0: return False if x == self.ix and y == self.iy and i >= 1: return False s_width = list(map(self._get_width, self.s)) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def move(self):\n self.cursor.forward(self.distance_per_loop)", "def move_cursor (self, view, blockno, line, oldpos, delta):\n\t\tpass", "def move_focus(self, relative: int) -> None:\n return self.set_focus(self.focus + relative)", "def mmove(point):\n win32api.SetCursorPos(point)", "def s...
[ "0.7544186", "0.7454761", "0.7058645", "0.70549965", "0.6916974", "0.68296117", "0.6668577", "0.6624391", "0.6616972", "0.65672845", "0.65613216", "0.6545663", "0.6531895", "0.64913744", "0.64800227", "0.64740103", "0.6446004", "0.64251745", "0.64124656", "0.64123523", "0.640...
0.0
-1
Returns the uuid of the strategy
def uuid(self): return self._uuid
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_uuid():\n return str(uuid.uuid4())", "def uuid(self) -> str:\n return self.__uuid", "def get_uuid(self):\n return self.__uuid", "def get_uuid(self):\n return self.__uuid", "def uuid(self) -> str:\n return self._uuid", "def uuid(self) -> str:\n return self...
[ "0.7376247", "0.7141793", "0.713637", "0.713637", "0.70244896", "0.70244896", "0.7017564", "0.70106053", "0.68286276", "0.6773216", "0.6757132", "0.67252815", "0.67071486", "0.6662601", "0.6632977", "0.6613209", "0.6592937", "0.6592937", "0.6566138", "0.6535967", "0.65300614"...
0.6857691
13
Initializes a strategy object using the given dictionary
def from_dict(self, data, build_phase=None, apply_phase=None, abort_phase=None): Strategy.__init__(self, data['uuid'], data['name'], data['state'], data['current_phase'], build_phase, apply_phase, abort_phase) return self
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, **kwargs):\n self.from_dict(kwargs)", "def build_strategy(self):\n self.strategy_cls = self._build_strategy(parameters=None)", "def test__init__(self):\n assert Strategy(\n location=self.location,\n mint_quantities=[1, 1, 1, 1, 1, 1, 1, 1, 1, 1],\n ...
[ "0.6372205", "0.62205267", "0.6164918", "0.6110043", "0.6095712", "0.60892385", "0.6069646", "0.6069646", "0.6069646", "0.6069646", "0.6069646", "0.6069646", "0.6069646", "0.6069646", "0.6069646", "0.6069646", "0.6069646", "0.6069646", "0.6069646", "0.6069646", "0.6069646", ...
0.6946274
0
Represent the strategy as json
def as_json(self): return json.dumps(self.as_dict())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def serialize(self):\n return {\n 'id': self.id,\n 'strategy': self.strategy\n }", "def as_json(self):\n d = {\n \"name\": self.name,\n \"resourceType\": 'AccessStrategy'\n }\n d[\"function_details\"] = (\n json.loads(self....
[ "0.73521787", "0.7116586", "0.6831241", "0.6831241", "0.6722991", "0.6655302", "0.66093695", "0.6537481", "0.65149236", "0.63894814", "0.635807", "0.6325918", "0.63169575", "0.62965745", "0.6265333", "0.6247607", "0.62475747", "0.62402034", "0.6237908", "0.62252015", "0.62231...
0.5821926
95
Returns True if n is prime and False otherwise
def isprime(n): if not isinstance(n, int): raise TypeError("argument passed to is_prime is not of 'int' type") if n < 2: return False if n == 2: return True max = int(math.ceil(math.sqrt(n))) i = 2 while i <= max: if n % i == 0: return False i += 1 return True
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def isprime(n):\n if prime(n):\n return True\n else:\n return False", "def isprime(n):\n if prime(n):\n return True\n else:\n return False", "def _isPrime(cls, n):\n if n == 1: return False\n for i in range(2,int(n**0.5)+1):\n if n % i == 0: retu...
[ "0.8704245", "0.8704245", "0.8656353", "0.8583804", "0.8580866", "0.8577379", "0.85112554", "0.85096157", "0.8509463", "0.85062796", "0.8491008", "0.849011", "0.8483346", "0.84739", "0.8453072", "0.8450206", "0.84457284", "0.84449726", "0.84375614", "0.8436109", "0.84322864",...
0.8510455
7
Ensure language is either en or cn
def verify_lang(lang): assert lang in ('en', 'cn'), "Parameter `lang` should be either `en` or `cn`, got `{}` instead.".format(lang)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_lang(char):\n if not char or not char.isalpha():\n return None\n char = char[0]\n if char.isalpha() and not (char.islower() or char.isupper()):\n lang = 'AR'\n else:\n lang = 'FW'\n return lang", "def test_guess_domain_language_for_sms_2(self):\n lang = guess_d...
[ "0.6936937", "0.6720353", "0.66955405", "0.66485935", "0.66226906", "0.65729517", "0.6557256", "0.6549615", "0.6521315", "0.6493704", "0.6401056", "0.63938034", "0.63720876", "0.6361977", "0.6358406", "0.6346796", "0.63233495", "0.63022023", "0.62952775", "0.626523", "0.61851...
0.7920675
0
Returns a list of primes < n
def primes(n): sieve = [True] * n for i in range(3,int(n**0.5)+1, 2): if sieve[i]: sieve[i*i::2*i]=[False] * ((n-i*i-1)//(2*i)+1) return [2] + [i for i in range(3, n, 2) if sieve[i]]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __primes(n):\n \"\"\" https://stackoverflow.com/questions/2068372/fastest-way-to-list-all-primes-below-n-in-python/3035188#3035188\"\"\"\n sieve = [True] * n\n for i in range(3, int(n ** 0.5) + 1, 2):\n if sieve[i]:\n sieve[i * i::2 * i] = [False] * int(((n - i * ...
[ "0.858299", "0.84117824", "0.815152", "0.8138249", "0.8125237", "0.81219095", "0.811765", "0.8032863", "0.8007576", "0.7977227", "0.79532224", "0.7946233", "0.7945569", "0.7942153", "0.79355", "0.79203624", "0.78926307", "0.78637457", "0.7836931", "0.7792363", "0.77584374", ...
0.7958955
10
Generate a random file name, but keep file extension and subdirectory.
def unique_file_path(instance, filename): if '/' in filename: # Extract subdirectory. subdir = filename.rsplit('/', 1)[0] # Split once, searching from end of string. else: subdir = '' extension = filename.split('.')[-1] # Extract file extension. new_filename = '{}.{}'.format(uuid.uuid4()...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def random_file_name():\n return ''.join(random.choice(string.ascii_uppercase) for _ in range(8))", "def get_random_filename(ext, prefix=\"\"):\n # hex returns a string with no dashes\n return prefix + str(uuid.uuid4().hex) + ext", "def generate_random_filename(self, filename):\n\n return \"\"....
[ "0.84594804", "0.83283645", "0.8287158", "0.81511176", "0.8141514", "0.8141514", "0.80910677", "0.7782772", "0.7781332", "0.7749681", "0.76624143", "0.7617273", "0.7526884", "0.7444857", "0.7351181", "0.7351181", "0.7286003", "0.71746486", "0.7158765", "0.71510565", "0.707930...
0.67782724
41
Creates a unique id for sharing experiments.
def generate_share_id(): uuid = shortuuid.uuid() # Generates 22 digit uuid. short_uuid = uuid[:5] # Truncate to reasonable length. return short_uuid
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _generate_id(self):\n return uuid.uuid4().hex", "def unique_instance_id():\n return f'test-instance-{uuid.uuid4().hex[:10]}'", "def _generate_submit_id():\n timestamp = int(time())\n return \"%d-%05d\" % (timestamp, random.randint(0, 99999))", "def _generate_unique_id(self):\n retu...
[ "0.6858956", "0.6830513", "0.6731263", "0.6693706", "0.66774875", "0.6652791", "0.66502166", "0.66387326", "0.66273564", "0.6620247", "0.6608805", "0.6597435", "0.65734816", "0.65710443", "0.65295", "0.6527764", "0.6526002", "0.6521797", "0.6476658", "0.64574724", "0.64470136...
0.71774805
0
Checks whether dungeon map has tile with specified coordinates.
def is_position_in_map(dmap, pos_x, pos_y): map_height = len(dmap) map_width = len(dmap[0]) is_inside = (pos_x >= 0 and pos_y >= 0 and pos_x < map_width and pos_y < map_height) return is_inside
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def tileExist(x, y, maxX, maxY):\n # if the x and y values are in the map\n if x >= 0 and y >= 0:\n if x <= maxX and y <= maxY:\n return True\n else:\n return False", "def is_visible_tile(x, y):\n global my_map\n if x >= MAP_WIDTH or x < 0:\n return False\n elif ...
[ "0.82876486", "0.7135815", "0.6916736", "0.6879143", "0.6844708", "0.6833069", "0.68177795", "0.6765254", "0.675295", "0.67039675", "0.66978294", "0.6672218", "0.6654688", "0.6630943", "0.66123706", "0.66062075", "0.6565258", "0.65461504", "0.64140445", "0.6342657", "0.631709...
0.6286343
23
Tests the bot's reaction to receiving an invalid crypto token
async def test_invalid_crypto(): channel = discord.utils.get(client.get_all_channels(), name='bot-testing') await channel.send("!crypto abcdefg") content = "There was an issue getting the information for abcdefg." try: await client.wait_for('message', timeout=10, check=lambda x: x.guild.id == ch...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_m_send_for_valied_token():\n with pytest.raises(AccessError):\n message_send(\"notatoken\", -1, \"test\")", "def test_unreact_invalid_token():\n with pytest.raises(AccessError):\n message_unreact(\"2130847\", -1, -1)", "def test_react_invalid_token():\n\n with pytest.raises(Acce...
[ "0.74050266", "0.720926", "0.6943443", "0.6685277", "0.6628065", "0.6595845", "0.64871854", "0.6414133", "0.6321115", "0.6292075", "0.6260774", "0.6217277", "0.6200071", "0.6171104", "0.6149714", "0.60606396", "0.6012891", "0.60115176", "0.59928495", "0.59757996", "0.59695125...
0.6789359
3
Close the log handler.
def close(self): try: if self.consumer.is_running: self.consumer.stop() # TODO: Implement QueueConsumer.join() so we can wait # for processing to complete before closing the HTTP session # self.consumer.join() self.sessio...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def close_logfile(handler, logname=\"\"):\n import logging\n logger = logging.getLogger(logname)\n if handler in logger.handlers:\n logger.removeHandler(handler)\n if not handler.stream.closed:\n handler.close()", "def close_logfile(self):\n if hasattr(self.logging_handler, 'stre...
[ "0.8253836", "0.8177684", "0.79194736", "0.79194736", "0.7671796", "0.7432017", "0.74027133", "0.72809774", "0.7169859", "0.7112046", "0.70945376", "0.708232", "0.7035228", "0.69898933", "0.69804275", "0.6975482", "0.69149745", "0.6911453", "0.6861167", "0.68371224", "0.68318...
0.0
-1
Get the record's UTC timestamp as an ISOformatted date / time string.
def _get_local_timestamp(record): timestamp = datetime.fromtimestamp( timestamp=record.created, tz=tzlocal() ) return timestamp.isoformat(sep=' ')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def iso_timestamp() -> str:\n return datetime.now(timezone.utc).replace(microsecond=0).isoformat()", "def timestamp():\n return datetime.now(timezone.utc).astimezone().isoformat()", "def _iso_8601(self):\n return time.strftime(\"%Y-%m-%dT%H-%M-%SZ\", time.gmtime())", "def timestamp_calculator(se...
[ "0.7777467", "0.76300275", "0.7492368", "0.7291465", "0.72199434", "0.72045124", "0.72027403", "0.71614677", "0.71524125", "0.7099215", "0.6970081", "0.6959073", "0.69504094", "0.69393486", "0.69127065", "0.6909772", "0.6906381", "0.68412983", "0.6776174", "0.67598915", "0.67...
0.7217903
5
If the specified data is represented as bytes, convert it to a UTF8 string (using Base64 encoding if the bytes do not represent valid UTF8). This is needed because json.dumps cannot serialise bytes.
def _encode_bytes_if_required(data): if (not isinstance(data, bytes)): return data try: data = data.decode('utf8') except UnicodeDecodeError: data = base64.encodebytes(data).decode('ascii') return data
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def base64_encodestring(data):\n return base64.encodebytes(data).decode()", "def encode_data(data):\n data_bytes = data.encode(\"ascii\")\n data_encoded = base64.b64encode(data_bytes)\n return data_encoded", "def encode(self, data):\n s = json.dumps(data, cls=PBBJSONEncoder)....
[ "0.76883733", "0.7636424", "0.7532713", "0.74893445", "0.7463162", "0.73569834", "0.73540956", "0.73289037", "0.7253325", "0.7249752", "0.7205232", "0.71930224", "0.71665627", "0.7155277", "0.7114491", "0.7093548", "0.7077992", "0.70369554", "0.7017349", "0.7014437", "0.70085...
0.81656164
0
load server configuration into a dict object from json file
def load_server_config(server_cfg_path: Path) -> ServerConfig: with open(server_cfg_path) as f: cfg_obj = yaml.load(f) return ServerConfig.from_yaml(cfg_obj)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_server_configs():\n\n with open(\".servers.json\", \"r\") as server_file:\n config_dict = json.load(server_file)\n\n return config_dict", "def load(f):\n config = json.loads(f.read())\n jsonschema.validate(config, CONFIG_SCHEMA)\n if 'port' not in config['redis']:\n config['r...
[ "0.7640711", "0.7335619", "0.73174584", "0.7313094", "0.7224375", "0.7197259", "0.71651554", "0.7100848", "0.70645046", "0.70639765", "0.70523256", "0.70459986", "0.7043242", "0.702432", "0.699576", "0.69749284", "0.6966589", "0.69323665", "0.69033074", "0.68785685", "0.68542...
0.0
-1
Make a graph where (1) a tensor is sliced twice and both slices are fed into the same concat op, and (2) another sliced output (i.e not the one from (1)) is fed into the same concat op twice.
def _make_test_graph_multi_dsts_2( self, input_shapes, input_start_indices, input_end_indices, dim, dtype, ): Ys = self._make_slice_ops( input_shapes, input_start_indices, input_end_indices, dim, dty...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def combine_slices(self, slices, tensor_shape, device=None):\n if tensor_shape.ndims == 0:\n return slices[0]\n\n ret = slices[:]\n tensor_layout = self.tensor_layout(tensor_shape)\n for mesh_dim, tensor_axis in zip(\n self.shape, tensor_layout.mesh_axis_to_tensor_axis(self.ndims)):\n ...
[ "0.63221544", "0.5881659", "0.5796164", "0.5790139", "0.5788466", "0.5708302", "0.57014924", "0.56651825", "0.5660581", "0.5594489", "0.55880916", "0.55713695", "0.55225456", "0.55206794", "0.55175483", "0.5471905", "0.54691553", "0.5460527", "0.5458085", "0.5454719", "0.5454...
0.6301367
1
Return a connection to the ElasticSearch server. May return ``None`` if no ElasticSearch connection is configured for the app.
def get_elastic_connection(self): return self.request.registry.settings['elastic_conn']
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _conn(self):\n elastic = Elasticsearch(\n hosts=self.hosts,\n http_auth=(self.username, self.passwd),\n scheme=self.scheme,\n port=self.port,\n verify_certs=self.verify_certs,\n ssl_show_warn=self.ssl_show_warn,\n )\n health...
[ "0.777592", "0.7361308", "0.6686803", "0.65819556", "0.65781397", "0.6570176", "0.63442034", "0.6258727", "0.6224093", "0.6214512", "0.6201316", "0.61546946", "0.61226505", "0.5976021", "0.59076524", "0.5897931", "0.56932646", "0.5682208", "0.56644577", "0.5635362", "0.562062...
0.7983388
0
Function to find the dice coefficient of the given input and output
def dice_coe(y_true, y_pred): assert len(y_pred.shape) == 4 and len(y_true.shape) == 4, "[ERROR]: Input shape must be 4" return tl.cost.dice_coe(y_pred, y_true, loss_type="jaccard", axis=(1, 2, 3))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dice_coeff(input, target):\n if input.is_cuda:\n s = torch.FloatTensor(1).cuda().zero_()\n else:\n s = torch.FloatTensor(1).zero_()\n\n for i, c in enumerate(zip(input, target)):\n s = s + DiceCoeff().forward(c[0], c[1])\n\n return s / (i + 1)", "def dice_coeff(input, target)...
[ "0.7189257", "0.7189257", "0.71451616", "0.7110187", "0.699475", "0.6876854", "0.68731105", "0.679984", "0.677119", "0.6703603", "0.66623837", "0.66623837", "0.66260475", "0.6559308", "0.64710045", "0.6459249", "0.64025664", "0.63837737", "0.6383033", "0.6347015", "0.63432646...
0.62254417
23
Initializes an iterator object to the beginning of a list.
def __init__(self, nums): self.nums = nums self.top = 0 self.count = len(nums)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, iterator):\n self.iterator = iterator\n self._next = None\n self.next()", "def __init__(self, iterator):\n self._iter = iterator\n # None is not a safe indicator for end of iteration because None might\n # be in the given iterator.\n self._peek ...
[ "0.6941208", "0.67635524", "0.6524486", "0.6501136", "0.6298053", "0.6285618", "0.626523", "0.626523", "0.6259004", "0.6130952", "0.6028111", "0.5926086", "0.5883872", "0.5874141", "0.5866123", "0.58606935", "0.5833062", "0.5818148", "0.5774666", "0.57525617", "0.574355", "...
0.0
-1
Resize image while keeping aspect ratio. Max dim is char_dim pad_dim is applied in order to have derivative friendly image
def resize_with_constant_ratio(img, char_dim): roi_h = img.shape[0] # need to handle cases where the height and width are both 0. The interpretation is that there is nothing here roi_w = img.shape[1] max_dim = max(roi_w, roi_h) pad_dim = 2 try: # custom modification scale = float(char_dim...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def resize_and_pad(img, size, padColor= 0):\n h, w = img.shape[:2]\n sh, sw = size\n\n # interpolation method\n if h > sh or w > sw: # shrinking image\n interp = cv2.INTER_AREA\n\n else: # stretching image\n interp = cv2.INTER_CUBIC\n\n # aspect ratio of image\n aspect = float(w)...
[ "0.6860011", "0.68117756", "0.6717236", "0.6672717", "0.6618276", "0.6600264", "0.65943587", "0.654777", "0.64306825", "0.64272714", "0.6325363", "0.63168323", "0.6315922", "0.6260892", "0.622743", "0.61684954", "0.61635524", "0.6162654", "0.61334634", "0.61231405", "0.611133...
0.76970243
0
Pad zeros in order to get a square char_dimxchar_dim image
def pad_digit(img, char_dim): pad_h = char_dim-img.shape[0] pad_w = char_dim-img.shape[1] pad_h_b = math.floor(pad_h/2) pad_h_t = pad_h - pad_h_b pad_w_r = math.floor(pad_w/2) pad_w_l = pad_w - pad_w_r dst = np.hstack(( img, np.zeros((img.shape[0], pad_w_r)))) dst = np.hstack(( np.zeros...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def zero_pad(im, pad_size):\n pad_width = ((0, 0), (pad_size, pad_size), (pad_size, pad_size))\n return np.pad(im, pad_width, mode=\"constant\")", "def pad(im):\n (m, c, w, h) = im.size()\n\n p1 = (64 - (w % 64)) % 64\n p2 = (64 - (h % 64)) % 64\n\n pad = nn.ReflectionPad2d(padding=(0, p2, 0, p...
[ "0.67215323", "0.6675181", "0.66221", "0.6409649", "0.63894653", "0.63350236", "0.6305963", "0.62353146", "0.61019903", "0.60978705", "0.6055991", "0.6053805", "0.6041446", "0.6033032", "0.6017995", "0.6003517", "0.59981906", "0.59329367", "0.5913352", "0.58907783", "0.580898...
0.71658826
0
Get command line arguments
def get_args(): parser = argparse.ArgumentParser(description=""" Put description of application here """) parser.add_argument('--hex2', action='store', dest='hex2', help='hex2 file to be load in the memory', default="") parser.add_argument('--trace', action='store'...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def GetCommandLineArgs():\n pass", "def get_args():\n ap = ArgumentParser()\n ap.add_argument('-x', '--no-cache', dest=\"cache\", default=True, action=\"store_false\")\n ap.add_argument('-w', '--write-only', dest=\"write_only\", default=False, action=\"store_true\")\n ap.add_argument('-r', '--read-o...
[ "0.7909645", "0.76307344", "0.7617682", "0.7617682", "0.7617682", "0.7617682", "0.7617682", "0.7617682", "0.7613567", "0.7597303", "0.75800574", "0.7542368", "0.7524566", "0.75190157", "0.7515975", "0.75063413", "0.7503365", "0.7498773", "0.7498482", "0.74963933", "0.7482544"...
0.7450661
26
Return the PEG ratio of the company.
def pegratio(self): peg = self.ratios[4].text if str(peg) == "-": return "-" return float(peg)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def extract_ratio(self):\n return 0.375", "def golden_ratio():\n\n return ratio(1)", "def GetRatio(self):\n ...", "def ratio(ticker):\n ticker = yf.Ticker(ticker)\n try:\n peg_ratio = ticker.info['pegRatio']\n except:\n return None\n return peg_ratio", "def calcul...
[ "0.68437815", "0.6682647", "0.6660026", "0.66046655", "0.6408629", "0.63982", "0.6342254", "0.62763363", "0.62102437", "0.62012273", "0.61760765", "0.6133465", "0.61236817", "0.61103076", "0.60652924", "0.6060302", "0.6057309", "0.6054656", "0.6049683", "0.6046891", "0.604150...
0.6660298
2
Return the PE Ratio of the company.
def priceearnings(self): pe = self.ratios[0].text if str(pe) == '—': return "-" return float(pe)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ratio(self):\n total_com = 0\n for item in self.metric_data:\n total_com += item[\"comm_vol\"]\n return self.fast_memory_use / (total_com + self.eps)", "def GetRatio(self):\n ...", "def extract_ratio(self):\n return 0.375", "def ppt_ratio(self):\n retu...
[ "0.6689273", "0.6612014", "0.6544652", "0.64721495", "0.635364", "0.6281799", "0.62003785", "0.6176587", "0.61745733", "0.6151062", "0.6115551", "0.60886955", "0.6084368", "0.6069634", "0.60569876", "0.6048783", "0.6048783", "0.60013986", "0.59807974", "0.5945759", "0.593958"...
0.5512168
64
Return the short interest ratio of the company.
def shortinterestratio(self): link = "https://ca.finance.yahoo.com/quote/"+ self.ticker+"/key-statistics?p="+self.ticker soup = self.gethtml(link) values = soup.find_all("td",{"class":"Fz(s) Fw(500) Ta(end)"}) sir = float(values[45].text) return sir
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def interest_rate(self):\n return 0.00299", "def extract_ratio(self):\n return 0.375", "def get_accrued_interest_pct(self ):\n if self.calculation_date in [ self.bond.issue_date ] + self.coupon_dates:\n return 0\n else:\n start = self.prev_coupon_date if self.p...
[ "0.6858623", "0.65099347", "0.62651587", "0.62448937", "0.6187033", "0.60640204", "0.60608494", "0.60241264", "0.598076", "0.5976265", "0.5961963", "0.59294116", "0.5908745", "0.58939916", "0.58841234", "0.5844936", "0.581009", "0.5795711", "0.5788058", "0.5757457", "0.575155...
0.60327023
7
Return the weighted alpha of the company.
def weightedalpha(self): link = "https://www.barchart.com/stocks/quotes/" + self.ticker soup = self.gethtml(link) rows = soup.find_all("div",{"class":"financial-data-row"}) wa = float(str(rows[4].find("span",{"class":"right"}).text).replace(" ","")) return wa
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def alpha(self) -> float:\n return self._alpha", "def alpha(self) -> float:\n\n return self._alpha", "def obtener_alpha(self):\n\t\treturn self.__alpha", "def get_alpha(self):\n return self.alpha", "def alpha(self):\n return self._alpha", "def alpha(self):\n return self...
[ "0.6537159", "0.64622235", "0.6337621", "0.63246816", "0.63146555", "0.63146555", "0.6212095", "0.61885184", "0.61618155", "0.61437064", "0.61354005", "0.60846645", "0.6075896", "0.60325575", "0.6025723", "0.6000386", "0.5996909", "0.5960706", "0.58810663", "0.5849437", "0.58...
0.690517
0
Get the full path to this cell's root
def fullPath(self): return os.path.join(self.project.project_path, self.name)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def root_path(self) -> str:\n return self._root_path", "def path(self):\n return self._snapshot_root(0)", "def table_root(self) -> str:\n return path.join(self.dataroot, self.split)", "def root_folder(self) -> str:\n return pulumi.get(self, \"root_folder\")", "def root_folder(se...
[ "0.77528185", "0.7297191", "0.7251123", "0.7147257", "0.7147257", "0.7147257", "0.7147257", "0.70270246", "0.69824594", "0.6975251", "0.6975251", "0.69699806", "0.69286317", "0.69000375", "0.68806744", "0.6875793", "0.6865176", "0.6865176", "0.6845287", "0.67858833", "0.67817...
0.0
-1
Convert the Dedup object to a dictionary.
def to_dict(self): topo_object = copy.copy(self.output) topo_object["options"] = vars(self.options) return topo_object
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_dict(self):\n return dict(self.d)", "def to_dict(self) -> Dict:\n return utilities.asdict(self)", "def _to_dict(self):\n return self.to_dict()", "def _to_dict(self):\n return self.to_dict()", "def _to_dict(self):\n return self.to_dict()", "def _to_dict(self):\n ...
[ "0.7444344", "0.7105621", "0.7067228", "0.7067228", "0.7067228", "0.7067228", "0.7067228", "0.7067228", "0.7067228", "0.7067228", "0.7067228", "0.7067228", "0.7067228", "0.7067228", "0.7067228", "0.7067228", "0.7067228", "0.7067228", "0.7067228", "0.7067228", "0.7067228", "...
0.0
-1
Calculate Mean Intersection and Union (mIoU)
def mean_iou(results, gt_seg_maps, num_classes, ignore_index, nan_to_num=None): all_acc, acc, iou = eval_metrics( results=results, gt_seg_maps=gt_seg_maps, num_classes=num_classes, ignore_index=ignore_index, metrics=['mIoU'], nan_to_num=nan_to_num) return all_acc...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def compute_mean_iou(name):\n sum_over_row = math_ops.to_float(math_ops.reduce_sum(total_cm, 0))\n sum_over_col = math_ops.to_float(math_ops.reduce_sum(total_cm, 1))\n cm_diag = math_ops.to_float(array_ops.diag_part(total_cm))\n denominator = sum_over_row + sum_over_col - cm_diag\n\n # If ...
[ "0.68985945", "0.688667", "0.67745143", "0.6700345", "0.6700345", "0.6630799", "0.6609478", "0.6605504", "0.65672183", "0.6551651", "0.6529787", "0.65187305", "0.6510095", "0.65006924", "0.649824", "0.6424971", "0.6419251", "0.6409184", "0.6409184", "0.6398975", "0.6385839", ...
0.6827642
2
HACK adds current locals() to globals(). Can be dangerous.
def fix_embed_globals(): frame = get_stack_frame(N=1) frame.f_globals.update(frame.f_locals) frame.f_globals['_did_embed_fix'] = True """ def fix_embed_globals(N=0): import inspect # Get the parent frame frame_cur = inspect.currentframe() for _ix in range(N + 1): ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def LOAD_LOCALS(self):\n self.vm.push(self.vm.frame.f_locals)", "def do_locals(self, arg, tracer):\n self.writeln('locals: [')\n for p in items(tracer.curframe_locals):\n self.writeln(' %s=%s' % p)\n self.writeln(']')\n\n return self.next_command.tailcall(tracer)", ...
[ "0.6679169", "0.66099745", "0.63219535", "0.63116336", "0.6255804", "0.6242228", "0.62202656", "0.6175128", "0.6161629", "0.61293346", "0.6087424", "0.6037594", "0.60337275", "0.6031347", "0.6012542", "0.5979037", "0.59696287", "0.59521925", "0.5932265", "0.5921033", "0.58740...
0.664499
1
Tests if running in IPython
def inIPython(): try: __IPYTHON__ return True except NameError: return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def isIpython():\n try:\n #print(\"testing Ipython [%s]\"%str(__IPYTHON__))\n if str(__IPYTHON__):\n return True\n except:\n return False", "def if_ipython():\n import sys\n return 'IPython' in sys.modules", "def run_from_ipython():\n try:\n __IPYTHON__\n ...
[ "0.8605742", "0.8460573", "0.83750546", "0.8145554", "0.7979128", "0.7849004", "0.77901155", "0.77656317", "0.7707504", "0.7637621", "0.76326245", "0.7617173", "0.7595681", "0.7592002", "0.7537447", "0.75146", "0.7511606", "0.7511606", "0.7264194", "0.721505", "0.6959615", ...
0.83041394
3
mimics lisp quasi quote functionality
def quasiquote(string): return string.format(**get_parent_frame().f_locals)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def Q(name: str, quote: str = '\"') -> str:\n return f'{quote}{name}{quote}'", "def quote(self, identifier):\r\n# return \"'%s'\" % identifier.replace(\"'\", \"''\")\r\n return identifier", "def qn(name):\n if name.startswith('\"') and name.endswith('\"'):\n return name # Qu...
[ "0.7604055", "0.7199002", "0.71532494", "0.70628965", "0.7032577", "0.7023318", "0.70150334", "0.69983596", "0.69957614", "0.69036865", "0.68345225", "0.6798017", "0.67433596", "0.6675056", "0.6659961", "0.66584724", "0.66489965", "0.6647084", "0.6621378", "0.660259", "0.6584...
0.69069487
9
Return an iterator that produces jobs for all combinations of a parameter grid. Optionally, filter out duplicate jobs The parameter grid is a dictionary of lists, giving the options for each hyperparameter. For more, see sklearn.grid_search.IterGrid
def job_grid(self, clf, X, Y, param_grid, filter_duplicates=True): from sklearn.grid_search import IterGrid for pg in IterGrid(param_grid): j = self.job(clf, X, Y, pg) if filter_duplicates and j.duplicate: continue yield j
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def iter_grid(param_grid):\n if hasattr(param_grid, 'has_key'):\n param_grid = [param_grid]\n for p in param_grid:\n keys = p.keys()\n for v in product(*p.values()):\n params = dict(zip(keys,v))\n yield params", "def __iter__(self) -> Iterator[Tuple[int, int, Dict...
[ "0.67471653", "0.6626007", "0.63014513", "0.59775245", "0.59603494", "0.5897791", "0.5894913", "0.5823627", "0.579957", "0.5714137", "0.5674602", "0.5657461", "0.56289744", "0.5623661", "0.5611747", "0.5610163", "0.5600998", "0.56001216", "0.5583974", "0.5582536", "0.5579107"...
0.8093411
0
Return whether this job is a duplicate (i.e. has the same parameters as another job that has been instantiated already).
def duplicate(self): return self._duplicated
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_there_duplicates_args(self):\n # type: () -> bool\n args = [arg['name'] for arg in self.current_file.get('args', [])]\n if len(args) != len(set(args)):\n return True\n return False", "def isDuplicate(self, other):\n return self.loc == other.loc", "def IsDupl...
[ "0.67885137", "0.6731678", "0.65399784", "0.64258564", "0.63745517", "0.6321747", "0.62811273", "0.6258702", "0.62264204", "0.616654", "0.6150994", "0.6134514", "0.60373646", "0.6019178", "0.6005691", "0.5972955", "0.5972135", "0.596395", "0.5918928", "0.5916407", "0.5868619"...
0.72704864
0
Converts boxes from pixel coordinates to normalized coordinates.
def norm_boxes(boxes, shape): h, w = shape scale = np.array([h - 1, w - 1, h - 1, w - 1]) shift = np.array([0, 0, 1, 1]) return np.divide((boxes - shift), scale).astype(np.float32)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def normalize_box(a:np.ndarray):\n min_x = np.min(a[:, 0])\n max_x = np.max(a[:, 0])\n min_y = np.min(a[:, 1])\n max_y = np.max(a[:, 1])\n range_x = max_x - min_x\n range_y = max_y - min_y\n a[:, 0] = (a[:, 0] - min_x) / range_x\n a[:, 1] = (a[:, 1] - min_y) / range_y\n\n # print(range_x...
[ "0.7043597", "0.7021417", "0.6911775", "0.6714755", "0.67140037", "0.64795566", "0.64449394", "0.64426047", "0.6415405", "0.6415405", "0.64067113", "0.64037126", "0.6327674", "0.63232523", "0.6305294", "0.62871635", "0.6251441", "0.6229892", "0.62129736", "0.62097806", "0.618...
0.63272595
13
Get a list of colors in random order.
def get_colors(): with open("colors.txt", "rb") as f: colors = [c.strip() for c in f] shuffle(colors) return colors
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def random_color(random):\n icolor = random.randint(0, 0xFFFFFF)\n return [icolor & 0xff, (icolor >> 8) & 0xff, (icolor >> 16) & 0xff]", "def randcolor():\n color = []\n for i in range(3):\n color.append(random.randrange(0,255))\n return tuple(color)", "def list_colors():\n clrs = [color...
[ "0.7767747", "0.7616919", "0.75800633", "0.7319001", "0.7300979", "0.7291432", "0.7291396", "0.7291396", "0.7291396", "0.7291396", "0.7291396", "0.7291396", "0.7291396", "0.7291396", "0.7291396", "0.7291396", "0.72709894", "0.72437555", "0.7221549", "0.721873", "0.7097987", ...
0.75190526
3
Setter method for parent_clock_identity, mapped from YANG variable /ptp_state/parent_port_detail/parent_clock_identity (string)
def _set_parent_clock_identity(self, v, load=False): if hasattr(v, "_utype"): v = v._utype(v) try: t = YANGDynClass(v,base=unicode, is_leaf=True, yang_name="parent-clock-identity", rest_name="parent-clock-identity", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_pa...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_parent_clock_identity(self):\n return self.__parent_clock_identity", "def parent_entity_id(self, parent_entity_id):\n\n self._parent_entity_id = parent_entity_id", "def parent_task_id(self, parent_task_id):\n\n self._parent_task_id = parent_task_id", "def parent_id(self, parent_id):...
[ "0.69214267", "0.60611105", "0.59827965", "0.59065694", "0.59065694", "0.58382577", "0.579708", "0.5738289", "0.57304776", "0.57246107", "0.559126", "0.5576562", "0.55538505", "0.5545369", "0.54792863", "0.54792863", "0.5419146", "0.5362559", "0.53367776", "0.5329267", "0.529...
0.8871462
0
Getter method for parent_port_number, mapped from YANG variable /ptp_state/parent_port_detail/parent_port_number (uint32)
def _get_parent_port_number(self): return self.__parent_port_number
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _set_parent_port_number(self, v, load=False):\n if hasattr(v, \"_utype\"):\n v = v._utype(v)\n try:\n t = YANGDynClass(v,base=RestrictedClassType(base_type=long, restriction_dict={'range': ['0..4294967295']}, int_size=32), is_leaf=True, yang_name=\"parent-port-number\", rest_name=\"parent-port-...
[ "0.77836895", "0.5678461", "0.55846065", "0.552353", "0.5400897", "0.5339048", "0.5294113", "0.52552056", "0.52068484", "0.5182988", "0.5158384", "0.51308286", "0.51257944", "0.5123896", "0.51022047", "0.5084777", "0.5056378", "0.5048363", "0.50367665", "0.50367665", "0.50367...
0.70760345
1
Setter method for parent_port_number, mapped from YANG variable /ptp_state/parent_port_detail/parent_port_number (uint32)
def _set_parent_port_number(self, v, load=False): if hasattr(v, "_utype"): v = v._utype(v) try: t = YANGDynClass(v,base=RestrictedClassType(base_type=long, restriction_dict={'range': ['0..4294967295']}, int_size=32), is_leaf=True, yang_name="parent-port-number", rest_name="parent-port-number", paren...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_parent_port_number(self):\n return self.__parent_port_number", "def _set_parent_cpcr(self, v, load=False):\n if hasattr(v, \"_utype\"):\n v = v._utype(v)\n try:\n t = YANGDynClass(v,base=RestrictedClassType(base_type=long, restriction_dict={'range': ['-2147483648..2147483647']}, int_s...
[ "0.6717746", "0.6188239", "0.58522874", "0.5741398", "0.5741398", "0.572314", "0.5681688", "0.56757903", "0.5659496", "0.5551595", "0.5530517", "0.54835755", "0.5462368", "0.5375791", "0.53681636", "0.5360916", "0.52830786", "0.52662843", "0.52662843", "0.52662843", "0.523831...
0.8596047
0
Getter method for parent_cpcr, mapped from YANG variable /ptp_state/parent_port_detail/parent_cpcr (int32)
def _get_parent_cpcr(self): return self.__parent_cpcr
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _set_parent_cpcr(self, v, load=False):\n if hasattr(v, \"_utype\"):\n v = v._utype(v)\n try:\n t = YANGDynClass(v,base=RestrictedClassType(base_type=long, restriction_dict={'range': ['-2147483648..2147483647']}, int_size=32), is_leaf=True, yang_name=\"parent-cpcr\", rest_name=\"parent-cpcr\", p...
[ "0.7932489", "0.613929", "0.58368003", "0.5736369", "0.5579901", "0.5512498", "0.5468928", "0.5461579", "0.54396766", "0.54396766", "0.54396766", "0.540703", "0.53917515", "0.5379032", "0.53282064", "0.5327125", "0.53103775", "0.53103775", "0.5308312", "0.53011006", "0.530099...
0.72342956
1