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 equivalent pandas datatypes.
def to_pandas(self): from ibis.formats.pandas import PandasSchema return PandasSchema.from_ibis(self)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pandas_typecast(self) -> dict:\n res = {}\n for feat in self.data_features:\n res[feat.key] = ApiForm.typecast(feat.dtype)\n return res", "def data_all_types(df):\n \n printmd (\"**Type of every column in the data**\")\n print(\"\")\n print(df.dtypes)", "def dtyp...
[ "0.7483843", "0.72879285", "0.7218836", "0.7067673", "0.7021887", "0.6965492", "0.69583434", "0.6892431", "0.679947", "0.6767429", "0.6765784", "0.67289424", "0.67004156", "0.66771317", "0.66665137", "0.66434366", "0.65977997", "0.656646", "0.65374166", "0.6502871", "0.647896...
0.0
-1
Return the equivalent pyarrow schema.
def to_pyarrow(self): from ibis.formats.pyarrow import PyArrowSchema return PyArrowSchema.from_ibis(self)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ArrowSchema(self) -> pa.Schema:", "def to_pyarrow(self):\n from ibis.backends.pyarrow.datatypes import ibis_to_pyarrow_schema\n\n return ibis_to_pyarrow_schema(self)", "def from_pyarrow(cls, pyarrow_schema):\n from ibis.formats.pyarrow import PyArrowSchema\n\n return PyArrowSche...
[ "0.8562046", "0.7632091", "0.68013066", "0.67765164", "0.6759869", "0.6724262", "0.6692505", "0.6598262", "0.6513932", "0.64983606", "0.6494904", "0.645149", "0.63553303", "0.6347682", "0.6347312", "0.6320295", "0.6315729", "0.6309261", "0.62695515", "0.62400705", "0.62399536...
0.7085298
2
Return the equivalent dask dtypes.
def to_dask(self): return self.to_pandas()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dtypes(self):\n return self.to_pandas().dtypes", "def infer_dtype(self):\n raise NotImplementedError", "def get_inferred_dtypes(self, dtypes_validated: TYPE_DSTR) -> TYPE_DSTR:\n\n dtypes_inferred = {}\n\n for column in self.df.columns:\n if column in dtypes_validated...
[ "0.74660766", "0.71805847", "0.68874955", "0.68139136", "0.6721712", "0.6702788", "0.6629063", "0.66237265", "0.6595934", "0.65799826", "0.65768605", "0.6568972", "0.65321016", "0.645831", "0.64208734", "0.6414597", "0.6409395", "0.6366331", "0.63314426", "0.6329928", "0.6310...
0.0
-1
Return the name of a schema column at position `i`.
def name_at_position(self, i: int) -> str: return self.names[i]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def table_column(self, i):\n return self.__column_list[i]", "def name_at_position(self, i: int) -> str:\n upper = len(self.names) - 1\n if not 0 <= i <= upper:\n raise ValueError(f'Column index must be between 0 and {upper:d}, inclusive')\n return self.names[i]", "def col...
[ "0.7554233", "0.75307804", "0.6253363", "0.6253363", "0.6171738", "0.61690795", "0.60926527", "0.60854715", "0.60502803", "0.5991299", "0.5967933", "0.596589", "0.5952607", "0.59414124", "0.5929768", "0.5908907", "0.58810186", "0.5862473", "0.5850232", "0.5824398", "0.5803906...
0.6199214
4
Construct ibis schema from schemalike python objects.
def schema(value: Any) -> Schema: raise InputTypeError(value)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, *args):\n _snap.Schema_swiginit(self, _snap.new_Schema(*args))", "def __init__(self, schema ):\n self.schema = schema", "def schema(self):", "def __init__(self, schema_row):\n self.schema = []\n for field in schema_row['fields']:\n self.schema.append(field['...
[ "0.62577", "0.6180562", "0.612678", "0.5922187", "0.5897925", "0.5819396", "0.58068603", "0.5785505", "0.5751523", "0.56711197", "0.5658533", "0.5637067", "0.56042147", "0.55953413", "0.5585807", "0.5556987", "0.5550922", "0.552284", "0.5511621", "0.5507841", "0.55021834", ...
0.0
-1
Infer the corresponding ibis schema for a python object.
def infer(value: Any, schema=None) -> Schema: raise InputTypeError(value)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def from_pyarrow(cls, pyarrow_schema):\n from ibis.formats.pyarrow import PyArrowSchema\n\n return PyArrowSchema.to_ibis(pyarrow_schema)", "def schema(self):", "def schema(self):\n raise NotImplementedError", "def ArrowSchema(self) -> pa.Schema:", "def schema() -> None:\n pass", "...
[ "0.62825453", "0.61824614", "0.61252975", "0.60899466", "0.6025038", "0.59748214", "0.5887591", "0.5862484", "0.58444434", "0.5745744", "0.5745725", "0.5689893", "0.5672773", "0.56652063", "0.56336737", "0.5529997", "0.55236036", "0.5503059", "0.54725903", "0.54714566", "0.54...
0.55060166
17
Print a meeting in the format specified in tabulate
def print_event(self): list_of_names = [str(c) for c in self.__list_of_contacts] joined_names = ', '.join(list_of_names) table = [[str(self._title)],["Date: "+str(self._date)],["Time: "+str(self._start)+" - "+str(self._end)],["Participants: "+str(joined_names)]] print(tabulate(table, ta...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __print_work_table(table):\n print \"%-5s %-30s %5s %5s %5s %5s %5s\" % ('Act', 'Pred', 'Block', 'Dummy', 'Succ', 'start', 'end')\n for k, col in sorted(table.items()):\n print \"%-5s %-30s %5s %5s %5s %5s %5s\" % tuple(\n [str(k)] + [list(col[0])] + [str(col[i]) for i in range(1, l...
[ "0.67374814", "0.650423", "0.6415967", "0.63342494", "0.63282096", "0.63114744", "0.6205536", "0.6193938", "0.6146755", "0.61387426", "0.611123", "0.6099525", "0.607082", "0.6061641", "0.60406595", "0.60314196", "0.6027438", "0.60216784", "0.60027564", "0.59833956", "0.598065...
0.67390203
0
Returns a list of requirements for building, as strings
def get_requires_for_build_wheel(config_settings=None): info = read_flit_config(pyproj_toml) # If we can get version & description from pyproject.toml (PEP 621), or # by parsing the module (_via_ast), we don't need any extra # dependencies. If not, we'll need to try importing it, so report any # run...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_requirement_strings(self):\n opts = self.get_options()\n return (\n opts.requirements,\n opts.timeout_requirements,\n opts.cov_requirements,\n opts.unittest2_requirements,\n )", "def output_requirements(requirements):\n return '\\n'.join('{0}=={1}'.format(key, value)\n ...
[ "0.8221567", "0.734749", "0.73026896", "0.6939991", "0.6884221", "0.68012553", "0.67826086", "0.6729706", "0.66376734", "0.660002", "0.6565588", "0.65557647", "0.65537924", "0.6433085", "0.6422791", "0.64084184", "0.6387786", "0.6351328", "0.6327737", "0.63250446", "0.6319358...
0.0
-1
Builds a wheel, places it in wheel_directory
def build_wheel(wheel_directory, config_settings=None, metadata_directory=None): info = make_wheel_in(pyproj_toml, Path(wheel_directory)) return info.file.name
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def build_wheel( # noqa:C901\n req=None, # type: Optional[TInstallRequirement]\n reqset=None, # type: Optional[Union[TReqSet, Iterable[TInstallRequirement]]]\n output_dir=None, # type: Optional[str]\n preparer=None, # type: Optional[TPreparer]\n wheel_cache=None, # type: Optional[TWheelCache]\...
[ "0.7076905", "0.67512256", "0.668144", "0.6616252", "0.6360134", "0.6259471", "0.6247735", "0.62405473", "0.6217855", "0.6099086", "0.6084555", "0.607915", "0.58472735", "0.57984155", "0.5774062", "0.5718388", "0.5654345", "0.56417274", "0.56394243", "0.56072754", "0.5585533"...
0.7281537
0
Builds an sdist, places it in sdist_directory
def build_sdist(sdist_directory, config_settings=None): path = SdistBuilder.from_ini_path(pyproj_toml).build(Path(sdist_directory)) return path.name
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _build_sdist(projdir, destdir, version):\n startdir = os.getcwd()\n try:\n os.chdir(projdir)\n # clean up any old builds\n cleanup('build')\n _build_dist('sdist', destdir)\n cleanup('build')\n if sys.platform.startswith('win'):\n os.chdir(destdir)\n ...
[ "0.81465816", "0.77726394", "0.7270736", "0.7080168", "0.6794272", "0.6646683", "0.65300876", "0.6493829", "0.6294017", "0.62699586", "0.6009657", "0.6009582", "0.59840405", "0.5958203", "0.5942298", "0.59193593", "0.5905268", "0.586562", "0.58555853", "0.5838701", "0.5810813...
0.78519255
1
Forms a new tuple by removing the head and adding word to the tail.
def shift(t, word): return t[1:] + (word,)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def arrange_trigram(t, word):\n return t[1:] + (word,) # returns new tuple", "def tupleofwords_to_wordoftuples(tupleofwords):\n return list(zip_longest(*tupleofwords, fillvalue=None))", "def shift(self, t, word):\n return t[1:] + (word,)", "def build_tuple(se...
[ "0.6418071", "0.6346002", "0.6233666", "0.62205017", "0.59590167", "0.5822437", "0.57986724", "0.5786385", "0.5692204", "0.5620294", "0.5596683", "0.5516665", "0.5507671", "0.5425695", "0.5425695", "0.5392829", "0.5380489", "0.5372302", "0.53522336", "0.5264407", "0.5264071",...
0.6161151
4
Generates random wordsfrom the analyzed text. Starts with a random prefix from the dictionary.
def random_text(n): start = random.choice(suffix_map.keys()) for i in range(n): suffixes = suffix_map.get(start, None) if suffixes == None: # if the start isn't in map, we got to the end of the # original text, so we have to start again. random_text(n-i) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generate(self, words=5):\n seed()\n return sorted(self.keywords, key=lambda *args: random())[0:words]", "def generate_new_word(model: Dict[str, Set[str]]) -> str:\n all_keys = list(dict.keys(model))\n return random.choice(all_keys)", "def gen_word(prefixes, suffixes):\n word = ''\n ...
[ "0.7152832", "0.70901644", "0.7081521", "0.69076353", "0.6862432", "0.6862432", "0.6862432", "0.6855847", "0.68058985", "0.6784311", "0.67443913", "0.6706348", "0.66863126", "0.666776", "0.66527236", "0.6651313", "0.6633531", "0.6623222", "0.661802", "0.6602975", "0.65938205"...
0.66053754
19
Finds and returns the current Skia sheriff.
def _get_skia_sheriff(): skia_sheriff_url = 'https://skia-tree-status.appspot.com/current-sheriff' return json.load(urllib2.urlopen(skia_sheriff_url))['username']
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_scene(orig_scene, match):\n \n image_to_compare = orig_scene.copy()\n \n r,c,_ = match.shape\n ir, ic, _ = image_to_compare.shape\n min_ssd = None\n\n\n for x in range(r):\n for y in range(c):\n # compare to sample image to start off with...\n # mse(imageA...
[ "0.55295104", "0.5523952", "0.5441981", "0.5334586", "0.5289384", "0.5241326", "0.5241326", "0.5162711", "0.51379424", "0.51379424", "0.5106453", "0.50707823", "0.49536857", "0.49430507", "0.48796844", "0.48774913", "0.48752755", "0.4857649", "0.4856254", "0.4855268", "0.4826...
0.6047922
0
If the name does not include '@', append '.org'.
def _complete_email(name): if '@' not in name: return name + '@chromium.org' return name
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _ensure_fqdn(self, name):\n if name[-1:] != \".\":\n return \"%s.\" % name\n else:\n return name", "def make_email(email: str) -> str:\n name, domain = email.split('@')\n\n empty_and_dot = ('', '.')\n new_email = [char + choice(empty_and_dot) for char in name[:-1]...
[ "0.6497594", "0.62800753", "0.61623675", "0.6121726", "0.60995024", "0.6052412", "0.6029269", "0.6010381", "0.598751", "0.5984499", "0.59310365", "0.59200096", "0.58873206", "0.5856794", "0.581703", "0.5801245", "0.5786105", "0.5780181", "0.5774503", "0.5747844", "0.5728314",...
0.65883
0
Determines whether the given email address is valid.
def _email_is_valid(email): return VALID_EMAIL_REGEXP.match(email) is not None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_email(address):\n try:\n validate_email(address)\n return True\n except:\n return False", "def is_valid_email_address (email):\n return valid_email.search(email)", "def is_valid_email_address(email_address):\n\t# requirements = re\n\treturn EMAIL_REGEX.match(email_address) !=...
[ "0.85897905", "0.8571418", "0.83789897", "0.8318031", "0.8277697", "0.8206891", "0.82036805", "0.81784165", "0.8161717", "0.8118336", "0.8111282", "0.80645365", "0.80546945", "0.8032254", "0.8025741", "0.79951423", "0.7943299", "0.79406726", "0.78730816", "0.7846007", "0.7845...
0.81402814
9
Returns the given list with any invalid email addresses removed.
def _filter_emails(emails): rv = [] for email in emails: if _email_is_valid(email): rv.append(email) else: print 'WARNING: Not including %s (invalid email address)' % email return rv
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def stripped_email_list(self):\n stripped_emails = [self._strip_email(email) for email in self.email_list]\n return stripped_emails", "def _cleanse_emails(emails):\n\n hit = False\n\n # Ensure we have a list.\n # Might have received a single string.\n if not isinstance(e...
[ "0.7772395", "0.7329067", "0.72403747", "0.6899788", "0.6697985", "0.6694312", "0.6415261", "0.6359821", "0.63345075", "0.63159084", "0.62172383", "0.62019163", "0.59883523", "0.5988252", "0.58961385", "0.58704084", "0.5809922", "0.58049273", "0.5785311", "0.5780129", "0.5777...
0.7666392
1
Returns the revision of the last roll.
def _last_roll_revision(self): if not self._cached_last_roll_revision: revinfo = subprocess2.check_output(['gclient', 'revinfo'], cwd=self._path_to_chrome) project_path = 'src/' + self._path_to_project for line in revinfo.splitlines(): dep_path, sou...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_last_revision(self):\n return self.index.get_index_revision(self.name)", "def last_revision(self):\n return self.revision_set.order_by(\"created_on\").last()", "def get_latest_revision(self):\n revision_list = self.get_revision_list()\n if revision_list:\n return ...
[ "0.787462", "0.77408046", "0.7395016", "0.7169948", "0.7140431", "0.7073292", "0.70303994", "0.69887865", "0.6910241", "0.6910241", "0.6854756", "0.68167895", "0.66349727", "0.66345936", "0.66305566", "0.6626378", "0.66246563", "0.65837735", "0.6563593", "0.65481496", "0.6495...
0.77297217
2
Ensure that new_roll_revision is newer than last_roll_revision.
def _compare_revisions(self, last_roll_revision, new_roll_revision): # Ensure that new_roll_revision is not an ancestor of old_roll_revision. try: subprocess2.check_call(['git', '--git-dir', self._project_git_dir, 'merge-base', '--is-ancestor', n...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_last_roll(self, roll):\n\n # Increment the attribute by the passed value\n self._last_roll = roll", "def _last_roll_revision(self):\n if not self._cached_last_roll_revision:\n revinfo = subprocess2.check_output(['gclient', 'revinfo'],\n cwd...
[ "0.5904212", "0.58974093", "0.56630087", "0.56507784", "0.5629114", "0.5496527", "0.54854286", "0.5464327", "0.54065496", "0.5376886", "0.5353647", "0.52900136", "0.5266059", "0.5256558", "0.52369004", "0.5156522", "0.51469284", "0.5130393", "0.5106145", "0.5050239", "0.50294...
0.77547526
0
Shorten a Git commit hash.
def _short_rev(self, revision): return subprocess2.check_output(['git', '--git-dir', self._project_git_dir, 'rev-parse', '--short', revision] ).rstrip()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def expand_short_commit_digest(refenv: lmdb.Environment, commit_hash: str) -> str:\n reftxn = TxnRegister().begin_reader_txn(refenv)\n commitParentStart = commit_parent_db_key_from_raw_key(commit_hash)\n with reftxn.cursor() as cursor:\n shortHashExists = cursor.set_range(commitParentStart)\n ...
[ "0.73842186", "0.68625987", "0.6678249", "0.6590356", "0.64762706", "0.63618886", "0.61957", "0.6189092", "0.6170607", "0.61457145", "0.6116378", "0.59887016", "0.59115225", "0.5903543", "0.5870623", "0.5848819", "0.5843042", "0.58114064", "0.580356", "0.57976186", "0.5768039...
0.5941998
12
Flush all monitor data to disk and close any open rending windows.
def close(self): super(KartRecorder, self).close() if hasattr(self, "video"): self.video.release()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def close(self):\n if self.proc:\n self.proc.terminate()\n self.proc.wait()\n self.proc = None\n del os.environ['DISPLAY']\n if self.fbdir:\n os.rmdir(self.fbdir)\n self.fbdir = None", "def flush(self):\n self.__checkOpen()\n ...
[ "0.6458882", "0.6169166", "0.61375904", "0.6060234", "0.6048682", "0.6038172", "0.60280097", "0.5988746", "0.5944875", "0.59433377", "0.58874184", "0.5855135", "0.584768", "0.58303475", "0.58062977", "0.58025354", "0.57874113", "0.5782501", "0.5760466", "0.575797", "0.5756002...
0.0
-1
Each time a new episode is started, the first
def KartDiscreteSkip(KartMultiDiscretizer): def __init__(self, env, max_skip): super(KartDiscreteSkip, self).__init__(env) self.max_skip = max_skip def reset(self, **kwargs): observation = super(KartDiscreteSkip, self).reset(**kwargs) observation, _, _, _ = self.env.step(self....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def start_episode(self):\n self.last_sensation = self.env()\n self.next_action = self.agent(self.last_sensation)", "def OnEpisodeStart(self):\n pass", "def startEpisode(self):\n self.lastState = None\n self.lastAction = None\n self.episodeRewards = 0.0\n\n print...
[ "0.74777174", "0.7459163", "0.74056876", "0.7226401", "0.6989912", "0.6833122", "0.6714491", "0.6679469", "0.6586426", "0.6496253", "0.6496253", "0.6490763", "0.6358326", "0.6294596", "0.6275568", "0.6192533", "0.6191089", "0.60953546", "0.6068517", "0.60085", "0.59664613", ...
0.0
-1
Get absolute path to resource, works for dev and for PyInstaller
def widget_path(relative_path): real_path = os.path.abspath(os.path.join(os.path.dirname(os.path.abspath(__file__)),"..")) base_path = getattr(sys, '_MEIPASS', real_path) return os.path.join(base_path, relative_path)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_resource_path():\n return os.path.join(os.path.dirname(__file__), \"resources\") + os.path.sep", "def resourcePath(relative):\r\n try:\r\n # PyInstaller creates a temp folder and stores path in _MEIPASS\r\n base_path = sys._MEIPASS\r\n except Exception:\r\n base_path = os.pa...
[ "0.83695436", "0.8280479", "0.82485795", "0.8139178", "0.8114118", "0.80985415", "0.80940944", "0.80797124", "0.80677074", "0.80673695", "0.8062465", "0.8062465", "0.8062465", "0.8062465", "0.8062465", "0.8062465", "0.8062465", "0.80569947", "0.80545217", "0.80448323", "0.804...
0.67379564
92
Finds a package and returns the prefix (or None if the package is not installed) as well as the folder that contains the package or module as a tuple. The package path returned is the module that would have to be added to the pythonpath in order to make it possible to import the module. The prefix is the path below whi...
def find_package(import_name): root_mod_name = import_name.split('.')[0] loader = pkgutil.get_loader(root_mod_name) if loader is None or import_name == '__main__': # import name is not found, or interactive/main module package_path = os.getcwd() else: # For .egg, zipimporter does...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_packages_path_from_package(package):\n root = finder.get_package_root(package)\n\n if is_built_package(package):\n package_name_folder = os.path.dirname(root)\n\n return os.path.dirname(package_name_folder)\n\n return os.path.dirname(root)", "def get_package_path():\n package_na...
[ "0.70141685", "0.69994724", "0.6892829", "0.682072", "0.67390347", "0.65677124", "0.6546146", "0.6531919", "0.65055424", "0.63818043", "0.63818043", "0.63660294", "0.62868327", "0.6284478", "0.62476885", "0.62447834", "0.6233799", "0.62180525", "0.6208255", "0.6187852", "0.61...
0.73515135
0
Does filename have the right extension?
def allowed_file(filename): return '.' in filename and \ filename.rsplit('.', 1)[1] in ALLOWED_EXTENSIONS
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_good_file(filename):\n for e in extensions:\n if filename.endswith(e):\n return True\n return False", "def check_allowed_extension(filename):\n return '.' in filename and filename.rsplit('.', 1)[1] in ALLOWED_EXTENSIONS", "def isExtensionSupported(filename):\n\tr...
[ "0.8175792", "0.8096151", "0.8093916", "0.8046253", "0.8033267", "0.8031603", "0.8024645", "0.79953194", "0.7994354", "0.7982996", "0.7975772", "0.79300594", "0.79300594", "0.79102004", "0.79071707", "0.79071707", "0.789413", "0.789413", "0.78927565", "0.78927565", "0.7892756...
0.7877349
33
>>> encryptMessage('HDarji', 'This is Harshil Darji from Dharmaj.') 'Akij ra Odrjqqs Gaisq muod Mphumrs.'
def encrypt(self, message, key): return self.translateMessage(message, key, "encrypt")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def encrypt_message(self):\r\n\t\t#Will not let user input useless messages that cannot be encrypted.\r\n\t\twhile True:\r\n\t\t\tself.message = input(\"Please enter a message you would like to encrypt. --> \")\r\n\t\t\tif self.message != \"\" and len(self.message) > 4:\r\n\t\t\t\tbreak\r\n\t\tself.setup_key_encry...
[ "0.7649288", "0.7455626", "0.7448802", "0.7400037", "0.73880076", "0.73387706", "0.72141796", "0.7155884", "0.711027", "0.7101812", "0.7088552", "0.70171213", "0.70133585", "0.6993428", "0.69250244", "0.6892062", "0.6785811", "0.6772237", "0.6726093", "0.6719309", "0.67081356...
0.6814104
16
>>> decryptMessage('HDarji', 'Akij ra Odrjqqs Gaisq muod Mphumrs.') 'This is Harshil Darji from Dharmaj.'
def decrypt(self,message, key): return self.translateMessage(message, key, "decrypt")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def decrypt_message(encrypted_message):", "def decrypt_message(self):\r\n\r\n\t\t#Will not let user input useless messages that cannot be decrypted.\r\n\t\twhile True:\r\n\t\t\tself.message = input(\"Please enter a message you would like to decrypt. --> \")\r\n\t\t\tif self.message != \"\" and len(self.message) ...
[ "0.8504155", "0.7798317", "0.77316475", "0.76322657", "0.7575592", "0.75293887", "0.7329691", "0.7295507", "0.7258182", "0.7218777", "0.7206869", "0.714759", "0.71140593", "0.70489913", "0.7015959", "0.7012131", "0.6983384", "0.6957681", "0.69416356", "0.6922926", "0.6884887"...
0.74382186
6
returns the mean of a list with floats
def mean(l): return sum(f) / max(1, len(f))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getMean(list):\n return sum(list) / len(list)", "def mean(list_of_values):\r\n # Explicit float(...) to allow for Python 2 division.\r\n return sum(list_of_values) / float(len(list_of_values))", "def _mean(listvalue):\n\treturn sum(listvalue)/len(listvalue)", "def get_mean(numlist):\n ...
[ "0.82278067", "0.8157484", "0.8111115", "0.81080157", "0.80680996", "0.8053436", "0.8040954", "0.80012536", "0.7930469", "0.7899532", "0.7898195", "0.7888556", "0.7888363", "0.78487796", "0.7818584", "0.78174084", "0.7767387", "0.7765281", "0.7765247", "0.7749035", "0.774255"...
0.79925734
8
reads a float form a string, even if it has the german format 0,123...
def parse_float(s): return float(s.replace(',', '.'))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __parse_float(str):\n return float(str.strip().replace(',','.'))", "def float_from_string(data):\n return float(maybe_number(data))", "def ffloat(string):\n try:\n return float(string.strip())\n except:\n return 0", "def read_float(v):\n if v.strip() == '':\n return 0....
[ "0.80227596", "0.77828217", "0.7699975", "0.7610833", "0.75872433", "0.7562495", "0.7347126", "0.7338427", "0.7285755", "0.7278729", "0.72324264", "0.7218965", "0.7198287", "0.7153326", "0.7091352", "0.7007192", "0.6976528", "0.69736487", "0.69532895", "0.6889665", "0.688155"...
0.7946037
1
Setup to run before each test.
def setUp(self): audio = open(SAMPLE_AUDIO, 'rb') self.converter = Converter(FileStorage(audio), 'en') audio.close()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setUp(self):\n test_env_setup()", "def before_run_tests(cls):\n pass", "def setUp(self):\n\n BaseTest.setUp(self)", "def setUp(self):\n pass #because we dont have anything to setup.", "def setUp(self):\r\n # nothing to do, all tests use different things\r\n pas...
[ "0.81505406", "0.8075117", "0.80032307", "0.79998565", "0.79487646", "0.7942599", "0.79185873", "0.7893009", "0.78359973", "0.78359973", "0.7829187", "0.7829187", "0.78268546", "0.78209335", "0.78209335", "0.7774749", "0.77681744", "0.7762983", "0.775813", "0.77469707", "0.77...
0.0
-1
Make sure the language is correct.
def test_language_conversion(self): self.assertEqual(self.converter.language, LANGUAGE_CODE, 'Check the language conversion.')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def testLanguage(self):\n if self.language in tools.LANGUAGES:\n self.assertEqual(\n self.language,\n self.config.language\n )\n else:\n self.assertNotEqual(\n self.language,\n self.config.language\n ...
[ "0.7461226", "0.74418116", "0.69557554", "0.6906872", "0.68655086", "0.68053037", "0.6803358", "0.6737107", "0.65065056", "0.647546", "0.64750373", "0.64712805", "0.6432323", "0.6425811", "0.6384908", "0.63830936", "0.63120383", "0.6301334", "0.63007563", "0.6299916", "0.6269...
0.71786284
2
Make sure the output file is wav format that can be used in moviepy.
def test_repair_file(self): audio_path = self.converter.audio self.assertTrue(audio_path.endswith('.wav')) # Make sure it can be loaded in moviepy clip = AudioFileClip(audio_path)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _to_wav(self):\n self._status = 0\n fname = fm.file2wav(self.get_filename()) \n if fname != self.get_filename(): # can change the name\n self._set_filename(fname) # in case of wave transcoding\n self._status = 1", "def convert_wav(src_wav, dst_wav, subtype='PCM_16'...
[ "0.6746549", "0.6638169", "0.6547723", "0.6489097", "0.6335564", "0.61946046", "0.616676", "0.6152689", "0.61306745", "0.6089117", "0.59809846", "0.59232265", "0.5917819", "0.5913669", "0.5835563", "0.5834596", "0.5795886", "0.5795476", "0.5768282", "0.57350564", "0.57267624"...
0.73776585
0
Check the convert_audio_to_text method.
def test_convert_audio_to_text(self): text = self.converter.convert_audio_to_text(START, END, [WORD], lambda: False) text = text.strip() self.assertEqual(text, WORD)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def convert_text(self):\n if msg.askyesno(message=\"Do you want to save audio file?\"):\n text = self.textbox.get(\"1.0\", tk.END)\n self.file.text = text\n files = [('Sound', '*.mp3')]\n mp3_file = asksaveasfile(title=\"Save your mp3 file\", filetypes=files, defa...
[ "0.72078073", "0.70218307", "0.68539006", "0.6316053", "0.62490535", "0.61305404", "0.6069292", "0.6001499", "0.59893584", "0.59762806", "0.59096026", "0.5887048", "0.57868725", "0.5771812", "0.5754475", "0.5692169", "0.5669798", "0.5667358", "0.5658711", "0.56554246", "0.565...
0.7876781
0
Called when the extension is loaded for a package or module (only when the extension is explicitly declared as an extension in the respective entity).
def init_extensions(self, package, module): pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_load(self):\n class TestExtension(Extension):\n pass\n\n self.setup_extension(TestExtension, enable=False)\n\n self.assertEqual(self.manager.get_installed_extensions(),\n [TestExtension])\n self.assertEqual(len(self.manager.get_enabled_extensi...
[ "0.66776913", "0.65020835", "0.64648277", "0.63726574", "0.63116807", "0.6220009", "0.61930776", "0.61930776", "0.61861295", "0.61385167", "0.6085559", "0.6050383", "0.603748", "0.6032699", "0.60284346", "0.6005604", "0.5946452", "0.59076786", "0.5884992", "0.5878957", "0.587...
0.7516416
0
Preprocess the source code of a Python module before it is executed. Must return the new source code string.
def preprocess_python_source(self, module, source): return source
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def exec_module(self, module):\n\n if not self.filename.endswith(config.FILE_EXT) and not self.filename.endswith(\n \"__init__.py\"\n ):\n print(\"Fatal error: ExtensionLoader is asked to load a normal file.\")\n print(\"filename:\", self.filename)\n print(...
[ "0.65866953", "0.61385167", "0.60301584", "0.60084313", "0.5923618", "0.58659154", "0.5835329", "0.58320415", "0.5829022", "0.57728", "0.5757757", "0.56760406", "0.56760406", "0.56760406", "0.56760406", "0.56760406", "0.5669681", "0.5610596", "0.5605799", "0.55920196", "0.556...
0.79914194
0
Returns a pathlib.Path for this request string. The implementation for RequestString.path always raises a RuntimeError because it is never absolute. This property only works on absolute requests.
def path(self): if os.path.isabs(self._value): return pathlib.Path(self._value) raise RuntimeError('RequestString.path not supported.')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_path(self, normalize = False):\r\n\r\n split = self.path_s.split(\"?\", 1)\r\n path = split[0]\r\n if not normalize: return path\r\n if not path.startswith((\"http://\", \"https://\")): return path\r\n return netius.legacy.urlparse(path).path", "def get_path(self, path)...
[ "0.7237451", "0.678672", "0.67106724", "0.6682079", "0.66322964", "0.6565029", "0.65359443", "0.65359443", "0.65359443", "0.6533527", "0.65183985", "0.64979887", "0.64979595", "0.64671755", "0.6465075", "0.6459914", "0.6457533", "0.64359605", "0.64359605", "0.64359605", "0.64...
0.88102084
0
Join this request string with a path. Only works for nonabsolute paths.
def joinwith(self, path): return path.joinpath(self._value)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _path_join(self, path):\n return os.path.join(self._path, path)", "def path(self, *path):\n path = list(filter(None, path))\n path = self.remove_prefix(path)\n items = [self.prefix_] + path\n return self.delimiter.join(items)", "def join(self, *parts):\n if parts:\n ...
[ "0.7004373", "0.69685245", "0.6831771", "0.68287516", "0.6785721", "0.6680574", "0.6644102", "0.6640286", "0.66127735", "0.6597202", "0.6591887", "0.6567443", "0.65204865", "0.6462723", "0.6442612", "0.6436504", "0.6395395", "0.63829744", "0.6377503", "0.63243717", "0.6290333...
0.6545364
12
Returns the name of the module. If Module.package is available, the name will be retrieved by creating a relative path from Module.filename to the Package.directory. If that failes, the Module.filename's `stem` is returned.
def name(self): if self.package: directory = self.package.directory if self.package.resolve_root: directory = directory.joinpath(self.package.resolve_root) rel = None try: rel = self.filename.with_suffix('').relative_to(directory) except ValueError as e: if sel...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def module_name(self):\n return self.lib.get_module_name()", "def module_name(self):\n if hasattr(self, \"module\"):\n return self.module.__name__\n return None", "def get_module_name(module_path):\n return ntpath.split(module_path)[1].split(\".\")[0]", "def get_module_name...
[ "0.76959693", "0.76019776", "0.75682527", "0.75682527", "0.7519076", "0.7470714", "0.7449334", "0.7388281", "0.7383214", "0.7352827", "0.72029555", "0.71613055", "0.7131809", "0.71139187", "0.7069969", "0.7022314", "0.70211965", "0.6990903", "0.6924631", "0.6900874", "0.68821...
0.86636263
0
Called to initialize the Module.namespace and reset Module.exports and should be used from Module.load() before the actual module content is loaded.
def init(self): self.loaded = False self.exports = NotImplemented self.exception = None self.namespace = self.create_namespace() self.namespace.__file__ = str(self.filename) self.namespace.module = self self.namespace.require = self.require
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _real_initialize(self):\n pass", "def initialize(self, module_name):\n # Load.\n self._initialize(module_name)", "def reset_modules(self) -> None:\n self.modules = {}\n self.update_modules()\n self.parse_modules()", "def __init__(self):\n\t\tScriptedLoadableModul...
[ "0.6664494", "0.66051054", "0.65584654", "0.65281165", "0.6483904", "0.64576524", "0.64576524", "0.64576524", "0.6457478", "0.6387795", "0.6372517", "0.6342101", "0.6283617", "0.6277023", "0.623577", "0.62349564", "0.61848664", "0.61729324", "0.61496955", "0.61472875", "0.614...
0.74685425
0
Implemented by subclass. Loads the contents of the module. Use Context.load_module() instead of calling this method directly for the standard behaviour and integrity checks (also calls init()).
def load(self): raise NotImplementedError
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mod_load(self):\n raise NotImplementedError(\"Mod load isn't overriden\")", "def load(self):\n\n\t\tif self.module is None:\n\t\t\t# Cause the interpreter to load the module in local namespace ...\n\t\t\texec \"import \" + self.name\n\n\t\t\t# Store the module object ...\n\t\t\tobject.__setattr__(self...
[ "0.771879", "0.77034295", "0.70456576", "0.70456576", "0.70456576", "0.69720906", "0.6965364", "0.68258", "0.6812579", "0.6797123", "0.66770613", "0.6668645", "0.66392994", "0.6534504", "0.6521039", "0.6483622", "0.6475898", "0.6402016", "0.6402016", "0.6402016", "0.6402016",...
0.6173194
33
Agrega una columna de precio de transporte a cada obra en la lista
def agregarprecios(obras): costos = lt.newList(datastructure='ARRAY_LIST') costototal = 0 z = 1 while z <= lt.size(obras): costofinal = 0 pesofinal = 0 costo_area = 0 costo_volumen = 0 if lt.getElement(obras,z)['Weight (kg)'] != '': costofinal = 72.00 ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_data(self):\n data = list(IgnitionRow.objects.all().order_by('-pub_date')[:self.num_ticks].values())\n two_hours = data[::-1]\n pct_flop_data = [[int(elem['pct_flop_{}'.format(key)]) for elem in two_hours] \n \tfor key in self.keys]\n pct_flop_data = [[min(elem, 100) for ...
[ "0.56969184", "0.5650795", "0.55957556", "0.55006737", "0.5393054", "0.53650707", "0.5359506", "0.535746", "0.5284209", "0.5280619", "0.52752787", "0.5275266", "0.5248913", "0.5239874", "0.5223765", "0.5184014", "0.5181769", "0.5165136", "0.5123221", "0.51225346", "0.50882894...
0.5293351
8
Compara dos medios. El primero es una cadena y el segundo un entry de un map
def compareMapObrasMedios(keyname, medio): medioentry = me.getKey(medio) if (keyname == medioentry): return 0 elif (keyname > medioentry): return 1 else: return -1
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def compareMapMediums(med, entry):\n medentry = me.getKey(entry)\n if (med == medentry):\n return 0\n elif (med > medentry):\n return 1\n else:\n return -1", "def mapsMatch(m1,m2):\n same = True\n f1 = file(m1,'r').readlines()\n f2 = file(m2,'r').readlines()\n for i, row ...
[ "0.65795666", "0.5880888", "0.56080663", "0.55132025", "0.5477764", "0.5376461", "0.5363831", "0.53297794", "0.5246969", "0.5219943", "0.5216095", "0.52134645", "0.52128386", "0.51622987", "0.5161585", "0.51257885", "0.5122588", "0.508634", "0.5085276", "0.508073", "0.506087"...
0.67532563
0
Devuelve verdadero (True) si el 'DateAcquired' de artwork1 es menores que el de artwork2
def cmpArtworkByDateAcquired(artwork1, artwork2): return artwork1['DateAcquired'] < artwork2['DateAcquired']
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cmpArtworkByDateAcquired(artwork1, artwork2):\n\n strdateArt1= artwork1['DateAcquired']\n if len(strdateArt1) == 0:\n return False\n year1=int(strdateArt1[0]+strdateArt1[1]+strdateArt1[2]+strdateArt1[3])\n month1=int(strdateArt1[5]+strdateArt1[6])\n day1=int(strdateArt1[8]+strdateArt1[9])...
[ "0.72560877", "0.70278573", "0.625313", "0.5837171", "0.580855", "0.570528", "0.55784255", "0.5531535", "0.54936886", "0.54412234", "0.5393782", "0.53929454", "0.5274607", "0.52449894", "0.5228514", "0.51731026", "0.50996405", "0.5092531", "0.50497586", "0.5035417", "0.503259...
0.6944538
2
Devuelve verdadero (True) si el 'ConstituentID' de artist1 es menor que el de artist2
def cmpArtistsByConstituentID(artist1, artist2): return int(artist1['ConstituentID']) < int(artist2['ConstituentID'])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __neq__(self, other):\n return self.atlasID != other.atlasID", "def is_equivalence(self) -> bool:", "def e_paralelo(self, other):\n if (self == other) or (self.normaliza() == other.normaliza()):\n return True\n else:\n return False", "def __eq__(self, other):\n ...
[ "0.5744785", "0.571622", "0.56875026", "0.5421424", "0.53063834", "0.52995515", "0.52991205", "0.52941054", "0.52799475", "0.52781206", "0.52728", "0.52713174", "0.5207197", "0.5191209", "0.5184792", "0.5175016", "0.5168229", "0.515785", "0.51388776", "0.513641", "0.51219356"...
0.69240767
0
Devuelve verdadero (True) si el 'BeginDate' de artist1 es menor que el de artist2
def cmpArtistsByDate(artist1, artist2): return int(artist1['BeginDate']) < int(artist2['BeginDate'])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cmpBeginDate(artist1, artist2):\n return int(artist1['BeginDate']) < int(artist2['BeginDate'])", "def cmpArtworkByDateAcquired(artwork1, artwork2):\n\n strdateArt1= artwork1['DateAcquired']\n if len(strdateArt1) == 0:\n return False\n year1=int(strdateArt1[0]+strdateArt1[1]+strdateArt1[2]+...
[ "0.7401707", "0.6341823", "0.62922573", "0.6038979", "0.60025793", "0.5924831", "0.5908261", "0.5833494", "0.58186954", "0.57135683", "0.55403507", "0.55403507", "0.54773563", "0.5339056", "0.5333506", "0.5329061", "0.53220433", "0.5314225", "0.52493155", "0.51908743", "0.517...
0.71587086
1
Devuelve verdadero (True) si el costo de transporte de artwork1 es menores que el de artwork2
def cmpArtworkByCost(artwork1, artwork2): return lt.lastElement(artwork1) > lt.lastElement(artwork2)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cmpExpensive(artwork1, artwork2):\n return artwork1['TransCost (USD)'] > artwork2['TransCost (USD)']", "def is_art(self):\n return 0", "def get_similar_lines(self, Coe1, Coe2):\n line1_victor = [Coe1[1], -Coe1[0]]\n line2_victor = [Coe2[1], -Coe2[0]]\n victor = line1_victor[1] * line2_victor[0...
[ "0.6030262", "0.5856878", "0.5841524", "0.57389164", "0.5697451", "0.56716293", "0.5560532", "0.5489362", "0.54111046", "0.53863007", "0.5321247", "0.5299042", "0.52916247", "0.5287804", "0.52837676", "0.5270088", "0.52626425", "0.52501374", "0.52463216", "0.5239026", "0.5238...
0.62906104
0
Devuelve verdadero (True) si el 'Date' de artwork1 es menores que el de artwork2
def cmpArtworkByDate(artwork1, artwork2): return (lt.firstElement(artwork1)['Date'] < lt.firstElement(artwork2)['Date'])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cmpArtworkByDateAcquired(artwork1, artwork2):\n\n strdateArt1= artwork1['DateAcquired']\n if len(strdateArt1) == 0:\n return False\n year1=int(strdateArt1[0]+strdateArt1[1]+strdateArt1[2]+strdateArt1[3])\n month1=int(strdateArt1[5]+strdateArt1[6])\n day1=int(strdateArt1[8]+strdateArt1[9])...
[ "0.69566625", "0.65254754", "0.63372284", "0.6290515", "0.6227315", "0.5830038", "0.57418394", "0.5584936", "0.54929775", "0.5438612", "0.54302365", "0.5366989", "0.53426766", "0.5297436", "0.5291882", "0.52880526", "0.5284331", "0.5275666", "0.52703995", "0.52682745", "0.522...
0.6647178
1
Represent Memory's start or end time with no punctuation.
def time2shortstr(time): return time.strftime(MEM_SHORT_TIME_FORMAT)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_time_string(self):\n return f\"{self.year} {self.month:02} \" \\\n f\"{self.start_day:02} {self.start_hour:02} 00 {self.get_duration():6}\"", "def get_time(self):\n return ''", "def get_time(self):\n start=''\n end=''\n time=''\n times=self.times\n ...
[ "0.67529655", "0.6669312", "0.6654873", "0.66013646", "0.65632164", "0.6502474", "0.6406365", "0.63605154", "0.63605154", "0.63507646", "0.6326633", "0.6323156", "0.63142294", "0.6267673", "0.62649596", "0.6253859", "0.62309664", "0.6199391", "0.61775607", "0.6169721", "0.610...
0.0
-1
All memory files in Sessions directory.
def get_memory_files(): return [f for f in os.listdir(SESSIONS_DIR) if f.endswith(".mem")]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reload_sessions(self):\n import glob \n sessions = glob.glob('*.session')\n for x in sessions:\n self._db['accounts'][x.split('.')[0]] = { 'session': x.split('.')[0] }", "def sessions(self, path:str):\n\n if not os.path.exists(path):\n print(path + ' doesn\\'...
[ "0.6022329", "0.5864773", "0.5807487", "0.57578665", "0.5741768", "0.5666594", "0.5664841", "0.56392574", "0.5572988", "0.5572165", "0.5566106", "0.55621016", "0.55179006", "0.54980904", "0.5477504", "0.546871", "0.5441262", "0.5430807", "0.5425915", "0.5421795", "0.5403669",...
0.82202905
0
Filename for current memory file (the one most recently changed).
def get_current_memory_file(): files = Memory.get_memory_files() if files: files.sort() return files[-1]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def current_filename(self):\n if self.char_limit is not None:\n return '{}/{}.{}.n{}.maf'.format(self.out_dir, self.chrom,\n self.taxon, self.file_num)\n else:\n return '{}/{}.{}.maf'.format(self.out_dir, self.chrom, self.taxon)", "d...
[ "0.73334825", "0.7168673", "0.7136722", "0.7060595", "0.7046298", "0.70014346", "0.6970598", "0.6907836", "0.6907836", "0.6907836", "0.6907836", "0.6907836", "0.68909687", "0.6883916", "0.6880127", "0.6873842", "0.6865343", "0.6865343", "0.68574065", "0.685289", "0.6844556", ...
0.7224698
1
Recreate a Memory for the current memory file; if there's no memory file, make one.
def recreate(user=None): file = Memory.get_current_memory_file() if file: id = file.split(".mem")[0] return Memory(id=id, user=user) else: return Memory(user=user)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reset_memory(self):\n self.memory = []", "def reopen(self):\n self.close()\n self._fileobj = os.fdopen(os.open(str(self.path), os.O_CREAT | os.O_RDWR, 384), \"r+b\", 0)", "def reopen(self):\n self.close()\n self._fileobj = os.fdopen(\n os.open(str(self.path), o...
[ "0.62452483", "0.6152825", "0.60772175", "0.6048614", "0.60299367", "0.58736163", "0.5843055", "0.57904834", "0.57724965", "0.5536836", "0.54709077", "0.54589456", "0.5433514", "0.54298526", "0.5429694", "0.5420607", "0.5416038", "0.538123", "0.53692603", "0.53214544", "0.530...
0.79343647
0
Create file for the Memory, putting start time in first line. File contains a YAML list.
def create_file(self): with open(self.get_path(), 'w', encoding='utf8') as file: print("- {}".format(time2str(self.start)), file=file)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create(self):\n self.create_file()", "def create_file():\r\n with open(fileName.strftime(\"%Y-%m-%d-%H-%M\")+\".txt\",\"w\") as file:\r\n file.write(\"\")", "def create_file():\n with open(filename.strftime(\"%Y-%B-%d-%H\"),'w') as file:\n file.write(\"\") #empty string", "def ...
[ "0.615702", "0.59733886", "0.5918602", "0.58286893", "0.5796329", "0.575469", "0.5684157", "0.5665067", "0.56544137", "0.56345", "0.5632594", "0.5596797", "0.5570356", "0.55388194", "0.54709643", "0.5375147", "0.5367693", "0.53442043", "0.53261644", "0.5282517", "0.52821654",...
0.6724001
0
Record the translation for sentrecord in this Memory.
def record(self, sentrecord, translation=None, segtrans=None, comments=None): print("Registrando traducción para {}: {}".format(sentrecord.raw, translation)) if translation: sentrecord.record(translation, comments=comments) d = sentrecord.to_dict(user=self.user) print...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def record(self, sentrecord, translation=None, segtrans=None,\n comments=None):\n print(\"{} recording translation for sentence {} with translation {} and seg trans {}\".format(self, sentrecord, translation, segtrans))\n segrecord = None\n if translation:\n translation...
[ "0.68302345", "0.60959625", "0.57916945", "0.57916945", "0.551869", "0.5476082", "0.54693973", "0.54580593", "0.54239666", "0.53894866", "0.538501", "0.5376", "0.5371752", "0.5346838", "0.53249514", "0.5317834", "0.5301172", "0.527779", "0.5269771", "0.522185", "0.5201075", ...
0.6403838
1
Close this memory, puting the end time in the last line. Further translations are recorded in another memory. If create_new is True, create the next one.
def close(self, create_new=True): self.end = get_time() with open(self.get_path(), 'a', encoding='utf8') as file: print("- {}".format(time2str(self.end)), file=file) self.running = False if create_new: return Memory()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def close(self):\n\n self.en_time = time.strftime('%H:%M %A %d %B')\n self.is_active = False", "def __finalize_if_needed(self) -> None:\n penultimate_measure_end = N_EIGHTHS_PER_MEASURE * (self.n_measures - 1)\n if self.current_time_in_eighths < penultimate_measure_end:\n r...
[ "0.55286527", "0.48124987", "0.48107478", "0.47931814", "0.47900987", "0.46205324", "0.46126184", "0.46035755", "0.45941657", "0.45859128", "0.45698726", "0.4567886", "0.45597374", "0.45563942", "0.45124477", "0.44897488", "0.44765466", "0.44705173", "0.44429904", "0.4425848", ...
0.74728256
0
Is this memory currently being used?
def is_open(self): return not self.end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_free(self):\n return self._size > 0", "def IsAllocated(self):\n return self._fsntfs_file_entry.is_allocated()", "def hasmem(state, mem):\n if mem <= state[HEAD][MEM]:\n return True\n else:\n state[HEAD][STATUS] = OOM\n return False", "def is_free(self) -> tuple:\n ...
[ "0.757247", "0.72244215", "0.7097177", "0.6942487", "0.690736", "0.6747208", "0.6713897", "0.6702244", "0.66968036", "0.66792744", "0.6674838", "0.6642236", "0.6584976", "0.6567642", "0.6565237", "0.6564114", "0.6546529", "0.6516234", "0.6466773", "0.6437211", "0.6430294", ...
0.0
-1
Create dictionary from Session, after it stops.
def to_dict(self): sentrecords = [r for r in [s.to_dict() for s in self.sentences] if r] if sentrecords: # Don't record anything if there are no sentence records. d = {} d['sents'] = sentrecords d['start'] = time2shortstr(self.start) d['end'] =...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_session_data(self):\n return dict(self._get_session())", "def _get_empty_session_object() -> Dict[str, Any]:\n return {History._SESSION_TIME: get_current_time_string(), History._TILINGS: []}", "def init(self, activity, session):\n return {}", "def create_session_dict(self, cand_i...
[ "0.6700602", "0.66093016", "0.6477893", "0.6384836", "0.61967224", "0.59296393", "0.59296393", "0.58620805", "0.58078986", "0.57563883", "0.57358915", "0.5694795", "0.56647676", "0.5650539", "0.5621468", "0.5605094", "0.5594807", "0.5593951", "0.55920833", "0.5559524", "0.555...
0.0
-1
Get all session dicts in session dict list matching time features.
def get_sessions(sessions, time_feat_dict): filt = Session.filter_time_func(time_feat_dict) return [s for s in sessions if filt(shortstr2time(s['start']))]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def itersessions(self):\n for x in np.unique(self.sessions):\n yield x, self.loc[self.sessions == x, :]", "def get_times_from_sessions(sorting_man, sessions,\n sign='pos', skip_artifacts=True):\n return get_data_from_sessions(sorting_man, sessions,\n ...
[ "0.6082232", "0.59462446", "0.58745986", "0.5787696", "0.575164", "0.5721586", "0.5690127", "0.56086445", "0.5564461", "0.5533494", "0.5513666", "0.55013466", "0.5459016", "0.5407688", "0.5401565", "0.5383871", "0.53654027", "0.5360119", "0.5359368", "0.534638", "0.5328362", ...
0.83535486
0
Is feature of type typ either unconstraining or matching value?
def filter_feature(feature, typ, value): return value is None or feature.__getattribute__(typ) == value
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __check(self, v):\n v = base_type(v)\n if not self._restriction_test(v):\n raise ValueError, \"did not match restricted type\"\n return True", "def is_(t, x):\n return type(x) is t", "def checkType(self, value):\n pass", "def test_has_exactly_type():\r\n\r\n return has_...
[ "0.67394114", "0.62627727", "0.6242865", "0.61344147", "0.6116088", "0.60428345", "0.5914859", "0.58903813", "0.5873509", "0.5846894", "0.5842804", "0.58134633", "0.5811292", "0.58096445", "0.5798315", "0.5762645", "0.5755315", "0.5749911", "0.57329977", "0.5732311", "0.57303...
0.5307899
93
Length of the session as a time delta object.
def length(self): if self.running: return ZERO_TIME else: return self.end - self.start
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def time_length(self):\n return self._time_length", "def get_session_length(row):\n time_delta = row['session_end'] - row['session_start']\n session_length = time_delta.total_seconds()\n return session_length", "def obs_length(self):\n return self.lc.time[-1] - self.lc.time[0]", "def d...
[ "0.7562332", "0.7416505", "0.7308223", "0.7132815", "0.6950073", "0.68898505", "0.6836733", "0.6835692", "0.6830801", "0.68140894", "0.6775445", "0.6775445", "0.6745337", "0.6745337", "0.6745112", "0.6745112", "0.6730818", "0.6730818", "0.67162967", "0.66735375", "0.6673061",...
0.70636547
4
Save new users, set the end time, save the session, and stop running.
def quit(self): # Save any new users (can there be more than 1?) User.write_new() User.new_users.clear() self.running = False self.end = get_time() self.save()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def on_start(self):\n # TODO: do the opposite of pop here, cut?\n new_user = next(users)\n\n self.user_data = new_user\n self.signup()\n # self.login()", "def save_users(user):\n user.save_user()", "def save(self):\n path = self.user.get_session_path()\n with...
[ "0.59986806", "0.5966547", "0.5942442", "0.59183097", "0.58576864", "0.58463377", "0.58076227", "0.5800966", "0.5751988", "0.56917274", "0.5676169", "0.566596", "0.5648207", "0.55428064", "0.55321395", "0.55321395", "0.5522207", "0.55176145", "0.549231", "0.5475836", "0.54509...
0.7931925
0
Record feedback about a sentence's translation.
def record(self, sentrecord, translation=None, segtrans=None, comments=None): print("{} recording translation for sentence {} with translation {} and seg trans {}".format(self, sentrecord, translation, segtrans)) segrecord = None if translation: translation = self.targ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def question_new_translate():", "def translate():\n pass", "def onCurrentSentence(self, *_args):\n global instance\n log(str(_args))\n #if (instance.isSpeaking and len(_args[1])==0): instance.SpeakDone()\n return", "def record(self, translation, comments=None):\n sel...
[ "0.6272468", "0.6190981", "0.61640537", "0.6081944", "0.60462373", "0.59363234", "0.5882387", "0.5833343", "0.57652295", "0.5645508", "0.56444466", "0.5634665", "0.5617984", "0.5603308", "0.5593634", "0.5576358", "0.5554945", "0.5543918", "0.554365", "0.55415225", "0.55259544...
0.67575705
0
Write the session feedback to the user's file.
def save(self): path = self.user.get_session_path() with open(path, 'a', encoding='utf8') as file: self.write(file=file)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save_to_file(self):\n # Create a new file name based off date and time\n file_name = datetime.datetime.now().strftime(\"%Y%m%d%H%M%S_RTI_CFG.txt\")\n file_path = os.path.expanduser(\"~\\\\Desktop\\\\\"+file_name)\n\n file = open(file_path, 'w')\n file.write(self.commandFileTe...
[ "0.5960048", "0.57520133", "0.56133085", "0.5613163", "0.5606673", "0.5560653", "0.5508717", "0.5477467", "0.5469874", "0.5446467", "0.542856", "0.542856", "0.5415389", "0.5414653", "0.5407225", "0.5400209", "0.53931063", "0.5383217", "0.53794736", "0.537055", "0.53663623", ...
0.6567236
0
Write the Session's information and contents to a file our stdout. Don't write anything if there are no sentence records.
def write(self, file=sys.stdout): d = self.to_dict() if d: yaml.dump([d], file, default_flow_style=False)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def printsessions(update, context, sessions_file, sessions_passed_file):\n\n\tsessions_list = get_sessions_list(sessions_file)\n\tsessions_passed_list = get_sessions_list(sessions_passed_file)\n\tsessions_all_list = sessions_list + sessions_passed_list\n\n\tif (len(sessions_all_list) == 0):\n\t\tupdate.effective_m...
[ "0.5825759", "0.572831", "0.5699988", "0.55567616", "0.5530455", "0.5522006", "0.5505266", "0.5432508", "0.54127216", "0.54100347", "0.53815925", "0.53254837", "0.529472", "0.528104", "0.52771", "0.5265412", "0.5264752", "0.5245561", "0.5243431", "0.52371377", "0.5233464", ...
0.0
-1
Write the source and target translations in raw form to file.
def write_doc(self, file=sys.stdout, tm=False): for sentence in self.sentences: if tm: print("<tu><tuv><seg>", file=file) print("{}".format(sentence.raw), file=file) if tm: print("</seg></tuv><tuv><seg>", file=file) print("{}".forma...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def translate(self, source_file):\n \n # Name of output file. The extension of output file is .translated\n if self.pos_tagging:\n output_file = os.path.splitext(source_file)[0] + '_pos.translated'\n else:\n output_file = os.path.splitext(source_file)[0] + '.transl...
[ "0.6050816", "0.5757669", "0.5736711", "0.558408", "0.55590296", "0.5517352", "0.55003625", "0.5494453", "0.5475913", "0.54444087", "0.5422245", "0.5409528", "0.5402745", "0.53991854", "0.53632", "0.5291642", "0.5290393", "0.52704483", "0.52669215", "0.5262643", "0.5236064", ...
0.0
-1
Convert a Morphosyn match to a string.
def MS_match2string(ms_match): return "{} {} {}".format(ms_match[0].__repr__(), ms_match[1], ms_match[2])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def convert(self, match: Match) -> V: # pylint: disable=no-self-use\n return match.string", "def get_match_str(self, match):\n return \"\"", "def _output_match(match, namespaces):\n out = \"?\"\n\n if isinstance(match, etree._Element):\n prefixed_name = _prefixed_name_from_absolute_...
[ "0.6881527", "0.6255174", "0.6217789", "0.57484734", "0.56757647", "0.56196886", "0.55653965", "0.5564614", "0.5539733", "0.532094", "0.51996297", "0.5194584", "0.5175976", "0.517546", "0.5165705", "0.51641405", "0.51155293", "0.51097876", "0.51097876", "0.5034046", "0.502124...
0.6974376
0
Record user's translation for the whole sentence.
def record(self, translation, comments=None): self.translation = translation if comments: self.comments = comments
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def translate():\n pass", "def question_new_translate():", "def translate(sentence):\n\n translated = ''\n for c in sentence:\n translated += translationDict[c]\n return translated", "def translate(self):\n pass", "def translate(self, oracion: str) -> None:\n\n if self....
[ "0.6624057", "0.62800735", "0.6201625", "0.6111668", "0.61036927", "0.6018335", "0.60169923", "0.60075253", "0.60069495", "0.5908121", "0.58935565", "0.5869922", "0.5863905", "0.5857509", "0.5723746", "0.5714091", "0.5705341", "0.56836116", "0.56750286", "0.5667796", "0.56518...
0.56713134
19
Create dictionary from SegRecord, to write to session file.
def to_dict(self): if self.seltrans: d = {} d['src'] = self.tokens if self.gname: d['gname'] = self.gname # if self.mergers: # d['mrg'] = self.mergers d['resp'] = self.response_code d['trg'] = self.selt...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_session_dict(self, cand_id, visit_label):\n self.session_info_dict = self.session_db_obj.create_session_dict(cand_id, visit_label)\n if self.session_info_dict:\n self.cand_id = self.session_info_dict['CandID']\n self.visit_label = self.session_info_dict['Visit_label']...
[ "0.5908638", "0.58857566", "0.58400387", "0.57222664", "0.55945075", "0.5503822", "0.54997164", "0.54465765", "0.5429387", "0.5417256", "0.5411185", "0.5368794", "0.5328324", "0.53151536", "0.5306862", "0.5281482", "0.52662677", "0.5249446", "0.5243703", "0.52335113", "0.5232...
0.0
-1
name and level are optional. Other fields are required.
def __init__(self, username='', email='', password='', name='', level=1, pw_hash='', creation=None, nsessions=0, nsentences=0, update=None, score=0.0, new=False): self.username = username self.email = email # Guarani ability self.level = level se...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def addLevel(self):\n pass", "def __init__(self, name, levels, label=None, info=None, description=None):\n\n super(Hierarchy, self).__init__(name, label, description, info)\n\n if not levels:\n raise ModelInconsistencyError(\"Hierarchy level list should \"\n ...
[ "0.6480518", "0.64243376", "0.64163417", "0.6187706", "0.60946864", "0.6086827", "0.60458785", "0.5946067", "0.58225524", "0.58215684", "0.5805215", "0.5779332", "0.5758384", "0.57236576", "0.57225204", "0.5714824", "0.5652087", "0.56247616", "0.56168073", "0.5611229", "0.560...
0.0
-1
Create a dictionary of user properties.
def user2dict(self): d = {} d['username'] = self.username d['level'] = self.level d['name'] = self.name d['email'] = self.email d['creation'] = self.creation d['update'] = self.update d['nsentences'] = self.nsentences d['nsessions'] = self.nsession...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _collect_properties(self):\n properties = {\n 'userid': self.user_id,\n 'title': self.get_fullname()\n }\n if not self.ogds_user:\n return properties\n\n for attribute_name in self.ogds_user_attributes:\n value = getattr(self.ogds_user, at...
[ "0.8033673", "0.7110519", "0.67372423", "0.6699864", "0.664961", "0.6576392", "0.64594024", "0.645521", "0.64334095", "0.6430084", "0.63252735", "0.63252735", "0.6260069", "0.62500596", "0.6240022", "0.6229378", "0.62293595", "0.6225645", "0.6223636", "0.6188652", "0.61807746...
0.69707483
2
Read in the sessions file for this user, returning a list of session dicts.
def read_sessions(self): path = self.get_session_path() # catch? return yaml.load(open(path, encoding="utf8"))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_sessions(self):\n try:\n with open(\"sessions.json\") as file:\n data = json.load(file)\n except:\n data = {}\n\n return data", "def readUserSession(datafile):\n for line in datafile:\n pages = line.split()\n total = len(pages)\n # Sele...
[ "0.72960246", "0.6899331", "0.67635894", "0.67215526", "0.6673509", "0.6492428", "0.6455494", "0.6319966", "0.6314382", "0.63143796", "0.630933", "0.6254693", "0.6233362", "0.61757135", "0.61704105", "0.6135873", "0.6095594", "0.6033651", "0.6010018", "0.5999583", "0.5995455"...
0.74893755
0
Read in current users from all.usr, adding them to User.users.
def read_all(): with open(User.get_users_path(), encoding='utf8') as file: for line in file: username, pw_hash, email, name, level = line.strip().split(';') level = int(level) user = User.from_file(username) # userfile = User.get_path() ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def checkAndInitUsers(self):\n # config\n users = {}\n\n # iterate through all usernames\n for rUser in pwd.getpwall():\n # check userid\n if rUser.pw_uid is not None and rUser.pw_uid != \"\" and not (\"/nologin\" in rUser.pw_shell or \"/false\" in rUser.pw_shell):...
[ "0.7320273", "0.6974932", "0.69633985", "0.69507223", "0.6945753", "0.68734515", "0.6844376", "0.6833444", "0.6804076", "0.6676773", "0.6661076", "0.66284525", "0.66283846", "0.6609282", "0.6604562", "0.6564792", "0.65331846", "0.6490618", "0.64873135", "0.6450774", "0.644391...
0.70725906
1
Enter all new users (normally at most one) in the users file. Create a user file for each new user.
def write_new(): if User.new_users: print("Creando nuevos usuarios {}".format(User.new_users)) with open(User.get_users_path(), 'a', encoding='utf8') as file: for username, user in User.new_users.items(): print(" Usuario {}".format(user)) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_users (users_file_name = 'lookup.csv'):\n users_file = open (users_file_name, 'r')\n for line in users_file:\n # user_fields = line.split ()\n user_data_list = parse_user_info_list (line.split (','))\n print user_data_list\n create_user (*user_data_list)\n users_file...
[ "0.7758134", "0.7244432", "0.7133731", "0.69696295", "0.69551456", "0.6926561", "0.68892527", "0.6807751", "0.677569", "0.6773167", "0.6760658", "0.6760301", "0.6709551", "0.6700183", "0.66569215", "0.66000205", "0.65829176", "0.65473884", "0.65319234", "0.6426371", "0.642497...
0.816369
0
Create user file with basic data about the user (to be changed later).
def create_user_file(self): d = self.user2dict() with open(User.get_path(self.username), 'w', encoding='utf8') as file: yaml.dump(d, file, default_flow_style=False)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_new_user():\n username = input('Vad är ditt användarID?: ')\n filename = 'user_db.json'\n \n with open(f'txt_files/{filename}', 'w') as f:\n json.dump(username, f)\n return username", "def create_user(self):\r\n room_num = self.create_room() # assign room_num to self.crea...
[ "0.7177041", "0.7092512", "0.6975767", "0.68061477", "0.6771897", "0.66835994", "0.6672581", "0.6589099", "0.6506192", "0.64744", "0.6452205", "0.6448889", "0.6420615", "0.64083475", "0.6243712", "0.62423587", "0.62295145", "0.62170726", "0.61644924", "0.6162999", "0.61518663...
0.81216717
0
Get the anonymous user; if it doesn't exist, create it.
def get_anon(): anon = User.get_user(User.anon_user) if not anon: anon = User(username=User.anon_user, email=User.anon_email, password=User.anon_pw, name=User.anon_name, new=True) return anon
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_anonymous_user():\n return User.objects.get(username = \"AnonymousUser\")", "def get_user(self):\n try:\n return User.objects.get(id=self.user_id)\n except User.DoesNotExist:\n return AnonymousProfile()", "def get_non_anonymous_user():\n user = getattr(_thread_...
[ "0.77944976", "0.73594", "0.73439956", "0.702529", "0.6978501", "0.69316226", "0.6891705", "0.685766", "0.68459904", "0.6734781", "0.6711232", "0.66815096", "0.6655275", "0.66483665", "0.66020805", "0.6597311", "0.6583172", "0.6536264", "0.6535616", "0.64844483", "0.64763033"...
0.77506804
1
Find all devices that match the specified vendor/product pairs.
def find_all(cls, vps: Sequence[Tuple[int, int]], nocache: bool = False) -> \ List[Tuple[UsbDeviceDescriptor, int]]: cls.Lock.acquire() try: devs = set() for vid, pid in vps: # TODO optimize useless loops devs.update(Us...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def list_devices(cls):\n # get all matching devices\n return usb.core.find(\n find_all=True,\n custom_match=lambda dev: (\n dev.idVendor == cls.vendor_id and dev.idProduct in cls.product_ids\n ),\n )", "def _find_devices(cls, vendor: int, produ...
[ "0.7043539", "0.68857026", "0.65902364", "0.62499905", "0.62397546", "0.6108846", "0.6098611", "0.605804", "0.58784753", "0.58157116", "0.5786293", "0.57730293", "0.5770422", "0.5765395", "0.57066756", "0.57022375", "0.56867045", "0.56804466", "0.5665249", "0.56069005", "0.56...
0.0
-1
Flush the FTDI device cache. It is highly recommanded to call this method a FTDI device is unplugged/plugged back since the last enumeration, as the device may appear on a different USB location each time it is plugged in.
def flush_cache(cls, ): cls.Lock.acquire() cls.UsbDevices.clear() cls.Lock.release()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _flushFTDI(self, rx=True, tx=True):\n if not self._isFTDI:\n return\n txdir = 0 # 0:OUT, 1:IN\n req_type = 2 if self._isFTDI else 1 # 0:std, 1:class, 2:vendor\n # 0:device, 1:interface, 2:endpoint, 3:other\n recipient = 0 if self._...
[ "0.63658136", "0.6086936", "0.58872694", "0.57773864", "0.5761773", "0.5670202", "0.56550646", "0.5641793", "0.56119055", "0.56041014", "0.5576462", "0.55763465", "0.5563762", "0.5555943", "0.55367345", "0.55324996", "0.5439465", "0.54316515", "0.54273576", "0.5419075", "0.53...
0.7014183
0
Find a previously open device with the same vendor/product or initialize a new one, and return it. If several FTDI devices of the same kind (vid, pid) are connected to the host, either index or serial argument should be used to discriminate the FTDI device. index argument is not a reliable solution as the host may enum...
def get_device(cls, devdesc: UsbDeviceDescriptor) -> UsbDevice: cls.Lock.acquire() try: if devdesc.index or devdesc.sn or devdesc.description: dev = None if not devdesc.vid: raise ValueError('Vendor identifier is required') ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def open(self, vid, pid, itf=0, idx=0, sn=None, descr=None):\n self.usb_dev = UsbTools.get_device(vid, pid, idx, sn, descr)\n cfg = self.usb_dev.get_active_configuration()\n # check for a valid interface\n if itf >= cfg.bNumInterfaces:\n raise usbdev_error('invalid interface: %d' % itf)\n self....
[ "0.65817636", "0.6267413", "0.6237315", "0.6047078", "0.6046159", "0.5969322", "0.5912368", "0.59045565", "0.5902695", "0.58416605", "0.58319193", "0.5827719", "0.5749275", "0.5712642", "0.567682", "0.56507945", "0.563167", "0.561368", "0.559788", "0.55904967", "0.5581084", ...
0.57022464
14
Release a previously open device, if it not used anymore.
def release_device(cls, usb_dev: UsbDevice): # Lookup for ourselves in the class dictionary cls.Lock.acquire() try: for devkey in cls.Devices: dev, refcount = cls.Devices[devkey] if dev == usb_dev: # found if ref...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def close(self):\n if self._dev_obj is not None:\n self._dev_obj.release()\n else:\n LOG.warning(\"Device is not opened!\")", "def releaseDevice(self, device_id):\n printLog(\"Releasing device %s ...\" % device_id, logging.INFO)\n for dc in self:\n if ...
[ "0.74712205", "0.7023415", "0.66560644", "0.65801156", "0.6413209", "0.63820183", "0.63591164", "0.6304807", "0.6281123", "0.627597", "0.6255251", "0.6231565", "0.62158555", "0.6195194", "0.6149153", "0.6136441", "0.6120692", "0.6104541", "0.6054913", "0.6054913", "0.6054913"...
0.7554263
0
Release all open devices.
def release_all_devices(cls, devclass: Optional[Type] = None) -> int: cls.Lock.acquire() try: remove_devs = set() for devkey in cls.Devices: if devclass: dev = cls._get_backend_device(cls.Devices[devkey][0]) if dev is None o...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def free(self):\n for device_buffer in self.device_buffers.values():\n device_buffer.free()", "def release(self):\n # type: () -> None\n for k in self.kernels:\n k.release()", "def release(self):\r\n for s in self.streams:\r\n s.release()", "def rele...
[ "0.6977047", "0.6747296", "0.66847193", "0.65975183", "0.6398882", "0.6371426", "0.63608223", "0.63365006", "0.63315076", "0.6270832", "0.62526244", "0.62436575", "0.62317735", "0.61759984", "0.6107009", "0.6082296", "0.594411", "0.5910484", "0.5874789", "0.58305734", "0.5827...
0.7071953
0
List candidates that match the device URL pattern.
def list_devices(cls, urlstr: str, vdict: Dict[str, int], pdict: Dict[int, Dict[str, int]], default_vendor: int) -> \ List[Tuple[UsbDeviceDescriptor, int]]: urlparts = urlsplit(urlstr) if not urlparts.path: raise UsbT...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def urls(self) -> list[str]:\r\n ...", "def getURLs():", "async def find_devices() -> List[DeviceInfo]:\n return await Discovery.search_devices()", "def find_target_urls(url_list):\n candidate_urls = []\n \n #iterate through urls\n for url in get_urls(get_clean_text(message_list)):\...
[ "0.6123401", "0.60209656", "0.58956355", "0.5863828", "0.58489066", "0.5842239", "0.5828112", "0.57580495", "0.5742189", "0.5666016", "0.5652385", "0.56451625", "0.5562471", "0.5548752", "0.55368084", "0.5535375", "0.55179316", "0.5496643", "0.54921937", "0.548251", "0.546871...
0.6654765
0
Parse a device specifier URL.
def parse_url(cls, urlstr: str, scheme: str, vdict: Dict[str, int], pdict: Dict[int, Dict[str, int]], default_vendor: int) -> Tuple[UsbDeviceDescriptor, int]: urlparts = urlsplit(urlstr) if scheme != urlparts.scheme: raise UsbToolsError("...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_url(url):\n results = NotifyBase.parse_url(url)\n\n if not results:\n # We're done early as we couldn't load the results\n return results\n\n # Apply our settings now\n devices = NotifyBase.unquote(results['fullpath'])\n\n # Store our devices\n ...
[ "0.5955001", "0.57433736", "0.56266594", "0.5605975", "0.5495419", "0.54808915", "0.5479917", "0.54717404", "0.54569286", "0.53738225", "0.5353081", "0.53467524", "0.53102374", "0.5305932", "0.52968967", "0.5293691", "0.5262653", "0.52357805", "0.5200543", "0.51783264", "0.51...
0.68176013
0
Enumerate USB device URLs that match partial URL and VID/PID criteria.
def enumerate_candidates(cls, urlparts: SplitResult, vdict: Dict[str, int], pdict: Dict[int, Dict[str, int]], default_vendor: int) -> \ Tuple[List[Tuple[UsbDeviceDescriptor, int]], Optional[int]]: specifiers = url...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def list_devices(cls, urlstr: str,\n vdict: Dict[str, int],\n pdict: Dict[int, Dict[str, int]],\n default_vendor: int) -> \\\n List[Tuple[UsbDeviceDescriptor, int]]:\n urlparts = urlsplit(urlstr)\n if not urlparts.path:\n ...
[ "0.7305313", "0.62146264", "0.5593864", "0.5369088", "0.53576976", "0.5335986", "0.53307885", "0.52431333", "0.5220281", "0.51991177", "0.51878214", "0.51549065", "0.5145526", "0.51372343", "0.51184356", "0.51061267", "0.5076512", "0.5073434", "0.50719374", "0.5039166", "0.50...
0.6434855
1
Build URL and device descriptors from UsbDeviceDescriptors.
def build_dev_strings(cls, scheme: str, vdict: Dict[str, int], pdict: Dict[int, Dict[str, int]], devdescs: Sequence[Tuple[UsbDeviceDescriptor, int]]) -> \ List[Tuple[str, str]]: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_url(cls, urlstr: str, scheme: str,\n vdict: Dict[str, int],\n pdict: Dict[int, Dict[str, int]],\n default_vendor: int) -> Tuple[UsbDeviceDescriptor, int]:\n urlparts = urlsplit(urlstr)\n if scheme != urlparts.scheme:\n raise UsbT...
[ "0.65785927", "0.6265347", "0.6186015", "0.6007385", "0.5635989", "0.5617807", "0.54494333", "0.53586143", "0.52578527", "0.5192252", "0.51403135", "0.51318246", "0.51189977", "0.50947773", "0.50773734", "0.50195354", "0.5009956", "0.49802485", "0.49542055", "0.48897895", "0....
0.62743443
1
Retrieve a string from the USB device, dealing with PyUSB API breaks
def get_string(cls, device: UsbDevice, stridx: int) -> str: if cls.UsbApi is None: #pylint: disable-msg=import-outside-toplevel import inspect args, _, _, _ = \ inspect.signature(UsbDevice.read).parameters if (len(args) >= 3) and args[1] == 'length...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def describe(device):\n base = os.path.basename(device)\n # USB-Serial devices\n sys_dev_path = '/sys/class/tty/%s/device/driver/%s' % (base, base)\n if os.path.exists(sys_dev_path):\n sys_usb = os.path.dirname(os.path.dirname(os.path.realpath(sys_dev_path)))\n return usb_string(sys_usb)\...
[ "0.6624832", "0.6569247", "0.6472554", "0.64069086", "0.6386069", "0.63275385", "0.63251895", "0.62799686", "0.6246414", "0.62235725", "0.61905366", "0.6111043", "0.6110673", "0.6058284", "0.60238", "0.60010874", "0.5995711", "0.5990885", "0.593111", "0.5896133", "0.5827619",...
0.7897122
0
Try to find and load an PyUSB backend.
def find_backend(cls) -> IBackend: cls.Lock.acquire() try: return cls._load_backend() finally: cls.Lock.release()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_backend_device(cls, device: UsbDevice) -> Any:\n try:\n #pylint: disable-msg=protected-access\n # need to access private member _ctx of PyUSB device\n # (resource manager) until PyUSB #302 is addressed\n return device._ctx.dev\n #pylint: disabl...
[ "0.6528787", "0.6497384", "0.61849433", "0.594289", "0.59159565", "0.59113526", "0.59077746", "0.5904936", "0.58497894", "0.5845929", "0.5811152", "0.5695571", "0.569013", "0.5617772", "0.5617772", "0.5612536", "0.5573676", "0.54854184", "0.54263353", "0.542542", "0.54063845"...
0.56192636
13
Find a USB device and return it. This code reimplements the usb.core.find() method using a local cache to avoid calling several times the underlying LibUSB and the system USB calls to enumerate the available USB devices. As these calls are timehungry (about 1 second/call), the enumerated devices are cached. It consumes...
def _find_devices(cls, vendor: int, product: int, nocache: bool = False) -> Set[UsbDevice]: backend = cls._load_backend() vidpid = (vendor, product) if nocache or (vidpid not in cls.UsbDevices): # not freed until Python runtime completion # enumerate...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_device():\n device = usb.core.find(\n idVendor=LuxaforFlag.DEVICE_VENDOR_ID,\n idProduct=LuxaforFlag.DEVICE_PRODUCT_ID\n )\n return device", "def find_device(device):\n return usb.core.find(idVendor=device['idVendor'], idProduct=device['idProduct'])", "def _find_dev(vendor_id...
[ "0.7946702", "0.7360734", "0.7259816", "0.71153873", "0.6948367", "0.668006", "0.6628235", "0.65830886", "0.64396906", "0.62554574", "0.6240327", "0.62086767", "0.61694384", "0.6118889", "0.60996205", "0.6041256", "0.6027425", "0.59508365", "0.5936064", "0.59221524", "0.58660...
0.6410725
9
Return the backend implementation of a device.
def _get_backend_device(cls, device: UsbDevice) -> Any: try: #pylint: disable-msg=protected-access # need to access private member _ctx of PyUSB device # (resource manager) until PyUSB #302 is addressed return device._ctx.dev #pylint: disable-msg=prote...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_device(self):\n raise NotImplementedError()", "def get_storage_backend(self):\n return self.client.info()['Driver']", "def _get_backend(args):\n if args.backend == 'gatttool':\n backend = GatttoolBackend\n elif args.backend == 'bluepy':\n backend = BluepyBackend\n elif args.backe...
[ "0.72897404", "0.72357816", "0.718308", "0.7140336", "0.7140336", "0.70863205", "0.70863205", "0.70500743", "0.70427233", "0.7001514", "0.6999211", "0.69636273", "0.68966055", "0.68470436", "0.6831942", "0.6820902", "0.68185806", "0.6810101", "0.67691904", "0.6763174", "0.675...
0.7659336
0
Execute an automated review on a review request.
def RunTool(server_url='', session='', username='', review_request_id=-1, diff_revision=-1, status_update_id=-1, review_settings={}, tool_options={}, repository_name='', base_commit_id='', *args, **kw...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def review(*args, mode=\"simulate\", model=DEFAULT_MODEL, **kwargs):\n reviewer = get_reviewer(*args, mode=mode, model=model, **kwargs)\n\n # Start the review process.\n reviewer.review()", "def post_review(self, form):\n comments_file = form.cleaned_data.get('comments', None)\n return_cod...
[ "0.69741786", "0.6609462", "0.637033", "0.6331829", "0.60357714", "0.6029596", "0.60130095", "0.6009785", "0.60097706", "0.59687054", "0.5932166", "0.5923932", "0.5912093", "0.5885328", "0.5790406", "0.57863104", "0.5782547", "0.570615", "0.5699592", "0.5699331", "0.56928253"...
0.515733
63
Update the list of installed tools. This will detect the installed analysis tool plugins and inform Review Board of them.
def update_tools_list(panel, payload): logger.info('Request to refresh installed tools from "%s"', payload['url']) logger.info('Iterating Tools') tools = [] for ep in pkg_resources.iter_entry_points(group='reviewbot.tools'): entry_point = ep.name tool_class = ep.load() ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_tools_status(self, plot=None):\n if plot is None:\n plot = self.get_plot()\n for tool in self.tools:\n tool.update_status(plot)", "def install_tools(self):\n\t\treturn Job(SDK.PrlVm_InstallTools(self.handle)[0])", "def installTools(self, out):\r\n # Check that ...
[ "0.6638885", "0.63158494", "0.6236855", "0.5890704", "0.58793336", "0.57942563", "0.5683789", "0.5661978", "0.56490993", "0.5617876", "0.5572844", "0.5565619", "0.55018574", "0.5490385", "0.54562634", "0.54142433", "0.54108703", "0.5410848", "0.5392601", "0.53896284", "0.5374...
0.65882957
1
Return the Review Bot extension resource.
def _get_extension_resource(api_root): # TODO: Cache this. We only use this resource as a link to sub-resources. return api_root.get_extension( extension_name='reviewbotext.extension.ReviewBotExtension')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def GetResourceExtension(self):\n\n return self.resource_extension", "def get_review(review_id):\n return get(cls, review_id)", "def get_review(review_id):\n obj = storage.get(Review, review_id)\n if obj is None:\n abort(404)\n return jsonify(obj.to_dict())", "def get_review(review_...
[ "0.5707065", "0.53944933", "0.5294799", "0.5252148", "0.5226599", "0.522346", "0.5210204", "0.51805484", "0.5091686", "0.5071662", "0.49671927", "0.49659368", "0.49607384", "0.49156708", "0.49134925", "0.48811162", "0.4877556", "0.48431104", "0.48347002", "0.47779602", "0.475...
0.7889255
0
\ Adds a text (i.e. the content of the QR code) to the QR code.
def qr_with_text(qrcode: segno.QRCode, *, text: str = None, font_size: int = 12, font_color=False, line_spacing: int = None, scale: int = 1, border: int = None, dark='#000', light='#fff', finder_dark=False, finder_light=False, data_dark=False, data_light=False, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def qr(self, text):\n qr_code = qrcode.QRCode(version=4, box_size=4, border=1)\n qr_code.add_data(text)\n qr_code.make(fit=True)\n im = qr_code.make_image()._img.convert(\"RGB\")\n # Convert the RGB image in printable image\n self._convert_and_print_image(im)", "def add_...
[ "0.6990847", "0.6843238", "0.67968", "0.6667089", "0.66013455", "0.65451825", "0.6533399", "0.65319693", "0.6301295", "0.6291603", "0.61765754", "0.6136995", "0.6129502", "0.6018429", "0.59912294", "0.5986992", "0.59510684", "0.5950361", "0.5946492", "0.5942649", "0.59340537"...
0.64510906
8
Builds a residual network.
def res_net_model(features, labels, mode): # Configurations for each bottleneck group. BottleneckGroup = namedtuple('BottleneckGroup', ['num_blocks', 'num_filters', 'bottleneck_size']) groups = [ BottleneckGroup(3, 128, 32), BottleneckGroup(3, 256, 64), BottleneckGroup(...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def build_resnet(self):\r\n\r\n # INPUTS\r\n inputs_data = Input((self.data_rows, self.data_cols, 1),name='inputs_data')\r\n\r\n\r\n def residual_block(input, output_channels=64, kernel_size=(3, 3), stride=(1, 1)):\r\n x = Conv2D(output_channels, kernel_size, padding='same', strides...
[ "0.72534406", "0.6566446", "0.6307158", "0.6297361", "0.6102438", "0.6098379", "0.607188", "0.60577697", "0.60462743", "0.6040497", "0.6026609", "0.5984552", "0.59563166", "0.592669", "0.589535", "0.58600163", "0.57996583", "0.5773589", "0.5766515", "0.57370585", "0.5730089",...
0.0
-1
Using pyAudioAnalysis package to train parameters for classification of emotion. Sorted chunked data into positive and negative categories,
def nonlearning(): aT.featureAndTrain(['../../AudioData/chunked_data_sorted/pos', '../../AudioData/chunked_data_sorted/neg'], 1.0, 1.0, aT.shortTermWindow, aT.shortTermStep, "svm", "emotion_classifier", True)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test():\r\n le = preprocessing.LabelEncoder()\r\n le.fit([\"Door Knocking\",\"Shower Running\",\"Toilet Flushing\",\"Vacuum Cleaning\",\"Keyboard Typing\", # encode class labels as numeric id values\r\n \"Coughing\",\"Neutral\"])\r\n \r\n if torch.cuda.is_available():\r\n dev...
[ "0.6523714", "0.6119607", "0.6084217", "0.60825354", "0.6022531", "0.6017659", "0.597446", "0.59653544", "0.59632087", "0.5882793", "0.5873618", "0.5863252", "0.58415496", "0.58212274", "0.5759538", "0.57592964", "0.57580644", "0.57561636", "0.5750136", "0.574835", "0.5738622...
0.6362868
1
Tests that 1 + 1 always equals 2.
def test_basic_addition(self): self.assertEqual(1 + 1, 2)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_sanity(self):\n self.assertEquals(2 + 2, 4)", "def test_basic_addition(self):\n self.failUnlessEqual(1 + 1, 2)", "def test_basic_addition(self):\n self.failUnlessEqual(1 + 1, 2)", "def test_basic_addition(self):\n self.failUnlessEqual(1 + 1, 2)", "def test_basic_additio...
[ "0.7010738", "0.693783", "0.693783", "0.693783", "0.68902385", "0.68902385", "0.6663544", "0.6489738", "0.6446602", "0.6415766", "0.6412249", "0.64111584", "0.64017916", "0.64017916", "0.64017916", "0.64017916", "0.64017916", "0.64017916", "0.64017916", "0.64017916", "0.64017...
0.63512295
48
switch between dexterity and Archetypes
def _crop(self, fieldname, scale, box): croputils = IImageCroppingUtils(self.context) data = croputils.get_image_data(fieldname) original_file = StringIO(data) image = PIL.Image.open(original_file) image_format = image.format or self.DEFAULT_FORMAT cropped_image = image...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def on_libType(self):\n self.rf_libTree()\n self.rf_libPath()\n self.rf_libFileName()\n self.rf_libTab()\n self.rf_delInfo()", "def vehicle_type():\n pass", "def drive_type():", "def TYPES():\n\n if config.types_cache:\n return config.types_cache\n\n typ...
[ "0.5298565", "0.5133547", "0.50736916", "0.48957548", "0.4879941", "0.48504728", "0.48302454", "0.48271546", "0.48271546", "0.48176137", "0.47850326", "0.47823656", "0.47812402", "0.4776487", "0.4776487", "0.4776487", "0.4776487", "0.4776487", "0.47613934", "0.47356507", "0.4...
0.0
-1
Tests for the regular expressions used in ReprHighlighter.
def test_highlight_regex(test: str, spans: List[Span]): text = Text(test) highlighter = ReprHighlighter() highlighter.highlight(text) print(text.spans) assert text.spans == spans
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_grammar_rules_regex(self) -> None:\n for rule in self.rules.grammar_regex:\n positions: List[Tuple[int, int]] = self.report.get_regex_postions(\n rule[\"regex\"], ignore_case=True\n )\n for position in positions:\n self.add_error(rule[\...
[ "0.6422873", "0.62258095", "0.60664713", "0.60421884", "0.59508204", "0.59140986", "0.5841004", "0.580531", "0.58048624", "0.5789454", "0.5773917", "0.57669", "0.57590634", "0.57407993", "0.57216334", "0.5709549", "0.56886894", "0.5685655", "0.56391066", "0.56190264", "0.5605...
0.63610345
1
transform = transforms.Compose([ transforms.Resize((256, 256)), transforms.CenterCrop(224), transforms.ToTensor(), transforms.Normalize(mean=[0.485, 0.456, 0.406], std=[0.229, 0.224, 0.225]), ]) model = EffNet() model.to(device) model.load_state_dict(torch.load('model_gray_eff_double_enrich.pt')) model.eval() df = pd.r...
def main(): # confusion matrix model ensemble df = pd.read_csv('pred_test_ensemble.csv') print('Real test accuracy:', accuracy_score(df.labels.values, df.class_preds.values)) conf_matrix = confusion_matrix(df.labels.values, df.class_preds.values, labels=[0, 1, 2, 3]) dct = {'': [0, 90, 180, 270]} ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test():\n\n # load image and adjust its format\n if MEMORY_CACHE:\n test_input = dataset[0]['file']\n oriImg = test_input.byte().permute((1, 2, 0)).numpy() # B,G,R order\n else:\n oriImg = cv2.imread(dataset[0]['file']) # B,G,R order\n test_input = torch.from_numpy(oriImg...
[ "0.6935953", "0.6887819", "0.6749426", "0.6691874", "0.6643962", "0.6596475", "0.6561488", "0.64913625", "0.6485693", "0.6481117", "0.64765394", "0.6473384", "0.64544684", "0.6441231", "0.6416619", "0.6386175", "0.6380545", "0.6375202", "0.637087", "0.6355539", "0.6348653", ...
0.0
-1
Returns a dog frame.
def _dog(): fh = open("/home/italojs/dev/python/api-flask-noalvo-demo/app/domain/live_stream/static/funny-dogs.jpg", "rb") frame = fh.read() fh.close() return frame
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def genFrame(self):\n # generate frame-specific data\n frameData = self._genFrameData()\n\n # call parent function to create the complete frame (as bytearray)\n frame = self._genDigiMeshFrame(frameData)\n\n # OBS: never escape-sequence local msg\n return frame", "def as_...
[ "0.6081915", "0.56700563", "0.5642934", "0.5457245", "0.5451143", "0.5434148", "0.54301244", "0.53619075", "0.5359643", "0.53493017", "0.5338358", "0.5334", "0.5326257", "0.5304185", "0.52989846", "0.5287807", "0.528613", "0.5284221", "0.526866", "0.5250349", "0.5235144", "...
0.74349314
0
Video streaming generator function.
def gen_livestream(): flag = True frame = _dog() while True: time.sleep(0.02) if app.images.qsize(): image = app.images.get() if flag: image = base64_to_cv2(image) gray = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY) detector...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def video_stream_demo():\n return render_template('video_stream_demo.html')", "def video_feed():\n print('before response function')\n return Response(stream_with_context(gen()),#gen(Camera()),\n mimetype='multipart/x-mixed-replace; boundary=frame')", "def stream_frames(video_ca...
[ "0.71821946", "0.70962954", "0.7025603", "0.6848372", "0.6807837", "0.67789626", "0.67789626", "0.67789626", "0.67789626", "0.67789626", "0.67789626", "0.67789626", "0.67789626", "0.67789626", "0.67789626", "0.67789626", "0.67789626", "0.67789626", "0.67789626", "0.6735533", ...
0.66807103
24
recursively unpack compressed file in dir_path delete compressed file after decompressed
def recursive_unpack(dir_path): exten = ['7z', 'zip', 'rar'] one_more = False for r, d, files in os.walk(dir_path): packed = [] for ext in exten: code_files = fnmatch.filter(files, '*.' + ext) if len(code_files) > 0: tmp_paths = [os.path.join(os.path.a...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def unpack(file_path, extraction_path, remove):\n print(file_path)\n Archive(file_path).extractall(extraction_path, auto_create_dir=True)\n # remove original compressed file???\n if remove is True:\n os.remove(file_path)", "def _uncompress(fname, outdir, msg=msg):\n import os\n assert os...
[ "0.7238741", "0.6962272", "0.6708829", "0.6642044", "0.6547225", "0.6475905", "0.64351845", "0.6425231", "0.6420933", "0.6343786", "0.6328651", "0.6327423", "0.6322118", "0.6318724", "0.6219428", "0.6204216", "0.6196655", "0.6195387", "0.6103305", "0.6084546", "0.6079501", ...
0.7164132
1
input a geneClass return a dict
def count_transmaxlen(geneclass,statdic,gffdb): genetranslen = {} for i in gffdb.children(geneclass,featuretype='transcript'): trans_id = i['transcript_id'][0] tmplist = [] translen = 0 exonnum = 0 for x in gffdb.children(i,featuretype='exon'): t...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def init_gene():\n gene_details=dict(\n id = '', \n anno_id = [],\n confgenes_id = [],\n name = '',\n source = '',\n gene_info = {},\n alias = '',\n name2 = [],...
[ "0.62123525", "0.59967506", "0.5947801", "0.58972055", "0.5725862", "0.56280047", "0.5556193", "0.55259985", "0.5508424", "0.54587126", "0.5446064", "0.5444129", "0.53496206", "0.53432304", "0.53352094", "0.53278846", "0.53195477", "0.526858", "0.5262937", "0.5249577", "0.523...
0.0
-1