query
stringlengths
9
3.4k
document
stringlengths
9
87.4k
metadata
dict
negatives
listlengths
4
101
negative_scores
listlengths
4
101
document_score
stringlengths
3
10
document_rank
stringclasses
102 values
Function to retreive the bin number
def find_bin(self, x): return (x - self.bin_edges[0]) // self.bin_width
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getBinIndex(self, x):\n\t\tb = -1\n\t\tif x == self._max_val: # final bin is [low, high], where others are [low,high)\n\t\t\tb = len(self._bins)-1\n\t\telse:\n\t\t\tb = math.floor((x-self._min_val)/self._bin_width)\n\t\treturn int(b)", "def get_bin(x, n=0):\n return format(x, 'b').zfill(n)", "def get_bi...
[ "0.756075", "0.71849936", "0.7154794", "0.70585626", "0.70246756", "0.69715875", "0.6932861", "0.6929739", "0.6837561", "0.67998797", "0.67592144", "0.669569", "0.6684878", "0.66757673", "0.661859", "0.65625226", "0.65551496", "0.65463084", "0.65427136", "0.65268064", "0.6524...
0.7280951
1
Accessor for topology. This function retrieves topology from the server as a list of road segments as pairs of waypoint objects, and processes the topology into a list of dictionary objects.
def get_topology(self): topology = [] # Retrieving waypoints to construct a detailed topology for segment in self._wmap.get_topology(): x1 = segment[0].transform.location.x y1 = segment[0].transform.location.y x2 = segment[1].transform.location.x y...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def topology(self) -> List[Topology]:\n return self._topology", "def topology(self):\n return self._topology", "def topology(self):\n return self._h5[TOPOLOGY][()]", "def get_topology(odl_url, odl_usr, odl_pass):\n if odl_url.endswith('/'):\n odl_url = odl_url[:-1]\n topolog...
[ "0.636812", "0.61905444", "0.6013915", "0.5730167", "0.55567867", "0.551303", "0.54704964", "0.5465589", "0.53611004", "0.53493327", "0.5213731", "0.51869893", "0.5132174", "0.50400406", "0.50259393", "0.5021925", "0.49883884", "0.49612585", "0.49448407", "0.49364305", "0.493...
0.7202825
0
Opens a communication channel and returns a stream object that is guaranteed to have send(bytes) and recv(bufsize) methods.
def open(address): method, path = address.split(':', 1) if method == 'unix': sock = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM) sock.connect(path) return sock if method == 'serial': ser = serial.Serial(path, 2400) return SerialWrapper(ser) if method == '...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _open(self):\n if self.channel is None:\n self.channel = self.transport.open_session()\n\n return self.channel", "def open_connection(host=None, port=None, *,\n loop=None, limit=_DEFAULT_LIMIT, **kwds):\n if loop is None:\n loop = events.get_event_loop()\...
[ "0.6364305", "0.5896953", "0.5745703", "0.56286246", "0.5547801", "0.54941547", "0.54451895", "0.54357046", "0.5434133", "0.54294544", "0.5404881", "0.54007065", "0.53984183", "0.5339949", "0.5311059", "0.5309945", "0.5260946", "0.52468234", "0.52391285", "0.5225487", "0.5224...
0.0
-1
Recover the sorted list of log patterns configured at logaccess_config.py
def listtypes(self): pattern_types = [i for i in sorted(self._allowed_patterns.iterkeys())] return pattern_types
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_access_logs(file_dir=log_dir):\n \n file_list = []\n for myfile in glob.glob1(file_dir, 'access_log*'):\n file_list.append('%s/%s' % (file_dir, myfile))\n# print file_list\n return file_list", "def getLogs():", "def getLogs():", "def list_patterns(self) -> localedata.LocaleDataD...
[ "0.597702", "0.591736", "0.591736", "0.584349", "0.58203423", "0.58155864", "0.5772261", "0.5664724", "0.565762", "0.5613998", "0.55920166", "0.55720824", "0.55649084", "0.5552007", "0.5502312", "0.545988", "0.5459798", "0.54555374", "0.5451005", "0.5402494", "0.5384004", "...
0.50404817
45
Recover the sorted list of log patterns and given contexts configured at logaccess_config.py
def listtypeindexes(self): indexes = {} for dtype,value in sorted(self._allowed_patterns.items()): if value.has_key('index'): indexes[dtype] = value['index'] return indexes
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getLogs():", "def getLogs():", "def _list_contexts(self):\r\n return sorted(list(self._bbreader.cache.keys()))", "def parse_access_log(log_lines):\n matches = [ ACCESS_RE.search(y) for y in log_lines ]\n return [ x.groupdict() for x in matches if x is not None ]", "def get_access_logs(file...
[ "0.5690263", "0.5690263", "0.55253536", "0.54465747", "0.5202226", "0.5195945", "0.5110438", "0.50635296", "0.5061706", "0.5024379", "0.5017279", "0.5000806", "0.49822634", "0.49700052", "0.4921275", "0.49207225", "0.48881912", "0.48814243", "0.4872348", "0.485778", "0.485200...
0.0
-1
Recover an Item statistics acording to the item code.
def getitem(self, code): fetch = self._collection.find_one({'code':code}) return fetch
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __getitem__(self, item):\n return self.get_data(stock=item)", "def getItemData(itemId):\n return Gw2Spidy._request('item', str(itemId))['result']", "def getRawItem(self, itemID):\n data = self._client.Item.find(int(itemID))\n return data", "def itemstatus(item, error='Duplicat...
[ "0.5819316", "0.57290924", "0.57257783", "0.56994206", "0.5555459", "0.53999716", "0.5366866", "0.5347076", "0.52674645", "0.5195175", "0.51944745", "0.5189391", "0.5175", "0.51722425", "0.51561046", "0.5155631", "0.5139623", "0.5103528", "0.5087385", "0.50855845", "0.508544"...
0.0
-1
Recover an list of item according to a pattern id retrieved by listpatterns method
def getitemsbypattern(self, pattern): return True
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_knitting_patterns_by_ids(self, ids_list):\n ids_string = ''\n\n for i in ids_list:\n ids_string = '{}, {}'.format(ids_string, i)\n\n ids_string = ids_string[1:] \n\n params = {\n \"ids\" : ids_string,\n \"craft\" : \"knitting\"\n }\n\n ...
[ "0.5939668", "0.5890393", "0.586018", "0.58466846", "0.55761737", "0.55570734", "0.54914767", "0.54500127", "0.54500127", "0.54500127", "0.5429458", "0.54239345", "0.534361", "0.5338712", "0.5329596", "0.5321798", "0.526911", "0.5244883", "0.5229335", "0.52082", "0.51975065",...
0.67687434
0
Do not return anything, modify board inplace instead.
def solve(self, board: List[List[str]]) -> None: visited = [[False for x in range(len(board[0]))] for y in range(len(board))] for i in range(len(board)): for j in range(len(board[i])): if not visited[i][j] and board[i][j] == 'O': res = [] ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def applyMove(self, (from_row,from_col), (to_row,to_col)):\n newboard = deepcopy(self)\n piece = newboard.board[from_row][from_col]\n newboard.board[from_row][from_col] = None\n newboard.board[to_row][to_col] = piece\n newboard.toplay = 'BLACK' if self.toplay == 'WHITE' else 'WHI...
[ "0.7664789", "0.70971596", "0.70476234", "0.7024398", "0.69861203", "0.6829364", "0.6778242", "0.6727011", "0.66938925", "0.6692377", "0.6625323", "0.6625323", "0.65893996", "0.6565318", "0.6564258", "0.65587217", "0.6539339", "0.65249294", "0.65223134", "0.6520972", "0.65202...
0.0
-1
Parse the provided commit message and return an array of problem identifiers that have been fixed.
def locate_fixed_problems(commit_message): identifiers = set() commit_message = commit_message.strip() lines = commit_message.splitlines() match_urls = True for line in lines: ids = identifiers_from_line(line, match_urls) if len(ids) == 0: match_urls = Fals...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_commit_message(message):\n # ['closes', 'close', 'fix', ...]\n keywords = []\n [keywords.extend(val) for val in KEYWORDS.values()]\n # we need to sort to match longuest command possible\n keywords.sort(lambda x, y: cmp(len(y), len(x)))\n # 'closes|close|fix...'\n keywords_re = '|'.jo...
[ "0.68951225", "0.58136165", "0.5794153", "0.57117003", "0.5585164", "0.5564257", "0.5515667", "0.5413323", "0.53617334", "0.5349822", "0.5347324", "0.5335515", "0.53326064", "0.53308296", "0.526027", "0.52450615", "0.5195016", "0.5193949", "0.51831806", "0.5180323", "0.517877...
0.7625704
0
Shells out to git(1), and locates the commits between start and end within repo_path. Returns a list of Commit objects for each commit in the range given.
def commits_between(repo_path, start, end): git = subprocess.Popen(["git", "log", "%s..%s" % (start, end)], stdout=subprocess.PIPE, cwd=repo_path) log = git.stdout.read().decode("utf-8") cur = None commits = [] for line in log.splitlines(): cm = re.match(r'commit ([a-f0-9]{40}...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def commits_in_range(self, revision_start, revision_end):\n revision_range = revision_start + '..' + revision_end\n output = self.run(\n ['git', 'rev-list', '--pretty=oneline', revision_range])\n commits = []\n for line in output.splitlines():\n # Split at the firs...
[ "0.7568852", "0.71092194", "0.7074235", "0.66874045", "0.6632878", "0.6599274", "0.6252481", "0.62169653", "0.621228", "0.6012338", "0.5848484", "0.5825941", "0.5750245", "0.57368284", "0.57110775", "0.5701161", "0.5697965", "0.554039", "0.5535404", "0.5516413", "0.5487601", ...
0.77835447
0
Returns the shape of a tf.Tensor as a list.
def get_shape(tensor): static_shape = tensor.shape.as_list() dynamic_shape = tf.unstack(tf.shape(tensor)) dims = [s[1] if s[0] is None else s[0] for s in zip(static_shape, dynamic_shape)] return dims
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_shape(tensor):\n return tensor.get_shape().as_list()", "def get_shape_list(tensor):\n static_shape, dyn_shape = tensor.shape.as_list(), tf.shape(tensor)\n\n def shape_dim(ndx):\n return dyn_shape[ndx] if static_shape[ndx] is None else static_shape[ndx]\n\n shape = map(s...
[ "0.86343443", "0.847432", "0.84028095", "0.8100093", "0.8080916", "0.8080916", "0.7954421", "0.7938573", "0.774353", "0.774353", "0.7706654", "0.7654455", "0.7515926", "0.74484056", "0.7375296", "0.7371953", "0.7371805", "0.7357831", "0.73540026", "0.72752106", "0.7149606", ...
0.76807886
11
Batch entropy of logits of shape [... x num_logits].
def categ_batch_entropy(logits): logits = tf.reshape(logits, [-1, logits.shape[-1].value]) mean_probs = tf.reduce_mean(tfd.Categorical(logits).probs, axis=0) return - tf.reduce_sum(mean_probs * tf.log(mean_probs + 1e-30), axis=-1)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def logit_entropy(logits):\n # We support either:\n # - 1D list of logits\n # - A 2D list, batch size x logits\n assert len(logits.shape) <= 2\n # keepdims=True is necessary so that we get a result which is\n # batch size x 1 instead of just batch size\n logp = logits - tf.reduce_logsumexp(log...
[ "0.7909235", "0.71882784", "0.6994014", "0.669817", "0.6688508", "0.6650155", "0.6617079", "0.6557628", "0.6547111", "0.6547111", "0.6494878", "0.64854825", "0.6482859", "0.6433548", "0.64330524", "0.64080656", "0.6405705", "0.6405494", "0.6401852", "0.64008105", "0.6372565",...
0.76391613
1
Load Data from the Database
def load_data(database_filepath): engine = create_engine('sqlite:///'+database_filepath) df = pd.read_sql_table('clean_df', con=engine) X=df['message'] Y = df.iloc[:, 4:] category_names = list(Y.columns) return X,Y,category_names
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read_db(self):\n with open(self.filename, 'r') as database:\n data = json.load(database)\n self.data = data", "def load_data(self):", "def load_data(self):\n try:\n self.manager.load()\n except error:\n show_error_message(title='Initialization er...
[ "0.7326386", "0.7296216", "0.72539115", "0.7212991", "0.7004115", "0.6945452", "0.6932251", "0.68281525", "0.6825065", "0.68078935", "0.68065125", "0.6759221", "0.67171234", "0.66802764", "0.6643358", "0.66384685", "0.6611453", "0.65831906", "0.6582818", "0.6582475", "0.65251...
0.0
-1
Return a Yices String representing the given pySMT logic.
def yices_logic(pysmt_logic): ylogic = str(pysmt_logic) if ylogic == "QF_BOOL": ylogic = "NONE" return ylogic
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def logic_program_form(self):\r\n return '% -------------------------------------\\n' +\\\r\n '% Theory ' + self.name + '\\n' +\\\r\n '% -------------------------------------\\n\\n' +\\\r\n GENERAL_AXIOMS", "def logic_program_form(self):\r\n s = ''\r\n ...
[ "0.62014735", "0.606736", "0.59748554", "0.5924965", "0.58945024", "0.5881407", "0.58732706", "0.5744191", "0.5730173", "0.5689957", "0.5673435", "0.56425935", "0.5622357", "0.5577381", "0.5539573", "0.54892117", "0.54863834", "0.54485565", "0.5437061", "0.54344344", "0.54099...
0.677988
0
Overloading of iterator from Model. We iterate only on the variables defined in the assignment.
def __iter__(self): term_v = yicespy.term_vector_t() yicespy.yices_init_term_vector(term_v) #todo here status = yicespy.yices_model_collect_defined_terms(self.yices_model, term_v) self._check_error(status) for d in term_v: try: pysmt_d = self.c...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __iter__(self):\n return iter(self.model)", "def __iter__(self):\n return iter(vars(self.obj))", "def __iter__(self):\n return iter(self._vars)", "def __iter__(self) -> Iterator[BaseAssignment]:\n for assignments in self._assignments.values():\n for assignment in assign...
[ "0.6850726", "0.6830741", "0.6730617", "0.6589007", "0.6472799", "0.6417582", "0.63860184", "0.63860184", "0.63860184", "0.63860184", "0.63551193", "0.63551193", "0.62693715", "0.62336004", "0.6215195", "0.6201147", "0.61724484", "0.6127379", "0.60184157", "0.6010114", "0.600...
0.57270336
50
Returns whether the model contains a value for 'x'.
def __contains__(self, x): return x in (v for v, _ in self)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def has_x(self):\n return any(map(lambda s: s.is_x, self))", "def contains(self, x: object):\n return x in self.items", "def contains(self, x):\n raise NotImplementedError", "def contains(self, x):\n raise NotImplementedError()", "def contains(self, x):\n return (isinstan...
[ "0.7329729", "0.71863216", "0.6969914", "0.687499", "0.67392546", "0.6433208", "0.63633", "0.63509834", "0.6334528", "0.6309228", "0.6265645", "0.6262307", "0.6260773", "0.6219586", "0.61962885", "0.61962885", "0.6181023", "0.6154614", "0.61003196", "0.61003196", "0.6092535",...
0.67513824
5
Set Search Parameters. Yices makes a distinction between configuratin and search parameters. The first are fixed for the lifetime of a context, while the latter can be different for every call to check_context.
def set_params(self, solver): params = yicespy.yices_new_param_record() yicespy.yices_default_params_for_context(solver.yices, params) for k,v in self.solver_options.items(): rv = yicespy.yices_set_param(params, k, v) if rv != 0: raise PysmtValueError("Err...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_search_params(self, **kwargs):\n self._search_params = kwargs", "def set_search_parameters(self, config):\n for k, v in config.items():\n self.config[k] = v", "def search_settings(self, search_settings):\n\n self._search_settings = search_settings", "def set_parameters...
[ "0.7363389", "0.7210578", "0.6475251", "0.61812407", "0.60081744", "0.5972157", "0.5915339", "0.5863669", "0.5724217", "0.57061315", "0.5704132", "0.5699922", "0.5670676", "0.5644207", "0.561121", "0.55997086", "0.5590485", "0.5590485", "0.5590485", "0.5590485", "0.5590485", ...
0.0
-1
After a call to solve() yielding UNSAT, returns the unsat core as a set of formulae
def get_unsat_core(self): return self.get_named_unsat_core().values()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_named_unsat_core(self):\n if self.options.unsat_cores_mode is None:\n raise SolverNotConfiguredForUnsatCoresError\n\n if self.last_result is not False:\n raise SolverStatusError(\"The last call to solve() was not\" \\\n \" unsatisfiable...
[ "0.64868635", "0.617883", "0.5953487", "0.59324986", "0.58462703", "0.5831892", "0.5792741", "0.56360483", "0.56312466", "0.5625035", "0.55705154", "0.55487573", "0.54742104", "0.54742104", "0.5472062", "0.54700786", "0.5445898", "0.54410523", "0.54400355", "0.54381645", "0.5...
0.63376844
2
After a call to solve() yielding UNSAT, returns the unsat core as a dict of names to formulae
def get_named_unsat_core(self): if self.options.unsat_cores_mode is None: raise SolverNotConfiguredForUnsatCoresError if self.last_result is not False: raise SolverStatusError("The last call to solve() was not" \ " unsatisfiable") if ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_named_unsat_core(self):\n if self.options.unsat_cores_mode is None:\n raise SolverNotConfiguredForUnsatCoresError\n\n if self.last_result is not False:\n raise SolverStatusError(\"The last call to solve() was not\" \\\n \" unsatisfiable...
[ "0.7151089", "0.6253496", "0.6253496", "0.57105905", "0.54076594", "0.5346823", "0.53426343", "0.53031605", "0.5271458", "0.5252732", "0.5247248", "0.5245722", "0.5221663", "0.5160494", "0.5159359", "0.51163274", "0.5076806", "0.5043931", "0.50153726", "0.50065917", "0.496032...
0.71991855
0
Convert a Yices expression back into a pySMT expression.
def back(self, expr, model=None): if expr in self._yices2pysmt: return self._yices2pysmt[expr] raise NotImplementedError
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def interm_to_smt2_expr(expr, env=None):\n assert isinstance(expr, Expression)\n CODE_SMT = ExprTranslator.apply(expr)\n return ProgramSmt2([CODE_SMT])", "def reconstructY(self, inputs):\n if self.act_dec is None:\n act_dec = lambda x: x\n else:\n act_dec = self.act_d...
[ "0.61883765", "0.60296005", "0.5956401", "0.5223984", "0.5221168", "0.52152973", "0.5208775", "0.51623577", "0.5157018", "0.5115472", "0.510989", "0.50814354", "0.5077802", "0.50336796", "0.50196713", "0.49950975", "0.49521714", "0.49446702", "0.49392343", "0.4907591", "0.487...
0.6567182
0
Bounds the variables in formula. Returns a tuple (new_formula, new_var_list) in which the old variables have been replaced by the new variables in the list.
def _rename_bound_variables(self, formula, variables): new_vars = [self._bound_symbol(x) for x in variables] old_vars = [self.walk_symbol(x) for x in variables] new_formula = yicespy.yices_subst_term(len(variables), yicespy.make_term_array(new_vars), ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_occuring_variables(formula,variables_to_consider,allowed_variables) :\n variable_set=set(allowed_variables)\n for clause in formula :\n variables_in_clause = {abs(l) for l in clause if abs(l) in variables_to_consider}\n if not variables_in_clause <= variable_set:\n return False, [v for v in ...
[ "0.5877155", "0.5828667", "0.5643589", "0.56074995", "0.5544756", "0.5446839", "0.54266375", "0.540049", "0.52934396", "0.52764535", "0.5275413", "0.5272243", "0.52428776", "0.51679504", "0.5162843", "0.5141705", "0.5139646", "0.5126008", "0.51069546", "0.51050544", "0.509448...
0.69548506
0
Return the yices Sort for the given name.
def yicesSort(self, name): name = str(name) try: return self._yicesSort[name] except KeyError: sort = yicespy.yices_new_uninterpreted_type() self._yicesSort[name] = sort return sort
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def select_sort_by_name_ascendant(self):\n msg = \"The new order of the items is by ascendant name\"\n with self.allure.step(msg):\n self.__product_sort.select_by_text('Name (A to Z)')\n self.allure.attach_image(self.driver, msg)", "def sort_by_name(self):\n # sort_by_n...
[ "0.6208319", "0.61897", "0.6068596", "0.60552937", "0.6051539", "0.5996636", "0.5967185", "0.5892825", "0.5877872", "0.5851732", "0.57803917", "0.5762835", "0.57413083", "0.57134265", "0.56733364", "0.5667565", "0.5640422", "0.56211984", "0.56094944", "0.5606411", "0.5592871"...
0.8395888
0
Return the yices EnumSort for the given name.
def yicesEnumSort(self, name, value): key = str(name) try: return self._yicesEnumSort[key][0] except KeyError: sort = yicespy.yices_new_scalar_type(len(value)) sortvalues = [] for i in range(len(value)): lhs = str(value[i]) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def yicesSort(self, name):\n name = str(name)\n try:\n return self._yicesSort[name]\n except KeyError:\n sort = yicespy.yices_new_uninterpreted_type()\n self._yicesSort[name] = sort\n return sort", "def tenum(name, vals):\n\n if isinstance(vals, bas...
[ "0.7609963", "0.589033", "0.5835212", "0.57860774", "0.5753377", "0.56176436", "0.56006116", "0.5560994", "0.55155605", "0.5423769", "0.53936815", "0.53725404", "0.53691125", "0.5356705", "0.53469497", "0.5331938", "0.52929187", "0.52641493", "0.52285933", "0.52111757", "0.51...
0.8267941
0
tests if sentence has a word contained in the wordlist
def match(self, sentence) -> bool: pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def match(self, sentence) -> bool:\r\n for word in self.word_list:\r\n if word.lower() in sentence.lower():\r\n return True\r\n return False", "def check_words(title, wordlist, verbose=False):\n\tfor word in wordlist:\n\t\tif title.find(word) >= 0:\n\t\t\tif verbose:\n\t\t...
[ "0.7999124", "0.77393407", "0.7712122", "0.7556133", "0.74560416", "0.74560416", "0.74560416", "0.74086666", "0.7331239", "0.7313937", "0.73098934", "0.7237485", "0.71792233", "0.7153619", "0.71415144", "0.7122514", "0.7100487", "0.69998336", "0.699689", "0.6993139", "0.68959...
0.0
-1
add word to the wordlist
def append(self, string): self.word_list.append(string)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_word(self, word):\n\n if word in self.wordlist:\n return \"Already in word list\"\n\n file_name = self.config_folder + self.wordlist_file\n word_list = open(file_name,'a+')\n word_list.write(word + \"\\n\")\n word_list.close()\n return None", "def add(...
[ "0.8447548", "0.8281665", "0.8253229", "0.8202399", "0.8171117", "0.8084702", "0.80711436", "0.80289054", "0.798414", "0.79529697", "0.79376346", "0.7932309", "0.78682923", "0.78488964", "0.78202254", "0.77676076", "0.7756117", "0.771654", "0.7705856", "0.7704328", "0.7699173...
0.74908745
35
tests if sentence contains a word in the wordlist
def match(self, sentence) -> bool: for word in self.word_list: if word.lower() in sentence.lower(): return True return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_word(words, word):\r\n if word in words:\r\n return True\r\n else:\r\n return False", "def check_words(title, wordlist, verbose=False):\n\tfor word in wordlist:\n\t\tif title.find(word) >= 0:\n\t\t\tif verbose:\n\t\t\t\tprint(\"\\t\\tFOUND '\"+word+\"' IN:\", title)\n\t\t\treturn Tr...
[ "0.7722893", "0.76752436", "0.75732464", "0.7551399", "0.7463943", "0.7463943", "0.7463943", "0.7405517", "0.73894894", "0.7206948", "0.7145627", "0.71257436", "0.7120852", "0.7107858", "0.6995455", "0.6987601", "0.69658506", "0.6918556", "0.6901736", "0.6859819", "0.6829926"...
0.8025514
0
test if sentence matches a full or partial word, but not a not word
def match(self, sentence) -> bool: if (any(word[0] in sentence.lower() for word in self.word_list if word[1] == "partial") or any( word[0].lower() == sentence.lower() for word in self.word_list if word[1] == "full")) and not any( word[0] in sentence.lower() for word in...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_word_not(text):\n return text.strip() == 'not'", "def substring_match(recipe, word):\n if names_only:\n line = recipe.name\n else:\n line = str(recipe)\n\n if not case:\n word = word.lower()\n line = line.lower()\n\n return line...
[ "0.7004962", "0.6858748", "0.68342656", "0.67009854", "0.6636463", "0.66354656", "0.66077316", "0.65880203", "0.6583608", "0.656416", "0.65482354", "0.6531005", "0.6517633", "0.65096074", "0.6455604", "0.6451215", "0.6446208", "0.6426749", "0.6421576", "0.6373186", "0.6365616...
0.7749148
0
returns true if building is placeable at pos, else false
def building_isplaceable(self, building, pos): x_pos, y_pos = pos m = building.mask_full() y_size, x_size = m.shape if x_pos + x_size > AIV_SIZE or y_pos + y_size > AIV_SIZE: return False for x in range(0,x_size): for y in range(0,y_size): ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def isPositionInRoom(self, pos):\n if pos in self.tiles:\n return True\n else:\n return False", "def _can_place(self, loc):\n non_blocks = [_AIR, _WATER, _LAVA]\n player = [self._pos, self._pos + _Vec3(0, 1, 0)]\n for dir_ in _adj_dirs + [_Vec3(0, 1, 0), _...
[ "0.69598156", "0.69421697", "0.6878886", "0.685575", "0.67933196", "0.67796236", "0.6751459", "0.6727748", "0.6723218", "0.66230464", "0.66161877", "0.66148025", "0.66137296", "0.6579545", "0.65682584", "0.65298176", "0.6518893", "0.651155", "0.65102607", "0.64806265", "0.647...
0.716373
0
places building at pos with pause, does nothing if building is not placable
def building_place(self, building, pos, pause=False): if not self.building_isplaceable(building, pos): return x_pos, y_pos = pos # all future steps +1 for x in range(0, AIV_SIZE): for y in range(0, AIV_SIZE): if (self.bmap_step[y, x] >= s...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def move_buildings(self):", "def place_building(self, building):\n if self.environment.grid.is_cell_empty(building.pos):\n self.environment.grid.place_agent(building, building.pos)\n self.environment.agents['residences'].append(building)\n else:\n try:\n ...
[ "0.63600856", "0.6258558", "0.60359925", "0.5988893", "0.5929227", "0.5911008", "0.5888564", "0.5828456", "0.5728379", "0.5718982", "0.57092506", "0.57061243", "0.56950647", "0.5675169", "0.56746465", "0.5644606", "0.56289035", "0.56059235", "0.56031656", "0.555743", "0.55550...
0.7207601
0
removes building placed at pos
def building_remove(self, pos): x, y = pos step = self.bmap_step[y,x] if step == 0: return for x in range(0,AIV_SIZE): for y in range(0,AIV_SIZE): if (self.bmap_step[y,x] == step): self.bmap_step[y,x] = 0 ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def removeIfDead(self):\n if self.y < 0:\n del projectiles[findPlace(self, projectiles)]", "def remove_pos(self):\r\n selected_items = self.treeview.selection()\r\n for items in selected_items:\r\n values = self.treeview.item(items, 'values')\r\n if values[0]...
[ "0.6693598", "0.65811896", "0.6406837", "0.6351213", "0.6280977", "0.6223392", "0.622173", "0.6203216", "0.61993384", "0.6186201", "0.6151671", "0.6138891", "0.6054233", "0.60505754", "0.60432374", "0.60303444", "0.5995092", "0.5985748", "0.5971482", "0.59708905", "0.5967626"...
0.74935937
0
places troop at pos
def troop_place(self, troop, pos): x, y = pos self.tmap[y, x] = troop tile_id = AIV_SIZE * y + x print(10*troop) for slot in range(10 * troop, 10 * (troop+1)): if self.tarr[slot]== 0: self.tarr[slot] = tile_id return
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def move_to_position2(self):", "def move_to_position1(self):", "def place(placement: str):\n Robot.place(placement)", "def place_goal(self, point = \"random\"):\n if point != \"random\":\n self.maze[point[0]][point[1]] = self.goal_value\n self.goal_position = tuple([point[0],p...
[ "0.64251316", "0.636119", "0.61575276", "0.6102893", "0.60633576", "0.6005838", "0.5976706", "0.5975634", "0.59755576", "0.59528005", "0.59332687", "0.58925927", "0.57779956", "0.5756049", "0.57527", "0.5743293", "0.5738759", "0.573769", "0.57347894", "0.5723453", "0.57222986...
0.7567367
0
removes troop at pos
def troop_remove(self, pos): x, y = pos # tile_id = AIV_SIZE * y + x troop = self.tmap[y, x] if (troop == 0): return # update tmap self.tmap[y, x] = 0 # first remove thing from tarr, then find something new in tmap # for sl...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete(self,pos):\n pos.next = pos.next.next", "def remove():", "def building_remove(self, pos):\n x, y = pos\n step = self.bmap_step[y,x]\n\n if step == 0:\n return\n\n for x in range(0,AIV_SIZE):\n for y in range(0,AIV_SIZE):\n if (s...
[ "0.6689739", "0.6675071", "0.65882707", "0.65590334", "0.6428142", "0.64276046", "0.6408341", "0.63639593", "0.63227624", "0.631509", "0.630923", "0.62942326", "0.6270247", "0.6265951", "0.6254995", "0.62523973", "0.62419504", "0.622547", "0.62165946", "0.62106955", "0.619811...
0.78317654
0
moves all buildings in the desired direction N, W, S, E by one; does nothing if not possible
def move_pos(self, dir): raise NotImplementedError # if dir == 'N': # if np.all(aiv[0,:] == 0): # aiv[:-1,:] = aiv[1:,:] # aiv[-1,:] = np.zeros((1,AIV_SIZE)) # elif dir == 'W': # if np.all(aiv[:,0] == 0): # aiv[:,:-1] = aiv[...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def move_buildings(self):", "def move(self, direction):\n # replace with your code\n\n indices = self.direction_indices[direction]\n for coordinate in indices:\n merged_coordinate_list = self.get_list(direction, coordinate)\n self.change_board(merged_coordinate_list, co...
[ "0.72433794", "0.6534664", "0.64312494", "0.6410266", "0.63970697", "0.6373598", "0.62683314", "0.62505853", "0.62160534", "0.6166288", "0.61537564", "0.611729", "0.61056423", "0.61025375", "0.6087578", "0.6078463", "0.60712385", "0.6042112", "0.6040611", "0.6037773", "0.6032...
0.0
-1
moves building built at step_before to step_after
def move_time(self, step_before, step_after): raise NotImplementedError
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def move_buildings(self):", "def stepStarted(build, step):", "def step(self, move):", "def after_step(self, after):\n # most steps only accept one source\n self.after = [after] if after else []\n return self", "def build_step(self):\n pass", "def build_step(self):\n pas...
[ "0.6676826", "0.645202", "0.6226223", "0.6223017", "0.6120875", "0.6120875", "0.6074297", "0.60600734", "0.6021978", "0.58635855", "0.5838216", "0.57866406", "0.5781399", "0.5728968", "0.5692847", "0.5657206", "0.5646584", "0.5601138", "0.5584831", "0.5558989", "0.5525064", ...
0.6100527
6
builds a wall of type from pos1 to pos2 with thickness
def build_wall(self, type, pos1, pos2, thickness=1): raise NotImplementedError
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def make_boundary_wall(self, height, width) -> None:\n for x in range(0, width):\n Wall(self, x, 0)\n Wall(self, x, height - 1)\n for y in range(1, height - 1):\n Wall(self, 0, y)\n Wall(self, width - 1, y)", "def add_walls(self):\n for x in range(...
[ "0.6652816", "0.6530705", "0.6497158", "0.6430438", "0.6359166", "0.62932396", "0.6252796", "0.6150248", "0.61410415", "0.6075788", "0.6074455", "0.60314775", "0.60010916", "0.59678346", "0.59656036", "0.5935086", "0.59339607", "0.5909519", "0.58775026", "0.5872708", "0.58670...
0.877552
0
builds stairs from pos1 with height to pos2; extended also builds the 6th stair
def build_stairs(self, pos1, pos2, height, extendend = False): raise NotImplementedError
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def stairs(x, y, length, blueness):\n color = (0, 0.5*blueness, blueness)\n if length>3:\n penup()\n goto(x, y)\n pendown()\n fillcolor(color)\n begin_fill()\n square(length)\n end_fill()\n stairs(x, y+length, length/2, blueness/1.25)\n stairs(x+...
[ "0.59213537", "0.5730924", "0.5600649", "0.5567194", "0.55222636", "0.54645634", "0.5406177", "0.53234625", "0.51944", "0.5179853", "0.51700884", "0.5168403", "0.51683027", "0.5167756", "0.5164616", "0.51390946", "0.5133047", "0.5126641", "0.5106857", "0.5099314", "0.5093502"...
0.8246664
0
merges steps into the steps with the lowest number
def merge_steps(self, steps): raise NotImplementedError
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def stage1(self):\n n = self.min\n while True:\n n, bin_ = self.sort_to_bin(n)\n if n is None:\n n = self.get_new_n(bin_)\n if n is None:\n break\n if self.viz:\n yield", "def get_next_steps(self, steps...
[ "0.57471377", "0.5562235", "0.5537756", "0.5376745", "0.53701097", "0.5365862", "0.52793205", "0.5239232", "0.52255756", "0.5206005", "0.5202807", "0.51601505", "0.5144697", "0.5136471", "0.51265377", "0.5107818", "0.50958174", "0.5094482", "0.5065117", "0.5062962", "0.504582...
0.6262804
0
returns the mask of the building
def mask(self): return np.ones((self.size, self.size))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mask(self):\n return self._mask", "def mask(self):\n return self._mask", "def mask(self):\n return self._mask", "def mask(self):\n return self._mask", "def mask(self):\n return self.mask_index", "def _mask(self):\n if self.__mask is None:\n # need ...
[ "0.78954804", "0.78954804", "0.78954804", "0.78954804", "0.772295", "0.7643143", "0.75407577", "0.7360633", "0.7311334", "0.7114861", "0.7114498", "0.7097834", "0.707536", "0.70625645", "0.706252", "0.70425147", "0.7038282", "0.7008833", "0.7004336", "0.6991965", "0.6918564",...
0.71690243
9
returns the mask of the building including the automatically built placeholders
def mask_full(self): size = self.size if self.name == "KEEP": m = np.zeros((2*size+1,size+5), dtype = np.int8) m[:size,:size] = np.ones((size,size)) # keep m[size:size+1,2:5] = np.ones((1,3)) # keepdoor m[size+1:2*size+1,:size] = np....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __generate_mask(self):\n mask = np.concatenate([np.ones(len(self.fixed[0])),\n np.zeros(self.num_points),\n np.ones(len(self.fixed[1]))])\n return mask", "def mask(self):", "def mask(self):\n return self._mask", "def mask(...
[ "0.74053776", "0.70580286", "0.6911085", "0.6911085", "0.6911085", "0.6911085", "0.6891338", "0.6888377", "0.6808672", "0.6799429", "0.67847437", "0.6762368", "0.67156136", "0.66221595", "0.66058373", "0.6601658", "0.6560427", "0.6529176", "0.64869", "0.648416", "0.647519", ...
0.63920027
26
returns the mask with all building ids for bmap_id
def mask_id(self): m = 2 * self.mask_full() m[0:self.size, 0:self.size] = self.id * self.mask() return m.astype(np.int16)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_mask(self, image_id):\n\n image_info = self.image_info[image_id]\n if image_info[\"source\"] != \"pcb\":\n return super(self.__class__, self).load_mask(image_id)\n\n # convert polygons to a bitmap mask of shape\n # [height, width, instance_count]\n info = self...
[ "0.63974375", "0.63060415", "0.6066493", "0.60461", "0.6044561", "0.6027554", "0.5987599", "0.59858096", "0.59734225", "0.5947414", "0.59335226", "0.58401555", "0.5831203", "0.5828433", "0.5784051", "0.57798535", "0.5767599", "0.5750882", "0.5740899", "0.5731547", "0.5729022"...
0.57657576
17
returns the mask with all building steps for bmap_step
def mask_step(self, step): m = step * self.mask_full() return m.astype(np.int32)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_regions_mask(self, input):", "def _generateTotalMask(self):\r\n\r\n mask = np.zeros(self.altPosMap.shape)\r\n\r\n for patch in self.finalPatches.itervalues():\r\n mask = mask + patch.array.astype(np.float)\r\n\r\n mask = ni.binary_closing(mask,\r\n ...
[ "0.6278759", "0.6190451", "0.60925514", "0.6075866", "0.60749245", "0.5841248", "0.5835478", "0.5823094", "0.57998985", "0.57666415", "0.5759012", "0.5713124", "0.56848174", "0.5651061", "0.5645872", "0.5637091", "0.5612297", "0.56048876", "0.559156", "0.5581121", "0.55583966...
0.5488081
26
returns mask for bmap_tile
def mask_tile(self): if self.size == 1: m = np.array([[0]]) elif self.size ==2: m = np.array([[1,2],[4,3]]) else: m = 9 * np.ones((self.size, self.size)) m[0,0] = 1 m[0,-1] = 2 m[-1,-1] = 3 ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_binary_mask(self,index):\n mask = self.load_mask_png(index)\n (rows,cols) = np.where(mask>0)[0:2] #pixels in mask disregarding the color\n new_mask = np.zeros(shape=mask.shape[0:2], dtype=np.uint8)\n new_mask[(rows,cols)] = 255\n return new_mask", "def _mask(self, map_)...
[ "0.68030757", "0.6597235", "0.64020073", "0.63684136", "0.636295", "0.6307365", "0.62979585", "0.62321377", "0.62078494", "0.6204927", "0.62012064", "0.61955607", "0.61827964", "0.6167925", "0.61083657", "0.6076602", "0.60515094", "0.603599", "0.603599", "0.603599", "0.603599...
0.6715494
1
returns mask for bmap_size
def mask_size(self): m = self.size * self.mask() return m.astype(np.int8)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _modify_map_size(self, merged_map):\n pos_x_white, pos_y_white = np.where(merged_map == 255)\n pos_x_black, pos_y_black = np.where(merged_map == 0)\n\n pos_x_M = np.amax(np.hstack((pos_x_black, pos_x_white)))\n pos_x_m = np.amin(np.hstack((pos_x_black, pos_x_white)))\n pos_y_...
[ "0.6193336", "0.6103328", "0.60384744", "0.5995964", "0.5965488", "0.59573275", "0.5923458", "0.5921077", "0.58160436", "0.58096987", "0.57979405", "0.5764964", "0.5760093", "0.57463944", "0.5730128", "0.5718431", "0.56881696", "0.5681048", "0.56538427", "0.56254137", "0.5623...
0.70576715
0
Methods for Jacobi eigenvalue algorithm.
def max_abs_idx(A): return np.unravel_index(np.argmax(np.abs(A)), A.shape)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def eigen(X):\n\n symmetric = np.alltrue(np.isclose(X - X.T, np.zeros(n)))\n small = max(X.shape) <= 11\n\n if symmetric:\n return jacobi(X)\n elif small:\n maxiter = 10 ** max(*X.shape, 4)\n return qrm3(X, maxiter=maxiter)\n else:\n maxiter = 10 ** max(*X.shape, 4)\n ...
[ "0.7082384", "0.68865615", "0.675026", "0.65622574", "0.6484257", "0.64265895", "0.64228565", "0.6420864", "0.6407039", "0.63492423", "0.6333977", "0.63335484", "0.6201813", "0.6170444", "0.61633956", "0.6157591", "0.6150209", "0.61390257", "0.61325246", "0.60977155", "0.6081...
0.0
-1
Run Jacobi algorithm to diagonalize symmetric matrix.
def jacobi_diagonalization(M, max_iter=1000, verbose=False): A = np.copy(M) n = A.shape[0] trajectory = [] for it in range(max_iter): diag_A = np.diag(A) A[np.arange(n), np.arange(n)] = 0 p, q = max_abs_idx(A) A[np.arange(n), np.arange(n)] = diag_A c, s = compute...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def jacobi(inv_diag: sparse.dia_matrix, lower_upper: sparse.dia.dia_matrix,\n b: np.ndarray, min_iter: int = 10, max_iter: int = 20, TOL = 0.001):\n x = b.copy()\n for i in range(min_iter):\n x = inv_diag @ (b - lower_upper @ x)\n \n for i in range(max_iter - min_iter):\n x...
[ "0.65458184", "0.65215915", "0.62391186", "0.6096284", "0.60770935", "0.5979991", "0.5963886", "0.5961214", "0.5884774", "0.58699703", "0.57684314", "0.5725163", "0.5719469", "0.5671948", "0.56443053", "0.56403714", "0.56045103", "0.5555194", "0.5532265", "0.5508106", "0.5507...
0.7252654
0
Finds angle that minimizes Givens rotation in subspace (i,j).
def minimize_frobenius_subspace(U, i, j): u_ii = U[i, i] u_ij = U[i, j] u_ji = U[j, i] u_jj = U[j, j] g = lambda alpha : -2 * ((u_ii + u_jj) * np.cos(alpha) + (u_ij - u_ji) * np.sin(alpha)) alpha = np.arctan2(u_ij - u_ji, u_ii + u_jj) alpha_shifted = alpha - np.sign(alpha) * np.pi if g...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def angle_peaks(self, i, j):\n g1 = norm_vec(self.Gvec(self.xp[i], self.yp[i], self.zp[i]))\n g2 = norm_vec(self.Gvec(self.xp[j], self.yp[j], self.zp[j]))\n return np.around(np.arccos(float(g1.T*g2)) * degrees, 3)", "def index_to_angle(i):\n return -135.0 + (i / 1081.0) * 0.25", "def Ho...
[ "0.61956495", "0.5928302", "0.59179556", "0.5873517", "0.57913995", "0.57579696", "0.5714722", "0.56798893", "0.5673125", "0.56543744", "0.5654022", "0.56531966", "0.5631712", "0.5619218", "0.561369", "0.55928063", "0.5586454", "0.5548546", "0.5513429", "0.54990697", "0.54963...
0.63661486
0
Greedily chooses Givens factor that minimizes Frobenius norm to the target U
def greedy_baseline(U, max_iter=None): U = U.copy() d = U.shape[0] if max_iter is None: max_iter = d * (d - 1) // 2 trajectory = [] idx_to_check = list(range(d)) rotation = Rotation() for it in range(max_iter): subspace_results = [] for i in range(d): fo...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def gelu(x):\r\n return x * 0.5 * (1.0 + torch.erf(x / math.sqrt(2.0)))", "def gelu(x):\n return x * 0.5 * (1.0 + torch.erf(x / math.sqrt(2.0)))", "def gelu(x):\n return x * 0.5 * (1.0 + torch.erf(x / math.sqrt(2.0)))", "def gelu(x):\n return x * 0.5 * (1.0 + torch.erf(x / math.sqrt(2.0)))", "d...
[ "0.7161018", "0.71295613", "0.71295613", "0.71295613", "0.71295613", "0.71295613", "0.71295613", "0.71295613", "0.71295613", "0.67541826", "0.6702751", "0.65816987", "0.64727277", "0.64727277", "0.64571327", "0.64571327", "0.64424783", "0.63795525", "0.630692", "0.6299277", "...
0.0
-1
Generates a random sequence of n Givens factors in d dimensions, where the Givens angles are drawn uniformly from [pi,pi]. If replace is True the subspaces are sampled with replacement otherwise not.
def random_planted_matrix(d, n, replace='True'): all_idx = np.asarray(list(zip(*np.tril_indices(d,-1)))) chosen_idx_positions = np.random.choice(len(all_idx), size=n, replace=replace) subspaces = all_idx[chosen_idx_positions] angles = 2*np.pi * (np.random.rand(len(subspaces)) - 0.5) U = np.eye(d) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def Generate_Ginibre(n):\n G_real = np.random.normal(scale= np.sqrt(1/(2*n)), size=[n,n])\n G_im = np.random.normal(scale= np.sqrt(1/(2*n)), size=[n,n]) * complex(0,1)\n G = G_real + G_im\n return G", "def rg(self, d=3, n=20):\n\n RG = nx.random_graphs.random_regular_graph(d, n)\n retur...
[ "0.62676924", "0.59859097", "0.59496826", "0.5851699", "0.5818886", "0.5799751", "0.5763621", "0.5757867", "0.5737094", "0.5703747", "0.5696938", "0.56821245", "0.5679375", "0.5670225", "0.56460977", "0.5583334", "0.5574868", "0.5567993", "0.555292", "0.55380654", "0.5535247"...
0.7204504
0
Calculate the great circle distance between two points on the earth (specified in decimal degrees)
def haversine(lon1, lat1, lon2, lat2): # convert decimal degrees to radians lon1, lat1, lon2, lat2 = map(radians, [lon1, lat1, lon2, lat2]) # haversine formula dlon = lon2 - lon1 dlat = lat2 - lat1 a = sin(dlat/2)**2 + cos(lat1) * cos(lat2) * sin(dlon/2)**2 c = 2 * asin(sqrt(a)) r = 6371...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def great_circle(lat_1, long_1, lat_2, long_2):\n long_1 = m.radians(long_1)\n lat_1 = m.radians(lat_1)\n long_2 = m.radians(long_2)\n lat_2 = m.radians(lat_2)\n\n d = 2 * 6367.45 * m.asin(\n m.sqrt(haversine(lat_2 - lat_1)\n + m.cos(lat_1)*m.cos(lat_2) *\n haversine(long...
[ "0.8146062", "0.78638023", "0.7632202", "0.7604661", "0.7595527", "0.75950956", "0.7592873", "0.757031", "0.7564319", "0.75560796", "0.75300086", "0.7516366", "0.7493803", "0.746558", "0.7450864", "0.7432722", "0.7391925", "0.7355981", "0.7347892", "0.7330029", "0.73271745", ...
0.0
-1
End Conversation by InlineKeyboard.
def end(update, context) -> int: update.callback_query.edit_message_text( 'Bye! I hope we can talk again some day.') logger.info("User [%s] exited the conversation, [Exit], from [Main Menu / Results State].", update.callback_query.message.chat.first_name) return ConversationHandler....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def endMessage(self):", "def end(update: Update, context: CallbackContext) -> int:\n update.callback_query.answer()\n\n text = \"See you around!\"\n update.callback_query.edit_message_text(text=text)\n\n return END", "def end(update, context):\n query = update.callback_query\n bot = context.b...
[ "0.69865876", "0.6973438", "0.68213534", "0.66304886", "0.61615235", "0.60839623", "0.6069418", "0.6066864", "0.6059899", "0.6048676", "0.5969928", "0.595569", "0.594251", "0.5929114", "0.5924612", "0.5903801", "0.58803385", "0.5869796", "0.5862226", "0.583221", "0.5808793", ...
0.71500057
0
End BBT Conversation by command.
def cancel(update: Update, context: CallbackContext) -> int: update.message.reply_text( 'Bye! I hope we can talk again some day.', reply_markup=ReplyKeyboardRemove() ) logger.info("User [%s] canceled BBT conversation using command [/stop].", update.message.from_user.first_name) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def endMessage(self):", "def end(update, context) -> int:\n update.callback_query.edit_message_text(\n 'Bye! I hope we can talk again some day.')\n\n logger.info(\"User [%s] exited the conversation, [Exit], from [Main Menu / Results State].\",\n update.callback_query.message.chat.firs...
[ "0.69126016", "0.6650812", "0.6205898", "0.6168638", "0.6153832", "0.61286306", "0.6106087", "0.6070589", "0.6059804", "0.604682", "0.6031242", "0.6010486", "0.6009194", "0.5993809", "0.59824944", "0.59759206", "0.5948804", "0.5913537", "0.5863353", "0.5859743", "0.58572745",...
0.57131565
30
End Conversation by command, /stop.
def stop(update, context) -> None: update.message.reply_text('Okay, bye.') logger.info("User [%s] canceled conversation using command [/stop].", update.message.from_user.first_name) return END
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def stop(update, context):\n\n update.message.reply_text(\n config.messages['stop'],\n reply_markup=ReplyKeyboardRemove())\n\n logger.info(f'{update.message.from_user.full_name}: stop')\n\n # clear cache\n context.user_data.clear()\n\n return ConversationHandler.END", "def stop(self)...
[ "0.6944882", "0.68855196", "0.665506", "0.6576726", "0.6544538", "0.65385246", "0.65183944", "0.6486657", "0.6477054", "0.64704984", "0.64567894", "0.64277023", "0.64273757", "0.64197487", "0.6331442", "0.63195616", "0.6311176", "0.6311176", "0.62933475", "0.62311274", "0.620...
0.73626995
0
Completely end conversation from within nested conversation by command, /stop.
def stop_nested(update, context): update.message.reply_text('Okay, bye.') logger.info("User [%s] canceled conversation within nested using command [/stop].", update.message.from_user.first_name) return STOPPING
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def stop(update, context) -> None:\n update.message.reply_text('Okay, bye.')\n\n logger.info(\"User [%s] canceled conversation using command [/stop].\",\n update.message.from_user.first_name)\n return END", "def stop(update, context):\n\n update.message.reply_text(\n config.mess...
[ "0.74252063", "0.67726016", "0.6479838", "0.63667774", "0.6243147", "0.61980194", "0.61872613", "0.61744773", "0.6128704", "0.61268866", "0.61176383", "0.60804325", "0.6076494", "0.6063793", "0.6007844", "0.59601426", "0.59601426", "0.5948303", "0.5938749", "0.59248614", "0.5...
0.77043283
0
End Second level conversation, add_filter, and Return to First level conversation.
def end_filter_selection(update, context): context.user_data['START_OVER'] = True start(update, context) logger.info("User [%s] selected to return to previous menu, [Main Menu], " "from [Add Filter / Show Filters]", update.callback_query.message.chat.first_name) return S...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def end(update, context) -> int:\n update.callback_query.edit_message_text(\n 'Bye! I hope we can talk again some day.')\n\n logger.info(\"User [%s] exited the conversation, [Exit], from [Main Menu / Results State].\",\n update.callback_query.message.chat.first_name)\n return Convers...
[ "0.61874306", "0.58758193", "0.5396063", "0.5229586", "0.5209735", "0.520134", "0.51906264", "0.518927", "0.5108428", "0.5048686", "0.5047585", "0.5041993", "0.50342107", "0.49853578", "0.49816087", "0.49747455", "0.49464867", "0.4933484", "0.4929137", "0.49254668", "0.491540...
0.62463814
0
End Third level conversation, filter options menu, and Return to Second level conversation, add_filter menu.
def return_add_filter_menu(update, context): add_filter(update, context) logger.info("User [%s] selected to return to previous menu, [Add Filter], " "from [Filter Option Selection / Show Filters]", update.callback_query.message.chat.first_name) return SELECT_FILTER
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def end_filter_selection(update, context):\n context.user_data['START_OVER'] = True\n start(update, context)\n\n logger.info(\"User [%s] selected to return to previous menu, [Main Menu], \"\n \"from [Add Filter / Show Filters]\",\n update.callback_query.message.chat.first_nam...
[ "0.7095945", "0.6262296", "0.559375", "0.55274487", "0.5399974", "0.5337311", "0.52899706", "0.52812284", "0.52424496", "0.52321196", "0.5228051", "0.52217984", "0.52002156", "0.513967", "0.5091542", "0.5087374", "0.5047827", "0.5043699", "0.50311667", "0.50200194", "0.499401...
0.5636334
2
Take file path as string; return text as string. Takes a string that is a file path, opens the file, and turns the file's contents as one string of text.
def open_and_read_file(): file_path = sys.argv[1] #print file_path file_data = open(file_path, 'r') gettysburg = file_data.read() return gettysburg
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def open_and_read_file(file_path):\n\n # your code goes here\n text_file = open(file_path)\n text_string= text_file.read()\n text_file.close()\n return text_string", "def open_and_read_file(file_path):\n\n text_file = open(file_path)\n full_text = text_file.read()\n\n return full_text", ...
[ "0.80703825", "0.8048914", "0.8015025", "0.79924196", "0.7922689", "0.7865267", "0.780107", "0.768055", "0.76599956", "0.76151365", "0.76083297", "0.75717854", "0.7540605", "0.7529533", "0.75045687", "0.75038856", "0.7500699", "0.74132633", "0.7371461", "0.7362938", "0.732943...
0.0
-1
Take input text as string; return dictionary of Markov chains. A chain will be a key that consists of a tuple of (word1, word2) and the value would be a list of the word(s) that follow those two words in the input text.
def make_chains(text_string, n): chains = {} gettysburg = open_and_read_file() word_list = gettysburg.split() #iterating through length of word_list for item in range(0, len(word_list) - n): key_list = [] #spefical case, last items # if item == len(word_list) - 3: #...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def make_chains(text_string):\n\n chains = {}\n #create an empty dictionary\n words = text_string.split()\n #make text into string and then splitting it\n \n for i in range(len(words)-2):\n #for every word in string except for last two words\n bi_gram = (words[i], words[i + 1])\n ...
[ "0.78405654", "0.7815626", "0.7713553", "0.7712469", "0.7682572", "0.7609984", "0.7523079", "0.7451183", "0.7412132", "0.7340578", "0.7228342", "0.7148296", "0.71370125", "0.7104237", "0.7066929", "0.7030934", "0.7027609", "0.69798696", "0.69663167", "0.6962427", "0.6946171",...
0.6859585
21
Return text from chains.
def make_text(chains): for keys, values in chains.items(): print keys, values print words = [] #1 create a link, which is a tuple from chains dic #2 extend tuple key into word list #3 get random word from list of words, list is value of key #4 make a new key out of the second word f...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def make_text(chains):\n key = choice(list(chains.keys()))\n\n words = []\n\n while key in chains:\n word = get_new_word(key, chains)\n words.append(word)\n key = get_new_key(key, word)\n\n return \" \".join(words)", "def make_text(chains):\n\n # your code goes here\n n_gra...
[ "0.6877864", "0.68339574", "0.66368175", "0.65270734", "0.6404046", "0.6402408", "0.6392992", "0.63704985", "0.6316046", "0.62374765", "0.6143996", "0.61439246", "0.6120579", "0.6117858", "0.60981613", "0.6083784", "0.6052192", "0.60474247", "0.6025969", "0.59894925", "0.5967...
0.60559165
16
Convert a number into comma notation as per Indian number system. This function accepts integer, float. If keep_decimal is true, we the decimal value will be be returned else decimal place will be ignored.
def indian_currency(amount, keep_decimal=True): if not amount: return 0.00 amount_string = valiate_format(amount) neg = True if amount < 0 else False amount_string, decimal_value = split_decimal(amount_string) length = len(amount_string) if length <=3: if keep_decimal and de...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def conv_num_with_commas(number_text):\n number=number_text.split(',')\n item=''\n for numero in number:\n item+=numero\n final_number=float(item)\n return final_number", "def display_float_with_comma(value):\n # incase the input type is not a string, convert into one\n if not isinsta...
[ "0.6213089", "0.6055099", "0.6021734", "0.59922403", "0.53055495", "0.52868134", "0.5286344", "0.528052", "0.52780765", "0.5189823", "0.5187271", "0.516885", "0.5160782", "0.5149218", "0.51118875", "0.50903136", "0.5089379", "0.50365806", "0.50206995", "0.49854368", "0.492030...
0.6437726
0
Converts a large integer number into a friendly text representation.
def indian_word_currency(value): if isinstance(value, int) and value < 100: return str(value) if isinstance(value, float) and value < 99: return str(value) try: if isinstance(value, str): if '.' not in value and int(value) < 99: return value i...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def format_large_number(num):\n if num < 1e4: # 10,000\n # https://stackoverflow.com/a/10742904\n return '{:,}'.format(num)\n\n for exp, prefix in iteritems(Formatter.NUM_PREFIX):\n fraction = float(num) / float(10**exp)\n if 1 <= fraction < 1e3:\n ...
[ "0.6610469", "0.6593143", "0.65803856", "0.6473262", "0.6387711", "0.6378826", "0.63741016", "0.6264508", "0.62550455", "0.6251129", "0.6245867", "0.6242559", "0.62408245", "0.6215427", "0.6211276", "0.6165015", "0.6134773", "0.60364807", "0.60314745", "0.6027881", "0.5992484...
0.0
-1
Compile struct packers for all of the formats used by BufferedByteStream. Called whenever a BufferedByteStream's endianness is changed.
def _compile_packers(endian): return { "B": struct.Struct(endian + "B"), "b": struct.Struct(endian + "b"), "h": struct.Struct(endian + "h"), "H": struct.Struct(endian + "H"), "l": struct.Struct(endian + "l"), "L": struct.Struct(endian + "L"), "d": struct.Struc...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _fill_cdata(cls):\n\n funcs = {}\n for key, name in [(\"b\", \"char\"), (\"h\", \"short\"),\n (\"i\", \"int\"), (\"q\", \"longlong\")]:\n for echar, esuffix in [(\"<\", \"le\"), (\">\", \"be\")]:\n esuffix = \"_\" + esuffix\n for unsigned in [True, False]...
[ "0.54127973", "0.52528113", "0.5202475", "0.51727545", "0.5138992", "0.51032", "0.50767475", "0.50531936", "0.502232", "0.501981", "0.50173527", "0.49746272", "0.49665293", "0.49586567", "0.49272287", "0.49084684", "0.49043682", "0.48672134", "0.48526588", "0.48318917", "0.48...
0.73967206
0
If C{length} is 1 or unspecified, return the rest of the buffer. Otherwise, return exactly the specified number of bytes from the buffer. Either way, advance the seek position over the data read.
def read(self, length=-1): if length == 0: return b'' if length < -1: raise IOError("invalid read length: %r" % length) if self.at_eof(): raise IOError( "Attempted to read from the buffer but already at the end") if length == -1: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get(self, length):\n if length > self.remaining():\n raise BufferError(\"Not enough bytes [remaining=%d,requested=%d]\" %\n (self.remaining(), length))\n start = self.offset\n end = self.offset + length\n self.offset += length\n return ...
[ "0.7689199", "0.7155332", "0.6718683", "0.6675357", "0.6514841", "0.6514841", "0.64937276", "0.64912575", "0.6453085", "0.6440127", "0.6392433", "0.63902384", "0.635299", "0.6351777", "0.6294604", "0.62938076", "0.6220419", "0.62060124", "0.6198831", "0.61686623", "0.6131877"...
0.73477554
1
Looks up to C{size} bytes ahead in the stream without changing the seek position. Unlike C{read}, it is not an error to try to peek past the end of the buffer, and fewer than the number of requested bytes may be returned.
def peek(self, size=1): if size < -1: raise ValueError("Cannot peek backwards") if size == 0: return b'' if size == -1: size = self.remaining() peeked = b'' with Excursion(self._buf): while len(peeked) < size: c =...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def peek(self, size=-1):\n if not self._readable:\n raise UnsupportedOperation(\"read\")\n\n with self._seek_lock:\n self._raw.seek(self._seek)\n return self._raw._peek(size)", "def read(self, size=-1):\n chunk_index, prefix_size = self._index_pos(self._pos)\...
[ "0.74297446", "0.6948958", "0.67741823", "0.6749181", "0.66498965", "0.6569089", "0.6517509", "0.6480654", "0.6467621", "0.6467621", "0.62642694", "0.6217797", "0.6177777", "0.6168342", "0.61496145", "0.6127795", "0.60906035", "0.6076821", "0.60006875", "0.59697473", "0.58953...
0.69835883
1
Discard all of the data already read (from byte 0 up to C{tell()}) and reset the seek position to the new beginning of the stream.
def consume(self): rest = self._buf.read() self._buf.seek(0, 0) self._buf.truncate(0) self._len = 0 self.append(rest)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rewind(self):\n self.seek(0)", "def rewind(self):\n self.seek(0)", "def reset(self):\n self.source.seek(0)\n self.target.seek(0)", "def reset(self):\n # type: () -> None\n self.digest.clear()\n self.offset.clear()\n self.buffer.clear()\n ...
[ "0.67790544", "0.67400026", "0.66891193", "0.65835226", "0.64055574", "0.6358923", "0.6332057", "0.63083786", "0.6299572", "0.62511396", "0.62072647", "0.6201914", "0.6192439", "0.6189732", "0.6158342", "0.60358", "0.6002399", "0.59987175", "0.5985189", "0.59615695", "0.59346...
0.5381876
48
Returns number of remaining bytes.
def remaining(self): return len(self) - self.tell()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remaining_bytes(self):\n try:\n return self._get_limit('remaining')\n except ValueError:\n logging.error(\n \"Unable to gather limit statistics until log() has been called. Returning -1\")\n return -1", "def BytesTransferred(self) -> int:", "def...
[ "0.79955524", "0.7503243", "0.72665423", "0.723585", "0.723585", "0.7140973", "0.7121997", "0.7101556", "0.70414186", "0.7018545", "0.69614124", "0.69507426", "0.69253415", "0.6894986", "0.6894986", "0.6891443", "0.68778425", "0.6819636", "0.6797956", "0.67900383", "0.6769142...
0.78777385
1
Returns C{True} if the seek position is at the end of the stream.
def at_eof(self): return self.tell() == len(self)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def atEnd(self):\n return (self.ins.tell() == self.size)", "def has_end(self):\n return bool(self._end)", "def at_eof(self):\n return self._eof and not self._buffer", "def eof(self):\r\n\t\treturn self.index == len(self.data)", "def eos(self):\n return self.pos == len(self.strin...
[ "0.73306084", "0.7322948", "0.72013944", "0.7068702", "0.6958195", "0.69033283", "0.689503", "0.6812034", "0.68020433", "0.67834455", "0.6665296", "0.662397", "0.6615335", "0.65767634", "0.6551174", "0.6505491", "0.64960724", "0.6482905", "0.6482905", "0.6482905", "0.6482905"...
0.7866897
0
Writes the content of the specified C{s} into this buffer at the current seek position, and advance the seek position.
def write(self, s): self._buf.write(s) self._len = None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _write(self, s):\n self.fh.write(s)\n self.fh.flush()", "def write(self, s):\r\n for result in self.writeAsync(s):\r\n pass", "def write(self, s):\n written = 0\n while written != len(s):\n written += os.write(self.__pipe, s[written:])", "def write...
[ "0.6771928", "0.67325693", "0.6679446", "0.6551387", "0.64571244", "0.6429988", "0.6343345", "0.5962146", "0.5882854", "0.58304954", "0.56686735", "0.5592929", "0.55721587", "0.5517105", "0.5515542", "0.54562396", "0.54396826", "0.54280365", "0.54177964", "0.54036105", "0.533...
0.6774574
0
Append data to the end of the stream. Does not change the seek position.
def append(self, data): if data is None: return odata = data if not isinstance(data, (six.binary_type, six.text_type, bytearray)): if hasattr(data, "getvalue"): data = data.getvalue() elif (hasattr(data, "read") and hasattr(...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def append(self, data):\n self.ensure_initialized()\n Buffer(stream=self.name,\n data=data).save(write_concern=dict(w=0, j=False))", "def append(self, data):\n self.buf = b''.join([self.buf, data])", "def append_end(self, data):\r\n with open(self.file_name, 'a', encod...
[ "0.79315263", "0.78478533", "0.77861255", "0.7241231", "0.72046864", "0.71505696", "0.7033231", "0.69544023", "0.67950517", "0.67017543", "0.66292185", "0.6625858", "0.65239507", "0.6487943", "0.6480987", "0.6456773", "0.64531285", "0.64305186", "0.6297832", "0.62860274", "0....
0.74896365
3
The endianness of this stream.
def endian(self): return self._endian
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def endianness(self):", "def data_endianess(self):\n data_endianess = self.query('FORMat:BORDer?')\n if data_endianess == 'NORM':\n return 'big'\n elif data_endianess == 'SWAP':\n return 'little'\n else:\n raise InstrIOError(cleandoc('''Agilent PNA did...
[ "0.85871786", "0.73067874", "0.71036994", "0.6880202", "0.6679047", "0.65297395", "0.6192463", "0.6032108", "0.5841983", "0.5796016", "0.56900966", "0.562354", "0.5619385", "0.5576774", "0.557647", "0.5484285", "0.5479514", "0.54259217", "0.5406424", "0.53953815", "0.5393183"...
0.8430153
1
Reads an C{unsigned char} from the stream.
def read_uchar(self): return self._packers["B"].unpack(self.read(1))[0]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read_unsigned_char(data):\n s_type = \"=%s\" % get_type(\"unsigned_char\")\n return struct.unpack(s_type, data.read(1))[0]", "def read_char(data):\n s_type = \"=%s\" % get_type(\"char\")\n return struct.unpack(s_type, data.read(1))[0]", "def read_char(self):\n return self._packers[\"b\"]...
[ "0.7388134", "0.6479258", "0.6409002", "0.6185375", "0.6154404", "0.61339027", "0.60471183", "0.59229064", "0.5886881", "0.58693", "0.5739066", "0.5736247", "0.5723009", "0.57197046", "0.57160836", "0.5687061", "0.5622769", "0.5608899", "0.5587311", "0.5542628", "0.55373245",...
0.63916385
3
Writes an C{unsigned char} to the stream.
def write_uchar(self, c): if not isinstance(c, six.integer_types): raise TypeError("expected an int, got %r" % type(c)) if not 0 <= c <= 255: raise OverflowError("Not in range, %d" % c) self.write(self._packers["B"].pack(c))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def write_char(self, c):\n if not isinstance(c, six.integer_types):\n raise TypeError(\"expected an int, got %r\" % type(c))\n\n if not -128 <= c <= 127:\n raise OverflowError(\"Not in range, %d\" % c)\n\n self.write(self._packers[\"b\"].pack(c))", "def write(self, data...
[ "0.62047654", "0.6169431", "0.5987988", "0.5944119", "0.59145176", "0.5777741", "0.5748772", "0.5719865", "0.5635184", "0.56037086", "0.55938625", "0.5517079", "0.55165476", "0.5494965", "0.5490515", "0.5480598", "0.53913444", "0.53841263", "0.5383362", "0.5370967", "0.535783...
0.6414628
0
Reads a C{char} from the stream.
def read_char(self): return self._packers["b"].unpack(self.read(1))[0]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _read_char(self):\n if self.read_pos >= len(self.data):\n self.char = \"\"\n else:\n self.char = self.data[self.read_pos]\n\n self.pos = self.read_pos\n self.read_pos += 1", "def ReadChar(self):\n return self.unpack('c')", "def read_char(self):\n ...
[ "0.80392116", "0.7728206", "0.750076", "0.74831676", "0.7385394", "0.7294869", "0.72302", "0.7133801", "0.69340503", "0.67945653", "0.67772686", "0.6732436", "0.64883834", "0.64750993", "0.64563584", "0.6453466", "0.63554895", "0.6342578", "0.63184357", "0.6194232", "0.616028...
0.74292386
4
Write a C{char} to the stream.
def write_char(self, c): if not isinstance(c, six.integer_types): raise TypeError("expected an int, got %r" % type(c)) if not -128 <= c <= 127: raise OverflowError("Not in range, %d" % c) self.write(self._packers["b"].pack(c))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def writechar(self, char: int, /) -> None:", "def write_char(self, char=' '):\n integer = ord(char)\n self.instruction(integer, True)", "def _write_char_to_printer(self, c):\n\n if c != 13: # Strip carriage returns\n self.timeout_wait()\n self._send_to_printer(c)\n ...
[ "0.78741604", "0.7694497", "0.656016", "0.64138603", "0.63576275", "0.63218206", "0.6209368", "0.61597043", "0.61543685", "0.60975426", "0.609098", "0.60559934", "0.59504026", "0.59109944", "0.59066737", "0.5889077", "0.58830947", "0.5869379", "0.5790695", "0.5787261", "0.578...
0.69380414
2
Reads a 2 byte unsigned integer from the stream.
def read_ushort(self): return self._packers["H"].unpack(self.read(2))[0]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read_unsigned_integer(stream, size):\n\t\n\tvalue = 0\n\tfor i in xrange(0, size):\n\t\tbyte = ord(stream.read(1))\n\t\tvalue = (value << 8) | byte\n\treturn value", "def read_unsigned_int(data):\n s_type = \"=%s\" % get_type(\"unsigned_int\")\n return struct.unpack(s_type, data.read(4))[0]", "def re...
[ "0.766513", "0.71402544", "0.7031943", "0.66271865", "0.65478635", "0.6478632", "0.6465242", "0.6383568", "0.63670504", "0.62853414", "0.6272011", "0.62385833", "0.6209731", "0.61416376", "0.61301327", "0.6118309", "0.61161214", "0.6115051", "0.61038816", "0.6088596", "0.6067...
0.6051892
22
Writes a 2 byte unsigned integer to the stream.
def write_ushort(self, s): if not isinstance(s, six.integer_types): raise TypeError("expected an int, got %r" % (type(s),)) if not 0 <= s <= 65535: raise OverflowError("Not in range, %d" % s) self.write(self._packers["H"].pack(s))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def write(writer: BitStreamWriter, value: int) -> None:\n\n writer.writeVarUInt64(value)", "def write(writer: BitStreamWriter, value: int) -> None:\n\n writer.writeVarUInt(value)", "def write(writer: BitStreamWriter, value: int) -> None:\n\n writer.writeVarUInt16(value)", "def write(writ...
[ "0.64777136", "0.64463854", "0.6185204", "0.6159232", "0.61308295", "0.6059817", "0.60490876", "0.60383743", "0.5952865", "0.5862558", "0.5853726", "0.5853726", "0.5818089", "0.5806767", "0.57858825", "0.57842326", "0.5759094", "0.5742367", "0.5663727", "0.5630262", "0.557682...
0.54830444
25
Reads a 2 byte integer from the stream.
def read_short(self): return self._packers["h"].unpack(self.read(2))[0]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read(self, bytes):\r\n return int.from_bytes(self.__input__.read(bytes), byteorder='big')", "def read_int(data):\n s_type = \"=%s\" % get_type(\"int\")\n return struct.unpack(s_type, data.read(4))[0]", "def read_unsigned_integer(stream, size):\n\t\n\tvalue = 0\n\tfor i in xrange(0, size):\n\t\tbyt...
[ "0.7256335", "0.69153917", "0.66121185", "0.660856", "0.6573912", "0.65217644", "0.6435378", "0.6409366", "0.6391915", "0.63241154", "0.629254", "0.6282565", "0.62767905", "0.62525207", "0.62324095", "0.6228817", "0.6199247", "0.61701554", "0.6144873", "0.61408687", "0.613137...
0.0
-1
Writes a 2 byte integer to the stream.
def write_short(self, s): if not isinstance(s, six.integer_types): raise TypeError("expected an int, got %r" % (type(s),)) if not -32768 <= s <= 32767: raise OverflowError("Not in range, %d" % s) self.write(self._packers["h"].pack(s))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def writeInt(self, value: int):\n self._pack('!i', value)", "def writeByte(self, value: int):\n self._pack('c', chr(value).encode('utf-8'))", "def write(writer: BitStreamWriter, value: int) -> None:\n\n writer.writeVarInt64(value)", "def write(writer: BitStreamWriter, value: int) -> None...
[ "0.6684756", "0.6595042", "0.65597475", "0.65221685", "0.6374616", "0.6374597", "0.6341045", "0.631777", "0.6280338", "0.61815804", "0.615131", "0.6151274", "0.6100302", "0.6003785", "0.594896", "0.5927925", "0.5913833", "0.5898952", "0.5879363", "0.584671", "0.584671", "0....
0.0
-1
Reads a 4 byte unsigned integer from the stream.
def read_ulong(self): return self._packers["L"].unpack(self.read(4))[0]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read_unsigned_integer(stream, size):\n\t\n\tvalue = 0\n\tfor i in xrange(0, size):\n\t\tbyte = ord(stream.read(1))\n\t\tvalue = (value << 8) | byte\n\treturn value", "def read_unsigned_int(data):\n s_type = \"=%s\" % get_type(\"unsigned_int\")\n return struct.unpack(s_type, data.read(4))[0]", "def re...
[ "0.7877984", "0.72684455", "0.7085551", "0.70260876", "0.7005186", "0.67214376", "0.67020947", "0.66794294", "0.66794294", "0.6592824", "0.647665", "0.6474869", "0.6398645", "0.6384977", "0.6357862", "0.6307053", "0.62883145", "0.62734646", "0.6258752", "0.6233887", "0.619420...
0.59115314
38
Writes a 4 byte unsigned integer to the stream.
def write_ulong(self, l): if not isinstance(l, six.integer_types): raise TypeError("expected an int, got %r" % (type(l),)) if not 0 <= l <= 4294967295: raise OverflowError("Not in range, %d" % l) self.write(self._packers["L"].pack(l))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def write(writer: BitStreamWriter, value: int) -> None:\n\n writer.writeVarUInt(value)", "def write(writer: BitStreamWriter, value: int) -> None:\n\n writer.writeVarUInt32(value)", "def write_u32(self):\n pass", "def write(writer: BitStreamWriter, value: int) -> None:\n\n writer.w...
[ "0.6620171", "0.6616966", "0.6519365", "0.64177084", "0.63879305", "0.6382794", "0.6150479", "0.61050576", "0.60932934", "0.6078528", "0.5987344", "0.5962268", "0.59355766", "0.5920396", "0.5905659", "0.59021604", "0.5894934", "0.5811835", "0.5797155", "0.57781565", "0.577815...
0.5123099
68
Reads a 4 byte integer from the stream.
def read_long(self): return self._packers["l"].unpack(self.read(4))[0]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read4(buf):\n return 0", "def read(self, bytes):\r\n return int.from_bytes(self.__input__.read(bytes), byteorder='big')", "def read_int(data):\n s_type = \"=%s\" % get_type(\"int\")\n return struct.unpack(s_type, data.read(4))[0]", "def read_int(self, size=4, location=None):\n return s...
[ "0.7653245", "0.7200353", "0.7169016", "0.7151406", "0.6944196", "0.68390286", "0.681368", "0.681368", "0.6614693", "0.65628636", "0.6554906", "0.64941144", "0.6379393", "0.6373212", "0.63580275", "0.6343378", "0.6330141", "0.62951756", "0.6257271", "0.62527514", "0.6252063",...
0.0
-1
Writes a 4 byte integer to the stream.
def write_long(self, l): if not isinstance(l, six.integer_types): raise TypeError("expected an int, got %r" % (type(l),)) if not -2147483648 <= l <= 2147483647: raise OverflowError("Not in range, %d" % l) self.write(self._packers["l"].pack(l))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def writeInt(self, value: int):\n self._pack('!i', value)", "def write(writer: BitStreamWriter, value: int) -> None:\n\n writer.writeVarUInt32(value)", "def write_int32(self, i: int) -> None:\n self.buffer += struct.pack(\"<i\", i)", "def write(writer: BitStreamWriter, value: int) -> Non...
[ "0.692751", "0.6676718", "0.66748893", "0.6648448", "0.66005147", "0.65843236", "0.64534575", "0.6433837", "0.641331", "0.63314", "0.632405", "0.6273158", "0.6253679", "0.6210804", "0.6147953", "0.61239624", "0.6076964", "0.60627997", "0.60627997", "0.6053167", "0.601624", ...
0.0
-1
Reads a 24 bit unsigned integer from the stream.
def read_24bit_uint(self): if self._is_little_endian(): order = [0, 8, 16] else: order = [16, 8, 0] n = 0 for x in order: n += (self.read_uchar() << x) return n
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read_24bit_int(self):\n n = self.read_24bit_uint()\n\n if n & 0x800000 != 0:\n # the int is signed\n n -= 0x1000000\n\n return n", "def read_unsigned_integer(stream, size):\n\t\n\tvalue = 0\n\tfor i in xrange(0, size):\n\t\tbyte = ord(stream.read(1))\n\t\tvalue = (v...
[ "0.7435512", "0.6937585", "0.67033064", "0.6518586", "0.61511385", "0.60001844", "0.59865487", "0.59164345", "0.59018034", "0.5834223", "0.5816457", "0.5815409", "0.58138126", "0.57731247", "0.5771819", "0.5757917", "0.5757917", "0.57309335", "0.5648384", "0.5620404", "0.5613...
0.77171445
0
Writes a 24 bit unsigned integer to the stream.
def write_24bit_uint(self, n): if not isinstance(n, six.integer_types): raise TypeError("expected an int, got %r" % (type(n),)) if not 0 <= n <= 0xffffff: raise OverflowError("n is out of range") if self._is_little_endian(): order = [0, 8, 16] else: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def write_24bit_int(self, n):\n if not isinstance(n, six.integer_types):\n raise TypeError(\"expected an int, got %r\" % (type(n),))\n\n if not -8388608 <= n <= 8388607:\n raise OverflowError(\"n is out of range\")\n\n if n < 0:\n n += 0x1000000\n\n if s...
[ "0.70267826", "0.67283916", "0.65581244", "0.63965625", "0.5880815", "0.5788928", "0.5785339", "0.57343805", "0.57132995", "0.5700842", "0.5683279", "0.5661951", "0.5599271", "0.5459302", "0.542944", "0.5402754", "0.5371565", "0.5343313", "0.5334597", "0.518417", "0.51594186"...
0.7210746
0
Reads a 24 bit integer from the stream.
def read_24bit_int(self): n = self.read_24bit_uint() if n & 0x800000 != 0: # the int is signed n -= 0x1000000 return n
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read_24bit_uint(self):\n if self._is_little_endian():\n order = [0, 8, 16]\n else:\n order = [16, 8, 0]\n\n n = 0\n for x in order:\n n += (self.read_uchar() << x)\n\n return n", "def _read24(self, register):\r\n ret = 0.0\r\n ...
[ "0.733056", "0.65002835", "0.60552233", "0.6039677", "0.60131735", "0.5971058", "0.59647214", "0.59647214", "0.594664", "0.5936618", "0.59352607", "0.59033895", "0.5838442", "0.57878673", "0.5767999", "0.5709288", "0.5655133", "0.56492794", "0.56178665", "0.55877143", "0.5566...
0.791934
0
Writes a 24 bit integer to the stream.
def write_24bit_int(self, n): if not isinstance(n, six.integer_types): raise TypeError("expected an int, got %r" % (type(n),)) if not -8388608 <= n <= 8388607: raise OverflowError("n is out of range") if n < 0: n += 0x1000000 if self._is_little_endi...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def write24bit(self, register, value):\n if value > ((2 ** 24) - 1) or value < 0:\n raise ValueError\n valuearray = struct.pack('!I', value) # Place value into byte array, format '!I' is int, network order\n self.device.writeregistermulti(register, valuearray[1:]) #Only 3 LSB bytes...
[ "0.68899083", "0.68623495", "0.6844214", "0.63099045", "0.62283903", "0.6189997", "0.60188186", "0.5983669", "0.5938283", "0.59133977", "0.58699304", "0.5794902", "0.57604027", "0.5732328", "0.56575936", "0.5546907", "0.554556", "0.55351263", "0.5510964", "0.5464817", "0.5443...
0.7471859
0
Reads an 8 byte float from the stream.
def read_double(self): return self._packers["d"].unpack(self.read(8))[0]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read_float(stream, size):\n\t\n\tif size not in (0, 4, 8):\n\t\traise IOError('Cannot read floating point values with lengths other than 0, 4, or 8 bytes.')\n\tvalue = 0.0\n\tif size in (4, 8):\n\t\tdata = stream.read(size)\n\t\tvalue = struct.unpack({\n\t\t\t4: '>f',\n\t\t\t8: '>d'\n\t\t}[size], data)[0]\n\tr...
[ "0.80106986", "0.7730838", "0.766151", "0.7635955", "0.7614672", "0.7487496", "0.7218203", "0.71581095", "0.6953444", "0.69432914", "0.6857476", "0.6772489", "0.6638946", "0.65989846", "0.6520763", "0.6501524", "0.644038", "0.6420116", "0.62686735", "0.62367857", "0.6165444",...
0.0
-1
Writes an 8 byte float to the stream.
def write_double(self, d): if not isinstance(d, float): raise TypeError("expected a float, got %r" % (type(d),)) self.write(self._packers["d"].pack(d))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def write_float(self, f: float) -> None:\n self.write(STRUCT_FLOAT.pack(f))", "def writeFloat(self, value: float):\n self._pack('!f', value)", "def write_float(self, f):\n if not isinstance(f, float):\n raise TypeError(\"expected a float, got %r\" % (type(f),))\n\n self.w...
[ "0.7677815", "0.75240207", "0.73776126", "0.73285884", "0.7201347", "0.700144", "0.68877804", "0.68068075", "0.66842574", "0.65563786", "0.65366155", "0.6486548", "0.6208688", "0.6133398", "0.612917", "0.6073239", "0.60621494", "0.60548085", "0.6021651", "0.60143775", "0.5952...
0.5021727
58
Reads a 4 byte float from the stream.
def read_float(self): return self._packers["f"].unpack(self.read(4))[0]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def readFloat(self) -> float:\n return self._unpack('!f', 4)", "def read_float(stream, size):\n\t\n\tif size not in (0, 4, 8):\n\t\traise IOError('Cannot read floating point values with lengths other than 0, 4, or 8 bytes.')\n\tvalue = 0.0\n\tif size in (4, 8):\n\t\tdata = stream.read(size)\n\t\tvalue = s...
[ "0.81904256", "0.81868696", "0.8081511", "0.78348106", "0.7648374", "0.75123966", "0.7459522", "0.7324471", "0.71458465", "0.7088968", "0.70001954", "0.6880871", "0.685976", "0.68519646", "0.6761948", "0.66912", "0.6442515", "0.6328978", "0.6322604", "0.60809606", "0.60084695...
0.79618204
3
Writes a 4 byte float to the stream.
def write_float(self, f): if not isinstance(f, float): raise TypeError("expected a float, got %r" % (type(f),)) self.write(self._packers["f"].pack(f))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def write_float(self, f: float) -> None:\n self.write(STRUCT_FLOAT.pack(f))", "def writeFloat(self, value: float):\n self._pack('!f', value)", "def write_float32(self, f: float) -> None:\n self.buffer += struct.pack(\"<f\", f)", "def write(writer: BitStreamWriter, value: float) -> None:\...
[ "0.77374744", "0.76476306", "0.76368445", "0.7548338", "0.718865", "0.71618754", "0.6940848", "0.66909313", "0.66549087", "0.6606455", "0.6405022", "0.6377028", "0.63117087", "0.6210589", "0.60448", "0.60443836", "0.6023774", "0.59980386", "0.5979807", "0.59551466", "0.585998...
0.74354744
4
Reads a UTF8 string from the stream.
def read_utf8_string(self, length): return self.read(length).decode("utf-8")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def readString(stream):\n # read the string length (4-byte int, network byte order)\n buf = stream.read(4)\n if len(buf) < 4:\n raise RuntimeError(\"found %d bytes (expected: 4)\" % len(buf))\n n_bytes = struct.unpack(\"!i\", buf)[0]\n if n_bytes < 0:\n return None\n buf = stream.re...
[ "0.7554304", "0.7308685", "0.73078424", "0.66278684", "0.6578648", "0.65687615", "0.6549844", "0.6532995", "0.6521878", "0.64916456", "0.64635867", "0.643787", "0.63874054", "0.62223274", "0.6187246", "0.6127436", "0.61217374", "0.6100491", "0.6074277", "0.6024016", "0.599429...
0.7803178
0
Writes a string to the stream. If it is a Unicode object, it will be encoded in UTF8; if it is a byte string, it will be written out asis.
def write_utf8_string(self, u): if isinstance(u, six.text_type): u = u.encode("utf-8") elif isinstance(u, bytearray): u = six.binary_type(u) if not isinstance(u, six.binary_type): raise TypeError("Expected a string, got %r" % (u,)) self.write(u)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def write_utf8(self, s: str) -> None:\n self.write_bytes(s.encode(\"utf-8\"))", "def write(file, string, codec='utf8'):\n if isinstance(string, str):\n file.write(string)\n elif isinstance(string, unicode):\n file.write(string.encode(codec))", "def writeString(stream, s):\n if s i...
[ "0.7791684", "0.75173044", "0.7269316", "0.70626867", "0.6870034", "0.68018013", "0.67969155", "0.6790861", "0.67679846", "0.67537695", "0.66470253", "0.66467935", "0.6618192", "0.65673757", "0.6537432", "0.6496219", "0.6492293", "0.63817656", "0.6369088", "0.6359491", "0.635...
0.7696836
1
Matrix is filled up with given data If too much data the excess is discarded If too little data the remainder is filled with zeros If no data then the matrix will be only zeros (shell for result matrix)
def fillMatrix(self, data): i = 0 length = len(data) for r in range(self.rows): for c in range(self.columns): if i >= length: num = 0 else: num = data[i] self.mat[r][c] = num ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def zeros_matrix(self, rows, cols):\r\n M = []\r\n while len(M) < rows:\r\n M.append([])\r\n while len(M[-1]) < cols:\r\n M[-1].append(0.0)\r\n\r\n return M", "def zeroMatrix(width, height):\n returnvalue = Matrix()\n for i in rang...
[ "0.6447685", "0.64340955", "0.62304294", "0.6177189", "0.6117132", "0.6110023", "0.60474694", "0.60474694", "0.6038418", "0.5968105", "0.5960306", "0.5879425", "0.58070964", "0.5775621", "0.57458425", "0.5740294", "0.57398784", "0.57330877", "0.57258934", "0.5714473", "0.5698...
0.73310274
0
Fill matrix with random numbers from 10 to 10
def randomfill(self): for r in range(self.rows): for c in range(self.columns): self.mat[r][c] = randint(-10, 10)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def irandmatrix(n, range = 10):\n A = mp.matrix(n, n)\n for i in xrange(n):\n for j in xrange(n):\n A[i,j]=int( (2 * mp.rand() - 1) * range)\n return A", "def generate_random_matrix(n):\n return [[random.randint(1, 50) for i in range(n)] for j in range(n)]", "def random_matrix(row...
[ "0.7244703", "0.7049676", "0.68952924", "0.6875506", "0.6874144", "0.68682826", "0.67189467", "0.6603398", "0.6603138", "0.6602197", "0.656827", "0.65382016", "0.6435154", "0.6365384", "0.6350057", "0.63318795", "0.63235366", "0.62902623", "0.6284012", "0.6262402", "0.6259421...
0.8371872
0
Checks to see if the dimensions would work for certain operations
def conformability(self, other): if self.columns == other.rows: return True else: return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _check_dimensions(self, workspace_to_check):\n for i in range(self._raw_ws.getNumDims()):\n if self._raw_ws.getDimension(i).getNBins() != workspace_to_check._raw_ws.getDimension(i).getNBins():\n return False\n return True", "def _autocheck_dimensions(self):\n # W dimensions che...
[ "0.75865364", "0.7460819", "0.7296454", "0.7290595", "0.71690255", "0.7003274", "0.69443405", "0.69296396", "0.6831217", "0.6804422", "0.668842", "0.66664505", "0.66611636", "0.6647703", "0.66099197", "0.65798324", "0.65714157", "0.65246826", "0.6504994", "0.64929646", "0.645...
0.0
-1
Checks if they have the same dimensions
def similar(self, other): if self.rows == other.rows and self.columns == other.columns: return True else: return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def have_same_shapes(array1, array2):\n return array1.shape == array2.shape", "def check_shapes(arrs):\r\n shps = [i.shape for i in arrs]\r\n eq = np.all(np.array([shps[0] == i for i in shps[1:]]))\r\n err = \"Arrays arr not of the same shape...\"\r\n if not eq:\r\n raise ValueError(\"{}\\n...
[ "0.75398207", "0.72383565", "0.72302717", "0.721817", "0.70686793", "0.69272715", "0.6916093", "0.68982494", "0.68744814", "0.6826846", "0.6802648", "0.67386645", "0.6696604", "0.6666695", "0.6666695", "0.66638666", "0.6617126", "0.6607582", "0.6575409", "0.6573012", "0.65647...
0.6427632
37
Work out the cofactor of each item Replace each item with it's cofactor Transpose Put 1/determinant at the front
def inverseN(self): result = Matrix(self.rows, self.columns) for r in range(self.rows): for c in range(self.columns): result.mat[r][c] = self.cofactor(r, c) result.out() result = result.transpose() det = self.determinant() print("1/(" +...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cofactorMatrix(self):\n returnvalue = Matrix()\n for i in range(self._height):\n newRow = list()\n for j in range(self._width):\n newRow.append(self.cofactor(i, j))\n returnvalue.addRow(*newRow)\n return returnvalue", "def cofactor_matrix(s...
[ "0.59314865", "0.55237913", "0.5516391", "0.54912686", "0.5344532", "0.52926326", "0.52512145", "0.51822233", "0.5175584", "0.51654005", "0.51284164", "0.50950515", "0.5084377", "0.50650454", "0.5057281", "0.5056189", "0.5050028", "0.50348383", "0.49950525", "0.49877185", "0....
0.0
-1
Do not return anything, modify nums1 inplace instead.
def merge(self, nums1: List[int], m: int, nums2: List[int], n: int) -> None: i1, i2 = 0, 0 result = [] while i1 < m and i2 < n: if nums1[i1] < nums2[i2]: result.append(nums1[i1]) i1 += 1 else: result.append(nums2[i2]) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def merge1(self, nums1, m, nums2, n): \n nums1[:m].extend(nums2[:n]) # 此方法改变了nums1的指向,无效\n # extend没改变指向,但是切片改了 \n nums1[:m] + nums2[:n] # 此方法改变了nums1的指向,无效\n # +号改变了指向\n\n nums1.sort()", "def merge(self, nums1, m, nums2, n):\n nums1.extend([0]*...
[ "0.70245457", "0.70108604", "0.70053697", "0.69865894", "0.691567", "0.6844798", "0.6828224", "0.6801554", "0.67691046", "0.6755363", "0.67433304", "0.67416406", "0.67373633", "0.6709736", "0.6706835", "0.6683356", "0.66682595", "0.663933", "0.6638101", "0.6635947", "0.663418...
0.6517034
29
Test converting toluene and benzene smiles to oemol to ffxml to openmm simulation.
def test_ffxml_simulation(): with utils.enter_temp_directory(): m0 = openmoltools.openeye.smiles_to_oemol("Cc1ccccc1") charged0 = openmoltools.openeye.get_charges(m0) m1 = openmoltools.openeye.smiles_to_oemol("c1ccccc1") charged1 = openmoltools.openeye.get_charges(m1) ligands...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_to_from_oemol(self, molecule):\n from openff.toolkit.utils.toolkits import UndefinedStereochemistryError\n\n # Known failures raise an UndefinedStereochemistryError, but\n # the round-trip SMILES representation with the OpenEyeToolkit\n # doesn't seem to be affected.\n #...
[ "0.6176524", "0.61076534", "0.60451335", "0.5921864", "0.5918076", "0.5777649", "0.57627714", "0.57627714", "0.57380736", "0.5735808", "0.5732254", "0.5728689", "0.5727124", "0.56702065", "0.5639355", "0.5635702", "0.56343955", "0.56327903", "0.5627573", "0.5610018", "0.55571...
0.672862
0
The given bots participate in a roundrobin tournament to determine the best.
def match_off(bots, file_path="../../docs/match_offs/match_off_{}.json", test_number=0, nr_of_games=30): file_path = file_path.format(test_number) planned_matches = _get_planned_matches(bots, file_path) total_number_matches = len(bots) * (len(bots) - 1) // 2 # initialisation of matches if planned_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ring_winners(b, players):\n winners = []\n winrank = ''\n s = [evaluator.evaluate(b, p) for p in players]\n for i, rank in enumerate(s):\n if rank == min(s):\n winners.append(i)\n winrank = evaluator.class_to_string(evaluator.get_rank_class(rank))\n return [winners, ...
[ "0.6292793", "0.62386554", "0.6203449", "0.6122177", "0.6074982", "0.6030982", "0.59578973", "0.59498966", "0.5937039", "0.5881273", "0.5870421", "0.58702165", "0.5868602", "0.5844037", "0.5842854", "0.58409625", "0.58147407", "0.57897043", "0.5786137", "0.5743565", "0.574102...
0.0
-1
1 match (with botconfigpair) = m games
def _run_match(bots, nr_of_games) -> dict: start, game_results = datetime.now().timestamp(), _run_games(nr_of_games, bots) match_duration = datetime.now().timestamp() - start match_json = _match_result(game_results, match_duration) _print_match_end_score(match_json, match_duration) return match_js...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def match_game(self):\n # TODO: split this out so hold'em is separate\n return ['Settings arenaVersion 1.0',\n 'Settings gameType NLHE',\n 'Settings gameMode tournament', ]", "def play_games(binary, map_width, map_height, bot_commands, number_of_runs):\n print(\"Com...
[ "0.7191942", "0.59416705", "0.5874856", "0.5748545", "0.56131715", "0.555551", "0.5531592", "0.5485517", "0.5481073", "0.5480412", "0.545376", "0.5430182", "0.54011494", "0.5385674", "0.5350811", "0.5349633", "0.5340531", "0.5331209", "0.53310716", "0.5319012", "0.5311718", ...
0.59055597
2