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
The names that identify each filtered session in the self.stage.filtered_sessions dictionary. Should be the same as self.active_config_names I believe.
def filtered_session_names(self): return list(self.stage.filtered_sessions.keys())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def filtered_sessions(self):\n return self.stage.filtered_sessions", "def active_config_names(self):\n return list(self.stage.active_configs.keys())", "def names_and_ids(self):\n names = [filter_.DISPLAY_NAME for filter_ in self._filters.values()]\n \n return sorted(zip(n...
[ "0.71639484", "0.6864112", "0.61691976", "0.61617726", "0.6147785", "0.60501343", "0.60365427", "0.59640867", "0.59084153", "0.58867407", "0.587789", "0.587743", "0.58476335", "0.58476335", "0.58476335", "0.5820232", "0.5815936", "0.5807232", "0.5799413", "0.5799208", "0.5777...
0.86430174
0
The active_configs property corresponding to the InteractivePlaceCellConfig obtained by filtering the session. Accessed through the stage.
def active_configs(self): return self.stage.active_configs
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def active_config_names(self):\n return list(self.stage.active_configs.keys())", "def test_active_configs(self):\n # one config and one active config\n if self.mod.knobs.n_configs != 1:\n self.mod.knobs.n_configs = 1\n self.assertTrue(len(self.map.active_configs) == 1)\n ...
[ "0.6361349", "0.60724103", "0.5527944", "0.54985166", "0.54849964", "0.5455777", "0.54042387", "0.5369496", "0.53409326", "0.5310802", "0.53056604", "0.528986", "0.5289264", "0.52027524", "0.5175396", "0.516749", "0.51288056", "0.5125859", "0.51124644", "0.5081273", "0.496363...
0.74186206
0
Load image and convert image to 3D pixel array
def load_image(image_path): image = io.imread(image_path) io.imshow(image) io.show() print("Size of the image is {} KB".format(round(os.path.getsize(image_path)/1024,2))) return image
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_rgb_image_as_3d_array(filename):\n image = np.asarray(Image.open(filename))\n image_shape = image.shape\n image_dim = len(image_shape)\n assert(image_dim == 2 or image_dim == 3)\n if(image_dim == 2):\n image = np.expand_dims(image, axis = 0)\n else:\n # transpose rgb imag...
[ "0.7332536", "0.70336413", "0.68744236", "0.6862861", "0.6849558", "0.6802284", "0.676675", "0.6642885", "0.6627401", "0.6565374", "0.65609986", "0.65593976", "0.6510876", "0.64931124", "0.64755046", "0.6442606", "0.6426788", "0.6391728", "0.63742554", "0.6368798", "0.6365661...
0.0
-1
Retrieve a 1d array of a single column
def _get_column_values(self, col: str) -> ndarray: dtype, loc = self._get_col_dtype_loc(col) # type: str, int return self._data[dtype][:, loc]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _colvec(x):\n x = np.atleast_1d(x)\n return x[:, None]", "def column(self):\n return self.reshape((self.size, 1))", "def get(self, column_name):\n if column_name is None:\n raise ValueError(\n 'column_name=None is not valid for column(), use value()')\n ...
[ "0.69397074", "0.6873625", "0.6802868", "0.6702818", "0.66716045", "0.65244174", "0.6522415", "0.64482975", "0.63932264", "0.6387682", "0.63806945", "0.63137066", "0.6271284", "0.62676483", "0.6255247", "0.6202583", "0.6202583", "0.6197382", "0.618534", "0.6159223", "0.614969...
0.6907229
1
Convert DataFrame to dictionary of 1dimensional arrays or lists
def to_dict(self, orient: str = 'array') -> Dict[str, Union[ndarray, List]]: if orient not in ['array', 'list']: raise ValueError('orient must be either "array" or "list"') data: Dict[str, Union[ndarray, List]] = {} col: str for col in self._columns: arr = self._...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def DataFrame_to_dict(df):\n return df.to_dict(orient='records')", "def to_dict_records(df):\r\n return df.to_dict('records')", "def df_to_dict(df):\n return df.to_dict('index')", "def to_dict(df):\n\t# Extract the names\n\tnames = list(df.columns.values)\n\t# Create sequence\n\tdf_list = []\n\t#Ite...
[ "0.7600603", "0.7524144", "0.7251253", "0.7160858", "0.7132188", "0.70843637", "0.70732117", "0.6941504", "0.67829555", "0.67328227", "0.6676021", "0.6546308", "0.6543563", "0.65364176", "0.6516415", "0.6314268", "0.62381935", "0.62234867", "0.6176557", "0.6126979", "0.605869...
0.6186529
18
Does this DataFrame have at least one numeric columns?
def _has_numeric_or_bool(self) -> bool: dtypes: Set[str] = set(self._data.keys()) return 'i' in dtypes or 'f' in dtypes or 'b' in dtypes
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_numeric_dtype(df, col_name):\n dtype = df.dtypes[col_name]\n return np.issubdtype(dtype, np.number)", "def isNumeric(data):\n\tif type(data) == list or type(data) == np.ndarray:\n\t\tcol = pd.Series(data)\n\telse:\n\t\tcol = data\n\treturn col.dtype == np.int32 or col.dtype == np.int64 or col.dtype ...
[ "0.7617909", "0.75525457", "0.7391616", "0.69804054", "0.68931645", "0.68915516", "0.6824759", "0.6778813", "0.6688396", "0.6687066", "0.6623517", "0.6604352", "0.658214", "0.6484492", "0.6447109", "0.6410173", "0.6398646", "0.63797784", "0.6375029", "0.63747674", "0.634677",...
0.74242073
2
Does this DataFrame have at least one numeric columns?
def _has_numeric_strict(self) -> bool: return bool({'i', 'f'} & self._data.keys())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_numeric_dtype(df, col_name):\n dtype = df.dtypes[col_name]\n return np.issubdtype(dtype, np.number)", "def isNumeric(data):\n\tif type(data) == list or type(data) == np.ndarray:\n\t\tcol = pd.Series(data)\n\telse:\n\t\tcol = data\n\treturn col.dtype == np.int32 or col.dtype == np.int64 or col.dtype ...
[ "0.761545", "0.7549162", "0.74226284", "0.73879397", "0.6978195", "0.68915063", "0.68911004", "0.68223464", "0.6778652", "0.66843873", "0.66843367", "0.6620444", "0.660335", "0.65812534", "0.6444384", "0.6411549", "0.639782", "0.6382429", "0.6373865", "0.6370961", "0.6349382"...
0.64823586
14
Check if DataFrame has 0 total elements. Used before calling many other methods Returns bool
def _is_empty(self): return self.size == 0
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_empty_dataframe(dataframe):\n\n return dataframe is not None and dataframe.empty", "def check_empty_table(spark, df):\n return df.count()", "def is_empty(self):\n return self._sum() == 0", "def check_data(dataframe):\n if dataframe.iloc[0, 0] == 'No data available':\n return Fal...
[ "0.7868982", "0.75395405", "0.7348686", "0.7296043", "0.7278333", "0.7236385", "0.71775657", "0.71577233", "0.7146891", "0.7125111", "0.70522594", "0.70522594", "0.70173335", "0.69990194", "0.69972694", "0.69929105", "0.69927067", "0.6979082", "0.69713223", "0.69713223", "0.6...
0.69107777
31
Returns the integer location of the minimum value of each column When setting `axis` to 'columns', all the nonnumeric/bool columns are dropped first
def argmin(self, axis: str = 'rows') -> 'DataFrame': return self._stat_funcs('argmin', axis)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_min(self):\n\n\n min_x = 1000\n min_y = 1000\n k = len(self.__col_lista)\n for i in range(k):\n x, y = self.__col_lista[i]\n if x < min_x:\n min_x = x\n if y < min_y:\n min_y = y\n return min_x, min_y", "de...
[ "0.6835697", "0.67511356", "0.63678", "0.63610435", "0.6359795", "0.6336167", "0.63280493", "0.62811816", "0.62805665", "0.62173605", "0.6195147", "0.61911404", "0.6164074", "0.61201364", "0.60715896", "0.6067516", "0.6060003", "0.6019172", "0.6010874", "0.5976058", "0.591949...
0.67838854
1
Computes the quantile of each numeric/boolean column
def quantile(self, axis: str = 'rows', q: float = 0.5) -> 'DataFrame': if not utils.is_number(q): raise TypeError('`q` must be a number between 0 and 1') if q < 0 or q > 1: raise ValueError('`q` must be between 0 and 1') return self._stat_funcs('quantile', axis, q=q)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_profiled_quantiles(self):\n\n # this data has 4 bins, range of 3\n # with equal bin size, each bin has the width of 0.75\n\n data = [\"1.0\", \"2.0\", \"3.0\", \"4.0\"]\n df = pd.Series(data)\n profiler = FloatColumn(df.name)\n profiler.update(df)\n profile...
[ "0.6875668", "0.66279334", "0.658389", "0.65147954", "0.6475612", "0.6474807", "0.6441311", "0.64368105", "0.64358675", "0.6349553", "0.6349553", "0.6349553", "0.63279176", "0.63209164", "0.6305109", "0.6270107", "0.6238138", "0.62330556", "0.62299323", "0.6210954", "0.617430...
0.5646735
67
Finds the unique elements of a single column in the order that they appeared
def unique(self, subset: Union[str, List[str], None] = None, only_subset: bool = False, keep: str = 'first') -> ndarray: if subset is None: subset = self.columns elif isinstance(subset, str): self._validate_column_name(subset) subset = [subset] ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def unique (a_data,a_column) :\n return list(__np.unique(a_data[a_column]))", "def unique_column_values(rows, column_name):\r\n\r\n values = [] #Create an empty list\r\n for row in rows: #Iterate through each row\r\n values.append(row[column_name]) \r\n values = set(values)\r\n ...
[ "0.7938848", "0.7741369", "0.7546379", "0.7531252", "0.72683793", "0.6905928", "0.68921965", "0.6849923", "0.678093", "0.6674861", "0.66372776", "0.6621372", "0.6596219", "0.6588587", "0.6564882", "0.65234184", "0.6522117", "0.65187514", "0.6506671", "0.650314", "0.6465835", ...
0.0
-1
Checks that the given schema is a tree consisting of nonleaf dictionaries and leaf tuples. This function checks that the input is a tree where nonleaf nodes are represented as dictionaries, and leaf nodes are represented as 2tuples. An AssertionError is thrown if this is not the case.
def _verify_schema(schema): assert type(schema) in [dict, tuple], f'Expected a dict or a tuple but got {type(schema)}' if isinstance(schema, tuple): assert len(schema) == 2, f'Expected a tuple with length 2 but got length {len(schema)}' if schema[1] is not None: assert isinstance(sch...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def validate(self, root):\n if not isinstance(root, list):\n parser.error('Root object is not a list')\n if root:\n expected_type = type(root[0])\n if expected_type not in [list, dict]:\n parser.error('First row is a {}, not a list or dictionary'.format(expected_type))\n for item i...
[ "0.6018993", "0.5960815", "0.59490496", "0.5921413", "0.5835567", "0.5811129", "0.57985985", "0.5785704", "0.5780904", "0.5769729", "0.57682014", "0.5623176", "0.5615052", "0.5588337", "0.5580634", "0.55784935", "0.5560984", "0.55357456", "0.55178094", "0.5516597", "0.5512281...
0.7013083
0
Converts a dictionary object into a SimpleNamespace object.
def dict_to_namespace(d): # Convert the dictionary to a JSON string json_str = json.dumps(d) # Convert the JSON string, but generate namespaces instead of dictionaries namespace = json.loads(json_str, object_hook=lambda x: SimpleNamespace(**x)) return namespace
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def namespace_to_dict(n):\n assert isinstance(n, SimpleNamespace)\n return _namespace_to_dict_util(n)", "def _converttonamespace(o):\n ret = {}\n\n # These things are written directy into the dictionary.\n direct = (numbers.Number, np.number, tuple,\n list, np.ndarray, str)\n\n for...
[ "0.66965634", "0.6586446", "0.61745816", "0.5820868", "0.5588785", "0.5497124", "0.544047", "0.53379846", "0.5212436", "0.513218", "0.5124473", "0.50624585", "0.5001273", "0.493033", "0.49260968", "0.48719987", "0.48711345", "0.4868787", "0.48423168", "0.48276168", "0.4803171...
0.7057479
0
Returns a copy of the default configuration as a SimpleNamespace.
def get_default_config(): return _config_schema_to_namespace(_CONFIG_SCHEMA)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _DefaultNamespace():\n return namespace_manager.get_namespace()", "def get_default_namespace(self):\n return None", "def namespace(self, namespace, lowercase=True, trim_namespace=True):\n\t\treturn Config(\n\t\t\t\tself.root_path,\n\t\t\t\tself.get_namespace_view(namespace, lowercase, trim_namespac...
[ "0.7337241", "0.70990056", "0.6818207", "0.66409296", "0.6517993", "0.64407", "0.63349724", "0.6292653", "0.61350274", "0.60979885", "0.60730165", "0.59729797", "0.5881527", "0.58716327", "0.5858298", "0.5831293", "0.5827198", "0.5827039", "0.58268845", "0.5802596", "0.579417...
0.7270116
1
Returns a string of random characters that is nSize long
def rand_string(nSize=20): cString = '' while len(cString) < nSize: cString = cString + str(random.randint(1,9)) return cString
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _random_string(self, size, chars=None):\n return ''.join(random.choice(chars or _DEFAULT_CHARS) for _ in range(size))", "def stringGen(size, chars=string.ascii_uppercase + string.digits):\n\treturn ''.join(random.choice(chars) for _ in range(size))", "def _rand_str(size=16):\n return \"\".join(random...
[ "0.7416506", "0.7377515", "0.7120204", "0.7005102", "0.69903386", "0.6920148", "0.68554103", "0.685463", "0.68315196", "0.68166023", "0.6798766", "0.6795226", "0.67702055", "0.67501986", "0.6665933", "0.666192", "0.66406", "0.66365236", "0.66230744", "0.66174483", "0.66052747...
0.82579064
0
Informs the backend of the status of a request if there's a Pub/Sub topic.
def maybe_notify_backend(message, hostname, policies): if policies.get('backend_topic'): topic = pubsub.full_topic_name( policies['backend_project'], policies['backend_topic']) attributes = { attribute['key']: attribute['value'] for attribute in policies['backend_attributes'] } ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def maybe_notify_lessee(request, response):\n if request.get('pubsub_topic'):\n pubsub.publish(\n pubsub.full_topic_name(\n request['pubsub_project'], request['pubsub_topic']),\n json.dumps(response),\n {},\n )\n metrics.pubsub_messages_sent.increment(fields={'target': 'le...
[ "0.63338625", "0.63260806", "0.63119763", "0.62039757", "0.61899084", "0.61565274", "0.6138162", "0.6047553", "0.59942424", "0.5939452", "0.58582336", "0.58457243", "0.5782096", "0.5734515", "0.57171786", "0.57130694", "0.5675675", "0.5656955", "0.5639477", "0.5637029", "0.56...
0.50725275
100
Informs the lessee of the status of a request if there's a Pub/Sub topic.
def maybe_notify_lessee(request, response): if request.get('pubsub_topic'): pubsub.publish( pubsub.full_topic_name( request['pubsub_project'], request['pubsub_topic']), json.dumps(response), {}, ) metrics.pubsub_messages_sent.increment(fields={'target': 'lessee'})
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def on_subscribe( client, userdata, mid, granted_qos ):\n logging.info( \"Topic successfully subcribed with QoS: %s\" %granted_qos )", "def publish_status(client):\n client.publish(config.topic_get, payload=getlight())", "def update_status(self) -> None:\n try:\n (rc, mid) = self.mqttc....
[ "0.6285326", "0.62276906", "0.62162524", "0.6176906", "0.6041007", "0.5997584", "0.59943396", "0.59927124", "0.5843037", "0.5799533", "0.5702484", "0.56841666", "0.5650153", "0.5642217", "0.5642217", "0.5608717", "0.55906945", "0.5588466", "0.5583844", "0.55807006", "0.557699...
0.6650253
0
Computes the concretized scalar lower bound value given eps and the lower bound weights
def concretize_l(self, lw: torch.Tensor): return -self.eps * torch.norm(lw, p=self.q, dim=-1)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def lower_bound(self) -> float:\n ...", "def min_values(self, lower, upper): \n if not self.lower_bounds is None:\n return self.lower_bounds\n\n minus = np.clip(self.coeffs,-math.inf,0)\n plus = np.clip(self.coeffs,0,math.inf)\n self.lower_bounds = plus.dot(lower) +...
[ "0.61943287", "0.61600316", "0.5750524", "0.55643916", "0.55425125", "0.55246836", "0.5498865", "0.5488924", "0.54560125", "0.54560125", "0.54421777", "0.538863", "0.53870505", "0.534808", "0.53361654", "0.5330524", "0.53239787", "0.53096724", "0.530531", "0.5275653", "0.5253...
0.5518538
6
Computes the concretized scalar upper bound value given eps and the upper bound weights
def concretize_u(self, uw: torch.Tensor): return self.eps * torch.norm(uw, p=self.q, dim=-1)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def compute_bounds(self, weights, add_coeff, dual_vars, lower_bounds, upper_bounds, store_primal=False):\n x0_coeff = -weights[0].backward(dual_vars.mus[0])\n x0 = torch.where(x0_coeff >= 0, lower_bounds[0].unsqueeze(1), upper_bounds[0].unsqueeze(1))\n bound = utils.bdot(x0, x0_coeff)\n ...
[ "0.6219264", "0.61677694", "0.5948774", "0.58611894", "0.57886773", "0.5741874", "0.5510578", "0.550674", "0.546447", "0.5463563", "0.54462457", "0.544002", "0.5426874", "0.54235315", "0.54189694", "0.5406498", "0.54022044", "0.5401791", "0.5396856", "0.53805375", "0.53770906...
0.0
-1
Break a list to chunks according to chunk_size.
def _FixLongList(self, long_list, chunk_size): split_list = [] length = len(long_list) if length > chunk_size: list_size = chunk_size - 1 pages, mod = divmod(length, list_size) if mod: pages += 1 for page in range(pages): split_list.append(long_list[list_size * page:l...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def split_chunk(list, chunk_size):\n for i in range(0, len(list), chunk_size):\n yield list[i:i + chunk_size]", "def chunks(self, list_to_chunk, size):\n for i in range(0, len(list_to_chunk), size):\n yield list_to_chunk[i:i + size]", "def split_to_chunks(of_list, chunk_size...
[ "0.87854344", "0.842914", "0.83943474", "0.8222609", "0.8187535", "0.8130914", "0.81014895", "0.8093639", "0.8016198", "0.7975158", "0.7921965", "0.7853733", "0.7843604", "0.78325725", "0.7827067", "0.77705264", "0.77673966", "0.77620757", "0.76705074", "0.7603887", "0.756765...
0.7085699
57
Convert sub list of netblocks to string.
def _NormalizeNetblocks(self, netblock_list): netblocks = [] for sub_list in netblock_list: if sub_list: netblocks.append(','.join(str(netblock) for netblock in sub_list)) else: netblocks.append('any') return netblocks
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __str__(self) -> str:\n blockchain_string = 'Node ' + self.node_id + ' Blockchain: \\n'\n stack = collections.deque()\n for block in self.blockchain:\n stack.append(block)\n for i in range(0, len(stack)):\n block = stack.pop()\n blockchain_string += ...
[ "0.60686004", "0.5843217", "0.5788446", "0.57813483", "0.57723945", "0.57723945", "0.57512295", "0.5731575", "0.5707351", "0.57071465", "0.5661783", "0.56284726", "0.55869347", "0.55869347", "0.55869347", "0.5576508", "0.55663514", "0.5541219", "0.5511762", "0.54916674", "0.5...
0.74932075
0
Set the metrics stats name.
def set_stats_name(self, stats_name): if self.stats_name == stats_name: return if stats_name in scales._Stats.stats: raise ValueError('"{0}" already exists in stats.'.format(stats_name)) stats = scales._Stats.stats[self.stats_name] del scales._Stats.stats[self....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def stat_name(self, stat_name):\n\n self._stat_name = stat_name", "def set_name(self, name):\n\t\tself.name_ = name", "def setname(self, name):\n self.__name = name", "def set_name(self, name):\r\n self.__name = name", "def set_name(self, name):\n self.__name = name", "def set...
[ "0.7355427", "0.67741555", "0.6728167", "0.6719688", "0.67039317", "0.67039317", "0.6700648", "0.66976804", "0.6601265", "0.65712816", "0.65712816", "0.65712816", "0.65712816", "0.65712816", "0.6567156", "0.6567156", "0.6561908", "0.6549536", "0.6481848", "0.6470287", "0.6456...
0.7620443
0
Add patterns to the ruler.
def add_patterns(self, patterns: Iterable[Dict[str, Any]],) -> None: # disable the nlp components after this one # in case they haven't been initialized / deserialised yet try: current_index = self.nlp.pipe_names.index(self.name) subsequent_pipes = [ pipe ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_patterns(self, patterns: Iterable[AttributeRulerPatternType]) -> None:\n for p in patterns:\n self.add(**p) # type: ignore[arg-type]", "def test_add_patterns(ruler: SpaczzRuler, patterns: List[Dict[str, Any]]) -> None:\n assert len(ruler) == len(patterns)", "def add_pattern(self, ...
[ "0.7300467", "0.6902597", "0.6730757", "0.64415747", "0.6426541", "0.6376736", "0.6208098", "0.61649734", "0.6056466", "0.58568573", "0.5804086", "0.57879376", "0.57579744", "0.574183", "0.5679537", "0.5603653", "0.5584647", "0.5564505", "0.5555327", "0.5533132", "0.5481157",...
0.5710875
14
Store those words only in cadidate_pos
def sentence_segment(self, doc, candidate_pos, lower,bigrams,trigrams): sentences = [] for sent in doc.sents: selected_words = [] bigram_words=[] for token in sent: bigram_words.append(token.text) # Store words only with cadidate POS ta...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _partsofspeech(self):\n \n l = len(self._words)\n for i in range(l):\n self._words[i]['pos'] = pos_tag( [ self._words[i]['word'] ])[0][1]", "def sentence_segment(self, doc, candidate_pos, lower):\n sentences = []\n for sent in doc.sents:\n selected_...
[ "0.6313715", "0.6076473", "0.6032558", "0.60120255", "0.5993958", "0.5989751", "0.5950847", "0.5927919", "0.57849723", "0.57830197", "0.57597053", "0.5696669", "0.56333035", "0.56061155", "0.5596007", "0.55601776", "0.55532134", "0.5547649", "0.552179", "0.55212325", "0.55193...
0.5436337
28
Finds & Removes empty comments from the tree and assigns children of empty comments to their parents. If no parents are found, the parent of children of empty comments, is set as the root of the tree. If any comment has empty comments as its children, they are removed.
def resolve_empty_comments(tree: dict, empty_comments: List[str]): empty_comments_dict = {} for id in empty_comments: empty_comments_dict[id] = tree["comments"][id] tree["comments"].pop(id) for id, comment in tree["comments"].items(): parent_id = comment["par...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cleaning_pipeline(self, tree: dict):\n tree = self.remove_redundant(tree)\n tree[\"selftext\"] = self.clean_text(tree[\"selftext\"])\n tree[\"title\"] = self.clean_text(tree[\"title\"])\n\n empty_comments = []\n for id, comment in tree[\"comments\"].items():\n if \...
[ "0.59740955", "0.5822621", "0.57353616", "0.5548554", "0.5422239", "0.5330405", "0.53220683", "0.5309191", "0.52991927", "0.52960855", "0.5252085", "0.52422625", "0.52383316", "0.5233206", "0.52222097", "0.519152", "0.5096152", "0.50871676", "0.5070019", "0.506332", "0.502927...
0.75805646
0
Returns a new tree, consisting of first few comments, specified by ids and the OP's text & title.
def new_branch_tree(tree, ids): branch_tree = {} branch_tree["selftext"] = tree["selftext"] branch_tree["title"] = tree["title"] branch_tree["id"] = tree["id"] branch_tree["comments"] = {} for id in ids[1:]: branch_tree["comments"][id] = tree["comments"][id] ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_by_parent(parent_id):\n return CommentsTreeDAO(root_id=parent_id)", "def get_comments_from_submission_id(submission_id):\n flat_comments = []\n tree_comments = []\n\n submission = (REDDIT.submission(id=submission_id))\n print(submission.num_comments)\n print(submission.shortlink)...
[ "0.59989", "0.5877851", "0.578554", "0.57389486", "0.5681951", "0.5669059", "0.56605774", "0.5642547", "0.5640219", "0.5624629", "0.55321985", "0.5518495", "0.55057955", "0.5503396", "0.5496973", "0.53077596", "0.5306573", "0.5298361", "0.52897197", "0.5277251", "0.5265725", ...
0.68043685
0
Adds entire comments subtree rooted at id in tree, to branch_tree.
def add_children(self, tree, branch_tree, id): if id in tree["comments"]: branch_tree["comments"][id] = tree["comments"][id] for reply_id in branch_tree["comments"][id]["replies"]: self.add_children(tree, branch_tree, reply_id)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new_branch_tree(tree, ids):\n branch_tree = {}\n branch_tree[\"selftext\"] = tree[\"selftext\"]\n branch_tree[\"title\"] = tree[\"title\"]\n branch_tree[\"id\"] = tree[\"id\"]\n branch_tree[\"comments\"] = {}\n for id in ids[1:]:\n branch_tree[\"comments\"][...
[ "0.65695316", "0.6120507", "0.60524553", "0.59299034", "0.5469549", "0.5454765", "0.54316235", "0.54105633", "0.53070396", "0.5293187", "0.52310574", "0.5178518", "0.50865406", "0.5083604", "0.50769883", "0.50617516", "0.5028316", "0.5026231", "0.5018051", "0.5013875", "0.497...
0.7934601
0
Calculate the symmetric KL divergence between two spectral densities j = sum( u / v + v / u 2)
def PSD_sym_KL(u, v): n = len(v) j = (1 / n) * (u / v + v / u - 2).sum() return j
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_Kl_divergence(model1, model2, collection, lam, missing_val = 0.0001):\n smoot_m2 = {key: (1-lam)*model2.get(key, 0) + lam*collection.get(key, missing_val) for key in model1}\n\n divergence = sum([model1[key]*math.log(model1[key]/smoot_m2[key]) for key in model1])\n return divergence", "def KL_di...
[ "0.6990029", "0.693879", "0.6901858", "0.6853633", "0.68325394", "0.68229544", "0.6752696", "0.6665913", "0.6631767", "0.6592732", "0.6571921", "0.6566313", "0.65197635", "0.65132886", "0.6487811", "0.6480615", "0.64803153", "0.6441547", "0.6406064", "0.64028364", "0.63934886...
0.63460296
28
Tests for extension argument. Remove/replace extensions in file
def test_filter_extension(ext_arg, ext_src, ext_dest): args = parser.parse_args([*ext_arg]) filters = renamer.initfilters(args) dest = renamer.get_renames(ext_src, filters, args.extension, args.raw) assert dest == ext_dest
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _remove_dot_from_extension(\n extensions\n):\n if isinstance(extensions, str):\n ext : str = extensions\n extensions = ext.replace(\".\",\"\")\n return extensions", "def fixExt(ext):\n if not ext.startswith(\".\"):\n return \".{}\".format(ext)\n return ext", "def add_ext...
[ "0.7550194", "0.7269844", "0.7131626", "0.699242", "0.69915247", "0.6886055", "0.6861724", "0.68613565", "0.6780371", "0.6731657", "0.669829", "0.66577303", "0.6624627", "0.66243935", "0.66123915", "0.65207916", "0.6500771", "0.64628214", "0.64541304", "0.6453924", "0.6387144...
0.6331891
22
Fixture for fixed tmp_path_factory
def fs(tmp_path_factory): dir_ = tmp_path_factory.mktemp("") for key, val in file_dirs.fs1.items(): d_ = dir_ / key d_.mkdir() for v in val: f = d_ / v f.write_text(v) return dir_
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fixture_project_dir(tmpdir_factory) -> Path:\n my_tmpdir = Path(tmpdir_factory.mktemp(\"data\"))\n yield my_tmpdir\n shutil.rmtree(str(my_tmpdir))", "def tmpfile(tmpdir_factory):\n\n def make(filename):\n fn = tmpdir_factory.mktemp(\"data\").join(filename)\n return fn\n\n # fn = ...
[ "0.7099243", "0.6951365", "0.6858074", "0.67587894", "0.6584498", "0.6538954", "0.6462802", "0.6441197", "0.6400856", "0.6387842", "0.637641", "0.63724923", "0.63446665", "0.6327275", "0.63223827", "0.6310343", "0.6308105", "0.630214", "0.6284065", "0.6282678", "0.6280282", ...
0.57408875
79
Checks if the item is in the cache.
def has_item(self, item): return item in self.cache
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cached(self, key):\n return key in self._cache", "def __contains__(self, key):\n\t\treturn key in self.cache", "def incache(self, query):\n key = genkey(query)\n res = self.memcache.get(key)\n if res and type(res) is int:\n return True\n return False", "def ...
[ "0.7756351", "0.76857334", "0.7614137", "0.7585272", "0.7513056", "0.7501666", "0.7498344", "0.7407451", "0.74013144", "0.73642147", "0.7254888", "0.7251837", "0.7248747", "0.7248747", "0.71668774", "0.7158434", "0.7116147", "0.71078867", "0.7043065", "0.7009456", "0.6980068"...
0.88010764
0
Converts a label to an ID. Removes all symbols and join as CamelCase.
def LabelToId(label): new_name = ''.join(c if c.isalnum() else ' ' for c in label) return ''.join(name.capitalize() if name[0].islower() else name for name in new_name.split())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def id_for_label(self, id_):\n return id_", "def id_for_label(self, id_):\n return id_", "def _create_label(self, label: str, ent_id: Union[str, None]) -> str:\n if isinstance(ent_id, str):\n label = \"{}{}{}\".format(label, self.ent_id_sep, ent_id)\n return label", ...
[ "0.7097293", "0.70629853", "0.6827276", "0.6749341", "0.66228485", "0.6446576", "0.6433326", "0.63861096", "0.6367814", "0.63268685", "0.630071", "0.62908566", "0.6234985", "0.6213996", "0.62030596", "0.6202348", "0.6195715", "0.61877364", "0.61877364", "0.6180449", "0.615920...
0.8775633
0
Returns True if other is an ancestor of this test (or is that test itself).
def HasAncestor(self, other): return (self == other) or (self.parent and self.parent.HasAncestor(other))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_ancestor(self, other):\n\n if other is self:\n return True\n elif hasattr(other, 'base'):\n return self.is_ancestor(other.base)\n else:\n return False", "def is_descendant(self, other):\n return other.is_ancestor(self)", "def is_in(self, other...
[ "0.87252444", "0.7472244", "0.7075495", "0.7023215", "0.6882201", "0.68549466", "0.68061453", "0.6715299", "0.6651208", "0.6608628", "0.659701", "0.6546176", "0.6493069", "0.64815205", "0.63963306", "0.6394533", "0.6335261", "0.63313156", "0.62963057", "0.62810576", "0.627620...
0.8287156
1
Returns the current test state from the state instance.
def GetState(self): return TestState.FromDictOrObject( self.root.state_instance.GetTestState(self.path))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_state(self):\n return self.__state", "def _get_state(self):\n return self.__state", "def _get_state(self):\n return self.__state", "def _get_state(self):\n return self.__state", "def _get_state(self):\n return self.__state", "def _get_state(self):\n return self.__state", "def...
[ "0.76212895", "0.76212895", "0.76212895", "0.76212895", "0.76212895", "0.76212895", "0.76212895", "0.76212895", "0.76212895", "0.76212895", "0.76212895", "0.76212895", "0.76212895", "0.76212895", "0.76212895", "0.76212895", "0.76212895", "0.76212895", "0.76212895", "0.76212895"...
0.8547658
0
Returns true if this node is a test group.
def IsGroup(self): return isinstance(self, TestGroup)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_group(self):\n return self._is_group", "def is_group(g, node):\n if node not in g.nodes():\n print('Not a node in the graph')\n return False\n elif g.node[node]['type'] == 'group':\n return True\n else:\n return False", "def has_node_groups(self, namespace=Non...
[ "0.72172475", "0.7139727", "0.7096164", "0.69602937", "0.68134856", "0.6761949", "0.6507491", "0.63584894", "0.6203636", "0.614735", "0.61234236", "0.5994723", "0.59826106", "0.5963674", "0.59611243", "0.5931166", "0.592078", "0.5870403", "0.58671546", "0.58316267", "0.581815...
0.7915062
0
Returns this node and children in a dictionary suitable for YAMLification.
def AsDict(self, state_map=None): node = {'id': self.id or None, 'path': self.path or None} if not self.subtests and state_map: state = state_map[self.path] node['status'] = state.status node['count'] = state.count node['error_msg'] = state.error_msg or None if self.subtests: n...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_dict(self):\r\n def node_to_dict(node):\r\n if len(node.children)==0:\r\n return node.info\r\n else:\r\n info_dict = node.info.copy()\r\n info_dict['children'] = []\r\n for c in node.children:\r\n inf...
[ "0.7082426", "0.70576924", "0.7001949", "0.69485635", "0.6759389", "0.67400837", "0.6666809", "0.66499925", "0.65858364", "0.65655017", "0.6533309", "0.65195733", "0.6475326", "0.6423271", "0.6357417", "0.63087386", "0.6294487", "0.622587", "0.61992675", "0.61903894", "0.6187...
0.0
-1
Get the placeholder assignments after normalize.
def mapping(self) -> Dict[str, str]: return self._normalizer.get_placeholders()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def infer_assignment(self):\r\n self.support_pruning()\r\n return {v: self.curr_domains[v][0]\r\n for v in self.variables if 1 == len(self.curr_domains[v])}", "def placeholders(self):\n rv = dict()\n for stage in self.stages:\n for name, ph_var in stage.place...
[ "0.6546146", "0.6443735", "0.643643", "0.60305905", "0.5791004", "0.5734934", "0.56722754", "0.56198215", "0.5552239", "0.5546004", "0.5520707", "0.5515866", "0.54954314", "0.5477008", "0.5442606", "0.54105896", "0.54082495", "0.5402434", "0.53924626", "0.5326455", "0.5296835...
0.5926346
4
Returns true iff we have matching subordinate endpoint.
def has_endpoint(self, endpoint_number: int, direction: USBDirection) -> USBEndpoint: return (self.get_endpoint(endpoint_number, direction) is not None)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _has_endpoint(self, endpoint):\n return self.endpoints.filter(pk=endpoint.pk).exists()", "def valid_endpoint(cls):\n\t\treturn cls.__subclasses__() == []", "def contains(self, possible_point):\n# if possible_point == self.endpoints[0] or possible_point == self.endpoints[1]:\n# retu...
[ "0.7355637", "0.6628543", "0.6609796", "0.64822406", "0.6400003", "0.63922644", "0.6301188", "0.6215098", "0.6166197", "0.61161476", "0.6056211", "0.60494876", "0.60310125", "0.6029338", "0.60259056", "0.59951144", "0.5992684", "0.5965913", "0.5962544", "0.5925459", "0.590480...
0.6145616
9
Return True if the lang param is present and URL isn't exempt.
def _is_lang_change(self, request): if 'lang' not in request.GET: return False return not any(request.path.endswith(url) for url in self.exempt_urls)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def validate_lang(lang):\n if lang in LANGUAGE_OPTIONS.keys():\n return True", "def isCleanUrl(self, name, langName, isValidIntl, isStripped):\n # logging.info(' >>>> isCleanUrl name [%s] langName [%s] isValidIntl [%s]', name, langName, isValidIntl)\n if (langName == 'en' and not isStripped) or ...
[ "0.7323595", "0.64322007", "0.64322007", "0.6125556", "0.6123799", "0.61120695", "0.5972247", "0.5830462", "0.5822171", "0.5816378", "0.58163774", "0.58098245", "0.5784358", "0.57709974", "0.5706111", "0.56920993", "0.56920993", "0.5665931", "0.5637", "0.5608741", "0.5605823"...
0.7540742
0
Compare one element of three cards to determine if they are all the same, or all different.
def compare_element(self, card1, card2, card3, element): e1 = card1[element] e2 = card2[element] e3 = card3[element] if (e1 == e2 and e2 == e3) or (e1 != e2 and e1 != e3 and e2 != e3): # All the same or all different. return 1 return 0
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_cards(self, cards):\n if len(cards) != 3:\n return False\n\n match = 0\n card1 = cards[0][1]\n card2 = cards[1][1]\n card3 = cards[2][1]\n\n match += self.compare_element(card1, card2, card3, 'shape')\n match += self.compare_element(card1, card2...
[ "0.75835973", "0.6676691", "0.6629698", "0.66104394", "0.65019184", "0.6489222", "0.6435462", "0.6434684", "0.64326954", "0.6394481", "0.63527066", "0.63523954", "0.6340301", "0.6329381", "0.6308832", "0.6259174", "0.62185717", "0.6159217", "0.61026245", "0.6102356", "0.60657...
0.85215586
0
Parse an invalid version.
def test_parse_invalid_version(self): version = VersionNumberScaleMeasurement.parse_version("This is not a version number") self.assertEqual(Version("0"), version)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def version_is_valid(version):\n try:\n return semver.parse(version)\n except (ValueError, TypeError):\n logger.debug('%s is not a valid version', version)\n return {}", "def parse_version(version):\n if version is None:\n raise ValueError(\"sbe:messageSchema/@version is requ...
[ "0.7375384", "0.6872092", "0.68124604", "0.6808332", "0.67721593", "0.6753474", "0.672828", "0.66914576", "0.66489553", "0.6632933", "0.6619009", "0.64824045", "0.64452106", "0.6406234", "0.6389749", "0.6317323", "0.61865604", "0.615476", "0.6128976", "0.6109858", "0.6077586"...
0.8135235
0
Test that debt target is not expired when a new issue is added.
def test_debt_target_not_expired_when_new_issue_added(self): measurement = self.measurement( self.metric(accept_debt=True, debt_target="100", issue_ids=["FOO-41", "FOO-42"]), count={"debt_target": "100"}, issue_status=[{"status_category": "done", "issue_id": "FOO-41"}], ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_debt_target_expired(self):\n measurement = self.measurement(\n self.metric(accept_debt=True, debt_target=\"100\", issue_ids=[\"FOO-40\"]),\n count={\"debt_target\": \"100\"},\n issue_status=[{\"status_category\": \"done\", \"issue_id\": \"FOO-40\"}],\n )\n ...
[ "0.7949988", "0.77672803", "0.6973192", "0.67723477", "0.6414009", "0.63958603", "0.63873535", "0.63640124", "0.6339702", "0.6339396", "0.6310996", "0.62400395", "0.62146246", "0.6095299", "0.6093503", "0.6028911", "0.6008512", "0.60053307", "0.5999598", "0.5998366", "0.59949...
0.85307115
0
Return True if wallet is greater than or equal to fee, otherwise False
def can_afford_entry_fee(self, fee): return self.wallet >= fee
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_funds(self, amount):\n if amount > self.get_balance():\n return False\n else:\n return True", "def check_funds(self, amount):\n if abs(amount)>self.get_balance(): return False\n else: return True", "def check_sufficient_funds(self, amount):\n b...
[ "0.75113904", "0.7412217", "0.68767715", "0.6752253", "0.6727848", "0.65802723", "0.6490926", "0.6485122", "0.642794", "0.6395635", "0.6267105", "0.6192457", "0.6117113", "0.6047069", "0.5999659", "0.599221", "0.59856784", "0.5965764", "0.59428436", "0.5935922", "0.58901346",...
0.75111663
1
Helper function to transform the tip pose given in the world frame to the eef pose.
def pose_tip2eef(self, pose: Union[tuple, list, np.ndarray], option=None): # any_T_tip -> any_T_eef pose_eef = self._pose_transform(pose, self.tTe, premultiply=False) if option == 'tuple' or (option is None and isinstance(pose, (tuple, list))): pose_eef = get_pose_2d_from_matrix(pose...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_tip_pose(self):\n world_pose_eef = get_link_pose(self.body, self.EEF_LINK_INDEX)\n wTe = get_matrix_from_pose_2d(world_pose_eef) # world_T_eef\n world_pose_eef = get_link_pose(self.body, self.TIP_LINK_INDEX)\n wTt = get_matrix_from_pose_2d(world_pose_eef) # world_T_tip\n ...
[ "0.72945035", "0.65058833", "0.64089745", "0.6276959", "0.59890205", "0.59792405", "0.59292626", "0.5884658", "0.5834132", "0.5765365", "0.575814", "0.57575226", "0.56921804", "0.56745374", "0.5572295", "0.5558999", "0.55432874", "0.554111", "0.55213577", "0.55141914", "0.549...
0.62756467
4
Evolve a wavefunction by u generated from a 1body Hamiltonian.
def evolve_fqe_givens_sector(wfn: Wavefunction, u: np.ndarray, sector='alpha') -> Wavefunction: if sector == 'alpha': sigma = 0 elif sector == 'beta': sigma = 1 else: raise ValueError("Bad section variable. Either (alpha) or (beta)") if u.shape[0] !...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def Equ_wave (previous_U):\n return lambda U: (U-previous_U)/DELTA_t+G((U + previous_U)/2)", "def H_wave (previous_U):\n H1 = np.dot(np.eye(n,n), 1./DELTA_t)\n H2 = np.dot(np.eye(n,n), 2)\n return lambda X: H1+np.dot(H_G(np.dot((X+previous_U),1./2)),H2)", "def evolve_ts(u, ui, a, dx, dy, dx2, dy2, ...
[ "0.6467316", "0.6446378", "0.6401784", "0.61282057", "0.6037421", "0.6002786", "0.59337413", "0.5880899", "0.57902235", "0.5699885", "0.5611269", "0.5594718", "0.55604005", "0.55227745", "0.5522105", "0.5507801", "0.54964584", "0.5463609", "0.5440256", "0.54399383", "0.543667...
0.53165406
27
Evolve a wavefunction by u generated from a 1body Hamiltonian. Evolve both alpha and beta sectors.
def evolve_fqe_givens(wfn: Wavefunction, u: np.ndarray) -> Wavefunction: wfn = evolve_fqe_givens_sector(wfn, u, sector='alpha') wfn = evolve_fqe_givens_sector(wfn, u, sector='beta') return wfn
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def evolve_fqe_givens_sector(wfn: Wavefunction, u: np.ndarray,\n sector='alpha') -> Wavefunction:\n if sector == 'alpha':\n sigma = 0\n elif sector == 'beta':\n sigma = 1\n else:\n raise ValueError(\"Bad section variable. Either (alpha) or (beta)\")\n\n ...
[ "0.65174896", "0.6153714", "0.6062043", "0.59139585", "0.5871363", "0.58057433", "0.57568526", "0.5681716", "0.56711286", "0.5632287", "0.56263644", "0.5542241", "0.547151", "0.5471453", "0.545643", "0.540714", "0.53245777", "0.52850854", "0.52847314", "0.5257687", "0.5251624...
0.642393
1
Evolve a wavefunction by u generated from a 1body Hamiltonian.
def evolve_fqe_givens_unrestricted(wfn: Wavefunction, u: np.ndarray) -> Wavefunction: rotations, diagonal = givens_decomposition_square(u.copy()) out = copy.deepcopy(wfn) # Iterate through each layer and time evolve by the appropriate # fermion operators for layer ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def Equ_wave (previous_U):\n return lambda U: (U-previous_U)/DELTA_t+G((U + previous_U)/2)", "def H_wave (previous_U):\n H1 = np.dot(np.eye(n,n), 1./DELTA_t)\n H2 = np.dot(np.eye(n,n), 2)\n return lambda X: H1+np.dot(H_G(np.dot((X+previous_U),1./2)),H2)", "def evolve_ts(u, ui, a, dx, dy, dx2, dy2, ...
[ "0.64692736", "0.64468443", "0.6401622", "0.6037062", "0.60054755", "0.5934396", "0.58831614", "0.5790353", "0.569961", "0.5614113", "0.5595035", "0.5561915", "0.55225676", "0.55220073", "0.55087775", "0.5496162", "0.5465592", "0.54431665", "0.54405963", "0.5436692", "0.54333...
0.612707
3
return a visual representation of the UserPersona as String. The default is " "
def fullname(self): parts = [] self.lastname and parts.append(self.lastname) self.firstname and parts.append(self.firstname) len(parts) == 0 and parts.append(self.userid) return ' '.join(parts)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __str__(self):\n return str(self.user_id) + \": \" + \\\n str(self.user_name) + \": \" + str(self.user_email)", "def __repr__(self):\n\n return \"\\n<User ID: {} Name: {} {}>\\n\".format (self.user_id,\n self.fname,\n ...
[ "0.74376816", "0.7296865", "0.7240386", "0.7240386", "0.7240386", "0.7240386", "0.7240386", "0.72331566", "0.71973366", "0.7181557", "0.71806985", "0.7167214", "0.7128597", "0.71202266", "0.7118662", "0.71117634", "0.7108211", "0.710078", "0.710078", "0.710078", "0.7099329", ...
0.0
-1
Return a cryptographically random string.
def create_nonce(): default_seed = 'ifh2847fhsn"lqOEYd@#Djh(&' hash = sha.new(default_seed) hash.update(str(datetime.utcnow())) return hash.hexdigest()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generateRandomString():\n return ''.join(b64encode(urandom(32)).decode('utf-8'))", "def generate_random_string():\n return \"\".join(random.choice(string.ascii_lowercase + string.digits) for _ in range(16)) # nosec", "def __generate_random_string():\n return uuid4().hex[:6].upper()", "def g...
[ "0.8494374", "0.7967045", "0.77649623", "0.77613014", "0.7576298", "0.7574232", "0.75535566", "0.748511", "0.74738127", "0.74399215", "0.7411332", "0.7409124", "0.7385575", "0.7369612", "0.7346189", "0.73395973", "0.7297913", "0.72905886", "0.72735626", "0.7261962", "0.725735...
0.0
-1
Create and return an authorization header. Returns (header, creation, nonce).
def create_authorization_header(username, password, creation=None, nonce=None): digest, creation, nonce = create_password_digest(password, creation, nonce) header = 'UsernameToken Username="%s", PasswordDigest="%s", Created="%s", Nonce="%s"' % ( username, digest, creation, nonce ) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def build_header(self):\n authstring = \"Bearer \" + self.auth_token\n header = {\n \"Authorization\": authstring,\n \"Content-Type\": \"application/json\",\n \"User-Agent\": self.user_agent,\n \"Accept-Encoding\": \"gzip\"\n }\n return header...
[ "0.68504906", "0.68492305", "0.681221", "0.680911", "0.67681205", "0.66249853", "0.65852547", "0.6519971", "0.6449289", "0.64442915", "0.6433978", "0.6390056", "0.6351271", "0.6342975", "0.6324382", "0.63168263", "0.62822807", "0.6267113", "0.6258026", "0.61708176", "0.615197...
0.79437095
0
Return True if digest is a valid digest of password. >>> digest, creation, nonce = create_password_digest('foo') >>> valid_password_digest('foo', digest, creation, nonce) True
def valid_password_digest(password, digest, creation, nonce, max_age=None): if not digest or not creation or not nonce: return False if not max_age: max_age = _max_nonce_age # don't accept creation times that are too old now = datetime.utcnow() created_dt = iso_to_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def password_is_valid(self, password):\n return Bcrypt().check_password_hash(self.password, password)", "def password_is_valid(self, password):\n return Bcrypt().check_password_hash(self.password, password)", "def valid_password(self, password):\n return check_hash(password, self.password)...
[ "0.708416", "0.708416", "0.7065819", "0.7006556", "0.6876132", "0.6795579", "0.67876554", "0.6760441", "0.6743898", "0.6740793", "0.66991943", "0.66975886", "0.6678237", "0.6633762", "0.65492076", "0.6514571", "0.650326", "0.64804727", "0.64505905", "0.64482105", "0.64401263"...
0.8422708
0
Takes a UTC DateTime.
def set_modified(self, dt): self.modified = dt_to_iso(dt)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fromutc(self, dt):\n if dt.tzinfo is None:\n return dt.replace(tzinfo=self)\n return super(UTC, self).fromutc(dt)", "def set_utc(date_time):\n utc = datetime.timezone(datetime.timedelta(0))\n date_time = date_time.replace(tzinfo=utc)\n return date_time", "def utc_datetime(...
[ "0.6975579", "0.6962471", "0.68758154", "0.6754713", "0.6665813", "0.6616258", "0.6616258", "0.6616258", "0.66031635", "0.6597842", "0.65895617", "0.6581197", "0.64907396", "0.6482422", "0.64281565", "0.6404498", "0.6399129", "0.6395959", "0.6370294", "0.635469", "0.6319016",...
0.0
-1
Takes a UTC DateTime.
def set_modified(self, dt): self.modified = dt_to_iso(dt)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fromutc(self, dt):\n if dt.tzinfo is None:\n return dt.replace(tzinfo=self)\n return super(UTC, self).fromutc(dt)", "def set_utc(date_time):\n utc = datetime.timezone(datetime.timedelta(0))\n date_time = date_time.replace(tzinfo=utc)\n return date_time", "def utc_datetime(...
[ "0.6975506", "0.69622475", "0.6875938", "0.67545027", "0.66658455", "0.6616034", "0.6616034", "0.6616034", "0.6602925", "0.65979975", "0.6589479", "0.6581037", "0.6490648", "0.6482301", "0.6428071", "0.64044476", "0.6398946", "0.63958406", "0.6370003", "0.6354751", "0.6319537...
0.0
-1
Takes a UTC DateTime.
def set_issued(self, dt): self.issued = dt_to_iso(dt)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fromutc(self, dt):\n if dt.tzinfo is None:\n return dt.replace(tzinfo=self)\n return super(UTC, self).fromutc(dt)", "def set_utc(date_time):\n utc = datetime.timezone(datetime.timedelta(0))\n date_time = date_time.replace(tzinfo=utc)\n return date_time", "def utc_datetime(...
[ "0.6975506", "0.69622475", "0.6875938", "0.67545027", "0.66658455", "0.6616034", "0.6616034", "0.6616034", "0.6602925", "0.65979975", "0.6589479", "0.6581037", "0.6490648", "0.6482301", "0.6428071", "0.64044476", "0.6398946", "0.63958406", "0.6370003", "0.6354751", "0.6319537...
0.0
-1
Takes a UTC DateTime.
def set_created(self, dt): self.created = dt_to_iso(dt)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fromutc(self, dt):\n if dt.tzinfo is None:\n return dt.replace(tzinfo=self)\n return super(UTC, self).fromutc(dt)", "def set_utc(date_time):\n utc = datetime.timezone(datetime.timedelta(0))\n date_time = date_time.replace(tzinfo=utc)\n return date_time", "def utc_datetime(...
[ "0.6975579", "0.6962471", "0.68758154", "0.6754713", "0.6665813", "0.6616258", "0.6616258", "0.6616258", "0.66031635", "0.6597842", "0.65895617", "0.6581197", "0.64907396", "0.6482422", "0.64281565", "0.6404498", "0.6399129", "0.6395959", "0.6370294", "0.635469", "0.6319016",...
0.0
-1
Return entry as XML string.
def output(self): entry = [] entry.append('''<entry> <title mode="escaped" type="text/html">%(title)s</title> <link rel="alternate" type="text/html" href="%(url)s" /> <issued>%(issued)s</issued> <modified>%(modified)s</modified> ''' % self.__di...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_xml(self):\n with io.StringIO() as string:\n string.write(ET.tostring(self.root, encoding=\"unicode\"))\n return string.getvalue()", "def toXML(self):\n item = \"<item uid=\\\"{uid}\\\" arg=\\\"{arg}\\\" valid=\\\"{valid}\\\"\"\n if(self.autocomplete!=None):\n ...
[ "0.6869378", "0.67117715", "0.67047393", "0.6628805", "0.6498415", "0.6424608", "0.6365732", "0.6362321", "0.6327101", "0.63154894", "0.6314639", "0.6311842", "0.6303648", "0.62564623", "0.6199303", "0.6127414", "0.6095097", "0.60768485", "0.60754484", "0.6065928", "0.6050105...
0.62891495
13
Given a string, returns a list containing _length_ sized pieces of the seq. For example, split_len('abcdefgh', 3) = ['abc', 'def', 'gh']
def split_len(seq, length): return [seq[i:i+length] for i in range(0, len(seq), length)]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def split_str_into_len(s, l=2):\r\n return [s[i:i+l] for i in range(0, len(s), l)]", "def get_word_lengths(s):\n return list(map(lambda si:len(si), s.split()))", "def split_seq(seq,size):\n return [seq[i:i+size] for i in range(0, len(seq), size)]", "def get_word_lengths(s):\n return [len(w) for w...
[ "0.7771089", "0.6592225", "0.65672016", "0.63935995", "0.63905644", "0.6376292", "0.63562685", "0.63397175", "0.6225668", "0.6222525", "0.60819787", "0.60710114", "0.59945035", "0.59915805", "0.59771425", "0.5976272", "0.59709847", "0.59709847", "0.58252406", "0.5758952", "0....
0.8035746
0
Returns description associated with this resource.
def get_description(self) -> Optional[str]: return self._description
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_description(self):\n return self.__description", "def get_description(self):\r\n return self.__description", "def _get_description(self):\n return self.__description", "def _get_description(self):\n return self.__description", "def get_description(self):\n return ...
[ "0.8336492", "0.82914555", "0.8250178", "0.8250178", "0.8235905", "0.8235905", "0.8235905", "0.8235905", "0.8217939", "0.8217939", "0.8217939", "0.8217939", "0.8217939", "0.8217939", "0.8217939", "0.8217939", "0.8217939", "0.8217939", "0.8217939", "0.8217939", "0.8217939", ...
0.0
-1
Return the workload name this Simpoint is associated with.
def get_workload_name(self) -> Optional[str]: return self._workload_name
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def workload_profile_name(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(self, \"workload_profile_name\")", "def name(self):\n return f\"PoolSense {BINARY_SENSORS[self.info_type]['name']}\"", "def name(self):\n return self.measurement_profile.name", "def name(self):\n r...
[ "0.74272215", "0.67942756", "0.67512816", "0.6715406", "0.66740584", "0.66740584", "0.66740584", "0.66740584", "0.66740584", "0.66740584", "0.66740584", "0.66740584", "0.66740584", "0.66740584", "0.66740584", "0.66740584", "0.66740584", "0.66740584", "0.66740584", "0.66740584",...
0.77204096
0
This function was created to maintain backwards compability for v21.1.0 and prior releases of gem5 where `Resource` was a class. In the interests of gem5resource specialization, the `Resource` class has been dropped. Instead users are advized to use the `obtain_resource` function which will return the correct `Abstract...
def Resource( resource_id: str, resource_directory: Optional[str] = None, download_md5_mismatch: bool = True, resource_version: Optional[str] = None, clients: Optional[List[str]] = None, ) -> AbstractResource: warn( "`Resource` has been deprecated. Please use the `obtain_resource` " ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _resource_factory(self, raw) -> ApiResource:\n raise NotImplemented", "def get_resource(self):\n raise errors.Unimplemented()", "def get_resource(self, name: str) -> ResourceBase:\n resource = self.get_payload(name)\n if not isinstance(resource, ResourceBase):\n raise...
[ "0.71609336", "0.7005341", "0.691584", "0.6439687", "0.621857", "0.61496073", "0.6128187", "0.61237407", "0.61237407", "0.61010855", "0.6072487", "0.6042288", "0.5981997", "0.59684485", "0.5952153", "0.593048", "0.59248257", "0.5894699", "0.5878017", "0.5859849", "0.5851275",...
0.6441405
3
``True`` if the position should be updated based on neighbors. Returns
def use_neighbor_placement(self): return self._use_neighbor_placement
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def calc_is_new_position(self, game_state: dict):\n current_position = game_state['self'][3]\n if current_position in self.positions:\n return False\n else:\n return True", "def pos_updated(self,next_pos):\n #if (int(self.oldx) == int(self.x) and int(self.oldy) == int(self.y)):\n ...
[ "0.7032947", "0.7022135", "0.67020416", "0.66221035", "0.6572099", "0.65589386", "0.65276814", "0.65166646", "0.64642835", "0.64432096", "0.6371319", "0.6329259", "0.6329259", "0.6329259", "0.6326402", "0.6286566", "0.6237664", "0.62094647", "0.62083465", "0.6157031", "0.6146...
0.0
-1
A very rough estimate of the duration of the waveform. An estimate of the waveform duration starting from flow. This is intended to be fast but not necessarily accurate. It should be an overestimate of the length. It is derived from a simplification of the 0PN postnewtonian terms and includes a fudge factor for possibl...
def rough_time_estimate(m1, m2, flow, fudge_length=1.1, fudge_min=0.02): m = m1 + m2 msun = m * lal.MTSUN_SI t = 5.0 / 256.0 * m * m * msun / (m1 * m2) / (numpy.pi * msun * flow) ** (8.0 / 3.0) # fudge factoriness return .022 if t < 0 else (t + fudge_min) * fudge_length
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def duration(self) -> float:\n return float(len(self.__samples))/float(self.__rate)", "def get_duration(period, aor, e):\n return 0.25 * period * np.sqrt(1 - e**2) / aor", "def get_duration(self):\n frame_dur = self.get_frame_duration()\n num_frames = self.get_num_frames()\n motion_dur = fra...
[ "0.6809631", "0.6683881", "0.6600433", "0.6581678", "0.6491546", "0.64422846", "0.64422846", "0.642567", "0.63207644", "0.62901556", "0.62901556", "0.62478316", "0.6244806", "0.624211", "0.6238588", "0.6223887", "0.6222593", "0.6158367", "0.61559445", "0.6147401", "0.6111985"...
0.5916745
37
Split a line of words into words
def line_split(self, line): line = re.sub(r"`(.*?)'", quote_replace, line) line = line.translate(None, '.:,()+*') return line.split()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def tokenize_words(line):\n return", "def wordize(lines):\n parser = Parser()\n tokenizer = Tokenizer()\n word_ctr = WordCounter()\n words = []\n for l in lines :\n if (l.rstrip()) :\n statement = parser.parseSentence(l, int(word_ctr))\n token_lists = toke...
[ "0.8133365", "0.71518725", "0.710461", "0.70399755", "0.7013255", "0.70115805", "0.69765246", "0.6967903", "0.69283277", "0.69283277", "0.69216174", "0.69216174", "0.69216174", "0.69216174", "0.69216174", "0.6903224", "0.6892397", "0.6892397", "0.68621147", "0.68488723", "0.6...
0.0
-1
Return the stations described in the given JSON data file. Each key in the returned dictionary is a station id, and each value is the corresponding Station object. Note that you need to call Station(...) to create these objects!
def create_stations(stations_file: str) -> Dict[str, 'Station']: # Read in raw data using the json library. with open(stations_file) as file: raw_stations = json.load(file) stations = {} for s in raw_stations['stations']: # Extract the relevant fields from the raw station JSON. ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def stations(self):\n try:\n stations_api = requests.get(self._stations_url)\n stations = {}\n for station in stations_api.json():\n station_id = station['id']\n station_name = station['name']\n stations[station_id] = station_name...
[ "0.74924695", "0.72170025", "0.70834684", "0.70042115", "0.69939035", "0.69657487", "0.6964106", "0.6939375", "0.6868818", "0.6733035", "0.67281866", "0.67109543", "0.6696497", "0.6635651", "0.66045696", "0.6580187", "0.65533316", "0.6532721", "0.65250486", "0.64687604", "0.6...
0.7926996
0
Returns the current tracker state as an object.
def current_state( self, event_verbosity: EventVerbosity = EventVerbosity.NONE ) -> Dict[Text, Any]: _events = self._events_for_verbosity(event_verbosity) if _events: _events = [e.as_dict() for e in _events] latest_event_time = None if len(self.events) > 0: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_state(self):\n\n # TODO: Assemble a dictionary containing the tracker state\n\n return {}", "def _get_state(self):\n return self.__state", "def _get_state(self):\n return self.__state", "def _get_state(self):\n return self.__state", "def _get_state(self):\n return self.__state", ...
[ "0.83822286", "0.7161613", "0.7161613", "0.7161613", "0.7161613", "0.7161613", "0.7161613", "0.7161613", "0.7161613", "0.7161613", "0.7161613", "0.7161613", "0.7161613", "0.7161613", "0.7161613", "0.7161613", "0.7161613", "0.7161613", "0.7161613", "0.7161613", "0.7161613", ...
0.0
-1
Get request message as environment information.
def get_environ(self): # REQUEST_METHOD environ = {'REQUEST_METHOD': self.command} # PATH_INFO and QUERY_STRING if '?' in self.path: path, qs = self.path.split('?', 1) else: path, qs = self.path, '' environ['PATH_INFO'] = path environ['QUE...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getRequest():\n return getLocal('request')", "def test_get_environment_string(self):\n pass", "def request_message(self) -> Optional[str]:\n return pulumi.get(self, \"request_message\")", "def get_environment(self):\r\n return self.mcas[0].get_environment()", "def _fetch_request_i...
[ "0.6505016", "0.6184309", "0.61148554", "0.60647887", "0.60334927", "0.60314906", "0.6020615", "0.5905464", "0.5905464", "0.5905464", "0.59035087", "0.5894478", "0.5839344", "0.5756319", "0.57538277", "0.57538277", "0.57435244", "0.57048094", "0.56968", "0.56779367", "0.56678...
0.59824646
7
Return a list containing all possible combinations of alternatives from the given grids and the corresponding total rating of that combination of alternatives. grids list of Grid
def create_rules(self, grids): from ..models import Rule alts = [grid.get_alternative_total_rating_tuples() for grid in grids] combinations = itertools.product(*alts) rules = [] for combi in combinations: alts, ratings = zip(*combi) rules.append(Rule(alts...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_combination(grid,pt):\n\n # find simplex interpolation coefficients\n coefs,tracks = find_interpolation_coefficients(grid,pt,grid.tessellation,grid.ndx)\n if (coefs is None): return None\n\n # find ages:\n ages = find_ages(coefs,tracks,pt[-1])\n if (ages is None): return None\n\n n = ...
[ "0.5959448", "0.5861889", "0.5765868", "0.5627832", "0.5550611", "0.55025434", "0.54806197", "0.5477299", "0.5419002", "0.53558767", "0.5354017", "0.5347773", "0.5336215", "0.5302203", "0.5280155", "0.52576506", "0.5257206", "0.5245959", "0.524559", "0.52394295", "0.522158", ...
0.72572803
0
Downloads the dataset from given url and extracts features, class labels and feature names.
def load_data(url: str, target_var: str) -> tuple: # link = "http://archive.ics.uci.edu/ml/machine-learning-databases/00519/heart_failure_clinical_records_dataset.csv" data = pd.read_csv(url) X = data.copy() y = X.pop(target_var) columns = X.columns return X.values, y.values, columns
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def download_datasets_csv(url):\n # dataset = pd.read_csv(url, sep='\\t')\n dataset = pd.read_csv(url, sep=\",\")\n dataset.columns = dataset.columns.str.replace(\" \", \"_\")\n return dataset", "def downloadDataset(datasetName, url):\n\n baseFolder = os.path.dirname(os.path.abspath(__file__))\n ...
[ "0.6495776", "0.64665216", "0.63410586", "0.61738825", "0.6162709", "0.61371934", "0.61182535", "0.6088954", "0.6087023", "0.6039434", "0.598119", "0.59385884", "0.5889935", "0.58829737", "0.5873307", "0.5857077", "0.584909", "0.58332866", "0.5709856", "0.5688253", "0.5672203...
0.5642872
25
String for representing the Model object (in Admin site etc.)
def __str__(self): return self.name
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __str__(self):\n return super().__str__() + self.model.__str__()", "def __str__(self):\n return '%s%s' % (self.name, ' - %s' % self.model if self.model else '')", "def __str__(self):\n model = self._meta.verbose_name.title()\n return f\"{model:s}: {self.name:s}\"", "def __str_...
[ "0.78009075", "0.7710605", "0.7673848", "0.7673848", "0.7523759", "0.74037886", "0.73972905", "0.73759353", "0.7326191", "0.72697985", "0.7242019", "0.7234025", "0.7205552", "0.71734023", "0.71664774", "0.7108678", "0.70352817", "0.70352817", "0.7011228", "0.69860566", "0.696...
0.0
-1
Returns the url to access a detail record for this book.
def get_absolute_url(self): return reverse('tag-detail', args=[str(self.id)])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_absolute_url(self):\n return reverse('book-detail', args=[str(self.id)]) \n # Returns an URL that can be used to access a detail record for this model \n # (for this to work we will have to \n # -- Define a URL mapping that has the name 'book-detail' (name='book-detail')\n ...
[ "0.76990575", "0.7611185", "0.7257499", "0.7257499", "0.7257499", "0.7117704", "0.6992158", "0.69547594", "0.6935497", "0.684423", "0.6591669", "0.6543265", "0.6541738", "0.64656514", "0.6445659", "0.64323515", "0.64318234", "0.6417527", "0.6407866", "0.638662", "0.6367192", ...
0.0
-1
String for representing the Model object (in Admin site etc.)
def __str__(self): return self.name
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __str__(self):\n return super().__str__() + self.model.__str__()", "def __str__(self):\n return '%s%s' % (self.name, ' - %s' % self.model if self.model else '')", "def __str__(self):\n model = self._meta.verbose_name.title()\n return f\"{model:s}: {self.name:s}\"", "def __str_...
[ "0.7801624", "0.77112937", "0.767426", "0.767426", "0.7524702", "0.74020135", "0.7398639", "0.7378346", "0.7328583", "0.7270028", "0.7244434", "0.7233179", "0.7205981", "0.7174358", "0.7165676", "0.7108926", "0.70379156", "0.70379156", "0.7012156", "0.69865996", "0.6968002", ...
0.0
-1
String for representing the Model object (in Admin site etc.)
def __str__(self): return self.name
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __str__(self):\n return super().__str__() + self.model.__str__()", "def __str__(self):\n return '%s%s' % (self.name, ' - %s' % self.model if self.model else '')", "def __str__(self):\n model = self._meta.verbose_name.title()\n return f\"{model:s}: {self.name:s}\"", "def __str_...
[ "0.7801624", "0.77112937", "0.767426", "0.767426", "0.7524702", "0.74020135", "0.7398639", "0.7378346", "0.7328583", "0.7270028", "0.7244434", "0.7233179", "0.7205981", "0.7174358", "0.7165676", "0.7108926", "0.70379156", "0.70379156", "0.7012156", "0.69865996", "0.6968002", ...
0.0
-1
Returns the url to access a detail record for this book.
def get_absolute_url(self): return reverse('book-detail', args=[str(self.id)])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_absolute_url(self):\n return reverse('book-detail', args=[str(self.id)]) \n # Returns an URL that can be used to access a detail record for this model \n # (for this to work we will have to \n # -- Define a URL mapping that has the name 'book-detail' (name='book-detail')\n ...
[ "0.7700398", "0.7613079", "0.7119572", "0.6994155", "0.6954283", "0.6938047", "0.6845822", "0.6592432", "0.6541922", "0.6541742", "0.64664704", "0.6445213", "0.6433065", "0.6432632", "0.64177823", "0.6407731", "0.6388763", "0.63671756", "0.63671756", "0.63593304", "0.63593304...
0.7259745
4
String for representing the Book object.
def __str__(self): return self.title
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __repr__(self) -> str:\n return f\"Book('{self.author}', '{self.title}', '{self.publisher}', '{self.shelf}', '{self.category}', \" \\\n f\"'{self.subject}')\"", "def __str__(self):\n return '{0} ({1})'.format(self.id, self.book)", "def __str__(self):\n return '{0} ({1})'....
[ "0.8500309", "0.7988276", "0.79347605", "0.7821464", "0.77893806", "0.77588505", "0.7664232", "0.752065", "0.74825776", "0.7331979", "0.73239887", "0.7232598", "0.71971804", "0.7035316", "0.69258535", "0.68964005", "0.68964005", "0.6892451", "0.68878984", "0.6866609", "0.6865...
0.0
-1
Check for any bullets if they have hit an alien and if so then get rid of the alien. Also spawns new fleet if last fleet is annihalated
def _check_bullet_alien_collisions(self): collisions = pygame.sprite.groupcollide(self.bullets, self.aliens, True, True) if collisions: for hits in collisions.values(): self.stats.score += self.settings.alien_points * len(hits) self.scoreboard.prep_score() ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _check_bullet_alien_collision(self):\n # checks if a bullet hits an alien\n # if it did, the bullet + alien will be removed\n collisions = pygame.sprite.groupcollide(self.bullets, self.aliens, True, True)\n\n # adds points to score on collision\n if collisions:\n f...
[ "0.78029644", "0.76365787", "0.75500643", "0.7455024", "0.72574365", "0.71892226", "0.7079051", "0.68577343", "0.6718862", "0.67108375", "0.6704042", "0.66983473", "0.6513901", "0.6489391", "0.6487545", "0.64367014", "0.64360905", "0.64121234", "0.6391954", "0.63836426", "0.6...
0.75447315
3
Updates the aliens positions.
def _aliens_update(self): self._check_fleet_edges() self.aliens.update() # Look for alien-ship collisions. if pygame.sprite.spritecollideany(self.ship, self.aliens): self._ship_hit() # Look for aliens reaching bottom of the screen self._check_aliens_bottom()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _update_aliens(self):\n\n #update position of aliens\n self.aliens.update()\n\n #increase counter\n self.counter += 1\n\n #delete offscreen aliens\n for alien in self.aliens.copy():\n if alien.rect.right < 0:\n self.aliens.remove(alien)\n\n ...
[ "0.77675235", "0.75433487", "0.7517483", "0.73686004", "0.7155843", "0.70730543", "0.7004507", "0.6915472", "0.68943447", "0.6853731", "0.67003167", "0.66999394", "0.6623743", "0.64582926", "0.64294034", "0.63272583", "0.6258216", "0.62523997", "0.6224449", "0.621462", "0.615...
0.73187447
4
Check if any aliens have reached the bottom of the screen.
def _check_aliens_bottom(self): screen_rect = self.screen.get_rect() for alien in self.aliens.sprites(): if alien.rect.bottom >= screen_rect.bottom: # Treat the same as if ship got hit. self._ship_hit() break
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _check_aliens_bottom(self):\n screen_rect = self.screen.get_rect()\n for alien in self.aliens.sprites():\n if alien.rect.bottom >= screen_rect.bottom:\n self._ship_hit()\n break", "def _check_aliens_bottom(self):\n screen_rect = self.screen.get_re...
[ "0.84619975", "0.84619975", "0.7864565", "0.77854824", "0.7772348", "0.77700484", "0.76433814", "0.7636987", "0.7513152", "0.7461978", "0.7070484", "0.6924367", "0.6813102", "0.66493016", "0.657903", "0.64892584", "0.64599264", "0.64534354", "0.6386031", "0.63544416", "0.6332...
0.8487487
0
Current density due to a harmonic electric dipole
def current_density(self, xyz): return self.sigma * self.electric_field(xyz)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def density(self):\n return (1e-3*self.molar_mass) * self.pressure / (gas_constant * self.temperature) # kg/m^3", "def current_density(self, xyz):\n\n j = self.electric_field(xyz) / self.rho\n return j", "def density(self):\n return self.get_density()", "def density( self ) :\n ...
[ "0.71840376", "0.7042334", "0.695533", "0.68963265", "0.68963265", "0.68963265", "0.6847159", "0.67914796", "0.6769513", "0.67483324", "0.67244685", "0.66476434", "0.6630878", "0.66202843", "0.6611444", "0.6586477", "0.6564632", "0.65513265", "0.6514661", "0.65125763", "0.646...
0.6951517
3
Removes the unit_ prefix from a unit attribute. For example, `_parse_unit_attr("unit_act")` will return `"act"`.
def _parse_unit_attr(attr: str) -> str: parts = attr.split('_', maxsplit=1) valid_attr = len(parts) == 2 and parts[0] == "unit" if not valid_attr: raise ValueError("{0} is not a valid unit attribute.".format(attr)) return parts[1]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _strip_optunit(thing, unit):\n if u.is_quantity(thing):\n return thing.value_in_unit(unit)\n return thing", "def format_attr(attr: str) -> str:\r\n prefix = query_params[Toml.REMOVE_PREFIX]\r\n suffix = query_params[Toml.REMOVE_SUFFIX]\r\n prefix_len = len(prefix)\r\n ...
[ "0.6248072", "0.61667264", "0.60530084", "0.586516", "0.58604455", "0.58442336", "0.58054173", "0.5797026", "0.5742074", "0.567695", "0.5630956", "0.56055146", "0.55520505", "0.55413646", "0.5474765", "0.54463446", "0.54281425", "0.54007167", "0.53734976", "0.5371237", "0.535...
0.7251399
0
Returns the average activation of the layer's units.
def avg_act(self) -> float: return torch.mean(self.units.act)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def avg_net(self) -> float:\n return torch.mean(self.units.net)", "def _get_mean(self):\n mu = self._get_conditional_negative_energy()\n return sigmoid(mu)", "def spatial_avg(self, input_layer):\n return tf.reduce_mean(input_layer, [2, 3], name='spatial_avg')", "def mean(self):\n ...
[ "0.69964594", "0.6915076", "0.6747515", "0.66701716", "0.66212344", "0.62630844", "0.6182448", "0.61810803", "0.61735374", "0.61544174", "0.61466193", "0.6105623", "0.60909224", "0.6086554", "0.6084948", "0.605586", "0.60527205", "0.6048957", "0.6039941", "0.60376", "0.60376"...
0.74216086
0
Returns the average net input of the layer's units.
def avg_net(self) -> float: return torch.mean(self.units.net)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def spatial_avg(self, input_layer):\n return tf.reduce_mean(input_layer, [2, 3], name='spatial_avg')", "def _get_mean(self):\n return [layer._get_mean() for layer in self.layers]", "def mean(self):\n return self.sum / self.sum_weights", "def average(self):\n s = self.sum()\n ...
[ "0.7476362", "0.68100595", "0.6617707", "0.6457264", "0.64329803", "0.6392206", "0.6390806", "0.63399464", "0.63184065", "0.63024646", "0.6276798", "0.6275908", "0.6272822", "0.6272822", "0.62665796", "0.6236386", "0.62281203", "0.61764216", "0.6168962", "0.6145486", "0.61360...
0.7616056
0
Test for the external http inline link
def test_external_inline_http(self): assert self.search( LINK_PATTERN % (EXTERNAL_CLASS, EXTERNAL_INLINE_LINK_HTTP, EXTERNAL_INLINE_TEXT_HTTP) )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def GoogleCode_IsExternalLink(wikifier, link):\n\n if GoogleCode_Exists(wikifier, link):\n return False;\n\n if URL.match(link):\n return True\n\n if '.' in link or '\\\\' in link or '/' in link or '#' in link:\n return True\n\n return False", "def test_external_inline_https(self...
[ "0.7755666", "0.7687817", "0.7624167", "0.7369923", "0.70497745", "0.6856061", "0.6837296", "0.6830296", "0.66895825", "0.66432387", "0.6611051", "0.6604564", "0.65828246", "0.65673614", "0.6536324", "0.6473654", "0.6465498", "0.6463018", "0.6439305", "0.640797", "0.640311", ...
0.8047165
0
Test for the external https inline link
def test_external_inline_https(self): assert self.search( LINK_PATTERN % (EXTERNAL_CLASS, EXTERNAL_INLINE_LINK_HTTPS, EXTERNAL_INLINE_TEXT_HTTPS) )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_external_reference_https(self):\n assert self.search(\n LINK_PATTERN\n % (\n EXTERNAL_CLASS,\n EXTERNAL_REFERENCE_LINK_HTTPS,\n EXTERNAL_REFERENCE_TEXT_HTTPS,\n )\n )", "def test_external_inline_http(self):\n ...
[ "0.7710757", "0.75346524", "0.7413679", "0.7205063", "0.694342", "0.68705314", "0.66175586", "0.6616176", "0.65890807", "0.6556849", "0.6488944", "0.6375207", "0.6372186", "0.63611573", "0.6360159", "0.6334702", "0.6269985", "0.62238896", "0.6194349", "0.6191165", "0.6175406"...
0.83391863
0
Bidirectional RNN of CTPN.
def Bidirectional_RNN(inputs, rnn_units=256, scope="gru"): if "lstm" in scope: rnn_layer = layers.LSTM elif "gru" in scope: rnn_layer = layers.GRU else: ValueError("Optional RNN layer: '*lstm', '*gru'.") with K.name_scope("bidirectional_" + scope): # Based on av...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(\n self,\n n_in_channel=1,\n nclass=10,\n attention=True,\n activation=\"glu\",\n dropout=0.5,\n train_cnn=True,\n rnn_type=\"BGRU\",\n n_RNN_cell=128,\n n_layers_RNN=2,\n dropout_recurrent=0,\n cnn_integration=False,\...
[ "0.70599073", "0.6841565", "0.649373", "0.63954735", "0.6383297", "0.6146673", "0.6032671", "0.5998843", "0.58858556", "0.5864402", "0.5829076", "0.58134615", "0.580539", "0.5772774", "0.5758394", "0.57426864", "0.57426864", "0.5737274", "0.573379", "0.5729653", "0.5724099", ...
0.6146169
6
X,Y parts of meshgrid Mihav's implementation
def integrate_3D(x, y, z, xlim, ylim, zlim, csd, xlin, ylin, zlin, X, Y, Z): Nz = zlin.shape[0] Ny = ylin.shape[0] m = np.sqrt((x - X)**2 + (y - Y)**2 + (z - Z)**2) m[m < 0.0000001] = 0.0000001 z = csd / m Iy = np.zeros(Ny) for j in xrange(Ny): Iz = np.zeros(Nz) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def xy_mesh(nx, ny, x_min=0, x_max=1, y_min=0, y_max=1):\n\n\tx = np.linspace(x_min, x_max, nx)\n\ty = np.linspace(y_min, y_max, ny)\n\txv, yv = np.meshgrid(x, y)\n\t\n\treturn xv, yv", "def ij_coordinates(self):\n\n x = np.arange(self.nx)\n y = np.arange(self.ny)\n return np.meshgrid(x, y)"...
[ "0.7560791", "0.7290006", "0.7249657", "0.7171141", "0.7093235", "0.7020099", "0.6994099", "0.6994099", "0.69871753", "0.69871753", "0.6944629", "0.692997", "0.6917998", "0.68721795", "0.6837775", "0.6837775", "0.6837775", "0.6837775", "0.6833452", "0.67925245", "0.6782209", ...
0.0
-1
What is the value of this state under the best action? Concretely, this is given by V(s) = max_{a in actions} Q(s,a)
def getValue(self, state): util.raiseNotDefined()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def bestAction(self, state):\n action = self.q_network.chooseBestAction(state)\n V = max(self.q_network.qValues(state))\n return action, V", "def computeActionFromValues(self, state):\n \"*** YOUR CODE HERE ***\"\n maxvalue = -100000000\n bestaction = None\n for a...
[ "0.8471306", "0.8411173", "0.8074187", "0.80544055", "0.80480546", "0.79577166", "0.7948263", "0.79347116", "0.7931858", "0.7929813", "0.79224104", "0.7872217", "0.7824365", "0.7782533", "0.7778754", "0.775486", "0.77246475", "0.7699368", "0.7653566", "0.7642246", "0.7628273"...
0.0
-1
Returns a dict from features to counts Usually, the count will just be 1.0 for indicator functions.
def getFeatures(self, state, action, thisAgent): util.raiseNotDefined()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_counts(self, X: np.ndarray) -> Dict[int, np.ndarray]:\n return {f: np.bincount(X[:, f].astype(int), minlength=n_cat) for f, n_cat in\n self.categories_per_feature.items()}", "def count_label_feature_frequency(self):\n label_feature_frequency = {}\n for label in self.l...
[ "0.78215027", "0.76435983", "0.7401831", "0.7268877", "0.718714", "0.7145538", "0.693373", "0.6876234", "0.686172", "0.6825929", "0.67843133", "0.67244554", "0.67213726", "0.6715564", "0.66551185", "0.66172785", "0.6570453", "0.6563888", "0.65494996", "0.6508152", "0.6482701"...
0.0
-1
Performs equality comparison. If comparing against another instance of _MethodConnection, the comparison is made between the constituent components of the bound method. Otherwise, this method will return False.
def __eq__(self, other): if isinstance(other, _MethodConnection): return (self._im_func == other._im_func and self._im_self_ref == other._im_self_ref and self._im_class == other._im_class) return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __eq__(self, other: 'GatewayVirtualConnection') -> bool:\n if not isinstance(other, self.__class__):\n return False\n return self.__dict__ == other.__dict__", "def __eq__(self, other):\n if isinstance(other, _DirectConnection):\n return self._callback_ref == other._...
[ "0.67261803", "0.66552955", "0.6655067", "0.6567932", "0.6489885", "0.6456508", "0.6456508", "0.6456508", "0.6456508", "0.6456508", "0.6456508", "0.6456508", "0.6456508", "0.6456508", "0.6456508", "0.6456508", "0.6456508", "0.6456508", "0.6456508", "0.6380068", "0.63798815", ...
0.8354931
0
Updates the position and size of the rectangle.
def update(self, pos=None, size=None): self.__node.pos = (pos[0]-size[0]/2, pos[1]-size[1]/2) self.__node.size = size
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update(self):\n self.rect = (self.x, self.y, self.width, self.height)", "def update(self):\n self.rect.x += self.change_x\n self.rect.y += self.change_y", "def update(self):\n self.rect.x += self.change_x\n self.rect.y += self.change_y", "def update(self):\r\n se...
[ "0.8384962", "0.7891583", "0.7891583", "0.7787605", "0.76663786", "0.7529469", "0.7331406", "0.7243508", "0.716976", "0.7139886", "0.707521", "0.7059984", "0.70564765", "0.70078963", "0.6950517", "0.6916052", "0.69149554", "0.690967", "0.6888426", "0.6838328", "0.6720548", ...
0.62733257
47
Return a unicode object on Python 3 and a bytes object on Python 2
def default_string(text, encode="utf-8"): if not PY3: if isinstance(text, unicode): # pylint: disable=undefined-variable result = text.encode(encode) else: result = text else: if isinstance(text, bytes): resul...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_bytes2unicode():\n if backwards.PY2: # pragma: Python 2\n res = backwards.unicode_type('hello')\n backwards.assert_unicode(res)\n nt.assert_equal(backwards.bytes2unicode('hello'), res)\n nt.assert_equal(backwards.bytes2unicode(unicode('hello')), res)\n nt.assert_equa...
[ "0.7692303", "0.7484009", "0.7428445", "0.71876967", "0.714974", "0.714974", "0.71446425", "0.71334255", "0.7068729", "0.70685756", "0.70585614", "0.7044192", "0.702749", "0.702749", "0.702749", "0.702749", "0.702749", "0.702749", "0.7010694", "0.699383", "0.6989764", "0.69...
0.0
-1
Function will convert an arcgis table into a pandas dataframe with an object ID index, and the selected input fields. Uses TableToNumPyArray to get initial data.
def arcgis_table_to_dataframe(in_fc, input_fields=None, query="", skip_nulls=False, null_values=None): OIDFieldName = arcpy.Describe(in_fc).OIDFieldName if input_fields: final_fields = [OIDFieldName] + input_fields else: final_fields = [field.name for field in arcpy.ListFields(in_fc)] np...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def table_to_data_frame(in_table, input_fields=None, where_clause=None):\n OIDFieldName = arcpy.Describe(in_table).OIDFieldName\n if input_fields:\n final_fields = [OIDFieldName] + input_fields\n else:\n final_fields = [field.name for field in arcpy.ListFields(in_table)]\n data = [row for...
[ "0.6806674", "0.60106766", "0.58832604", "0.5779051", "0.5770023", "0.572546", "0.56946844", "0.5674356", "0.5672547", "0.5611763", "0.56050265", "0.55698717", "0.5561268", "0.5526062", "0.5473312", "0.5467393", "0.5444699", "0.5432899", "0.53706425", "0.5348424", "0.5346139"...
0.7759994
0
Returns a set of pairs from a list eg if the list is [1, 2, 3] returns [(1, 2), (2, 3)]
def get_pairs(my_list): return [(current, my_list[idx + 1] if - 1 else None) for idx, current in enumerate(my_list) if idx < len(my_list) - 1]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def list_to_pairs(l):\n return {(l[2*i], l[2*i+1]) for i in range(len(l)/2)}", "def pairs(lst):\r\n\tfor i in range(1, len(lst), 2):\r\n\t\tyield lst[i-1], lst[i]", "def __unordered_pairs(l):\n\n return [(l[i], l[j]) for i in range(len(l) - 1) for j in range(i + 1, len(l))]", "def pairs(lst):\n i = ...
[ "0.76769555", "0.7475579", "0.74348855", "0.7001826", "0.6996558", "0.67464036", "0.6644373", "0.6575346", "0.645916", "0.6458086", "0.6451812", "0.6327511", "0.63258916", "0.6272453", "0.6272453", "0.62359446", "0.62358856", "0.6168561", "0.61575514", "0.6146467", "0.6119382...
0.74457395
2
Gets the 1byte 8bits string, as writed in the tag, from the unicode, returned by tag.get().
def get_tag_str(string): result = [] for char in string: if 0 < ord(char) < 256: result.append(chr(ord(char))) else: result.append(char) return "".join(result)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def utf8(num):\n # code de la prof louche\n if num < 8:\n return 1\n else:\n return num//6+1\n\n return binary", "def _get_unicode_value(value: Union[Text, bytes]) -> Text:\n decoded_value = stats_util.maybe_get_utf8(value)\n # Check if we have a valid utf-8 string. If not, assign a p...
[ "0.60388136", "0.59449506", "0.59394777", "0.59174234", "0.5893981", "0.5810036", "0.5799288", "0.5792435", "0.57895654", "0.57471424", "0.57282174", "0.5724308", "0.5639128", "0.5639128", "0.5639128", "0.5620825", "0.5591751", "0.55812293", "0.55773085", "0.55768454", "0.555...
0.54113626
31
Checks if a key is between _from_ and _to_ or equal to _to_ on the ring. If _from_ and _to_ are equal, returns True.
def between(key: int, fr: int, to: int) -> bool: if fr == to: return True if fr > to: return key > fr or key <= to return key > fr and key <= to
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def within_time_interval(self, from_time, to_time, time):\n\t\tif from_time == None:\n\t\t\tif to_time == None:\n\t\t\t\treturn True\n\t\t\telse:\n\t\t\t\treturn bool(time <= to_time)\n\t\telse:\n\t\t\tif to_time == None:\n\t\t\t\treturn bool(time >= from_time)\n\n\t\treturn bool((time >= from_time) and (time <= t...
[ "0.6104028", "0.5961235", "0.5856892", "0.5758627", "0.57217", "0.57182115", "0.5645745", "0.56402236", "0.5639159", "0.55818915", "0.5565264", "0.54980606", "0.546903", "0.5468121", "0.54589367", "0.54332536", "0.5426839", "0.54118395", "0.54108", "0.5388942", "0.53854334", ...
0.76660794
0
Remove stop words and steam text
def remove_and_stemming(text, steam=False): stop_words = set(stopwords.words('english')) stop_words.update( ['~', '.', ':', ',', ';', '?', '¿', '!', '¡', '...', '/', '\'', '\\', '\"', '-', 'amp', '&', 'rt', '[', ']', '":', '--&', '(', ')', '|', '*', '+', '%', '$', '_', '@', 's', 'ap', ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove_stopwords(self,text):\n return \" \".join([word for word in str(text).split() if word not in self.STOPWORDS])", "def remove_stopwords_fun(self):\n tokens = str(self.doc).split()\n cleaned_tokens = [token for token in tokens\n if token.lower() not in self.s...
[ "0.80621713", "0.8057364", "0.80325174", "0.8006171", "0.7962217", "0.7941643", "0.79011446", "0.7728401", "0.7725139", "0.77106684", "0.76989716", "0.7654973", "0.7652837", "0.7591295", "0.75778854", "0.75189817", "0.7494272", "0.74576247", "0.74576247", "0.74576247", "0.745...
0.7128313
38
Convert Integer to onehot vector
def int2onehot(x, length): assert x > 0 and x < length assert isinstance(x, int) assert isinstance(length, int) ohv = np.zeros([length], dtype=np.float32) ohv[x] = 1 return ohv
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def one_hot(y_):\n y_ = y_.reshape(len(y_))\n n_values = int(np.max(y_)) + 1\n n_values = 6\n return np.eye(n_values)[np.array(y_, dtype=np.int32)] # Returns FLOATS", "def to_one_hot(v):\n n = len(v)\n m = max(v) + 1\n out = np.zeros((n, m))\n out[np.arange(n), v] = 1\n return out", ...
[ "0.8231864", "0.8230908", "0.8188341", "0.8175699", "0.8157209", "0.8117434", "0.80875933", "0.80693007", "0.8057325", "0.79855186", "0.7979528", "0.79351777", "0.7892738", "0.7889967", "0.7879773", "0.7852498", "0.78483856", "0.7766263", "0.7760869", "0.7723347", "0.7720615"...
0.81546724
5
Adds a field for a maximum precision floating point number.
def add_long_float(self, name, file_only=False): if self._have_logged: raise RuntimeError('Cannot add fields after logging has started.') # Example: 17 digits = width 25 # -1.23456699999999992e-299 # 1234567890123456789012345 # 1 23456789012345678 # Example...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def float_parameter(level, maxval):\n return float(level) * maxval / 10.", "def add_float(self, name, width=9, file_only=False):\n if self._have_logged:\n raise RuntimeError('Cannot add fields after logging has started.')\n\n # Example: 5 digits => width 11\n # -1.234e-299\n ...
[ "0.59441394", "0.579989", "0.57804924", "0.5775495", "0.5762475", "0.57519263", "0.55415416", "0.5530851", "0.5454839", "0.5454464", "0.5424442", "0.54001266", "0.53827864", "0.53693813", "0.5292192", "0.5275924", "0.52746975", "0.52746975", "0.5256474", "0.5231602", "0.52289...
0.6669364
0
Adds a field showing a formatted time (given in seconds).
def add_time(self, name, file_only=False): if self._have_logged: raise RuntimeError('Cannot add fields after logging has started.') # Check name name = str(name) # Determine field width width = max(len(name), 8) # Add field f1 = f2 = None se...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def format_time(self, time):\n hours = time // 3600\n time = time - hours*3600\n minutes = time // 60\n seconds = time - minutes*60\n return ('%d:%d:%d' %(hours, minutes, seconds))", "def _format_time(seconds):\n hrs = seconds // 3600\n seconds -= 3600 * hrs\n mins = s...
[ "0.6833884", "0.6812204", "0.6691628", "0.6662432", "0.65091133", "0.64945614", "0.64874995", "0.6466244", "0.6430194", "0.6426254", "0.6393009", "0.63896203", "0.63846636", "0.6375752", "0.6372314", "0.6366959", "0.63507336", "0.6300499", "0.62330073", "0.62271285", "0.62087...
0.63973784
10
Enables logging to screen if an output ``stream`` is passed in. Logging to screen can be disabled by passing ``stream=None``.
def set_stream(self, stream=sys.stdout): if self._have_logged: raise RuntimeError('Cannot configure after logging has started.') self._stream = stream
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_stream(self, stream):\n\n for handler in self.handlers[:]:\n if isinstance(handler, logging.StreamHandler):\n self.handlers.remove(handler)\n\n if stream is not None:\n stream_handler = logging.StreamHandler(stream)\n stream_handler.addFilter(_S...
[ "0.6377226", "0.6117433", "0.6064815", "0.59997314", "0.5972256", "0.5893454", "0.57410854", "0.571663", "0.57003826", "0.56164306", "0.55964345", "0.5578915", "0.5546357", "0.5476954", "0.54725367", "0.5459003", "0.5457599", "0.54564285", "0.54116195", "0.5383457", "0.536107...
0.70919865
0
Remove all handlers from this event object.
def reset(self): self.__handlers = []
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove_hook(self):\n for handle in self.handlers:\n handle.remove()", "def remove_hook(self):\n for handle in self.handlers:\n handle.remove()", "def release_handlers(self):\n for handler in self.handlers:\n handler.close()", "def _clean(self):\n\t\tf...
[ "0.7590513", "0.7590513", "0.71608186", "0.70596224", "0.70309407", "0.6837315", "0.6762741", "0.6760301", "0.67196596", "0.66944957", "0.6678199", "0.65662545", "0.6510765", "0.6505952", "0.6492501", "0.64834875", "0.6427863", "0.6406144", "0.6402371", "0.63706493", "0.63679...
0.71553874
3