query
stringlengths
9
9.05k
document
stringlengths
10
222k
metadata
dict
negatives
listlengths
30
30
negative_scores
listlengths
30
30
document_score
stringlengths
4
10
document_rank
stringclasses
2 values
Update the timeout penalties directory. Update the timeout penalties by error dictionary used to deactivate a pool.
def update_timeout_penalties_by_error(penalty_dict): if penalty_dict and isinstance(penalty_dict, dict): _TIMEOUT_PENALTIES_BY_ERR_NO.update(penalty_dict)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _update_resource_timeouts(self, timeout):\n\n for resource_id, test_prep in self._test_preps.iteritems():\n try:\n test_prep.sut.update_lock_timeout(timeout)\n except CoreError:\n raise CoreError('The \"{0}\" resource is not currently checked out by th...
[ "0.64578515", "0.59423137", "0.5942137", "0.5757979", "0.5561408", "0.52926654", "0.52085173", "0.51905227", "0.49876463", "0.4952442", "0.49120688", "0.4895273", "0.48888853", "0.48456872", "0.4839235", "0.48297524", "0.4825805", "0.48181972", "0.4812415", "0.48100135", "0.4...
0.70020324
0
Verifies if connection is secure.
def is_secure(self): return self._is_ssl or self._is_socket
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_secure():\n return get_config_handler().check_secure()", "def secure(self) -> bool:\n return self.get_state(self.args[CONF_OVERALL_SECURITY_STATUS]) == \"Secure\"", "def is_secure(self):\n return (self.nbits % 8 == 0) and (self.nbits >= params.MINIMUM_KEY_SIZE)", "def is_secure_tra...
[ "0.7685507", "0.73935765", "0.7042564", "0.68651164", "0.68104255", "0.6803506", "0.6792077", "0.6557997", "0.6509255", "0.6490868", "0.6275847", "0.6274484", "0.62523067", "0.62479746", "0.613625", "0.6082202", "0.6001328", "0.59894526", "0.59757334", "0.59134", "0.5912556",...
0.7985311
0
Sets this Router unavailable to open connections.
def set_unavailable(self): self["available"] = False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def unavailable(self):\r\n\r\n self._available = False\r\n self.owner.trigger(\"on_unavailable\")", "def set_unavailable(self, time_out=-1):\n if self._available:\n _LOGGER.warning(\n \"ConnectionPool.set_unavailable pool: %s time_out: %s\",\n self,\n...
[ "0.68024015", "0.63710225", "0.63632125", "0.618218", "0.57032275", "0.565823", "0.5600337", "0.5573427", "0.53834504", "0.5378982", "0.5320795", "0.52802694", "0.5193362", "0.51573664", "0.51213264", "0.50979555", "0.5076377", "0.5059898", "0.5033755", "0.5033186", "0.502316...
0.7030494
0
Get a list of the current available routers that shares the given priority.
def _get_available_routers(self, priority): router_list = self._routers_directory[priority] router_list = [router for router in router_list if router.available()] return router_list
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def best_routes_for_routers(self) -> Sequence['outputs.GetRouterStatusBestRoutesForRouterResult']:\n return pulumi.get(self, \"best_routes_for_routers\")", "def get_all_routers(self):\n import network\n sta_if = network.WLAN(network.STA_IF)\n sta_if.active(True)\n all_routers =...
[ "0.6171273", "0.6041962", "0.6034307", "0.5962338", "0.59141415", "0.58702815", "0.5838168", "0.58028054", "0.57238275", "0.5592458", "0.54240227", "0.5399914", "0.5386131", "0.536433", "0.5353427", "0.53302324", "0.5325058", "0.53171957", "0.53160673", "0.5314322", "0.528009...
0.820786
0
Get a random router from the group with the given priority.
def _get_random_connection_params(self, priority): router_list = self._get_available_routers(priority) if not router_list: return None if len(router_list) == 1: return router_list[0] last = len(router_list) - 1 index = random.randint(0, last) retu...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_next_router(self):\n if not self._routers:\n self._can_failover = False\n router_settings = self._settings.copy()\n router_settings[\"host\"] = self._settings.get(\"host\", \"localhost\")\n router_settings[\"port\"] = self._settings.get(\"port\", 33060)\n ...
[ "0.6443754", "0.57199085", "0.5464766", "0.54480845", "0.5380465", "0.5349423", "0.5275978", "0.5257964", "0.5209318", "0.5207216", "0.518145", "0.5172855", "0.51230246", "0.50956744", "0.5080085", "0.5078181", "0.50336725", "0.5022846", "0.50095725", "0.49857655", "0.4927093...
0.7469789
0
Returns the directory containing all the routers managed.
def get_routers_directory(self): return self._routers_directory
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_dir(self) -> typing.List[str]:\n if get_engineering_mode():\n return self.super_dir()\n return self.get_filtered_dir_list()", "def routers():\n routers = []\n\n for app_controller in __app_controllers__:\n routers.append(app_controller.router())\n\n ...
[ "0.67521036", "0.65163875", "0.6353083", "0.6312008", "0.62837875", "0.6214547", "0.62108445", "0.6205643", "0.6201469", "0.6192914", "0.61928076", "0.61797047", "0.6130378", "0.61286974", "0.6078683", "0.6051697", "0.6024993", "0.6024993", "0.60194445", "0.5997913", "0.59614...
0.7911935
0
Set the TLS capabilities.
def _set_tls_capabilities(self, caps): if self.settings.get("ssl-mode") == SSLMode.DISABLED: return if self.stream.is_socket(): if self.settings.get("ssl-mode"): _LOGGER.warning("SSL not required when using Unix socket.") return if "tls" not ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_capabilities(self, capabilities: WlSeat.capability) -> None:\n lib.wlr_seat_set_capabilities(self._ptr, capabilities)", "def has_tls_support(self):\n return \"STARTTLS\" in self.__capabilities", "def setTlsOptions(self, tlsOptions):\n internals.blpapi_SessionOptions_setTlsOptions(\...
[ "0.6283395", "0.6046862", "0.59853387", "0.5933391", "0.5836795", "0.5719707", "0.5661212", "0.5588899", "0.55324024", "0.5484506", "0.5468711", "0.5426122", "0.5417852", "0.5377021", "0.52267647", "0.52210593", "0.52199686", "0.5201323", "0.51081294", "0.50878096", "0.506060...
0.8059733
0
Set the compression capabilities. If compression is available, negociates client and server algorithms. By trying to find an algorithm from the requested compression algorithms list, which is supported by the server. If no compression algorithms list is provided, the following priority
def _set_compression_capabilities(self, caps, compression, algorithms=None): compression_data = caps.get("compression") if compression_data is None: msg = "Compression requested but the server does not support it" if compression == Compression.REQUIRED: raise NotS...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_compression(self, compression):\n converter = geowave_pkg.datastore.redis.config.RedisOptions.CompressionConverter()\n self._java_ref.setCompression(converter.convert(compression))", "def handle_protocol_compression(self, session):\n if self.protocol_compression is not None:\n ...
[ "0.6046909", "0.5819362", "0.5407032", "0.53581226", "0.5113678", "0.49839842", "0.498346", "0.49380842", "0.49221307", "0.49186134", "0.4917529", "0.49124977", "0.488789", "0.4852176", "0.48067507", "0.47812027", "0.47570655", "0.4756323", "0.47503453", "0.4736139", "0.47208...
0.83857566
0
Authenticate with the MySQL server using `MySQL41AuthPlugin`.
def _authenticate_mysql41(self): plugin = MySQL41AuthPlugin(self._user, self._password) self.protocol.send_auth_start(plugin.auth_name()) extra_data = self.protocol.read_auth_continue() self.protocol.send_auth_continue(plugin.auth_data(extra_data)) self.protocol.read_auth_ok()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def authenticate(self):\n self.connection.authenticate()", "def _authenticate(self):\n auth = self.settings.get(\"auth\")\n if auth:\n if auth == Auth.PLAIN:\n self._authenticate_plain()\n elif auth == Auth.SHA256_MEMORY:\n self._authentica...
[ "0.6400933", "0.62732726", "0.61138994", "0.61138994", "0.60705614", "0.5945095", "0.58467805", "0.58269435", "0.5800302", "0.57872933", "0.57863736", "0.5760464", "0.57275146", "0.5718929", "0.5718551", "0.56705445", "0.5662705", "0.56346184", "0.56291765", "0.5603998", "0.5...
0.85435927
0
Authenticate with the MySQL server using `PlainAuthPlugin`.
def _authenticate_plain(self): if not self.stream.is_secure(): raise InterfaceError( "PLAIN authentication is not allowed via unencrypted connection" ) plugin = PlainAuthPlugin(self._user, self._password) self.protocol.send_auth_start(plugin.auth_name(), a...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _authenticate_mysql41(self):\n plugin = MySQL41AuthPlugin(self._user, self._password)\n self.protocol.send_auth_start(plugin.auth_name())\n extra_data = self.protocol.read_auth_continue()\n self.protocol.send_auth_continue(plugin.auth_data(extra_data))\n self.protocol.read_au...
[ "0.7103007", "0.67480946", "0.6699975", "0.6312854", "0.6282266", "0.6259324", "0.622877", "0.622877", "0.6171425", "0.61585176", "0.60417956", "0.60392666", "0.58906585", "0.5858753", "0.5825263", "0.58198947", "0.58059144", "0.5794666", "0.5784688", "0.57266223", "0.5722434...
0.7235906
0
Authenticate with the MySQL server using `Sha256MemoryAuthPlugin`.
def _authenticate_sha256_memory(self): plugin = Sha256MemoryAuthPlugin(self._user, self._password) self.protocol.send_auth_start(plugin.auth_name()) extra_data = self.protocol.read_auth_continue() self.protocol.send_auth_continue(plugin.auth_data(extra_data)) self.protocol.read_a...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _authenticate_mysql41(self):\n plugin = MySQL41AuthPlugin(self._user, self._password)\n self.protocol.send_auth_start(plugin.auth_name())\n extra_data = self.protocol.read_auth_continue()\n self.protocol.send_auth_continue(plugin.auth_data(extra_data))\n self.protocol.read_au...
[ "0.66558886", "0.6050372", "0.5807445", "0.5724545", "0.57190645", "0.56151664", "0.55641025", "0.5541321", "0.5529535", "0.5519596", "0.5519596", "0.55058753", "0.5492875", "0.5449138", "0.54403234", "0.5424199", "0.5413333", "0.54038423", "0.5382327", "0.53573394", "0.53550...
0.81344426
0
Executes the prepared statement pipeline.
def _execute_prepared_pipeline(self, msg_type, msg, statement): # For old servers without prepared statement support if not self._prepared_stmt_supported: # Crud::<Operation> self.protocol.send_msg_without_ps(msg_type, msg, statement) return if statement.deal...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def execute(self):\n if self.sql is None:\n self.sql = self.construct_query()\n # Only SQL strings can be split, not (e.g.) SQLAlchemy statements.\n if self.multiple_statements and isinstance(self.sql, str):\n statements = self._split_sql()\n else:\n sta...
[ "0.70832497", "0.6924596", "0.6796455", "0.67755574", "0.67714244", "0.6683341", "0.6624205", "0.66034377", "0.6593222", "0.6552192", "0.64773214", "0.64732516", "0.64438355", "0.63944197", "0.6392974", "0.63772726", "0.63595045", "0.63264805", "0.62783676", "0.62783676", "0....
0.7378705
0
Send an insert statement.
def send_insert(self, statement): if self.protocol is None: raise OperationalError("MySQLx Connection not available") msg_type, msg = self.protocol.build_insert(statement) self.protocol.send_msg(msg_type, msg) ids = None if isinstance(statement, AddStatement): ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def insert_statement() -> str:\n pass", "def send_insert(self, query):\n # TODO: Add exception handling from bad queries\n\n # More regex to make sure our table names don't have colons\n insert_pattern = r\"INSERT INTO ([\\w_:]+)\"\n match = re.search(insert_pattern, query, re....
[ "0.7384397", "0.69468737", "0.68763345", "0.6809553", "0.6746126", "0.66473293", "0.65237105", "0.65009034", "0.6473686", "0.6462763", "0.6447793", "0.6376111", "0.632397", "0.6143063", "0.6130192", "0.61221296", "0.61190283", "0.61083734", "0.60887593", "0.60645217", "0.6062...
0.76300764
0
Send an find statement.
def send_find(self, statement): msg_type, msg = self.protocol.build_find(statement) self._execute_prepared_pipeline(msg_type, msg, statement) return DocResult(self) if statement.is_doc_based() else RowResult(self)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def command_find(args):\n _perform_environment_check()\n\n filter_dict = _get_find_filter_dict(args)\n _find_verify_arguments(filter_dict)\n\n session = setup_session()\n expanded_queries = _expand_query_list(\n session, args[\"queries\"], True, args[\"verbose\"])\n query_results = retriev...
[ "0.6444074", "0.6254063", "0.61229104", "0.59837246", "0.5848489", "0.5848489", "0.5728122", "0.5681463", "0.5674269", "0.55781", "0.55584466", "0.55389637", "0.55220276", "0.5503203", "0.5482566", "0.5453439", "0.5439397", "0.54308236", "0.5427496", "0.53980815", "0.5381286"...
0.78340423
0
Send an delete statement.
def send_delete(self, statement): msg_type, msg = self.protocol.build_delete(statement) self._execute_prepared_pipeline(msg_type, msg, statement) return Result(self)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete(self):\n self.method = \"DELETE\"\n self.send()", "async def delete(self, delete: TPayload) -> None:", "async def send_delete(self, timeout, message, *args, **kwargs):\n msg = await self.send(message, *args, **kwargs)\n await self.delay(timeout, self.delete_message, msg)"...
[ "0.7385034", "0.73660344", "0.71574575", "0.70037", "0.7000284", "0.6950718", "0.6941215", "0.69066143", "0.673866", "0.67378473", "0.6722369", "0.6716552", "0.6706473", "0.6699444", "0.66581553", "0.6646974", "0.66316766", "0.66136587", "0.66136587", "0.6557389", "0.65246904...
0.80671525
0
Execute a non query command.
def execute_nonquery(self, namespace, cmd, raise_on_fail, fields=None): try: msg_type, msg = self.protocol.build_execute_statement( namespace, cmd, fields ) self.protocol.send_msg(msg_type, msg) return Result(self) except OperationalError: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _execute_command(self):\n try:\n self.dw.execute_sql_command(self.query)\n except Exception as e:\n raise e", "def execute_command(self):\n raise Exception(\"Not implemented\")", "def execute():\n pass", "def execute_command(self, command):\n raise...
[ "0.7001297", "0.6783529", "0.67653435", "0.67629516", "0.6759797", "0.6638806", "0.6563317", "0.6484494", "0.6454391", "0.64470786", "0.643935", "0.6354869", "0.63405234", "0.6338001", "0.63165015", "0.6301107", "0.628283", "0.6262336", "0.6207604", "0.62047315", "0.6106944",...
0.75498843
0
Execute a SQL scalar.
def execute_sql_scalar(self, sql): msg_type, msg = self.protocol.build_execute_statement("sql", sql) self.protocol.send_msg(msg_type, msg) result = RowResult(self) result.fetch_all() if result.count == 0: raise InterfaceError("No data found") return result[0][...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def scalar(\n self,\n statement: Executable,\n params: Optional[_CoreSingleExecuteParams] = None,\n *,\n execution_options: OrmExecuteOptionsParameter = util.EMPTY_DICT,\n bind_arguments: Optional[_BindArguments] = None,\n **kw: Any,\n ) -> Any:\n\n return...
[ "0.7701918", "0.71551996", "0.7100363", "0.6940922", "0.6882699", "0.6826517", "0.6695476", "0.6527107", "0.64857984", "0.64295435", "0.6383758", "0.6353387", "0.6353387", "0.6297698", "0.62929964", "0.62206954", "0.6217163", "0.6205181", "0.61824566", "0.61709344", "0.616329...
0.8164014
0
Returns the next statement ID.
def get_next_statement_id(self): self._stmt_counter += 1 return self._stmt_counter
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_next_id(self):\n con = self.c._connect()\n last_id = self.c.get_last_id(con.cursor())\n con.close()\n return last_id + 1", "def _GetNextId(self):\r\n ret = self.next_id\r\n self.next_id += 1\r\n return str(self.next_id)", "def next_id(self):\n next_id = self....
[ "0.7208179", "0.7177133", "0.71536875", "0.7083505", "0.69675034", "0.68555605", "0.66787165", "0.6669282", "0.66617703", "0.66554725", "0.6654138", "0.66450495", "0.6561741", "0.6561741", "0.6507544", "0.6493001", "0.64676034", "0.64601374", "0.641892", "0.6389219", "0.63501...
0.87267596
0
Get the disconnection message sent by the server.
def get_disconnected_reason(self): return self._server_disconnected_reason
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def disconnect(self):\n\n if not self.sascfg.reconnect:\n return \"Disconnecting and then reconnecting to this workspaceserver has been disabled. Did not disconnect\"\n\n pgm = b'\\n'+b'tom says EOL=DISCONNECT \\n'\n self.stdin[0].send(pgm)\n\n while True:\n ...
[ "0.7116792", "0.6579427", "0.6540664", "0.6371147", "0.6267578", "0.62578523", "0.6254394", "0.6201919", "0.61806864", "0.61534166", "0.61381096", "0.6127999", "0.611137", "0.6108084", "0.6046112", "0.5982081", "0.5954857", "0.59370977", "0.59243006", "0.58993757", "0.5895715...
0.68035406
1
Reset a sucessfully authenticated session.
def reset_session(self): if not self.is_open(): return if self._active_result is not None: self._active_result.fetch_all() try: self.keep_open = self.protocol.send_reset(self.keep_open) except (InterfaceError, OperationalError) as err: _LOG...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reset():\n if app.config['SESSION_KEY'] in session:\n session.pop(app.config['SESSION_KEY'])\n return redirect(url_for('home'))", "def reset_flask_session_on_login():\n session.clear()\n session.permanent = True", "def relogin(self):\n spotify.Error.maybe_raise(lib.sp_session_relo...
[ "0.7480814", "0.6960703", "0.68716395", "0.6633303", "0.6603879", "0.6529527", "0.64746696", "0.6469612", "0.6411634", "0.6361558", "0.6336899", "0.6296393", "0.6277908", "0.618854", "0.618854", "0.6179551", "0.61739373", "0.6171018", "0.6112825", "0.60756004", "0.60566664", ...
0.72207
1
Do not close, but add connection back to pool. The close_session() method does not close the connection with the MySQL server. The connection is added back to the pool so it can be reused. When the pool is configured to reset the session, the session state will be cleared by reauthenticating the user once the connectio...
def close_session(self): self.pool.add_connection(self)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def close_db_session(self, session):\r\n session.close()", "def recycle(self, session):\n pool = self.session_pool\n for s in list(pool): # freezing the pool into a list for iteration allows pool mutation inside the loop\n if not s.healthy:\n pool.remove(s)\n ...
[ "0.6510951", "0.63316697", "0.61100155", "0.61048955", "0.6004304", "0.59648746", "0.5942895", "0.5915236", "0.5910982", "0.5891946", "0.58184874", "0.58020455", "0.57593113", "0.5719936", "0.57130855", "0.56957394", "0.5664843", "0.5656271", "0.5656271", "0.56377137", "0.563...
0.8022143
0
Reset the connection. Resets the connection by reauthenticate.
def reset(self): self.reconnect()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _reset_connection(self):\n\n self.__userid = 0\n self.__token = 0\n self.__conn.close()\n\n self.__conn = httplib.HTTPConnection(\"www.slimtimer.com\")\n self._logon()", "def reconect(self):\n self.connection.reset_connection()\n return self.connection", ...
[ "0.7405834", "0.7173897", "0.7081212", "0.6790866", "0.6768989", "0.66587275", "0.6614098", "0.6464352", "0.64231384", "0.6328056", "0.6328056", "0.6328056", "0.6328056", "0.63127524", "0.6265836", "0.618074", "0.6164294", "0.6147996", "0.6144305", "0.6122264", "0.6121173", ...
0.73772067
1
r"""Set the name of the pool. This method checks the validity and sets the name of the pool.
def _set_pool_name(self, pool_name): if _CNX_POOL_NAME_REGEX.search(pool_name): raise AttributeError(f"Pool name '{pool_name}' contains illegal characters") if len(pool_name) > _CNX_POOL_MAX_NAME_SIZE: raise AttributeError(f"Pool name '{pool_name}' is too long") self.name...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_name(self, name):\n\t\tself.name_ = name", "def set_name(self, name):\n self.name = name # overwrite the existing name with the input name", "def set_name(self, name):\n self.name = name # overwrite the existing name with the input name", "def set_name(self, _name):\n self.name...
[ "0.6738657", "0.6685082", "0.6685082", "0.6633863", "0.6587753", "0.6581045", "0.65677935", "0.65675783", "0.6564265", "0.6564265", "0.6564265", "0.6564265", "0.6564265", "0.65593666", "0.65580016", "0.65530765", "0.65530765", "0.6527032", "0.65236634", "0.65236634", "0.64855...
0.8624035
0
Returns the number of open connections that can return to this pool.
def open_connections(self): return len(self._connections_openned)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _created_connections(self):\n return len(self._available_connections) + len(self._in_use_connections)", "def getconnectioncount(self):\n return self.proxy.getconnectioncount()", "def size(self):\r\n return sum(pool.size() for pool in self.host_to_pool.values())", "def pool_size(self)...
[ "0.8044701", "0.7799287", "0.7330027", "0.73162156", "0.719832", "0.71733403", "0.71316063", "0.70556307", "0.70315176", "0.7030046", "0.6980931", "0.6876273", "0.6845227", "0.680742", "0.670429", "0.66962683", "0.66733575", "0.66601783", "0.66520566", "0.66254", "0.6611033",...
0.85150576
0
Removes a connection from this pool.
def remove_connection(self, cnx=None): self._connections_openned.remove(cnx)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def del_connection_in_use(self, connection):\n try:\n self._in_use_connections.remove(connection)\n connection.disconnect()\n except Exception as err:\n self.class_logger.warning(\"Error occurred while removing connection: %s\" % (err, ))", "def removeConnection(sel...
[ "0.73158354", "0.7269082", "0.69396466", "0.6919552", "0.6912065", "0.6884179", "0.6790434", "0.66967654", "0.6660787", "0.6624521", "0.6611776", "0.65944844", "0.6536934", "0.6517376", "0.6482876", "0.64035654", "0.63714844", "0.6320985", "0.6307719", "0.62835497", "0.624697...
0.7323535
0
Adds a connection to this pool. This method instantiates a Connection using the configuration passed when initializing the ConnectionPool instance or using the set_config() method. If cnx is a Connection instance, it will be added to the queue.
def add_connection(self, cnx=None): if not self.cnx_config: raise PoolError("Connection configuration not available") if self.full(): raise PoolError("Failed adding connection; queue is full") if not cnx: cnx = PooledConnection(self) # mysqlx_wai...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _threadsafe_add_connection(self, con):\n self._connections.append(con)", "def add_connection(self, connection):\n self.connections.append(connection)", "def add_connection(self, connection):\n self.connections[connection.id] = connection", "def make_connection(self):\n if self...
[ "0.64743185", "0.62594146", "0.6200402", "0.5844291", "0.5764441", "0.5724644", "0.5622598", "0.55206937", "0.5484835", "0.54817796", "0.5468249", "0.54592377", "0.5424593", "0.54111004", "0.5401769", "0.5301684", "0.5267528", "0.5172469", "0.5143603", "0.5113358", "0.5112914...
0.834149
0
Sets this pool unavailable for a period of time (in seconds).
def set_unavailable(self, time_out=-1): if self._available: _LOGGER.warning( "ConnectionPool.set_unavailable pool: %s time_out: %s", self, time_out, ) self._available = False self._timeout_stamp = datetime.now() ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_pool_unavailable(pool, err):\n penalty = None\n try:\n err_no = err.errno\n penalty = _TIMEOUT_PENALTIES_BY_ERR_NO[err_no]\n except (AttributeError, KeyError):\n pass\n if not penalty:\n err_msg = err.msg\n for key, value in...
[ "0.6928558", "0.6741965", "0.6512105", "0.6314378", "0.6283715", "0.5775192", "0.56474566", "0.55812824", "0.5574952", "0.5572716", "0.5553683", "0.55163765", "0.55151737", "0.5471133", "0.5459293", "0.54034746", "0.5378221", "0.5371841", "0.5370946", "0.53631514", "0.5357788...
0.774368
0
Verifies if a pool exists with the given name.
def _pool_exists(self, client_id, pool_name): pools = self.__pools.get(client_id, []) for pool in pools: if pool.name == pool_name: return True return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_pool_exist(pool_name: str) -> bool:\n if not pool_name:\n return False\n return os.path.exists(constant.work_dir + \"/pool/\" + pool_name)", "def _floating_ip_pool_exists(self, context, name):\n pools = [pool.get('name') for pool in\n self.get_floating_ip_pools(conte...
[ "0.8228599", "0.74547726", "0.6876268", "0.6849546", "0.6354214", "0.6221264", "0.6199039", "0.61017257", "0.6075915", "0.6072237", "0.6043367", "0.6029448", "0.59958076", "0.5952388", "0.59245205", "0.5858584", "0.57955545", "0.57142246", "0.57142246", "0.5710723", "0.570179...
0.779611
1
Retrieves a list of pools that shares the given settings.
def _get_pools(self, settings): available_pools = [] pool_names = [] connections_settings = self._get_connections_settings(settings) # Generate the names of the pools this settings can connect to for router_name, _ in connections_settings: pool_names.append(router_na...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getPools(self):\n data = self.connect('get','pools',None)\n return data", "def pools(self) -> List[CachingPool]:\n return self._pool_fetcher.pools", "def get_pools():\n pools = ch_core.hookenv.action_get('pools')\n if pools:\n return [p.strip() for p in pools.split(',')]\n...
[ "0.64371336", "0.6221961", "0.6218955", "0.61430126", "0.6115297", "0.6105824", "0.60802984", "0.6063483", "0.59884423", "0.5928385", "0.5899938", "0.5893801", "0.58063644", "0.5693193", "0.5659797", "0.56546915", "0.5629152", "0.55909127", "0.5525719", "0.5514052", "0.548285...
0.78941125
0
Generates a list of separated connection settings for each host. Gets a list of connection settings for each host or router found in the given settings.
def _get_connections_settings(settings): pool_settings = settings.copy() routers = pool_settings.get("routers", []) connections_settings = [] if "routers" in pool_settings: pool_settings.pop("routers") if "host" in pool_settings and "port" in pool_settings: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_pools(self, settings):\n available_pools = []\n pool_names = []\n connections_settings = self._get_connections_settings(settings)\n\n # Generate the names of the pools this settings can connect to\n for router_name, _ in connections_settings:\n pool_names.appe...
[ "0.6441771", "0.59143704", "0.549022", "0.5409772", "0.5368586", "0.53313816", "0.5314408", "0.5314408", "0.5308428", "0.5303599", "0.52979267", "0.5296564", "0.5277395", "0.5248984", "0.52361083", "0.516034", "0.5144902", "0.512325", "0.50972766", "0.5079645", "0.5056473", ...
0.7740059
0
Creates a `ConnectionPool` instance to hold the connections. Creates a `ConnectionPool` instance to hold the connections only if no other pool exists with the same configuration.
def create_pool(self, cnx_settings): connections_settings = self._get_connections_settings(cnx_settings) # Subscribe client if it does not exists if cnx_settings.get("client_id", "No id") not in self.__pools: self.__pools[cnx_settings.get("client_id", "No id")] = [] # Creat...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def make_pool(self) -> pool.SimpleConnectionPool:\n\n return pool.SimpleConnectionPool(\n minconn=1, maxconn=self.pool_size, **self._kwargs\n )", "def make_connection(self):\n if self._created_connections() >= self.max_connections:\n raise ConnPoolException(\"Too many c...
[ "0.75595397", "0.73116374", "0.7268992", "0.71307266", "0.6933179", "0.6854876", "0.6727898", "0.6601544", "0.6593131", "0.6423678", "0.6390654", "0.6333992", "0.63116014", "0.6211054", "0.6180269", "0.6154187", "0.6125197", "0.61084527", "0.60987025", "0.609623", "0.60843295...
0.7385907
1
Closes the connections in the pools
def close_pool(self, cnx_settings): pools = self._get_pools(cnx_settings) for pool in pools: pool.close() # Remove the pool if cnx_settings.get("client_id", None) is not None: client_pools = self.__pools.get(cnx_settings.get("client_id")) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def close(self):\n PoolsManager().close_pool(self.settings)\n for session in self.sessions:\n session.close_connections()", "async def cleanup(self):\n for _ in range(self.pool_size):\n conn = self.pool.get()\n conn.close()", "async def close_connections(se...
[ "0.8231265", "0.7499418", "0.7387195", "0.73317623", "0.7289334", "0.72526157", "0.72519416", "0.72513884", "0.7220146", "0.7214504", "0.7156073", "0.71482754", "0.70928895", "0.70746666", "0.7031293", "0.7031066", "0.6994858", "0.69891924", "0.6965076", "0.6906142", "0.68550...
0.75684214
1
Sets a pool as unavailable. The time a pool is set unavailable depends on the given error message or the error number.
def set_pool_unavailable(pool, err): penalty = None try: err_no = err.errno penalty = _TIMEOUT_PENALTIES_BY_ERR_NO[err_no] except (AttributeError, KeyError): pass if not penalty: err_msg = err.msg for key, value in _TIMEOUT_PENA...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_unavailable(self, time_out=-1):\n if self._available:\n _LOGGER.warning(\n \"ConnectionPool.set_unavailable pool: %s time_out: %s\",\n self,\n time_out,\n )\n self._available = False\n self._timeout_stamp = date...
[ "0.67663455", "0.6144874", "0.59132653", "0.58282214", "0.5166597", "0.50937444", "0.5027872", "0.5018812", "0.5001439", "0.49609485", "0.49187532", "0.48645824", "0.48108545", "0.48038194", "0.48004118", "0.47767752", "0.4757744", "0.47423255", "0.47006467", "0.46958756", "0...
0.8235165
0
Setup default and user defined connectionattributes.
def _init_attributes(self): if os.name == "nt": if "64" in platform.architecture()[0]: platform_arch = "x86_64" elif "32" in platform.architecture()[0]: platform_arch = "i386" else: platform_arch = platform.architecture() ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __setup_conn__(self, **kwargs):\n self.ext_conn = setup_conn(**kwargs)", "def setup_class(cls):\n cls.connection_config = ConnectionConfig(\n name=\"connection_name\",\n author=\"author\",\n version=\"0.1.0\",\n connections={cls.old_connection_id},\n ...
[ "0.65551555", "0.6265929", "0.6141386", "0.6136928", "0.6075293", "0.6021759", "0.58700883", "0.5774287", "0.57723933", "0.5768105", "0.56981736", "0.5661012", "0.5657088", "0.5634599", "0.5629403", "0.56282943", "0.56181884", "0.55838466", "0.55712587", "0.5533862", "0.55328...
0.7018126
0
Returns the underlying connection.
def get_connection(self): return self._connection
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_connection(self):\n return self.connection", "def get_connection(self):\n return self.connection", "def connection(self):\n return self.get_connection()", "def get_connection(self):\n if self.conn is None or self.conn.closed != 0:\n self._connect()\n logg...
[ "0.8500861", "0.8500861", "0.83815616", "0.83661926", "0.8338797", "0.8206327", "0.81601465", "0.81601465", "0.81601465", "0.8104311", "0.8070838", "0.79749274", "0.7973642", "0.79457104", "0.7937752", "0.793084", "0.78242356", "0.77912843", "0.7752608", "0.77429104", "0.7714...
0.85670614
1
Returns the list of schemas in the current session.
def get_schemas(self): result = self.sql("SHOW DATABASES").execute() return [row[0] for row in result.fetch_all()]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def schemas(self):\n return self.get_schemas()", "def schemas(self):\n if not self._schemas:\n self._schemas = get_schema(self.attributes.workspace.namespace, self.attributes.workspace.name)\n return self._schemas", "def schemas(self):\n return model.Schemas(self)", "de...
[ "0.7940168", "0.7674091", "0.76055425", "0.76007926", "0.74846065", "0.7372321", "0.6949388", "0.6884964", "0.68326396", "0.68226933", "0.6800426", "0.6788221", "0.6720207", "0.6689522", "0.6683078", "0.6618202", "0.66057914", "0.65894604", "0.6363446", "0.63566357", "0.62927...
0.76975685
1
Retrieves a Schema object from the current session by it's name.
def get_schema(self, name): return Schema(self, name)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_schema(name):\n global SCHEMA\n\n loaded_schema = SCHEMA.get(name)\n if not loaded_schema:\n filename = \"{}/{}.json\".format(_get_directory(), name)\n if os.path.exists(filename):\n SCHEMA[name] = json.load(open(filename, 'r'))\n\n return SCHEMA.get(name)", "def sch...
[ "0.7099188", "0.6785333", "0.65350753", "0.6392307", "0.6346262", "0.6317523", "0.63076603", "0.6277886", "0.61222565", "0.610875", "0.60736275", "0.60679245", "0.60511553", "0.602065", "0.59344053", "0.59279686", "0.5887502", "0.5860551", "0.58236897", "0.5783029", "0.576627...
0.7382961
0
Drops the schema with the specified name.
def drop_schema(self, name): self._connection.execute_nonquery( "sql", _DROP_DATABASE_QUERY.format(quote_identifier(name)), True )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def drop_schema(self):\n connRepo = self.connect(self.cxRepo)\n sql = f\"\"\"drop schema if exists {self.schemaRepo} cascade\"\"\"\n with connRepo:\n with connRepo.cursor() as curs:\n curs.execute(sql)", "def drop(name):\n\t\treturn \"DROP DATABASE {0};\".format(nam...
[ "0.7630842", "0.7411391", "0.73312235", "0.72176456", "0.71065515", "0.69249046", "0.67872876", "0.67010725", "0.66641957", "0.6568357", "0.6504149", "0.6495129", "0.63986737", "0.6311625", "0.6287318", "0.6284021", "0.62831044", "0.6239468", "0.62374985", "0.6194844", "0.618...
0.88189185
0
Creates a schema on the database and returns the corresponding object.
def create_schema(self, name): self._connection.execute_nonquery( "sql", _CREATE_DATABASE_QUERY.format(quote_identifier(name)), True ) return Schema(self, name)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create(self):\n c = self.cursor()\n byte_schema = pkgutil.get_data(__package__, 'schema.sql')\n c.executescript(byte_schema.decode('utf-8'))\n self.commit()", "def create_schema(schema): \n\n query = \"CREATE SCHEMA IF NOT EXISTS {}\".format(schema)\n qdb.execute(query)", ...
[ "0.713566", "0.7131881", "0.6989725", "0.6950006", "0.6838461", "0.6758156", "0.67543703", "0.67307276", "0.65807515", "0.656584", "0.6518259", "0.6468557", "0.6438678", "0.64039695", "0.6398292", "0.63878834", "0.637881", "0.63674325", "0.63658404", "0.63474345", "0.6346392"...
0.72758913
0
Creates a transaction savepoint. If a name is not provided, one will be generated using the uuid.uuid1() function.
def set_savepoint(self, name=None): if name is None: name = f"{uuid.uuid1()}" elif not isinstance(name, str) or len(name.strip()) == 0: raise ProgrammingError("Invalid SAVEPOINT name") self._connection.execute_nonquery( "sql", f"SAVEPOINT {quote_identifier(nam...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_wallet(self, walletName):\n return", "def save_transaction(**kwargs):\n if not 'user_id' in kwargs:\n raise AttributeError(\"Cannot create a transaction without user_id\")\n\n\n return History.create(\n user_id=kwargs['user_id'],\n from_curr=kwargs['cu...
[ "0.65303457", "0.61587226", "0.59878576", "0.5905397", "0.5792132", "0.57136196", "0.5660708", "0.55327386", "0.54938084", "0.548573", "0.54418075", "0.54328376", "0.5341623", "0.53411496", "0.53411496", "0.53342783", "0.53303015", "0.5328881", "0.5287005", "0.5276058", "0.52...
0.6933689
0
Rollback to a transaction savepoint with the given name.
def rollback_to(self, name): if not isinstance(name, str) or len(name.strip()) == 0: raise ProgrammingError("Invalid SAVEPOINT name") self._connection.execute_nonquery( "sql", f"ROLLBACK TO SAVEPOINT {quote_identifier(name)}", True, )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def savepoint_rollback(self, id):\n self.execute(\"ROLLBACK TO SAVEPOINT {}\".format(id))", "def release_savepoint(self, name):\n if not isinstance(name, str) or len(name.strip()) == 0:\n raise ProgrammingError(\"Invalid SAVEPOINT name\")\n self._connection.execute_nonquery(\n ...
[ "0.75790715", "0.6660333", "0.6392549", "0.6234782", "0.62145495", "0.6171088", "0.61522824", "0.6101417", "0.6064307", "0.6056632", "0.60493654", "0.60462016", "0.59910023", "0.59887075", "0.59846413", "0.59639025", "0.58136445", "0.5793797", "0.57077324", "0.5703036", "0.56...
0.85947764
0
Release a transaction savepoint with the given name.
def release_savepoint(self, name): if not isinstance(name, str) or len(name.strip()) == 0: raise ProgrammingError("Invalid SAVEPOINT name") self._connection.execute_nonquery( "sql", f"RELEASE SAVEPOINT {quote_identifier(name)}", True, )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rollback_to(self, name):\n if not isinstance(name, str) or len(name.strip()) == 0:\n raise ProgrammingError(\"Invalid SAVEPOINT name\")\n self._connection.execute_nonquery(\n \"sql\",\n f\"ROLLBACK TO SAVEPOINT {quote_identifier(name)}\",\n True,\n ...
[ "0.6826982", "0.65725434", "0.6022051", "0.5866084", "0.5803091", "0.5377269", "0.52517676", "0.5245904", "0.5132967", "0.49802732", "0.49693072", "0.49311382", "0.48374695", "0.48211297", "0.4773615", "0.4773615", "0.4773615", "0.47389153", "0.47362256", "0.47286457", "0.472...
0.8287476
0
Set the max idle time. This method sets the max idle time.
def _set_max_idle_time(self, max_idle_time): if ( isinstance(max_idle_time, bool) or not isinstance(max_idle_time, int) or not max_idle_time > -1 ): raise AttributeError( "Connection max_idle_time value must be an integer greater or " ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def maximum_idle_time(self, maximum_idle_time):\n if (self.local_vars_configuration.client_side_validation and\n maximum_idle_time is not None and maximum_idle_time > 2147483647): # noqa: E501\n raise ValueError(\"Invalid value for `maximum_idle_time`, must be a value less than or...
[ "0.7250238", "0.68779844", "0.686107", "0.6692613", "0.66525775", "0.6395718", "0.6354745", "0.6289671", "0.6289671", "0.6282277", "0.62430394", "0.6237619", "0.61759275", "0.6161843", "0.6161843", "0.6144219", "0.6110566", "0.6076418", "0.6045437", "0.5964966", "0.5964966", ...
0.8394763
0
Set if the pool is enabled. This method sets if the pool is enabled.
def _set_pool_enabled(self, enabled): if not isinstance(enabled, bool): raise AttributeError("The enabled value should be True or False.") self.pooling_enabled = enabled
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setEnabled(self, enable: bool) -> None:\n self.enabled = ...", "def set_enabled(self, enabled=True):\n self._enabled = enabled", "def enabled(self, enabled):\n \n self._enabled = enabled", "def enabled(self, enabled):\n\n self._enabled = enabled", "def enabled(self, e...
[ "0.6399708", "0.6362323", "0.629909", "0.62372655", "0.62372655", "0.6163484", "0.61200476", "0.61200476", "0.6109915", "0.6096295", "0.6096295", "0.60143596", "0.596099", "0.59420854", "0.5857917", "0.5758405", "0.57415175", "0.56308055", "0.562213", "0.562213", "0.562213", ...
0.84562
0
Set the queue timeout. This method sets the queue timeout.
def _set_queue_timeout(self, queue_timeout): if ( isinstance(queue_timeout, bool) or not isinstance(queue_timeout, int) or not queue_timeout > -1 ): raise AttributeError( "Connection queue_timeout value must be an integer greater or " ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_timeout(self, timeout: float) -> None:\n self._timeout = timeout", "def set_timeout(self, timeout):\n pass", "def set_timeout(self, timeout):\n self.timeout = timeout", "def set_timeout(self, timeout):\n if self.interface is not None:\n self.interface.timeout = time...
[ "0.7421812", "0.7354362", "0.72003436", "0.71162975", "0.70625746", "0.70500946", "0.70189744", "0.6955598", "0.6946011", "0.6945228", "0.691051", "0.69039935", "0.6892539", "0.6864599", "0.68465585", "0.6709919", "0.6695983", "0.66703004", "0.6661025", "0.664645", "0.6402911...
0.8419401
0
Validates the settings to be passed to a Session object the port values are converted to int if specified or set to 33060 otherwise. The priority values for each router is converted to int if specified.
def _validate_settings(settings): invalid_opts = set(settings.keys()).difference(_SESS_OPTS) if invalid_opts: invalid_opts_list = "', '".join(invalid_opts) raise InterfaceError(f"Invalid option(s): '{invalid_opts_list}'") if "routers" in settings: for router in settings["routers"]: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _validatePortConfig(self):\n if config.BindHTTPPorts:\n if config.HTTPPort == 0:\n raise UsageError(\n \"HTTPPort required if BindHTTPPorts is not empty\"\n )\n elif config.HTTPPort != 0:\n config.BindHTTPPorts = [config.HTTPP...
[ "0.60197586", "0.5657626", "0.5495007", "0.53471047", "0.5289687", "0.5281556", "0.5281556", "0.5234276", "0.52294874", "0.51977766", "0.5155232", "0.5141573", "0.5139727", "0.51385075", "0.50844365", "0.5050152", "0.5013974", "0.50133044", "0.50025", "0.49238983", "0.4921965...
0.5876934
1
Creates a Session instance using the provided connection data.
def get_session(*args, **kwargs): settings = _get_connection_settings(*args, **kwargs) return Session(settings)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_session(self, **params):\n raise NotImplementedError('Should be implemented by a sub-class.')", "def create_session(self, transport):\n session = self.SESSION_CLS(self, transport, 0)\n self.session = session\n return session", "def create_session(self, loop):\n ses...
[ "0.66529363", "0.6487199", "0.6373291", "0.63426346", "0.6335163", "0.6329022", "0.63015455", "0.627489", "0.6243606", "0.62059706", "0.6134959", "0.61318696", "0.61073995", "0.60964423", "0.6075273", "0.60751593", "0.6062976", "0.60453093", "0.6037572", "0.6036886", "0.60237...
0.7035977
0
Create frequent candidate 1itemset C1 by scaning data set.
def create_C1(data_set): C1 = set() for t in data_set: for item in t: item_set = frozenset([item]) C1.add(item_set) return C1
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_C1(data_set):\r\n C1 = set()\r\n for t in data_set:\r\n for item in t:\r\n item_set = frozenset([item])\r\n C1.add(item_set)\r\n return C1", "def fit(self, filePath):\n # Initialize some variables to hold the tmp result\n transListSet = self.getTran...
[ "0.68666804", "0.62472063", "0.6199198", "0.57517475", "0.5700819", "0.5536886", "0.5462085", "0.54602176", "0.54483926", "0.5408374", "0.53961325", "0.5344222", "0.53286785", "0.5307133", "0.53000116", "0.5285556", "0.5277256", "0.5261426", "0.5240939", "0.5231014", "0.52222...
0.68868816
0
Judge whether a frequent candidate kitemset satisfy Apriori property.
def is_apriori(Ck_item, Lksub1): for item in Ck_item: sub_Ck = Ck_item - frozenset([item]) if sub_Ck not in Lksub1: return False return True
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_apriori(Ck_item, Lksub1):\r\n for item in Ck_item:\r\n sub_Ck = Ck_item - frozenset([item])\r\n if sub_Ck not in Lksub1:\r\n return False\r\n return True", "def runApriori(data_iter, minSupport, minConfidence):\n itemSet, transactionList = getItemSetTransactionList(da...
[ "0.66666365", "0.6057518", "0.5988564", "0.59796983", "0.59633344", "0.58799654", "0.57969064", "0.57616246", "0.5732276", "0.57254297", "0.5724408", "0.57123095", "0.5711876", "0.57087386", "0.5667456", "0.56315696", "0.5604504", "0.56003827", "0.5575922", "0.55722725", "0.5...
0.6695725
0
Create Ck, a set which contains all all frequent candidate kitemsets by Lk1's own connection operation.
def create_Ck(Lksub1, k): Ck = set() len_Lksub1 = len(Lksub1) Lksub = list(Lksub1) for i in range(len_Lksub1): for j in range(1, len_Lksub1): l1 = list(Lksub[i]) l2 = list(Lksub[j]) l1.sort() l2.sort() if l1[0:k-2] == l2[0:k-2]: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_Ck(Lksub1, k):\r\n Ck = set()\r\n len_Lksub1 = len(Lksub1)\r\n list_Lksub1 = list(Lksub1)\r\n for i in range(len_Lksub1):\r\n for j in range(1, len_Lksub1):\r\n l1 = list(list_Lksub1[i])\r\n l2 = list(list_Lksub1[j])\r\n l1.sort()\r\n l2.sor...
[ "0.70719284", "0.6693435", "0.6450291", "0.62909186", "0.62846655", "0.6244212", "0.6235127", "0.61993384", "0.6139224", "0.61078626", "0.60946053", "0.5995736", "0.59837943", "0.59188837", "0.5881509", "0.5826247", "0.5768663", "0.5767914", "0.57656425", "0.5685713", "0.5681...
0.7029299
1
Separator for split operation
def separator(self): pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_separator(self):\r\n \r\n return self._separator", "def sep(self):\n return self.sep_index", "def sep_token(self):\r\n if self._sep_token is None:\r\n logger.error(\"Using sep_token, but it is not set yet.\")\r\n return self._sep_token", "def __split_for_...
[ "0.72160506", "0.71307766", "0.69760233", "0.69715023", "0.6950039", "0.68944466", "0.68936884", "0.6867587", "0.68510765", "0.68073255", "0.6776286", "0.67086405", "0.6669383", "0.6662774", "0.6639649", "0.6636426", "0.6620719", "0.66103375", "0.65886676", "0.65592295", "0.6...
0.72390425
0
Create a function which attempts to cast input to any of provided types. The order of provided `types` is meaningful if two types accept given input value, the first one on list will be used. Types should be able to accept a string (if correct) as input value for their constructors.
def one_of(*types): def one_of_types(string): exceptions = [] for type_constructor in types: try: return type_constructor(string) except (ArgumentTypeError, TypeError, ValueError) as e: exceptions.append(f'{type_constructor.__name__}: {e}') ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_as(val, *types):\n for typ in types:\n try:\n return typ(val)\n except ValueError:\n pass\n return quote(val)", "def parameter_converter(\n possible_types: list,\n default_return: t.Any,\n cache_handler: t.Optional[t.Callable],\n):\n for type_ in po...
[ "0.6481975", "0.6214616", "0.6106705", "0.59639883", "0.5830974", "0.5764432", "0.5697015", "0.56758696", "0.5581147", "0.55767035", "0.55717325", "0.5514725", "0.5415872", "0.5408412", "0.5407065", "0.53984433", "0.5390378", "0.5338023", "0.52545696", "0.525337", "0.5241277"...
0.66086835
0
rendering the screen for the GAME OVER TEXT and displaying on the screen
def game_over_text(): over_text = over_font.render("GAME OVER", True, (255, 255, 255)) screen.blit(over_text, (200, 250))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def displayGameOver():\n screen.fill(pygame.Color('black'), (0, 0, SCREEN_SIZE[0], SCREEN_SIZE[1]))\n goText, rect1 = GAME_FONT.render('Game Over', WHITE)\n paText, rect2 = GAME_FONT.render('Press [Enter] to play again', WHITE)\n width1 = goText.get_width()\n height1 = goText.get_height()\n width2 = paText.g...
[ "0.8063501", "0.7958444", "0.78897667", "0.7875936", "0.78596604", "0.77770543", "0.7751221", "0.7696494", "0.7675551", "0.76128083", "0.75853896", "0.75559884", "0.7494957", "0.7444925", "0.74221295", "0.73675346", "0.7348137", "0.7345269", "0.7285808", "0.72778124", "0.7268...
0.8097579
0
Get a task's parent id from a JSON task dictionary
def get_parent_id(task_dict: dict) -> int | None: return task_dict['parent']['id'] \ if task_dict['parent'] and 'id' in task_dict['parent'] else None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_task_by_id(self, id):\n task_table = Table('task', self.metadata, autoload=True)\n try:\n parent_task = self.session.query(task_table).filter(task_table.c.id==id).one()\n task = parent_task._asdict()\n return task\n except Exception as e:\n l...
[ "0.67251194", "0.65341544", "0.6511568", "0.6479204", "0.64372146", "0.6387878", "0.6379795", "0.6379795", "0.62652236", "0.6212493", "0.6132431", "0.6123978", "0.5951328", "0.5945004", "0.5915101", "0.5915101", "0.59042", "0.59042", "0.59042", "0.59042", "0.59029186", "0.5...
0.8564628
0
ensures 'selfupdate check' does not download anything.
def test_check_no_download(self): output = self.run_command("selfupdate --check", exitcode=0) contains_latest_version = ("Already at latest version" in output) contains_new_version = ("New version available" in output) assert (contains_latest_version or contains_new_version) self...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def needs_update(self) -> bool:\n return False", "def dummy_update( self ):\r\n pass", "def check_updates(self):\n try:\n if not common.latest_version(version):\n self.update_notify()\n except:\n self.neterror()", "def run(self):\n USER....
[ "0.66283035", "0.6478493", "0.6332788", "0.6326459", "0.62626725", "0.6182095", "0.61624914", "0.611767", "0.6111686", "0.60227585", "0.6000878", "0.59463876", "0.59266293", "0.59234554", "0.58967555", "0.5894234", "0.588228", "0.5823291", "0.58189195", "0.58148617", "0.58021...
0.6917813
0
test that selfupdate uses the correct default repo and branch
def test_default_repo_branch(self): # network may be unavailable, but we are not interested anyway, # so we ignore the exitcode output = self.run_command("selfupdate --check", exitcode=None) self.assertIn("Target: ywangd:master", output) self.assertNotIn("Target: ywangd:dev", out...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_default_repo(self):\n # network may be unavailable, but we are not interested anyway,\n # so we ignore the exitcode\n output = self.run_command(\"selfupdate --check dev\", exitcode=None)\n self.assertIn(\"Target: ywangd:dev\", output)\n self.assertNotIn(\"Target: ywangd:...
[ "0.803227", "0.72238606", "0.6964844", "0.6536882", "0.6459807", "0.64591706", "0.64538366", "0.6417182", "0.6341737", "0.6337273", "0.6321295", "0.6302465", "0.6289103", "0.6223448", "0.62056243", "0.62040347", "0.618718", "0.6172022", "0.6157208", "0.6133951", "0.602443", ...
0.8427602
0
test that selfupdate uses the correct default repo
def test_default_repo(self): # network may be unavailable, but we are not interested anyway, # so we ignore the exitcode output = self.run_command("selfupdate --check dev", exitcode=None) self.assertIn("Target: ywangd:dev", output) self.assertNotIn("Target: ywangd:master", output...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_default_repo_branch(self):\n # network may be unavailable, but we are not interested anyway,\n # so we ignore the exitcode\n output = self.run_command(\"selfupdate --check\", exitcode=None)\n self.assertIn(\"Target: ywangd:master\", output)\n self.assertNotIn(\"Target: y...
[ "0.7640011", "0.7398748", "0.7280295", "0.7017325", "0.65783685", "0.6536711", "0.6522651", "0.6477542", "0.6472085", "0.6460582", "0.64320356", "0.6405418", "0.63857055", "0.63639194", "0.6355184", "0.6300703", "0.62530875", "0.62479275", "0.6238622", "0.62385267", "0.623796...
0.82788765
0
test the version check on an outdated branch.
def test_version_check_outdated(self): output = self.run_command("selfupdate --check bennr01:selfupdate_test_outdated", exitcode=0) self.assertIn("Target: bennr01:selfupdate_test_outdated", output) self.assertNotIn("Target: ywangd:master", output) self.assertIn("Already at latest version...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_version_check_update_available(self):\n output = self.run_command(\"selfupdate --check bennr01:selfupdate_test_future\", exitcode=0)\n self.assertIn(\"Target: bennr01:selfupdate_test_future\", output)\n self.assertNotIn(\"Target: ywangd:master\", output)\n self.assertNotIn(\"Al...
[ "0.76776046", "0.7427171", "0.6923874", "0.6835676", "0.68241715", "0.67480385", "0.66892505", "0.66880554", "0.6635462", "0.66249126", "0.66240865", "0.66131085", "0.6598753", "0.6585061", "0.6582532", "0.65403354", "0.65228", "0.6500237", "0.64956987", "0.64749783", "0.6471...
0.7763817
0
test the version check on an outdated branch.
def test_version_check_update_available(self): output = self.run_command("selfupdate --check bennr01:selfupdate_test_future", exitcode=0) self.assertIn("Target: bennr01:selfupdate_test_future", output) self.assertNotIn("Target: ywangd:master", output) self.assertNotIn("Already at latest ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_version_check_outdated(self):\n output = self.run_command(\"selfupdate --check bennr01:selfupdate_test_outdated\", exitcode=0)\n self.assertIn(\"Target: bennr01:selfupdate_test_outdated\", output)\n self.assertNotIn(\"Target: ywangd:master\", output)\n self.assertIn(\"Already a...
[ "0.7763817", "0.7427171", "0.6923874", "0.6835676", "0.68241715", "0.67480385", "0.66892505", "0.66880554", "0.6635462", "0.66249126", "0.66240865", "0.66131085", "0.6598753", "0.6585061", "0.6582532", "0.65403354", "0.65228", "0.6500237", "0.64956987", "0.64749783", "0.64719...
0.76776046
1
test the version check on an nonexistend branch.
def test_version_check_does_not_exist(self): output = self.run_command("selfupdate --check selfupdate_test_does_not_exist", exitcode=0) self.assertIn("Target: ywangd:selfupdate_test_does_not_exist", output) self.assertNotIn("Target: ywangd:master", output) self.assertNotIn("Already at la...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_version_missing(self):\r\n self.assertIsNone(self._version_test(self.no_version))", "def test_default_repo_branch(self):\n # network may be unavailable, but we are not interested anyway,\n # so we ignore the exitcode\n output = self.run_command(\"selfupdate --check\", exitcod...
[ "0.73072684", "0.69348514", "0.6934578", "0.6737858", "0.66638994", "0.66529757", "0.6570365", "0.6517341", "0.65064025", "0.64400685", "0.6373914", "0.6364468", "0.6341854", "0.63392055", "0.6328755", "0.6303596", "0.6291833", "0.62678796", "0.62600833", "0.62577677", "0.623...
0.74615693
0
Construct a `Schema` from an iterable of pairs.
def from_tuples( cls, values: Iterable[tuple[str, str | dt.DataType]], ) -> Schema: pairs = list(values) if len(pairs) == 0: return cls({}) names, types = zip(*pairs) # validate unique field names name_locs = {v: i for i, v in enumerate(names)} ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def from_tuples(\n cls,\n values: Iterable[tuple[str, str | dt.DataType]],\n ) -> Schema:\n return cls(dict(values))", "def from_dicts(cls, dicts: typing.Dict[str, typing.Any]) -> 'StarSchema':\n # TODO: Still needs cleaning up a bit\n # TODO: Override for default_on_clause\...
[ "0.7464028", "0.5775714", "0.5559106", "0.54880965", "0.53594357", "0.53316325", "0.5222471", "0.51282495", "0.511169", "0.50875187", "0.50622284", "0.50596225", "0.49821848", "0.4974939", "0.49419346", "0.4924182", "0.48580188", "0.48482725", "0.48464513", "0.48421666", "0.4...
0.72733176
1
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
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
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
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
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
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
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
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
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
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 '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
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
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
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
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
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
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
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