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
Loads the model weights once, so it can be reused for several images sequentially.
def load_model(weight_file, img_w, img_h): model, input_data, y_pred = OCRModel( img_w, img_h, NUMBER_GENERATOR_OUPUT_SIZE, ABSOLUTE_MAX_STRING_LEN).build() test_func = K.function([input_data], [y_pred]) model.load_weights(weight_file) return model, test_func
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _load_weights(self):\n self.npz_weights = np.load(self._weight_file)\n self._load_byte_embedding()\n self._load_cnn_weights()\n self._load_highway()\n self._load_projection()", "def load_model_weights(self):\n raise NotImplementedError", "def load_model(self, ):\n ...
[ "0.74412036", "0.74169856", "0.72789735", "0.7261369", "0.7261095", "0.7220132", "0.718703", "0.71257687", "0.70274734", "0.7009838", "0.6920951", "0.691932", "0.6899038", "0.687305", "0.6852795", "0.6798096", "0.6764068", "0.67364603", "0.67252874", "0.67067325", "0.66952705...
0.0
-1
Given an image and a model, return the result of the model prediction on that image.
def evaluate(model, img, test_func, img_w, img_h): size = 2 # For some reason, it fails for a single value labels = np.ones([size, ABSOLUTE_MAX_STRING_LEN]) input_length = np.zeros([size, 1]) label_length = np.ones([size, 1]) X_data = np.ones([size, img_w, img_h, 1]) for i in xrange(size): ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def predict(model, img):\n\tx = image.img_to_array(img)\n\tx = np.expand_dims(x, axis=0)\n\tx = preprocess_input(x)\n\tpreds = model.predict(x)\n\treturn preds[0]", "def predict_one_image(img_path, prediction_model):\n # Load image and resize it\n img = image.load_img(img_path, target_size=(224, 22...
[ "0.84053665", "0.79450554", "0.79360104", "0.78320575", "0.7763854", "0.77579683", "0.7702613", "0.7669564", "0.76502466", "0.76502466", "0.7564796", "0.74904966", "0.7482218", "0.7437108", "0.73461425", "0.73023725", "0.7244278", "0.7186402", "0.7175088", "0.7150801", "0.713...
0.6912929
31
Given images and a model, return the results of the model prediction on those images.
def evaluate_batch(model, images, test_func, img_w, img_h): if len(images) == 1: return [evaluate(model, images[0], test_func, img_w, img_h)] size = len(images) # For some reason, it fails for a single value labels = np.ones([size, ABSOLUTE_MAX_STRING_LEN]) input_length = np.zeros([size, 1]) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def predict(model, images):\n return model.predict_classes(images)", "def model_predict(img, model, preprocess_func):\n img = img.resize((224, 224)) # Each model expects shape: (224, 224, 3)\n x = image.img_to_array(img)\n x = np.expand_dims(x, axis=0)\n\n x = preprocess_func(x)\n preds = model.p...
[ "0.7901662", "0.7528717", "0.72941136", "0.72903866", "0.7132775", "0.70108235", "0.6991459", "0.6991264", "0.69582474", "0.6955385", "0.6889948", "0.6857865", "0.685432", "0.67916816", "0.67916816", "0.6787396", "0.6769087", "0.6752149", "0.67412907", "0.6697111", "0.6690872...
0.66428125
28
Recrusively create all directories on a path. This is a wrapper around os.makedirs that doesn't fail if the directories already exist.
def makedirs(path): try: os.makedirs(path) except (IOError, OSError) as ex: if ex.errno != errno.EEXIST: raise return path
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def make_dirs(path):\n\tif not os.path.exists(path):\n\t\treturn os.makedirs(path)", "def make_dirs(path):\n if not os.path.exists(path):\n os.makedirs(path)", "def create_directories(path):\n try:\n os.makedirs(path)\n\n except OSError as e:\n\n if e.errno != errno.EEXIST:\n ...
[ "0.83516157", "0.83009607", "0.8265935", "0.8242433", "0.80090976", "0.7965065", "0.77871525", "0.77753794", "0.7769545", "0.77508503", "0.7704466", "0.7666375", "0.7647138", "0.7646015", "0.7645237", "0.76410836", "0.76353884", "0.7622909", "0.76044124", "0.7596248", "0.7586...
0.72890437
73
Send a 204 response with no payload.
def get200_model204_no_model_default_error204_valid( # pylint: disable=name-too-long self, **kwargs: Any ) -> Optional[_models.MyException]: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, 304: Resou...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def response_204(description=None):\n description = description or \"Item deleted\"\n return response(204, {\n \"description\": description,\n \"schema\": {\"type\": \"null\"}\n })", "def create_204_response() -> bytes:\n date = datetime.datetime.now(datetime.timezone.utc).strftime(...
[ "0.73792374", "0.73369396", "0.71968496", "0.69492", "0.66780806", "0.6610339", "0.625239", "0.61683136", "0.61584014", "0.60066664", "0.5949783", "0.58643544", "0.58643544", "0.57564586", "0.5734541", "0.5730738", "0.57254153", "0.56899637", "0.56244755", "0.56234354", "0.56...
0.0
-1
Send a 202 response with no payload.
def get202_none204_none_default_error202_none( # pylint: disable=inconsistent-return-statements,name-too-long self, **kwargs: Any ) -> None: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, 304: Resou...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_204_response() -> bytes:\n date = datetime.datetime.now(datetime.timezone.utc).strftime(\"%a, %d %b %Y %H:%M:%S GMT\")\n\n header = \"HTTP/1.1 204 No Content\" + \"\\r\\nDate: \" + date + \"\\r\\n\\r\\n\"\n\n print(header)\n return header.encode(HttpServer.FORMAT)", "def as...
[ "0.6130708", "0.60945415", "0.574898", "0.5702039", "0.5666428", "0.56437886", "0.56437886", "0.55945367", "0.557903", "0.5564844", "0.5432638", "0.5430155", "0.53832376", "0.53440756", "0.53351414", "0.5314114", "0.531253", "0.52789325", "0.52699775", "0.52528673", "0.523478...
0.4983368
37
Send a 204 response with no payload.
def get202_none204_none_default_error204_none( # pylint: disable=inconsistent-return-statements,name-too-long self, **kwargs: Any ) -> None: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, 304: Resou...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def response_204(description=None):\n description = description or \"Item deleted\"\n return response(204, {\n \"description\": description,\n \"schema\": {\"type\": \"null\"}\n })", "def create_204_response() -> bytes:\n date = datetime.datetime.now(datetime.timezone.utc).strftime(...
[ "0.73792374", "0.73369396", "0.71968496", "0.69492", "0.66780806", "0.6610339", "0.625239", "0.61683136", "0.61584014", "0.60066664", "0.5949783", "0.58643544", "0.58643544", "0.57564586", "0.5734541", "0.5730738", "0.57254153", "0.56899637", "0.56244755", "0.56234354", "0.56...
0.0
-1
Send a 204 response with no payload.
def get202_none204_none_default_none204_none( # pylint: disable=inconsistent-return-statements self, **kwargs: Any ) -> None: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, 304: ResourceNotModifiedE...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def response_204(description=None):\n description = description or \"Item deleted\"\n return response(204, {\n \"description\": description,\n \"schema\": {\"type\": \"null\"}\n })", "def create_204_response() -> bytes:\n date = datetime.datetime.now(datetime.timezone.utc).strftime(...
[ "0.73792374", "0.73369396", "0.71968496", "0.69492", "0.66780806", "0.6610339", "0.625239", "0.61683136", "0.61584014", "0.60066664", "0.5949783", "0.58643544", "0.58643544", "0.57564586", "0.5734541", "0.5730738", "0.57254153", "0.56899637", "0.56244755", "0.56234354", "0.56...
0.0
-1
Send a 400 response with no payload.
def get202_none204_none_default_none400_none( # pylint: disable=inconsistent-return-statements self, **kwargs: Any ) -> None: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, 304: ResourceNotModifiedE...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def resp400(description: str) -> flask.Response:\n return flask.make_response(\n # This puts a JSON body into the response with a JSON object with one\n # key, the description\n flask.jsonify(description=description),\n 400,\n )", "def send400(start_response, message=YZ_INVALID_...
[ "0.7887991", "0.7731034", "0.757063", "0.734717", "0.725373", "0.72494215", "0.722996", "0.71282196", "0.7051718", "0.6991129", "0.69120866", "0.6905295", "0.6902304", "0.68650514", "0.68360734", "0.6794365", "0.6684633", "0.6642237", "0.66114086", "0.6441837", "0.643518", ...
0.0
-1
Send a 200 response with no payload.
def get_default_model_a200_none(self, **kwargs: Any) -> _models.MyException: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, 304: ResourceNotModifiedError, } error_map.update(kwargs.pop("error_map...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def write_empty_response(self, status_code):\n self.send_response(status_code)\n self.end_headers()", "def send_200_resp(self, response, content_type):\n self.send_response(200)\n self.send_header(\"Content-type\", content_type)\n if response is not None:\n ...
[ "0.7140614", "0.6911207", "0.6805079", "0.6704318", "0.6640129", "0.6560751", "0.65226126", "0.6522408", "0.6472847", "0.6449063", "0.64455646", "0.6410004", "0.6389447", "0.63364375", "0.6236438", "0.62204695", "0.62106997", "0.61392415", "0.6115059", "0.60700107", "0.601783...
0.0
-1
Send a 400 response with no payload.
def get_default_model_a400_none(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-statements error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, 304: ResourceNotModifiedError, } err...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def resp400(description: str) -> flask.Response:\n return flask.make_response(\n # This puts a JSON body into the response with a JSON object with one\n # key, the description\n flask.jsonify(description=description),\n 400,\n )", "def send400(start_response, message=YZ_INVALID_...
[ "0.7887991", "0.7731034", "0.757063", "0.734717", "0.725373", "0.72494215", "0.722996", "0.71282196", "0.7051718", "0.6991129", "0.69120866", "0.6905295", "0.6902304", "0.68650514", "0.68360734", "0.6794365", "0.6684633", "0.6642237", "0.66114086", "0.6441837", "0.643518", ...
0.0
-1
Send a 200 response with no payload.
def get_default_none200_none(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-statements error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, 304: ResourceNotModifiedError, } error_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def write_empty_response(self, status_code):\n self.send_response(status_code)\n self.end_headers()", "def send_200_resp(self, response, content_type):\n self.send_response(200)\n self.send_header(\"Content-type\", content_type)\n if response is not None:\n ...
[ "0.7140614", "0.6911207", "0.6805079", "0.6704318", "0.6640129", "0.6560751", "0.65226126", "0.6522408", "0.6472847", "0.6449063", "0.64455646", "0.6410004", "0.6389447", "0.63364375", "0.6236438", "0.62204695", "0.62106997", "0.61392415", "0.6115059", "0.60700107", "0.601783...
0.0
-1
Send a 400 response with no payload.
def get_default_none400_none(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-statements error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, 304: ResourceNotModifiedError, } error_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def resp400(description: str) -> flask.Response:\n return flask.make_response(\n # This puts a JSON body into the response with a JSON object with one\n # key, the description\n flask.jsonify(description=description),\n 400,\n )", "def send400(start_response, message=YZ_INVALID_...
[ "0.7887991", "0.7731034", "0.757063", "0.734717", "0.725373", "0.72494215", "0.722996", "0.71282196", "0.7051718", "0.6991129", "0.69120866", "0.6905295", "0.6902304", "0.68650514", "0.68360734", "0.6794365", "0.6684633", "0.6642237", "0.66114086", "0.6441837", "0.643518", ...
0.0
-1
Send a 200 response with no payload, when a payload is expected client should return a null object of thde type for model A.
def get200_model_a200_none(self, **kwargs: Any) -> _models.MyException: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, 304: ResourceNotModifiedError, } error_map.update(kwargs.pop("error_map", {}...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_response_200_on_get(self):\n pass", "def emptyresponse():\n return get_response(\"\")", "def get_default_none200_none(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-statements\n error_map = {\n 401: ClientAuthenticationError,\n 404: Resource...
[ "0.6507499", "0.62811166", "0.6234812", "0.6197322", "0.6133319", "0.61317474", "0.6097245", "0.60916", "0.601716", "0.59952927", "0.59543383", "0.5899835", "0.5888825", "0.58010465", "0.579738", "0.5774586", "0.5764884", "0.57151973", "0.57149965", "0.56925756", "0.5677122",...
0.61720115
4
Send a 400 response with no payload client should treat as an http error with no error model.
def get200_model_a400_none(self, **kwargs: Any) -> _models.MyException: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, 304: ResourceNotModifiedError, } error_map.update(kwargs.pop("error_map", {}...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def bad_request_400(error):\n return jsonify({\n 'success': False,\n 'message': 'Bad request',\n 'error': 400\n }), 400", "def bad_request():\n return HttpError(400)", "def resp400(description: str) -> flask.Response:\n return flask.make_response(\n # This ...
[ "0.76749116", "0.7658953", "0.7632113", "0.7593276", "0.7578937", "0.74632627", "0.73270446", "0.7229627", "0.7171219", "0.71373594", "0.7116561", "0.71098167", "0.7102666", "0.70817393", "0.7056665", "0.703174", "0.7018669", "0.6873507", "0.6851439", "0.6816785", "0.67640305...
0.6775207
20
Simple method to stop the RC loop
def stop(self): self.killed = True
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def stop() -> None:", "def stop():", "def stop():", "def stop():", "def stop():", "def stop(self) -> None:", "def stop(self) -> None:", "def loop_stop( self ):\n self.client.loop_stop()", "def stop(self) -> None:\n ...", "def stop(self):", "def stop(self):", "def loop_stop(self)...
[ "0.82286155", "0.8035311", "0.8035311", "0.8035311", "0.8035311", "0.7669321", "0.7669321", "0.7646347", "0.7599892", "0.7523446", "0.7523446", "0.7490129", "0.74642634", "0.74642634", "0.7462247", "0.74590796", "0.745203", "0.7422136", "0.7381036", "0.738065", "0.738065", ...
0.0
-1
Start listening to the wiimote and drive the motors
def run(self): # Initiate the drivetrain while self.wiimote and not self.killed: buttons_state = self.wiimote.get_buttons() nunchuk_buttons_state = self.wiimote.get_nunchuk_buttons() joystick_state = self.wiimote.get_joystick_state() #logging.debug("joyst...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def startReceiving(self):\n self.listening = True\n self.start()", "def start(self):\n self.listener.start()\n # No need to start broadcaster, it just sends when necessary", "def connect(self):\n try:\n # Port and packet handler set up\n self.port_handler = port_h.Por...
[ "0.67203516", "0.6442965", "0.64378023", "0.6405441", "0.6325161", "0.6262563", "0.62568414", "0.61795133", "0.6170025", "0.6148327", "0.6144105", "0.6132609", "0.6060723", "0.6046509", "0.6042113", "0.6031949", "0.6025661", "0.6018097", "0.6009561", "0.5989705", "0.59850127"...
0.6070517
12
handle integer, characteristic read handle the data was received on value bytearray, the data returned in the notification
def handle_data(handle, value): print("Received data: %s" % hexlify(value))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dataReceived(self, data):", "def callback_dat(fd_):\n # receive data\n data = os.read(fd_, 8)\n if data == '':\n return\n data, = struct.unpack('<Q', data)\n # TODO: Interpret data", "def _receive(self, length):\n \n return self.device.read(length...
[ "0.6919184", "0.68212444", "0.65012705", "0.6473814", "0.6387321", "0.6259692", "0.6167678", "0.61559623", "0.611855", "0.61046755", "0.60961735", "0.6074765", "0.6074765", "0.6033116", "0.60220635", "0.60208684", "0.60087305", "0.5997787", "0.5969673", "0.59640014", "0.59611...
0.67988044
2
read an object from json file
def read_object_from_file(file_name): if os.path.exists(file_name) is False: print ("Error read path: [%s]" % file_name) return None with open(file_name, 'r') as f: try: obj = json.load(f) except Exception: print ("Error json: [%s]" % f.read()[0:10]) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read_json(fpath):\n with open(fpath, 'r') as f:\n obj = json.load(f)\n return obj", "def read_json(fn):\n with open(fn) as f:\n return json.load(f, object_hook=_operator_object_hook)", "def convert_json_to_object(file_content):\n object = json.loads(file_content)\n print(object...
[ "0.79075253", "0.7820032", "0.778218", "0.76092285", "0.75858706", "0.75614053", "0.7538552", "0.7453517", "0.7453517", "0.7428007", "0.7397801", "0.7393363", "0.73734057", "0.73734057", "0.73653334", "0.73588914", "0.7321864", "0.7318475", "0.73151296", "0.7285039", "0.72725...
0.77815557
3
write the object to file with json(if the file exists, this function will overwrite it)
def write_object_to_file(file_name, mode, target_object): dirname = os.path.dirname(file_name) find_and_create_dirs(dirname) try: with open(file_name, mode) as f: json.dump(target_object, f, skipkeys=False, ensure_ascii=False, check_circular=True, allow_nan=True, cls=None, indent=True, s...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save_to_json_file(my_obj, filename):\n with open(filename, \"w\") as myfile:\n return myfile.write(json.dumps(my_obj))", "def save_to_json_file(my_obj, filename):\n with open(filename, \"w\") as f:\n j = json.dumps(my_obj)\n f.write(j)\n f.close()", "def save_to_json_file(...
[ "0.79542804", "0.7921877", "0.79136485", "0.7912281", "0.78973514", "0.78823596", "0.786181", "0.7860786", "0.78478086", "0.7840982", "0.78318274", "0.78094125", "0.7794018", "0.778671", "0.7760466", "0.77531064", "0.77507997", "0.7709685", "0.7690376", "0.7666225", "0.765206...
0.7158376
67
find dir, create it if it doesn't exist
def find_and_create_dirs(dir_name): if os.path.exists(dir_name) is False: os.makedirs(dir_name) return dir_name
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def make_dir_if_needed(dir) :\n\tif not exists(dir) :\n\t\tos.makedirs(dir)", "def _find_or_create_dir(dir_name: str) -> str:\r\n # Get the directory of the current file.\r\n parent_dir_path = os.path.dirname(os.path.realpath(__file__))\r\n \r\n # Create a directory if it doesn't exist.\r\n dir_pa...
[ "0.78143203", "0.7572564", "0.75672174", "0.7505218", "0.7405751", "0.73660105", "0.7318875", "0.7313977", "0.7313617", "0.7306224", "0.7281798", "0.7190104", "0.7147234", "0.7147234", "0.7122194", "0.7111919", "0.7110475", "0.7098091", "0.70818955", "0.70818603", "0.7077556"...
0.7628102
1
Print things to stdout on one line dynamically
def _Printer(self,data): sys.stdout.write("\r\x1b[K"+data.__str__()) sys.stdout.flush()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _print_output(*args):\n for arg in args:\n print(arg)\n print('\\n')", "def print_line():\n print('+ - - - - + - - - - +'),", "def sequential_print_statements():\n pass", "def out(*args):\r\n print(*args)", "def console_print(out, *args, **kwargs):\n const_charset = stream_enco...
[ "0.7003771", "0.6996452", "0.6864809", "0.67389697", "0.6675036", "0.6674195", "0.6670956", "0.6645322", "0.6582603", "0.6571834", "0.6556301", "0.65497273", "0.6515566", "0.6511007", "0.65037435", "0.64908195", "0.64829123", "0.6458268", "0.6438447", "0.64293385", "0.6404028...
0.0
-1
Return a series of spheres centered on the current center of mass with radius decreasing by stepsize. Stop when inner_radius is reached.
def iterate_center_of_mass(sphere, inner_radius, stepsize=0.05, com_kwargs=None): if com_kwargs is None: com_kwargs = {} yield sphere while (sphere.radius > inner_radius): com = sphere.quantities.center_of_mass(**com_kwargs) try: sphere = sphe...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def Icosphere(radius=1.0, center=(0.0, 0.0, 0.0), nsub=3):\n mesh = Icosahedron()\n mesh.clear_data()\n mesh = mesh.subdivide(nsub=nsub)\n\n # scale to desired radius and translate origin\n dist = np.linalg.norm(mesh.points, axis=1, keepdims=True) # distance from origin\n mesh.points = mesh.poin...
[ "0.63789153", "0.6274192", "0.61310375", "0.61086935", "0.6108442", "0.60960174", "0.60567", "0.601587", "0.5988825", "0.5943185", "0.5924592", "0.5862869", "0.58270377", "0.5824245", "0.5806278", "0.5776951", "0.5719401", "0.5662561", "0.56606776", "0.559281", "0.559004", ...
0.75595194
0
Get list of savegame files
def getSaveGames(): dll = ctypes.windll.shell32 buf = ctypes.create_unicode_buffer(ctypes.wintypes.MAX_PATH + 1) try: if dll.SHGetSpecialFolderPathW(None, buf, 0x0005, False): savedir = osp.join(buf.value, "My Games", "Skyrim", "Saves") if not osp.exists(savedir) or not osp.i...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def readPlayerImageFiles(self):\n currentPath = os.path.dirname(os.path.abspath(__file__))\n listOfFileNames=[]\n for i in os.listdir(currentPath):\n if re.match(\"player\\_\\d+\",i): #i.endswith(\".gif\")\n listOfFileNames.append(currentPath+'/'+i)\n return li...
[ "0.7067182", "0.6939934", "0.6672595", "0.6662785", "0.662831", "0.6571709", "0.65469205", "0.6523936", "0.6403642", "0.63961196", "0.6357462", "0.63361794", "0.6335132", "0.6324376", "0.6322563", "0.630025", "0.6292312", "0.6264926", "0.62489045", "0.6243798", "0.6222176", ...
0.7966331
0
Whether to use L2 weight decay for `param_name`.
def _do_use_weight_decay(self, param_name): if not self.weight_decay_rate: return False if self.exclude_from_weight_decay: for r in self.exclude_from_weight_decay: if re.search(r, param_name) is not None: return False return True
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _do_use_weight_decay(self, param_name):\n if self._exclude_from_weight_decay:\n for r in self._exclude_from_weight_decay:\n if re.search(r, param_name) is not None:\n return False\n return True", "def _do_use_weight_decay(self, param_name):\n ...
[ "0.70423925", "0.70372206", "0.6972458", "0.6972458", "0.6972458", "0.6972458", "0.61478865", "0.61143965", "0.60728186", "0.5874968", "0.57316977", "0.5686603", "0.5607701", "0.5540735", "0.5532297", "0.5527218", "0.5491086", "0.5461098", "0.5446388", "0.54453504", "0.544086...
0.70576096
3
Get the variable name from the tensor name.
def _get_variable_name(self, param_name): m = re.match("^(.*):\\d+$", param_name) if m is not None: param_name = m.group(1) return param_name
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def GetTensorName(tensor):\n return _C.GetTensorName(_stringify_tensor(tensor))", "def GetTensorName(tensor):\n return GetTensorNameCC(_stringify_tensor(tensor))", "def named_tensor(self, name):\n return self._tensor_name_to_result[name]", "def get_tensor_name(subgraph, tensor_idx):\n return subg...
[ "0.75244457", "0.749249", "0.7394237", "0.7164717", "0.7080124", "0.6847809", "0.6808347", "0.67888844", "0.6754007", "0.6628649", "0.66107064", "0.64974034", "0.64758366", "0.6414051", "0.6414051", "0.6413587", "0.6413587", "0.6413587", "0.6351056", "0.6344226", "0.63432276"...
0.65315413
11
Whether to use L2 weight decay for `param_name`.
def _do_use_weight_decay(self, param_name): if not self.weight_decay_rate: return False if self.exclude_from_weight_decay: for r in self.exclude_from_weight_decay: if re.search(r, param_name) is not None: return False return True
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _do_use_weight_decay(self, param_name):\n if self._exclude_from_weight_decay:\n for r in self._exclude_from_weight_decay:\n if re.search(r, param_name) is not None:\n return False\n return True", "def _do_use_weight_decay(self, param_name):\n ...
[ "0.70423925", "0.70372206", "0.6972458", "0.6972458", "0.6972458", "0.6972458", "0.61478865", "0.61143965", "0.60728186", "0.5874968", "0.57316977", "0.5686603", "0.5607701", "0.5540735", "0.5532297", "0.5527218", "0.5491086", "0.5461098", "0.5446388", "0.54453504", "0.544086...
0.70576096
2
Get the variable name from the tensor name.
def _get_variable_name(self, param_name): m = re.match("^(.*):\\d+$", param_name) if m is not None: param_name = m.group(1) return param_name
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def GetTensorName(tensor):\n return _C.GetTensorName(_stringify_tensor(tensor))", "def GetTensorName(tensor):\n return GetTensorNameCC(_stringify_tensor(tensor))", "def named_tensor(self, name):\n return self._tensor_name_to_result[name]", "def get_tensor_name(subgraph, tensor_idx):\n return subg...
[ "0.75244457", "0.749249", "0.7394237", "0.7164717", "0.7080124", "0.6847809", "0.6808347", "0.67888844", "0.6754007", "0.6628649", "0.66107064", "0.64974034", "0.64758366", "0.6414051", "0.6414051", "0.6413587", "0.6413587", "0.6413587", "0.6351056", "0.6344226", "0.63432276"...
0.65315413
12
Whether to use L2 weight decay for `param_name`.
def _do_use_weight_decay(self, param_name): if not self.weight_decay_rate: return False if self.exclude_from_weight_decay: for r in self.exclude_from_weight_decay: if re.search(r, param_name) is not None: return False return True
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _do_use_weight_decay(self, param_name):\n if self._exclude_from_weight_decay:\n for r in self._exclude_from_weight_decay:\n if re.search(r, param_name) is not None:\n return False\n return True", "def _do_use_weight_decay(self, param_name):\n ...
[ "0.70423925", "0.70372206", "0.6972458", "0.6972458", "0.6972458", "0.6972458", "0.61478865", "0.61143965", "0.60728186", "0.5874968", "0.57316977", "0.5686603", "0.5607701", "0.5540735", "0.5532297", "0.5527218", "0.5491086", "0.5461098", "0.5446388", "0.54453504", "0.544086...
0.70576096
0
Get the variable name from the tensor name.
def _get_variable_name(self, param_name): m = re.match("^(.*):\\d+$", param_name) if m is not None: param_name = m.group(1) return param_name
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def GetTensorName(tensor):\n return _C.GetTensorName(_stringify_tensor(tensor))", "def GetTensorName(tensor):\n return GetTensorNameCC(_stringify_tensor(tensor))", "def named_tensor(self, name):\n return self._tensor_name_to_result[name]", "def get_tensor_name(subgraph, tensor_idx):\n return subg...
[ "0.75244457", "0.749249", "0.7394237", "0.7164717", "0.7080124", "0.6847809", "0.6808347", "0.67888844", "0.6754007", "0.6628649", "0.66107064", "0.64974034", "0.64758366", "0.6414051", "0.6414051", "0.6413587", "0.6413587", "0.6413587", "0.6351056", "0.6344226", "0.63432276"...
0.65315413
14
Whether to use L2 weight decay for `param_name`.
def _do_use_weight_decay(self, param_name): if not self.weight_decay_rate: return False if self.exclude_from_weight_decay: for r in self.exclude_from_weight_decay: if re.search(r, param_name) is not None: return False return True
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _do_use_weight_decay(self, param_name):\n if self._exclude_from_weight_decay:\n for r in self._exclude_from_weight_decay:\n if re.search(r, param_name) is not None:\n return False\n return True", "def _do_use_weight_decay(self, param_name):\n ...
[ "0.70423925", "0.70372206", "0.6972458", "0.6972458", "0.6972458", "0.6972458", "0.61478865", "0.61143965", "0.60728186", "0.5874968", "0.57316977", "0.5686603", "0.5607701", "0.5540735", "0.5532297", "0.5527218", "0.5491086", "0.5461098", "0.5446388", "0.54453504", "0.544086...
0.70576096
1
Get the variable name from the tensor name.
def _get_variable_name(self, param_name): m = re.match("^(.*):\\d+$", param_name) if m is not None: param_name = m.group(1) return param_name
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def GetTensorName(tensor):\n return _C.GetTensorName(_stringify_tensor(tensor))", "def GetTensorName(tensor):\n return GetTensorNameCC(_stringify_tensor(tensor))", "def named_tensor(self, name):\n return self._tensor_name_to_result[name]", "def get_tensor_name(subgraph, tensor_idx):\n return subg...
[ "0.75244457", "0.749249", "0.7394237", "0.7164717", "0.7080124", "0.6847809", "0.6808347", "0.67888844", "0.6754007", "0.6628649", "0.66107064", "0.64974034", "0.64758366", "0.6414051", "0.6414051", "0.6413587", "0.6413587", "0.6413587", "0.6351056", "0.6344226", "0.63432276"...
0.65315413
15
Decorator that creates command out of function definition.
def generic_command(replace_name: Optional[str] = None, default_parser: Callable[[Any], str] = default_parser, arg_parsers: Optional[Dict[str, Callable[[Any], str]]] = None, ignore_args: Optional[List[str]] = None, add_class_name: bool = Tr...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def command(func: 'function') -> 'function':\n func._decorators = (Bot.command,)\n return func", "def command(self, function=None, prefix=None):\n def _command(func):\n captured_f = self.capture(func, prefix=prefix)\n self.commands[func.__name__] = captured_f\n ...
[ "0.8092421", "0.7569025", "0.7526286", "0.7378395", "0.7354148", "0.73233855", "0.7297695", "0.72684866", "0.72678035", "0.7260316", "0.72071135", "0.71917653", "0.71703213", "0.7100008", "0.7096345", "0.7083381", "0.7083381", "0.70739347", "0.700642", "0.6956643", "0.6945057...
0.6392908
42
activet the sensor with sensor index This function activates a specific sensor having a matched sensor index among multiple sensors if there are multiple sensors in system. \brief Activate a specific sensor This function activates a specific sensor having a matched sensor index among multiple sensors if there are multi...
def index_activation(pSpecDevice, sensor_index): ret = pSpecDevice.duActivateSensorWithIndex(sensor_index) if ret <=0: print ("[PythonPrismError] Activating Sensor with Index failed!") return -1; else: print ("[PythonPrism] Successfully Activated the sesnor with specific in...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def activate_item(self, index):\n item = index.model().listdata[index.row()]\n self.get_selected(item)\n self.controller.display_item(item)", "def activate(self):\n super(ActiveIndexedComponent, self).activate()\n if self.is_indexed():\n for component_data in iterval...
[ "0.5475209", "0.5446762", "0.5374098", "0.52927256", "0.5236261", "0.517365", "0.4991842", "0.49528223", "0.4937684", "0.4916082", "0.4858801", "0.48299465", "0.47647876", "0.47303236", "0.47166547", "0.47158837", "0.4614805", "0.4611197", "0.45979622", "0.45724156", "0.45665...
0.8379042
0
Verify the Jenkins Config History plugin has been configured properly.
def test_job_config_history(self): self.config_page.visit() self.config_page.expand_advanced() assert self.job_config_history['HISTORY_ROOT_DIR'] == self.config_page.get_history_root_dir() assert self.job_config_history['MAX_HISTORY_ENTRIES'] == self.config_page.get_max_history_entries()...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _check_config(self):", "def check_configs(self):\n\n pass", "def check_config():\n\n if not config_instance:\n LOG.error(\"Failed to load the config!\")\n sys.exit(9)\n\n if not hasattr(config_instance, \"CONFIG_VERSION\"):\n LOG.warning( \"The config file does not specify...
[ "0.6823133", "0.67036337", "0.6660288", "0.66462886", "0.6567653", "0.63230246", "0.629709", "0.6247693", "0.62097293", "0.61033195", "0.6071187", "0.6071187", "0.6033012", "0.5999714", "0.5996398", "0.5953271", "0.59522414", "0.5932529", "0.5889813", "0.58763665", "0.5860229...
0.7349895
0
Constructs a feature generator
def __init__(self): self.check_nans = False self.debug_force_memmap = False # Implementations must initialise the dtype so that feature arrays can be created with correct type: self.dtype = None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def construct_feature_generator(feature_strs):\n feature_fns = [FEATURE_MAP[s] for s in feature_strs]\n\n def _feature_generator(data, *args, **kwargs):\n features = [np.concatenate([subfeature.ravel() for subfeature in feature_fn(data, *args, **kwargs)]) for feature_fn in feature_fns]\n return...
[ "0.7065937", "0.7005653", "0.6622074", "0.66030973", "0.65595263", "0.65545934", "0.65325284", "0.64558053", "0.64257246", "0.63655734", "0.6349132", "0.62923414", "0.6278311", "0.62748533", "0.6227061", "0.62244236", "0.6219891", "0.6205227", "0.6188998", "0.61826247", "0.61...
0.0
-1
Saves a 'allbatteriesincluded' feature generator at a given path (folder)
def save(self, path: str): os.makedirs(path, exist_ok=True) frozen = encode_indent(self) lprint(f"Saving feature generator to: {path}") with open(join(path, "feature_generation.json"), "w") as json_file: json_file.write(frozen) return frozen
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save_features_to_file(self):\n if not os.path.exists(self.features_save_path):\n os.makedirs(self.features_save_path)\n for s in self.sets:\n self.save_features_to_file_by_set(s)", "def save(self, folder):\n self.generator.save_weights('%s/generator.h5'%folder)\n ...
[ "0.6550367", "0.63035154", "0.62864685", "0.6070348", "0.60682887", "0.6041556", "0.5851316", "0.57868385", "0.5766876", "0.57223296", "0.56905526", "0.56848353", "0.56739694", "0.5669084", "0.5645307", "0.5645307", "0.5635035", "0.56290305", "0.5603846", "0.55711997", "0.553...
0.6561969
0
Returns a 'allbatteriesinlcuded' feature generator from a given path (folder)
def load(path: str): lprint(f"Loading feature generator from: {path}") with open(join(path, "feature_generation.json"), "r") as json_file: frozen = json_file.read() thawed = jsonpickle.decode(frozen) thawed._load_internals(path) return thawed
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_features(feature_path):\n if not os.path.exists(os.path.join(feature_path, f\"0_features.npy\")): \n raise ValueError(f\"The provided location {feature_path} does not contain any representation files\")\n\n ds_list, chunk_id = [], 0\n while os.path.exists(os.path.join(feature_path, f\"{chu...
[ "0.56279373", "0.5607112", "0.55230314", "0.5483209", "0.53291225", "0.53291225", "0.53084856", "0.5268843", "0.5251109", "0.52350736", "0.52210736", "0.5193332", "0.5169473", "0.5160666", "0.5146863", "0.51414", "0.5139911", "0.5139759", "0.51297855", "0.5125928", "0.5121712...
0.5089232
22
Returns the receptive field radius in pixels
def get_receptive_field_radius(self): raise NotImplementedError()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def estimate_radius(self):\n red = self.T[:,:,0] # empirically, the most reliable channel\n\n eye_radius = red.sum(axis=1).max() / 2\n return eye_radius", "def get_receptive_field_radius(self) -> int:\n\n receptive_field_radius = 0\n for feature_group in self.features_group_lis...
[ "0.76650316", "0.7617731", "0.7569536", "0.75477064", "0.730754", "0.72716415", "0.7263465", "0.72270113", "0.72229064", "0.72219", "0.72117025", "0.71374255", "0.71154857", "0.71154857", "0.71154857", "0.71154857", "0.71154857", "0.7106693", "0.71053755", "0.7082142", "0.708...
0.7922638
0
Computes the features given an image. If the input image is of shape (d,h,w), resulting features are of shape (n,d,h,w) where n is the number of features.
def compute( self, image, exclude_center_feature: bool = False, exclude_center_value: bool = False, features: ndarray = None, feature_last_dim: bool = True, passthrough_channels: Optional[Tuple[bool]] = None, num_reserved_features: int = 0, exclude...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_features(image, features, gparams, fg_size):\n import numpy as np\n from get_hog import get_hog\n\n if len(image.shape) == 2:\n image = image.reshape([image.shape[0], image.shape[1], 1])\n\n if len(image.shape) == 3:\n [im_height, im_width, num_im_chan] = image.shape\n num_...
[ "0.76855665", "0.7230327", "0.71915025", "0.7156839", "0.7148146", "0.714419", "0.7137311", "0.71207803", "0.7114263", "0.70311654", "0.69543415", "0.69309753", "0.6880886", "0.6876123", "0.6826729", "0.67420065", "0.6730815", "0.6714536", "0.6709948", "0.6693498", "0.6687064...
0.0
-1
Creates a feature array of the right size and possibly in a 'lazy' way using memory mapping.
def create_feature_array(self, image, nb_features): with lsection(f'Creating feature array for image of shape: {image.shape}'): # That's the shape we need: shape = (nb_features, image.shape[0]) + image.shape[2:] dtype = image.dtype if self.dtype is None else self.dtype ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def memmap_feats(features):\n features = np.array(features)\n dtype = features.dtype\n feats_shape = features.shape\n\n outfile = TemporaryFile()\n fp = np.memmap(outfile, dtype=dtype, mode='w+', shape=feats_shape)\n fp[:] = features[:]\n fp.flush()\n del features\n del fp\n logging.i...
[ "0.6230521", "0.6202618", "0.5860363", "0.5834283", "0.57285964", "0.57285964", "0.5699803", "0.565439", "0.55717295", "0.5529149", "0.54918015", "0.5489064", "0.5474994", "0.5464324", "0.5447807", "0.5440975", "0.54392403", "0.54379714", "0.5425065", "0.53975654", "0.5385166...
0.66130865
0
Same as process in worker
def eval(self, sess, num_episodes=200): logger.info("Start eval policy") sess.run(self.sync) # copy weights from shared to local # Run an episode #for _ in range(num_episodes): # pass done = False last_state = self.env.reset() #last_features = self.p...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _worker(self, args):\n pass", "def process():\n pass", "def process():", "def _StartWorkerProcess(self, process_name):", "def do_work(self):", "def process_thread(self):", "def docker_worker():", "def main() -> None:\n worker = Worker()\n worker.do_work()", "def process(self):\n...
[ "0.7672062", "0.73389775", "0.7315635", "0.72968554", "0.7037058", "0.70256454", "0.6964473", "0.6929028", "0.6897743", "0.6897073", "0.68221366", "0.6765532", "0.6765532", "0.6765532", "0.66941804", "0.6612123", "0.65632576", "0.65393066", "0.6529271", "0.6508273", "0.649180...
0.0
-1
Tensorflow for monitoring trained policy
def main(_): args = HParams spec = cluster_spec(args.num_workers, 1) cluster = tf.train.ClusterSpec(spec).as_cluster_def() def shutdown(signal, frame): logger.warn('Received signal %s: exiting', signal) sys.exit(128+signal) signal.signal(signal.SIGHUP, shutdown) signal.signal(...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, env, task, visualise,record = False):\n\n self.env = env\n self.task = task\n worker_device = \"/job:worker/task:{}/cpu:0\".format(task)\n with tf.device(tf.train.replica_device_setter(1, worker_device=worker_device)):\n with tf.variable_scope(\"global\"):\...
[ "0.67439765", "0.66909194", "0.6592112", "0.6452863", "0.6382239", "0.6316095", "0.630651", "0.6278101", "0.62772006", "0.6261835", "0.62309563", "0.62138945", "0.6196782", "0.61940974", "0.61904985", "0.61813486", "0.6171826", "0.6158264", "0.6102216", "0.6101969", "0.608815...
0.0
-1
Decides if there is a majority element
def naive_majority(voters): half = len(voters)//2 for index, voter in enumerate(voters): count = 0 for other_voter in voters: if voter == other_voter: count += 1 if count > half: return Outcome.has_majority return Outcome.no_majority
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def majority_element(arr):\n count = 0\n possible_majority = arr[0]\n for elem in arr:\n if count == 0:\n possible_majority = elem\n if elem == possible_majority:\n count += 1\n else:\n count -= 1\n\n return validate_majority(arr, possible_majority)...
[ "0.78945804", "0.7498133", "0.7430315", "0.7224675", "0.71783185", "0.717191", "0.71492034", "0.7123453", "0.70309395", "0.6962388", "0.691895", "0.68667895", "0.6787631", "0.67498225", "0.6609209", "0.6581515", "0.6581342", "0.6574731", "0.65429467", "0.6477543", "0.64475876...
0.72392845
3
Decides if there is a majority among the votes
def iterative_majority(votes): half = len(votes)//2 counts = defaultdict(lambda: 0) for vote in votes: counts[vote] += 1 sorted_counts = sorted((count for count in counts.values()), reverse=True) return (Outcome.has_majority if sorted_counts[0] > half else Outcome.no_majority)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def majority_vote(votes):\n import scipy.stats as ss\n mode, count = ss.mstats.mode(votes)", "def naive_majority(voters):\n half = len(voters)//2\n for index, voter in enumerate(voters):\n count = 0\n for other_voter in voters:\n if voter == other_voter:\n coun...
[ "0.8047089", "0.78859496", "0.7793428", "0.7649061", "0.759137", "0.7395394", "0.7320145", "0.7288646", "0.72348565", "0.71879995", "0.6928337", "0.67314535", "0.6582607", "0.65114915", "0.6500682", "0.6484041", "0.6430799", "0.6409211", "0.6389137", "0.63407356", "0.63311565...
0.7945168
1
Decides if there is a majority among the votes
def iterative_majority_two(votes): half = len(votes)//2 counts = defaultdict(lambda: 0) for vote in votes: counts[vote] += 1 for count in counts.values(): if count > half: return Outcome.has_majority return Outcome.no_majority
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def majority_vote(votes):\n import scipy.stats as ss\n mode, count = ss.mstats.mode(votes)", "def iterative_majority(votes):\n half = len(votes)//2\n counts = defaultdict(lambda: 0)\n for vote in votes:\n counts[vote] += 1\n\n sorted_counts = sorted((count for count in counts.values()), ...
[ "0.8047089", "0.7945168", "0.78859496", "0.7793428", "0.7649061", "0.759137", "0.7395394", "0.7288646", "0.72348565", "0.71879995", "0.6928337", "0.67314535", "0.6582607", "0.65114915", "0.6500682", "0.6484041", "0.6430799", "0.6409211", "0.6389137", "0.63407356", "0.63311565...
0.7320145
7
Returns a list of merged variant(s) from the provided `variants`.
def get_merged_variants(self, variants, key): # type: (List[vcfio.Variant], str) -> List[vcfio.Variant] raise NotImplementedError
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def exclude_duplicates(self, variants):\n \n unique_vars = {}\n for variant in variants:\n key = variant[0].child.get_key()\n if key not in unique_vars:\n unique_vars[key] = list(variant)\n else:\n result = variant[1]\n ...
[ "0.657678", "0.6056205", "0.59043044", "0.5827425", "0.5802855", "0.5766344", "0.55869615", "0.5510106", "0.5472591", "0.53676164", "0.53660834", "0.53125113", "0.5301464", "0.5296049", "0.5262057", "0.525347", "0.5252048", "0.5224145", "0.52215767", "0.5197025", "0.51750356"...
0.74890333
0
Returns a generator of keys (str) used for merging variants.
def get_merge_keys(self, variant): # type: (vcfio.Variant) -> Iterable[str] raise NotImplementedError
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def gen_keys():", "async def keys(self) -> Iterable[str]:", "def random_keys(self):\n while True:\n yield self.generator.str()", "def keys(self) -> Sequence[str]:\n raise NotImplementedError", "def gen_decomp_keys(self, decomp_list):\n for key in decomp_list:\n if...
[ "0.6789153", "0.6568766", "0.6476109", "0.64546305", "0.6377591", "0.62587345", "0.62532", "0.6250463", "0.62424064", "0.62237823", "0.6207848", "0.6157455", "0.610816", "0.60871756", "0.6028108", "0.601163", "0.59775627", "0.59563607", "0.5953673", "0.59474635", "0.59450173"...
0.6784472
1
Optionally modifies the bigquery schema based on merging logic.
def modify_bigquery_schema(self, schema, info_keys): # type: (bigquery.TableSchema, Set[str]) -> None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def merge_schema(self, schema):\n self.validate_schema(schema)\n\n if self.exclusive is False:\n self.exclusive = schema.exclusive\n\n if self.default is None:\n self.default = schema.default", "def merge_schema(first, second):\n if not (type(first) == type(second) =...
[ "0.6379471", "0.6048851", "0.59542614", "0.59007806", "0.5778663", "0.5664556", "0.5654739", "0.5611729", "0.5603805", "0.5579028", "0.5564193", "0.54974824", "0.54887533", "0.5486523", "0.5463733", "0.54462385", "0.5430294", "0.54173553", "0.5397434", "0.5388764", "0.5323661...
0.6154523
1
Creates a SkyScanner object with default country, currency, and local which can be changed as necessary. In addition, a requests session is made.
def __init__(self, originCountry = "US", currency = "USD", locale="en-US"): self.originCountry = originCountry self.currency = currency self.locale = locale self.rootURL = "https://skyscanner-skyscanner-flight-search-v1.p.rapidapi.com" #path to the API self.airports = {} ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _scan(self):\n\n return self._scan_factory.make_scan(\n image_range=(1, 1),\n # dummy value--return to this later please\n exposure_time=1,\n oscillation=(\n self.detectorbase.osc_start,\n self.detectorbase.osc_start + self.detect...
[ "0.47756967", "0.47718138", "0.4711326", "0.47016704", "0.46773443", "0.4665861", "0.46638766", "0.46559757", "0.46452054", "0.46146983", "0.45960456", "0.45547736", "0.45530304", "0.45436147", "0.45220035", "0.45085174", "0.44786787", "0.44782293", "0.44725567", "0.44702947", ...
0.6197627
0
Gets the quotes for two specific dates. Only for 1way trips. Returns both 1) quotes in JSON format and 2) a dict of airport_code > airport_name
def get_quotes_oneway(self, source, destination, outboundDate): quoteRequestPath = "/apiservices/browsequotes/v1.0/" browseQuotesURL = self.rootURL + quoteRequestPath + self.originCountry + "/" + self.currency + "/" + self.locale + "/" + source + "/" + destination + "/" + outboundDate + "/" resp...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_quotes(scanner: SkyScanner, start, end, start_date, entire_month=\"false\"):\n all_quotes = []\n if entire_month == \"false\":\n quotes, airports = scanner.get_quotes_oneway(start, end, start_date)\n else:\n start_date = start_date.split(\"-\")[0] + \"-\" + start_date.split(\"-\")[1]...
[ "0.59062976", "0.56777614", "0.53988975", "0.53696054", "0.5356138", "0.5263399", "0.5209945", "0.5087088", "0.50474745", "0.49753934", "0.49591064", "0.49152985", "0.49046555", "0.48815036", "0.48767883", "0.48675764", "0.4862268", "0.48283228", "0.4813378", "0.4811284", "0....
0.6263273
0
Returns places that match a specific search query. Can choose to exclude countries or cities. Airports are always returned.
def search_places(self, search, country="True", city="True"): params = {} params["query"] = search params["includeCities"] = city params["includeCountries"] = country placeRequestPath = "/apiservices/autosuggest/v1.0/" browsePlacesURL = self.rootURL + placeRequestPath + s...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def search():\n\n # Store the 'q' part of the URL as a string called 'q'. Check 'q' loaded, and produce runtime error if not.\n # e.g. '12589'\n q = request.args.get(\"q\")\n if not q:\n raise RuntimeError(\"missing location\")\n\n # Rewrites user input as lowercase\n q = str.lower(q)\n\n ...
[ "0.7065333", "0.6633748", "0.6569348", "0.6467306", "0.64596575", "0.63857245", "0.6306432", "0.62548643", "0.61801684", "0.6125794", "0.61072093", "0.60262483", "0.59899133", "0.595883", "0.59574234", "0.5949816", "0.5907867", "0.58415496", "0.58353376", "0.5792506", "0.5788...
0.66791874
1
Returns an array of all currencies supported. USD, EUR, GPD are the first three
def get_currencies(): here = os.path.dirname(os.path.abspath(__file__)) data_path = os.path.join(here, "currencies.json") with open(data_path) as f: data = json.load(f) curr_array = [0] * 152 #152 total currenies for i in range(152): curr_array[i] = data['Currencies'][i] #move t...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getCurrencies():", "def get_available_currencies(self):\n auth = self.get_auth()\n currencies = []\n content = self._get_response(\n self.CURRENCY_URL,\n auth=auth\n )\n for option in content:\n currency = Currency.objects.get_or_create(\n ...
[ "0.78752357", "0.78289694", "0.7737017", "0.75819105", "0.7483928", "0.7443427", "0.7427704", "0.726445", "0.7226797", "0.7215208", "0.71014035", "0.7029238", "0.7019046", "0.69235307", "0.69143134", "0.68932337", "0.68323815", "0.66850317", "0.66620195", "0.6617729", "0.6607...
0.6035779
34
Take user input and convert to location code which can be used in the API
def get_location_codes(scanner, input): matches = scanner.search_places(input) codes = [] for i in matches["Places"]: codes.append(i["PlaceId"]) return codes
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fix_location(in_text):\n prompt = ConversionPrompt(\n 'I', 'O',\n (\"lenox ma\", \"Lenox, MA\"),\n (\"london\", \"London, U.K.\"),\n (\"chicago\", \"Chicago, IL\"),\n (\"dallas, tx\", \"Dallas, TX\"),\n engine='babbage'\n )\n return prompt.convert(in_text)", ...
[ "0.63323337", "0.6314674", "0.6286337", "0.6201499", "0.62010175", "0.61455065", "0.6139045", "0.6139045", "0.6139045", "0.6103889", "0.6093175", "0.6085588", "0.60730654", "0.60516274", "0.6015908", "0.5972379", "0.59678656", "0.59480083", "0.59207165", "0.5851892", "0.58478...
0.62245744
3
Returns the cheapest quote and then all other quotes given the params and a scanner object
def get_quotes(scanner: SkyScanner, start, end, start_date, entire_month="false"): all_quotes = [] if entire_month == "false": quotes, airports = scanner.get_quotes_oneway(start, end, start_date) else: start_date = start_date.split("-")[0] + "-" + start_date.split("-")[1] quotes, air...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def first_inside_quotes(s):\n\n assert type(s) == str, repr(s)+' is not a string.'\n assert introcs.count_str(s,'\"') >= 2, repr(s)+' needs two \"\" characters.'\n\n #find first double quotation\n\n first = introcs.find_str(s,'\"')\n #print(first)\n #find second double quotation\n\n second = i...
[ "0.58224344", "0.5512561", "0.50302064", "0.48981693", "0.48731175", "0.47719675", "0.47137618", "0.4713489", "0.46993667", "0.4697319", "0.46878594", "0.46744052", "0.46669102", "0.46645442", "0.46498346", "0.45787597", "0.45504197", "0.45458466", "0.4529796", "0.45278853", ...
0.5722081
1
The initialization function. Besides saving attributes we also need to create the policy network in Tensorflow that later will be used.
def __init__(self, tf_session, state_size=(4,), action_size=2, learning_rate=1e-3, gamma=0.99, memory_size=5000): n_hidden = 4 n_outputs = action_size initializer = tf.contrib.layers.variance_scaling_initializer() self.state_size = state_size self.action_size =...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initialize_network(self):\n self.sess = tf.InteractiveSession()\n sys.stderr.write(\"------\\n\")\n self.model.create_model()\n self._initialize_trainer()\n self.sess.run(tf.initialize_all_variables())\n self.saver = tf.train.Saver()", "def initialisation(self):\n ...
[ "0.7637311", "0.75570047", "0.74034977", "0.7363583", "0.72185636", "0.7145868", "0.71032405", "0.70255864", "0.6935355", "0.69153196", "0.68670785", "0.6762694", "0.6728638", "0.6719373", "0.66964704", "0.66727585", "0.66572976", "0.66493297", "0.66432375", "0.6633739", "0.6...
0.0
-1
Given the current state sample an action from the policy network. Return a the index of the action [0..N).
def take_action(self, state): action = self.tf_sess.run(self.sample, feed_dict={self.X: state.reshape(1, len(state))}) return action
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def select_action(self, state):\n\t\treturn sample(range(0, self.action_space), 1)[0]", "def get_action(self, state):\n if np.random.rand() <= self.epsilon:\n action_idx = random.randrange(self.action_size)\n else:\n \n # Use all traces for RNN\n #q = self.model.pr...
[ "0.7715992", "0.76681644", "0.74845713", "0.7317097", "0.71172917", "0.7105228", "0.70912486", "0.7057842", "0.70544374", "0.70031416", "0.69955885", "0.6986513", "0.6960665", "0.6937768", "0.6922736", "0.69145274", "0.690203", "0.68946403", "0.68931156", "0.684575", "0.68448...
0.65601355
39
Train the policy network using the collected experiences during the episode(s).
def train_agent(self): # Retrieve collected experiences from memory experiences = np.array(self.replay.get_all()) # rewards = np.array([h['reward'] for h in experiences]) #rewards = experiences[:,2] rewards = np.array([r[2] for r in experiences]) # Discount and normalize ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def train(self, env):\n\n\t\tmin_average_reward_for_stopping = 195\n\t\tconsecutive_successful_episodes_to_stop = 10\n\t\tlast_10_rewards = deque(maxlen=consecutive_successful_episodes_to_stop)\n\n\t\tnum_Episodes = []\n\t\tEpisode_Rewards = []\n\n\t\tfor episode in range(self.episodes):\n\t\t\tstate = env.reset()...
[ "0.7571355", "0.73662174", "0.7365849", "0.7270195", "0.7265887", "0.71922773", "0.7191969", "0.7185173", "0.716789", "0.7138937", "0.7132511", "0.71263695", "0.7119303", "0.7110821", "0.7008673", "0.6987574", "0.6936", "0.69279706", "0.6918577", "0.6911287", "0.6890119", "...
0.77739614
0
Given the rewards for an epsiode discount them by gamma. Next since we are sending them into the neural network they should have a zero mean and unit variance. Return the new list of discounted and normalized rewards.
def discount_rewards_and_normalize(self, rewards): discounted_rewards = np.empty(len(rewards)) cumulative_rewards = 0 for step in reversed(range(len(rewards))): cumulative_rewards = rewards[step] + cumulative_rewards * self.gamma discounted_rewards[step] = cumulative_rew...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def compute_discounted_rewards(self, rewards):\n discounted_rewards = []\n for t in range(len(rewards)):\n Gt = 0\n pw = 0\n for r in rewards[t:]:\n Gt = Gt + self.gamma ** pw * r\n pw = pw + 1\n discounted_rewards.append(Gt)\n...
[ "0.78813607", "0.7818528", "0.77405256", "0.75703305", "0.7485824", "0.7371996", "0.7272344", "0.7100034", "0.7099121", "0.7018618", "0.6907162", "0.6857457", "0.67791605", "0.6755919", "0.67452127", "0.6703027", "0.66754395", "0.6652472", "0.6647539", "0.6635979", "0.6612237...
0.77522385
2
QRectF.adjust(float, float, float, float)
def adjust(self, p_float, p_float_1, p_float_2, p_float_3): # real signature unknown; restored from __doc__ pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def adjusted(self, p_float, p_float_1, p_float_2, p_float_3): # real signature unknown; restored from __doc__\r\n return QRectF", "def paintEvent(self, e):\r\n self.adjustToView()\r\n return super().paintEvent(e)", "def setRect(self, *args):\n if len(args) == 0:\n self.re...
[ "0.75226665", "0.6427346", "0.62660956", "0.6047131", "0.59840167", "0.5973623", "0.59394455", "0.59227055", "0.5917059", "0.58711326", "0.58567405", "0.5856231", "0.58310854", "0.58018637", "0.58018637", "0.58012", "0.5753968", "0.57334626", "0.56727767", "0.56608933", "0.56...
0.0
-1
QRectF.adjusted(float, float, float, float) > QRectF
def adjusted(self, p_float, p_float_1, p_float_2, p_float_3): # real signature unknown; restored from __doc__ return QRectF
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def boundingRect(self) -> QRectF:\n return self._rect.adjusted(-10, -10, 10, 10)", "def boundingRect(self):\n return QRectF()", "def boundingRect(self):\n extra = self._halfLength / 2.0\n return QRectF(self._origin, QSizeF(self._end.x() - self._origin.x(),\n ...
[ "0.7523984", "0.7407381", "0.6920634", "0.68608844", "0.6679734", "0.6560438", "0.64691794", "0.6168941", "0.59401673", "0.5911161", "0.5906248", "0.5896799", "0.58789915", "0.5817213", "0.57800424", "0.5741719", "0.57302284", "0.57062167", "0.563075", "0.56293607", "0.561055...
0.82418644
0
QRectF.contains(QPointF) > bool QRectF.contains(QRectF) > bool QRectF.contains(float, float) > bool
def contains(self, *__args): # real signature unknown; restored from __doc__ with multiple overloads return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __contains__(self, item: 'BoundingBox2D') -> bool:\n top_left_inside = item.xmin >= self.xmin and item.ymin >= self.ymin\n bottom_right_inside = item.xmax <= self.xmax and item.ymax <= self.ymax\n return top_left_inside and bottom_right_inside", "def contains(self, Union, QPointF=None, Q...
[ "0.7023224", "0.6964382", "0.6639134", "0.6616067", "0.6616067", "0.66096723", "0.6598423", "0.6598423", "0.65199876", "0.64801264", "0.6476461", "0.6441724", "0.64372414", "0.6389606", "0.63867176", "0.6375359", "0.6365074", "0.6354819", "0.63270384", "0.62823135", "0.623226...
0.0
-1
QRectF.getCoords() > (float, float, float, float)
def getCoords(self): # real signature unknown; restored from __doc__ pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_box_coordinates(self):\n return QRect(self.box_begin,self.box_end)", "def getRect(self): # real signature unknown; restored from __doc__\r\n pass", "def coordinates(self):", "def boundingRect(self):\n return QRectF()", "def get_pos(self) -> tuple:\n return self.rect....
[ "0.7368357", "0.66639704", "0.66209674", "0.65601283", "0.64767325", "0.64313006", "0.64045686", "0.63729024", "0.6357421", "0.6334392", "0.6302994", "0.6292692", "0.62892866", "0.6275379", "0.6220668", "0.62196934", "0.61438215", "0.6137749", "0.6102628", "0.60969114", "0.60...
0.6971415
1
QRectF.getRect() > (float, float, float, float)
def getRect(self): # real signature unknown; restored from __doc__ pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def boundingRect(self):\n return QRectF()", "def getRect(self):\n return self.rect()", "def getRect(self):\n return self.rect", "def get_view_rect(self) -> core.QRect:\n r = core.QRectF(self.rect())\n return self.viewportTransform().inverted()[0].mapRect(r)", "def get_box...
[ "0.7405999", "0.7291851", "0.7247606", "0.7115561", "0.705903", "0.70336133", "0.70179623", "0.6998176", "0.6907978", "0.6870234", "0.6763795", "0.6759248", "0.67521775", "0.66974133", "0.66245663", "0.6588025", "0.6582874", "0.657484", "0.65584433", "0.65322214", "0.65298295...
0.7626621
0
QRectF.setCoords(float, float, float, float)
def setCoords(self, p_float, p_float_1, p_float_2, p_float_3): # real signature unknown; restored from __doc__ pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setRect(self, *args):\n if len(args) == 0:\n self.resetTransform() # reset scaling and rotation when called without argument\n return\n if isinstance(args[0], (QtCore.QRectF, QtCore.QRect)):\n rect = args[0] # use QRectF or QRect directly\n else:\n ...
[ "0.759322", "0.72502685", "0.69142467", "0.66767424", "0.64047873", "0.6392438", "0.63724905", "0.63593864", "0.63569313", "0.63453287", "0.63399667", "0.63181597", "0.6286654", "0.62714994", "0.6266786", "0.6238682", "0.620199", "0.613037", "0.60969216", "0.6092151", "0.6081...
0.65980357
4
QRectF.setRect(float, float, float, float)
def setRect(self, p_float, p_float_1, p_float_2, p_float_3): # real signature unknown; restored from __doc__ pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setRect(self, *args):\n if len(args) == 0:\n self.resetTransform() # reset scaling and rotation when called without argument\n return\n if isinstance(args[0], (QtCore.QRectF, QtCore.QRect)):\n rect = args[0] # use QRectF or QRect directly\n else:\n ...
[ "0.811456", "0.72924024", "0.6899937", "0.67006505", "0.66871715", "0.6679867", "0.66333675", "0.66026175", "0.65830314", "0.6501076", "0.6378331", "0.63138497", "0.6312193", "0.6284299", "0.62495655", "0.6125737", "0.6122323", "0.6093273", "0.60838044", "0.6054471", "0.60270...
0.77824867
1
QRectF.translated(float, float) > QRectF QRectF.translated(QPointF) > QRectF
def translated(self, *__args): # real signature unknown; restored from __doc__ with multiple overloads return QRectF
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def adjusted(self, p_float, p_float_1, p_float_2, p_float_3): # real signature unknown; restored from __doc__\r\n return QRectF", "def updatePosition(self, scene):\n pos0 = scene.posFromLonLat(self._lon0, self._lat0)\n pos1 = scene.posFromLonLat(self._lon1, self._lat1)\n\n self.prepar...
[ "0.68442065", "0.5737175", "0.5611309", "0.5594033", "0.5561529", "0.55589247", "0.54844475", "0.5468499", "0.54548025", "0.541805", "0.53979594", "0.53938884", "0.53861076", "0.5311449", "0.52604544", "0.52604544", "0.5161839", "0.51586455", "0.5154933", "0.51431406", "0.512...
0.7493262
0
x.__contains__(y) y in x
def __contains__(self, y): # real signature unknown; restored from __doc__ pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __contains__(self, x):\n return x in (v for v, _ in self)", "def __contains__(self, x):\n return x in (v for v, _ in self)", "def contains(cls, lhs, rhs):\n return rhs in lhs", "def contains(s1, s2):\n\n return s2 in s1", "def __contains__(self, v):\n for i in self:\n ...
[ "0.8438303", "0.8438303", "0.7765183", "0.75777864", "0.7557874", "0.75052977", "0.7409693", "0.72703457", "0.7190018", "0.7146586", "0.71316844", "0.7131541", "0.7115832", "0.7096226", "0.7084637", "0.70719075", "0.7064072", "0.70213836", "0.7005326", "0.6979342", "0.6943806...
0.7228764
8
x.__nonzero__() x != 0
def __nonzero__(self): # real signature unknown; restored from __doc__ pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __nonzero__(self):\n for e in self:\n if e != 0:\n return True\n return False", "def __nonzero__(self):\n return self.value.__nonzero__()", "def __nonzero__(self):\n return self.__nonzero", "def __nonzero__(self):\n return self.__nonzero", "def _...
[ "0.77507436", "0.76362675", "0.74977964", "0.74977964", "0.749715", "0.7277969", "0.71057385", "0.70980686", "0.7076215", "0.7038673", "0.7013006", "0.69773006", "0.6971467", "0.69356734", "0.6927782", "0.6920768", "0.690163", "0.6892301", "0.6864851", "0.6852248", "0.6836008...
0.62630165
66
Builds up the SoundNet model and loads the weights from a given model file (8layer model is kept at models/sound8.npy).
def build_model(): model_weights = np.load(WEIGHTS_PATH, encoding='latin1').item() model = Sequential() model.add(InputLayer(batch_input_shape=(1, None, 1))) filter_parameters = [ {'name': 'conv1', 'num_filters': 16, 'padding': 32, 'kernel_size': 64, 'conv_strides': 2, 'pool_s...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_weights(self, model_file):\n if not self.encoder_decoder:\n raise TypeError('You need to build a model using the method '\n '`build_model` before trying to load an already '\n 'trained one.')\n self.encoder_decoder.load_weights...
[ "0.66504765", "0.6607584", "0.65316325", "0.64626664", "0.6456177", "0.6368297", "0.63454306", "0.63360137", "0.6319556", "0.6305303", "0.6294995", "0.6294981", "0.6262272", "0.62598294", "0.62332153", "0.6224671", "0.621389", "0.6212194", "0.6205", "0.6192347", "0.6184388", ...
0.61878854
20
Get mobilenet_v3 large model
def get_mobilenet_v3(model_name:str, pretrained=True, **kwargs) -> nn.Module: mbconfig = partial(MBConvConfig, depth_mult=1.0, width_mult=1.0, norm_layer=nn.BatchNorm2d, se_act2=partial(nn.Hardsigmoid, inplace=True), se_reduction_ratio=4, se_reduce_mode='adjust') if model_name == 'mobil...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mobilenet_v3_large(pretrained: bool = False, include_top: bool = False, freeze: bool = False):\n model = torchvision.models.mobilenet_v3_large(pretrained)\n if freeze:\n set_parameter_requires_grad(model, \"classifier\")\n if not include_top:\n output_size = model.classifier[0].in_featur...
[ "0.73536885", "0.72899085", "0.71932006", "0.7060566", "0.6891054", "0.6839438", "0.6653818", "0.65547043", "0.64544296", "0.64085776", "0.63266057", "0.63144726", "0.6296878", "0.6257561", "0.62444127", "0.6231361", "0.619437", "0.6168173", "0.61530125", "0.6107736", "0.6062...
0.7593799
0
Initialize the runner, optionally with text to validate. (If not a string, it must be an OrderedDict, ideally straight out of the parser.)
def __init__(self, text: Union[str, Text, None] = None): if isinstance(text, str): text = TNTParser().parse(text) if text is not None: self.text = text
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def validate(self, text: Union[str, Text, None] = None) -> None:\n text = text or self.text\n if isinstance(text, str):\n text = TNTParser().parse(text)\n if text is not None:\n self.text = text\n try:\n for i, (lineno, line) in enumerate(text.items()):\...
[ "0.5885243", "0.57479566", "0.5742945", "0.57244945", "0.5588444", "0.558445", "0.5526332", "0.5523798", "0.5482151", "0.5470329", "0.54604083", "0.54574263", "0.54541725", "0.5433209", "0.5433209", "0.5429169", "0.54059213", "0.54005533", "0.5378159", "0.5374998", "0.5370741...
0.645403
0
Validates the OrderedDict of line numbers to TNT statements. If no issues, returns None. Otherwise, raises an exception tailored to the rule. ``text`` can be set at initialization or passed at call.
def validate(self, text: Union[str, Text, None] = None) -> None: text = text or self.text if isinstance(text, str): text = TNTParser().parse(text) if text is not None: self.text = text try: for i, (lineno, line) in enumerate(text.items()): ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check(text):\n text = text.copy()\n if not isinstance(text,list): # TEST\n raise TypeError(\"text must be a listlike :\\n{}\".format(text))\n \n # managing latex genuine tag\n for i, line in enumerate(text):\n if '\\\\' in line:\n utils.underlineall(line,'\\\\')\n ...
[ "0.5193765", "0.5154263", "0.505798", "0.49654058", "0.4808358", "0.47402716", "0.4713079", "0.47065118", "0.47031403", "0.47010857", "0.46935087", "0.46704283", "0.465404", "0.46469313", "0.46239817", "0.46209937", "0.46112055", "0.460087", "0.45773935", "0.4564255", "0.4562...
0.6640136
0
Returns True if ``obj`` has any parent Fantasy ``fantasy``.
def find_fantasy(self, fantasy: Fantasy, obj: Union[Statement, Fantasy]) -> bool: if fantasy is None: return True # all objects have top level as parent fant = obj.fantasy while fant is not None: fant = fant.fantasy if fant is fantasy: return T...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def has_parent(obj, parent_name):\n if obj.parent is None:\n return False\n if obj.parent.name is None:\n return False\n elif obj.parent.name == parent_name:\n return True\n else:\n return has_parent(obj.parent, parent_name)", "def is_known(self, child):\r\n return ...
[ "0.6535494", "0.63880473", "0.6018726", "0.59466255", "0.59413505", "0.5922115", "0.5884263", "0.5848098", "0.5846054", "0.5814949", "0.58070546", "0.57707447", "0.57596886", "0.57503855", "0.57455945", "0.5726896", "0.5691056", "0.56856734", "0.5673926", "0.56407756", "0.563...
0.8815424
0
Returns True if the loop should continue, False if no action is needed. Raises MissingArgument with ``rule`` and ``arg`` in the exception message if the fantasy ends prematurely.
def raise_fantasy(self, idx: int, fantasy: Fantasy, rule: str, arg: str) -> bool: try: if idx < 0: # When idx < 0, it'll wrap to the end. Check for this instead. raise MissingArgument(rule + ' missing corresponding ' + arg) if self.text.vals[idx].fantasy i...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def should_continue():\n\n return LoopContinueEvent()", "def has_rule(self):\n # Someday I'll have a real implementation, but for now I just:\n return False", "def check_args(self):\n parser = get_base_arguments(get_parser())\n parser = get_tc_arguments(parser)\n # Dis...
[ "0.5710809", "0.5579009", "0.5500455", "0.54977596", "0.5490412", "0.54401356", "0.5400107", "0.538158", "0.5363287", "0.5356038", "0.5355447", "0.5333873", "0.53159326", "0.53159326", "0.53159326", "0.53159326", "0.53159326", "0.5308262", "0.530587", "0.52823794", "0.5276743...
0.60716426
0
Raise TooManyReferrals if there are too many referrals.
def at_most_refs(self, line: Statement, count: int, rule: str) -> None: if len(line.referrals) > count: raise TooManyReferrals(f'too many referrals for {rule}: expected ' f'at most {count}, got {len(line.referrals)}')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_referrers_consistency(self):\n logger.info(\"Checking for inconsistent referrers field\")\n assigned_fix_reqs = set()\n\n # Get all assigned fixture requests. Ensure that the instance has the fixture request in it's list of referrers\n # If instance does not have the referrer,...
[ "0.5879438", "0.5434337", "0.539833", "0.5300049", "0.52206147", "0.51793766", "0.5150164", "0.5094897", "0.5081152", "0.50607497", "0.49575502", "0.49304283", "0.49287638", "0.4914705", "0.49128336", "0.49035567", "0.489277", "0.48598227", "0.484587", "0.48380458", "0.480528...
0.6889877
0
Find an argument that matches the cmp function.
def find_arg(self, idx: int, line: Statement, cmp: type(lambda: None), rule: str, argname: str) -> Statement: i = idx fantasy = line.fantasy while i > 0: i -= 1 # if True, text.vals[i] is in an inner fantasy than line, # and c...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_arg(needle, haystack):\r\n for i in range(0, len(haystack)):\r\n if haystack[i] == needle:\r\n try:\r\n return haystack[i+1]\r\n except IndexError:\r\n pass\r\n return None", "def match_argname(argname, fallback=None, default=None):\n return class_predicate(argname, NameK...
[ "0.63055265", "0.5989534", "0.59502274", "0.59242034", "0.5879357", "0.5817449", "0.57719547", "0.57121897", "0.57012236", "0.5686402", "0.5519801", "0.5498948", "0.5480281", "0.5455657", "0.54323494", "0.5412333", "0.5405195", "0.5395234", "0.53883517", "0.53606737", "0.5351...
0.6921261
0
Get the direct or indirect referral and raise if it's missing.
def get_arg(self, idx: int, line: Statement) -> Statement: if len(line.referrals) == 1: return self.text[line.referrals[0]] if idx > 0 and self.text.vals[idx-1].fantasy is line.fantasy: return self.text.vals[idx-1] raise MissingArgument('separation missing both direct ' ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def referral_resource(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(self, \"referral_resource\")", "def get_referral(self, action):\n\n token = self.request.REQUEST.get('ref_token')\n log.debug(\"Token_arrived_from_req: %s\" % token)\n if token:\n referral = act...
[ "0.60115016", "0.55879205", "0.53493047", "0.5047921", "0.49596596", "0.4945889", "0.4945889", "0.48965114", "0.48853284", "0.48605117", "0.483323", "0.47735193", "0.4761757", "0.47544307", "0.4731469", "0.47286972", "0.47248268", "0.4713975", "0.46995237", "0.46933705", "0.4...
0.49649978
4
How did you get here?
def rule_invalid(self, idx: int, line: Statement) -> None: #TODO: this is a print while not all rules are handled yet print(NotARule(f'No such rule: {line.rule.value!r}'))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def think(self):\n pass", "def info(self) -> int:", "def info() -> None:", "def info(self):", "def info(self):", "def getInfo():", "def _get_information(self):\n pass", "def whoAmI(self): #good\r\n\t\treturn self.read(0x75)", "def compute_debug(self):", "def _get_state(self):", "d...
[ "0.65999806", "0.65853584", "0.6402468", "0.6388792", "0.6388792", "0.6110091", "0.60946214", "0.607509", "0.6037723", "0.5938964", "0.5888812", "0.5800743", "0.5789914", "0.5766601", "0.5766601", "0.57418567", "0.57357323", "0.571191", "0.57068455", "0.5693501", "0.5662407",...
0.0
-1
The string ``~~`` can be deleted from any theorem. It can also be inserted into any theorem, provided that the resulting string is itself wellformed.
def rule_double_tilde(self, idx: int, line: Statement) -> None: self.at_most_refs(line, 1, 'double-tilde') arg = self.get_arg(idx, line) if str(line.formula).replace('~~', '') != str(arg.formula).replace('~~', ''): raise InvalidReferral('change in formula does not only consist ' ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def scratch(line):\n if line.count('~~') >= 2:\n for i in range(0, line.count('~~') - line.count('~~') % 2):\n if i % 2 == 0:\n line = line.replace('~~', '<del>', 1)\n else:\n line = line.replace('~~', '</del>', 1)\n return line", "def bpe_postproc...
[ "0.6226605", "0.6026329", "0.5811224", "0.5771401", "0.5712928", "0.56504095", "0.5649122", "0.56223536", "0.56127286", "0.55980724", "0.5481653", "0.54661506", "0.54555297", "0.5449331", "0.5404552", "0.5401567", "0.53912276", "0.53807366", "0.5351295", "0.53452885", "0.5341...
0.0
-1
Inside a fantasy, any theorem from the "reality" one level higher can be brought in and used.
def rule_carry(self, idx: int, line: Statement) -> None: self.at_most_refs(line, 1, 'carry') # the parser is guaranteed to provide the single referral, # because the rule syntax requires it arg = self.text[line.referrals[0]] if not self.find_fantasy(arg.fantasy, line): ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def a_realization(self):\n if self.t==1:\n return self.kmonomial()\n else:\n return self.kHallLittlewoodP()", "def prove_R() -> Proof:\n # Optional Task 6.7g", "def test_theft_and_stealing(self):", "def main():\n wow = (((4 * 4) + (2 * 2))**0.5)**2\n wow = wow * (...
[ "0.5895005", "0.5729651", "0.5707765", "0.5642858", "0.5612754", "0.547754", "0.5460614", "0.54495007", "0.5447576", "0.54474837", "0.5389059", "0.53662133", "0.5298452", "0.52946985", "0.52458435", "0.5240242", "0.5199059", "0.5197052", "0.51939785", "0.51782036", "0.5176281...
0.0
-1
Suppose a term (which may contain variables as long as they are free) appears once, or multiply, in a theorem. Then any (or several, or all) of the appearances of the term may be replaced by a variable which otherwise does not occur in the theorem, and the corresponding existential quantifier must be placed in front.
def rule_existence(self, idx: int, line: Statement) -> None: self.at_most_refs(line, 1, 'existence') def referral_matches(line: Statement, arg: Statement) -> bool: # find variables quantified in line but not in arg # this is very similar to specification and generalization, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def free_variables(*terms, **kwargs):\n by_name = kwargs.get('by_name', False)\n _free_variables = partial(free_variables, by_name=by_name)\n\n t = terms[0] if len(terms) == 1 else terms\n\n if type(t) is Var:\n return frozenset((t.name if by_name else t,))\n\n elif type(t) in (tuple, Const, ...
[ "0.56068015", "0.5510019", "0.54720384", "0.5459136", "0.5404303", "0.53361857", "0.5307577", "0.52348053", "0.5223689", "0.5174133", "0.5119183", "0.50959367", "0.5070509", "0.50638944", "0.5010539", "0.49977437", "0.49943748", "0.49415708", "0.4936705", "0.492342", "0.48975...
0.54157114
4
0 is not the successor of any natural number.
def rule_axiom_1(self, idx: int, line: Statement) -> None: self.at_most_refs(line, 0, 'axiom 1') if line.formula != self.AXIOMS[1].formula: raise InvalidRule('not axiom 1')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sgn(x) -> int:\n if x > 0:\n return 1\n if x < 0:\n return -1\n return 0", "def torch_isnotfinite(x):\n not_inf = ((x + 1) != x)\n not_nan = (x == x)\n return 1 - (not_inf & not_nan)", "def sign(n):\n return (n > 0) - (n < 0)", "def p(x):\n if x<0 or x>1:\n re...
[ "0.6770732", "0.6713736", "0.6497921", "0.64779", "0.64756936", "0.6468263", "0.6449532", "0.6415817", "0.63191956", "0.6266652", "0.6248801", "0.6143978", "0.613796", "0.61341465", "0.6131532", "0.6102842", "0.6058444", "0.6043784", "0.60304385", "0.6026586", "0.59800816", ...
0.0
-1
The sum of any natural number and 0 is the number.
def rule_axiom_2(self, idx: int, line: Statement) -> None: self.at_most_refs(line, 0, 'axiom 2') if line.formula != self.AXIOMS[2].formula: raise InvalidRule('not axiom 2')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sum_natural(n):\n total, curr = 0 , 1\n\n while curr <= n:\n total, curr = total + curr, curr + 1\n return total", "def sum(n):\n if n == 0:\n return 0\n return sum(n - 1) + n", "def zero_sum(list):\n if not list:\n return 0\n else:\n return sum(list)", "d...
[ "0.70752275", "0.7010487", "0.6922917", "0.674976", "0.663038", "0.65916085", "0.6576432", "0.6576432", "0.6562442", "0.65312654", "0.652108", "0.6515682", "0.6507846", "0.6503463", "0.6501796", "0.63944256", "0.6331975", "0.63311905", "0.62371", "0.62298775", "0.6193746", ...
0.0
-1
S can be slipped in and out of parentheses.
def rule_axiom_3(self, idx: int, line: Statement) -> None: self.at_most_refs(line, 0, 'axiom 3') if line.formula != self.AXIOMS[3].formula: raise InvalidRule('not axiom 3')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def removeOuterParentheses(self, S):\n _open, _close = \"(\", \")\"\n oc, cc = 0, 0\n part, res = \"\", \"\"\n\n for i, p in enumerate(S):\n if p == _open:\n oc += 1\n elif p == _close:\n cc += 1\n\n part += p\n\n ...
[ "0.64436746", "0.62083685", "0.58791816", "0.58675164", "0.5802482", "0.57623535", "0.5664085", "0.5593671", "0.55099535", "0.54730666", "0.5471174", "0.547069", "0.5468538", "0.5454318", "0.54535645", "0.5428021", "0.5398385", "0.5396412", "0.53567183", "0.534787", "0.534148...
0.0
-1
Any natural number multiplied by 0 is 0.
def rule_axiom_4(self, idx: int, line: Statement) -> None: self.at_most_refs(line, 0, 'axiom 4') if line.formula != self.AXIOMS[4].formula: raise InvalidRule('not axiom 4')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def zero(x):\n # TODO: get dtype from Expr and Matrix:\n return x * 0", "def zero(*_, **__) -> None:\n return", "def zeros(num):\n if num < 1:\n raise IndexError('num must be >= 1.')\n return Vector.fromSequence([0] * num)", "def test_zero(self):\n\n input_ = 0\n ...
[ "0.71559536", "0.6750768", "0.6670707", "0.6597194", "0.65920085", "0.65668356", "0.65656066", "0.64535195", "0.6385685", "0.636736", "0.6346667", "0.6336748", "0.6290091", "0.6273333", "0.62724316", "0.62715787", "0.6188883", "0.6168746", "0.61516285", "0.6133803", "0.608595...
0.0
-1
A natural number multiplied by the successor of another natural number is the two numbers multipled plus the first number.
def rule_axiom_5(self, idx: int, line: Statement) -> None: self.at_most_refs(line, 0, 'axiom 5') if line.formula != self.AXIOMS[5].formula: raise InvalidRule('not axiom 5')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def multiply_numbers(first_number, second_number):", "def multiply_nums(n1, n2):\n\n result = n1 * n2\n return result", "def multiply(first, second):\n return first * second", "def multiply(n1, n2):\n return n1 * n2", "def multiplication(self, first_value, second_value):\n return first_v...
[ "0.7155889", "0.6850856", "0.6720201", "0.67102486", "0.6536018", "0.64909804", "0.64755446", "0.64552796", "0.6411664", "0.64000386", "0.6386679", "0.6378077", "0.63634753", "0.6352197", "0.6310251", "0.6276104", "0.6268769", "0.62671614", "0.6266487", "0.6236302", "0.622096...
0.0
-1
The first statement in a fantasy is assumed true as the premise.
def rule_premise(self, idx: int, line: Statement) -> None: self.at_most_refs(line, 0, 'premise') if line.fantasy.premise is not line: raise InvalidRule('this line is not the premise, this one is: ' + str(line.fantasy.premise))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def canned():\n return (next_phrase(\"we proceed as follows\") |\n (next_word('the') + \n first_word('result lemma theorem proposition corollary') +\n next_word('now').possibly() +\n next_word('follows')) |\n next_phrase('the othe...
[ "0.61674565", "0.6048048", "0.57897395", "0.5771222", "0.56613994", "0.5599137", "0.55587053", "0.55496484", "0.5487427", "0.5397764", "0.5382202", "0.5350548", "0.530042", "0.52928394", "0.52916205", "0.5284255", "0.52804005", "0.5277904", "0.5261861", "0.52506226", "0.52290...
0.55322695
8
Creates a new instance of TrackwayDirectionStage.
def __init__(self, key, owner, **kwargs): super(TrackwayDirectionStage, self).__init__( key, owner, label='Trackway Direction', **kwargs) self._paths = []
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self):\n super().__init__()\n self.waypoint_vector = [-1, 10]", "def _build_directions(self):\n d = {'start': self.get_start(), 'end': self.get_end(), 'duration': self.get_duration(),\n 'mode': self.get_primary_mode(), 'price_range': self.get_price_range(), 'legs': s...
[ "0.5205769", "0.5060475", "0.49711707", "0.4937936", "0.4937936", "0.48164803", "0.46623772", "0.46488953", "0.46384993", "0.46002585", "0.45988762", "0.4572386", "0.45723125", "0.45568055", "0.45305637", "0.45285165", "0.4508893", "0.44773376", "0.4474872", "0.4455077", "0.4...
0.6856049
0
Samples the trackway and returns result
def _sampleTrackway(self, trackway, windowSize): window = [] samples = [] entries = self.trackHeadingData[trackway.uid]['entries'] analysisTrackway = trackway.getAnalysisPair(self.analysisSession) for entry in entries: # For each track entry in the trackways data a...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sample(self):", "def sample(self):\r\n raise NotImplementedError", "def samples(self):\n pass", "async def test_all_samples(self):\n response = await self.collect(get_request_json_return_value=self.JMETER_JSON)\n self.assert_measurement(response, value=\"248\", entities=[])", "d...
[ "0.6952959", "0.6750686", "0.6693277", "0.6688981", "0.6587614", "0.6587614", "0.6511986", "0.6443781", "0.63794374", "0.633841", "0.6336211", "0.6332874", "0.63011825", "0.628949", "0.6210352", "0.6204264", "0.6074091", "0.6064068", "0.60129523", "0.5998648", "0.5984774", ...
0.6427744
8
Scales a numpy array to a new size using a specified scaling method
def resize(orig, factor, method="nearest"): method_dict = {'nearest': 0, 'bilinear': 1, 'cubic': 2} if method.lower() not in method_dict: raise ValueError("Invalid interpolation method. Options are: " + ", ".join(method_dict.keys())) try: return zoom(orig, factor, order=method_dict[meth...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def task_scaling(input_array, scaling_factor):\n return(np.multiply(scaling_factor, input_array))", "def scale(self):", "def scale(X, *, axis=..., with_mean=..., with_std=..., copy=...):\n ...", "def scale(data, factor):\n\n if np.ndim(data) != 2: # only process one IV dataset at a time\n ra...
[ "0.72506666", "0.6702226", "0.65821934", "0.64897275", "0.64589036", "0.64474237", "0.64441586", "0.64421093", "0.6434063", "0.64316", "0.64267987", "0.64052486", "0.64030355", "0.6390981", "0.638809", "0.63560194", "0.6274042", "0.6263043", "0.62367076", "0.62106544", "0.620...
0.65582985
3
Initialize HTTPError with `response` object and `status`.
def __init__(self, reason=None): self.reason = reason super(HTTPError, self).__init__(reason)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def from_http_error(cls, e):\n assert isinstance(e, requests.HTTPError), \"Expected 'requests.HTTPError' object\"\n r = e.response\n if r.status_code == 400:\n raise BadRequest(format_exception(e))\n elif r.status_code == 401:\n raise Unauthorized(format_exception(...
[ "0.69992054", "0.69851625", "0.6772945", "0.6706142", "0.669899", "0.6501592", "0.6406469", "0.6372283", "0.6366712", "0.63601094", "0.63356847", "0.63239634", "0.6231068", "0.6200624", "0.6197056", "0.6168606", "0.61596155", "0.6152448", "0.61208165", "0.61087805", "0.605093...
0.6903359
2
This function cleans strings removes special characters from within a string, sets all characters to lower case
def preprocess(self, s): stripped = re.sub("[^\w\s]", "", s) stripped = re.sub("_", "", stripped) stripped = re.sub("\s+", " ", stripped) stripped = stripped.strip() return stripped.lower()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sanitize(string):\n retval = string.lower()\n retval = re.sub(r\"[^\\w\\s]\", '', retval)\n retval = re.sub(r\"\\s+\", '_', retval)\n return retval", "def clean_str(string):\n return string.strip().lower()", "def to_clean_str(s: str) -> str:\n return re.sub(\"[^a-zA-Z0-9]\", \"\", s).lowe...
[ "0.77615", "0.7568341", "0.7521308", "0.7508947", "0.7476247", "0.7340672", "0.7329918", "0.73217434", "0.7291019", "0.72791153", "0.72528136", "0.72507566", "0.72102726", "0.72047937", "0.7200713", "0.71883965", "0.71828973", "0.7181059", "0.71767104", "0.7167191", "0.714459...
0.6901854
47
Creates COURSES_TO_DISPLAY new Courses and recommends them as activities for user
def generate_matching_courses(self,goal): searchstring = self.preprocess(goal.goal) wordlist = nltk.word_tokenize(searchstring) relevant_words = [] mystopwords = stopwords.words("english") + stopwords.words("german") for word in wordlist: if word not in mystopwords: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def courses(request):\r\n courses = get_courses(request.user, request.META.get('HTTP_HOST'))\r\n courses = sort_by_announcement(courses)\r\n\r\n return render_to_response(\"courseware/courses.html\", {'courses': courses})", "def generate_courses():\r\n for category in CourseCategory.objects.all():\r\...
[ "0.61373603", "0.6113792", "0.5901775", "0.5864133", "0.5779268", "0.57281446", "0.5723184", "0.5680084", "0.5675108", "0.5659758", "0.56344086", "0.5545084", "0.55196625", "0.55038464", "0.5492701", "0.54852253", "0.54694027", "0.5447528", "0.5436865", "0.54341394", "0.5385"...
0.59336793
2
Filter the queryset with the underlying form's `cleaned_data`. You must call `is_valid()` or `errors` before calling this method. This method should be overridden if additional filtering needs to be applied to the queryset before it is cached.
def filter_queryset(self, queryset): for name, value in self.form.cleaned_data.items(): queryset = self.filters[name].filter(queryset, value) # assert isinstance(queryset, models.QuerySet), \ # "Expected '%s.%s' to return a QuerySet, but got a %s instead." \ #...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _clean(self):\n return self._cleaned_data", "def clean(self):\n return self.cleaned_data", "def filter_queryset(self, request, queryset, view):\n form_id = view.kwargs.get(view.lookup_field, view.kwargs.get(\"xform_pk\"))\n lookup_field = view.lookup_field\n\n queryset = ...
[ "0.6860447", "0.67583185", "0.6699687", "0.66001344", "0.63974935", "0.6367156", "0.634692", "0.6310847", "0.6285551", "0.6239892", "0.6235133", "0.6218591", "0.6080913", "0.60272163", "0.601743", "0.5989977", "0.5984208", "0.59268767", "0.59214664", "0.5918033", "0.591439", ...
0.76146466
0
Welcome page quiz info and username form.
def welcome_page(): username = session.get('username') reset() if request.method == 'POST': if not username: session['username'] = request.form['username'] if username: return redirect(url_for('question_page')) return render_template('welcome.html', username=...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def welcome():\n on_session_start()\n return question(PRIME_QUESTION, intro=WELCOME_SPEECH)", "def test_welcome_exploration(self):\n self.init_player(\n '0', 'Welcome to Oppia!', 'do you know where the name \\'Oppia\\'')\n self.submit_and_compare(\n '0', 'Yes!', 'In fact...
[ "0.6697398", "0.6539233", "0.64245236", "0.63571936", "0.62531626", "0.6225158", "0.6220158", "0.6194444", "0.6194444", "0.6178174", "0.61647373", "0.61265844", "0.61160815", "0.60899746", "0.60562956", "0.6045096", "0.60315967", "0.602277", "0.5971155", "0.59668285", "0.5961...
0.7527604
0
Quiz question page show question, handle answer.
def question_page(): question_start_time = session.get('start_time') question_last_answer = session.get('last_answer') counter = session.get('counter') if not counter: session['counter'] = 0 if session['counter'] < 5: if session['counter'] > 0: check_answer(question_start...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show_question(q_id):\n responses = session[ANSWERS_KEY]\n if len(responses) < len(survey.questions):\n current_question = survey.questions[len(responses)]\n return render_template(\"question.html\", \n question = current_question)\n else:\n return re...
[ "0.75936353", "0.7143329", "0.7020141", "0.6966851", "0.6905311", "0.67368495", "0.66854775", "0.65165657", "0.6488054", "0.64855194", "0.64412254", "0.641232", "0.63482326", "0.63407415", "0.62596256", "0.6250438", "0.6208988", "0.6195438", "0.61866647", "0.6178402", "0.6169...
0.630683
14
Last page show results.
def result_page(): results = session.get('results') points = 0 if results: for k,p in results.items(): points += p['points'] return render_template('results.html', results=results, points=points),
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def last_page(self):\n await self.show_page(self.maximum_pages)", "def __goToLastPage(self):\n try:\n self.currenturi = self.currenturi = self.currenturi.rsplit('/',1)[0] + '/' +self.soup.find('div', 'pagination_container vt_pagination_container').findAll('a', text=re.compile ('^\\...
[ "0.806454", "0.7144447", "0.7003012", "0.6999305", "0.69795215", "0.6966101", "0.69216794", "0.6709376", "0.67040706", "0.6691933", "0.6680299", "0.6667703", "0.64640254", "0.64532304", "0.64493704", "0.64367706", "0.63419807", "0.6335299", "0.6331367", "0.6103349", "0.60931"...
0.5780358
32
Load the data and calculate the heights.
def __init__(self): self.data_graph = self._initialise_data() self.messages_sent = [] self.messages_received = [] self.answered_true = set() self.implied_true = set() self.current_subgraph = set() self.explanations = [] self.user_input = True ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getHeights(self):\n if self.heights: return self.heights\n reader = self.getReader()\n subData = reader.findSubRecord('VHGT','LAND')\n if not subData: return None\n height0 = struct.unpack('f',subData[:4])[0]\n import array\n deltas = array.array('b',subData[4:4...
[ "0.652412", "0.6450491", "0.6450491", "0.6066886", "0.6036422", "0.6029137", "0.58693266", "0.5864067", "0.5846139", "0.5808671", "0.5753752", "0.5730368", "0.5730368", "0.5730368", "0.5692719", "0.5692719", "0.56660783", "0.5632269", "0.55844057", "0.5581426", "0.5559642", ...
0.0
-1
Load the data from the knowledge base file and parse the clauses.
def _load_data(self): with open("znalostni_baze.txt") as f: content = f.readlines() data_graph = Graph("Expertní systém opraváře kol") for line in content: if line.startswith("#"): continue separated = line.strip(" IF ").split(" THEN ") ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_knowledge(self):\n MemoryManager.load_memory(self.knowledge_file)", "def load_all_data_from_file(self) -> None:\n self.load_gene_data_from_file()\n self.load_ontology_from_file(ontology_type=DataType.GO, ontology_url=self.go_ontology_url,\n ontolo...
[ "0.6023121", "0.5985196", "0.5984333", "0.59361756", "0.5822633", "0.57613045", "0.5707698", "0.5568779", "0.5562392", "0.5529335", "0.5527774", "0.5449343", "0.5428194", "0.54253757", "0.54044956", "0.5381706", "0.537846", "0.5372385", "0.534769", "0.53448343", "0.53372735",...
0.53429145
20