query
stringlengths
9
3.4k
document
stringlengths
9
87.4k
metadata
dict
negatives
listlengths
4
101
negative_scores
listlengths
4
101
document_score
stringlengths
3
10
document_rank
stringclasses
102 values
Test that Logger Temperature file with duplicate entry cannot be uploaded
def test_logger_temperature_upload_duplicate(self): test_type_filename = 'server/tests/test_data_files/Test/Test_New_Logger_Type_Positive.csv' test_temp_filename = 'server/tests/test_data_files/Test/temp_files/DUMMYID_2000_pgsql_Duplicate.txt' with self.app.test_client() as client: w...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_upload_duplicate(client: FlaskClient):\n file = get_example_file(ExampleFileType.Png)\n response1 = util.upload_file(client, DEFAULT_USER, file)\n response2 = util.upload_file(client, DEFAULT_USER, file)\n\n assert response1.status == \"201 CREATED\"\n assert response2.status == \"200 OK\"\...
[ "0.67010015", "0.638992", "0.6376859", "0.6261966", "0.624463", "0.62304544", "0.62001187", "0.6198904", "0.6182989", "0.61653274", "0.6137007", "0.6109847", "0.6075311", "0.60572684", "0.6047644", "0.60395145", "0.60256505", "0.6012684", "0.5980237", "0.595728", "0.5917336",...
0.7041636
0
Esta funcion resuelve una ecuacion de la forma ax^2+bx+c=0
def raices_eq_cuadratica(a: float,b: float,c: float) -> Tuple[float, float]: x1 = (-b + (b**2-4*a*c)**0.5) / (2*a) x2 = (-b - (b ** 2 - 4 * a * c) ** 0.5) / (2 * a) return x1, x2 # equivale a (x1, x2)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def complex_inverse(c1,cr):", "def wce(B):\n return eme*B", "def TestFunc2(x):\r\n return 10*(-0.02*x[0] + 0.5*x[0]*x[0] + x[1])**2 \\\r\n + 128*(-0.02*x[0] + 0.5*x[0]*x[0] - x[1]/4) \\\r\n - (8e-5)*x[0]", "def func_voce(eps,a,b0,c,b1):\n return a-b0*np.exp(-c*eps) + b1 *...
[ "0.640015", "0.6392045", "0.6250174", "0.61922735", "0.61771965", "0.6088744", "0.608832", "0.6082301", "0.60774565", "0.6073722", "0.6049641", "0.6031505", "0.60018027", "0.59975994", "0.5991092", "0.59697044", "0.59589124", "0.59403247", "0.5937569", "0.59324086", "0.591199...
0.0
-1
Computes the value of an entry by running its task. Requires that all the task's dependencies are already computed.
def compute(self, context): # TODO There are a few cases here where we acccess private members on # self.state; should we clean this up? state = self.state task = state.task protocol = state.desc_metadata.protocol assert state.is_initialized assert not state.is...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _compute(self, task_key_logger):\n\n task = self.task\n\n dep_results = [\n dep_state.get_results_assuming_complete(task_key_logger)[\n dep_key.dnode.to_entity_name()\n ]\n for dep_state, dep_key in zip(self.dep_states, task.dep_keys)\n ]\n\n...
[ "0.63904375", "0.59485996", "0.57995343", "0.5572648", "0.5520435", "0.55173826", "0.54368013", "0.53980225", "0.53946394", "0.53903", "0.53770065", "0.5371793", "0.53237903", "0.53095233", "0.52732223", "0.5251898", "0.52199835", "0.52119595", "0.5201217", "0.51943415", "0.5...
0.7053696
0
Indicates whether the task state's result is cached.
def is_cached(self): if self.should_persist: # If our value is persistable, it can be saved either on disk or in memory, # but only the former counts as being officially "cached". return self._result_value_hash is not None else: return self._result is not ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_cached(self):\n return False", "def is_cached(name, typ=\"pkl\"):\n return os.path.exists(cache_name(name, typ))", "def _may_cache(self, request, response=None):\n # any successful request may be cached\n return ((HTTPStatus.OK <= response.status_code < HTTPStatus.BAD_REQUEST)\n ...
[ "0.74749434", "0.68324715", "0.68149173", "0.6738329", "0.6655201", "0.66187906", "0.65679663", "0.6416865", "0.6415875", "0.6382452", "0.6292968", "0.62685287", "0.62240446", "0.6211946", "0.6159335", "0.61113095", "0.60873556", "0.60792947", "0.6072414", "0.6051632", "0.604...
0.79039913
0
Loads the hash of the persisted value for this task, if it exists. If the persisted value is available in the cache, this object's `is_cached` property will become True. Otherwise, nothing will happen.
def attempt_to_access_persistent_cached_value(self): assert self.is_initialized assert not self.is_cached if not self.should_persist: return if not self._cache_accessor.can_load(): return self._load_value_hash()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _load_value_hash(self):\n\n artifact = self._cache_accessor.load_artifact()\n if artifact is None or artifact.content_hash is None:\n raise AssertionError(\n oneline(\n f\"\"\"\n Failed to load cached value (hash) for descriptor\n ...
[ "0.72252256", "0.63859934", "0.5972734", "0.5886148", "0.5879905", "0.5804419", "0.574814", "0.5677867", "0.5613093", "0.5568389", "0.5543914", "0.54435587", "0.54258996", "0.5423656", "0.5395598", "0.53953743", "0.5376388", "0.53689486", "0.53612226", "0.53522384", "0.535086...
0.71849906
1
Refreshes all state that depends on the persistent cache. This is useful if the external cache state might have changed since we last worked with this task.
def refresh_all_persistent_cache_state(self, context): # If this task state is not initialized or not persisted, there's nothing to # refresh. if not self.is_initialized or not self.should_persist: return self.refresh_cache_accessor(context) # If we haven't loaded ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def flush_local_cache(self):\n self._local_cache = {}", "def reload_cache(self):\n self.data = self.read_data_cache()", "def flush_cache(self):\n if self.cache_modified:\n self.cache_manager.write(self.cache_file, self.cache)", "def sync_after_remote_computation(self):\n\n ...
[ "0.6510259", "0.63184017", "0.6079995", "0.6077812", "0.60450286", "0.5920667", "0.5860059", "0.58537775", "0.5784254", "0.5776172", "0.5739506", "0.57234544", "0.5665114", "0.56476337", "0.564716", "0.56465435", "0.5620647", "0.5612728", "0.55823725", "0.5579131", "0.5574888...
0.75692886
0
Syncs the task state by populating and reloading data in the current process after completing the task state in a subprocess. This is necessary because values populated in the task state are not communicated back from the subprocess.
def sync_after_remote_computation(self): # If this state was never initialized, it doesn't have any out-of-date # information, so there's no need to update anything. if not self.is_initialized: return assert self.should_persist # First, let's flush the stored entri...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sync_after_subprocess_completion(self):\n\n # First, let's flush the stored entries in cache accessors. This is to prevent cases\n # like current process contains an outdated stored entries.\n #\n # For example: In assisted mode, main process checks for versioning error which can\n ...
[ "0.679525", "0.60613567", "0.60286933", "0.60181457", "0.60056067", "0.5974136", "0.59708184", "0.5753098", "0.5696014", "0.56820947", "0.5621178", "0.5607121", "0.55749136", "0.5534419", "0.5492815", "0.538063", "0.53788686", "0.53788686", "0.53278726", "0.5323719", "0.53019...
0.57953227
7
Initializes the cache acessor for this task state. This sets up state that allows us to read and write cache entries for this task's value. This includes some inmemory representations of exernal persistent resources (files or cloud blobs); calling this multiple times can be necessary in order to wipe this state and all...
def refresh_cache_accessor(self, context): self._cache_accessor = context.core.persistent_cache.get_accessor( task_key=self.task_key, provenance=self._provenance, ) if context.core.versioning_policy.check_for_bytecode_errors: self._check_accessor_for_version_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def init_cache(self):\n if self.cacheable:\n self._instance._cache[self.name] = {}", "def __init__(self, persistent=True):\n super().__init__()\n self.name_cache = {}\n self.run_cache = {}\n self.row_cache = {}\n self.persistent = persistent\n\n if self...
[ "0.71220165", "0.65763086", "0.65461636", "0.6457462", "0.64347655", "0.63934815", "0.62920505", "0.62669885", "0.61933905", "0.60915667", "0.6079506", "0.60543674", "0.6022922", "0.60054994", "0.599823", "0.59843284", "0.5959548", "0.5947162", "0.5927737", "0.5907709", "0.59...
0.54607123
82
Checks for any versioning errors i.e., any cases where a task's function code was updated but its version annotation was not.
def _check_accessor_for_version_problems(self): old_prov = self._cache_accessor.load_provenance() if old_prov is None: return new_prov = self._cache_accessor.provenance if old_prov.exactly_matches(new_prov): return if old_prov.nominally_matches(new_prov...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _validate_missing_versioned_tags(module):\n version_table = getattr(module, '__version_table__', {})\n\n # Get all functions from the module.\n functions = inspect.getmembers(module, inspect.isfunction)\n functions_dict = dict(functions)\n function_names = list(functions_dict)\n\n # Get all c...
[ "0.69742507", "0.61686295", "0.6032363", "0.59617966", "0.58357054", "0.5830695", "0.5827717", "0.5817524", "0.58131546", "0.5808405", "0.58020407", "0.57866913", "0.57857144", "0.57734126", "0.57588166", "0.56948197", "0.5692589", "0.56653947", "0.56652933", "0.56586355", "0...
0.6633973
1
Reads (from disk or cloud) and saves (in memory) this task's value hash.
def _load_value_hash(self): artifact = self._cache_accessor.load_artifact() if artifact is None or artifact.content_hash is None: raise AssertionError( oneline( f""" Failed to load cached value (hash) for descriptor {self._...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save_digest(self, task: \"TaskView\") -> dict:\n # XXX user definition should be able to exclude inputs from digest\n # XXX might throw AttributeError\n inputs = task._resolved_inputs # type: ignore\n\n # sensitive values are always redacted so no point in including them in the dig...
[ "0.61814857", "0.5982808", "0.5848447", "0.5757408", "0.5693065", "0.5498911", "0.54744655", "0.5450672", "0.5423203", "0.54196274", "0.5387745", "0.53874344", "0.53849286", "0.5367149", "0.5363407", "0.53323734", "0.5316272", "0.52829957", "0.52800924", "0.5279477", "0.52739...
0.65436584
0
Returns copies of the provided TaskStates with any unnecessary state and ancestors "stripped" off; these copies can be safely transmitted to another process for computation.
def strip_states(self, states): stripped_states_by_task_key = {} def strip_state(original_state): """Returns a stripped copy of a TaskState.""" task_key = original_state.task_key if task_key in stripped_states_by_task_key: return stripped_states_by_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def strip_state(original_state):\n\n task_key = original_state.task_key\n if task_key in stripped_states_by_task_key:\n return stripped_states_by_task_key[task_key]\n\n assert original_state in self.all_states\n assert original_state not in self.non_serial...
[ "0.7007315", "0.6059291", "0.57722616", "0.5648813", "0.54974157", "0.54269755", "0.53582656", "0.53353125", "0.52991706", "0.52278084", "0.5219097", "0.5181115", "0.5153454", "0.5147667", "0.5111569", "0.51057416", "0.5078182", "0.5068822", "0.5066051", "0.49776638", "0.4975...
0.84246093
0
Returns a stripped copy of a TaskState.
def strip_state(original_state): task_key = original_state.task_key if task_key in stripped_states_by_task_key: return stripped_states_by_task_key[task_key] assert original_state in self.all_states assert original_state not in self.non_serializable_state...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def strip_states(self, states):\n\n stripped_states_by_task_key = {}\n\n def strip_state(original_state):\n \"\"\"Returns a stripped copy of a TaskState.\"\"\"\n\n task_key = original_state.task_key\n if task_key in stripped_states_by_task_key:\n return...
[ "0.74558896", "0.59286696", "0.5859667", "0.5805591", "0.57871336", "0.5779528", "0.5778583", "0.5769516", "0.5739012", "0.57232314", "0.56408906", "0.5633798", "0.5573608", "0.55289465", "0.5504658", "0.5491149", "0.547416", "0.5440028", "0.5384897", "0.5383192", "0.5378312"...
0.7607578
0
View to return all information needed to display the cart, by converting what has been saved to the session into key variables. Protection in place in case a product, size or nic has been deleted while still in the cart, removing from the list before saving back to the cart session variable.
def cart_contents(request): cart_items = [] total = 0 savings = 0 product_count = 0 points_available = 0 points_earned = 0 discount_applied = request.session.get('discount_applied') cart = request.session.get('cart', {}) # Create a new dict so that items can be removed if needed ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def detail(request):\n # del request.session['cart_id']\n # del request.session['total_in_cart']\n data = {}\n if (cart_id := request.session.get('cart_id', None)):\n cart = Cart.objects.get(pk=cart_id)\n data['products_in_cart'] = cart.cartitems.all()\n data['total_price'] = cart....
[ "0.74897677", "0.70164984", "0.6997387", "0.68789303", "0.68103784", "0.6678317", "0.66267216", "0.6622569", "0.66087735", "0.6606675", "0.6523773", "0.6521631", "0.6521631", "0.647599", "0.647599", "0.647599", "0.64378947", "0.6432149", "0.63870263", "0.63262737", "0.6304301...
0.76600933
0
Calculate the magnetic field from the WMM 2019.
def GeoMag(self, location, time=datetime.datetime.today(), location_format='geodetic', output_format='geodetic'): # convert location to spherical coordinates if location_format == 'geodetic': lat, lon, alt = np.deg2rad(location[0]), np.deg2rad(location[1]), location[2] * 1e-3 # convert from...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def magnetisation(field):\n norm_field = df.Field(field.mesh, dim=1, value=(field.norm.array != 0))\n volume = df.integral(norm_field * df.dV, direction='xyz')\n return df.integral(field * df.dV / volume, direction='xyz')", "def magnetic_field(date: datetime.datetime, lat, lon, alt, output_format='carte...
[ "0.75418234", "0.6628489", "0.6579454", "0.6525822", "0.65067333", "0.6360796", "0.63534766", "0.62209004", "0.62075037", "0.6105055", "0.6103376", "0.60536784", "0.60512596", "0.60364956", "0.6007709", "0.5975416", "0.59612495", "0.5917661", "0.5905833", "0.59036034", "0.590...
0.0
-1
Outputs magnetic field given lat, lon, alt.
def magnetic_field(date: datetime.datetime, lat, lon, alt, output_format='cartesian'): g = GeoMag() return g.GeoMag(np.array([lat, lon, alt]), date, location_format='geodetic', output_format=output_format)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def magnetization(h):\n if h.has_eh: raise\n if h.has_spin: \n mx = extract.mx(h.intra)\n my = extract.my(h.intra)\n mz = extract.mz(h.intra)\n else: raise\n np.savetxt(\"MAGNETIZATION_X.OUT\",np.matrix([h.geometry.x,h.geometry.y,mx]).T)\n np.savetxt(\"MAGNETIZATION_Y.OUT\",np.matrix([h.geometry.x,h....
[ "0.6234416", "0.6036381", "0.56869453", "0.5671633", "0.5600399", "0.55292517", "0.55019677", "0.544296", "0.53621125", "0.5302858", "0.5279656", "0.51781017", "0.50963485", "0.5032904", "0.500878", "0.49855933", "0.49819586", "0.49788126", "0.49635312", "0.49299306", "0.4889...
0.79384327
0
Calculate a checksum for num using the Luhn algorithm.
def luhn_checksum(num: str) -> str: check = 0 for i, s in enumerate(reversed(num)): sx = int(s) if i % 2 == 0: sx *= 2 if sx > 9: sx -= 9 check += sx return str(check * 9 % 10)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def checksum(n):\n\n # Compute the sum of the non-check digits.\n s = sum(luhn_digits(n * 10))\n\n # Multiply by 9.\n result = s * 9\n\n # The units digit is the check digit\n check_digit = result % 10\n\n m = int(str(n) + str(check_digit))\n assert(verify(m))\n\n return check_digit", ...
[ "0.8084448", "0.80643237", "0.78999513", "0.7894059", "0.7728619", "0.75503194", "0.7511611", "0.7499676", "0.74020904", "0.71649796", "0.7110696", "0.6942625", "0.6888765", "0.68604416", "0.6764696", "0.6605598", "0.65903616", "0.6547519", "0.64829504", "0.64828515", "0.6453...
0.84606624
0
Romanize a given string.
def romanize(string: str, locale: t.Union[Locale, str]) -> str: locale = validate_locale(locale) if locale not in (Locale.RU, Locale.UK, Locale.KK): raise ValueError(f"Romanization is not available for: {locale}") table = _get_translation_table(locale) return string.translate(table)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fromRoman(s):\n pass", "def toRoman(n):\n pass", "def romanify(num):\n result = \"\"\n return result", "def fromRoman(s):\n if not s:\n raise InvalidRomanNumeralError, 'Input can not be blank'\n if not romanNumeralPattern.search(s):\n raise InvalidRomanNumeralError, 'Invalid R...
[ "0.7063574", "0.689551", "0.6734362", "0.64427215", "0.63702637", "0.6330791", "0.6323522", "0.6299757", "0.6215566", "0.6198708", "0.61629105", "0.61244214", "0.6120783", "0.61043954", "0.60932904", "0.60877186", "0.6060893", "0.5971338", "0.5948232", "0.5926629", "0.5908616...
0.7607582
0
Configure the logging system. If a logpath is provided, entries will also be written to that logfile.
def configure_logger(logpath, loglevel=logging.DEBUG): handlers = [logging.StreamHandler()] if logpath: handlers.append(logging.FileHandler(logpath)) logging.basicConfig(format='%(asctime)s - %(levelname)s - %(name)s - %(message)s', datefmt='%d-%m-%y %H:%M:%S', level=loglevel, handlers=han...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _configure_logging(self):\n self.log_level = Scaffold.LOG_LEVEL_MAP.get(self.log_level, ERROR)\n formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s')\n\n # assign the windmill instance logger\n #logging.basicConfig()\n self.log = logging.getLo...
[ "0.7340265", "0.7313647", "0.7286824", "0.724973", "0.7248175", "0.7177587", "0.7139101", "0.70546126", "0.70544195", "0.7049995", "0.70458865", "0.70351976", "0.70171684", "0.70139897", "0.7012062", "0.7011974", "0.69839966", "0.69708276", "0.69193125", "0.68887985", "0.6874...
0.8009328
0
Evaluate `x` using locallyweighted regression parameters. Degree of polynomial used in loess is inferred from b. `x` is assumed to be a scalar.
def loc_eval(x, b): loc_est = 0 for i in enumerate(b): loc_est+=i[1]*(x**i[0]) return(loc_est)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def local_linear_regression(x, y, basis_point_index, eps_scale=3, bandwidth=None, bandwidth_type='median'):\n # Calculate a bandwidth.\n if bandwidth is None:\n if bandwidth_type == 'median':\n bandwidth = np.power((np.median(squareform(pdist(x))) / eps_scale), 2)\n elif bandwidth_ty...
[ "0.6404346", "0.62495077", "0.6190865", "0.6152914", "0.60442674", "0.5979035", "0.5977707", "0.5963519", "0.59209937", "0.58717275", "0.58336616", "0.582725", "0.5811", "0.577924", "0.57749844", "0.576471", "0.5730046", "0.57143253", "0.56869996", "0.5661605", "0.56416345", ...
0.5679762
19
Perform locallyweighted regression on xvals & yvals.
def loess(xvals, yvals, alpha, poly_degree=1): # Sort dataset by xvals. all_data = sorted(zip(xvals, yvals), key=lambda x: x[0]) xvals, yvals = zip(*all_data) locsDF = pd.DataFrame( columns=[ 'loc','x','weights','v','y','raw_dists', 'scale_fac...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def local_weight_regression(\r\n training_data_x: np.mat, training_data_y: np.mat, bandwidth: float\r\n) -> np.mat:\r\n m, n = np.shape(training_data_x)\r\n ypred = np.zeros(m)\r\n\r\n for i, item in enumerate(training_data_x):\r\n ypred[i] = item * local_weight(\r\n item, training_da...
[ "0.65673846", "0.6203821", "0.6122985", "0.6087269", "0.5884519", "0.58712137", "0.58013576", "0.56775177", "0.56697303", "0.5631842", "0.5581171", "0.5570354", "0.55586505", "0.5543728", "0.5536329", "0.55168223", "0.5516314", "0.55150086", "0.5470168", "0.54659784", "0.5465...
0.58164173
6
Connect two nodes with a channel. Connects node a to node b using the given channel.
def connect(self, channel, a, b): a.sender.channels.append(channel) channel.receivers.append(b)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def connectChannel(sock, chan):\n sock.send(\"JOIN {}\\r\\n\".format(chan).encode(\"utf-8\"))\n\n console.info(\"Successfully connected to {}\".format(chan))", "def connect(self, node1, node2):\n self.neighbour1 = node1\n self.neighbour2 = node2", "def connect_two_nodes(left_node: Node, rig...
[ "0.60193217", "0.58925235", "0.5827985", "0.57909036", "0.57899636", "0.56818223", "0.56715274", "0.5666792", "0.56497663", "0.56090224", "0.5600908", "0.55008054", "0.54504013", "0.5447329", "0.54283625", "0.5424262", "0.54172355", "0.53959185", "0.5352588", "0.53389084", "0...
0.73055255
0
Get statistics collected during run.
def get_statistics(self): return self.results
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_run_stats(self):\n return self.run_stats", "def statistics(self):\n return self.get_statistics()", "def stats(self):\n pass", "def get_stats(self):\n return self.stats", "def get_stats(self):\n return self.manager.get_stats(self)", "def getStats(self):\n\n ...
[ "0.8423611", "0.7779856", "0.77203375", "0.77192026", "0.76687366", "0.7663487", "0.75916755", "0.75905645", "0.75601757", "0.73241776", "0.7218625", "0.71950877", "0.71844864", "0.7177086", "0.7143594", "0.7113807", "0.710871", "0.7092663", "0.70923436", "0.70543694", "0.704...
0.7649026
6
Create a time stamp
def format_time(self, record): record.dbtime = time.strftime("%Y-%m-%d %H:%M:%S", time.localtime(record.created)) return
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _create_time_stamp() -> str:\n\n return datetime.datetime.now().strftime(\"%Y%m%d\")", "def createTimeStamp_Time():\r\n\r\n return str(datetime.now().strftime(\"%H%M%S\"))", "def _generate_timestamp():\n\t\treturn strftime(\"%Y%m%dT%H%M%S\")", "def time_stamper() :\n\treturn datetime.now().strf...
[ "0.8233453", "0.80581737", "0.79409295", "0.7885426", "0.77232575", "0.76477885", "0.76388806", "0.7607675", "0.7506243", "0.7500952", "0.7491634", "0.7403374", "0.73812056", "0.73719895", "0.7358379", "0.72903913", "0.72595435", "0.72434366", "0.72373694", "0.7206951", "0.71...
0.0
-1
crawl objct and return the result
def crawl_start(crawl_obj): res = None if crawl_obj.type in ['user', 'song'] : res = eval('crawl_' + crawl_obj.type)(crawl_obj) elif crawl_obj.type in ['artist', 'album'] : web_data = requests.get(crawl_obj.url, headers = cheat_headers) soup = bs4.BeautifulSoup(web_data.text, '...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _scrape(self):", "def scrape(self):\n pass", "def crawl(self, url):\n return None", "def scrape(self):\n try:\n self.result = urlfetch.fetch(self.url)\n except DownloadError:\n self.result = urlfetch.fetch(self.url) \n if ((self.result.status_code == 200) and\n (s...
[ "0.71161443", "0.66178185", "0.6551923", "0.60435236", "0.6042226", "0.6040767", "0.59387845", "0.5858021", "0.5807145", "0.58034575", "0.5781588", "0.5735748", "0.5689979", "0.568243", "0.56674963", "0.5655977", "0.56543124", "0.5643372", "0.56385326", "0.5625415", "0.562377...
0.6746438
1
Calculate frequency table of characters in text.
def histogram(text): hist = {} for char in text.lower(): if char.isalpha(): hist[char] = hist.get(char, 0) + 1 else: hist['others'] = hist.get('others', 0) + 1 return hist
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def letter_freq( text ):\n\tchars = string.ascii_uppercase\n\ttext = text.upper()\n\tresult = get_letter_dict()\n\ttotal = 0\n\tfor char in chars:\n\t\tcount = text.count(char)\n\t\tresult[char] = count\n\t\ttotal += count\n\tif total != 0:\n\t\tfor char in chars:\n\t\t\tresult[char] = (result[char]*10000 / total)...
[ "0.7648815", "0.7515002", "0.7477705", "0.7281719", "0.71724904", "0.7077413", "0.70214486", "0.6931976", "0.6922323", "0.6906666", "0.6856542", "0.6832168", "0.68194664", "0.6801115", "0.6779408", "0.67449754", "0.67339164", "0.669856", "0.66707134", "0.6670571", "0.6635781"...
0.69385314
7
move and return the grid without a new random tile It won't affect the state of the game in the browser.
def execute_move(move, board): if move == UP: return game.merge_up(board) elif move == DOWN: return game.merge_down(board) elif move == LEFT: return game.merge_left(board) elif move == RIGHT: return game.merge_right(board) else: sys.exit("No valid move")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new_tile(self):\n while True:\n random_row = random.randrange(self._grid_height)\n random_column = random.randrange(self._grid_width)\n if self._grid[random_row][random_column] == 0:\n self._grid[random_row][random_column] = random.choice([2] * 9 + [4])\n ...
[ "0.79467946", "0.7700813", "0.7627812", "0.7521414", "0.7489073", "0.74867195", "0.7348494", "0.7314265", "0.7249992", "0.7211116", "0.71880275", "0.71707225", "0.7168241", "0.70822585", "0.7079668", "0.70515215", "0.70515215", "0.70206416", "0.6987183", "0.69860077", "0.6921...
0.0
-1
Check if two boards are equal
def board_equals(board, newboard): return (newboard == board).all()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __eq__(self, other) -> None:\n\t\tfor k, v in enumerate(self.board):\n\t\t\tif v != other.board[k]:\n\t\t\t\treturn False\n\t\treturn True", "def __eq__(self, other):\n for row in range( self.n ):\n if self.board[row] != other.board[row]:\n return False\n return True",...
[ "0.7675659", "0.75886476", "0.75203764", "0.7315694", "0.70487416", "0.6995405", "0.697579", "0.69640183", "0.6950214", "0.6934378", "0.69289273", "0.6896391", "0.68638206", "0.6810947", "0.68063855", "0.67953414", "0.67835134", "0.67559415", "0.6735635", "0.6714601", "0.6604...
0.77490914
2
Returns the learning rate scaled by schedule(s) that will be used for the next training step
def current_lr( self, optimizer_states: types.OptimizerStates ) -> tp.Optional[jnp.ndarray]: if self.lr_schedule is not None: step = optimizer_states[-1].count return self.lr_schedule(step)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def learning_rate_schedule(current_epoch,\n current_batch,\n batches_per_epoch,\n batch_size):\n del current_batch, batches_per_epoch # not used\n initial_learning_rate = common.BASE_LEARNING_RATE * batch_size / 128\n learning_rate =...
[ "0.79894197", "0.7785588", "0.77826655", "0.76667386", "0.76645464", "0.7660921", "0.74982613", "0.74174136", "0.74023986", "0.7375447", "0.7314137", "0.7252626", "0.7250394", "0.72385687", "0.7227012", "0.7188356", "0.717606", "0.7163271", "0.7159572", "0.7149901", "0.714215...
0.0
-1
get available directions for any number of dimensions
def get_directions(board_ndim): directions = [ [[0 for _ in range(board_ndim)] for _ in range(2)] for _ in range(board_ndim) ] for ind in range(board_ndim): directions[ind][0][ind] = 1 directions[ind][1][ind] = -1 return directions
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_directions():\n return [(1, 0), (0, 1), (-1, 0), (0, -1)]", "def directions(self):\n return []", "def directions(self):\n direction_list = []\n for direction in Maze.possible_directions:\n move = Maze.dirs_to_moves[direction]\n if (0 <= (self.location[0]+mo...
[ "0.6784351", "0.6429041", "0.6240504", "0.6145204", "0.5987847", "0.59382296", "0.59382296", "0.59382296", "0.59382296", "0.59382296", "0.59382296", "0.59382296", "0.588869", "0.5781544", "0.57415617", "0.56616753", "0.56433386", "0.5630479", "0.5609333", "0.56029123", "0.559...
0.61947703
3
iterates over points on the board
def points_generator(self): rows, cols = self.game.board.board_size points = [Point(i, j) for i, j in product(range(rows), range(cols))] for point in points: yield point
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def iter_points(self):\n for x in range(self.left, self.right + 1):\n for y in range(self.top, self.bottom + 1):\n yield Point(x, y)", "def grid_points(self):\n for i in range(self.rows):\n for j in range(self.cols):\n min_lat,max_lat,min_lon,max_...
[ "0.72778916", "0.68592465", "0.6857867", "0.6820964", "0.663074", "0.6541899", "0.64622074", "0.6450496", "0.6430873", "0.6379434", "0.6351412", "0.6338828", "0.62530154", "0.6235255", "0.622739", "0.6218105", "0.6214263", "0.6176402", "0.61315227", "0.61090213", "0.60718495"...
0.6902485
1
calculate available actions for current board sizes
def get_available_actions(self): actions = [] direction = [[1, 0], [0, 1]] for dir_ in direction: for point in self.points_generator(): dir_p = Point(*dir_) new_point = point + dir_p try: _ = se...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _getAvailableActions(self, board):\r\n myPits = board.mySide(self.id)\r\n return [i for i in myPits if i > 0]", "def _getAvailableActions(self, board):\r\n myPits = board.mySide(self.id)\r\n return [i for i in myPits if i > 0]", "def get_cost_of_actions_helper(actions, board, st...
[ "0.68598026", "0.68598026", "0.6652122", "0.66291237", "0.6517024", "0.650987", "0.6499747", "0.6499747", "0.64463955", "0.63347924", "0.6303849", "0.63017744", "0.62943614", "0.62659013", "0.6257811", "0.62543374", "0.6197231", "0.6195532", "0.6195532", "0.6195532", "0.61796...
0.57378316
39
r"""AlexNet model architecture from the
def alexnet(pretrained=False, **kwargs): model = AlexNet(**kwargs) if pretrained: model_path = './alexnet.pth.tar' pretrained_model = torch.load(model_path) model.load_state_dict(pretrained_model['state_dict']) return model
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def alexnet(**kwargs):\n model = AlexNet(**kwargs)\n # if pretrained:\n # model.load_state_dict(model_zoo.load_url(model_urls['alexnet']))\n return model", "def imagenet_alexnet(**kwargs):\r\n model = ImageNetAlexNet(**kwargs)\r\n return model", "def load(self, name=\"\"):\n\n self...
[ "0.6519144", "0.6468875", "0.64450973", "0.64397836", "0.631246", "0.6307277", "0.6291954", "0.6257867", "0.62547463", "0.6231065", "0.61943966", "0.614853", "0.6140133", "0.6133221", "0.6133221", "0.61192954", "0.610197", "0.60987943", "0.6097791", "0.6090801", "0.6086538", ...
0.61159253
16
Returns the minimum value of a and b ignoring any negative values.
def _get_min_positive_value(self, a, b): if a < 0 and b >= 0: return b if a >= 0 and b < 0: return a return min(a, b)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mini(a, b):\n return min(a, b)", "def _null_min(a, b):\n if a is None:\n return b\n if b is None:\n return a\n return min(a, b)", "def minimum_inplace(a, b):", "def minimum(lhs, rhs):\n return _make.minimum(lhs, rhs)", "def smallest_diff(a, b):\n b.sort()\n smallest_diff = None\n\n...
[ "0.79426205", "0.7518428", "0.7121123", "0.702984", "0.6997932", "0.69437057", "0.68694836", "0.68295264", "0.6827028", "0.6682797", "0.66441596", "0.6604545", "0.6468406", "0.64508706", "0.64410925", "0.64327365", "0.63909256", "0.6367581", "0.6353903", "0.63516575", "0.6350...
0.8785171
0
Converts image in PIL format to base64.
def img_to_base64(img): with io.BytesIO() as output: img.save(output, format="PNG") img_string = base64.b64encode(output.getvalue()) return img_string.decode("utf-8")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def b64_image(self) -> bytes:\n buffer = BytesIO()\n self.image.save(buffer, \"PNG\") \n im_b64 = base64.b64encode(buffer.getvalue())\n im_b64 = b\"data:image/png;base64,\" + im_b64\n return im_b64", "def image_to_base64str(image):\n file_bytes = image.file.read()\n bas...
[ "0.79094106", "0.7860328", "0.78388363", "0.7716888", "0.7690451", "0.7282849", "0.7243197", "0.7226432", "0.71624523", "0.7135727", "0.710332", "0.7079983", "0.7032868", "0.70260394", "0.7014201", "0.70000696", "0.6970189", "0.69077027", "0.6870043", "0.6826366", "0.6805358"...
0.7843585
2
Creates a table with profile information.
def show_profile(self, aggregate=0): s = '' if aggregate == 0: s += '%50s\t %7s \t %4s \t %4s \t %s \n' % ("call", "time", "#sol", "#call", "location") s += '-' * 100 + '\n' for tm, key in sorted((t, k) for k, t in self.timestats.items()): term, locati...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _create_schema(self): \n q = (\"CREATE TABLE IF NOT EXISTS \" + \\\n \"profiles (username text, body text, epoch numeric)\",)\n for x in q: self.cursor.execute(x)\n self.conn.commit()", "def create_table(self):\n pass", "def create_table(self, repo, table, params):\n...
[ "0.75132346", "0.7041197", "0.6883866", "0.68042874", "0.667752", "0.65733296", "0.65512705", "0.6545101", "0.6514953", "0.65127397", "0.65013385", "0.6498644", "0.6493005", "0.6491383", "0.6481848", "0.64752764", "0.64375293", "0.64184505", "0.63713443", "0.6357026", "0.6349...
0.0
-1
Given input and target, it returns onehot encoding form
def convert_to_one_hot_labels(input, target, val=0): tmp = input.new(target.size(0), target.max() + 1).fill_(-1) tmp.scatter_(1, target.view(-1, 1), 1.0) # for some activation functions, e.g. relu if val == 0: ret = (tmp + 1) / 2 # for some activation functions, e.g. tanh if val == ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_one_hot_encoding(target_data):\n target_data = target_data.squeeze()\n n_class = len(np.unique(target_data))\n res = np.eye(n_class)[target_data.astype(int)]\n return res", "def one_hot_encode(y, out_size):\n n = len(y)\n oh = np.zeros((n, out_size))\n oh[range(n), y] ...
[ "0.81693745", "0.76902974", "0.76337856", "0.763148", "0.75926006", "0.75651914", "0.75068235", "0.7502144", "0.7479327", "0.74774253", "0.74637264", "0.741777", "0.74170744", "0.74142945", "0.74105936", "0.7311816", "0.73084605", "0.72973084", "0.7291329", "0.7266173", "0.72...
0.7634374
2
This function is provided by instructor to get cifar or mnist dataset using torchvision.dataset package
def load_data(one_hot_labels=False, normalize=False, flatten=True, data_dir=None, cifar=False, full=True, tiny=False, val=0): if data_dir is None: data_dir = './data' if cifar is not None and cifar: print('* Using CIFAR') cifar_train_set = datasets.CIFAR10(data_dir + '/ci...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_datasets(data):\n train_dataset, test_dataset = None, None\n data_dir = '../data'\n\n if data == 'fmnist':\n transform = transforms.Compose([transforms.ToTensor(), transforms.Normalize(mean=[0.2860], std=[0.3530])])\n train_dataset = datasets.FashionMNIST(data_dir, train=True, downl...
[ "0.76766676", "0.75385934", "0.7449148", "0.7220129", "0.72050947", "0.7101542", "0.69663155", "0.69628024", "0.69498754", "0.6922246", "0.6910327", "0.68956625", "0.6893303", "0.6890772", "0.684377", "0.6840554", "0.6813392", "0.680247", "0.67767084", "0.67741853", "0.673338...
0.0
-1
Retrieves all flashcards in ascending order (max 250 at a time) or using basic pagination returns `qty` flashcards occuring after `start`.
def retrieve_all_flashcards(start: int=0, qty:int=None): qty = 250 if qty == None else qty with sqlite3.connect(current_app.config['DB']) as db: c = db.cursor() c.execute(""" SELECT id, title, description, source, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_cards(query_param):\n return _query_scryfall(query_param)", "def get_all(self, start_at, limit, order=None):", "def get_cards(shop, redas=None, skip=0, limit=40):\n connection = pymongo.MongoClient(MONGO_URL)\n db = connection[DB]\n\n selector = {'shops.' + shop: {'$exists': 1}}\n if red...
[ "0.5929701", "0.56348145", "0.5483227", "0.52740085", "0.5245021", "0.5158718", "0.51479316", "0.5110173", "0.5082926", "0.5076762", "0.5074356", "0.5069807", "0.50454044", "0.5042", "0.50204206", "0.5005391", "0.50021154", "0.50005645", "0.49998033", "0.4996675", "0.49888542...
0.822305
0
Parse results filename in format 7, restricted to the ho basis special case, but allowing for natural orbitals built on this basis.
def parser(filename): regex = re.compile( # prolog r"run(?P<run>\w+)" ##r"\-(?P<code_name>((mfdn)|(obscalc-ob))[^\-]*)" r"\-(?P<descriptor>" # descriptor contents r"Z(?P<Z>\d+)\-N(?P<N>\d+)" r"\-(?P<interaction>.+)\-(?P<coulomb>\d)" r"\-(?P<truncation...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _parse_results(self):\n for line in self.file_dic['output'].splitlines():\n if line.startswith(' * GAMESS VERSION = '):\n temp = line.split('=')[1]\n temp = temp.split('*')[0]\n self.version = temp.strip()\n\n if line[1...
[ "0.6099494", "0.58512676", "0.58459806", "0.57934743", "0.5758889", "0.5653699", "0.5639124", "0.55673873", "0.5560741", "0.5470509", "0.5454175", "0.54439193", "0.5409063", "0.5407918", "0.5395332", "0.53548986", "0.5347291", "0.53218514", "0.5285737", "0.5282547", "0.528069...
0.5843057
3
rightpad a string with zeros to the given length
def _rzfill(string, to_len): if len(string) > to_len: raise ValueError("string is already longer than to_len") return string + '0' * (to_len - len(string))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def r_pad(arg, length):\n if length <= len(arg):\n return arg\n else:\n return arg + \" \" * (length - len(arg))", "def rightpad(field, length):\r\n field = str(field)\r\n field_length = len(field)\r\n if field_length>length:\r\n field = field[:length]\r\n if field_length<l...
[ "0.8048082", "0.8042724", "0.8026424", "0.78363734", "0.78341615", "0.76930463", "0.7581309", "0.74894637", "0.73814124", "0.7381266", "0.7312482", "0.7301371", "0.72033757", "0.71582454", "0.7100653", "0.70349735", "0.7018298", "0.70045847", "0.6971008", "0.6954787", "0.6918...
0.8118524
0
simple base conversion using the RFC4648 base32 alphabet
def _base32_to_hex(base32): ALPHABET = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ234567' x = 0 for digit in str(base32.upper().strip(' ')): x = x * len(ALPHABET) + ALPHABET.index(digit) return hex(x).lstrip('0x').rstrip('L').upper()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def baseEncode(number, base=36):\n if base == 10:\n return str(number)\n if not isinstance(number, int):\n raise TypeError('number must be an integer')\n alphabet='0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz'\n if base > 62 or base <=1:\n print(\"base should be b...
[ "0.694653", "0.6893029", "0.68493384", "0.6781506", "0.6748476", "0.6748476", "0.6748476", "0.6748476", "0.673473", "0.67151284", "0.66982746", "0.66775656", "0.6672081", "0.66119474", "0.66039515", "0.6559059", "0.6518085", "0.6504039", "0.64883107", "0.64749783", "0.6462858...
0.68664634
2
Confirms that programming should take place
def _program_confirm(self, slot, base32_key, require_button): if int(slot) not in (1, 2): return tkMessageBox.showerror("Error", "Please Choose a slot") try: _base32_to_hex(base32_key.replace(' ', '')) except ValueError: return tkMessageBox.showerror( ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def solveOneStep(self):\n ### Student code goes here\n return True", "def entrance_exam(self):\n status = False\n tool = ProgrammingTool.create(self.PROGRAMMING_TOOL)\n if tool.connect(self.target_name):\n status = entrance_exam(tool, self.register_map)\n ...
[ "0.66171014", "0.6451814", "0.6279466", "0.62419975", "0.6218109", "0.6213138", "0.62026155", "0.6154495", "0.6097345", "0.6082555", "0.6067573", "0.60469735", "0.5939188", "0.5937973", "0.5904631", "0.5901756", "0.587484", "0.58664036", "0.5863362", "0.5831017", "0.5813148",...
0.0
-1
Once we get here, things get destructive
def _program_key(self, slot, base32_key, require_button): try: config = self.parent.yk.init_config() except (AttributeError, yubico.yubikey_usb_hid.usb.USBError): return tkMessageBox.showerror( "Error", "No YubiKey detected" ) c...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def finalise(self):", "def cleanup(self):", "def cleanup(self):", "def cleanup(self):", "def clean_up(self):\n\t\tpass", "def _clean_up(self):", "def cleanup(self):\r\n pass", "def cleanup():", "def cleanup(self):\r\n pass", "def cleanup(self):\r\n pass", "def cleanup (self):\n...
[ "0.7717137", "0.76449364", "0.76449364", "0.76449364", "0.7408459", "0.73973453", "0.7345347", "0.7338911", "0.7309913", "0.7309913", "0.7275345", "0.72413766", "0.72413766", "0.72413766", "0.72413766", "0.72413766", "0.72413766", "0.72413766", "0.72413766", "0.72413766", "0....
0.0
-1
callback for the help>help pulldown
def _help_dialogue(self): webbrowser.open('https://github.com/ldrumm/yubikey-totp-gui/wiki')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def help(self):", "def help(self):", "def Help(self, event):\n Help(self)", "def help():\n \n pass", "def help():", "def cb_help( self, ):\r\n # this shows how to run stuff in the helper -- call thru queue, post to queue\r\n #help_file = self.parameters.help_file\r\n ...
[ "0.80186397", "0.80186397", "0.7731719", "0.7697429", "0.7684272", "0.7594509", "0.7521115", "0.7521115", "0.7504964", "0.74518096", "0.7404527", "0.7398889", "0.7305916", "0.73051256", "0.72600025", "0.7231249", "0.72197986", "0.72022885", "0.7184661", "0.7184661", "0.717605...
0.6912986
39
callback for the help>about pulldown
def _about_dialogue(self): webbrowser.open('https://github.com/ldrumm/yubikey-totp-gui')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _helpmenu_about():\n self.helpindex = Toplevel(self.master)\n self.helpindex.title(\"About\")\n self.helpindex.geometry(\"500x300\")\n self.helpindex.label()", "def on_about(self, event):\n pass", "def OnButtonAboutHelpButton(self, event):\r\n\t\twebbrowse...
[ "0.765356", "0.7577206", "0.74981856", "0.7448139", "0.7448139", "0.7319513", "0.72994196", "0.72841066", "0.7245511", "0.7188178", "0.71726924", "0.71114415", "0.70453995", "0.70418257", "0.7026243", "0.7026243", "0.7003405", "0.69978666", "0.69692993", "0.69655603", "0.6960...
0.6496328
65
callback for the help>about pulldown
def _credits_dialogue(self): credits_dialogue = _Credits(self) self.root.wait_window(credits_dialogue.top)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _helpmenu_about():\n self.helpindex = Toplevel(self.master)\n self.helpindex.title(\"About\")\n self.helpindex.geometry(\"500x300\")\n self.helpindex.label()", "def on_about(self, event):\n pass", "def OnButtonAboutHelpButton(self, event):\r\n\t\twebbrowse...
[ "0.7653562", "0.75776154", "0.7498668", "0.744767", "0.744767", "0.7320218", "0.729864", "0.72840995", "0.7245795", "0.71876717", "0.7171748", "0.71118313", "0.70450485", "0.70416677", "0.70259655", "0.70259655", "0.70030093", "0.6997717", "0.6969709", "0.69647825", "0.696079...
0.0
-1
callback for the edit>Program YubiKey pulldown Opens a new configuration window, blocking until exit.
def _program_key(self): prg_dialogue = _ProgrammingWindow(self) self.root.wait_window(prg_dialogue.top)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def open_configuration(self,event):\n configDevFrame = Single_deviceconf(parent=self, ID=996)\n configDevFrame.Centre()\n configDevFrame.Show()\n configDevFrame.ShowModal()\n configDevFrame.Destroy()", "def launch_configtool():\r\n from PyQt4 import QtGui\r\n from freesee...
[ "0.61349726", "0.60930395", "0.56927663", "0.5672919", "0.5658804", "0.56028754", "0.5590743", "0.5581867", "0.55574065", "0.5545362", "0.55315197", "0.5530267", "0.5511534", "0.5434221", "0.5433302", "0.5420036", "0.54124206", "0.538076", "0.5372468", "0.5334774", "0.5318711...
0.5807202
2
Event handler for keypress events.
def keypress(self, event): events = { '1': lambda: self.slot.set(1), '2': lambda: self.slot.set(2), '6': lambda: self.digits.set(6), '8': lambda: self.digits.set(8), } try: events[event.keysym]() except KeyError: pas...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _on_key_press(self, event):", "def key_press_event(self, event):\n pass", "def ev_KEYDOWN(self, event):", "def ev_KEYUP(self, event):", "def _on_key_release(self, event):", "def ev_keydown(self, event: KeyDown) -> None:", "def on_key_event(self, key):\n pass", "def _handle_key_press...
[ "0.83731693", "0.8224903", "0.7860711", "0.78414875", "0.78065944", "0.76585764", "0.75980836", "0.75778073", "0.7518489", "0.7457421", "0.7428157", "0.73604447", "0.7314259", "0.7306808", "0.72179407", "0.7211457", "0.7195942", "0.7187176", "0.7184973", "0.71583706", "0.7148...
0.7696556
5
Tries to detect a pluggedin YubiKey else alerts user
def detect_yubikey(self): try: self.yk = yubico.find_yubikey() self.version.set("Version:%s" % self.yk.version()) self.serial.set("Serial:%s" % self.yk.serial()) except yubico.yubikey.YubiKeyError: self.version.set("No YubiKey detected") self.s...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def detect_infrared():\n try:\n count = 0\n while True:\n if GPIO.input(PIN_NO) == True:\n count += 1\n print('[+] Detected ' + str(count))\n output_sound()\n send_message()\n time.sleep(2)\n except Exception ...
[ "0.5550443", "0.54399776", "0.5384098", "0.5384029", "0.535033", "0.5321742", "0.5321742", "0.527354", "0.5258836", "0.52223456", "0.5207884", "0.5207635", "0.5153576", "0.5151934", "0.5151934", "0.5151934", "0.5151934", "0.5151934", "0.5151934", "0.5151934", "0.5151934", "...
0.7784908
0
Create an OATH TOTP OTP and return it as a string (to disambiguate leading zeros). This is ripped straight out of yubico's commandline script, `yubikeytotp`. Credit due.
def _make_totp(self): secret = struct.pack('> Q', int(time.time()) / DEFAULT_STEP).ljust(64, chr(0x0)) response = self.yk.challenge_response(secret, slot=self.slot.get()) # format with appropriate number of leading zeros fmt = '%.' + str(self.digits.get()) + 'i' totp_str = fmt % ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def createOTP():\n\t code = []\n\t for i in range(6):\n\t\t code.append(random.randint(0,9))\n\t return \"\".join(str(code) for c in code)", "def get_generate_root_otp():\n if vault_version_ge(\"1.10.0\"):\n test_otp = \"BMjzW3wAsEzINXCM05Wbas3u9zSl\"\n elif vault_version_ge(\"1.0.0\"):\n ...
[ "0.79286695", "0.73375225", "0.7077653", "0.69100636", "0.6877625", "0.67218035", "0.6552476", "0.62827194", "0.6226551", "0.6221451", "0.60806763", "0.6037466", "0.5912459", "0.58949953", "0.58866847", "0.588235", "0.5861816", "0.5819198", "0.58083165", "0.57993615", "0.5791...
0.7274214
2
example action using the internationalization operator T and flash rendered by views/default/index.html or views/generic.html
def index(): #Have to create LOGIN #serverxmpp.init() return dict()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index(request, *args, **kwargs):\n return Response({\"message\":\"Nobody expects the spanish inquisition!\"})", "def index():\n return dict(message=T('Hello World'))", "def index():\n response.flash = \"Welcome to Myapp!\"\n return dict(message=T('Hello World'))", "def index_en(request):\n ...
[ "0.6669253", "0.6106264", "0.60288846", "0.58851135", "0.5849926", "0.5769206", "0.57516533", "0.5746587", "0.56890476", "0.56517714", "0.5640681", "0.5632036", "0.5626597", "0.5620084", "0.5610544", "0.55801964", "0.5567253", "0.5565134", "0.5561535", "0.5552105", "0.5483386...
0.0
-1
Converts a twodimensional grid with onedimensional coordinate variables to an array where each grid value is associated with its coordinates.
def grid2triple(x, y, z, msg=None, meta=False): # todo: Revisit for handling of "meta" argument # Basic sanity checks if z.ndim != 2: raise DimensionError( "ERROR grid2triple: `z` must be two dimensions !\n") if isinstance(x, xr.DataArray): x = x.values if isinstance(y,...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def as_numpy_array_2D(self):\n wx = []\n wy = []\n for wp in self.waypoints:\n wx.append(wp.location.x)\n wy.append(wp.location.y)\n return np.array([wx, wy])", "def _getLatLonGrid(self, lats, lons):\n numLats, numLons = lats.shape\n\n #coordGrid = ...
[ "0.7030514", "0.6824461", "0.66414434", "0.659834", "0.6587743", "0.65657645", "0.6543118", "0.6542288", "0.6476765", "0.6476106", "0.6450794", "0.62825483", "0.62591165", "0.62475705", "0.62113106", "0.6190677", "0.61894315", "0.6177104", "0.61621207", "0.6114646", "0.610391...
0.0
-1
Display the Entry text value.
def save(self): fname = self.dir_saving+str(self.folder)+'/colours.txt' if not os.path.isfile(fname): self.file_com = open(fname, 'w') else: print 'warning this person has an objects file in its dir, I will rewrite it.' self.file_com = open(fname, 'w') ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def displayText(self):\n if self.entryWidget.get().strip() == \"\":\n tkMessageBox.showerror(\"Tkinter Entry Widget\", \"Enter a text value\")\n else:\n self.file_com.write(self.entryWidget.get().strip()+'\\n')", "def print_entry(text):\n print \"Text entered: \\n '%s'\" % t...
[ "0.76484877", "0.6926207", "0.6598252", "0.6590535", "0.65623057", "0.6552865", "0.6468197", "0.64450836", "0.64450836", "0.64450836", "0.64450836", "0.64450836", "0.6352432", "0.6344944", "0.6339035", "0.6331184", "0.6292854", "0.62803704", "0.6258875", "0.62545305", "0.6250...
0.0
-1
Display the Entry text value.
def displayText(self): if self.entryWidget.get().strip() == "": tkMessageBox.showerror("Tkinter Entry Widget", "Enter a text value") else: self.file_com.write(self.entryWidget.get().strip()+'\n')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def print_entry(text):\n print \"Text entered: \\n '%s'\" % text", "def value (self):\r\n return self.entry.get()", "def display_entry(self, entry):\n border = '-' * 50\n print(border)\n print('Employee: {}'.format(entry.employee_name))\n print('Task Name: {}'.format(entry....
[ "0.6926207", "0.6598252", "0.6590535", "0.65623057", "0.6552865", "0.6468197", "0.64450836", "0.64450836", "0.64450836", "0.64450836", "0.64450836", "0.6352432", "0.6344944", "0.6339035", "0.6331184", "0.6292854", "0.62803704", "0.6258875", "0.62545305", "0.62507486", "0.6148...
0.76484877
0
Create and configure connexion app.
def create_app(env): connexion_app = connexion.App(__name__, specification_dir='openapi/', options={'swagger_url': '/swagger'}) app = connexion_app.app env_config_class_map = { 'prod': 'config.Prod', 'testing': 'config.Testing', 'dev': 'config.Dev' ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_app(self):\r\n self.app = Flask(__name__, instance_relative_config=True)\r\n\r\n # Init the secret key of the app -it is a must for flask to run\r\n self.app.config.from_mapping(\r\n SECRET_KEY='!ZNeverSayNever116Z!',\r\n MONGODB_SETTINGS= {'host': 'mongodb://l...
[ "0.74086744", "0.71356195", "0.71240467", "0.7108809", "0.7074317", "0.7031925", "0.70253813", "0.7023434", "0.7022537", "0.7013904", "0.70036703", "0.69989914", "0.69644254", "0.6951114", "0.69442946", "0.693363", "0.6925931", "0.6923495", "0.6898156", "0.68892235", "0.68874...
0.7772478
0
Initialize the network. A variable size network with only fully connected layers and SELU activations after all but the last layer.
def __init__(self, sizes, final=None, batchnorm=False, dropout=0.0): super(MLP, self).__init__() self.layers = nn.ModuleList() # If there is only one input dimension, everything is fine if sizes[0] == 1: self.layers.append(nn.Linear(sizes[0], sizes[1])) # For multip...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initialise_network(self):\n raise NotImplementedError", "def initialize_network(self):\n self.sess = tf.InteractiveSession()\n sys.stderr.write(\"------\\n\")\n self.model.create_model()\n self._initialize_trainer()\n self.sess.run(tf.initialize_all_variables())\n ...
[ "0.72223186", "0.7183338", "0.7149344", "0.70532566", "0.68841815", "0.685267", "0.6812993", "0.67817575", "0.67806387", "0.6703794", "0.6695307", "0.6632749", "0.65558106", "0.65533847", "0.655", "0.651694", "0.6497365", "0.646424", "0.64635956", "0.64514226", "0.64335364", ...
0.0
-1
Train a network on data with Adam.
def train(net, x, y, loss_func=nn.MSELoss(), epochs=50, batchsize=64, **kwargs): opt = torch.optim.Adam(net.parameters(), **kwargs) n_samples = x.size(0) for epoch in tqdm(range(epochs), desc='epochs'): # Shuffle training data p = torch.randperm(n_samples).long() xp = x[p] ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _train(self, dataset):\n net = buildNetwork(\n dataset.params_length,\n self._default_hidden_layers,\n 1 # a binary classifier only requires one output layer\n )\n ds = SupervisedDataSet(dataset)\n trainer = BackpropTrainer(net, ds)\n trainer...
[ "0.7142611", "0.70283115", "0.6980313", "0.6946319", "0.6933361", "0.6874179", "0.68680966", "0.6864175", "0.6826276", "0.6806006", "0.6795536", "0.6792484", "0.6745369", "0.6721245", "0.6689094", "0.6658409", "0.66518384", "0.6641448", "0.66338944", "0.66302085", "0.6597788"...
0.0
-1
Right Call/Contact Center Monitoring written in Python
def main(transcribe_bucket_name, mp3_bucket_name): s3 = boto3.resource('s3') for bucket in s3.buckets.all(): if bucket.name == transcribe_bucket_name: for key in bucket.objects.all(): if key.key.endswith('.json'): r = {} # Get referenc...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def verifyActionCenterRts():\n pass", "def process_calls():\n try:\n sdplus_api = API(os.environ['SDPLUS_ADMIN'], 'http://sdplus/sdpapi/')\n if not sdplus_api:\n raise KeyError\n except KeyError:\n print('Windows environment varible for \"SDPLUS_ADMIN\" (the API key for s...
[ "0.5548838", "0.5275075", "0.52695197", "0.52552813", "0.5224158", "0.5212015", "0.52037525", "0.519015", "0.516678", "0.5134479", "0.5118978", "0.5107609", "0.51021135", "0.5101119", "0.5096831", "0.5074387", "0.5034377", "0.49731573", "0.49478325", "0.49477607", "0.4943996"...
0.0
-1
Handle the command line.
def parse_args(arglist): help = dedent(""" Currently this can start with ROIs defined as a surface label on fsaverage, labels defined on each subject's native surface, ROIs defined on the high-res volume in Freesurfer space, or a statistical volume from a subject-level analysis. You can always ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def main():\n args = parse_args()\n process_args(args)", "def main(args):\n cli = CLI()\n # Check arguments\n cli.parse_arguments(args)", "def cli():\n config, auth, execute_now = read_command_line_arguments()\n main(config, auth, execute_now)", "def main():\n\n try:\n args.han...
[ "0.74971783", "0.71494687", "0.71189487", "0.6985615", "0.6935053", "0.6935053", "0.6898837", "0.68239295", "0.68239295", "0.67813313", "0.67738324", "0.67629313", "0.67573655", "0.67573655", "0.67573655", "0.67573655", "0.67573655", "0.67573655", "0.67573655", "0.67573655", ...
0.0
-1
Verify that the proper recommendation class is used (in this case MinimizeIngredients)
def test_minimize_recommendation(self, mocker): all_prop = mocker.patch( 'saana_lib.recommendation.MinimizeIngredients.all', new_callable=mocker.PropertyMock, return_value={"onion": 0, "flax": 2} ) _ = MinimizeRecommendation(patient_id()).as_list() all...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_set_scored_recommendations_post(self):\n pass", "def test_recommender(self):\n\n self._build_sample_graph()\n\n # set skill sa score to 1.0 and skill sb score to 0.5\n measure_sa = competency.SuccessRateCompetencyMeasure.load(\n self.user_id, self.sa.id)\n m...
[ "0.595414", "0.58778185", "0.5792868", "0.5701177", "0.569256", "0.56817424", "0.55536056", "0.5547504", "0.5527662", "0.551033", "0.5493342", "0.54928374", "0.54863137", "0.54805166", "0.54494816", "0.54334074", "0.54104257", "0.5401707", "0.54013485", "0.5377127", "0.536532...
0.56267285
6
Verify the content of the list being returned
def test_prioritize_recommendation(self, mocker): mocker.patch( 'saana_lib.recommendation.PrioritizeIngredients.all', new_callable=mocker.PropertyMock, return_value={"onion": 0, "flax": 2} ) get_ingr_mock = mocker.patch( 'saana_lib.recommendation.R...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_for_list(check):", "def test_list(self):\n self.assertEqual(1, len(self.response.data))", "def test_get_list(self):\n pass", "def test_list(self):\n pass", "def test_list(self):\n pass", "def testList(self):\n response = requests.get(url=self.url)\n hea...
[ "0.7559709", "0.7377934", "0.72857034", "0.70505047", "0.70505047", "0.69433063", "0.6929412", "0.6905284", "0.6885966", "0.68247575", "0.67836255", "0.67389417", "0.67317593", "0.6656165", "0.6630503", "0.66243565", "0.66194046", "0.6611757", "0.6585201", "0.65682197", "0.65...
0.0
-1
This test verifies both, that the correct property is called, and check the content values being returned
def test_avoid_recommendation_values(self, mocker, datetime_mock): all_prop = mocker.patch( 'saana_lib.patient.AvoidIngredients.all', new_callable=mocker.PropertyMock, return_value={"onion", "flax"} ) get_ingr_mock = mocker.patch( 'saana_lib.recomm...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_properties_get(self):\n pass", "def test_getContent(self):\n self.assertEquals(\n self.successResultOf(self.testObject.getContent()), 'somecontent')", "def test_instance_of_property_methods_are_displayed(self):\n self.assertContains(self.response, \"<td>a_property</td>\...
[ "0.7652187", "0.7556218", "0.7029322", "0.6970644", "0.67729867", "0.6761271", "0.6690784", "0.66681176", "0.66422534", "0.66307294", "0.66168284", "0.659183", "0.6556387", "0.6556158", "0.6489865", "0.6480734", "0.64655095", "0.6452075", "0.6446517", "0.64337194", "0.6402229...
0.0
-1
Do not return anything, modify nums inplace instead. first, use a variable to represent the value of original num and also define a variable to store the possible upper num.
def nextPermutation(self, nums) -> None: def helper(a, i): while i > 0: for j in range(i - 1, a - 1, - 1): if nums[j] < nums[i]: nums[j], nums[i] = nums[i], nums[j] nums[j + 1:] = reversed(nums[j + 1:]) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def nextPermutation(self, nums: List[int]) -> None:\n '''\n 思路:下一个最大的数字,这个思想其实总是不明确,今天总结一下\n 原数组\n 1 2 7 4 3 1\n 下一个排列是\n 1 3 1 2 4 7\n 如何得到的?\n 观察原数组可以看出,如果从末尾往前看,数字逐渐变大,到了2时才减小,然后再从后往前找到第一个比2大的数字,3,然后交换2和3,再把此时3后面的数字转换一下即可\n\n '''\n\n # 交换元素\n...
[ "0.60333633", "0.5858728", "0.58256394", "0.5781123", "0.5750352", "0.5716651", "0.571249", "0.5701299", "0.56818914", "0.56051517", "0.5545243", "0.5529484", "0.55239177", "0.55072266", "0.54970944", "0.549113", "0.547449", "0.5471782", "0.5469615", "0.54593915", "0.5451816"...
0.5503453
14
Do not return anything, modify nums inplace instead.
def nextPermutation(self, nums: List[int]) -> None: n = len(nums) if n > 1: q = 0 for i in range(n - 2, -1, -1): if nums[i] < nums[i + 1]: nums[i], nums[i + 1] = nums[i + 1], nums[i] break else: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fn(i):\n if i == len(nums): ans.append(nums.copy())\n for j in range(i, len(nums)): \n nums[i], nums[j] = nums[j], nums[i]\n fn(i+1)\n nums[i], nums[j] = nums[j], nums[i]", "def double_nums(num_list):", "def remove_dups(nums):\r\n nums[:...
[ "0.70469916", "0.67161703", "0.66934896", "0.6586775", "0.6501143", "0.6482345", "0.6442288", "0.6407945", "0.6376896", "0.6372343", "0.63671577", "0.6365932", "0.63512594", "0.6328759", "0.6298402", "0.62855035", "0.62671727", "0.62472045", "0.62221444", "0.6193869", "0.6188...
0.0
-1
Trains the policy on given training data.
def train(self, X, y, domain, **kwargs): # type: (ndarray, List[int], Domain, **Any) -> None self.memorise(X, y, domain)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def train(self, training_data):\n pass", "def train(self, trainData):\n pass", "def train(self, training_data, cfg, **kwargs):\n pass", "def train (self, data, options={}):\n dir_name = list(data.keys())[0]\n relations = list(data.values())[0]\n if \"relation\" in opti...
[ "0.72467244", "0.6953124", "0.6876966", "0.68157506", "0.671062", "0.66017306", "0.64371353", "0.6391807", "0.631205", "0.61942077", "0.618187", "0.6178154", "0.6176209", "0.6142582", "0.61402553", "0.61247325", "0.6084632", "0.6078516", "0.60584986", "0.6033105", "0.6020605"...
0.0
-1
Predicts the next action the bot should take after seeing x. This should be overwritten by more advanced policies to use ML to predict the action. Returns the index of the next action
def predict_action_probabilities(self, tracker, domain): # type: (DialogueStateTracker, Domain) -> (float, Optional[int]) x = self.featurize(tracker, domain) logger.debug('Current tracker state [\n\t{}]'.format( "\n\t".join(["{}".format(e) for e in self.featurizer.decode_features(x, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def predict(self, x):\n self.eval()\n self.forward(x)\n predicted = np.argmax(self.inputs[-1], axis=1)\n return predicted", "def predict_step(self, x):\n\n input_x = self.session.graph.get_operation_by_name(\"input_x\").outputs[0]\n predictions_op = self.session.graph.ge...
[ "0.6715775", "0.66838646", "0.6628312", "0.66075236", "0.657193", "0.6548782", "0.6548782", "0.6548782", "0.6548782", "0.6533695", "0.64771754", "0.64747757", "0.6376165", "0.635955", "0.63558674", "0.6354287", "0.635243", "0.63053787", "0.62928694", "0.6230337", "0.6215346",...
0.62475294
19
Adds the commit to the commits array if it doesn't already exist, and returns the commit's index in the array.
def add_commit(self, commit): sha1 = commit.hex if sha1 in self._commits: return self._commits[sha1] title, separator, body = commit.message.partition("\n") commit = { 'explored': False, 'sha1': sha1, 'name': GitUtils.abbreviate_sha1(sha1),...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_commit(self, commit_id):\n commit = next((\n commit for commit in self.repo.iter_commits()\n if commit.hexsha == commit_id\n ), None)\n if commit is None:\n raise Exception(f'Commit {commit_id} not found!')\n return commit", "def commit_id(self...
[ "0.6170759", "0.593805", "0.5836253", "0.56688523", "0.5563604", "0.5461908", "0.5457891", "0.5429918", "0.5420427", "0.5400795", "0.5369754", "0.5346436", "0.5341644", "0.532622", "0.53205234", "0.5295877", "0.5276312", "0.52377796", "0.5224023", "0.52174157", "0.5216296", ...
0.64689815
0
Uniquely abbreviates the given SHA1.
def abbreviate_sha1(cls, sha1): # For now we invoke git-rev-parse(1), but hopefully eventually # we will be able to do this via pygit2. cmd = ['git', 'rev-parse', '--short', sha1] # cls.logger.debug(" ".join(cmd)) out = subprocess.check_output(cmd).strip() # cls.logger.d...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def uniquely_shorten(string, length):\n\n if len(string) <= length and not (len(string) == length and\n string.startswith(SHORTENED_PREFIX)):\n return string\n\n h = hashlib.sha256()\n h.update(\"%s \" % length)\n h.update(string)\n hash_text = h.hexdigest...
[ "0.6464314", "0.6410942", "0.6409734", "0.6156034", "0.6136031", "0.60622424", "0.6015629", "0.58965665", "0.58919525", "0.58904374", "0.58792883", "0.5815525", "0.5790694", "0.5786428", "0.5748069", "0.5668363", "0.5649841", "0.5627461", "0.56117934", "0.5600008", "0.5596956...
0.7369677
0
Returns a humanreadable representation of the given SHA1.
def describe(cls, sha1): # For now we invoke git-describe(1), but eventually we will be # able to do this via pygit2, since libgit2 already provides # an API for this: # https://github.com/libgit2/pygit2/pull/459#issuecomment-68866929 # https://github.com/libgit2/libgit2/pul...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sha1(self) -> str:\n return self.data.sha1", "def SHA1(self) -> _n_0_t_3[_n_0_t_9]:", "def abbreviate_sha1(cls, sha1):\n\n # For now we invoke git-rev-parse(1), but hopefully eventually\n # we will be able to do this via pygit2.\n cmd = ['git', 'rev-parse', '--short', sha1]\n ...
[ "0.75539047", "0.7134043", "0.71139914", "0.70256186", "0.6916353", "0.64446837", "0.6435449", "0.6391325", "0.6265224", "0.6232268", "0.62071484", "0.61809236", "0.61722136", "0.61514837", "0.6138544", "0.6127918", "0.610665", "0.6103424", "0.6097129", "0.6020157", "0.596937...
0.6566882
5
Returns all refs pointing to the given SHA1.
def refs_to(cls, sha1, repo): matching = [] for refname in repo.listall_references(): symref = repo.lookup_reference(refname) dref = symref.resolve() oid = dref.target commit = repo.get(oid) if commit.hex == sha1: matching.appen...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_refs(self, for_push: bool) -> List[Tuple[str, str]]:\n try:\n loc = posixpath.join(self._path, \"refs\")\n res = self._connection.files_list_folder(loc, recursive=True)\n files = res.entries\n while res.has_more:\n res = self._connection.fil...
[ "0.62746805", "0.6179788", "0.6128106", "0.5900156", "0.5898155", "0.5856927", "0.57434326", "0.57430595", "0.56420195", "0.5639147", "0.55719423", "0.55558074", "0.5515448", "0.5467317", "0.5440578", "0.5412632", "0.5385987", "0.5375013", "0.5368968", "0.53635335", "0.535599...
0.7806024
0
Find all dependencies of the given revision, recursively traversing the dependency tree if requested.
def find_dependencies(self, dependent_rev, recurse=None): if recurse is None: recurse = self.options.recurse try: dependent = self.get_commit(dependent_rev) except InvalidCommitish as e: abort(e.message()) self.todo.append(dependent) self.tod...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_dependencies(self, revision: Dict) -> List[Dict]:\n dependency_ids = revision['auxiliary']['phabricator:depends-on']\n revisions = self.get_revisions(phids=dependency_ids)\n result = []\n for r in revisions:\n result.append(r)\n sub = self.get_dependencies(...
[ "0.73712236", "0.6699492", "0.6546439", "0.6005795", "0.5999744", "0.55470836", "0.55263996", "0.54850143", "0.54307467", "0.5410811", "0.5379994", "0.5371398", "0.53526044", "0.5317734", "0.529328", "0.5279827", "0.5243155", "0.52289486", "0.5216687", "0.5189272", "0.5168941...
0.67338073
1
Find all dependencies of the given revision caused by the given parent commit. This will be called multiple times for merge commits which have multiple parents.
def find_dependencies_with_parent(self, dependent, parent): self.logger.debug(" Finding dependencies of %s via parent %s" % (dependent.hex[:8], parent.hex[:8])) diff = self.repo.diff(parent, dependent, context_lines=self.options.context_lines) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_dependencies(self, revision: Dict) -> List[Dict]:\n dependency_ids = revision['auxiliary']['phabricator:depends-on']\n revisions = self.get_revisions(phids=dependency_ids)\n result = []\n for r in revisions:\n result.append(r)\n sub = self.get_dependencies(...
[ "0.65092677", "0.6238572", "0.6223792", "0.5911293", "0.5791384", "0.56604487", "0.56449336", "0.5590153", "0.55886996", "0.5547283", "0.55453926", "0.5428988", "0.53039974", "0.5298665", "0.52890277", "0.5216612", "0.51291275", "0.51100653", "0.510938", "0.5103599", "0.50664...
0.6811225
0
Run git blame on the parts of the hunk which exist in the older commit in the diff. The commits generated by git blame are the commits which the newer commit in the diff depends on, because without the lines from those commits, the hunk would not apply correctly.
def blame_hunk(self, dependent, parent, path, hunk): first_line_num = hunk.old_start line_range_before = "-%d,%d" % (hunk.old_start, hunk.old_lines) line_range_after = "+%d,%d" % (hunk.new_start, hunk.new_lines) self.logger.debug(" Blaming hunk %s @ %s" % ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_blame(blameoutput):\n lines = blameoutput.split('\\n')\n i = 0\n commits = {}\n\n while i < len(lines):\n # Read a commit line and parse it.\n line = lines[i]\n i += 1\n if not line.strip():\n continue\n commitline = line.split()\n commithash = commitline[0]\n lineno_then = ...
[ "0.6053283", "0.6032853", "0.57691056", "0.5739654", "0.5558605", "0.54753315", "0.54249126", "0.53682005", "0.5311587", "0.52980185", "0.5267507", "0.52285916", "0.5224669", "0.5176965", "0.5174912", "0.51497334", "0.51410127", "0.5134518", "0.5132892", "0.5132451", "0.51252...
0.7433148
0
Navigate to the tree or blob object pointed to by the given target path for the given commit. This is necessary because each git tree only contains entries for the directory it refers to, not recursively for all subdirectories.
def tree_lookup(self, target_path, commit): segments = target_path.split("/") tree_or_blob = commit.tree path = '' while segments: dirent = segments.pop(0) if isinstance(tree_or_blob, pygit2.Tree): if dirent in tree_or_blob: tre...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def traverse_tree(tree, thisFolder, path, submission):\n\n # Get files directly underneath this folder.\n blobs = tree.blobs\n thisFolderName = tree.name\n\n # Add this folder to the path.\n path = os.path.join(path, thisFolderName)\n print(path)\n\n for blob in blobs:\n filepath = os.p...
[ "0.5894933", "0.55579513", "0.5489392", "0.52907765", "0.528364", "0.5157724", "0.5122504", "0.51111794", "0.50728655", "0.4995954", "0.49644312", "0.486692", "0.4840334", "0.48367405", "0.48296806", "0.4813238", "0.47609875", "0.47581476", "0.472949", "0.4682747", "0.4671142...
0.7929258
0
Multiplies a chain of matrices (2d ndarrays) All matrices must have dimensions compatible with matrix multiplication. This function actually calls the dot() method of the objects passed in as arguments. It thus handles any object that provides a dot() method that accepts 2D ndarrays. We also try to call dot_left(), in ...
def mmul(*args): #if not out is None and (args.count == 2 and out in args or args[-1] is out): # raise res = args[0] for x in args[1:]: try: res = x.dot_left(res) except: res = res.dot(x) #Since, for some reason, the method version of dot() does ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def matrix_dot(*args):\n rval = args[0]\n for a in args[1:]:\n rval = tm.dot(rval, a)\n return rval", "def matrix_dot(*args):\r\n rval = args[0]\r\n for a in args[1:]:\r\n rval = theano.tensor.dot(rval, a)\r\n return rval", "def _mul(*args):\n\treturn functools.reduce(numpy.dot,...
[ "0.6464176", "0.64443016", "0.64034724", "0.6394492", "0.6346506", "0.63325864", "0.63120514", "0.62841994", "0.6244109", "0.6220131", "0.62185293", "0.61864954", "0.6177195", "0.61623335", "0.61421657", "0.6108951", "0.60923254", "0.60776734", "0.6048294", "0.60069627", "0.5...
0.0
-1
Calculates the scalar product for the ancilla, expecting the arguments in matrix form. Equivalent to trace(dot(H(a), b))
def adot(a, b): return sp.inner(a.ravel().conj(), b.ravel())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def trace_dot(a, b):\r\n return np.sum(a * b)", "def _mul(*args):\n\treturn functools.reduce(numpy.dot, args)", "def matmul(a, b):\n raise NotImplementedError", "def matrix_dot(*args):\r\n rval = args[0]\r\n for a in args[1:]:\r\n rval = theano.tensor.dot(rval, a)\r\n return rval", ...
[ "0.6860679", "0.6431614", "0.6235833", "0.61052155", "0.60941714", "0.60521656", "0.6050547", "0.60273427", "0.6012209", "0.59840417", "0.59786654", "0.5951647", "0.5924648", "0.5924604", "0.59234643", "0.5921385", "0.58611935", "0.58481747", "0.58075315", "0.5792245", "0.577...
0.0
-1
Calculates the scalar product for the ancilla, expecting the arguments in matrix form. Equivalent to trace(dot(a, b))
def adot_noconj(a, b): return sp.inner(a.T.ravel(), b.ravel())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def trace_dot(a, b):\r\n return np.sum(a * b)", "def _mul(*args):\n\treturn functools.reduce(numpy.dot, args)", "def matrix_dot(*args):\r\n rval = args[0]\r\n for a in args[1:]:\r\n rval = theano.tensor.dot(rval, a)\r\n return rval", "def dot_product(a,b):\n return sum(pairwise_mult(a,b...
[ "0.7579812", "0.7087431", "0.69432503", "0.6658414", "0.66481644", "0.6605811", "0.6450666", "0.636946", "0.6345714", "0.6341091", "0.62828994", "0.62696874", "0.6254947", "0.6234855", "0.62276524", "0.62057537", "0.620463", "0.6201436", "0.6200419", "0.61829895", "0.61677045...
0.0
-1
Matrix conjugate transpose (adjoint). This is just a shortcut for performing this operation on normal ndarrays.
def H(m, out=None): if out is None: return m.T.conj() else: out = sp.conjugate(m.T, out) return out
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def transjugate(A):\n return conjugate(transpose(A))", "def conjugate(self) -> JaggedArray:\n return self._unitary_op(np.conjugate)", "def conjugate(x):\n if len(list(x.size())) == 2:\n z = torch.zeros(2, x.size()[1], dtype=torch.double, device=x.device)\n z[0] = x[0]\n z[1] =...
[ "0.70892566", "0.69537246", "0.6742829", "0.65784675", "0.65714926", "0.6512788", "0.645505", "0.6390343", "0.6361083", "0.6300163", "0.6300163", "0.6300163", "0.6300163", "0.6300163", "0.6300163", "0.6300163", "0.6300163", "0.6300163", "0.6300163", "0.6300163", "0.6300163", ...
0.51606166
73
Randomizes a complex matrix in place.
def randomize_cmplx(x, a=-0.5, b=0.5, aj=-0.5, bj=0.5): x[:] = (((b - a) * sp.random.ranf(x.shape) + a) + 1.j * ((bj - aj) * sp.random.ranf(x.shape) + aj)) return x
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def complex_randn(shape):\n return np.random.randn(*shape) + 1j * np.random.randn(*shape)", "def generate_random_matrix(dim):\n\n A = np.complex128(np.random.random([dim, dim]))\n A_adjoint = A.conj().T\n\n P = A @ A_adjoint\n P += np.identity(len(P))\n\n P_inverse = np.linalg.inv(P)\n\n ret...
[ "0.7110527", "0.6787168", "0.62844926", "0.6281481", "0.5847896", "0.58324844", "0.578896", "0.57016677", "0.56990147", "0.56330025", "0.55559", "0.553823", "0.5475703", "0.5463606", "0.54351777", "0.5429479", "0.5408215", "0.5368029", "0.5358951", "0.5351161", "0.5349964", ...
0.55754113
10
Return the matrix square root of a hermitian or symmetric matrix Uses scipy.linalg.eigh() to diagonalize the input efficiently.
def sqrtmh(A, ret_evd=False, evd=None): if not evd is None: (ev, EV) = evd else: ev, EV = la.eigh(A) #uses LAPACK ***EVR ev = sp.sqrt(ev) #we don't require positive (semi) definiteness, so we need the scipy sqrt here #Carry out multiplication with the diagonal matrix of eigenva...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def trans_hellinger(m):\n m = asmatrix(m)\n row_sums = sum(m, axis=1)\n result = sqrt(m / row_sums)\n return result", "def _symmetric_matrix_square_root(mat, eps=1e-10):\n # Unlike numpy, tensorflow's return order is (s, u, v)\n s, u, v = linalg_ops.svd(mat)\n # sqrt is unstable around 0, just use...
[ "0.62265146", "0.6111763", "0.60754913", "0.6025185", "0.5924092", "0.57053465", "0.56531864", "0.56375873", "0.56003076", "0.5589603", "0.5574254", "0.55350095", "0.5526857", "0.55079013", "0.5506939", "0.5501033", "0.54983324", "0.5481793", "0.5479065", "0.5479065", "0.5477...
0.66119474
0
Return the matrix square root of a hermitian or symmetric positive definite matrix Uses a Cholesky decomposition, followed by a QR decomposition, and then Nwewton iteration to obtain a polar form UH, with H Hermitian p.d. and
def sqrtmpo(A, out=None): R = la.cholesky(A) R = la.qr(R, overwrite_a=True, mode='r') #FIXME: NOTFINISHED assert False return 0
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def Rouwenhorst(rho, sig_z, num):\n import numpy as np\n p = (1+rho)/2.0\n q = (1+rho)/2.0\n psi = ((num-1)**0.5)*sig_z\n \n z = np.linspace(-psi, psi, num)\n \n T = np.array([[p, 1-p], [1-q, q]])\n \n if num == 2:\n return [z, T]\n elif num > 2:\n for i in range(3, n...
[ "0.6257454", "0.61807615", "0.6158862", "0.60760975", "0.59674543", "0.59514034", "0.5946448", "0.5878034", "0.5824738", "0.5823747", "0.57836276", "0.5773169", "0.57698154", "0.57347274", "0.57316196", "0.5720248", "0.5710236", "0.5703914", "0.5693833", "0.5690064", "0.56817...
0.0
-1
Compute the inverse of a triangular matrix Uses the corresponding LAPACK routine.
def invtr(A, overwrite=False, lower=False): trtri, = la.lapack.get_lapack_funcs(('trtri',), (A,)) inv_A, info = trtri(A, lower=lower, overwrite_c=overwrite) if info > 0: raise sp.LinAlgError("%d-th diagonal element of the matrix is zero" % info) if info < 0: raise ValueErro...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def inverse(self):\n self.check_square()\n\n\n N = self.rows\n\n inverse = make_matrix(N, N)\n\n # Solve on a per-column basis using Ax = b formalism\n for j in range(N):\n b = make_matrix(N, 1)\n b[j, 0] = 1\n\n x = self.solve_linear_system(b)\n\...
[ "0.74353004", "0.7380224", "0.7320343", "0.7228165", "0.7201508", "0.7059015", "0.69849044", "0.6935947", "0.6908033", "0.6890019", "0.6872973", "0.687151", "0.6863323", "0.6860544", "0.6846122", "0.68341386", "0.68189293", "0.68002075", "0.674202", "0.6693195", "0.6651067", ...
0.68603367
14
Efficient inversion of positive definite matrices using Cholesky decomposition. NOT YET WORKING
def invpo(A, out=None, lower=False): t = la.cholesky(A, lower=lower) print sp.allclose(sp.dot(H(t), t), A) #a, lower = la.cho_factor(A, lower=lower) #no.. we need a clean answer, it seems potri, = la.lapack.get_lapack_funcs(('potri',), (A,)) inv_A, info = potri(t, lower=lower, overwri...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def Cholesky_Derivs(InvV,m_points):\n #get some of the dimensions from the inputs\n m = InvV.n\n d = InvV.d\n\n #initialise the required array\n dM_dL = np.zeros([m,d,d,d,d])\n \n #firstly loop through each map/component\n for j in range(m):\n #now want to loop over each of the Chole...
[ "0.70008886", "0.6660287", "0.6586627", "0.6476201", "0.636285", "0.63269204", "0.62721646", "0.6265825", "0.6253143", "0.6099577", "0.60407466", "0.60191023", "0.5977014", "0.59703875", "0.5964205", "0.5907188", "0.58999556", "0.5897118", "0.5881195", "0.58727616", "0.586985...
0.52888644
99
Implements the BiCGSTAB method for isomorphic operations. The BiCGSTAB method is used to solve linear equations Ax = b. Should the vectors x, b be isomorphic to some other objects, say matrices x' and b', with corresponding opeator A' (for example, via the ChoiJamiolkowski isomorphism), the method can similarly be carr...
def bicgstab_iso(A, x, b, MVop, VVop, max_itr=500, atol=1E-14, rtol=1E-14): r_prv = b - MVop(A, x) r0 = r_prv.copy() rho_prv = 1 alpha = 1 omega_prv = 1 v_prv = sp.zeros_like(x) p_prv = sp.zeros_like(x) for i in xrange(max_itr): rho = sp.trace(sp.dot(r0, r_prv...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def solve_bicgstab(matvec: Callable,\n b: Any,\n ridge: Optional[float] = None,\n **kwargs) -> Any:\n if ridge is not None:\n matvec = _make_ridge_matvec(matvec, ridge=ridge)\n return jax.scipy.sparse.linalg.bicgstab(matvec, b, **kwargs)[0]", "def Matrix...
[ "0.6539457", "0.6492956", "0.59676135", "0.5878155", "0.58677775", "0.570458", "0.5635726", "0.5610093", "0.5430438", "0.5374911", "0.5323662", "0.5261384", "0.5253508", "0.52354103", "0.5204675", "0.51971155", "0.51891965", "0.5166504", "0.513837", "0.51158535", "0.51150143"...
0.5772146
5
Create a category for that party.
def create_category(party_id: PartyID, title: str) -> TourneyCategory: party = DbParty.query.get(party_id) if party is None: raise ValueError('Unknown party ID "{}"'.format(party_id)) category = TourneyCategory(party.id, title) party.tourney_categories.append(category) db.session.commit() ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_category():\n category = Category(name='testcategory', description=\"\", fee=DEFAULT_FEE)\n category.save()\n return category", "def create_new_wallet_category(self):\n wallet_category_vals = self._build_new_wallet_category_vals()\n return self.env['wallet.category'].create(wall...
[ "0.6914065", "0.67545795", "0.6537486", "0.65007126", "0.6460365", "0.62982243", "0.6271935", "0.6229216", "0.6228962", "0.6087871", "0.5959873", "0.59403336", "0.5935428", "0.5925022", "0.5839894", "0.58252794", "0.58077806", "0.57977724", "0.5763211", "0.5750037", "0.573666...
0.76143277
0
Move a category upwards by one position.
def move_category_up(category: TourneyCategory) -> None: category_list = category.party.tourney_categories if category.position == 1: raise ValueError('Category already is at the top.') popped_category = category_list.pop(category.position - 1) category_list.insert(popped_category.position - 2...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def move_category_down(category: TourneyCategory) -> None:\n category_list = category.party.tourney_categories\n\n if category.position == len(category_list):\n raise ValueError('Category already is at the bottom.')\n\n popped_category = category_list.pop(category.position - 1)\n category_list.i...
[ "0.7810339", "0.71507776", "0.70979744", "0.7040622", "0.70031214", "0.700075", "0.6951428", "0.6938323", "0.6885611", "0.6773141", "0.67571497", "0.6626251", "0.65867424", "0.65745205", "0.6459161", "0.64488965", "0.6434402", "0.63261694", "0.6297202", "0.6264247", "0.622065...
0.8217802
0
Move a category downwards by one position.
def move_category_down(category: TourneyCategory) -> None: category_list = category.party.tourney_categories if category.position == len(category_list): raise ValueError('Category already is at the bottom.') popped_category = category_list.pop(category.position - 1) category_list.insert(popped...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def move_category_up(category: TourneyCategory) -> None:\n category_list = category.party.tourney_categories\n\n if category.position == 1:\n raise ValueError('Category already is at the top.')\n\n popped_category = category_list.pop(category.position - 1)\n category_list.insert(popped_category....
[ "0.75041527", "0.6625059", "0.65953684", "0.6541835", "0.65137774", "0.6502901", "0.64917004", "0.6411511", "0.63754165", "0.63680816", "0.63534594", "0.634604", "0.6333525", "0.6307063", "0.6192082", "0.6185564", "0.6164168", "0.6129639", "0.60469884", "0.6000192", "0.600018...
0.80289805
0
Return the category with that id, or `None` if not found.
def find_category(category_id: TourneyCategoryID) -> Optional[TourneyCategory]: return TourneyCategory.query.get(category_id)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_category(id):\n\n category = get_db().execute('SELECT * FROM categories WHERE id = ?', (id, )).fetchone()\n\n if not category:\n abort(404, \"category id {0} does not exist.\".format(id))\n\n return category", "async def get_category(cls, session: AsyncSession, id: int) -> Optional[Categ...
[ "0.8413986", "0.82415974", "0.7956866", "0.7917487", "0.78595597", "0.73798203", "0.73384565", "0.72064275", "0.71930254", "0.6999618", "0.67847186", "0.6735789", "0.6639301", "0.65112734", "0.650825", "0.6481206", "0.6460801", "0.6449573", "0.63940597", "0.63577557", "0.6324...
0.7904236
4
Return the categories for this party.
def get_categories_for_party(party_id: PartyID) -> Sequence[TourneyCategory]: return TourneyCategory.query \ .filter_by(party_id=party_id) \ .order_by(TourneyCategory.position) \ .all()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def categories(self):\n\t\treturn self._categories", "def categories(self):\n return self._data[\"categories\"]", "def categories(self):\n return self.__categories", "def categories(self):\n return self._categories", "def getCategories(self):\r\n return self.categories", "def ...
[ "0.7996981", "0.7990833", "0.79048777", "0.78893447", "0.7860822", "0.78507435", "0.7831972", "0.78282094", "0.7793402", "0.7686937", "0.7667401", "0.76551235", "0.7599832", "0.7522415", "0.7482043", "0.7397668", "0.73637855", "0.73436093", "0.7312128", "0.72793543", "0.72627...
0.66241163
54
Set up an interceptor so all grpc calls will have the apikey added on the header, in order to authenticate.
def set_interceptor(self, apikey): self.header_interceptor = \ interceptor.header_adder_interceptor( 'lc-api-key', apikey ) try: self.intercept_channel = grpc.intercept_channel( self.channel, self.header_interceptor) except ValueError as e: raise Exception("Attempted to connect on termninated cli...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def authenticate(self, api_key):\n self.headers['x-rapidapi-key'] = api_key", "def __init__(self, api_key):\n self._api_key = api_key\n self.headers = {\n \"hibp-api-key\": api_key,\n \"user-agent\": \"haveibeenpywned.py\",\n }\n \"\"\"Dict of additional h...
[ "0.6686443", "0.63640404", "0.59382933", "0.5867886", "0.5780181", "0.5739476", "0.57209116", "0.57013947", "0.56940454", "0.569231", "0.56693566", "0.56687033", "0.5631621", "0.56137", "0.5556618", "0.55513924", "0.5533995", "0.5528315", "0.55266106", "0.5516029", "0.5476392...
0.79679054
0
The function add key to registry under 'REG_PATH'
def persistent(name, value): try: _winreg.CreateKey(_winreg.HKEY_CURRENT_USER, REG_PATH) registry_key = _winreg.OpenKey(_winreg.HKEY_CURRENT_USER, REG_PATH, 0, _winreg.KEY_WRITE) _winreg.SetValueEx(registry_key, name, 0, _winreg.REG_SZ, value) _...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, key_path=''):\n super(WinRegistryKey, self).__init__()\n self._key_path = key_paths.JoinKeyPath([key_path])", "def WriteRegValue(hiveKey, key, name, data, typeId=win32con.REG_SZ):\n try:\n keyHandle = win32api.RegOpenKeyEx(hiveKey, key, 0, win32con.KEY_ALL_ACCESS)\n win3...
[ "0.67100567", "0.6677133", "0.6297388", "0.62430936", "0.6082676", "0.6067533", "0.6060717", "0.600192", "0.5982344", "0.5917521", "0.59152794", "0.59032106", "0.5898263", "0.5894519", "0.58920854", "0.5866869", "0.5840783", "0.5834587", "0.58304256", "0.5813845", "0.57618916...
0.59483933
9
The function sends data to server, and prints msgs from other clients.
def main(): try: # persistent('infected', os.path.abspath(__file__)) # DON'T REMOVE # rename me to client.py # os.rename(__file__, os.getcwd() + "/client1.py") # print os.path.abspath(__file__) global my_socket my_socket = socket.socket(socket.AF_INET, socket.SOCK_S...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def run(self):\n # send data to client\n currProcessID = os.getpid()\n print \"PID: %s sending echo message to server: %s\" % (currProcessID,\n ECHO_MSG)\n sentDataLen = self.sock.send(ECHO_MSG)\n print \"Sent: %d chara...
[ "0.7056971", "0.7019039", "0.68477523", "0.6810195", "0.6644971", "0.6635883", "0.66154855", "0.66057706", "0.65976816", "0.65917546", "0.6570916", "0.6568058", "0.6564347", "0.654368", "0.6525813", "0.6509941", "0.6500165", "0.6489766", "0.64577127", "0.6444351", "0.64402354...
0.6016732
72
Writes results to a file
def write_to_file(file_name, bds, parameters=None, success=None, result=None, add_head=False, overwrite=False): if overwrite: f = open(file_name, "w") else: f = open(file_name, "a") # adds header for the results file if add_head: head_str = "Iteration" params = {} ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def write_result(self, file_name):\n f = file(file_name, \"w\")\n f.write(self.m_result)\n f.close()", "def write_results_to_disk(self, result_path,results):\n with open(result_path+\"/results.txt\",\"w+\") as out:\n\n for query_num in results:\n for doc_num ...
[ "0.77442235", "0.77054715", "0.7367398", "0.7360259", "0.73494154", "0.73246366", "0.7308568", "0.72313744", "0.7201102", "0.71957", "0.7158928", "0.7124561", "0.7120183", "0.7078446", "0.707296", "0.7059509", "0.7049528", "0.69777733", "0.69493216", "0.688521", "0.6858873", ...
0.6562216
50
returning all elements names from ``ImmunizationRecommendation`` according specification, with preserving original sequence order.
def elements_sequence(cls): return [ "id", "meta", "implicitRules", "language", "text", "contained", "extension", "modifierExtension", "identifier", "patient", "date", ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def itemnames():\n g = ['KIS_NA_39', 'VII_57', 'MX_48', 'MX_56', 'KIS_NA_42', 'VII_54',\n 'MX_S_48', 'MX_S_52', 'MX_52', 'KIS_NA_45', 'KIS_NA_51', 'MIP_45',\n 'MIP_49', 'MIP_52', 'MIP_plus_48', 'MIP_plus_51', 'MX_42', 'MX_45',\n 'MIP_G_42', 'KIS_42', 'KIS_NA_48']\n return(g)", "def elemen...
[ "0.56782556", "0.56028837", "0.5595492", "0.5593947", "0.55300343", "0.5521369", "0.55187535", "0.55180925", "0.5463728", "0.54546034", "0.54065096", "0.538096", "0.538058", "0.5376563", "0.5376563", "0.53717583", "0.5366831", "0.53619134", "0.5345186", "0.53447956", "0.53373...
0.56116945
1
returning all elements names from ``ImmunizationRecommendationRecommendation`` according specification, with preserving original sequence order.
def elements_sequence(cls): return [ "id", "extension", "modifierExtension", "vaccineCode", "targetDisease", "contraindicatedVaccineCode", "forecastStatus", "forecastReason", "dateCriterion", ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def itemnames():\n g = ['KIS_NA_39', 'VII_57', 'MX_48', 'MX_56', 'KIS_NA_42', 'VII_54',\n 'MX_S_48', 'MX_S_52', 'MX_52', 'KIS_NA_45', 'KIS_NA_51', 'MIP_45',\n 'MIP_49', 'MIP_52', 'MIP_plus_48', 'MIP_plus_51', 'MX_42', 'MX_45',\n 'MIP_G_42', 'KIS_42', 'KIS_NA_48']\n return(g)", "def get_na...
[ "0.55996305", "0.5533983", "0.5532082", "0.5531071", "0.551983", "0.55109936", "0.5510303", "0.5445824", "0.54457086", "0.54309005", "0.54169387", "0.5382732", "0.5362275", "0.53310806", "0.5324852", "0.5321274", "0.5321274", "0.53174865", "0.53172743", "0.53057075", "0.52920...
0.5134457
46
returning all elements names from ``ImmunizationRecommendationRecommendationDateCriterion`` according specification, with preserving original sequence order.
def elements_sequence(cls): return ["id", "extension", "modifierExtension", "code", "value"]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_date_pred():\r\n \r\n date_now = dt.datetime.now()\r\n date_pred = [date_now - dt.timedelta(days=1)+dt.timedelta(days=i) for i in range(8)]\r\n month_pred = [item.month for item in date_pred]\r\n day_pred = [item.day for item in date_pred]\r\n \r\n return date_pred,month_pred,day_pred"...
[ "0.5164994", "0.49957657", "0.49790373", "0.49350888", "0.489302", "0.4817644", "0.47879577", "0.4780576", "0.4754007", "0.4715894", "0.46958432", "0.46928817", "0.46879193", "0.46861127", "0.46854797", "0.4663666", "0.46342486", "0.4606411", "0.45946944", "0.4579715", "0.457...
0.0
-1
default cal index from 19000101
def __init__(self, code, start_date="1900-01-01", end_date="2020-01-01"): base = Base() self.datas = base.getData( code=code, start_date=start_date, end_date=end_date) self._index = 0 self.period = 14
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setDefaultIndex():\r\n return 0", "def dayofyear(self) -> Index:\n warnings.warn(\n \"`dayofyear` will return int32 index instead of int 64 index in 4.0.0.\",\n FutureWarning,\n )\n return Index(self.to_series().dt.dayofyear)", "def day(self) -> Index:\n ...
[ "0.625253", "0.6234539", "0.61408883", "0.5848705", "0.58286357", "0.57312787", "0.57171273", "0.5658349", "0.556045", "0.5558227", "0.555326", "0.55059904", "0.54892826", "0.54743004", "0.540458", "0.5399076", "0.53972256", "0.53660876", "0.53427213", "0.5341637", "0.5278321...
0.0
-1
Compute time for arrival of 2 successive Poisson processes.
def successive_poisson(tau1, tau2, size=1): # Draw samples out of first exponential distribution: t1 t1 = np.random.exponential(tau1, size) # Draw samples out of second exponential distribution: t2 t2 = np.random.exponential(tau2, size) return t1 + t2
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def inter_arrival_times(self):\n # this function returns arrival times between two subsequent tuples in ms\n # task mean_inter_arrival_time std_inter_arrival_time\n if self.inter_arrival_time is None:\n if self.tuple_arrival is None:\n self.tuple_arrivals()\n ...
[ "0.6605994", "0.64463836", "0.5987773", "0.5685406", "0.5586563", "0.5566638", "0.55001855", "0.54996055", "0.5490612", "0.5451096", "0.5409021", "0.53857464", "0.5382504", "0.53800315", "0.52867806", "0.5285191", "0.52186906", "0.51881415", "0.5177398", "0.51758695", "0.5167...
0.5467813
10
Callback when front server is connected.
def OnFrontConnected(self) -> None: self.gateway.write_log("行情服务器连接成功") self.login()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def on_connect(self):\n print('Client connected!')", "def on_connect():\n print(\"User connected!\")", "def connected(self):\n manager = self.manager()\n self.log().debug(\"Register [%s] callbacks\", self.name())\n\n manager.subscribeServerCallbacks(self, self.cfg().chatimg.serve...
[ "0.7463222", "0.69432336", "0.686189", "0.6838079", "0.67208254", "0.66620857", "0.66216904", "0.658405", "0.6554587", "0.6540486", "0.64954203", "0.6479373", "0.64791733", "0.6423165", "0.64106476", "0.6404848", "0.64022064", "0.6392826", "0.63813555", "0.63813555", "0.63813...
0.74887276
1
Callback when front server is disconnected.
def OnFrontDisconnected(self, reason: int) -> None: self.login_status = False self.gateway.write_log(f"行情服务器连接断开,原因{reason}")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def callback_disconnect():\n # if Networking.get_instance().is_host:\n logger.warning(\"It seems that client is not connected...\")\n Networking.get_instance().disconnect()\n EventQueue.post(CustomEvent(ChangeSceneEnum.DISCONNECT))", "def on_disconnect(self):\n ...
[ "0.79246867", "0.78729045", "0.742912", "0.7390743", "0.7358495", "0.7335591", "0.73057854", "0.7276291", "0.72380644", "0.7230405", "0.720272", "0.71938705", "0.7179511", "0.7127314", "0.71052814", "0.7078196", "0.706709", "0.7030486", "0.6985139", "0.68786025", "0.6869716",...
0.7072486
17