query
stringlengths
9
3.4k
document
stringlengths
9
87.4k
metadata
dict
negatives
listlengths
4
101
negative_scores
listlengths
4
101
document_score
stringlengths
3
10
document_rank
stringclasses
102 values
Return the url and etag (which may be ``None``) stored for `filename`. Raise ``EnvironmentError`` if `filename` or its stored metadata do not exist.
def filename_to_url(filename, cache_dir=None): if cache_dir is None: cache_dir = PYTORCH_PRETRAINED_BERT_CACHE if sys.version_info[0] == 3 and isinstance(cache_dir, Path): cache_dir = str(cache_dir) cache_path = os.path.join(cache_dir, filename) if not os.path.exists(cache_path): ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def filename_to_url(filename, cache_dir=None):\n if cache_dir is None:\n cache_dir = PYTORCH_PRETRAINED_BIGGAN_CACHE\n if sys.version_info[0] == 3 and isinstance(cache_dir, Path):\n cache_dir = str(cache_dir)\n\n cache_path = os.path.join(cache_dir, filename)\n if not os.path.exists(cache...
[ "0.6935979", "0.66862404", "0.56602347", "0.5526214", "0.5495133", "0.549179", "0.54821646", "0.5451763", "0.54232866", "0.5404365", "0.5390168", "0.53592336", "0.5340097", "0.5316367", "0.5316367", "0.53050923", "0.5263058", "0.5249617", "0.5236301", "0.5236301", "0.5236301"...
0.6845483
1
Given something that might be a URL (or might be a local path), determine which. If it's a URL, download the file and cache it, and return the path to the cached file. If it's already a local path, make sure the file exists and then return the path.
def cached_path(url_or_filename, cache_dir=None): if cache_dir is None: cache_dir = PYTORCH_PRETRAINED_BERT_CACHE if sys.version_info[0] == 3 and isinstance(url_or_filename, Path): url_or_filename = str(url_or_filename) if sys.version_info[0] == 3 and isinstance(cache_dir, Path): cac...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cached_path(url_or_filename, cache_dir=None):\n if cache_dir is None:\n cache_dir = PYTORCH_PRETRAINED_BIGGAN_CACHE\n if sys.version_info[0] == 3 and isinstance(url_or_filename, Path):\n url_or_filename = str(url_or_filename)\n if sys.version_info[0] == 3 and isinstance(cache_dir, Path):...
[ "0.8017018", "0.78666955", "0.7483797", "0.7304314", "0.7053811", "0.6941138", "0.68727976", "0.6839023", "0.68017435", "0.67998075", "0.6774163", "0.67073125", "0.6654511", "0.6564311", "0.6553657", "0.6505267", "0.64998394", "0.6499154", "0.6411366", "0.6400722", "0.6386748...
0.78506035
2
Split a full s3 path into the bucket name and path.
def split_s3_path(url): parsed = urlparse(url) if not parsed.netloc or not parsed.path: raise ValueError("bad s3 path {}".format(url)) bucket_name = parsed.netloc s3_path = parsed.path # Remove '/' at beginning of path. if s3_path.startswith("/"): s3_path = s3_path[1:] return...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def split_s3_path(url):\n\tparsed = urlparse (url)\n\tif not parsed.netloc or not parsed.path:\n\t\traise ValueError (\"bad s3 path {}\".format (url))\n\tbucket_name = parsed.netloc\n\ts3_path = parsed.path\n\t# Remove '/' at beginning of path.\n\tif s3_path.startswith (\"/\"):\n\t\ts3_path = s3_path[1:]\n\treturn...
[ "0.8375207", "0.7735455", "0.746958", "0.7318568", "0.7218094", "0.7035903", "0.70340866", "0.69963294", "0.667914", "0.6636463", "0.6606474", "0.65380406", "0.65207124", "0.63669854", "0.6354931", "0.634183", "0.6308922", "0.6285839", "0.62362", "0.6153867", "0.6139802", "...
0.83343893
2
Wrapper function for s3 requests in order to create more helpful error messages.
def s3_request(func): @wraps(func) def wrapper(url, *args, **kwargs): try: return func(url, *args, **kwargs) except ClientError as exc: if int(exc.response["Error"]["Code"]) == 404: raise EnvironmentError("file {} not found".format(url)) else:...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def s3_request(func):\n\n\t@wraps (func)\n\tdef wrapper(url, *args, **kwargs):\n\t\ttry:\n\t\t\treturn func (url, *args, **kwargs)\n\t\texcept ClientError as exc:\n\t\t\tif int (exc.response[\"Error\"][\"Code\"]) == 404:\n\t\t\t\traise EnvironmentError (\"file {} not found\".format (url))\n\t\t\telse:\n\t\t\t\trai...
[ "0.76719946", "0.6665943", "0.6402019", "0.63837814", "0.5939377", "0.59061104", "0.5840347", "0.5833341", "0.5818076", "0.58115727", "0.5808956", "0.57792574", "0.57344204", "0.57298124", "0.5725997", "0.5720364", "0.570092", "0.5694907", "0.5693311", "0.5685151", "0.5666691...
0.76369745
2
Check ETag on S3 object.
def s3_etag(url): s3_resource = boto3.resource("s3") bucket_name, s3_path = split_s3_path(url) s3_object = s3_resource.Object(bucket_name, s3_path) return s3_object.e_tag
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def s3_etag(url, proxies=None):\n\ts3_resource = boto3.resource (\"s3\", config=Config (proxies=proxies))\n\tbucket_name, s3_path = split_s3_path (url)\n\ts3_object = s3_resource.Object (bucket_name, s3_path)\n\treturn s3_object.e_tag", "def __check_metadata(s3client, key, bucket_name):\n response = s3client....
[ "0.7609127", "0.6753514", "0.6726762", "0.66672444", "0.62203646", "0.62162846", "0.61209494", "0.6087607", "0.59397113", "0.5937211", "0.5868046", "0.5830815", "0.5825242", "0.58229005", "0.58092743", "0.57960355", "0.57894117", "0.57681316", "0.57361794", "0.57229257", "0.5...
0.7740408
1
Pull a file directly from S3.
def s3_get(url, temp_file): s3_resource = boto3.resource("s3") bucket_name, s3_path = split_s3_path(url) s3_resource.Bucket(bucket_name).download_fileobj(s3_path, temp_file)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _s3_get_file(url):\n try:\n return S3().get_contents_from_url(url)\n except Exception as e:\n raise ScrBaseException(\"Could not load file from {0}: {1}\".format(url, e))", "def get_s3_object(self, remote_s3_url):\n try:\n _file = tempfile.mkstemp()[1]\n ...
[ "0.78477514", "0.77158487", "0.7608827", "0.7504507", "0.7471005", "0.74436337", "0.7418692", "0.7417389", "0.73352194", "0.7314232", "0.7274724", "0.71449965", "0.7134211", "0.7127028", "0.7124694", "0.71173424", "0.709214", "0.7072526", "0.7063774", "0.7017222", "0.70075125...
0.7664795
3
Given a URL, look for the corresponding dataset in the local cache. If it's not there, download it. Then return the path to the cached file.
def get_from_cache(url, cache_dir=None): if cache_dir is None: cache_dir = PYTORCH_PRETRAINED_BERT_CACHE if sys.version_info[0] == 3 and isinstance(cache_dir, Path): cache_dir = str(cache_dir) if not os.path.exists(cache_dir): os.makedirs(cache_dir) # Get eTag to add to filenam...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fetch_and_cache(data_url, file, data_dir=\"data\", force=False):\n data_dir = Path(data_dir)\n data_dir.mkdir(exist_ok = True)\n file_path = data_dir / Path(file)\n if force and file_path.exists():\n file_path.unlink()\n if force or not file_path.exists():\n print('Downloading...',...
[ "0.7324406", "0.71844316", "0.7031236", "0.6990155", "0.6980752", "0.6954394", "0.69461733", "0.6900871", "0.6895569", "0.6878797", "0.68373203", "0.68310595", "0.68248343", "0.67984205", "0.6793078", "0.6792131", "0.6791669", "0.6771587", "0.6748456", "0.66867965", "0.662460...
0.6577928
23
Extract a deduped collection (set) of text from a file. Expected file format is one item per line.
def read_set_from_file(filename): collection = set() with open(filename, "r", encoding="utf-8") as file_: for line in file_: collection.add(line.rstrip()) return collection
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def extract_set(file):\n s = set([])\n\n f = open(file, 'r')\n for line in f:\n flist = extract_words(line)\n\n for word in flist:\n if(word not in s):\n s.add(word)\n\n f.close()\n\n return s", "def read_gzip_file_lines_into_set(filename):\n with gzip.op...
[ "0.70601773", "0.6523493", "0.62634283", "0.6184579", "0.6109035", "0.6089902", "0.60104346", "0.6005262", "0.5984719", "0.5939507", "0.5928584", "0.5926395", "0.586926", "0.58470607", "0.58362484", "0.5735106", "0.5721555", "0.5711964", "0.570927", "0.56818986", "0.56660604"...
0.71203864
0
Build a resized Embedding Module from a provided token Embedding Module. Increasing the size will add newly initialized vectors at the end Reducing the size will remove vectors from the end
def _get_resized_embeddings(self, old_embeddings, new_num_tokens=None): if new_num_tokens is None: return old_embeddings old_num_tokens, old_embedding_dim = old_embeddings.weight.size() if old_num_tokens == new_num_tokens: return old_embeddings # Build new embed...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def resize_token_embeddings(self, new_num_tokens=None):\n base_model = getattr(self, self.base_model_prefix, self) # get the base model if needed\n model_embeds = base_model._resize_token_embeddings(new_num_tokens)\n if new_num_tokens is None:\n return model_embeds\n\n # Upd...
[ "0.6257246", "0.59338236", "0.59102905", "0.5880166", "0.5861137", "0.5818605", "0.58136606", "0.58124065", "0.5789941", "0.57822675", "0.5750501", "0.565386", "0.5651047", "0.5645711", "0.5632255", "0.56189686", "0.5605597", "0.5601651", "0.5597018", "0.5533937", "0.5523833"...
0.5473481
23
Tie or clone module weights depending of weither we are using TorchScript or not
def _tie_or_clone_weights(self, first_module, second_module): # TODO: ignore torch scripts here first_module.weight = second_module.weight
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initialise_weights(self): \n \n def initialise_process(param):\n \n \"\"\"\n Initialises weights of a given parameter following either Xavier or Kaiming uniform or normal processes.\n \n : param (torch.Tensor):\n \n ...
[ "0.6059909", "0.59139943", "0.5835686", "0.5801824", "0.578343", "0.57619166", "0.5751291", "0.55874944", "0.5566885", "0.5566885", "0.5566885", "0.55622125", "0.55498856", "0.5534293", "0.5514865", "0.54380494", "0.540177", "0.53923684", "0.5387447", "0.5385017", "0.5377151"...
0.7063566
0
Resize input token embeddings matrix of the model if new_num_tokens != config.vocab_size. Take care of tying weights embeddings afterwards if the model class has a `tie_weights()` method.
def resize_token_embeddings(self, new_num_tokens=None): base_model = getattr(self, self.base_model_prefix, self) # get the base model if needed model_embeds = base_model._resize_token_embeddings(new_num_tokens) if new_num_tokens is None: return model_embeds # Update base mo...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _resize_token_embeddings(\n cls, model: PreTrainedModel, tokenizer_wrapper: TokenizerWrapper\n ):\n if tokenizer_wrapper.num_added_special_tokens > 0:\n model.resize_token_embeddings(\n new_num_tokens=len(tokenizer_wrapper.tokenizer)\n )", "def _get_resiz...
[ "0.7340149", "0.73199034", "0.66773486", "0.6232395", "0.5885491", "0.5708248", "0.5682836", "0.5608442", "0.5600368", "0.55258316", "0.54641026", "0.5434204", "0.5431489", "0.54279315", "0.53705066", "0.53556705", "0.5320183", "0.5313493", "0.53025067", "0.52424026", "0.5235...
0.8302218
0
Prunes heads of the base model.
def prune_heads(self, heads_to_prune): base_model = getattr(self, self.base_model_prefix, self) # get the base model if needed base_model._prune_heads(heads_to_prune)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _prune_heads(self, heads_to_prune):\n\n for layer, heads in heads_to_prune.items():\n\n self.encoder.layer[layer].attention.prune_heads(heads)", "def _prune_heads(self, heads_to_prune):\n for layer, heads in heads_to_prune.items():\n self.encoder.layer[layer].attention.pru...
[ "0.72563326", "0.72481006", "0.72481006", "0.72481006", "0.70842814", "0.6267746", "0.5592379", "0.5545439", "0.54839396", "0.54800785", "0.5456683", "0.5320149", "0.5312295", "0.5246493", "0.5192349", "0.51423156", "0.5136725", "0.51237094", "0.5061058", "0.49885798", "0.495...
0.83380306
0
Save a model and its configuration file to a directory, so that it
def save_pretrained(self, save_directory): assert os.path.isdir(save_directory), "Saving path should be a directory where the model and configuration can be saved" # Only save the model it-self if we are using distributed training model_to_save = self.module if hasattr(self, "module") else self...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save_model(model, model_filepath):", "def save_model(model, model_path, model_name):\n config_dict = model.config\n os.makedirs(model_path, exist_ok=True)\n config_file, model_file = _get_config_file(model_path, model_name), _get_model_file(model_path, model_name)\n with open(config_file, \"w\") ...
[ "0.7900544", "0.7652828", "0.7614003", "0.760421", "0.75679713", "0.74694145", "0.7463031", "0.74493766", "0.7428195", "0.741997", "0.73837805", "0.73575747", "0.72427034", "0.72242886", "0.7206827", "0.7206248", "0.7197328", "0.71940047", "0.71772146", "0.71490467", "0.71455...
0.0
-1
r"""Instantiate a pretrained pytorch model from a pretrained model configuration. The model is set in evaluation mode by default using ``model.eval()`` (Dropout modules are deactivated) To train the model, you should first set it back in training mode with ``model.train()`` The warning ``Weights from XXX not initialize...
def from_pretrained(cls, pretrained_model_name_or_path, *model_args, **kwargs): config = kwargs.pop("config", None) state_dict = kwargs.pop("state_dict", None) cache_dir = kwargs.pop("cache_dir", None) from_tf = kwargs.pop("from_tf", False) from_hf = kwargs.pop("from_hf", False)...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initialize_model_from_cfg(args, gpu_id=0):\n model = eval(args.model).loot_model(args)\n model.eval()\n\n if args.cuda:\n model.cuda()\n\n if args.load_ckpt:\n load_name = args.load_ckpt\n logger.info(\"loading checkpoint %s\", load_name)\n checkpoint = torch.load(load_n...
[ "0.6976545", "0.6916713", "0.6758365", "0.6717086", "0.6631128", "0.64870167", "0.6471911", "0.6439166", "0.6403689", "0.64014363", "0.639224", "0.6378459", "0.63575405", "0.6351665", "0.6319597", "0.6311798", "0.6302049", "0.62893885", "0.6288816", "0.62884915", "0.62712437"...
0.69160885
2
Handling one pygame event
def event_handler(self, event): if event.type == pygame.QUIT: # close window event self.exit() elif event.type == pygame.KEYDOWN: # keyboard event on press ESC if event.key == pygame.K_ESCAPE: self.exit()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __handle_events(self):\r\n for event in pygame.event.get():\r\n self.controller.handle_event(event)", "def do_event(self, event):\n self.event = event\n self.event_type = event.type\n self.event_name = pygame.event.event_name(event.type)\n self.surf_list = []\n ...
[ "0.7445657", "0.7323183", "0.72670966", "0.7109164", "0.7107148", "0.7049959", "0.7011809", "0.70093966", "0.69182605", "0.68861115", "0.686717", "0.68447286", "0.6834843", "0.6834282", "0.68310976", "0.6816098", "0.68129355", "0.6801154", "0.67861557", "0.6767286", "0.671451...
0.6689121
27
Here game objects update their positions
def update(self): self.tick() self.ball.update(self) for c in self.balls: print("updated ball") c.update(self) for c in self.balls: for z in self.blocks: print("updated ball/block") collideWithBlock(z,c) for c i...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _update_objects(self):\n\t\tself.clouds.update()\n\t\tif self.is_play:\n\t\t\tself.floor.update()\n\t\t\tself.bolan.update()\n\t\t\tself.obstacles.update()\n\t\t\tself.scoreboard.update()", "def _update_positions(self):\n self._velocities += self._accelerations * self.time_step\n self._position...
[ "0.74033827", "0.7331041", "0.73167026", "0.7303462", "0.7108151", "0.7061423", "0.70484126", "0.69942296", "0.698247", "0.69750166", "0.6967847", "0.6963651", "0.6925267", "0.6912903", "0.69103706", "0.68955576", "0.68888736", "0.688342", "0.68648386", "0.68462163", "0.68325...
0.63846165
88
Execution loop of the game
def execute(self): while(self._running): # get all pygame events from queue for event in pygame.event.get(): self.event_handler(event) self.update() self.render() self.cleanup()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def GAME_LOOP():\n pass", "def game_loop(self):\n self.interface.game_loop(self)", "def Gameloop():", "def run(self):\n while True:\n if self.game_over: \n return \n\n self.handle_events() \n if self.paused:\n continue\n\n self....
[ "0.8563122", "0.84267336", "0.8262979", "0.8257844", "0.8222864", "0.8066505", "0.80106884", "0.79766047", "0.7966363", "0.7822993", "0.7811433", "0.7766384", "0.7717791", "0.77140033", "0.771144", "0.76834625", "0.76576585", "0.76340437", "0.7621107", "0.7611632", "0.7571561...
0.0
-1
Return list of results sorted by rank
def get_sorted_results(self): results = self.results.values() return sorted(results, key=lambda r: r.rank(), reverse=True)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_rank_order(self):\n for k in self._run:\n self._run[k].sort(key=lambda x:x.get_rank(),reverse=False)\n tot_res = len(self._run[k])\n for r in self._run[k]:\n r.set_score(tot_res - int(r.get_rank()) + 1)\n print r.get_str()", "def get_p...
[ "0.69254977", "0.684963", "0.6849142", "0.6802348", "0.67524517", "0.6719774", "0.66903794", "0.6648478", "0.6606203", "0.65088266", "0.6424007", "0.6407158", "0.63892245", "0.6320967", "0.63044244", "0.6295104", "0.6294889", "0.62153345", "0.6185796", "0.6177191", "0.6166677...
0.8218771
0
Return a list of dictionaries of the results sorted by rank
def get_sorted_results_by_dict(self): results = self.get_sorted_results() return [dict(r) for r in results]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_sorted_results(self):\n results = self.results.values()\n return sorted(results, key=lambda r: r.rank(), reverse=True)", "def sort_ranking_dict(self):\n\n # reset self.ranking_dict to empty dict (if sorted tuple)\n self.ranking_dict = {}\n\n # create ranking dict with p...
[ "0.775157", "0.6683781", "0.6677163", "0.6617864", "0.65598196", "0.6511982", "0.64773464", "0.6474295", "0.6439614", "0.63109255", "0.6295219", "0.6294836", "0.62821764", "0.625474", "0.62448514", "0.62414736", "0.6218454", "0.62135255", "0.61834943", "0.61212486", "0.610193...
0.6865028
1
Return the named logger.
def getLogger(name): return logging.getLogger(name)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_logger(name):\n return logging.getLogger(name)", "def get_logger(name):\n # type: (str) -> Logger\n return logging.getLogger(name)", "def get_logger(name: str) -> logging.Logger:\n \n return logging.getLogger(name)", "def get_logger(logger_name='root'):\n return getLogger(lo...
[ "0.84202963", "0.8320279", "0.82145303", "0.8188328", "0.79968315", "0.78506225", "0.7847334", "0.7838277", "0.78292906", "0.7821073", "0.78051853", "0.7803655", "0.77958643", "0.77785164", "0.776719", "0.7752958", "0.7750331", "0.7716235", "0.7704729", "0.768047", "0.7656594...
0.77547795
15
Configure logging to receive log messages at the console.
def enable_console(): global CONSOLE if CONSOLE is None: # define a Handler which writes messages to sys.stderr CONSOLE = logging.StreamHandler() CONSOLE.setLevel(logging.DEBUG) # set a format which is simpler for console use formatter = logging.Formatter('%(levelname)s %...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def configure_console_logger ():\n\t\tconsole = logging.StreamHandler()\n\t\tconsole.setLevel(logging.INFO) # Change level for console logger in development mode\n\t\tformatter = logging.Formatter('%(levelname)-8s %(message)s')\n\t\tconsole.setFormatter(formatter)\n\t\tlogging.getLogger('').addHandler(console)", ...
[ "0.8326157", "0.82240087", "0.79164594", "0.78068614", "0.7774686", "0.7754041", "0.7711719", "0.76938075", "0.76492554", "0.7488018", "0.74673927", "0.7462291", "0.74519753", "0.7443409", "0.74388915", "0.743081", "0.74278116", "0.7423144", "0.7395937", "0.73913264", "0.7322...
0.6923742
39
Stop receiving log messages at the console.
def disable_console(): logger.removeHandler(CONSOLE)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def stop_console(self):\n return", "def stop_logging(self):\n\n self._log_queue.put_nowait(None)\n self._log_subprocess.join()", "def stopLogging (self):\n self.isLogging = False", "def Stop(self):\n for process_logger in self.process_loggers:\n process_logger.StopLogging(...
[ "0.78879744", "0.7596596", "0.75806665", "0.69654834", "0.6801776", "0.67767566", "0.6759206", "0.66976804", "0.66335547", "0.6587193", "0.65731966", "0.6567817", "0.6502418", "0.64667916", "0.6452393", "0.64509517", "0.6410366", "0.6409168", "0.640567", "0.63680905", "0.6347...
0.73424244
3
Return dict representing this Logger's state.
def __getstate__(self): state = self.__dict__.copy() state['_logger'] = None # Contains an unpickleable lock. return state
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __getstate__(self):\n state = dict(self.__dict__)\n del state['logger']\n return state", "def save_state(self):\n return {'log_formatstr': self.log_formatstr,\n 'backend_interval': self.backend_interval}", "def get_state(self):\n\n # TODO: Assemble a dictionary...
[ "0.81866395", "0.7860514", "0.76662624", "0.7611011", "0.74871504", "0.7330996", "0.7326406", "0.7326406", "0.72727907", "0.7172149", "0.7114898", "0.71087533", "0.7103719", "0.7102913", "0.7094033", "0.7051571", "0.70221627", "0.7014673", "0.6977747", "0.69748193", "0.697239...
0.70902884
15
Restore this Logger's state.
def __setstate__(self, state): self.__dict__ = state self._logger = logging.getLogger(self._name) self.level = self._level
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def revert_logging(self):\n if self._previous_action_logging_setting is not None:\n self.action_logging_enabled = self._previous_action_logging_setting\n self._previous_action_logging_setting = None\n return", "def restore_state(self, state: ale_py.ALEState):\n self.ale...
[ "0.69087595", "0.6845371", "0.6712689", "0.66738003", "0.6513239", "0.6494111", "0.6493251", "0.6451605", "0.6426061", "0.6292491", "0.6276428", "0.6251882", "0.6245137", "0.6231107", "0.6206482", "0.61979216", "0.6178583", "0.6161093", "0.61551374", "0.61468834", "0.6117147"...
0.56713307
98
Change name reported in log.
def rename(self, name): self._name = name self._logger = logging.getLogger(name) self._logger.setLevel(self._level)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def change_name(change_account):\n change_data(change_account, changed_data='name')", "def new_name(self,new_name):\n self.name = new_name", "def update_name(self, new_name):\r\n self.__name = new_name", "def update_name(self, new_name):\r\n self.__name = new_name", "def set_name(se...
[ "0.75993884", "0.75131446", "0.73500913", "0.73500913", "0.72083247", "0.71485895", "0.70160717", "0.689644", "0.68923503", "0.68923503", "0.6866243", "0.68378323", "0.6815318", "0.6801107", "0.67552984", "0.6750267", "0.6738826", "0.671881", "0.67061144", "0.66812235", "0.66...
0.7860457
0
Log a debug message.
def debug(self, msg, *args, **kwargs): self._logger.debug(msg, *args, **kwargs)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def debug(message):\n logging.getLogger().debug(message)", "def debug(self, message: str):\n self.log(Level.DEBUG, message)", "def log_debug(self, msg):\n self.log(msg, level=LOG_DEBUG)", "def debugLog(message):\n if debugFlag != None:\n print \"#debug: \" + str(message)", "def d...
[ "0.8464044", "0.84245175", "0.8317086", "0.82970744", "0.82817125", "0.82645655", "0.826264", "0.8230575", "0.82266045", "0.8219258", "0.8212807", "0.8202084", "0.8193062", "0.81663966", "0.81370026", "0.81363595", "0.81245035", "0.8121413", "0.81208456", "0.8113997", "0.8108...
0.81465197
14
Log an information message.
def info(self, msg, *args, **kwargs): self._logger.info(msg, *args, **kwargs)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def log_info(self, message, msg_type='info'):\n pass", "def info(cls, message):\n print('[INFO] {0}'.format(message))", "def info(self, *args, **kwargs):\n\n message = self.get_message(*args, **kwargs)\n self.logger.info(message)", "def info(self, message: str):\n self.log(...
[ "0.83133876", "0.8209451", "0.8206397", "0.81367356", "0.8088158", "0.8085133", "0.8058078", "0.80265284", "0.8014304", "0.8001576", "0.79474974", "0.7947099", "0.79468304", "0.7943471", "0.79060245", "0.790031", "0.7896671", "0.78947765", "0.7891623", "0.7889653", "0.7864467...
0.79122704
14
Log a warning message.
def warning(self, msg, *args, **kwargs): self._logger.warning(msg, *args, **kwargs)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def warning(msg):\n log('WARNING', msg)", "def warning(warning_message: str):\n logger.warning(warning_message)", "def warning(self, msg):\r\n self.logger.warning(msg)", "def logwarning(self, msg):\n self.logger.warning(msg)", "def warning(self, msg: str):\n self._logger.warn...
[ "0.89419824", "0.8865843", "0.885691", "0.8816802", "0.87562454", "0.87405264", "0.87277776", "0.8705478", "0.8581896", "0.8573009", "0.8569966", "0.8559014", "0.8427883", "0.84113264", "0.83965313", "0.8370078", "0.83427745", "0.83300245", "0.83227646", "0.8307793", "0.82788...
0.86715686
8
Log an error message.
def error(self, msg, *args, **kwargs): self._logger.error(msg, *args, **kwargs)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def logerror(self, msg):\n self.logger.error(msg)", "def log_error(self, msg):\n self.log(msg, level=LOG_ERROR)", "def log_error(self, msg):\n self.logger.error(msg)", "def error(self, message: str):\n self.log(Level.ERROR, message)", "def error(error_message: str):\n logger....
[ "0.8564865", "0.8555966", "0.85530597", "0.8548042", "0.853302", "0.8453578", "0.82887", "0.82592005", "0.8217033", "0.820497", "0.81797916", "0.81781536", "0.81455135", "0.81117034", "0.80785674", "0.8063031", "0.8056405", "0.8052397", "0.8046515", "0.80300486", "0.8000984",...
0.81664586
12
Log a critical message.
def critical(self, msg, *args, **kwargs): self._logger.critical(msg, *args, **kwargs)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def logcritical(self, msg):\n self.logger.critical(msg)", "def critical(self, msg):\r\n self.logger.critical(msg)", "def critical(self, msg: str):\n self._logger.critical(msg)", "def critical(msg):\n log_msg(CRITICAL, msg)", "def critical(self, msg):\n self.__logger.criti...
[ "0.8792606", "0.8743759", "0.8654438", "0.8638135", "0.8633321", "0.85828686", "0.8524781", "0.8507044", "0.8484163", "0.84632355", "0.8400138", "0.8359838", "0.8099608", "0.808304", "0.80479217", "0.79738295", "0.7906664", "0.77565897", "0.77172333", "0.7358693", "0.7176216"...
0.86360335
4
Log a message at a specified level.
def log(self, level, msg, *args, **kwargs): self._logger.log(level, msg, *args, **kwargs)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def log(self, msg, logging_level):\n\n # log\n self.logger.log(logging_level, msg)", "def log(self, message, level=None):\n\n if level is None or level.lower() == \"all\":\n level = \"notset\"\n level = getattr(logging, level.upper())\n\n self.logger.log(level, messa...
[ "0.7936794", "0.7934243", "0.7917798", "0.7799095", "0.77968574", "0.77239585", "0.7705664", "0.7622494", "0.75659174", "0.755691", "0.7502358", "0.73117405", "0.7269846", "0.7261094", "0.7257239", "0.72303665", "0.7185473", "0.71545196", "0.7142923", "0.71102774", "0.7107711...
0.76912713
7
Log a debug message.
def debug(self, msg, *args, **kwargs): pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def debug(message):\n logging.getLogger().debug(message)", "def debug(self, message: str):\n self.log(Level.DEBUG, message)", "def log_debug(self, msg):\n self.log(msg, level=LOG_DEBUG)", "def debugLog(message):\n if debugFlag != None:\n print \"#debug: \" + str(message)", "def d...
[ "0.8464044", "0.84245175", "0.8317086", "0.82970744", "0.82817125", "0.82645655", "0.826264", "0.8230575", "0.82266045", "0.8219258", "0.8212807", "0.8202084", "0.8193062", "0.81663966", "0.81465197", "0.81370026", "0.81363595", "0.81245035", "0.8121413", "0.81208456", "0.811...
0.7888286
32
Log an information message.
def info(self, msg, *args, **kwargs): pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def log_info(self, message, msg_type='info'):\n pass", "def info(cls, message):\n print('[INFO] {0}'.format(message))", "def info(self, *args, **kwargs):\n\n message = self.get_message(*args, **kwargs)\n self.logger.info(message)", "def info(self, message: str):\n self.log(...
[ "0.83133876", "0.8209451", "0.8206397", "0.81367356", "0.8088158", "0.8085133", "0.8058078", "0.80265284", "0.8014304", "0.8001576", "0.7947099", "0.79468304", "0.7943471", "0.79122704", "0.79060245", "0.790031", "0.7896671", "0.78947765", "0.7891623", "0.7889653", "0.7864467...
0.79474974
10
Log a warning message.
def warning(self, msg, *args, **kwargs): pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def warning(msg):\n log('WARNING', msg)", "def warning(warning_message: str):\n logger.warning(warning_message)", "def warning(self, msg):\r\n self.logger.warning(msg)", "def logwarning(self, msg):\n self.logger.warning(msg)", "def warning(self, msg: str):\n self._logger.warn...
[ "0.89419824", "0.8865843", "0.885691", "0.8816802", "0.87562454", "0.87405264", "0.87277776", "0.8705478", "0.86715686", "0.8581896", "0.8573009", "0.8569966", "0.8559014", "0.8427883", "0.84113264", "0.83965313", "0.8370078", "0.83427745", "0.83300245", "0.83227646", "0.8307...
0.7996571
32
Log an error message.
def error(self, msg, *args, **kwargs): pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def logerror(self, msg):\n self.logger.error(msg)", "def log_error(self, msg):\n self.log(msg, level=LOG_ERROR)", "def log_error(self, msg):\n self.logger.error(msg)", "def error(self, message: str):\n self.log(Level.ERROR, message)", "def error(error_message: str):\n logger....
[ "0.8564865", "0.8555966", "0.85530597", "0.8548042", "0.853302", "0.8453578", "0.82887", "0.82592005", "0.8217033", "0.820497", "0.81797916", "0.81781536", "0.81664586", "0.81455135", "0.81117034", "0.80785674", "0.8063031", "0.8056405", "0.8052397", "0.8046515", "0.80300486"...
0.0
-1
Log a critical message.
def critical(self, msg, *args, **kwargs): pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def logcritical(self, msg):\n self.logger.critical(msg)", "def critical(self, msg):\r\n self.logger.critical(msg)", "def critical(self, msg: str):\n self._logger.critical(msg)", "def critical(msg):\n log_msg(CRITICAL, msg)", "def critical(self, msg, *args, **kwargs):\n se...
[ "0.8792606", "0.8743759", "0.8654438", "0.8638135", "0.86360335", "0.8633321", "0.85828686", "0.8524781", "0.8507044", "0.8484163", "0.84632355", "0.8400138", "0.8359838", "0.8099608", "0.80479217", "0.79738295", "0.7906664", "0.77565897", "0.77172333", "0.7358693", "0.717621...
0.808304
14
Log a message at a specified level.
def log(self, level, msg, *args, **kwargs): pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def log(self, msg, logging_level):\n\n # log\n self.logger.log(logging_level, msg)", "def log(self, message, level=None):\n\n if level is None or level.lower() == \"all\":\n level = \"notset\"\n level = getattr(logging, level.upper())\n\n self.logger.log(level, messa...
[ "0.7936794", "0.7934243", "0.7917798", "0.7799095", "0.77968574", "0.77239585", "0.7705664", "0.76912713", "0.7622494", "0.75659174", "0.755691", "0.7502358", "0.7269846", "0.7261094", "0.7257239", "0.72303665", "0.7185473", "0.71545196", "0.7142923", "0.71102774", "0.7107711...
0.73117405
12
Smoke test for pipeline runner main. Strictly speaking this is an integration test, not a unit test.
def test_pipeline_runner_main(): working_dir = os.path.join( os.getcwd(), 'tests') pypyr.pipelinerunner.main(pipeline_name='smoke', pipeline_context_input=None, working_dir=working_dir, log_level=50, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def testRunSmoke(self):\n stage = self.ConstructStage()\n with self.OutputCapturer():\n stage.Run()", "def test_build_pipeline_one(self):\n args = \"Test_APP ONE TWO THREE\".split(\" \")\n task_list = build_pipeline(args, False)\n self.assertEqual(\"Task One\", task_list[0].execut...
[ "0.76054335", "0.6964659", "0.6951112", "0.69106495", "0.68871206", "0.68079656", "0.67062974", "0.6609242", "0.6600631", "0.65963787", "0.65834165", "0.65677947", "0.654029", "0.6531875", "0.6528586", "0.65184176", "0.65039784", "0.648935", "0.64736086", "0.6444929", "0.6443...
0.848315
0
test attendees for bag_check testing
def get_test_attendees(): attendees = [Attendee(.5, 0.3, .25, .5, i) for i in range(10)] for attendee in attendees: attendee.has_bag = True return attendees
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_teams_invite_member(self):\n pass", "def test_meetings(self):\n pass", "def test_assign_managing_team(self):\n pass", "def test_invite_ct(self):\r\n # for now just make sure we can get a 200 call on it.\r\n params = {\r\n 'api_key': self.api_key\r\n ...
[ "0.63845855", "0.5888382", "0.58855546", "0.5864182", "0.5847379", "0.5691347", "0.5680123", "0.5594723", "0.55914426", "0.55857736", "0.5568812", "0.555654", "0.5538625", "0.553525", "0.54930884", "0.5454616", "0.5431417", "0.5431417", "0.5431417", "0.5431417", "0.5431417", ...
0.69715554
0
Cuts half of fourier spectra. Spectrum has length 'n' number of samples. The meaning part is only half of one. The output array frequency samples are floor(n/2) + 1
def fourier_spectra(x, axis=1, flip=True, duplicate=True, **kwargs): x = forward_fourier(x, axis=axis, duplicate=duplicate) ns = x.shape[axis] nw = np.int32(np.floor(ns/2) + 1) slc = [slice(None)] * len(x.shape) slc[axis] = slice(0, nw) if flip: x = np.flip(x[tuple(slc)], axis=axis) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def samp_from_freq(n_samples):\n datapath = os.path.normpath(os.getcwd()+os.sep+os.pardir+os.sep+\"Dataset\"+os.sep+\"All_channels_500hz.npy\")\n data = np.load(datapath)\n fourier = np.fft.rfft(data,axis=0)\n fourier_mean = np.mean(fourier,axis=1)\n print(fourier.shape)\n ...
[ "0.7150992", "0.6811904", "0.6689297", "0.64012915", "0.6388876", "0.6366547", "0.6344191", "0.630355", "0.623903", "0.62182015", "0.61841524", "0.61706424", "0.6152935", "0.61505306", "0.6149574", "0.61395437", "0.613199", "0.6127949", "0.61228526", "0.61060256", "0.60953647...
0.6334208
7
Split Fourier Spectrum into Amplitude and Phase
def decompose_spectra(s, duplicate=True, **kwargs): if duplicate: s = deepcopy(s) amplitude = np.abs(s) phase = np.angle(s) return amplitude, phase
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def record_chunk(self):\n data = self.stream.read(nFFT)\n data_array = bytearray(data)\n self.cur_input = []\n for i in range(nFFT):\n amp = struct.unpack('H', data_array[:2])\n for _ in range(2):\n data_array.pop(0)\n self.cur_input.appen...
[ "0.64105207", "0.62792295", "0.61757046", "0.6167808", "0.6128677", "0.61282164", "0.6061809", "0.59869945", "0.59730077", "0.5937999", "0.5928755", "0.5890726", "0.579301", "0.5788351", "0.57652515", "0.57421577", "0.57369924", "0.5664829", "0.56638646", "0.56500655", "0.559...
0.57765394
14
Compose fill spectrum from Amplitude and Phase parts
def compose_spectra(amplitude, phase, duplicate=True, **kwargs): if duplicate: amplitude = deepcopy(amplitude) phase = deepcopy(phase) s = amplitude * np.exp(np.array([1.j]) * phase) return s
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def app_complex(data_pupil,data_phase,oversize=4):\n#phase colors\n # cdict = {'red': ((0.0, 1.0, 1.0),(0.25, 0.0, 0.0),(0.5, 0.0, 0.0),(0.75, 1.0, 1.0),(1.00, 1.0, 1.0)),'green': ((0.0, 0.0, 0.0),(0.25, 1.0, 1.0),(0.5, 0.0, 0.0),(0.75, 1.0, 1.0),(1.0, 0.0, 0.0)),'blue': ((0.0, 0.0, 0.0),(0.25, 0.0, 0.0),(0.5, 1...
[ "0.6411826", "0.57913023", "0.5675218", "0.5653244", "0.55799466", "0.5579412", "0.5542808", "0.5533283", "0.55275106", "0.5524995", "0.5507862", "0.55072194", "0.5503415", "0.54930496", "0.5489805", "0.54528993", "0.5415201", "0.5358701", "0.5357929", "0.5354411", "0.5347019...
0.5825405
1
Calculate Amplitude and Phase spectra of a signal.
def amplitude_n_phase_spectrum(x, axis=1, unwrap_phase=True, normalize_amplitude=True, **kwargs): s = fourier_spectra(x, axis=axis, **kwargs) amplitude, phase = decompose_spectra(s, **kwargs) if unwrap_phase: phase = np.unwrap(phase, axis=axis) if normalize_amplitude: ns = x.shape[axis] ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def spectrum(self):\r\n f, spectrum = tsa.get_spectra(self.input.data, method=self.method)\r\n return spectrum", "def signal_spectral(signal, FS):\n # check inputs\n if signal is None or signal == []:\n print(\"Signal is empty.\")\n\n # ensure numpy\n signal = np.array(signal)\n ...
[ "0.6344557", "0.6296159", "0.6280285", "0.6264026", "0.59472233", "0.5931212", "0.5915389", "0.5873053", "0.5865408", "0.5840819", "0.58061194", "0.578612", "0.5776553", "0.5761796", "0.57497466", "0.57440084", "0.56771356", "0.5667969", "0.5624562", "0.5617329", "0.5587389",...
0.6119489
4
Parse all the arguments provided from the CLI.
def get_arguments(): parser = argparse.ArgumentParser(description="DeepLabLFOV Network Inference.") parser.add_argument("model_weights", type=str, help="Path to the file with model weights.") parser.add_argument("--save_dir", type=str, default=SAVE_DIR, help="...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_arguments(args):", "def parse_args(self, argv=None):\n self.opts, self.args = self.cli_parser.parse_args(argv)\n self.check_arguments()\n self._post_process_opts_and_args()\n return self.opts, self.args", "def _parse_args(self):\n parser = argparse.ArgumentParser()\...
[ "0.80191135", "0.7827306", "0.78252083", "0.78129536", "0.768335", "0.7675676", "0.76408064", "0.76342136", "0.7633758", "0.7624596", "0.76102966", "0.76016474", "0.75891554", "0.7580388", "0.757933", "0.757059", "0.7565358", "0.7515046", "0.7512521", "0.750885", "0.7505817",...
0.0
-1
Create the model and start the evaluation process.
def main(): args = get_arguments() # Create network. net = DeepLabLFOVModel() # Which variables to load. trainable = tf.trainable_variables() # Set up TF session and initialize variables. config = tf.ConfigProto() config.gpu_options.allow_growth = True sess = tf.Session(co...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def run(self) -> None:\n self.model = self.trainer.train_model(self.model, self.data)", "def train_and_eval(self):\n self.__create_indexes()\n model = None\n model = None\n if self.model == 'OMult':\n model = OMult(self.kwargs)\n elif self.model == 'ConvO':\n ...
[ "0.7154538", "0.7110913", "0.70891786", "0.70385206", "0.6866587", "0.68355024", "0.68056273", "0.6790459", "0.6780459", "0.6717746", "0.6706127", "0.6687629", "0.66817534", "0.6587053", "0.6575464", "0.6549759", "0.6510648", "0.64960116", "0.6456182", "0.6450196", "0.6441333...
0.0
-1
For a given intensity matrix and midpoint value mid_value, return the difference map (see diffmap) with the proper midpoint color.
def get_diffmap_for(M, mid_value=0.0, **kwargs): Mmin, Mmax = M.min(), M.max() return diffmap(mid=(mid_value-Mmin) / (Mmax - Mmin), **kwargs)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def diffmap(mid=0.5, use_black=False):\n m = int(not use_black)\n segmentdata = { 'red': [(0, 1, 1), (mid, m, m), (1, 0, 0)],\n 'green': [(0, 0, 0), (mid, m, m), (1, 0, 0)],\n 'blue': [(0, 0, 0), (mid, m, m), (1, 1, 1)] }\n return LSC('RdWhBu', segmentdata)", "de...
[ "0.6853404", "0.6015778", "0.5425222", "0.52518445", "0.5215845", "0.5185668", "0.5179875", "0.5131757", "0.5131583", "0.5131583", "0.5131583", "0.5131583", "0.49886134", "0.49092737", "0.4889693", "0.48509473", "0.48508602", "0.47814962", "0.47762534", "0.4763996", "0.474199...
0.6858394
0
Conventional differencing map with graded red and blue for values less than and greater than, respectively, the mean of the data. Values approaching the mean are increasingly whitened, and the mean value is white.
def diffmap(mid=0.5, use_black=False): m = int(not use_black) segmentdata = { 'red': [(0, 1, 1), (mid, m, m), (1, 0, 0)], 'green': [(0, 0, 0), (mid, m, m), (1, 0, 0)], 'blue': [(0, 0, 0), (mid, m, m), (1, 1, 1)] } return LSC('RdWhBu', segmentdata)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def determine_color(score=be.df[\"score\"].mean()):\n avg_score = int(round(be.df[\"score\"].mean(), 0))\n if score < avg_score * 0.95:\n return \"red\"\n elif score > avg_score * 1.05:\n return \"green\"\n else:\n return \"yellow\"", "def lightness(self):\n min_component ...
[ "0.60227", "0.57572806", "0.5668451", "0.56669575", "0.5605286", "0.55654144", "0.5550292", "0.5537512", "0.5494354", "0.5462608", "0.5445197", "0.5441948", "0.53646445", "0.5362676", "0.5309056", "0.5297285", "0.52458024", "0.5243891", "0.52267265", "0.5226143", "0.5220546",...
0.60766786
0
Returns all of the patient fields for a given Patient ID.
def get_patient_fields(connection, patient_id): patient_id = str(patient_id) patient_field_results = pymedphys.mosaiq.execute( connection, """ SELECT TxField.FLD_ID, TxField.Field_Label, TxField.Field_Name, TxField.Version, TxF...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_fields_for_cr(cr_id):\n # Construct request\n url = \"{}/reports/{}/patient_fields\"\n url = url.format(FABRIC_API_URL, cr_id)\n\n sys.stdout.flush()\n result = requests.get(url, auth=auth)\n return result.json()", "def getMetadataFields(self, study_id):\n try:\n con =...
[ "0.7638833", "0.6249444", "0.6241787", "0.5919338", "0.5912562", "0.59045774", "0.5813044", "0.5777699", "0.5760114", "0.5727335", "0.5727335", "0.57182664", "0.5704563", "0.56991935", "0.5695287", "0.568826", "0.5680867", "0.5672122", "0.566745", "0.5660976", "0.56479514", ...
0.7786585
0
capture frame and reverse RBG BGR and return opencv image
def captureNextFrame(self): ret, readFrame=self.capture.read() if(ret==True): self.currentFrame=cv2.cvtColor(readFrame,cv2.COLOR_BGR2RGB)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def captureImage(capture):\n cvImg = cv.QueryFrame(capture)\n # cv.CvtColor(cvImg, cvImg, cv.CV_BGR2RGB)\n cvMat = cv.GetMat(cvImg)\n return cv.CloneMat(cvMat)", "def capture():\n stream = BytesIO()\n cam.capture(stream, 'jpeg')\n data = np.fromstring(stream.getvalue(), dtype=np.uint8)\n ...
[ "0.7031712", "0.6961248", "0.67733324", "0.67698646", "0.67168295", "0.6631839", "0.66124904", "0.6596871", "0.6594688", "0.65533656", "0.6541315", "0.64970255", "0.6480267", "0.6475994", "0.63838184", "0.63391477", "0.6332231", "0.633169", "0.6312778", "0.62934744", "0.62857...
0.66915715
5
converts frame to format suitable for QtGui
def convertFrame(self): try: height,width=self.currentFrame.shape[:2] img=QtGui.QImage(self.currentFrame, width, height, QtGui.QImage.Format_RGB888) img=QtGui.QPixmap.fromImage(img) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def convertFrame(self):\r\n try:\r\n height, width = self.currentFrame.shape[:2]\r\n img = QtGui.QImage(self.currentFrame,\r\n width,\r\n height,\r\n QtGui.QImage.Format_RGB888)\r\n img...
[ "0.6662103", "0.5891546", "0.5891546", "0.57573384", "0.57337284", "0.5656035", "0.55532897", "0.55452555", "0.55336356", "0.54665524", "0.5404309", "0.5376422", "0.53557295", "0.5321648", "0.53171486", "0.5305771", "0.52639043", "0.52639043", "0.52639043", "0.5260184", "0.52...
0.6601457
1
convert a rfc3339 date representation into a Python datetime
def rfc3339_to_datetime(data): try: ts = time.strptime(data, '%Y-%m-%d') return date(*ts[:3]) except ValueError as error: pass try: dt, _, tz = data.partition('Z') if tz: tz = offset(tz) else: tz = offset('00:00') ts = time.str...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rfc3339str_to_datetime(rfc3339_str):\n\n ret = None\n for fmt in rfc3339_date_input_fmts:\n try:\n ret = datetime.datetime.strptime(rfc3339_str, fmt)\n # Force this since the formats we support are all utc formats, to support non-utc\n if ret.tzinfo is None:\n ...
[ "0.77277243", "0.7557866", "0.6939527", "0.68279094", "0.6747444", "0.6724481", "0.6667682", "0.6641921", "0.66370517", "0.65986127", "0.6573383", "0.6560308", "0.65338504", "0.6486673", "0.646336", "0.6452801", "0.6445426", "0.6442138", "0.6438197", "0.6423296", "0.6411111",...
0.81067127
0
Creates actual manager, which can be further subclassed and instantiated without arguments.
def __new__(cls, *fields, **options): if ((not fields and hasattr(cls, 'fields') and hasattr(cls, 'allow_many')) or fields and not isinstance(fields[0], basestring)): # Class was already prepared. return super(NaturalManager, cls).__new__(cls) assert fields, 'No fiel...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new_manager() -> SyncManager:\n return Manager()", "def manager():\n pass", "def create_manager(self, username, tenancy):\n raise NotImplementedError", "def get_manager():\n return __manager__", "def get_manager():\n\n return multiprocessing.Manager()", "def create_manager(\n ...
[ "0.78406274", "0.7199186", "0.71282786", "0.7111841", "0.6985285", "0.6875047", "0.6726475", "0.66438735", "0.6631264", "0.66204035", "0.6607084", "0.6552734", "0.64892805", "0.645577", "0.64272857", "0.6420774", "0.61791205", "0.613841", "0.6131726", "0.6111986", "0.6106806"...
0.6136871
18
The password will be changed when the user is saved
def set_password(self, raw_password: str): self.new_password = raw_password
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save(self, *args, **kwargs):\n kwargs[\"commit\"] = False\n user = super(JOSNewPasswordForm, self).save(*args, **kwargs)\n\n password = self.cleaned_data.get(\"password1\")\n\n user.set_password(password)\n user.save()\n\n return user", "def save(self, commit=True):\...
[ "0.8387643", "0.8122888", "0.80822545", "0.79655004", "0.7886254", "0.7832762", "0.77869254", "0.7750751", "0.7690086", "0.76349056", "0.75918627", "0.7575142", "0.7539392", "0.75090134", "0.75023526", "0.74939597", "0.74773926", "0.7454426", "0.74517304", "0.7444587", "0.743...
0.7101471
56
The View function for the top page and home.
def home(request): if request.user.is_authenticated: return render(request, 'wantedly_app/home.html') # Execute the below if the user is not authenticated. if request.method == 'POST': user = authenticate(username=request.POST['username'], password=request.POST['password']) # If th...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def home(request):\n\treturn render(request, \"compta/home.html\")", "def home():\n tc = totalclicks()\n tl1, tl2, tl3 = topthreelinks()\n bl1, bl2, bl3 = topblomoedlinks()\n return flask.render_template('home.html', tc=tc, tl1=tl1, tl2=tl2, tl3=tl3, bl1=bl1, bl2=bl2, bl3=bl3)", "def home(self, *ar...
[ "0.7091475", "0.70445156", "0.70299345", "0.70086724", "0.7000072", "0.70000243", "0.69365287", "0.69318044", "0.69228727", "0.692016", "0.69026226", "0.689173", "0.68847394", "0.6867492", "0.6864389", "0.68447745", "0.68066126", "0.67986137", "0.67865497", "0.67817515", "0.6...
0.0
-1
The View function for the about page.
def about(request): return render(request, 'wantedly_app/about.html')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def about():\n return render_template('about.html', title='About')", "def about_view(request):\n return {'message': 'Info about us.'}", "def about_page(request):\r\n return render(request, 'ez_main/about_page.html')", "def about():\n\n\treturn render_template(\"about.html\")", "def aboutus(requ...
[ "0.80002", "0.799056", "0.79731536", "0.79608667", "0.7933555", "0.7901159", "0.7897344", "0.7870512", "0.7863864", "0.7857774", "0.78450185", "0.784392", "0.782511", "0.7823544", "0.7823544", "0.7819948", "0.7809141", "0.78086245", "0.7805979", "0.7798565", "0.7795315", "0...
0.77838695
21
The View function for the signup page.
def sign_up(request): context = { 'signup_form': SignUpForm(), 'profile_form': ProfileForm(), 'login_form': LoginForm(), } if request.method == 'GET': return render(request, 'registration/sign_up.html', context) # Execute the below if the signup form is posted. if r...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def showSignUpPage(request):\n return render(request, \"core/signup.html\", {\n\n })", "def signup():\n return render_template('auth/signup.html')", "def get(self):\n\n self.render(\"signup.html\")", "def showSignup():\n return render_template('signup.html')", "def sign_up():\n return...
[ "0.82068276", "0.8159498", "0.8060286", "0.80464447", "0.8036484", "0.79713154", "0.7881954", "0.7669237", "0.75833756", "0.756642", "0.7487902", "0.746106", "0.7328134", "0.7316656", "0.7214809", "0.7213889", "0.72098213", "0.7195882", "0.7175291", "0.7173706", "0.7167952", ...
0.6892625
36
The View function for the Profile page.
def profile(request, id): u = get_object_or_404(User, pk=id) context = ProfileContext(u).get_context() return render(request, 'wantedly_app/profile.html', context)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def view_profile():\n user_id = session.get(\"user_id\")\n \n user = User.query.get(session[\"user_id\"])\n \n return render_template(\"editable_profile_page.html\", user=user)", "def profile(request):\n return render(request, 'profile.html', context)", "def profile():\n \n return r...
[ "0.80185527", "0.79375666", "0.7934458", "0.77846044", "0.77808625", "0.77558196", "0.77408385", "0.7680066", "0.76265186", "0.751552", "0.7512421", "0.7430645", "0.7363787", "0.7356809", "0.73231965", "0.73184234", "0.7189979", "0.71482545", "0.7109793", "0.7100276", "0.7095...
0.75673157
9
The View function for the Profile edit page.
def profile_edit(request): if request.user.is_authenticated: u = request.user context = ProfileContext(u).get_context_with_form() context = calculate_char_in_textarea(context) return render(request, 'wantedly_app/profile_edit.html', context) else: return redirect('home')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def viewprofile():\n user = current_user\n form = UserUpdateForm(obj=user)\n form.populate_obj(user)\n if form.validate_on_submit():\n form.populate_obj(user)\n\n db.session.commit()\n\n flash('You have successfully edited your profile!')\n return render_template('user/user.html...
[ "0.8073889", "0.7958744", "0.78520644", "0.7720143", "0.7641491", "0.7496907", "0.747552", "0.74449766", "0.73899806", "0.7337671", "0.7270589", "0.72170943", "0.71899027", "0.7138172", "0.7130227", "0.7084803", "0.7052808", "0.70508546", "0.7049892", "0.6981817", "0.6954192"...
0.71286726
15
The function when POST action occurs in the Profile edit page. The POST data is sent by Ajax. The Ajax script is in main.js.
def profile_edit_post(request): if request.user.is_authenticated and request.method == 'POST': u = request.user rq = read_request_data(request) ji = judge_instance(u, rq, request) save_data_to_db(rq, ji, request) response = load_data_from_db(rq, ji) return HttpRespons...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def handle_ajax(self):\r\n pass", "def edit_profile(request, userId):\n try:\n try:\n user = User.objects.get(pk=userId)\n profile = Profile.objects.get(user_id=userId)\n user.first_name = request.data['first_name'] if 'first_name' in request.data else user.first...
[ "0.64560044", "0.62283105", "0.61597276", "0.6152454", "0.6027695", "0.6007733", "0.5926738", "0.5895855", "0.5893347", "0.5859112", "0.585527", "0.5765868", "0.57532847", "0.57269907", "0.5719247", "0.57186335", "0.57110727", "0.5680641", "0.5676178", "0.5657126", "0.5627813...
0.71993047
0
The View function for the organization page.
def organization(request, id): org = get_object_or_404(Organization, pk=id) context = { 'org': org, 'cover': modify_image_url(str(org.cover), 'cover'), 'logo': modify_image_url(str(org.logo), 'logo'), 'mission': "", 'values': "", 'members': "", } context[...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def org_view(org_id):\n org_detail = None\n try:\n org_detail = Organisation.query.filter_by(id=org_id).first()\n\n except IndexError:\n pass\n\n if org_detail is not None:\n return render_template('organisations/org_view.html', org_detail=org_detail, org=org_detail)\n\n\n elif ...
[ "0.69180477", "0.6562782", "0.6347636", "0.6236421", "0.61702347", "0.61681354", "0.6154304", "0.61482716", "0.6101052", "0.59865576", "0.58782595", "0.5795372", "0.5794597", "0.577704", "0.5755357", "0.5727754", "0.5677531", "0.5673188", "0.56458205", "0.56372476", "0.562334...
0.7201585
0
Pull the profile data from DB and add the data to the context.
def __init__(self, u): self.context = { 'u': u, 'cover': modify_image_url(str(u.profile.cover), 'cover'), 'avatar': modify_image_url(str(u.profile.avatar), 'avatar'), 'organizations': "", 'introduction': "", 'statement': "", 'wo...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_context_data(self, **kwargs):\r\n context = super().get_context_data(**kwargs)\r\n context['user'] = self.request.user\r\n context['profile'] = self.request.user.profile\r\n return context", "def get_profile_data(auth, db):\n\n id_team, user, team, money, color_prim, color_se...
[ "0.6975846", "0.65331084", "0.64676595", "0.63053834", "0.6209058", "0.6158559", "0.6157175", "0.612888", "0.61132", "0.6072251", "0.6061658", "0.59937143", "0.59250313", "0.5912794", "0.584297", "0.58187157", "0.57715756", "0.5744373", "0.5740175", "0.563154", "0.56282204", ...
0.6137119
7
Add the form to the context.
def get_context_with_form(self): self.context['form'] = { 'profile': ProfileEditForm(), 'avatar': AvatarForm(), 'cover': CoverForm(), 'introduction': IntroductionForm(), 'statement': StatementForm(), 'experience': ExperienceForm(), ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def form(self, form):\n\n self._form = form", "def form(self, form):\n\n self._form = form", "def get_context_data(self):\n return {\"form\": self.get_form()}", "def register_form(self):\n f = Form()\n self.forms = f\n return f", "def form(self):\n if getatt...
[ "0.7144628", "0.7144628", "0.6993413", "0.688578", "0.681279", "0.6785873", "0.6544541", "0.64791316", "0.6425021", "0.6402661", "0.63913417", "0.63824195", "0.633752", "0.6306994", "0.6285876", "0.6278406", "0.62484014", "0.6244671", "0.6233216", "0.62002236", "0.6193718", ...
0.74072003
0
Modify image url each types and return it.
def modify_image_url(image_url, type=''): parsed_uri = urlparse(image_url) if parsed_uri.scheme == 'https' or parsed_uri.scheme == 'http': pass elif image_url == '': image_url = '/media/default_' + type + '.jpg' else: image_url = '/media/' + image_url return image_url
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_image_url():", "def url_for(**options):\n\n url_parts = get_url_parts(**options)\n image_hash = hashlib.md5(b(options[\"image_url\"])).hexdigest()\n url_parts.append(image_hash)\n\n return \"/\".join(url_parts)", "def get_thumbnail_url():", "def get_url_image(self, obj):\n return s...
[ "0.7146244", "0.6298754", "0.6159808", "0.6114807", "0.6114807", "0.6114807", "0.60653496", "0.6041088", "0.6010959", "0.6006904", "0.59923077", "0.5985666", "0.5966213", "0.592543", "0.5918504", "0.59183526", "0.5910592", "0.58902115", "0.5883194", "0.5861966", "0.5857781", ...
0.77044326
0
Pull max_length of text column in DB and calculate the number of characters that can be entered to textarea. And add calculated data to the context.
def calculate_char_in_textarea(context): context['max_length'] = {} context['remaining_length'] = {} introduction_max_length = Introduction._meta.get_field('introduction').max_length context['max_length']['introduction'] = introduction_max_length if context['introduction']: context['remaini...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def compute_user_description_text_length(row):\n row[\"user_description_text_length\"] = len(row['user_description'])\n return row[\"user_description_text_length\"]", "def set_max_sentence_length(self):\n new_max = int(self.set_max_sentence.get())\n cur_min = self.min_sentence_length\n\n ...
[ "0.6396993", "0.6259367", "0.6027601", "0.59684163", "0.5717755", "0.5667692", "0.564673", "0.56400645", "0.5621926", "0.5595736", "0.5549537", "0.5544679", "0.5539502", "0.5515646", "0.5499823", "0.5490022", "0.54774857", "0.5465199", "0.5458489", "0.5439081", "0.5363234", ...
0.798289
0
Read the request.POST and the request.FILES data. The function is called in the profile_edit_post function.
def read_request_data(request): print(request.POST) print(request.FILES) rq = { 'change_privacy_level': request.POST.get('change-privacy-level', False), 'target_instance_name': request.POST.get('target-instance-name', False), 'edit_target_instance_id': request.POST.get('uuid', False)...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def post(self, request, *args, **kwargs):\n user_prof = UserProfile.objects.get(user=request.user)\n form = AboutFunderForm(request.POST, request.FILES)\n if form.is_valid():\n name = form.cleaned_data['name']\n content = form.cleaned_data.get('content')\n fund...
[ "0.6435877", "0.6140716", "0.60834515", "0.60343087", "0.6024056", "0.5950326", "0.5948689", "0.5940282", "0.5928336", "0.58589065", "0.58264875", "0.58215076", "0.5799543", "0.5796606", "0.576883", "0.5722754", "0.5717224", "0.56721866", "0.564817", "0.5510797", "0.550546", ...
0.7192528
0
Judge the instance to be edited. The function is called in the profile_edit_post function.
def judge_instance(u, rq, request): ji = { 'instance': '', 'form': '', 'image_form': '', } if rq['target_instance_name'] == 'profile': ji['instance'] = u.profile ji['form'] = ProfileEditForm(request.POST or None, instance=ji['instance']) elif rq['target_instance_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def edit_profile_post(request, pk=None):\n profilepost = get_object_or_404(ProfilePost, pk=pk) \n if (request.user == profilepost.user or\n request.user.is_superuser):\n if request.method == \"POST\":\n profile_post_form = ProfilePostForm(request.POST, request.FILES, instanc...
[ "0.69602066", "0.6737818", "0.66141385", "0.63811874", "0.6378778", "0.63334167", "0.6307408", "0.62878174", "0.62370384", "0.6225368", "0.6220724", "0.61918736", "0.6174082", "0.60948354", "0.60337526", "0.601735", "0.59988207", "0.5988501", "0.59767634", "0.5938747", "0.593...
0.6105586
13
Save the edited or added profile data. The function is called in the profile_edit_post function.
def save_data_to_db(rq, ji, request): if rq['change_privacy_level']: privacy_id = request.POST.get('privacy-id', False) ji['instance'].privacy = Privacy(pk=privacy_id) ji['instance'].save() elif rq['delete_img_flag']: ji['instance'].save() elif rq['delete_target_instance_id']...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save_profile(self):\n self.save()", "def save_user_profile(instance, **_):\n instance.profile.save()", "def save_profile(sender, instance, **kwargs):\n instance.profile.save()", "def saveProfile(self, request):\n return self._doProfile(request)", "def save_user_profile(sender, insta...
[ "0.76954156", "0.7443638", "0.7389677", "0.73589927", "0.73051345", "0.73051345", "0.72756493", "0.7101942", "0.6893983", "0.67917323", "0.67493933", "0.6743772", "0.66627395", "0.6646145", "0.6614826", "0.6592018", "0.6571289", "0.6566441", "0.65061134", "0.64844215", "0.648...
0.0
-1
Load the saved data. The function is called in the profile_edit_post function.
def load_data_from_db(rq, ji): response = { 'result': '設定が更新されました!', 'uuid': str(ji['instance'].id), 'target_instance_name': rq['target_instance_name'], 'change_privacy_level': rq['change_privacy_level'], 'add_new_profile_data': rq['add_new_profile_data'], 'delete_tar...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def post_load(self, data):\n return data", "def _load(self) -> None:\n self.record = self._saved_record\n self.counter = self._saved_counter\n self.current_objects = self._saved_objects", "def loadData(self, data):\n\n #Grab the guide settings in case we want to use them here...
[ "0.6625922", "0.6267086", "0.61494297", "0.6144365", "0.5976707", "0.5961987", "0.59402853", "0.59083605", "0.58963484", "0.5867567", "0.5815157", "0.58075064", "0.5776614", "0.5773734", "0.5746203", "0.56932014", "0.56506425", "0.56445485", "0.5628721", "0.56106454", "0.5609...
0.0
-1
Remove the sterile registry and replace it with the one that
def uninstall(self): getSiteManager.sethook(self.old)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reset_registries():\n StepRegistry().clear()\n HookRegistry().reset()\n ExtensionRegistry().reset()", "def tear_down_registry(registry):\n for reg_adp in list(registry.registeredAdapters()):\n registry.unregisterAdapter(factory=reg_adp.factory,\n required=...
[ "0.6923052", "0.6774927", "0.6669881", "0.63998425", "0.6381192", "0.6318257", "0.62571", "0.6245309", "0.61353266", "0.6050785", "0.60379833", "0.58028156", "0.5711218", "0.5693762", "0.5680666", "0.5668571", "0.56544274", "0.5647842", "0.56013906", "0.55829656", "0.55812925...
0.5996638
11
printing capital 'P' using for loop
def for_P(): for row in range(7): for col in range(4): if col==0 or row in (0,3) and col!=3 or col==3 and row in(1,2): print("*",end=" ") else: print(" ",end=" ") print()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def display_pokemon(pokemon_party):\n \n for count, i in enumerate(pokemon_party, start=0):\n print(f\"{count+1}){pokemon_party[count]}\")", "def print_phrase(self):\r\n for letter in self.phrase:\r\n if letter == ' ':\r\n print(letter, end=' ')\r\n else:\...
[ "0.6292577", "0.6186484", "0.60026276", "0.59637165", "0.5761991", "0.57389694", "0.57382977", "0.5718504", "0.5718504", "0.5718504", "0.5669218", "0.566629", "0.5628453", "0.5627613", "0.5620463", "0.5611722", "0.5610559", "0.56080395", "0.55921006", "0.55819786", "0.5577338...
0.6000895
3
printing capital 'P' using while loop
def while_P(): i=0 while i<7: j=0 while j<4: if j==0 or i in(0,3) and j%3!=0 or j==3 and i in(1,2): print("*",end=" ") else: print(" ",end=" ") j+=1 print() i+=1
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def print_phrase(self):\r\n for letter in self.phrase:\r\n if letter == ' ':\r\n print(letter, end=' ')\r\n else:\r\n print(letter.show(), end=' ')\r\n print('\\n')", "def operation(level):\r\n blank = 0\r\n while blank < len(input_list[leve...
[ "0.60286325", "0.58887637", "0.5877251", "0.5765733", "0.5721193", "0.56865925", "0.5669595", "0.56365657", "0.5609904", "0.55644715", "0.5557263", "0.5557263", "0.5557263", "0.5554934", "0.5519928", "0.5482042", "0.5440737", "0.54331636", "0.54306805", "0.54181135", "0.53854...
0.6100206
0
Returns the normalized name for the task.
def TaskNormalizedName(cls, task): abs_path = FileUtils.GetAbsPathForFile(task) if abs_path: return abs_path return task
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def task_name(self) -> str:\n return self._task_name", "def task_name(self):\n pass", "def getTaskName(self):\n return self._taskName", "def TaskDisplayName(cls, task):\n if not task: return None\n return '//' + cls.TaskRelativeName(task)", "def TaskBaseName(cls, task):\n if n...
[ "0.8382673", "0.79891896", "0.79698485", "0.79065853", "0.77549475", "0.73818046", "0.708065", "0.708065", "0.7041858", "0.7030377", "0.6922824", "0.6897264", "0.68918365", "0.68649757", "0.682683", "0.6758295", "0.67563534", "0.6754193", "0.6749823", "0.6647676", "0.66235113...
0.85451823
0
Returns the relative name for the task w.r.t the src dir.
def TaskRelativeName(cls, task): if not task: return None return os.path.relpath(cls.TaskNormalizedName(task), PipelineConfig.Instance().pipeline_base_dir())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def TaskNormalizedName(cls, task):\n abs_path = FileUtils.GetAbsPathForFile(task)\n if abs_path: return abs_path\n return task", "def src_name(self) -> str:\n return self._src_name", "def TaskBaseName(cls, task):\n if not task: return None\n return os.path.basename(task)", "def task_nam...
[ "0.70790714", "0.70685434", "0.70276946", "0.68989986", "0.6897503", "0.6831635", "0.67773825", "0.6771261", "0.67468935", "0.67403793", "0.66436476", "0.65638936", "0.6533882", "0.6504925", "0.6454892", "0.645265", "0.6442094", "0.63864714", "0.632192", "0.6313081", "0.63065...
0.8300594
0
Returns the display name for the task.
def TaskDisplayName(cls, task): if not task: return None return '//' + cls.TaskRelativeName(task)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def task_name(self) -> str:\n return self._task_name", "def task_name(self):\n pass", "def getTaskName(self):\n return self._taskName", "def display_name(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"display_name\")", "def display_name(self) -> pulumi.Output[str]:\n ...
[ "0.82471687", "0.81944007", "0.78453606", "0.77776456", "0.77776456", "0.77776456", "0.77776456", "0.77776456", "0.77776456", "0.77776456", "0.77776456", "0.77776456", "0.77776456", "0.7674832", "0.7674832", "0.7674832", "0.7674832", "0.7674832", "0.7674832", "0.7674832", "0....
0.8725436
0
Returns the base name for the task.
def TaskBaseName(cls, task): if not task: return None return os.path.basename(task)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def task_name(self):\n pass", "def task_name(self) -> str:\n return self._task_name", "def base_name(self):\n return self._project.path", "def TaskRelativeName(cls, task):\n if not task: return None\n return os.path.relpath(cls.TaskNormalizedName(task),\n ...
[ "0.80576354", "0.7993184", "0.76752627", "0.7604692", "0.75275767", "0.7465695", "0.74218655", "0.741003", "0.7403453", "0.7358316", "0.7225236", "0.7169889", "0.7147637", "0.71266806", "0.6995057", "0.6930375", "0.6924231", "0.6897062", "0.6875494", "0.68721527", "0.6861195"...
0.8556416
0
Returns the dir name for the task.
def TaskDirName(cls, task): if not task: return None return os.path.dirname(task)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dir_name(self):\n return self._dir", "def GetTaskOutputRelativeDir(cls, task):\n task = os.path.dirname(cls.TaskRelativeName(task))\n if not task: return ''\n\n parts = task.split(os.sep)\n res_parts = []\n for part in parts:\n priority_name = part.split('_', 1)\n res_parts +=...
[ "0.7382956", "0.71118563", "0.7021062", "0.70205456", "0.7001556", "0.69878685", "0.69065046", "0.69002163", "0.6749548", "0.6700269", "0.66729057", "0.6617986", "0.66096455", "0.6530177", "0.6515121", "0.63931465", "0.6349999", "0.63473034", "0.63405544", "0.63321805", "0.63...
0.8452019
0
Returns the display name for a list of tasks.
def TasksDisplayNames(cls, tasks): return [cls.TaskDisplayName(task) for task in tasks]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def TaskDisplayName(cls, task):\n if not task: return None\n return '//' + cls.TaskRelativeName(task)", "def task_name(self):\n pass", "def task_name(self) -> str:\n return self._task_name", "def show_tasks(self, tasks=None, date_format=None):\n\n\t\tif not tasks:\n\t\t\ttasks = self.task...
[ "0.7450009", "0.7172618", "0.69796497", "0.6694739", "0.66327953", "0.6623551", "0.6532465", "0.6459202", "0.6419528", "0.6419528", "0.6419528", "0.6419528", "0.6419528", "0.6419528", "0.6419528", "0.6419528", "0.6419528", "0.6419528", "0.6363873", "0.6363873", "0.6363873", ...
0.8679665
0
Returns the priority of the task.
def GetTaskPriority(cls, task): if not task: return None task = cls.TaskRelativeName(task) priority = '' parts = task.split(os.sep) for part in parts: priority_name = part.split('_', 1) if len(priority_name) < 2 or not priority_name[0].isdigit(): return None priority += priority_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_priority(self):\n return self.options[\"priority\"]", "def get_priority(self):\n return self.options['priority']", "def priority(self) -> int:\n return pulumi.get(self, \"priority\")", "def priority(self) -> str:\n return pulumi.get(self, \"priority\")", "def get_priorit...
[ "0.79299945", "0.79171634", "0.7853719", "0.78262603", "0.7825332", "0.7825332", "0.7815426", "0.7815426", "0.77602154", "0.7622434", "0.7622434", "0.7622434", "0.7622434", "0.7606914", "0.7606914", "0.7606914", "0.7505123", "0.7503515", "0.7503515", "0.7503515", "0.7503515",...
0.79160833
2
Returns the output directory for the task. This removes all priority info from the task. This path is intended for use as input to CreateAllSubDirsForPath() which can generate the relevant output dirs for the path.
def GetTaskOutputRelativeDir(cls, task): task = os.path.dirname(cls.TaskRelativeName(task)) if not task: return '' parts = task.split(os.sep) res_parts = [] for part in parts: priority_name = part.split('_', 1) res_parts += [priority_name[1]] return os.sep.join(res_parts)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def GetOutDirForTask(cls, task):\n rel_path = cls.GetTaskOutputRelativeDir(task)\n subdirs = PipelineConfig.Instance().GetAllSubDirsForPath(rel_path)\n return subdirs.get('PIPELINE_OUT_DIR', '')", "def output_directory(self):\n if self._output_directory is None:\n cache_filename = self...
[ "0.76105917", "0.69024384", "0.6888713", "0.6840183", "0.6792421", "0.67734486", "0.6719438", "0.6704272", "0.6657806", "0.6648596", "0.65524286", "0.6510063", "0.6486327", "0.6458716", "0.64314944", "0.6418034", "0.6389241", "0.63731694", "0.63688755", "0.63460684", "0.63168...
0.76557827
0
Returns the out dir base for the pipeline.
def GetOutSubDir(cls): return PipelineConfig.Instance().pipeline_subdirs().get('PIPELINE_OUT_DIR', '')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def out_dir(self) -> str:\n return self._out_dir", "def get_base_dir(self):\n return self._config_dict['output']['@baseDirectory']", "def outputdir():\n return __OUTPUT_DIR__", "def output_path():\n folder = path.join(path.curdir, \"stages\")\n folder = path.abspath(folder)\n return...
[ "0.7739622", "0.7588257", "0.7478215", "0.73121095", "0.7309159", "0.72506773", "0.72222686", "0.71670294", "0.70638156", "0.70635444", "0.6981685", "0.69800514", "0.6948506", "0.6907481", "0.6896779", "0.68842655", "0.6840776", "0.6840294", "0.68123174", "0.67847246", "0.677...
0.80701506
0
Returns the out dir for the task.
def GetOutDirForTask(cls, task): rel_path = cls.GetTaskOutputRelativeDir(task) subdirs = PipelineConfig.Instance().GetAllSubDirsForPath(rel_path) return subdirs.get('PIPELINE_OUT_DIR', '')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def out_dir(self) -> str:\n return self._out_dir", "def GetTaskOutputRelativeDir(cls, task):\n task = os.path.dirname(cls.TaskRelativeName(task))\n if not task: return ''\n\n parts = task.split(os.sep)\n res_parts = []\n for part in parts:\n priority_name = part.split('_', 1)\n re...
[ "0.8124036", "0.7807332", "0.7749472", "0.77024525", "0.75807124", "0.75534135", "0.7461827", "0.74134356", "0.73026556", "0.7255008", "0.7196208", "0.7184133", "0.71576756", "0.71497446", "0.71199167", "0.708671", "0.7082931", "0.697324", "0.6912908", "0.690384", "0.68974566...
0.83940774
0
Returns the publish dated dir for the task.
def GetPublishDirForTask(cls, task): if not PipelineConfig.Instance().pipeline_publish_dir(): return '' out_dir = cls.GetOutDirForTask(task) if not out_dir: return '' return out_dir.replace(cls.GetOutSubDir(), PipelineConfig.Instance().pipeline_publish_dir())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def GetPublishCurrentDirForTask(cls, task):\n if not PipelineConfig.Instance().pipeline_publish_dir(): return ''\n\n out_dir = cls.GetOutDirForTask(task)\n if not out_dir: return ''\n out_dir = out_dir.replace(cls.GetOutSubDir(), PipelineConfig.Instance().pipeline_publish_dir())\n return os.path.joi...
[ "0.7302616", "0.6539091", "0.6442193", "0.6307431", "0.626553", "0.62530804", "0.6200344", "0.61683017", "0.60647184", "0.6061066", "0.60597706", "0.60472125", "0.6033625", "0.6007393", "0.5978313", "0.5960628", "0.5911679", "0.5867535", "0.58419484", "0.58406895", "0.5836643...
0.7450393
0
Returns the current publish dir for the task.
def GetPublishCurrentDirForTask(cls, task): if not PipelineConfig.Instance().pipeline_publish_dir(): return '' out_dir = cls.GetOutDirForTask(task) if not out_dir: return '' out_dir = out_dir.replace(cls.GetOutSubDir(), PipelineConfig.Instance().pipeline_publish_dir()) return os.path.join(os.path.d...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def GetPublishDirForTask(cls, task):\n if not PipelineConfig.Instance().pipeline_publish_dir(): return ''\n\n out_dir = cls.GetOutDirForTask(task)\n if not out_dir: return ''\n return out_dir.replace(cls.GetOutSubDir(), PipelineConfig.Instance().pipeline_publish_dir())", "def get_dir(self):\n ...
[ "0.8311917", "0.66121066", "0.6603187", "0.6539092", "0.65207803", "0.6476241", "0.6405742", "0.639465", "0.6389074", "0.6347666", "0.6347057", "0.6316912", "0.62855846", "0.6264913", "0.6236826", "0.6235748", "0.6203303", "0.6187073", "0.61870384", "0.61644363", "0.61621976"...
0.87881327
0
Returns the log file for the task.
def GetLogFileForTask(cls, task): rel_path = cls.TaskRelativeName(task) if not rel_path or not PipelineConfig.Instance().pipeline_log_dir(): return None # Flatten the path. rel_path = rel_path.replace(os.sep, '.') return os.path.join(PipelineConfig.Instance().pipeline_log_dir(), rel_path + '.log')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_log_file(self):\n self.log_file = os.path.join(\n self.directory,\n \"ts\",\n self.ts.reaction_label,\n \"conformers\",\n \"{}_{}_{}.log\".format(self.ts.reaction_label, self.ts.direction, self.ts.index))\n return self.log_file", "def g...
[ "0.7858659", "0.76647484", "0.76480573", "0.75937", "0.74517137", "0.7376751", "0.7348423", "0.7322756", "0.73191816", "0.7068097", "0.7066757", "0.70392674", "0.6990611", "0.69762087", "0.694384", "0.6891112", "0.68894416", "0.6869049", "0.6851791", "0.6836735", "0.6825012",...
0.84021187
0
Returns the previous dated sibling directory containing the request file.
def GetPrevDatedDirCotainingPattern(cls, path, pattern): while path: prev_dir = FileUtils.GetPreviousDatedDir(path) if prev_dir and glob.glob(os.path.join(prev_dir, pattern)): return prev_dir path = prev_dir return None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def previous_directory(self):\r\n prev_dir = Path(self.path_viewer.text()).parent\r\n self.set_new_path(str(prev_dir))", "def get_previous_path(cls,tag) :\n if re.search('./',tag) :\n a,tag = os.path.split(tag)\n l = cls.Variants[tag]\n if len(l) == 2 :\n ...
[ "0.7043889", "0.6543688", "0.6499275", "0.64525276", "0.6379416", "0.6375339", "0.6351219", "0.62836957", "0.6264441", "0.62580884", "0.62292373", "0.62176466", "0.6164836", "0.61125314", "0.6109885", "0.60798436", "0.6078996", "0.60758823", "0.60333776", "0.60294205", "0.601...
0.6055854
18
Returns the email id for zeus.
def ZeusEmailId(cls, mail_domain): return ('zeus+%s+noreply@%s.%s' % (PipelineConfig.Instance().pipeline_id(), socket.gethostname(), mail_domain))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_id(self):\n return self.email", "def get_id(self):\n return self.email", "def get_id(self):\n return escape(self.email)", "def get_email_template_id(self):\n return self.email_template_id", "def generate_email_address(self):\n return \"%s.%s@%s\" % (uuid.uuid4(), ...
[ "0.7823534", "0.7823534", "0.76104593", "0.66705906", "0.6644535", "0.6607022", "0.6607022", "0.6607022", "0.6598872", "0.65259534", "0.65159255", "0.6464402", "0.6455131", "0.64423794", "0.6381351", "0.63786924", "0.63620985", "0.6347863", "0.6347863", "0.6347863", "0.634786...
0.7983458
0
Compute the cosine distance between a "model" M from an author's set of documents and a featureset F extracted from D (the document to anonymize.) Note that m and f must be of equal length for this computation to be meaningful.
def cosine_distance(m, f): return (1 - ((m * f).sum() / (norm(m) * norm(f))))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cosine_similarity(self, source_doc, input_doc):\n vectorizer = self.vectorizer or TfidfVectorizer(tokenizer=PlagiarismDetector.tokenize_and_stem, stop_words='english')\n tfidf = vectorizer.fit_transform([source_doc, input_doc])\n return ((tfidf * tfidf.T).A)[0, 1]", "def cossim(corpus):\...
[ "0.6630762", "0.61939925", "0.6147209", "0.60718644", "0.6021758", "0.59584635", "0.5938526", "0.5901172", "0.58796334", "0.58659804", "0.5859782", "0.58310515", "0.581814", "0.5765349", "0.57595015", "0.57588243", "0.5756044", "0.57552505", "0.5741638", "0.5714364", "0.57093...
0.72795385
0
Create an empty disjoint forest
def __init__(self, size = 100): self.__parent = [i for i in range(size)] self.__rank = [0 for _ in range(size)]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_forest(comm, depth, htarget=5.0, filename=\"cantilever.stp\"):\n # Load the geometry model\n geo = TMR.LoadModel(filename)\n\n # Mark the boundary condition faces\n verts = geo.getVertices()\n faces = geo.getFaces()\n volumes = geo.getVolumes()\n\n # Set source and target faces\n ...
[ "0.5749455", "0.5624931", "0.56204474", "0.5562846", "0.5494885", "0.5315566", "0.5272273", "0.52571905", "0.5256525", "0.521862", "0.5198441", "0.5163385", "0.5129123", "0.5122395", "0.5119441", "0.51045215", "0.5103846", "0.5083557", "0.5068666", "0.50231063", "0.50011575",...
0.0
-1
Return the string representation
def __str__(self): return str(self.__parent)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_str(self) -> str:", "def to_string(self):\r\n return self.__str__()", "def toString():", "def toString(self) -> str:\n raise NotImplementedError", "def to_str(self):\n return pformat(self.to_dict())", "def to_str(self):\n return pformat(self.to_dict())", "def to_str(s...
[ "0.8306265", "0.8090477", "0.8065673", "0.79516023", "0.79034895", "0.79034895", "0.79034895", "0.79034895", "0.79034895", "0.79034895", "0.79034895", "0.79034895", "0.79034895", "0.79034895", "0.79034895", "0.79034895", "0.79034895", "0.79034895", "0.79034895", "0.79034895", ...
0.0
-1
Return the representative of x
def find(self, x): if(self.__parent[x] != x): self.__parent[x] = self.find(self.__parent[x]) return self.__parent[x]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def agnesi(x):\n return 1/(1+x**2)", "def g(self, x):\n return x * (1 - x)", "def x(self):\r\n return self.unif[0]", "def evaluate(self, x):\r\n return self.forward(x)[0]", "def x(self):\n return self.x", "def independent(self):\n return self.x", "def apply(cls, x):\n ...
[ "0.71208394", "0.68357193", "0.6741086", "0.6738478", "0.6732434", "0.6643247", "0.66232073", "0.6616977", "0.6584508", "0.65603054", "0.65516174", "0.6518618", "0.6518618", "0.6518618", "0.6518618", "0.6518618", "0.6518618", "0.6518618", "0.6518618", "0.6518618", "0.6518618"...
0.0
-1
Performs the union of the collections where x and y belong
def union(self, x, y): rx, ry = self.find(x), self.find(y) krx, kry = self.__rank[rx], self.__rank[ry] if(krx >= kry): self.__parent[ry] = rx if(krx == kry): self.__rank[rx] = self.__rank[rx] + 1 else: self.__parent[rx] = ry
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def union(set1, set2):", "def union(self,x,y):\n assert x in self and y in self\n rx,ry = self.find(x),self.find(y)\n if rx!=ry:\n nx,ny = self.__rank[rx],self.__rank[ry]\n if nx<=ny:\n self.__parent[rx] = ry\n self.__size[ry] += self.__size[rx]\n if nx==ny: self.__rank[ry...
[ "0.76819134", "0.7398091", "0.7039702", "0.68953127", "0.68443996", "0.68340266", "0.68339586", "0.6819198", "0.6807751", "0.6807751", "0.67667603", "0.67397404", "0.67224586", "0.6701945", "0.6700268", "0.6622474", "0.6608949", "0.6595676", "0.6559491", "0.65472156", "0.6528...
0.6765475
11
method for getting the json file.
def _filepath(self, which_one: str): dataset = self.mode.name with open('data/dstc2_{}/scripts/config/dstc2_{}.flist'.format( 'test' if self.mode is DSTC2.Mode.test else 'traindev', dataset )) as flist: paths = flist.read().splitlines() for path in paths: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_json(filename) :\n result = json.load(open(filename,'r'))\n return result", "def download_json(self):\n # make the path dir if it doesn't exist\n if not self.path.is_dir():\n self.path.mkdir(parents=True)\n\n # open a file, send a request for the json and write to ...
[ "0.7534961", "0.73098904", "0.7234796", "0.7234796", "0.71960187", "0.7113393", "0.7083411", "0.70211965", "0.69739604", "0.6961993", "0.6951935", "0.6931603", "0.69309044", "0.69165653", "0.69121474", "0.6837195", "0.6836966", "0.68329525", "0.6778984", "0.6775207", "0.67447...
0.0
-1
read the dataset json file. Gets only the utterance and the first label for that utterance
def read_json(self): utterances, labels = [], [] for log in self.log_json: for turn in log['turns']: utterance = turn['output']['transcript'] label = turn['output']['dialog-acts'][0]['act'] utterances.append(utterance) labels.ap...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_dataset():\n data = request.get_json()\n return jsonify(result=Tree.files(data['label']))", "def load_dataset(data_json):\n with open(data_json, 'r') as file:\n data = [json.loads(l) for l in file]\n \n ecgs = []; labels = []\n \n for entry in tqdm.tqdm(data):\n ecgs.ap...
[ "0.63026005", "0.6185721", "0.613367", "0.61276716", "0.6103785", "0.60992557", "0.60845", "0.605887", "0.60186905", "0.5916006", "0.5856801", "0.5816078", "0.5790435", "0.57400084", "0.56922793", "0.5689473", "0.5661292", "0.5655901", "0.5613307", "0.5607707", "0.56064785", ...
0.6511941
0
Build the word dictionary from the dataset.
def _build_set(self, n_words): # count all words counter = Counter() utterances, labels = self.read_json() for utterance in utterances: tokens = nltk.word_tokenize(utterance) counter.update(tokens) # generate an int representation count = [['UNK',...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def build_dataset(words):\n count = []\n # count.extend(collections.Counter(words).most_common(n_words - 1))\n count.extend(collections.Counter(words).most_common())\n dictionary = dict()\n for word, _ in count:\n dictionary[word] = len(dictionary)\n data = list()\n # unk_count = 0\n for word in words:\...
[ "0.745151", "0.71270126", "0.69602984", "0.6791243", "0.67032725", "0.6685858", "0.6682602", "0.6563543", "0.65620625", "0.6562013", "0.6547336", "0.6540815", "0.6525479", "0.6476588", "0.64454633", "0.6439453", "0.6438709", "0.64279246", "0.6408625", "0.64002645", "0.6381944...
0.0
-1
encode labels into int representation
def _build_label(self): counter = Counter() _, labels = self.read_json() counter.update(labels) dictionary = dict() for i, word in enumerate(counter.most_common()): dictionary[word[0]] = i return dictionary
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def encode_label(self, label: str) -> int:\n return self.class_map[label]", "def encode_label(label: str) -> int:\n\tif not label:\n\t\treturn 0\n\t# part after letter if it has a number, otherwise 1\n\tindex = int(label[1:]) if len(label) > 1 else 1\n\t# A = 1, B = 2, ... E = 5\n\toffset = ord(label[0]) ...
[ "0.74007314", "0.73307025", "0.7182741", "0.7160468", "0.7084768", "0.7046795", "0.70365775", "0.7003301", "0.6909219", "0.66486865", "0.6618533", "0.65429914", "0.65429384", "0.6502384", "0.64889055", "0.6430829", "0.639269", "0.6301232", "0.6262231", "0.62427974", "0.617515...
0.0
-1
method for converting a sentence into List[int] based on the encoded word dictionary
def word2vec(self, sentence: str): tokens = nltk.word_tokenize(sentence) v = [self.word_dict.get(token, 0) for token in tokens] return v
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _sentences_to_ints(texts, lowercase=True):\n w_dict = {}\n for sen in texts:\n for w in sen:\n if lowercase:\n w = w.lower()\n w_dict.update({w: w_dict.get(w, 0) + 1})\n int_to_word = [(i, word[0]) for i, word in\n ...
[ "0.7370511", "0.7102135", "0.7051201", "0.7021026", "0.68867725", "0.68590796", "0.6716552", "0.65488654", "0.6540233", "0.6526179", "0.6510303", "0.6396774", "0.63948077", "0.6361679", "0.6361622", "0.6342499", "0.63343316", "0.6306907", "0.6306843", "0.62784266", "0.6263717...
0.6224745
24
Function returning the feature vectors, labels as int representations
def word_vecs(self, raw_label=False): utterances, labels = self.read_json() # print(utterances) # print(self.label_dict) utterances = [self.word2vec(u) for u in utterances] if raw_label: labels = labels else: labels = [self.label_dict[l] for l in l...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def feature_label(features):\n f=[]\n l=[]\n for item in features:\n f.append(item[0])\n l.append(item[1])\n return f,l", "def feats_to_vec(features):\n vec = [0] * len(F2I)\n for feature in features:\n if feature in F2I:\n vec[F2I[feature]] += 1\n return vec"...
[ "0.73276436", "0.7024504", "0.6902145", "0.6832875", "0.6736696", "0.6561274", "0.65415835", "0.6539557", "0.6518541", "0.6480069", "0.64189994", "0.64095014", "0.6408895", "0.63794714", "0.63169545", "0.6266113", "0.6262751", "0.62511265", "0.6238904", "0.623087", "0.6194604...
0.0
-1
Function returning the DSTC2 data as a Dataset class representation
def dataset(self, data_size: float = 1.0, features=None): from collections import Counter import nltk utterances, labels = self.read_json() size = int(len(utterances) * data_size) utterances = utterances[:size] labels = labels[:size] if features is None: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def as_dataset(self) -> \"Dataset\":\n \n freq_def = {\n 1: \"L1\", # G\n 2: \"L2\", # G\n 5: \"L5\", # G\n 20: \"L2C\", # G\n 101: \"L1\", # R\n 102: \"L2\", # R\n 201: \"E1\", # E \n 205: \"E...
[ "0.67227435", "0.63342255", "0.62304074", "0.6221889", "0.62172234", "0.60951495", "0.60861737", "0.6084175", "0.6060473", "0.60367596", "0.5998212", "0.597592", "0.597592", "0.5972852", "0.5956344", "0.589599", "0.5874409", "0.58533835", "0.5852439", "0.58283246", "0.5811923...
0.0
-1
the basic structure of a hexagonal lattice is persumed, if no other parameter are not given
def __init__(self, Nd=2, J_hop=1., delta = 1., it = 0, k_vec = np.zeros((2), float), **kwargs): self.J_hop = J_hop # the hopping coefficient self.Nd = Nd # dimension of Hamiltonian, self.delta = delta # time-dep hopping amplitude self.it = it ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def make_init(self,L,noise=0.005):\n self.L = L\n self.x0 = self.hexagonal_lattice(int(np.ceil(self.L/0.5)),int(np.ceil(self.L/np.sqrt(3))),noise=noise)\n # self.x0 = self.hexagonal_lattice(self.n_c,self.n_c,noise=noise)\n # self.x0 = self.x0[self.x0.max(axis=1) < L*0.95...
[ "0.6057267", "0.60398334", "0.59376043", "0.5860045", "0.5755649", "0.57389784", "0.57116485", "0.563488", "0.5621987", "0.5537128", "0.55340034", "0.5484667", "0.54307127", "0.5425045", "0.5408305", "0.540819", "0.5307512", "0.53026265", "0.5274596", "0.5259547", "0.52546215...
0.0
-1
update the Hamiltonian matrix by new kvector and timeinterval it
def updateH(self,k_vec,it): self.k_vec = k_vec self.it = it self.H_kc = fl.H_k(k_vec, self.it, self.delta)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def Hamiltonian_setup(N,V,interval):\n (a,b) = interval\n H = np.zeros((N-1,N-1))\n h= (b-a)/N\n for i in range(N-1):\n for j in range(N-1):\n if i==j:\n x=((i+1)*h) + a\n Vi=V(x)\n H[i,j] = Vi + 2/(h**2)\n if i==j+1 or i==j-1:\n...
[ "0.6314911", "0.59838396", "0.59380555", "0.58630985", "0.58421797", "0.5684106", "0.56371933", "0.5370095", "0.5368967", "0.53191304", "0.53141874", "0.5274858", "0.5238412", "0.52382356", "0.52371114", "0.520182", "0.5200775", "0.5192901", "0.5190681", "0.5169864", "0.51665...
0.6105699
1