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
Return a list of saved queries.
def cli_saved_queries_list(): query_list = None try: query_list = api.saved_queries_list() except NoRecordsFound as error: print "%(error)s" % locals() return for saved_query in query_list: print "%s: %s" % (saved_query['name'], ' '.join(saved_query['query_data']))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_all():\n return SavedQuery.get_all()", "def queries(self):\n return self.__queries", "def getQueries(self):\r\n\t\tp=[]\r\n\t\tfor pa in self.session.query(Query):\r\n\t\t\tp.append(pa)\r\n\t\treturn p", "def queries(self):\n request = Request(method=\"get\", endpoint=\"/query/curren...
[ "0.7667576", "0.7585832", "0.75617886", "0.712175", "0.67487055", "0.6739182", "0.6725898", "0.66023", "0.64973307", "0.64898187", "0.64600664", "0.63632965", "0.63412994", "0.6326499", "0.63150954", "0.62393606", "0.62237144", "0.62087446", "0.6208423", "0.6192179", "0.61645...
0.8412328
0
Add a new saved query.
def cli_saved_queries_add(query_name, query_data=None): api.saved_queries_add(query_name=query_name, query_data=query_data) print "Create a saved query called: %(query_name)s WHERE %(query_data)s" % locals()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sql_query(self, new_query):\n self._project.sql_query = new_query", "def append(query):\n # type: (str) -> bool\n if not query or not SEARCH_SAVED:\n return False\n searches = retrieve()\n if query not in searches:\n searches.append(query)\n save(searches)", "def add...
[ "0.66554177", "0.6546092", "0.63932824", "0.63851625", "0.63511246", "0.6313394", "0.63000375", "0.6286107", "0.6180346", "0.61383593", "0.6059474", "0.6016288", "0.6015879", "0.6008801", "0.6008801", "0.6008801", "0.6001739", "0.5991288", "0.59602004", "0.5895817", "0.589522...
0.7951758
0
get a saved query.
def cli_saved_queries_get(query_name): query_data = None try: query_data = api.saved_queries_get(query_name=query_name) except NoRecordsFound as error: print "%(error)s" % locals() return print " ".join(query_data)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_query(self):\n return self.query_class(self)", "def q(cls) -> Query:\n if not cls.s:\n raise M2Error('No DB session defined')\n return cls.s.query(cls)", "def query(self):\n return self.__query", "def get_by_id(query_id):\n return SavedQuery.get_by_id(query_i...
[ "0.7155504", "0.6962284", "0.67774105", "0.6627227", "0.65879077", "0.65879077", "0.65879077", "0.6582541", "0.64890325", "0.6447516", "0.64372355", "0.63774914", "0.637324", "0.63315004", "0.6327272", "0.6263391", "0.61659586", "0.6151461", "0.614061", "0.6099947", "0.607525...
0.6742502
3
Set command line arguments to be taken from user
def command_line_arguments(): _parser.add_argument('-l', '--list', nargs='+', help='<Required> Set flag', required=True) _parser.add_argument("-A", "--access", required=True, help="access to host => grant/revoke")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_args():\n # Initialise argparse object\n parser = argparse.ArgumentParser(description='Set some arguments for our script')\n # Add some arguments, elements are: short form name, long form name, type of input expected\n # default value if you don't set an argument, help string (shown if you run ...
[ "0.7202128", "0.6717831", "0.6680046", "0.6588375", "0.64948684", "0.64900154", "0.6443785", "0.6419259", "0.6415527", "0.63784754", "0.63747734", "0.63634557", "0.63517284", "0.6348229", "0.63337815", "0.6329227", "0.632307", "0.6321973", "0.63211393", "0.63144726", "0.62946...
0.6827972
1
get provided host credentials
def get_host_credentials(hostname, all_json): return all_json.get(hostname)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _config_credentials_get():\n user = input(\"username:\")\n password = getpass.getpass()\n url = input(\"url:\")\n return user, password, url", "def get_credentials(server: str) -> Tuple[str, int, str]:\n\n try:\n host, port, passwd = Credentials.from_string(server)\n except InvalidCr...
[ "0.73745304", "0.67990994", "0.6733025", "0.6724817", "0.6701221", "0.6673382", "0.6610663", "0.6610663", "0.65922374", "0.6591646", "0.65898424", "0.64869344", "0.64693296", "0.6456553", "0.6452662", "0.64463603", "0.6443417", "0.63946605", "0.6389267", "0.6388173", "0.63849...
0.68818766
1
This endpoint returns the matched data
def matched_string_folder(is_authenticated, is_authorized): if not is_authorized: return render_template("unauthorized_user.html"), 401 start = datetime.now() data_json = request.get_json() config = utils.config_parser() payload_data = {} payload_data['query'] = data_json.get('query') ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get(self):\n matches = Match.select()[:]\n\n if not matches:\n return 'No matches available!', 200\n\n result = { \"data\": [match.to_dict() for match in matches] }\n return result, 200", "def get_matched_data(self, flow):\n if self.is_activated_data_rules_contains_request_data:\n ...
[ "0.7862966", "0.6228477", "0.61065316", "0.6047621", "0.60210323", "0.6005613", "0.59666187", "0.5954562", "0.5954562", "0.5943147", "0.5907019", "0.5886982", "0.5866357", "0.58358437", "0.5776767", "0.5776767", "0.5772744", "0.5770831", "0.5766851", "0.57346314", "0.57239586...
0.0
-1
This endpoint connects to redis server and gets the matched keywords
def suggest(is_authenticated, is_authorized): if not is_authorized: return render_template("unauthorized_user.html"), 401 data_json = request.get_json() payload_data = {} payload_data['query'] = data_json.get('query') for field in payload_data: response_msg = check_field_validatio...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def search(tcp, data):\n\n # send SEARCH keyword to server and print results\n tcp.sendMessage('SEARCH ' + data[0])\n print tcp.receiveMessage()", "def query(self, key: int, *args, **kwargs) -> Optional[bytes]:\n result = []\n\n with self.get_add_handler() as redis_handler:\n for _key...
[ "0.58292973", "0.5697416", "0.5663478", "0.5642598", "0.5598828", "0.5536215", "0.5508933", "0.5468474", "0.5466872", "0.5465162", "0.53629035", "0.53525054", "0.5346393", "0.53394216", "0.53375626", "0.5337224", "0.53328866", "0.5328069", "0.5277627", "0.5260911", "0.5240561...
0.59811133
0
This endpoint will be used to insert the documents in the elastic search. This endpoint needs an input as path.
def index_corpus(is_authenticated, is_authorized): if not is_authorized: return render_template("unauthorized_user.html"), 401 try: thread1 = threading.Thread(target=index_keyword_updater.update) thread1.start() resp = Response(json.dumps({'status':'Ingest corpus started'}), sta...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def insert(input_json): \n client, index_name = connection_es()\n datetime_ = datetime.datetime.now().strftime(\"%Y.%m.%d_%H:%M:%S\")\n fs_metadata_name = index_name+datetime_\n res = client.index(index = fs_metadata_name, doc_type = 'nvisnx', body = input_json)\n return res", "def post(body):\...
[ "0.66307104", "0.6559178", "0.62823325", "0.6236056", "0.6130883", "0.6071537", "0.58949244", "0.58607024", "0.5841428", "0.5813002", "0.5754202", "0.57106304", "0.56878096", "0.55863255", "0.55847394", "0.5578154", "0.5560309", "0.55575716", "0.5556969", "0.5555463", "0.5549...
0.0
-1
This endpoint will be used to insert the specified documents in the elastic search. This endpoint needs an input as comma separated list of relative egnyte file path.
def ingest_files(is_authenticated, is_authorized): if not is_authorized: return render_template("unauthorized_user.html"), 401 data_json = request.get_json() payload_data = {} payload_data['egnyte_uploaded_files'] = data_json.get('egnyte_uploaded_files') for field in payload_data: r...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def bulk_push_to_elastic(elastic_search_url, index, docs):\n CREATE_TEMPLATE = {\"create\": {\"_index\": index, \"_type\": \"_doc\", \"_id\": \"\"}}\n\n bulk_request_body = \"\"\n for doc in docs:\n CREATE_TEMPLATE[\"create\"][\"_id\"] = doc[HASH_ID]\n bulk_request_body += json.dumps(CREATE_...
[ "0.6405247", "0.6349397", "0.6217392", "0.60723656", "0.6061014", "0.59498495", "0.5936006", "0.5913759", "0.5880672", "0.5875658", "0.58533245", "0.58466685", "0.58335674", "0.5832544", "0.58174014", "0.5801218", "0.57660764", "0.57576966", "0.5694868", "0.5691784", "0.56790...
0.55003095
33
Returns the full path where to download the file creating the necessary directories.
def _get_station_filename(): output_dir = os.path.join(output, state, station) if not os.path.isdir(output_dir): logger.debug("Creating directory %s", output_dir) os.makedirs(output_dir) return os.path.join(output_dir, "%s.%s" % (c_time, format))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def download_path(self) -> str:\n return self._download_path", "def download_dir(self) -> str:\n return self._download_dir", "def _get_download_dir(self):\n return self.manager.download_dir", "def _get_download_dir(self):\n return self.data['info']['root_downloads_dir']", "def g...
[ "0.7617928", "0.7588386", "0.74501324", "0.7374461", "0.70665056", "0.6962773", "0.6952165", "0.6927898", "0.69233745", "0.69048804", "0.68439454", "0.6763743", "0.6763743", "0.6712763", "0.6686853", "0.66732055", "0.66678554", "0.6658332", "0.66426486", "0.66111445", "0.6552...
0.0
-1
I subtract b from a and return the result
def subtractor(a,b): return a-b # i output a value by using the return statement
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def subtract(a, b):\n return a - b", "def subtract(a, b):\n return a - b", "def sub(self, a, b):\n return a - b", "def subtraction(a, b):\n return a - b", "def subtraction(self, a, b):\n if not check_arguments(a, b): # check if arguments are numbers\n self.last_result = a...
[ "0.8355271", "0.8355271", "0.8223993", "0.81965727", "0.817745", "0.81305796", "0.79816806", "0.78315383", "0.78311956", "0.7750077", "0.7742857", "0.7667645", "0.7667645", "0.7667645", "0.7615763", "0.7596306", "0.75700676", "0.7519295", "0.74694043", "0.73828113", "0.738281...
0.7668196
11
I divide a by b and return the result
def divisor (a,b): return a/b #i output a value by using the return statement
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def div(a,b):\r\n return a/b", "def divide(a, b):\n return a / b", "def division(a, b):\n if b != 0:\n return a//b", "def get_divide_ab(a, b): # IN= 2'int' / OUT= 1'foat'\n return float(a/b)", "def div(a, b):\n a = float(a)\n b = float(b)\n return a / b", "def Div(a, ...
[ "0.86562824", "0.861235", "0.8494464", "0.8460207", "0.84143704", "0.84032947", "0.8383728", "0.8352077", "0.8323875", "0.8181596", "0.8138509", "0.8115373", "0.8074413", "0.8069347", "0.8068661", "0.8011315", "0.79993355", "0.7971207", "0.7959612", "0.7921511", "0.7862788", ...
0.7956811
19
Asks the player to enter a valid choice
def player_turn(self): if self.turn == "x": player_name = self.player_1 else: player_name = self.player_2 player_choice = input(f"{player_name}, pick an open box to put an {self.turn} by entering the column, 'a', 'b'," f" or 'c' and the cell...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_option(allowed_options):\n\n choice = input(\"Enter a choice: \")\n\n while choice not in allowed_options:\n choice = input(\"Invalid. Try again? \")\n\n assert choice in allowed_options\n return choice", "def player_choice(text):\n try:\n action_choice = input(text)\n ...
[ "0.7194181", "0.7153731", "0.7088755", "0.7021447", "0.695129", "0.6937681", "0.69151866", "0.6909988", "0.68647224", "0.68492573", "0.6813575", "0.6806612", "0.67945564", "0.67458385", "0.67190284", "0.67184615", "0.6701124", "0.6700365", "0.66852254", "0.6681538", "0.666993...
0.63771653
53
Checks rows, columns and diagonals for a winner and returns player name if winner found
def check_winner(self): for row in self.board.values(): if all([mark == "x" for mark in row]): return self.player_1 elif all([mark == "o" for mark in row]): return self.player_2 # checks every column for i in range(3): first_ro...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def winner_found(self):\n\n first_row = self.find_three_in_row([self._board[0][0], self._board[0][1], self._board[0][2]])\n second_row = self.find_three_in_row([self._board[1][0], self._board[1][1], self._board[1][2]])\n third_row = self.find_three_in_row([self._board[2][0], self._board[2][1],...
[ "0.7850276", "0.7844686", "0.78040963", "0.77991927", "0.7786862", "0.7772859", "0.7772767", "0.775103", "0.77378315", "0.77017176", "0.769776", "0.7691695", "0.76738596", "0.7589716", "0.7542575", "0.7541765", "0.7540349", "0.753474", "0.75276124", "0.7417552", "0.74025553",...
0.8051105
0
If the input is unicode, it will be converted to utf8 encoded bytes; others will be returned to original way.
def to_bytes(data): if isinstance(data, unicode): return data.encode('utf-8') else: return data
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def force_utf8(text):\n if isinstance(text, binary_type):\n return text\n else:\n return text.encode('utf-8')", "def unicode2utf8(arg):\n\n try:\n if isinstance(arg, unicode):\n return arg.encode('utf-8')\n except NameError:\n pass # Python 3\n return arg", ...
[ "0.72585714", "0.7057726", "0.705013", "0.70202917", "0.69109493", "0.68745905", "0.6828343", "0.6787694", "0.6770514", "0.6762633", "0.6759491", "0.67589563", "0.6746645", "0.6735249", "0.6671572", "0.66674966", "0.66594577", "0.66577935", "0.6628185", "0.6556121", "0.653581...
0.6503458
23
Convert input to str object
def to_string(data): return to_bytes(data)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def convert_to_str(input_string):\n\n if sys.version < '3':\n\n if isinstance(input_string, str) \\\n or isinstance(input_string, unicode): # pragma: no cover py3\n\n return input_string # pragma: no cover py3\n\n else:\n\n if isinstance(input_string, str): # pragma...
[ "0.72751254", "0.7200921", "0.7122549", "0.70270336", "0.6898368", "0.68964654", "0.6890061", "0.6829235", "0.68084615", "0.6798918", "0.67820257", "0.6757715", "0.6690605", "0.6590487", "0.65460414", "0.6543309", "0.6530057", "0.6511816", "0.6509681", "0.64587384", "0.641334...
0.5901373
91
Convert the input to unicode, input is required to be unicode or utf8 encoded bytes.
def to_unicode(data): if isinstance(data, bytes): return data.decode('utf-8') else: return data
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_unicode(value):\r\n if isinstance(value, _TO_UNICODE_TYPES):\r\n return value\r\n if not isinstance(value, bytes_type):\r\n raise TypeError(\r\n \"Expected bytes, unicode, or None; got %r\" % type(value)\r\n )\r\n return value.decode(\"utf-8\")", "def utf8tounicode...
[ "0.7793887", "0.77113724", "0.75553405", "0.7408156", "0.7390316", "0.7390316", "0.738984", "0.736352", "0.73187596", "0.72773427", "0.7253526", "0.7247552", "0.7231445", "0.71971655", "0.71865135", "0.7123094", "0.7112982", "0.70650494", "0.703904", "0.703389", "0.70170397",...
0.75615406
2
If the string subobject in the input object is unicode encoded, it is converted to a byte of utf8; the other is returned as it is.
def stringify(input): if isinstance(input, dict): return dict([(stringify(key), stringify(value)) for key, value in input.iteritems()]) elif isinstance(input, list): return [stringify(element) for element in input] elif isinstance(input, unicode): return input...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _to_unicode(obj, encoding=\"UTF-8\"):\n if isinstance(obj, basestring):\n if not isinstance(obj, unicode):\n obj = unicode(obj, encoding)\n return obj", "def as_utf8(value):\n assert value is None or isinstance(value,types.StringTypes)\n if isinstance(value,types.UnicodeType):\n...
[ "0.70804787", "0.7054887", "0.70273423", "0.70273423", "0.70273423", "0.70273423", "0.70273423", "0.70273423", "0.69450444", "0.6890117", "0.6826282", "0.67923164", "0.6772603", "0.6772084", "0.6770586", "0.67700917", "0.67441547", "0.6667456", "0.66381395", "0.66276354", "0....
0.0
-1
If the input is str (ie unicode), it will be converted to utf8 encoded bytes; others will return as they are.
def to_bytes(data): if isinstance(data, str): return data.encode(encoding='utf-8') else: return data
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def give_me_bytes(string):\n return string.encode('utf8') if isinstance(string, str) else string", "def as_utf8(value):\n assert value is None or isinstance(value,types.StringTypes)\n if isinstance(value,types.UnicodeType):\n return value.encode('utf-8')\n else:\n return value", "def ...
[ "0.7504459", "0.7472167", "0.7422524", "0.7396655", "0.73131263", "0.7242583", "0.7220387", "0.7214761", "0.7203917", "0.71764106", "0.7152591", "0.7113217", "0.70409924", "0.6968084", "0.69579387", "0.6933949", "0.69033337", "0.6884524", "0.68819547", "0.68632", "0.68306863"...
0.6585055
42
If the input is bytes, it is considered to be utf8 encoding, and returns str
def to_string(data): if isinstance(data, bytes): return data.decode('utf-8') else: return data
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def utf8(value):\r\n if isinstance(value, _UTF8_TYPES):\r\n return value\r\n elif isinstance(value, unicode_type):\r\n return value.encode(\"utf-8\")\r\n else:\r\n return str(value)", "def _encode_to_utf8(s):\n return s.encode('utf-8')", "def utf8(value):\r\n if isinstance(v...
[ "0.76432323", "0.76154476", "0.7567259", "0.75092566", "0.7471273", "0.74313176", "0.7378342", "0.73617756", "0.73536265", "0.7344269", "0.7342175", "0.73386896", "0.7317219", "0.7298769", "0.7298769", "0.72802126", "0.72549284", "0.7251981", "0.7217084", "0.72070533", "0.718...
0.68467027
37
Convert the input to unicode, input is required to be unicode or utf8 encoded bytes.
def to_unicode(data): return to_string(data)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_unicode(value):\r\n if isinstance(value, _TO_UNICODE_TYPES):\r\n return value\r\n if not isinstance(value, bytes_type):\r\n raise TypeError(\r\n \"Expected bytes, unicode, or None; got %r\" % type(value)\r\n )\r\n return value.decode(\"utf-8\")", "def utf8tounicode...
[ "0.7793887", "0.77113724", "0.75615406", "0.75553405", "0.7408156", "0.7390316", "0.7390316", "0.738984", "0.736352", "0.73187596", "0.72773427", "0.7253526", "0.7247552", "0.7231445", "0.71971655", "0.71865135", "0.7123094", "0.7112982", "0.70650494", "0.703904", "0.703389",...
0.68372756
34
Convert to prediction, combining entries that belong to multiple conll ids
def to_full_prediction_merged(self, tensor, fill): result = self.to_full_prediction(tensor, fill) merged_result = [] for sentence, ids, labels \ in zip(result, self.conll_ids, self.conll_labels): try: max_id = len(labels) except IndexError:...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _reformat_predictions(self,\n y_true: List[List[int]],\n y_pred: List[List[int]],\n input_ids: List[List[str]]\n ) -> Tuple[List[List[str]],\n List[List[st...
[ "0.6131339", "0.61290807", "0.60674053", "0.60674053", "0.58740234", "0.5842175", "0.5812585", "0.58105874", "0.5743837", "0.56046236", "0.5565723", "0.5557773", "0.5503556", "0.5502431", "0.5476751", "0.5468402", "0.54093605", "0.5401778", "0.53834724", "0.53806883", "0.5377...
0.5578792
10
Return list of strings with tokens combined according to the conll_ids.
def merged_tokens(self, i, tokenizer): out = [] counts = [] last_id = None tokens = tokenizer.convert_ids_to_tokens(self.token_ids[i].tolist()) for token, current_id in zip(tokens[1:-1], self.conll_ids[i]): if last_id == current_id.item(): if token.sta...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def convert_ids_to_tokens(self, tok_ids):\n result = []\n for tok in tok_ids:\n word = self.itos(tok)\n result.append(word)\n return result", "def convert_ids_to_tokens(self, ids):\n tokens = []\n for i in ids:\n tokens.append(self.ids_to_tokens...
[ "0.66199964", "0.6468824", "0.6340238", "0.623249", "0.61589926", "0.6137667", "0.61109114", "0.6054484", "0.60323775", "0.60165447", "0.6009443", "0.59576935", "0.5930871", "0.5900529", "0.5874406", "0.5858084", "0.5858084", "0.58328474", "0.5806652", "0.57909125", "0.576713...
0.603462
8
Returns the start state for the search problem.
def getStartState(self): util.raiseNotDefined()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getStartState(self):\n return self._start_loc", "def getStartState(self):\n\t\tutil.raiseNotDefined()", "def getStartState(self):\n\t\tutil.raiseNotDefined()", "def getStartState(self):\r\n\t\tutil.raiseNotDefined()", "def get_start_state(self):\n util.raiseNotDefined()", "def get_start...
[ "0.75840217", "0.7533028", "0.7533028", "0.7457706", "0.7429071", "0.7384781", "0.7342245", "0.7342245", "0.7342245", "0.7342245", "0.7342245", "0.7342245", "0.7342245", "0.7342245", "0.7342245", "0.7339077", "0.69931024", "0.6990535", "0.6884872", "0.6682311", "0.6666652", ...
0.74203616
40
Returns a sequence of moves that solves tinyMaze. For any other maze, the sequence of moves will be incorrect, so only use this for tinyMaze.
def tinyMazeSearch(problem): from game import Directions s = Directions.SOUTH w = Directions.WEST return [s, s, w, s, w, w, s, w]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def tinyMazeSearch(problem):\n from game import Directions\n s = Directions.SOUTH\n w = Directions.WEST\n n = Directions.NORTH\n\n return [s, s, n, s, w, s, w, w, s, w]", "def tinyMazeSearch(problem):\n from game import Directions\n\n s = Directions.SOUTH\n w = Directions.WEST\n retur...
[ "0.7176117", "0.71666056", "0.71489185", "0.7117483", "0.7117483", "0.7117483", "0.7104597", "0.7104597", "0.7104597", "0.7104597", "0.7104597", "0.7104597", "0.7104597", "0.71019185", "0.71019185", "0.71019185", "0.71019185", "0.71019185", "0.71019185", "0.71019185", "0.7101...
0.7096785
42
Search the deepest nodes in the search tree first. Your search algorithm needs to return a list of actions that reaches the goal. Make sure to implement a graph search algorithm. To get started, you might want to try some of these simple commands to
def depthFirstSearch(problem): "*** YOUR CODE HERE ***" util.raiseNotDefined()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def depthFirstSearch(problem):\n \"*** YOUR CODE HERE ***\"\n class Node:\n def __init__(self, state, parent, action, pathCost):\n self.state = state #state of the game\n self.parent = parent #parent of the node\n self.action = action #action that led to that node\n ...
[ "0.7514212", "0.7227323", "0.72050494", "0.71345645", "0.7111152", "0.7071466", "0.7005544", "0.6993732", "0.6985615", "0.69755584", "0.69137734", "0.69034725", "0.6887418", "0.6877962", "0.68774015", "0.6870302", "0.6825583", "0.6765508", "0.675797", "0.67508304", "0.6742589...
0.63844323
53
Search the shallowest nodes in the search tree first.
def breadthFirstSearch(problem): "*** YOUR CODE HERE ***" util.raiseNotDefined()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def depth_first_search(self):\r\n queue = [self.root]\r\n ordered = []\r\n while queue:\r\n node = queue.pop()\r\n ordered.append(node)\r\n queue.extend(node.children)\r\n \r\n while ordered:\r\n yield ordered.pop()", "def depth_first...
[ "0.69203365", "0.6734959", "0.659188", "0.65315974", "0.65235966", "0.6515641", "0.64349604", "0.63706106", "0.6349397", "0.63105273", "0.62683547", "0.62573814", "0.6188355", "0.61810166", "0.6174985", "0.60993695", "0.60754585", "0.6070981", "0.60292786", "0.6028391", "0.60...
0.0
-1
Search the node of least total cost first.
def uniformCostSearch(problem): "*** YOUR CODE HERE ***" util.raiseNotDefined()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _find_lowest_cost_node(self) -> str:\n lowest_cost = float(\"inf\")\n lowest_cost_node = None\n for node in self.costs:\n cost = self.costs[node]\n if cost < lowest_cost and node not in self.closed_nodes:\n lowest_cost = cost\n lowest_cos...
[ "0.7481386", "0.6694703", "0.6617916", "0.66044676", "0.65461653", "0.6504626", "0.64884573", "0.647909", "0.6447552", "0.6389625", "0.6388501", "0.63831747", "0.63667625", "0.63632995", "0.6247147", "0.62458867", "0.6236465", "0.62307185", "0.6224366", "0.6224366", "0.620009...
0.56800514
69
A heuristic function estimates the cost from the current state to the nearest goal in the provided SearchProblem. This heuristic is trivial.
def nullHeuristic(state, problem=None): return 0
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def uniformCostSearch(problem):\n # Initialization\n startState = problem.getStartState()\n\n if problem.isGoalState(startState):\n return [] # No action needed\n\n closedSet = set()\n queue = util.PriorityQueue()\n queue.push((startState, None, 0), 0)\n cameFrom = dict() # Stores most ...
[ "0.74263334", "0.7401543", "0.72895956", "0.72838056", "0.7258945", "0.7187053", "0.718194", "0.71579057", "0.7101961", "0.7080719", "0.70694226", "0.70437473", "0.7041541", "0.70369065", "0.7026071", "0.7017246", "0.70020163", "0.6997853", "0.69822514", "0.6965341", "0.69587...
0.0
-1
A heuristic function estimates the cost from the current state to the nearest goal in the provided SearchProblem. This heuristic is trivial.
def myHeuristic(state, problem=None): #print("myHeuristic") #print(problem.isGoalState((1,1))) xy2 = problem.goal return abs(state[0] - xy2[0]) + abs(state[1] - xy2[1])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def uniformCostSearch(problem):\n # Initialization\n startState = problem.getStartState()\n\n if problem.isGoalState(startState):\n return [] # No action needed\n\n closedSet = set()\n queue = util.PriorityQueue()\n queue.push((startState, None, 0), 0)\n cameFrom = dict() # Stores most ...
[ "0.7427332", "0.72896004", "0.7284291", "0.72579", "0.71861756", "0.7181096", "0.7158981", "0.7101936", "0.7081954", "0.7069965", "0.70446587", "0.7041991", "0.70378923", "0.7026378", "0.70171255", "0.7001647", "0.6998071", "0.69829196", "0.6965342", "0.6959571", "0.6958475",...
0.7400617
1
A heuristic function estimates the cost from the current state to the nearest goal in the provided SearchProblem. This heuristic is trivial.
def myHeuristic2(state, problem=None): #print("myHeuristic2") #print(problem.isGoalState((1,1))) xy2 = problem.goal return ( (state[0] - xy2[0]) ** 2 + (state[1] - xy2[1]) ** 2 ) ** 0.5
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def uniformCostSearch(problem):\n # Initialization\n startState = problem.getStartState()\n\n if problem.isGoalState(startState):\n return [] # No action needed\n\n closedSet = set()\n queue = util.PriorityQueue()\n queue.push((startState, None, 0), 0)\n cameFrom = dict() # Stores most ...
[ "0.74269426", "0.74015385", "0.72899383", "0.72837085", "0.72585464", "0.7187147", "0.7157567", "0.7102029", "0.7080077", "0.7069959", "0.70438606", "0.7041926", "0.7037639", "0.70259935", "0.7017", "0.7002094", "0.69986874", "0.69824964", "0.6965349", "0.69591075", "0.695815...
0.71819085
6
A heuristic function estimates the cost from the current state to the nearest goal in the provided SearchProblem. This heuristic is trivial.
def myHeuristic3(state, problem=None): #canto =[(1,1), (1,2), (2,1), (2,2), (36,36), (35,36), (35,35), (36,35), (1,36),(1,35),(2,36),(2,35),(36,1),(36,2),(35,1),(35,2)] canto = [] for l in range(2): for c in range(2): canto.append((l,c)) heru = abs(state[0] - 1) + abs(state[1] - 1) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def uniformCostSearch(problem):\n # Initialization\n startState = problem.getStartState()\n\n if problem.isGoalState(startState):\n return [] # No action needed\n\n closedSet = set()\n queue = util.PriorityQueue()\n queue.push((startState, None, 0), 0)\n cameFrom = dict() # Stores most ...
[ "0.7427799", "0.74015236", "0.7290393", "0.7284833", "0.72575444", "0.7186404", "0.718217", "0.7158862", "0.71004665", "0.7080881", "0.7068445", "0.70454955", "0.7043179", "0.7036047", "0.7025068", "0.7015509", "0.70004034", "0.6998868", "0.6981003", "0.69639426", "0.6960016"...
0.0
-1
Search the node that has the lowest combined cost and heuristic first.
def aStarSearch(problem, heuristic=myHeuristic): #frontier = util.PriorityQueue() #startState = problem.getStartState() #startNode = (startState, ['East'], 0) #frontier.push(startNode, 0) #currentState, actions, currentCost = frontier.pop() #return ['West','West', 'West','West','South','South'...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _find_lowest_cost_node(self) -> str:\n lowest_cost = float(\"inf\")\n lowest_cost_node = None\n for node in self.costs:\n cost = self.costs[node]\n if cost < lowest_cost and node not in self.closed_nodes:\n lowest_cost = cost\n lowest_cos...
[ "0.7490412", "0.729986", "0.71320164", "0.69334143", "0.6902337", "0.68997335", "0.68794054", "0.6843608", "0.68071157", "0.6789481", "0.67846143", "0.6755595", "0.67428833", "0.66356206", "0.6634861", "0.66248906", "0.6619309", "0.6590115", "0.65720975", "0.65501213", "0.653...
0.61913544
70
Arranges for a program to run as if in an xterm. The program is not run directly within the xterm, but with its input and output redirected to the xterm. The `name` specifies the term to use, which may already be running.
def get_xterm(name, geom="80x30+0+0"): if name in _terminals: p, (files, stdin, stdout, stderr) = _terminals[name] else: p, files = start_display_xterm(name, geom) stdin = open(files[0]) stdout = open(files[1], "w") stderr = open(files[2], "w") _terminals[name] = ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def run_in_xterm(name, cmd, geom=\"80x30+0+0\", cwd=None,\n useStdin=False):\n p, (files, stdin, stdout, stderr) = get_xterm(name, geom)\n if useStdin:\n stdin = subprocess.PIPE\n args = (cmd,) + files\n p = _run(args=\"exec %s\" % cmd, shell=True, stdin=stdin, std...
[ "0.72731894", "0.6425588", "0.6072298", "0.59669644", "0.54634476", "0.5459218", "0.53708595", "0.53413415", "0.5335392", "0.5267892", "0.52526206", "0.5241784", "0.51542586", "0.5081368", "0.50617504", "0.4828752", "0.48046297", "0.4778131", "0.47717136", "0.47596747", "0.47...
0.6771185
1
Start a process within a terminal. This starts a separate process so that its output and appears in a separate terminal. If necessary an Xterm will be started, but if the `name` refers to an Xterm that ProcMan has already started then that terminal is reused.
def run_in_xterm(name, cmd, geom="80x30+0+0", cwd=None, useStdin=False): p, (files, stdin, stdout, stderr) = get_xterm(name, geom) if useStdin: stdin = subprocess.PIPE args = (cmd,) + files p = _run(args="exec %s" % cmd, shell=True, stdin=stdin, stdout=stdout, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def start_display_xterm(title, geom=\"120x50+0+0\"):\n # Run sleep as the xterm's process rather than the normal shell.\n # NOTE: Anything that last for more than 10 days will break ;)\n p = subprocess.Popen(args=(\"xterm\",\n \"-T\", title,\n \"-geometry\", geom,\n # \"-l\", \"-lf\",...
[ "0.6421115", "0.6323413", "0.6249955", "0.6134532", "0.6110877", "0.6107632", "0.6044274", "0.59998924", "0.5938184", "0.5780604", "0.5651973", "0.5432514", "0.5416875", "0.5406733", "0.5402068", "0.540136", "0.5381226", "0.5286359", "0.5259668", "0.52372444", "0.52203286", ...
0.65523607
0
Stops all processes that have been started using run_in_xterm.
def stopProcesses(*args): _stopProcessSet(_running)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _stopTerminals(*args):\n procSet = [p for p, x in _terminals.values()]\n _stopProcessSet(procSet)\n _terminals.clear()", "def stop(self):\n for process in self.process:\n process.stop()", "def term():\n curses.endwin()\n unicornhathd.off()", "def kill_all(self):\n ...
[ "0.7222768", "0.6800035", "0.6690746", "0.65433234", "0.64757663", "0.6451818", "0.64330614", "0.642858", "0.6261095", "0.615764", "0.613418", "0.60446024", "0.60445046", "0.60445046", "0.6037355", "0.6024075", "0.60186803", "0.5981608", "0.597272", "0.5966531", "0.5953299", ...
0.63606554
8
Starts an Xterm that can be used for redirection. The approach that we use is to run an XTerm with 'sleep 10d' as the program it should execute (i.e. we give it 'e sleep 10d'. This means that there should be a ``/usr/bin/sleep`` running as the child of the XTerm, which will have its STDIN, STDOUT and STDERR attaced to ...
def start_display_xterm(title, geom="120x50+0+0"): # Run sleep as the xterm's process rather than the normal shell. # NOTE: Anything that last for more than 10 days will break ;) p = subprocess.Popen(args=("xterm", "-T", title, "-geometry", geom, # "-l", "-lf", "%s.log" % (title.repl...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def on_xTerm(self):\n path = os.path.normpath(self.pXterm)\n os.system('start \"Toto\" /d \"%s\"' % path)", "def run_in_xterm(name, cmd, geom=\"80x30+0+0\", cwd=None,\n useStdin=False):\n p, (files, stdin, stdout, stderr) = get_xterm(name, geom)\n if useStdin:\n ...
[ "0.6997668", "0.6861239", "0.6433669", "0.6050429", "0.59457225", "0.58234394", "0.57922614", "0.5637698", "0.5502042", "0.5352155", "0.53459644", "0.5345631", "0.52963144", "0.52610123", "0.5218999", "0.5180862", "0.5136395", "0.51340973", "0.5131129", "0.51257503", "0.50877...
0.7804727
0
Stop all the processes that are in the `procSet`. First any still running processes are sent SIGTERM then, if still running after 3 seconds, a SIGKILL is delivered.
def _stopProcessSet(procSet): # Send a SIGTERM to all (still running) processes. finished = {} needToWait = False for i, p in enumerate(procSet): if p.poll() is not None: finished[p] = None continue needToWait = True try: if platformType == "w...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def kill_processes(self):\n for proc in self.processes:\n if proc['proc'].poll() is not None:\n proc['proc'].terminate()", "def stopProcesses(*args):\n _stopProcessSet(_running)", "def stop(self):\n for process in self.process:\n process.stop()", "def sto...
[ "0.760437", "0.7129253", "0.71260667", "0.7077345", "0.69477403", "0.6945782", "0.6783743", "0.67598736", "0.6745251", "0.6736421", "0.6736421", "0.66943616", "0.66538376", "0.66531056", "0.66427165", "0.6602587", "0.65193135", "0.6468882", "0.64296544", "0.642096", "0.640845...
0.8264156
0
Stops all the currently running xterms.
def _stopTerminals(*args): procSet = [p for p, x in _terminals.values()] _stopProcessSet(procSet) _terminals.clear()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def stop_all():\n\twhile _running:\n\t\t_running[0].stop(noerror=True)", "def terminate_all(self):\n self._stop_all('terminate')", "def kill_all(self):\n self._stop_all('kill')", "def _stop_all(self):\n # LEDs\n self.cam_led.off\n self.analysis_led[0].off\n self.anal...
[ "0.72247905", "0.72110677", "0.6950174", "0.6901465", "0.6833289", "0.67772776", "0.6776221", "0.6760797", "0.6682366", "0.6650142", "0.6629993", "0.6579462", "0.6570818", "0.6566609", "0.6549168", "0.6538018", "0.64766616", "0.6470131", "0.64662087", "0.6454953", "0.6424395"...
0.6633377
10
An alternative to os.system that runs in a new process group This uses the subprocess module to run a command in a similar manner to os.system, but the subprocess runs in its own process group. There are
def system_grp(cmd): p = subprocess.Popen(cmd, shell=True, preexec_fn=lambda:os.setpgrp()) try: return os.waitpid(p.pid, 0) finally: _killGrp(p)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def spawn(*command: Strings, **resources: int) -> None:\n current = Invocation.current\n\n def _run_exec(parts: List[str]) -> Awaitable:\n return asyncio.create_subprocess_exec(*parts, stdout=asyncio.subprocess.PIPE, stderr=asyncio.subprocess.PIPE)\n\n await current.done(current.run_action(\"...
[ "0.6302876", "0.6268063", "0.6222188", "0.62070966", "0.61652493", "0.61190146", "0.6034322", "0.6029597", "0.60274696", "0.59873176", "0.597094", "0.5961691", "0.5948557", "0.5945869", "0.5926003", "0.5890027", "0.5826783", "0.58263457", "0.5808363", "0.5808363", "0.5808363"...
0.6964251
0
run tracker, return bounding result and speed
def run_tracker(p): # load model net = torch.load(os.path.join(p.net_base_path, p.net)) net = net.to(device) # evaluation mode net.eval() # load sequence img_list, target_position, target_size = load_sequence(p.seq_base_path, p.video) # first frame img_uint8 = cv2.imread(img_list[...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def tracking(self) -> None:\n dist, delta_angle, timestamp = self.vision.get_vision_data()\n # collect data only once per loop\n if timestamp is None:\n # self.next_state(\"searching\")\n # print(f\"tracking -> searching {self.vision.get_vision_data()}\")\n sel...
[ "0.5958332", "0.5941803", "0.5772376", "0.5717255", "0.5667418", "0.5642824", "0.5603686", "0.5562891", "0.5536074", "0.5523343", "0.5458954", "0.5458954", "0.5441691", "0.5441144", "0.54259014", "0.5425104", "0.5414455", "0.54104364", "0.53977853", "0.5386665", "0.53558975",...
0.5071052
57
Converts a string into all lowercase
def lower(value): # Only one argument. return value.lower()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def lowercase(str):\n \n return str.lower()", "def lowercase(string):\n\n return str(string).lower()", "def filter_lowercase(self, string):\n newstring = string.lower()\n return newstring", "def lowercase(s):\n ls = \"\"\n for c in s:\n if c in string.ascii_uppercase:\n ...
[ "0.8448203", "0.82843536", "0.8245768", "0.8052874", "0.7945869", "0.7915361", "0.7820438", "0.77656955", "0.7739656", "0.76565814", "0.7640426", "0.7617962", "0.7511215", "0.74629986", "0.73779565", "0.73143524", "0.72820365", "0.7247467", "0.72200024", "0.72177523", "0.7110...
0.6984823
31
Create the list of products by finding the link of each product page
def _subpage_crawler(self): while True: try: family = self.product_families.pop() except IndexError: break with closing(urlopen(self.base_url + family)) as product_list_page: product_list_soup = BeautifulSoup(product_list_page, 'html.parser') product_list = product_list_soup.find('ul', class...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _scrape_product_links(self, response):\n\n items = response.xpath(\n '//ul[@id=\"prod-list\"]/li[contains(@class, \"product-list-item\")]'\n )\n\n if items:\n for item in items:\n link = is_empty(\n item.xpath('./span[@class=\"product...
[ "0.7489459", "0.7178447", "0.7158751", "0.7106569", "0.7037473", "0.69986695", "0.6930341", "0.689953", "0.6877997", "0.68156356", "0.6773051", "0.6744286", "0.6728577", "0.67268896", "0.6710279", "0.6702772", "0.6680659", "0.66799915", "0.6646794", "0.6635357", "0.66300076",...
0.6519097
23
Nodes have to be sorted in reverse order
def _DFS_loop(nodes, edges, t_n=None): if t_n is not None: n_t = dict((b,a) for a,b in t_n.items()) # {time: node} get_node_by_time = lambda time: time if t_n is None else n_t[time] get_time_by_node = lambda node: node if t_n is None else t_n[node] gen_edges = lambda node: map(get_time_by_node,...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reverse(self): # Class O(nlog2n)\r\n # I'm assuming this classification because this function\r\n # calls removeNode() and addNodeAfter()\r\n listvalues = \"%s\" % self.head\r\n h = self.head\r\n l = self.length()\r\n count = 0\r\n while count <= l:\r\n ...
[ "0.719796", "0.70448", "0.68519765", "0.66853374", "0.66853184", "0.65238416", "0.65163136", "0.6481715", "0.64751273", "0.64530593", "0.6439442", "0.6439366", "0.64234287", "0.6385281", "0.63593477", "0.63563514", "0.63504976", "0.6333715", "0.6322531", "0.6317217", "0.62864...
0.0
-1
Encode text to vector
def encode(self, text): text = unicodedata.normalize("NFKD", text).encode("ASCII", "ignore").decode("ASCII") text = " ".join(text.split()) groups = ["".join(group) for _, group in groupby(text)] text = "".join([self.UNK_TK.join(list(x)) if len(x) > 1 else x for x in groups]) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def encode(self, text):", "def vectorize_texts(self, encoder) -> NoReturn:\n self.encoder = encoder\n self.vectorized_texts = [self.encoder.encode(t) for t in self.tokenized_texts]", "def encode_text(self, text):\n text = clip.tokenize(text).to(self.device)\n text_features = self.cl...
[ "0.7328312", "0.6938278", "0.6600379", "0.6515598", "0.6455898", "0.63648427", "0.6327088", "0.630752", "0.62285024", "0.6219736", "0.6215387", "0.62046796", "0.62046796", "0.6187914", "0.61590433", "0.61040735", "0.60860777", "0.6063937", "0.6033152", "0.59849155", "0.597556...
0.5944885
24
Decode vector to text
def decode(self, text): decoded = "".join([self.chars[int(x)] for x in text if x > -1]) decoded = self.remove_tokens(decoded) decoded = pp.text_standardize(decoded) return decoded
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def vec2txt(self, vector: List[int]) -> str:\n tokens = [self._index_lookup(idx) for idx in vector]\n text = self.bpe.decode(tokens)\n return text", "def decode_vector(vector, charset):\n return \"\".join(charset[x] for x in vector)", "def decode(self, toks_vec):\n toks = []\n ...
[ "0.8203244", "0.7664987", "0.71442807", "0.64030087", "0.6352809", "0.63438", "0.63438", "0.6332403", "0.6078708", "0.5987371", "0.5973672", "0.59597003", "0.58955765", "0.5894924", "0.5885879", "0.5874574", "0.58274615", "0.5822148", "0.577595", "0.5754771", "0.57035786", ...
0.5475898
38
Remove tokens (PAD) from text
def remove_tokens(self, text): return text.replace(self.PAD_TK, "").replace(self.UNK_TK, "")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove_punct(self,text):", "def pad_punctuation(text):\n\n text = re.sub(r\"([!\\\"#$%&\\'()*+,-./:;<=>?@\\[\\\\\\]^_`{|}~])\", r\" \\1 \", text)\n text = re.sub(r\"\\s{2,}\", \" \", text)\n return re.sub(r\"(<)\\s(\\w+)\\s(/)\\s(>)\", r\"\\1\\2\\3\\4\", text, re.I | re.M) # keep special tokens int...
[ "0.7152915", "0.6991101", "0.6867556", "0.6745236", "0.6733392", "0.6723463", "0.6695939", "0.66440445", "0.66368353", "0.6634762", "0.6600727", "0.6578465", "0.65717447", "0.6557954", "0.6538209", "0.65295035", "0.65250766", "0.65060663", "0.6466262", "0.643882", "0.643882",...
0.8181711
0
Allow the editors and users group to view the workstation.
def assign_workstation_permissions(self): perm = f"view_{Workstation._meta.model_name}" for group in [self.users_group, self.editors_group]: workstations = get_objects_for_group( group=group, perms=perm, klass=Workstation ) if ( self....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def can_display(self, course, settings, is_user_authenticated, is_user_staff): # pylint: disable=unused-argument\r\n return True", "def enableWorkspace(self):\n # enable tabs\n for tabId in xrange( self.tab.count() ):\n doc = self.tab.widget(tabId)\n doc.setEnabled(Tru...
[ "0.58589333", "0.56498307", "0.5620146", "0.5602444", "0.55552506", "0.5548771", "0.55228484", "0.5475922", "0.5473233", "0.5449073", "0.543679", "0.54311645", "0.54066074", "0.54066074", "0.53920794", "0.5369299", "0.5365513", "0.53626275", "0.53398925", "0.53253734", "0.530...
0.70389026
0
Returns The most recent container image for this algorithm
def latest_ready_image(self): return ( self.algorithm_container_images.filter(ready=True) .order_by("-created") .first() )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_latest_image():\n return sqldb.get_latest_image()", "def get_oldest_image():\n return sqldb.get_oldest_image()", "def most_recent_image(self, shape):\n size = np.array(shape).prod()\n arr = np.ascontiguousarray(np.zeros(size, dtype=np.int32))\n self.lib.GetMostRecentImage(arr...
[ "0.7029266", "0.6995048", "0.69461316", "0.69450504", "0.6870035", "0.6715748", "0.6448968", "0.6362757", "0.6305601", "0.62002623", "0.6162885", "0.61494726", "0.6136684", "0.61160696", "0.6103054", "0.6093062", "0.6027537", "0.59714675", "0.59640044", "0.595704", "0.594172"...
0.7893187
0
Returns the default workstation, creating it if it does not already exist.
def default_workstation(self): w, created = Workstation.objects.get_or_create( slug=settings.DEFAULT_WORKSTATION_SLUG ) if created: w.title = settings.DEFAULT_WORKSTATION_SLUG w.save() return w
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def default():\n return DefaultSwh.default()", "def GetDefaultWiredNetwork(self):\n config = ConfigParser.ConfigParser()\n config.read(self.wired_conf)\n profileList = config.sections()\n for profile in profileList:\n if config.has_option(profile, \"default\"):\n ...
[ "0.64564544", "0.6380634", "0.6099718", "0.5942832", "0.5869021", "0.58102024", "0.5772783", "0.5761062", "0.57277817", "0.56636065", "0.5655392", "0.56540525", "0.5607993", "0.56071055", "0.5588896", "0.5576455", "0.5570802", "0.55385363", "0.5522304", "0.55080473", "0.54978...
0.8310973
0
Deletes the related groups. We use a signal rather than overriding delete() to catch usages of bulk_delete.
def delete_algorithm_groups_hook(*_, instance: Algorithm, using, **__): try: instance.editors_group.delete(using=using) except ObjectDoesNotExist: pass try: instance.users_group.delete(using=using) except ObjectDoesNotExist: pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def on_groups_deleted(event):\n permission_backend = event.request.registry.permission\n\n for change in event.impacted_objects:\n group = change[\"old\"]\n bucket_id = event.payload[\"bucket_id\"]\n group_uri = utils.instance_uri(event.request, \"group\", bucket_id=bucket_id, id=group[\...
[ "0.6811357", "0.6718679", "0.6654341", "0.6587503", "0.64869356", "0.6389104", "0.6375399", "0.62677145", "0.6255273", "0.62524956", "0.6236309", "0.6212224", "0.6174363", "0.61615455", "0.61507773", "0.61191946", "0.6117073", "0.6063971", "0.6019178", "0.6016682", "0.5996941...
0.60603523
18
Read all of the images in /output/ & convert to an UploadSession.
def _get_result(self): try: with cleanup( self._client.containers.run( image=self._io_image, volumes={ self._output_volume: {"bind": "/output/", "mode": "ro"} }, name=f"{self._job_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_images(self):\n raw_outputs = self.interface.get_data(self.target_charge,\n self.charge_deviation,\n n_samples=self.n_samples)\n\n # apply roi to images\n roi_images = []\n for i in range(...
[ "0.59588146", "0.57884127", "0.56709373", "0.5668584", "0.5659985", "0.56490076", "0.56277287", "0.56075525", "0.55613685", "0.5555012", "0.5552847", "0.5542271", "0.5541562", "0.55254954", "0.5512875", "0.5500142", "0.5478446", "0.5475795", "0.5475795", "0.5472628", "0.54663...
0.51777667
66
A list_display column containing a checkbox widget.
def action_checkbox(self, obj): if self.check_concurrent_action: return helpers.checkbox.render(helpers.ACTION_CHECKBOX_NAME, force_str("%s,%s" % (obj.pk, get_revision_of_object(obj)))) else: # pragma: no cover return super().action_che...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_list_display(self, request):\n list_display = []\n for field_name in self.list_display:\n try:\n db_field = self.model._meta.get_field(field_name)\n if isinstance(db_field, BooleanField):\n field_name = boolean_switch_field(db_field)...
[ "0.6194315", "0.5683853", "0.5649223", "0.56066346", "0.55812025", "0.5547091", "0.52968127", "0.52922386", "0.5250746", "0.523286", "0.52301085", "0.52169627", "0.51726454", "0.51695156", "0.51318824", "0.51318824", "0.5123294", "0.51006347", "0.50877786", "0.50861514", "0.5...
0.57720435
1
Handle an admin action. This is called if a request is POSTed to the changelist; it returns an HttpResponse if the action was handled, and None otherwise.
def response_action(self, request, queryset): # noqa # There can be multiple action forms on the page (at the top # and bottom of the change list, for example). Get the action # whose button was pushed. try: action_index = int(request.POST.get('index', 0)) except Val...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def callback(self, request):\n post = request.POST\n action = post.get(\"_action\")\n\n # call admin\n if hasattr(self, action):\n func, action, description = self.get_action(action)\n qs = self._get_queryset(request)\n r = func(self, request, qs)\n ...
[ "0.7257398", "0.66040426", "0.64806634", "0.60526055", "0.58881503", "0.58590096", "0.5845572", "0.5715907", "0.5675337", "0.5675337", "0.56600225", "0.55630153", "0.55397105", "0.55318725", "0.5484787", "0.5471801", "0.5429727", "0.5421682", "0.5388814", "0.53831667", "0.534...
0.6404771
3
Returns the ManagementForm instance for this FormSet.
def _management_form(self): if self.is_bound: form = ConcurrentManagementForm(self.data, auto_id=self.auto_id, prefix=self.prefix) if not form.is_valid(): raise ValidationError('ManagementForm data is missing or has been tampere...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def management_form(self):\n if self.is_bound:\n form = AttachmentManagementForm(self.data, auto_id=self.auto_id, prefix=self.prefix)\n if not form.is_valid():\n raise ValidationError('ManagementForm data is missing or has been tampered with')\n else:\n ...
[ "0.71396756", "0.66645527", "0.66645527", "0.63575435", "0.6231655", "0.62000716", "0.61292356", "0.6125592", "0.6120834", "0.6112439", "0.6102003", "0.60750073", "0.5939128", "0.5879666", "0.58429885", "0.57521427", "0.5715844", "0.56427836", "0.557819", "0.5555635", "0.5554...
0.7361751
0
Initialization of the path for saving visualisations.
def __init__(self, results_path): self.results_path = results_path
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save_path(self):\n raise NotImplementedError", "def save_path(self):\n raise NotImplementedError", "def save_plot(self):\r\n\t\t# Generate the plot\r\n\t\tself.generate_plot()\r\n\t\t# Create save directory\r\n\t\tdirectory = self.dir + '/%s/' % str(int(self.universe.init_time))\r\n\t\tif not...
[ "0.7197961", "0.7197961", "0.695531", "0.64456785", "0.6426191", "0.637794", "0.63402694", "0.632507", "0.63136494", "0.6188271", "0.6170486", "0.6160792", "0.6136995", "0.61136836", "0.6095165", "0.60882246", "0.60882246", "0.60882246", "0.6069207", "0.60661894", "0.60501814...
0.0
-1
Drawing the confusion matrix.
def draw_confusion_matrix(self, conf_arr, f_name): norm_conf = [] for i in conf_arr: a = 0 tmp_arr = [] a = sum(i, 0) for j in i: tmp_arr.append(float(j) / float(a)) norm_conf.append(tmp_arr) fig = plt.figure() ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def plot_confusion_matrix(self):\r\n interp = ClassificationInterpretation.from_learner(self.learn)\r\n interp.plot_confusion_matrix()", "def confusion_matrix(y_true, y_pred):\n skplt.plot_confusion_matrix(y_true, y_pred, normalize=True)\n plt.show()", "def plot_cnf_matrix(y_pred, y...
[ "0.7814405", "0.7664193", "0.76362276", "0.76232296", "0.7399793", "0.7370499", "0.73578197", "0.73292273", "0.72847784", "0.72413075", "0.7235783", "0.7223383", "0.71827155", "0.71579397", "0.7134419", "0.71111244", "0.7068057", "0.7066812", "0.7065908", "0.7058013", "0.7056...
0.7019025
22
Training loop for Pytorch
def loop_train(data_loader, model, criterion, optimizer, epochs): losses = [] for epoch in range(epochs): for x, y in data_loader: yhat = model(x) loss = criterion(yhat, y) losses.append(loss.item()) optimizer.zero_grad() loss.backward() ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def train(self):\n\n # Ensure everything is sent to GPU if being trained on the cloud\n if self.local == False:\n torch.set_default_tensor_type(torch.cuda.FloatTensor)\n print(\"\\n \\n EVERYTHING TO CUDA \\n \\n\")\n\n # Load weights if applicable\n if self.load_w...
[ "0.750842", "0.73880816", "0.73750114", "0.7335384", "0.73146576", "0.7286139", "0.7251804", "0.7229235", "0.7229235", "0.7229235", "0.7229235", "0.7229235", "0.7226182", "0.7192378", "0.71854514", "0.7178638", "0.71759117", "0.7162442", "0.71451205", "0.71316934", "0.7119756...
0.0
-1
Return the rotation matrix associated with counterclockwise rotation about the given axis by theta radians.
def rotation_matrix(axis, theta): axis = np.asarray(axis) axis = axis / math.sqrt(np.dot(axis, axis)) a = math.cos(theta / 2.0) b, c, d = -axis * math.sin(theta / 2.0) aa, bb, cc, dd = a * a, b * b, c * c, d * d bc, ad, ac, ab, bd, cd = b * c, a * d, a * c, a * b, b * d, c * d return np.arra...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_rotation_matrix(axis, theta):\n axis = np.asarray(axis)\n axis = axis / math.sqrt(np.dot(axis, axis))\n a = math.cos(theta / 2.0)\n b, c, d = -axis * math.sin(theta / 2.0)\n aa, bb, cc, dd = a * a, b * b, c * c, d * d\n bc, ad, ac, ab, bd, cd = b * c, a * d, a * c, a * b, b * d, c * d\n ...
[ "0.7977438", "0.7962036", "0.7955048", "0.7778583", "0.77589536", "0.77123857", "0.7712289", "0.7705695", "0.7694338", "0.7689674", "0.76730025", "0.75680214", "0.7557322", "0.7438136", "0.73224056", "0.7304231", "0.7298034", "0.72914284", "0.7200381", "0.7190196", "0.7188644...
0.77155566
6
Load all of the parsable Arguments.
def run_parser(): parser = default_args.default_args() instance_id, instances_keys = core_args.instance_args() zone_id, zone_info = core_args.zone_args() conf_manager, config_info = core_args.coniguration_args() schematic_id, schematic_info = core_args.schematic_args() # Setup for the position...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _parse_args(self):\n parser = argparse.ArgumentParser()\n _, args = parser.parse_known_args()\n self.args = [a for a in args if a != '']", "def load( self, arguments = None ):\n\n # determine list of arguments to load\n if arguments is None:\n arguments = sys.arg...
[ "0.7037555", "0.684689", "0.65822035", "0.64684325", "0.641964", "0.6406422", "0.6367505", "0.63630414", "0.63580734", "0.6357089", "0.6335473", "0.63186294", "0.6316012", "0.63136137", "0.63122565", "0.6289517", "0.628351", "0.6267775", "0.62507814", "0.6249971", "0.6240977"...
0.0
-1
m is the number of data points nx is the number of features
def normalize(X, m, s): return ((X - m) / s)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def scale_features(features_nxm):\n # type: (list) -> list\n temp_mxn = [[], # 0 Aspect ratio\n [], # 1 Black pixel count\n [], # 2 Black pixel average inclination\n [], # 3 CentroidX\n [], # 4 CentroidY\n [], # 5 Centroid incli...
[ "0.62114626", "0.6119223", "0.61119616", "0.6102509", "0.6077221", "0.59839386", "0.5954769", "0.59307563", "0.5902289", "0.5896997", "0.58302236", "0.58028513", "0.5790355", "0.578134", "0.577109", "0.57694376", "0.5766266", "0.57536215", "0.5746482", "0.57091147", "0.569587...
0.0
-1
Desirializing of nonuuid formatted value should raise an error.
def test_invlalid_uuid_load(): schema = UUIDSchema() result = schema.load({ "uuid_str": INVALID_UUID_STR, "uuid_uuid": UUID(UUID_STR), }) assert_that(result.errors["uuid_str"], contains('Not a valid UUID.'))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def validate_uuid(value: Any, none_allowed: bool, display_name: str) -> None:\n if none_allowed and value is None:\n return\n\n if not isinstance(value, UUID) or value.version != 4:\n raise TypeError(f\"{display_name} must be a UUID version 4\")", "def validateUuid(sValue, aoNilValues = tuple...
[ "0.68983275", "0.66873175", "0.65473825", "0.65364915", "0.64650166", "0.6401455", "0.6399042", "0.6303111", "0.62995964", "0.6214849", "0.62138045", "0.60851914", "0.6074883", "0.6074883", "0.60541576", "0.6017049", "0.6000152", "0.6000152", "0.6000152", "0.59587204", "0.594...
0.60952204
11
1. number of lines 2. line length mean 3. line length variance 4. line orientation variance 5. line contrast mean 6. line orientation entropy 7. line length entropy 8. line contrast entropy
def __lsr_hist_feature(lsr_im, orders=[1,2], peak_nums=2): feat_vec = [] orientations = lsr_im[1].flatten() orientations = orientations[np.where(orientations != -1)] lengths = lsr_im[0].flatten() lengths = lengths[np.where(lengths != -1)] contrasts = lsr_im[2].flatten() contrast...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def lines():\n line_dict = {}\n #\n line_dict['ArI'] = 2**0\n line_dict['HgI'] = 2**1\n line_dict['KrI'] = 2**2\n line_dict['NeI'] = 2**3\n line_dict['XeI'] = 2**4\n line_dict['CdI'] = 2**5\n line_dict['ZnI'] = 2**6\n line_dict['HeI'] = 2**7\n line_dict['OH_R24000'] = 2**8\n lin...
[ "0.60912627", "0.56121546", "0.5475013", "0.54706347", "0.54609936", "0.53947014", "0.53947014", "0.5375146", "0.5370783", "0.52862126", "0.5269811", "0.5244334", "0.52294326", "0.519454", "0.51828766", "0.5180473", "0.51736253", "0.51716095", "0.5138301", "0.51266545", "0.51...
0.0
-1
input is a gray scale image
def line_support_regions(array, mag_threshold=20, lsr_threshold=20, distance_threshold=8, orientation_threshold=22.5): # calculate gradient orientation and magnitude mag, ang, dx, dy = __calc_mag_ang(array) mag *= 0.001 # tmp(edmim<magThreshold)=-1; temp = np.where(mag < mag_threshold, -1...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def grayscale_image(input_image):\n return cv2.cvtColor(input_image, cv2.COLOR_BGR2GRAY)", "def q_1(input_file, output_file):\n img = cv2.imread(input_file, cv2.IMREAD_COLOR)\n\n # Convert image to gray channel\n np_img = np.array(img)\n b = np_img[:,:,0]\n g = np_img[:,:,1]\n r = np_img[:,:...
[ "0.77630657", "0.76917404", "0.73381895", "0.73381895", "0.73381895", "0.73381895", "0.7315823", "0.7281324", "0.7219497", "0.7219339", "0.7219339", "0.7210702", "0.71945107", "0.7149808", "0.7135789", "0.71235466", "0.70612997", "0.70196134", "0.70066786", "0.69954866", "0.6...
0.0
-1
label regions with pixels of similar orientation
def __expand(data_object, origin_i, origin_j, candidate_i, candidate_j): abs_orientation_diff = abs(data_object.orientation_image[candidate_i][candidate_j] - data_object.orientation_image[origin_i][origin_j]) # when abs_orientation_diff is large, it means that the orientations of the pixels are similar c...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def detect_labels(img: np.ndarray):\n \n # Create a range of allowed colors.\n lower_color = np.array([20, 50, 0])\n upper_color = np.array([255, 255, 255])\n\n # Keep the pixels that lie within the range.\n color_filtered = cv.inRange(\n cv.cvtColor(img, cv.COLOR_RGB2HSV),\n lower_...
[ "0.67621547", "0.67551845", "0.64126414", "0.6185197", "0.61561686", "0.61257744", "0.60460055", "0.60256255", "0.59506834", "0.5945067", "0.5934389", "0.5850128", "0.5826683", "0.5811062", "0.57905567", "0.57820094", "0.577386", "0.5765633", "0.575415", "0.5744413", "0.57355...
0.0
-1
Strip string of punctuation
def clean_punctuation(s, punc_to_keep=[]): if not isinstance(s, str): raise ValueError('The value passed is not a string') PUNCT = re.compile('[%s]' % re.escape("".join(set(string.punctuation) - set(punc_to_keep)))) return re.sub('\s+', ' ', PUNCT.sub('', s)).strip()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def stripPunctuation(text):\n exclude = set(string.punctuation)\n clean_text = ''.join(ch for ch in text if ch not in exclude)\n clean_text = clean_text.replace('\\n',' ') # Let's account for newline characters also \n return clean_text.encode('ascii','ignore')", "def remove_punctuation(text: str) ->...
[ "0.8417255", "0.841389", "0.8373057", "0.8369177", "0.82820225", "0.8260349", "0.8250926", "0.81922114", "0.8177257", "0.81682265", "0.8163829", "0.81610394", "0.81348956", "0.8105774", "0.8100929", "0.8092508", "0.80706114", "0.8056346", "0.7998115", "0.7993093", "0.7986413"...
0.8155103
12
Remove nonASCII characters from list of tokenized words
def remove_non_ascii(word): if not isinstance(word, str): raise ValueError('The value passed is not a string') return unicodedata.normalize('NFKD', word).encode('ascii', 'ignore').decode('utf-8', 'ignore')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def clean_non_word_chars(tokens):\n toks = []\n for token in tokens:\n t = re.sub(r'\\W', \"\", token)\n if len(t) > 1:\n toks.append(t)\n\n return toks", "def _remove_non_ascii(words):\n new_words = []\n for word in words:\n new_word = unicodedata.normalize('NFKD', word).encode('ascii...
[ "0.811785", "0.7990454", "0.7987333", "0.79803234", "0.79627377", "0.79627377", "0.79627377", "0.79627377", "0.79627377", "0.79627377", "0.79065156", "0.7874596", "0.7569082", "0.75249046", "0.7517662", "0.73463523", "0.73408365", "0.7230869", "0.71905714", "0.7190189", "0.71...
0.68136555
55
Seperate camel case words to two single words
def camel_case_split(str_to_split): if not isinstance(str_to_split, str): raise ValueError('The value passed is not a string') str_to_split = str_to_split.replace('-', ' ') remove_digits = str.maketrans('', '', string.digits) str_to_split = str_to_split.translate(remove_digits) m...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _camelify(words):\n newText = ''\n for word in words:\n if newText == '':\n newText = word[:1].lower() + word[1:]\n else:\n newText = '%s%s' % (newText, word.capitalize())\n return newText", "def camel_to_spaces(s):\n subbed = _underscorer1.sub(r'\\1 \\2', s)\n...
[ "0.7439202", "0.7209049", "0.7148833", "0.7134165", "0.70911187", "0.70911187", "0.70870596", "0.7048623", "0.70053107", "0.69176424", "0.69008493", "0.688399", "0.6830623", "0.67979103", "0.6775484", "0.6767627", "0.67572695", "0.67546576", "0.6749716", "0.6726867", "0.66919...
0.0
-1
Lemmatize word according to the given POS tag
def lemmatize_word(word, pos): if not isinstance(word, str): raise ValueError('The value passed is not a string') if not isinstance(pos, str) or pos not in ['s', 'a', 'r', 'v', 'n', 'adverb']: raise ValueError('Please enter a valid part of speach out of the following options: s, a, r, v,...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def lemmatize(token, pos_tag):\n lemmatizer = TextPreprocessor.LEMMATIZER\n return lemmatizer.lemmatize(token, pos_tag)", "def lemmatize(token, tag):\n tag = {\n 'N': wn.NOUN,\n 'V': wn.VERB,\n 'R': wn.ADV,\n 'J': wn.ADJ\n }.get(tag[0], wn.N...
[ "0.8053258", "0.76011205", "0.73328537", "0.6925885", "0.6925728", "0.6922423", "0.68798333", "0.68689114", "0.6864096", "0.6829363", "0.6825703", "0.6824416", "0.6821353", "0.67756885", "0.6772498", "0.67560947", "0.674111", "0.6735526", "0.6716456", "0.67060876", "0.6687492...
0.7252529
3
Transform the given word from/to POS tags
def normalize_word(word, from_pos, to_pos): if not isinstance(word, str): raise ValueError('The value passed is not a string') if not isinstance(from_pos, str) or from_pos not in ['s', 'a', 'r', 'v', 'n', 'adverb']: raise ValueError('Please enter a valid from_pos part of speach out of th...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _postprocess(self, tags: List[str], words: List[str], pos: List[str]):\n result = list()\n\n i = 0\n for tag in tags:\n if (\"<\" not in tag) and (\">\" not in tag):\n if pos:\n result.append(f\"{words[i]}/{pos[i]}\")\n else:\n ...
[ "0.66575104", "0.66374004", "0.66243297", "0.65955764", "0.65822613", "0.6575373", "0.6541543", "0.65287185", "0.64845985", "0.6482805", "0.6473483", "0.6416917", "0.6397829", "0.63900965", "0.6346806", "0.6311959", "0.63085", "0.62770104", "0.62190413", "0.6211214", "0.61976...
0.5563037
71
The implementation of the HTTP GET method which is serviced by the sample module.
def get(self): return current_app.services.sample_module_service.send_response()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def do_GET(self):\n self.http_method = 'GET'\n self.response()", "def do_GET(self):\n self.log.debug('do_GET called')\n self.HeadGet('GET')", "def do_GET(self):\r\n self._send_handler_response('GET')", "def http_method_get():\n return 'GET'", "def get(self, *args, **kwargs...
[ "0.80192673", "0.76798284", "0.76283586", "0.76259863", "0.7574784", "0.75625587", "0.7546261", "0.75256866", "0.74438536", "0.74194705", "0.7411236", "0.7322497", "0.7322497", "0.7278562", "0.7258146", "0.7238777", "0.7230624", "0.7230624", "0.71521634", "0.70956784", "0.708...
0.68829143
31
compute distance between two points
def distance(p1, p2): return math.sqrt((p1[0]-p2[0])**2 + (p1[1]-p2[1])**2 + (p1[2]-p2[2])**2)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def distance(a: Point, b: Point) -> float:\n return math.sqrt(math.pow(b.x - a.x, 2) + math.pow(b.y - a.y, 2))", "def dist(a: Point, b: Point):\n return (a.x - b.x) ** 2 + (a.y - b.y) ** 2", "def distance_between_points(p1,p2):\n return math.sqrt((p2.x-p1.x)**2+(p2.y-p1.y)**2)", "def __get_distance(...
[ "0.8322674", "0.82640535", "0.8257232", "0.8252242", "0.82493836", "0.8206229", "0.81913906", "0.81900877", "0.8185447", "0.8179995", "0.81790316", "0.8175724", "0.8172884", "0.8136757", "0.811559", "0.8083298", "0.80756813", "0.8074209", "0.807224", "0.804152", "0.804152", ...
0.7967753
29
compute dot production of two vectors
def dot_product(v1, v2): return v1[0]*v2[0] + v1[1]*v2[1] + v1[2]*v2[2]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dot(a, b):\n\n if len(a) != len(b):\n raise Exception(\"Input vectors must be of same length, not %d and %d\" % (len(a), len(b)))\n\n return float(sum([a[i] * b[i] for i in range(len(a))]))", "def dot(vector1, vector2):\n return sum(a1 * a2 for a1, a2 in zip(vector1, vector2))", ...
[ "0.8511496", "0.84440446", "0.8402081", "0.8395364", "0.83690804", "0.8349456", "0.8316363", "0.83106387", "0.8247005", "0.8224876", "0.8203073", "0.8202561", "0.8144584", "0.8127831", "0.80985284", "0.80964756", "0.80841047", "0.8082877", "0.80808747", "0.80802584", "0.80544...
0.8106549
14
compute cross production of two vectors
def cross_product(v1, v2): return cg3d_vector.CG3dVector( v1[1] * v2[2] - v2[1] * v1[2], v1[2] * v2[0] - v2[2] * v1[0], v1[0] * v2[1] - v2[0] * v1[1] )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cross(a, b):\n #return np.cross(a,b)\n\n return vector(a[1] * b[2] - a[2] * b[1],\n a[2] * b[0] - a[0] * b[2],\n a[0] * b[1] - a[1] * b[0])", "def vec_cross(a,b):\r\n return [a[1] * b[2] - a[2] * b[1],\r\n a[2] * b[0] - a[0] * b[2],\r\n a[0] * b[1] -...
[ "0.8276196", "0.8221919", "0.80771583", "0.8044745", "0.79784995", "0.7958217", "0.7818568", "0.7786286", "0.7779489", "0.777509", "0.7701375", "0.76462483", "0.76118815", "0.7483775", "0.74591064", "0.7422321", "0.7417814", "0.74160844", "0.73222435", "0.7279918", "0.7129102...
0.79456735
6
compute mirrored point to a plane
def mirror_point_to_plane(point, plane): assert isinstance(plane, cg3d_plane.CGPlane) pn, norm = plane.get_point_and_normal() norm.normalize() return point - 2.0 * ((point - pn) * norm) * norm
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mirror_point_point(point, mirror):\n return add_vectors(mirror, subtract_vectors(mirror, point))", "def invert_point_on_plane(point, plane):\n _, _, proj = project_point_to_plane(point, plane)\n\n u, v = proj[0][1]\n return u, v", "def project_onto_plane(self,z):\n U=self.U\n Q=se...
[ "0.71565664", "0.67760986", "0.6685388", "0.6677545", "0.66611445", "0.6372813", "0.63392705", "0.62583184", "0.6253109", "0.61372876", "0.612526", "0.612526", "0.6121148", "0.6121148", "0.6113271", "0.6097133", "0.6086039", "0.6075026", "0.605341", "0.6046495", "0.5969498", ...
0.76001906
0
compute angle between two vectors, measured in radians within [0, pi] if v3 is not provided measured in radians within [0, 2pi) if v3 is provided
def compute_angle_v2v(v1, v2, v3=None): alpha = math.acos(dot_product(v1, v2) / (vlength(v1)*vlength(v2))) if v3 is not None: cross = cross_product(v2, v1) if dot_product(cross,v3) > 0.0: return 2*math.pi-alpha return alpha
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def calc_angle(v1, v2, v3):\n v1 = v1 - v2\n v3 = v3 - v2\n return v1.angle(v3)", "def angleBetweenVectors(v1, v2):\n v2Size = vectorLength(v2)\n if not v2Size:\n theta = 0.0\n else:\n theta = math.acos(dotProduct(v1, v2) / v2Size)\n return theta", "def angle(v1: Vector, v2: ...
[ "0.84741956", "0.8296164", "0.8205863", "0.8055873", "0.805562", "0.80314547", "0.7992834", "0.7979169", "0.7962801", "0.795649", "0.79424447", "0.7937237", "0.79015785", "0.7883824", "0.7839015", "0.78255475", "0.7810004", "0.7809378", "0.77991074", "0.7781774", "0.7773379",...
0.88554674
0
Main function of Register, serve as the decorator to register classes.
def register(self, param): def decorator(key, value): self[key] = value return value if callable(param): return decorator(None, param) return lambda x: decorator(param, x)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def register(cls):\n register(cls, cls.provided_class)", "def register(cls, L):\r\n ...", "def register(name):\n def func(cls):\n \"\"\"\n See register\n \"\"\"\n REGISTRY[name] = cls()\n return cls\n return func", "def on_register(cls):", "def registe...
[ "0.76450974", "0.7044375", "0.6888721", "0.6851743", "0.68083435", "0.68083435", "0.67943233", "0.67342126", "0.6708213", "0.6637487", "0.65565246", "0.650989", "0.65090024", "0.6480116", "0.6479117", "0.64501053", "0.6411301", "0.64008385", "0.63668823", "0.62780255", "0.626...
0.0
-1
Get all keys in dicts
def keys(self) -> KeysView: return self._dict.keys()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dict_keys(d):\n return list(d.keys())", "async def get_keys(self):\n return self.dict.keys()", "def list_all_keys(self):\n \n return self.keys", "def get_all_keys(self):\n r = []\n with self.lock:\n for key in self.keys():\n if self.get(key)...
[ "0.8031105", "0.7790034", "0.76039946", "0.7483124", "0.7314452", "0.7230665", "0.71800774", "0.71691775", "0.7143525", "0.7129215", "0.7122522", "0.7120335", "0.7110998", "0.70974016", "0.7091062", "0.70866126", "0.7063168", "0.70134073", "0.70073587", "0.69722843", "0.69722...
0.7175166
7
This method will display results with respect to queries.
def search(es_object, index_name, search): res = es_object.search(index=index_name, body=search) pprint(res)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def display_results():\n pass", "def _display_results(self):\n self._display_summary()\n self._display_domain_record()\n self._display_ip_record()\n self._display_cert_details()\n self._display_ti_data()\n self._display_screenshot()\n self._display_related_aler...
[ "0.75823486", "0.7561038", "0.71960175", "0.7114863", "0.69339514", "0.6871", "0.68257946", "0.6755528", "0.6751226", "0.6742363", "0.66402996", "0.66347855", "0.6589896", "0.6554801", "0.65412784", "0.6514173", "0.6504562", "0.644559", "0.64353865", "0.64291275", "0.6371323"...
0.0
-1
In this method we passed a config variable that contains the mapping of entire document structure.
def create_index(es_object, index_name): created = False """ index settings """ settings = { "settings": { "number_of_shards": 1, "number_of_replicas": 0 }, "mappings": { "physicians": { "dynamic": "strict", "propert...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def build_document(self):\n pass", "def document(self):\n ...", "def default_configs(cls):\n config = super().default_configs()\n config.update(\n {\n \"entry_type\": \"ft.onto.base_ontology.Document\",\n \"model_name\": \"ktrapeznikov/biober...
[ "0.57194966", "0.56746614", "0.56575346", "0.5510882", "0.55053866", "0.54717547", "0.54570746", "0.5352944", "0.5347917", "0.5296169", "0.52675897", "0.5255579", "0.5252195", "0.5228124", "0.521388", "0.5160215", "0.5160215", "0.51475686", "0.5127578", "0.5119132", "0.511347...
0.0
-1
This method is use to storing the actual data or document
def store_record(elastic_object, index_name, record): is_stored = True try: outcome = elastic_object.index(index=index_name, doc_type='physicians', body=record) print(outcome) except Exception as ex: print('Error in indexing data') print(str(ex)) is_stored = False ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def store(self):\n\n pass", "def save(self):\n store = datastore.DataStore()\n store.connect()\n store.setup()\n store.put(self.as_doc())", "def save(self):\n if self.document.id:\n self.db.insert(self.document)\n else:\n self.db.update(sel...
[ "0.7766237", "0.7683521", "0.75763404", "0.7552463", "0.73784524", "0.70936716", "0.7027931", "0.7005489", "0.69571227", "0.6954598", "0.69326884", "0.69326884", "0.69326884", "0.6888453", "0.68799967", "0.68799967", "0.68799967", "0.68799967", "0.68799967", "0.68750316", "0....
0.0
-1
This method is use to connect the ElasticSearch server
def connect_elasticsearch(): _es = None # create an instance of elasticsearch and assign it to port 9200 _es = Elasticsearch([{'host': 'localhost', 'port': 9200}]) _es.cluster.health(wait_for_status='yellow', request_timeout=1) # pings the server and returns True if gets connected. if _es.ping...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def connect_elasticsearch(ip = \"localhost\"):\n _es = None\n _es = Elasticsearch([{'host': ip, 'port': 9200}])\n if _es.ping():\n print('Succesfully Connected')\n else:\n print('Failed to connection')\n return _es", "def _init_es(self):\n es = Elasticsearch([{'host': elastic_...
[ "0.7927826", "0.7733264", "0.7659889", "0.7570665", "0.7431623", "0.7340576", "0.7242035", "0.7060697", "0.6873925", "0.68355966", "0.67021406", "0.665547", "0.6562014", "0.65527004", "0.65390545", "0.6489188", "0.6444184", "0.6411389", "0.636623", "0.63366604", "0.6314665", ...
0.8208195
0
This method is use to pull the data. Since we need data in JSON format, therefore, It convert the data accordingly.
def parse(u): rec = {} try: r = requests.get(u, headers=headers) if r.status_code == 200: html = r.text soup = BeautifulSoup(html, 'lxml') overview_section = soup.select('.Raw-s14xcvr1-0 gXqFYO') full_name_section = soup.select('.sc-iwsKbI kjxnCg...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _fetch_data(self):\n pass", "def _get_converted_data(self):\n pass", "def get_data(self):\n return self.data.to_json()", "def fetch_data(self):", "def get_data(self):", "def _read_data(self):", "def get_data(self):\r\n pass", "def get_data():\n pass", "def get_dat...
[ "0.70395666", "0.70234317", "0.7021594", "0.690795", "0.68960196", "0.6799101", "0.6764389", "0.6739458", "0.67217726", "0.67217726", "0.6687901", "0.66830933", "0.6590662", "0.6403266", "0.6391145", "0.6371797", "0.62587065", "0.62509966", "0.6238409", "0.62237555", "0.61731...
0.0
-1
Base struct on Reference Class
def __init__(self, name: str, namespace: str): self.name = name self.namespace = namespace
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, reference=None):\n self.reference = reference", "def Reference(cls):\n return type(cls.__name__, (Typed, ), {\"type\": cls})", "def make_reference(self):\n self.make_reference2()", "def test_reference_field(self):\n dt = np.dtype([('a', 'i'),('b', h5py.ref_dtype)])\...
[ "0.68119735", "0.6561263", "0.6478888", "0.6463668", "0.64498544", "0.631495", "0.6180563", "0.61760455", "0.6064846", "0.6040737", "0.6039495", "0.6020801", "0.6006587", "0.60060763", "0.5923059", "0.591321", "0.58910745", "0.5869636", "0.5856874", "0.5856874", "0.5803859", ...
0.0
-1
It should have an AddLabwareDefinitionRequest model.
def test_add_labware_request(well_plate_def: models.LabwareDefinition) -> None: request = AddLabwareDefinitionRequest( definition=well_plate_def, ) assert request.definition == well_plate_def
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def test_add_labware_implementation(\n well_plate_def: models.LabwareDefinition,\n mock_handlers: AsyncMock,\n) -> None:\n request = AddLabwareDefinitionRequest(\n definition=well_plate_def\n )\n\n impl = request.get_implementation()\n result = await impl.execute(mock_handlers)\n\n ...
[ "0.6190147", "0.6027513", "0.5921026", "0.58792675", "0.5688149", "0.5624537", "0.55538905", "0.5538914", "0.5526585", "0.5387325", "0.53617215", "0.52914256", "0.5254577", "0.51942605", "0.5173082", "0.51148427", "0.5098331", "0.5093142", "0.50807995", "0.5037279", "0.503200...
0.7245749
0
It should be have an AddLabwareDefinitionResult model.
def test_add_labware_result() -> None: result = AddLabwareDefinitionResult( loadName="loadname", namespace="ns", version=1, ) assert result.loadName == "loadname" assert result.namespace == "ns" assert result.version == 1
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_add_labware_request(well_plate_def: models.LabwareDefinition) -> None:\n request = AddLabwareDefinitionRequest(\n definition=well_plate_def,\n )\n\n assert request.definition == well_plate_def", "async def test_add_labware_implementation(\n well_plate_def: models.LabwareDefinition,\n ...
[ "0.6378661", "0.6378401", "0.6012059", "0.58740896", "0.541192", "0.5409955", "0.54081714", "0.51540506", "0.5104484", "0.50718534", "0.5071431", "0.50662804", "0.500971", "0.49539307", "0.49170685", "0.49033558", "0.49006936", "0.485272", "0.4847301", "0.48120546", "0.479319...
0.6950073
0
An AddLabwareRequest should have an execution implementation.
async def test_add_labware_implementation( well_plate_def: models.LabwareDefinition, mock_handlers: AsyncMock, ) -> None: request = AddLabwareDefinitionRequest( definition=well_plate_def ) impl = request.get_implementation() result = await impl.execute(mock_handlers) assert result ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def InvocationAddRequest(builder, request):\n return AddRequest(builder, request)", "def __call__(self, req):\n raise NotImplementedError(\"%s.__call__()\" % self.__class__.__name__)", "def __call__(self, req):\n raise NotImplementedError(\"%s.__call__()\" % self.__class__.__name__)", "def a...
[ "0.62162125", "0.5733132", "0.5733132", "0.5667069", "0.55817854", "0.5423216", "0.528022", "0.5255451", "0.5245095", "0.5243872", "0.52155715", "0.5208877", "0.51968306", "0.5190897", "0.5181421", "0.5167241", "0.51598376", "0.5142138", "0.51322234", "0.5109828", "0.5106882"...
0.51323515
18
Removed all endpoints that have not been recently updated.
def expire(ttl): print("[+] Staring expiration of old endpoints.") try: now = arrow.utcnow() expiration = now - timedelta(hours=ttl) endpoints = database.session_query(Endpoint).filter( cast(Endpoint.last_updated, ArrowType) <= expiration ) for endpoint in e...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def shutdown_all_endpoints(self):\n logger.debug('Removing all endpoints')\n endpoints = []\n with self._endpoint_lock:\n endpoints = list(self._endpoints)\n # be sure we're not holding the lock when shutdown calls\n # _remove_endpoint.\n for e in endpoints:\n ...
[ "0.7379679", "0.66049266", "0.6535214", "0.6284587", "0.628356", "0.6249345", "0.6231531", "0.61824423", "0.6170027", "0.61422783", "0.60801876", "0.6066305", "0.6036329", "0.60182923", "0.60074353", "0.60074353", "0.6005392", "0.595887", "0.5899034", "0.58659315", "0.5842976...
0.5253774
97
A stream to dump to
def __init__(self, o: AsStreamTypeAccept, human_readable: bool): self.o = o self.human_readable = human_readable if isinstance(o, str): if os.path.isdir(o): self.o = os.path.join(o, uuid.uuid4().hex) self.mode = StreamType.MODE_FILE elif isinstan...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dump(self, stream):\n log.error('Cannot dump: %s', self.file_name)", "def dump(self, output_stream):\n raise NotImplementedError", "def export(self, stream):\n pass", "def save(datastream):", "def dumps(self):\n buff = io.StringIO()\n self.dump(buff)\n buff.see...
[ "0.7625899", "0.7525129", "0.7355745", "0.6853095", "0.6424289", "0.6414291", "0.63583827", "0.63230246", "0.6251582", "0.62219036", "0.6032733", "0.6020485", "0.59757525", "0.5975509", "0.5956795", "0.59330094", "0.5920573", "0.5916138", "0.5906137", "0.5906137", "0.588776",...
0.0
-1
Test map state initalisation
def testInit(self): map_state = MapState(self.event_manager) self.assertEqual(map_state.event_manager, self.event_manager) self.assertTrue(map_state in self.event_manager.listener_groups["default"].listeners) self.assertEqual(map_state.occupied_sectors_by_actor_id, {}) self.asser...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_default_map_copy(self):\n self.assertEqual(_DEFAULT_MAP[\"initialViewState\"][\"latitude\"], 0)\n\n st.map(df1)\n self.assertEqual(_DEFAULT_MAP[\"initialViewState\"][\"latitude\"], 0)", "def testMapConstructor(self):\n # We only use one map type since they all share the same impl...
[ "0.7265246", "0.69092846", "0.6823226", "0.6821895", "0.67803544", "0.66519034", "0.6625274", "0.6577769", "0.65546983", "0.65419436", "0.65352696", "0.65162754", "0.64886796", "0.6487898", "0.6458597", "0.6433869", "0.64280206", "0.6424503", "0.6423329", "0.6420677", "0.6392...
0.79490566
0
Test charactor place notification
def testCharactorPlaceNotification(self): map_state = MapState(self.event_manager) charactor = Charactor(self.event_manager) charactor.sector = Sector() charactor_place_event = CharactorPlaceEvent(charactor) self.event_manager.post(charactor_place_event) self.assertEqual(...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_actor_matches_activity(self):", "def setUp(self):\n self.message = \"notification message\"", "def test_if_fires_on_zone_appear(self):\n assert setup_component(self.hass, automation.DOMAIN, {\n automation.DOMAIN: {\n 'trigger': {\n 'platform':...
[ "0.59219193", "0.5917184", "0.590566", "0.57799864", "0.5739272", "0.56696534", "0.56668067", "0.5664857", "0.56487775", "0.5569228", "0.5566681", "0.5528", "0.5517465", "0.5512968", "0.5508632", "0.54891986", "0.54885614", "0.5478166", "0.54666233", "0.54548526", "0.54514325...
0.7563159
0
Test free section action notification
def testFreeSectorActionNotification(self): map_state = MapState(self.event_manager) sector = Sector() self.actionExecuted = False #TODO: this is no good def function(sector_is_free): if sector_is_free: self.actionExecuted = True callback_func...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_section_change(self):\n form = ComplaintActions(\n initial=self.initial_values,\n data={**self.initial_values, 'assigned_section': 'VOT'}\n )\n\n self.assertEqual(form.errors, {})\n self.assertCountEqual(form.get_actions(), [\n ('Assigned sectio...
[ "0.6198999", "0.5610769", "0.55951947", "0.54828197", "0.5441922", "0.54344755", "0.54324454", "0.5429805", "0.54294246", "0.5427339", "0.5427339", "0.54259884", "0.54064876", "0.5392552", "0.53608054", "0.53546816", "0.53256404", "0.53256404", "0.5313559", "0.5311197", "0.53...
0.5678359
1
Set grid from unstructured_grid.UnstructuredGrid instance
def set_grid(self,ug): self.grd=ug self.set_topology()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def grid(self, grid):\n\n self._grid = grid", "def _load_grid(self):\n\n grid_metrics = ['nbe', 'ntsn', 'nbsn', 'ntve', 'nbve', 'art1', 'art2', 'a1u', 'a2u']\n grid_variables = ['lon', 'lat', 'x', 'y', 'lonc', 'latc', 'xc', 'yc',\n 'h', 'siglay', 'siglev']\n\n ...
[ "0.70924187", "0.61134106", "0.5965736", "0.5831968", "0.5830156", "0.58101654", "0.5759747", "0.56962466", "0.5693362", "0.5683724", "0.56670326", "0.56269586", "0.5619845", "0.5611844", "0.5603769", "0.551005", "0.5500384", "0.5470164", "0.54357785", "0.54238737", "0.539154...
0.70702094
1
using ete2 for midpoint rooting
def midpointRooting(infileName, outfileName): newickString=open(infileName, 'rb').readline().rstrip().replace('[&R] ', '') tree = Tree(newickString); if tree.get_midpoint_outgroup()!=None: tree.set_outgroup( tree.get_midpoint_outgroup() ) tree.ladderize() with open(outfileName, 'wb') as...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def root_midpoint(self):\n node1, node2, distance = self.find_middle_point()\n self.root_nodes(node1, node2, distance)", "def E2K(E):\n return sqrt(E/2.0723)", "def midpoint(bbox):\n return (0.5*(bbox[0][0] + bbox[1][0]), 0.5*(bbox[0][1] + bbox[1][1]))", "def root2(self):\r\n if se...
[ "0.6437743", "0.6227128", "0.6197915", "0.6186449", "0.6170142", "0.6085364", "0.6068605", "0.60582215", "0.60238284", "0.60014725", "0.5962743", "0.5799887", "0.5752096", "0.57503545", "0.5709532", "0.56763613", "0.56555104", "0.56351256", "0.5610681", "0.5605583", "0.560346...
0.58482397
11
retorna dicionario com os valeres preenchidos com a respectiva nowDate
def fillDict(valDict, nowDate=datetime.now()): copyDict = copy.deepcopy(valDict) copyDict[names.year] = nowDate.year copyDict[names.month] = nowDate.month copyDict[names.day] = nowDate.day return copyDict
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_date(self):\n for fax_in in self:\n DATETIME_FORMAT = \"%Y-%m-%d %H:%M:%S\"\n date_planned = False\n if fax_in.date:\n from_dt = datetime.datetime.strptime(str(fax_in.date[:19]), DATETIME_FORMAT)\n # from_dt = from_dt + datetime.timedelt...
[ "0.6433749", "0.62375826", "0.62264824", "0.60999036", "0.60984176", "0.6083139", "0.60449576", "0.5996652", "0.59885174", "0.59549683", "0.588471", "0.5857914", "0.58202463", "0.577532", "0.5742193", "0.5738928", "0.57209474", "0.57141507", "0.5698251", "0.56518626", "0.5651...
0.550281
37
start should be datetime.datetime instance start+ (2003, 1, 1) end less then today save the data on db/start.json
def get_one(self, date): now = datetime.now() now = datetime(now.year, now.month, now.day) assert isinstance(date, datetime), 'start need to be datetime instance' assert date < now, 'date need to be less or equal than yesterday' assert date >= start_date, 'no data before...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def start(start):\n # retrieve temp observations from start date given and convert to list \n start_date = list(session.query(Measurement.date, func.min(Measurement.tobs), func.avg(Measurement.tobs), func.max(Measurement.tobs)).filter(Measurement.date >= start).group_by(Measurement.date).all())\n return j...
[ "0.7180564", "0.7024863", "0.68616873", "0.6859777", "0.67597926", "0.66796297", "0.6634743", "0.6536478", "0.6519963", "0.6403612", "0.6328178", "0.6305765", "0.62967575", "0.629503", "0.62881696", "0.6282426", "0.62573117", "0.62265784", "0.61940074", "0.6158808", "0.615158...
0.6110816
22
start and end should be datetime.datetime instance start+ (2003, 1, 1) end less then today save the data on db/start+end.json
def get_between(self, start, end): now = datetime.now() now = datetime(now.year, now.month, now.day) assert isinstance(start, datetime), 'start need to be datetime instance' assert isinstance(end, datetime), 'end need to be datetime instance' assert start < end, 'start n...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def startend(start,end):\n \n All_temps = session.query(func.min(Measurement.tobs), func.avg(Measurement.tobs), func.max(Measurement.tobs)).\\\n filter(Measurement.date >= start).filter(Measurement.date <= end).all()\n \n session.close()\n\n return jsonify(All_temps)\n\n return json...
[ "0.7291892", "0.7013067", "0.67804277", "0.6715123", "0.6580593", "0.65523016", "0.6548323", "0.6479772", "0.6474213", "0.64688563", "0.6401303", "0.63979715", "0.6366458", "0.63545704", "0.6302838", "0.6266598", "0.6201307", "0.61916107", "0.6191002", "0.61574227", "0.614303...
0.7089704
1
Return a emprty tictactoe board we can use for simulating a game.
def _new_board(board_size): return tuple(tuple(0 for _ in range(board_size)) for _ in range(board_size))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def PlayTicTacToe(numPlayers):\n\tteams = {} # maps the teams onto players or computer\n\tif numPlayers == 0:\n\t\tteams['X'] = 'C'\n\t\tteams['O'] = 'C'\n\telif numPlayers == 1:\n\t\tteams['X'] = 'H'\n\t\tteams['O'] = 'C'\n\telse:\n\t\tteams['X'] = 'H'\n\t\tteams['O'] = 'H'\n\n\tnumberBoard = (\n\t\t\t('0', '1', ...
[ "0.6652592", "0.6599624", "0.6571921", "0.65252966", "0.6513397", "0.64413214", "0.6377839", "0.6330763", "0.6317147", "0.62754655", "0.626351", "0.6233981", "0.62005985", "0.6187352", "0.6175879", "0.6167289", "0.6132597", "0.61313915", "0.6118611", "0.60963076", "0.6095623"...
0.56937885
81
Returns a copy of the given board_state with the desired move applied.
def apply_move(board_state, move, side): move_x, move_y = move def get_tuples(): for x in range(len(board_state)): if move_x == x: temp = list(board_state[x]) temp[move_y] = side yield tuple(temp) else: yield board_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def result(self, board_state, move):\n # Create a copy of the current board state\n output_state = BoardState(other_state=board_state)\n # Swap pieces\n output_state.move_piece(move)\n # Eliminate pieces\n output_state.eliminate_piece()\n return output_state", "de...
[ "0.76411194", "0.7558772", "0.73455983", "0.68056464", "0.6557931", "0.6489222", "0.64678603", "0.6444116", "0.6425383", "0.6387431", "0.6352943", "0.63512206", "0.63462776", "0.6318669", "0.6311034", "0.6275443", "0.62611324", "0.6258866", "0.6233591", "0.62235296", "0.62084...
0.65109485
5
Get all legal moves for the current board_state. For Tictactoe that is all positions that do not currently have pieces played.
def available_moves(board_state): for x, y in itertools.product(range(len(board_state)), range(len(board_state[0]))): if board_state[x][y] == 0: yield (x, y)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_legal_moves(self):\n # for each square in the castle figure out if an moves can occur from it.\n moves = []\n allowed = [self.turn]\n if self.turn == DEFENDER:\n allowed.extend((KING, CASTLE_OCCUPIED))\n it = np.nditer(self.board_state, flags=['multi_index'])\n...
[ "0.8104835", "0.79265124", "0.78373796", "0.7735789", "0.77165693", "0.7643346", "0.75891775", "0.7550649", "0.7538445", "0.74807423", "0.7466644", "0.7418224", "0.7406417", "0.7396408", "0.7373833", "0.73277944", "0.7315183", "0.7275858", "0.7267511", "0.7243297", "0.7232759...
0.7168862
29