query
stringlengths
9
9.05k
document
stringlengths
10
222k
metadata
dict
negatives
listlengths
30
30
negative_scores
listlengths
30
30
document_score
stringlengths
4
10
document_rank
stringclasses
2 values
Set store_id for this ConnectionParams.Builder.
def store_id(self, store_id): self._store_id = store_id return self
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_store(self, store):\n self.store = store", "def setSessionStore(self, store):\n pass", "def store_url(self, store_url):\n\n self._store_url = store_url", "def featurestore_id(self, featurestore_id):\n\n self._featurestore_id = featurestore_id", "def _set_store(self, stor...
[ "0.6544826", "0.6192493", "0.60865414", "0.5993064", "0.5724497", "0.56288934", "0.54020125", "0.5375262", "0.5218585", "0.5207619", "0.51837516", "0.5072023", "0.5036242", "0.4977555", "0.49160936", "0.49113953", "0.48505828", "0.4825781", "0.48211673", "0.48009145", "0.4775...
0.7704247
0
Build ConnectionParams with the attributes of this class.
def build(self): return ConnectionParams(self)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def make_connection_params(self, host, port, db):\r\n\r\n kwargs = {\r\n \"db\": db,\r\n \"parser_class\": self.get_parser_cls(),\r\n \"password\": self.options.get('PASSWORD', None),\r\n }\r\n\r\n if host == \"unix\":\r\n kwargs.update({'path': port...
[ "0.6745582", "0.6161791", "0.6111269", "0.6027589", "0.60202765", "0.59959686", "0.599479", "0.5972416", "0.59703094", "0.5948663", "0.5848386", "0.5811184", "0.57574433", "0.57423806", "0.57356447", "0.571891", "0.57150394", "0.5714473", "0.5685257", "0.5660084", "0.564066",...
0.81474
0
Get RSA pubic key from private key.
def get_pub_key(priv_key: rsa.RSAPrivateKey) -> rsa.RSAPublicKey: return priv_key.public_key()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_pub_rsa_key(pub_key):\n return RSA.importKey(pub_key)", "def generate_rsa_public_key(private_key: RSAPrivateKeyWithSerialization) -> RSAPublicKey:\n return private_key.public_key()", "def _rsa_key(self,private_key):\n numbers = private_key.private_numbers()\n content = WriteMessage(...
[ "0.82938814", "0.81100035", "0.7503003", "0.74164814", "0.73668206", "0.7284507", "0.7243444", "0.7107461", "0.70154107", "0.6984905", "0.6832703", "0.6828781", "0.68268013", "0.67838", "0.6773461", "0.6765474", "0.67521864", "0.67009723", "0.6685639", "0.6684122", "0.6667030...
0.8426687
0
Sign msg with RSA private key.
def sign(priv_key: rsa.RSAPrivateKey, msg: bytes) -> Signature: return priv_key.sign(msg, PADDING, HASH)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rsa_sign(message, privatekey):\r\n \r\n # A key object is created to interact with the PyCrypto\r\n # encryption suite. The object contains key data and\r\n # the necessary rsa functions.\r\n temp_key_obj = _rsa_keydict_to_keyobj(privatekey = privatekey) \r\n \r\n return _rsa_chopstring(message, temp_ke...
[ "0.798795", "0.7426772", "0.72883123", "0.7218941", "0.72114533", "0.7073284", "0.6896547", "0.67001873", "0.6679949", "0.66555315", "0.65101177", "0.6444393", "0.64387923", "0.63820434", "0.6343739", "0.6319195", "0.6286958", "0.6271825", "0.6266799", "0.6261391", "0.6228991...
0.81781274
0
Verify msg signature with RSA public key.
def verify(signature: Signature, pub_key: rsa.RSAPublicKey, msg: bytes) -> bool: try: pub_key.verify(signature, msg, PADDING, HASH) except: return False return True
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def verify_rsa(sig_hex, message, public_key):\n sig_int = int(sig_hex , 16)\n m_int = pow(sig_int, public_key.e, public_key.n)\n m_hex = \"%0512x\" % m_int\n h = SHA.new(message).hexdigest()\n return re.match('0001f*' + ASN1_MAGIC + h, m_hex) is not None", "def verify(self, msg, sig, key):\n ...
[ "0.81414336", "0.73828924", "0.73817885", "0.7299497", "0.72877675", "0.7134118", "0.7074892", "0.7026358", "0.6990865", "0.6977369", "0.69641346", "0.69527584", "0.6942516", "0.6936673", "0.69320744", "0.69279444", "0.68377656", "0.68285733", "0.6825046", "0.6811681", "0.673...
0.8222373
0
use_lock adb_lock = lock to be used operation = True => Lock = False => Release nprocs = >0 when in multiprocessing mode >>> alock = multiprocessing.Lock() >>> use_lock(alock, True, 2) True >>> use_lock(alock, False, 2) True
def use_lock(adb_lock, operation, nprocs=0): use_dblock_return = False logging.debug('Entering use_lock with operation:[%s].', operation) if adb_lock is None: logging.debug('use_lock: adb_lock is [None].') return use_dblock_return logging.debug('use_lock: adb_lock.semlock:[%s].', adb...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_lock_status(use_lock):\r\n get_lock.lock_is_enabled = use_lock", "def lock(*args):", "def enable_lock(self, lock_on=True):\n if lock_on:\n self.write('ScanM_Mode=2') #Search\n time.sleep(10)\n self.write('ScanM_Mode=3') #Lock, its unclear from manual if\n ...
[ "0.74159145", "0.69176936", "0.6331075", "0.63139176", "0.62144965", "0.6151019", "0.6064903", "0.60581577", "0.6047758", "0.6033694", "0.595085", "0.5926155", "0.5878316", "0.5877478", "0.5859715", "0.5856653", "0.5817371", "0.5810528", "0.58100533", "0.58070713", "0.5798284...
0.8074711
0
mprocessing Function nprocs = Number of processes to launch (int) lockdb = lock for access to Database (lock obj to be created) running = Value to count processed items (count obj to be created) mutex = mutex for access to value running (obj to be created) itemslist = list of items to be processed a_fn = a function whi...
def mprocessing(nprocs, lockdb, running, mutex, itemslist, a_fn, cur): # proc_pool = Local variable proc_pool for Pool of processes # log_level = log_level # count_total = Total counter of items to distribute/play/indicate progress # len(itemslist) log_level = logging.getLogger()....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mp_process_file(shared_job_q, shared_result_q, server_ip, nprocs,operation,user_name,db_ip,db_name,ngram):\n procs = []\n for i in range(nprocs):\n p = Process(\n target=process_file_worker,\n args=(shared_job_q, shared_result_q, server_ip,operation, user_name, db_ip,...
[ "0.58528554", "0.57438636", "0.56736654", "0.5560661", "0.55478173", "0.5474617", "0.5432887", "0.5414169", "0.5413469", "0.540166", "0.53347164", "0.527827", "0.52477205", "0.52431244", "0.5225218", "0.5219987", "0.51997316", "0.51976323", "0.5156502", "0.5152163", "0.514616...
0.8265458
0
Initializes the subprocess with callbacks and timeout.
def __init__(self, command, timeout=-1, stdout_chunk_callback=None, stderr_chunk_callback=None, exit_process_callback=None, stdin_bytes=None, io_loop=None, kill_on_timeout=False): self.exit_process_callback = exit_process_callback self.kill_on_timeout = kill_on_timeout ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, *args, **kwargs):\n self.total_timeout = kwargs.pop('total_timeout', None)\n self.chunk_timeout = kwargs.pop('chunk_timeout', None)\n super(TimeoutProc, self).__init__(*args, **kwargs)", "def _initialize(self):\n self.send_init_command()", "def init(self):\r\n ...
[ "0.6227763", "0.6021077", "0.5982659", "0.59431446", "0.59279984", "0.59177715", "0.59161824", "0.5895552", "0.5890061", "0.5877837", "0.58621943", "0.58537936", "0.58132327", "0.5812401", "0.58066916", "0.5794201", "0.57923806", "0.5752941", "0.5717931", "0.571509", "0.56608...
0.6322379
0
Convert a Measurement into an ImmutableMeasurement.
def from_measurement( cls, measurement: measurements.Measurement) -> 'ImmutableMeasurement': measured_value = measurement.measured_value if isinstance(measured_value, measurements.DimensionedMeasuredValue): value = data.attr_copy( measured_value, value_dict=copy.deepcopy(measured_value.val...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def measurement(metric: Metric, **kwargs) -> Measurement:\n measurement = Measurement(metric, **kwargs)\n measurement.update_measurement()\n return measurement", "def test_copy(self):\n timestamp = \"2020-01-01\"\n measurement_copy = Measurement(self.metric(), start=timestamp, ...
[ "0.6376785", "0.55081004", "0.5377018", "0.5154965", "0.51250917", "0.5048187", "0.50208795", "0.4991375", "0.498001", "0.4966417", "0.492134", "0.49193904", "0.49179283", "0.48459628", "0.481078", "0.47937503", "0.4793322", "0.47779462", "0.4770837", "0.4770837", "0.47524896...
0.8011524
0
Create a TestApi for access to this TestState. The returned TestApi should be passed as the first argument to test phases. This attribute must only be accessed within a running_phase_context().
def test_api(self) -> 'test_descriptor.TestApi': if not self.running_phase_state: raise ValueError('test_api only available when phase is running.') if not self._running_test_api: self._running_test_api = openhtf.TestApi( measurements=measurements.Collection( self.running_pha...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def api_factory(config):\n return SdkApi(config.get('apiKey'),\n sdk_api_base_url=config['sdkApiBaseUrl'],\n events_api_base_url=config['eventsApiBaseUrl'],\n split_sdk_machine_name=config['splitSdkMachineName'],\n split_sdk_machine_ip=config['...
[ "0.6026852", "0.5861637", "0.5760366", "0.5718832", "0.5546001", "0.5492011", "0.5492011", "0.5432047", "0.53792197", "0.5330571", "0.5303144", "0.52942324", "0.529239", "0.5261884", "0.52366954", "0.5186171", "0.51538813", "0.5143069", "0.51318043", "0.5115971", "0.5107954",...
0.8420046
0
Get a copy of an attachment from current or previous phases.
def get_attachment(self, attachment_name: Text) -> Optional[test_record.Attachment]: # Check current running phase state for the attachment name first. if self.running_phase_state: if attachment_name in self.running_phase_state.phase_record.attachments: attachment = self.runni...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_attachment(self, attachment_name):\n attachment = self.get_attachment_meta(attachment_name)\n with attachment.open() as content:\n return content.read()", "def getOriginal(self,):\n\t\treturn self.original;", "def get_as_attachment(self):\n return self.as_attachment", ...
[ "0.57618684", "0.5639334", "0.5604076", "0.52672434", "0.52498174", "0.51497364", "0.5118958", "0.5111859", "0.5087968", "0.50256944", "0.49862835", "0.49789578", "0.49616992", "0.4948914", "0.49484855", "0.4940164", "0.48953402", "0.4888297", "0.4879606", "0.48529857", "0.48...
0.6673366
0
Create a context within which a single phase is running. Yields a PhaseState object for tracking transient state during the execution of the phase, including the output PhaseRecord. That PhaseState provides the TestApi to be passed into the test phase. Within this context, the Station API will report the given phase as...
def running_phase_context( self, phase_desc: phase_descriptor.PhaseDescriptor) -> Iterator['PhaseState']: assert not self.running_phase_state, 'Phase already running!' phase_logger = self.state_logger.getChild('phase.' + phase_desc.name) phase_state = self.running_phase_state = PhaseState.from_d...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, *phases):\n self.loop = False\n self.phases = phases\n self.output_callbacks = []\n\n # Pull some metadata from the frame in which this Test was created.\n frame_record = inspect.stack()[1]\n self.filename = os.path.basename(frame_record[1])\n self.docstring = inspect.getdoc...
[ "0.5546377", "0.54420495", "0.52828914", "0.5198869", "0.5172719", "0.50623846", "0.50623846", "0.5032182", "0.4942684", "0.49291357", "0.4912989", "0.49095812", "0.48637497", "0.47719717", "0.47425377", "0.47313967", "0.4729003", "0.47182474", "0.4691393", "0.46817875", "0.4...
0.70114124
0
Convert to a dict representation composed exclusively of base types.
def as_base_types(self) -> Dict[Text, Any]: running_phase_state = None if self.running_phase_state: running_phase_state = self.running_phase_state.as_base_types() return { 'status': data.convert_to_base_types(self._status), 'test_record': self.test_record.as_base_types(), 'plug...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _asdict(self) -> Dict[Text, Any]:\n return self.as_base_types()", "def base_type_dict():\n return {'filter' : filters.Filter,\n 'global_options' : global_options.GlobalOptions,\n 'input_device' : input_devices.InputDevice,\n 'input_stream' : input_streams.InputStream,\n...
[ "0.8049235", "0.723234", "0.69954157", "0.6925197", "0.6925197", "0.68735784", "0.6807746", "0.6621673", "0.6597442", "0.6495919", "0.641326", "0.6394108", "0.6358325", "0.63454837", "0.63454837", "0.6306957", "0.6293567", "0.627729", "0.6276063", "0.6273456", "0.6242688", ...
0.757112
1
Stops the currently running phase, allowing another phase to run.
def stop_running_phase(self) -> None: self.running_phase_state = None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def stop(self):\n self._context.state = STOPPED", "def stop(self):\n self._run = False\n self.IA.stop()", "def stop_procedure(self):\n pass", "def stop(self):\n if self.debug:\n print(\"%s stop\" % self.name)\n self.force_exit()", "def stop_execution(se...
[ "0.71527326", "0.71316", "0.6998534", "0.6969481", "0.69545484", "0.6933644", "0.6931657", "0.6931641", "0.68879503", "0.6874086", "0.6874086", "0.6874086", "0.6874086", "0.6874086", "0.6852114", "0.6852114", "0.6850776", "0.6850776", "0.6849411", "0.68468523", "0.6836662", ...
0.79179174
0
Get the name of the currently running phase, or None. Note that this name is not guaranteed to still be accurate by the time this method returns, so this should only be used for log messages/user display and not for programmatic purposes.
def last_run_phase_name(self) -> Optional[Text]: if self.running_phase_state: return self.running_phase_state.name return None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def phase(self) -> Optional[str]:\n return pulumi.get(self, \"phase\")", "def getName(self):\n return self.stepDictionary[self.getLocation()]", "def phase(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(self, \"phase\")", "def phase(self) -> Optional[pulumi.Input[str]]:\n ...
[ "0.71856076", "0.69921845", "0.66996187", "0.66996187", "0.66996187", "0.6474902", "0.63779265", "0.63779265", "0.6363522", "0.62794316", "0.62593573", "0.62593573", "0.62593573", "0.62593573", "0.62593573", "0.62593573", "0.62593573", "0.62593573", "0.62593573", "0.62593573", ...
0.8030202
0
Mark the test as actually running, can't be done once finalized.
def set_status_running(self) -> None: if self._is_aborted(): return assert self._status == self.Status.WAITING_FOR_TEST_START self._status = self.Status.RUNNING self.notify_update()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mark_test_started(self) -> None:\n # Blow up instead of blowing away a previously set start_time_millis.\n assert self.test_record.start_time_millis == 0\n self.test_record.start_time_millis = util.time_millis()\n self.notify_update()", "def mark_running(self):\r\n self.status = RUNNING", ...
[ "0.7192233", "0.70850664", "0.68423414", "0.6834678", "0.6805021", "0.66742206", "0.65531033", "0.65130544", "0.6481792", "0.64412594", "0.6388481", "0.63506866", "0.63506866", "0.63506866", "0.63441235", "0.6325607", "0.62740904", "0.6169857", "0.6163241", "0.6152993", "0.61...
0.7215398
0
Finalize due to the given phase outcome.
def finalize_from_phase_outcome( self, phase_execution_outcome: phase_executor.PhaseExecutionOutcome, phase_name: str, ) -> None: if self._is_aborted(): return # Handle a few cases where the test is ending prematurely. if phase_execution_outcome.raised_exception: result = ph...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def end_phase():\n pass", "def finalize_normally(self) -> None:\n if self._is_aborted():\n return\n\n phases = self.test_record.phases\n if not phases:\n # Vacuously PASS a TestRecord with no phases.\n self._finalize(test_record.Outcome.PASS)\n elif any(\n phase.outcome == te...
[ "0.70426756", "0.6492182", "0.6364347", "0.6356518", "0.62024015", "0.6124143", "0.6105777", "0.6105777", "0.6092769", "0.6092769", "0.6092769", "0.60269135", "0.5990775", "0.5990775", "0.5912633", "0.58894676", "0.58680886", "0.58637744", "0.5844667", "0.58355415", "0.583554...
0.73849475
0
Returns whether the given value is a failed multidim measurement.
def _is_failed_multidim_measurement(self, meas: measurements.Measurement ) -> bool: return bool(meas.outcome != measurements.Outcome.PASS and meas.dimensions)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_dimension_error(self):\n return self._tag == 'dimension_error'", "def is_dimensionless(value):\n ureg = get_unit_registry()\n\n # Ensure the provided value is in the right format\n value = ureg.Quantity(value)\n\n if value.units == ureg.dimensionless:\n return True\n\n if valu...
[ "0.66260946", "0.6334465", "0.6226154", "0.6016202", "0.5945726", "0.5780808", "0.5770328", "0.5740424", "0.57200956", "0.566947", "0.56402314", "0.5600689", "0.5597503", "0.5557413", "0.5551603", "0.55309", "0.55200446", "0.54951936", "0.5487549", "0.5475095", "0.54699117", ...
0.8419664
0
Gets all the failed phase multidim measurements in the test record.
def _get_failed_multidim_measurements( self, ) -> List[Tuple[str, openhtf.core.measurements.Measurement]]: failed_phases = ( phase for phase in self.test_record.phases if phase.outcome == test_record.PhaseOutcome.FAIL ) phases_meas_items = (phase.measurements.items() for phas...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _add_multidim_outcome_details(self):\n failed_multidim_meas = self._get_failed_multidim_measurements()\n\n for name, measurement in failed_multidim_meas:\n message = [f' failed_item: {name} ({measurement.outcome})']\n message.append(f' measured_value: {measurement.measured_value}')\n mess...
[ "0.6763146", "0.64912117", "0.64848167", "0.6397373", "0.6040359", "0.59870434", "0.5880294", "0.58619", "0.5849545", "0.5729405", "0.571495", "0.57080466", "0.56415033", "0.55924684", "0.5567824", "0.5526191", "0.5495368", "0.54716057", "0.5457755", "0.545517", "0.5441068", ...
0.8574967
0
Adds additional outcome details for failed multidim measurements.
def _add_multidim_outcome_details(self): failed_multidim_meas = self._get_failed_multidim_measurements() for name, measurement in failed_multidim_meas: message = [f' failed_item: {name} ({measurement.outcome})'] message.append(f' measured_value: {measurement.measured_value}') message.append(...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_failed_multidim_measurements(\n self,\n ) -> List[Tuple[str, openhtf.core.measurements.Measurement]]:\n failed_phases = (\n phase\n for phase in self.test_record.phases\n if phase.outcome == test_record.PhaseOutcome.FAIL\n )\n phases_meas_items = (phase.measurements.ite...
[ "0.6722506", "0.6476317", "0.6427798", "0.63586694", "0.6281179", "0.62567145", "0.6115043", "0.5939959", "0.59152484", "0.58664274", "0.5837", "0.58163273", "0.58134365", "0.57862335", "0.5729041", "0.5709229", "0.56970525", "0.56737024", "0.5659165", "0.5598383", "0.5561858...
0.8511092
0
Create a PhaseState from a phase descriptor.
def from_descriptor(cls, phase_desc: phase_descriptor.PhaseDescriptor, test_state: TestState, logger: logging.Logger) -> 'PhaseState': # Measurements are copied because their state is modified during the phase # execution. measurements_copy = [ copy.deepco...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def as_phase(cls, phase_name):\r\n return Phase(cls._namespace(phase_name))", "def fromState(state):", "def __init__(self, thermodynamic_state=None, phase=PropertyPhase.Undefined,\n substance=None, value=None, uncertainty=None, source=None):\n self.id = str(uuid.uuid4())\n\n se...
[ "0.5901623", "0.573441", "0.52983284", "0.52097625", "0.5188337", "0.5154739", "0.513558", "0.50887674", "0.5087237", "0.501412", "0.5000742", "0.49741125", "0.49693373", "0.4949071", "0.4839506", "0.47664595", "0.4753101", "0.47332838", "0.4727449", "0.47049156", "0.4703295"...
0.7462065
0
Store the given binary_data as an attachment with the given name.
def attach(self, name: Text, binary_data: Union[Text, bytes], mimetype: MimetypeT = INFER_MIMETYPE) -> None: if name in self.phase_record.attachments: raise DuplicateAttachmentError('Duplicate attachment for %s' % name) if mimetype is INFER_MIMETYPE: mimetype ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_file_with_data(self, name, data):\n if not isinstance(data, bytes):\n raise ValueError('the data argument must be an instance of the bytes type')\n\n if name in self._files:\n raise ValueError('a file named \\\"{}\\\" has already been added'.format(name))\n\n size...
[ "0.670549", "0.61618793", "0.60133225", "0.6012995", "0.5966191", "0.5948534", "0.5944536", "0.59377676", "0.5862432", "0.57360655", "0.5682304", "0.56769955", "0.564369", "0.55465496", "0.554103", "0.55262554", "0.55235434", "0.55233115", "0.5498213", "0.5488345", "0.5483979...
0.8058148
0
Store the contents of the given filename as an attachment.
def attach_from_file(self, filename: Text, name: Optional[Text] = None, mimetype: MimetypeT = INFER_MIMETYPE) -> None: if mimetype is INFER_MIMETYPE: mimetype = mimetypes.guess_type(filename)[0] or mimetype with open(filename, 'rb') as f...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def attach(self, filename, file_contents, **extra):\n\t\tself._client.add_attachment(self, filename, file_contents, **extra)", "def attach(self, file, name=None):\n \n part = MIMEBase('application', \"octet-stream\")\n\n if isinstance(file, (str, unicode)):\n fp = open(file, \"rb\...
[ "0.7349168", "0.65992314", "0.65093124", "0.63166267", "0.63093156", "0.6307511", "0.6286933", "0.62617105", "0.6228952", "0.6167807", "0.61675483", "0.6121375", "0.6083769", "0.60421675", "0.599837", "0.5995004", "0.5977652", "0.5970326", "0.59377265", "0.59281266", "0.59139...
0.67713904
1
Perform endofphase finalization steps for measurements. Any UNSET measurements will cause the Phase to FAIL unless conf.allow_unset_measurements is set True.
def _finalize_measurements(self) -> None: for measurement in self.measurements.values(): # Clear notification callbacks for later serialization. measurement.set_notification_callback(None) # Validate multi-dimensional measurements now that we have all values. if measurement.outcome is measur...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def finalize(self):\n\n try:\n if self.current_measurement[0] == INFO_TYPE_SENSOR:\n if not len(self.current_measurement) == 5:\n raise FatalTestFailException(\n \"Incorrect sensor data format: {}\".format(\n self...
[ "0.68266314", "0.6237211", "0.62133825", "0.6188766", "0.6177662", "0.594026", "0.58439374", "0.58013874", "0.5788249", "0.57822007", "0.5782142", "0.5769425", "0.5763432", "0.57499456", "0.57465255", "0.56589127", "0.564329", "0.5637507", "0.5623582", "0.56230336", "0.560561...
0.7749675
0
Set the phase outcome before running diagnosers.
def _set_prediagnosis_phase_outcome(self) -> None: result = self.result if result is None or result.is_terminal or self.hit_repeat_limit: self.logger.debug('Phase outcome of %s is ERROR.', self.name) outcome = test_record.PhaseOutcome.ERROR elif result.is_repeat or result.is_skip: self.log...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _set_postdiagnosis_phase_outcome(self) -> None:\n if self.phase_record.outcome == test_record.PhaseOutcome.ERROR:\n return\n # Check for errors during diagnoser execution.\n if self.result is None or self.result.is_terminal: # pytype: disable=attribute-error # always-use-return-annotations\n ...
[ "0.7460226", "0.6295827", "0.6160584", "0.6117645", "0.60658294", "0.59653926", "0.58854604", "0.58286864", "0.5736422", "0.5707876", "0.5703262", "0.5691029", "0.5612916", "0.5587391", "0.5517587", "0.5507033", "0.5494078", "0.5431996", "0.5336656", "0.52754474", "0.5212484"...
0.82222116
0
Set the phase outcome after diagnosers run.
def _set_postdiagnosis_phase_outcome(self) -> None: if self.phase_record.outcome == test_record.PhaseOutcome.ERROR: return # Check for errors during diagnoser execution. if self.result is None or self.result.is_terminal: # pytype: disable=attribute-error # always-use-return-annotations self.lo...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _set_prediagnosis_phase_outcome(self) -> None:\n result = self.result\n if result is None or result.is_terminal or self.hit_repeat_limit:\n self.logger.debug('Phase outcome of %s is ERROR.', self.name)\n outcome = test_record.PhaseOutcome.ERROR\n elif result.is_repeat or result.is_skip:\n ...
[ "0.8071551", "0.6335474", "0.6224346", "0.6189157", "0.6104597", "0.60809827", "0.60761803", "0.59966975", "0.598846", "0.5879128", "0.587277", "0.5818907", "0.57921416", "0.5775318", "0.5759695", "0.5589831", "0.55803585", "0.5576181", "0.5542914", "0.55238664", "0.54350126"...
0.78608143
1
Execute a single phase diagnoser.
def _execute_phase_diagnoser( self, diagnoser: diagnoses_lib.BasePhaseDiagnoser) -> None: try: self.test_state.diagnoses_manager.execute_phase_diagnoser( diagnoser, self, self.test_state.test_record) except Exception: # pylint: disable=broad-except if self.phase_record.result.is_ter...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _execute_phase_diagnosers(self) -> None:\n result = self.result\n if result is None:\n self.logger.error('Internal error occurred; skipping diagnosers.')\n return\n if result.is_aborted:\n self.logger.warning('Skipping diagnosers when phase was aborted.')\n return\n if result.is...
[ "0.7528064", "0.5904373", "0.56924766", "0.56003857", "0.5577136", "0.55498296", "0.5543227", "0.54182625", "0.54006", "0.5377654", "0.53473175", "0.5335607", "0.53330886", "0.53130376", "0.5299024", "0.52929837", "0.52845454", "0.52507937", "0.5249303", "0.52362543", "0.5229...
0.7732303
0
Execute all the diagnosers for this phase.
def _execute_phase_diagnosers(self) -> None: result = self.result if result is None: self.logger.error('Internal error occurred; skipping diagnosers.') return if result.is_aborted: self.logger.warning('Skipping diagnosers when phase was aborted.') return if result.is_repeat or re...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _execute_phase_diagnoser(\n self, diagnoser: diagnoses_lib.BasePhaseDiagnoser) -> None:\n try:\n self.test_state.diagnoses_manager.execute_phase_diagnoser(\n diagnoser, self, self.test_state.test_record)\n except Exception: # pylint: disable=broad-except\n if self.phase_record.re...
[ "0.62423986", "0.59378695", "0.58098745", "0.5799028", "0.57503647", "0.57035184", "0.56895036", "0.5570516", "0.55603206", "0.5547739", "0.55377626", "0.5531544", "0.55043304", "0.5479485", "0.54547757", "0.5452687", "0.54503983", "0.5447924", "0.54457384", "0.5438638", "0.5...
0.8527003
0
Produce exception class. theName Name of the class theList List of (error code, error code symbolic name, error message) tuples
def produceExceptionClass(theName, theList): TheException = type(theName, (Exception, object,), dict(_errorMessages={}, __init__=_myEx_init, __str__=_myEx_str, errCode=_myEx_errCode...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_exception(self, msg: str):", "def style_class_and_exc_name(self):\n name = click.style(self.__class__.__name__, fg='red', bold=True)\n if self.err_name and self.err_name != self.__class__.__name__:\n name += click.style('({})'.format(self.err_name), fg='yellow')\n retur...
[ "0.62011254", "0.6175793", "0.5648254", "0.56179905", "0.55889374", "0.55434155", "0.54998326", "0.5497248", "0.5496245", "0.54730004", "0.54630154", "0.54527235", "0.5443619", "0.54391485", "0.54203814", "0.54166967", "0.53751427", "0.5372925", "0.5358933", "0.5346867", "0.5...
0.8250918
0
At least n activities of activity type set sA (with m activity types) must be performed
def activity_choice(trace:Trace, activities:list, at_least_performed:int, parameters=None): if parameters is None: parameters = {} activity_key = parameters[PARAMETER_CONSTANT_ACTIVITY_KEY] if PARAMETER_CONSTANT_ACTIVITY_KEY in parameters else DEFAULT_NAME_KEY at_least_performed = at_least_perform...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def activity_inclusion_multiple(trace:Trace, activites:list, parameters=None):\n\n if parameters is None:\n parameters = {}\n\n activity_key = parameters[PARAMETER_CONSTANT_ACTIVITY_KEY] if PARAMETER_CONSTANT_ACTIVITY_KEY in parameters else DEFAULT_NAME_KEY\n\n not_fulfilled_activities = []\n fo...
[ "0.59071773", "0.56525445", "0.5606904", "0.55212224", "0.5158935", "0.5149856", "0.5126057", "0.5098756", "0.5075921", "0.49682078", "0.4966863", "0.48913848", "0.48564807", "0.4850245", "0.4791828", "0.47753608", "0.47560462", "0.4738997", "0.4735523", "0.4726355", "0.47228...
0.6147962
0
Creates a Method that corresponds to the generated function call. It will be part of a class that implements the right interface, and will have the appropriate name and signature.
def create_method(self): assert self.stored_args != None if self.generated_method != None: return (self.generated_cf, self.generated_method) class_name = self._cf.this.name.value + "_lambda_" + str(self._ins.pos) self.generated_cf = ClassFile.create(class_name) # Jaw...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_method(self):\n n_indents = 1 if self.target_language in ['java', 'js',\n 'php', 'ruby'] else 0\n return self.temp('separated.method', n_indents=n_indents,\n skipping=True).format(**self.__dict__)", "def convert_met...
[ "0.6970116", "0.6602043", "0.659688", "0.659456", "0.65326494", "0.6304949", "0.63005865", "0.62870735", "0.6263385", "0.61848754", "0.6184322", "0.61611307", "0.61408794", "0.61363584", "0.6077518", "0.6076941", "0.60494155", "0.59824884", "0.59747493", "0.59747493", "0.5932...
0.730944
0
Gets the class type for an invokedynamic instruction that calls a constructor.
def class_from_invokedynamic(ins, cf): info = InvokeDynamicInfo.create(ins, cf) assert info.created_type != "void" return info.created_type
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_trivial_constructor(type_):\n assert isinstance(type_, class_declaration.class_t)\n return type_.find_trivial_constructor()", "def _constructor(self):\n return self.__class__", "def infer_constructor_application(classtype, argtypes):\n # Figure out the list of argtypes\n cls = class...
[ "0.6270029", "0.6199995", "0.5577283", "0.5521435", "0.5442646", "0.54378617", "0.5341689", "0.53408056", "0.5334224", "0.5321794", "0.5304999", "0.52879286", "0.5256004", "0.51834446", "0.51670945", "0.51322865", "0.5129453", "0.511618", "0.50918376", "0.50879806", "0.507364...
0.69957364
0
Gets the recipe string, if this is a string concatenation implemented via invokedynamic.
def string_from_invokedymanic(ins, cf): info = InvokeDynamicInfo.create(ins, cf) if not isinstance(info, StringConcatInvokeDynamicInfo): return return info.recipe
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def recipe(self):\n return self.__recipe", "def recipe_as(self, recipe):\n prefix, suffix = self._get_jsonp()\n return prefix + JSON.recipe_as(self, recipe) + suffix", "def name(self):\n return self.recipe_name", "def get_string(self, **kwargs):\n ...", "def __str__(self)...
[ "0.5672332", "0.56036395", "0.5547018", "0.5375775", "0.5296948", "0.52167076", "0.52145666", "0.5181181", "0.5164461", "0.51332796", "0.513258", "0.5102436", "0.50908947", "0.5087734", "0.5086124", "0.5054412", "0.50518596", "0.5043541", "0.50417495", "0.5036389", "0.5035654...
0.6483566
0
Called when a method is invoked.
def on_invoke(self, ins, const, obj, args): pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def method(self):", "def call(self):", "def method():\n pass", "def __call__(self, *args, **kwargs):\n return self.method(*args, **kwargs)", "def another_method(self):\n pass", "def __call__( self ):\n pass", "def someMethod (self):\n pass", "def meth(self):\r\n ...
[ "0.72481096", "0.6856518", "0.67664295", "0.67524135", "0.67518026", "0.6723362", "0.672032", "0.671402", "0.6689967", "0.66367376", "0.66367376", "0.6636482", "0.6595273", "0.6581869", "0.6574461", "0.6548603", "0.6520617", "0.6513437", "0.6491007", "0.64847064", "0.6437786"...
0.7019894
1
Called for a getfield or getstatic instruction.
def on_get_field(self, ins, const, obj): pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _MocaCtlGetField(self, outfcn, field):\n\n m_re = re.compile(field + r'\\s*:\\s+(\\S+)')\n for line in outfcn():\n mr = m_re.search(line)\n if mr is not None:\n return mr.group(1)\n return None", "def __call__(self, field_name):\n return getattr(self, field_name)", "def getfiel...
[ "0.5962523", "0.5797852", "0.5791937", "0.5786487", "0.5760696", "0.5665899", "0.5653516", "0.56291336", "0.55270946", "0.5497443", "0.5492224", "0.548495", "0.54837006", "0.5450192", "0.54373544", "0.54224664", "0.5406061", "0.5402405", "0.54001826", "0.5374319", "0.5374319"...
0.76843786
0
Called for a putfield or putstatic instruction.
def on_put_field(self, ins, const, obj, value): pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def put(self, *_, **__): # pylint: disable=arguments-differ\n pass", "def put(self, *_, **__): # pylint: disable=arguments-differ\n pass", "def put(self):\n pass", "def put(self):\n pass", "def put(self, name, val):\n pass", "def put(data):", "def put(self, key, val...
[ "0.61882997", "0.61882997", "0.60075027", "0.60075027", "0.5948273", "0.5925751", "0.5791312", "0.5639221", "0.5620443", "0.5583568", "0.5532177", "0.5517266", "0.5494565", "0.544801", "0.54314023", "0.53838474", "0.53535324", "0.5326953", "0.52377033", "0.5231153", "0.519009...
0.69665706
0
Called for an invokedynamic instruction.
def on_invokedynamic(self, ins, const, args): raise Exception("Unexpected invokedynamic: %s" % str(ins))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def on_invoke(self, ins, const, obj, args):\n pass", "def __execute(self, instruction: Instruction) -> NoReturn:\n\n op, *args = instruction\n logging.debug(f\"Executing: {op}\")\n logging.debug(self.memory)\n function_map[op](*args, memory=self.memory)\n logging.debug(s...
[ "0.65767473", "0.5756922", "0.54574543", "0.5399601", "0.53694516", "0.53299844", "0.5153121", "0.51479316", "0.51023656", "0.5067054", "0.5046033", "0.5019514", "0.5011392", "0.50036955", "0.49859267", "0.49639124", "0.49582633", "0.4941354", "0.49224293", "0.49104628", "0.4...
0.795619
0
Walks through a method, evaluating instructions and using the callback for sideeffects. The method is assumed to not have any conditionals, and to only return at the very end.
def walk_method(cf, method, callback, verbose, input_args=None): assert isinstance(callback, WalkerCallback) stack = [] locals = {} cur_index = 0 if not method.access_flags.acc_static: # TODO: allow specifying this locals[cur_index] = object() cur_index += 1 if input_a...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def trace(\n method: Callable[['Evaluator', lark.Tree], Any]) -> Callable[['Evaluator', lark.Tree], Any]:\n @wraps(method)\n def concrete_method(self: 'Evaluator', tree: lark.Tree) -> Any:\n self.logger.info(f\"{self.level*'| '}{tree!r}\")\n result = method(self, tree)\n self.logg...
[ "0.5684935", "0.52763826", "0.5275444", "0.5064057", "0.50518525", "0.50365335", "0.50073606", "0.5001793", "0.5001793", "0.49614048", "0.49480075", "0.49267405", "0.4889493", "0.488395", "0.48287648", "0.4793226", "0.47903362", "0.47877258", "0.47764698", "0.47462782", "0.47...
0.57391286
0
Use this function to return the Ranker object to evaluate, The parameter to this function, cfg_file, is the path to a configuration file used to load the index.
def load_ranker(cfg_file, i): return metapy.index.OkapiBM25(k1=i, b=0.75, k3=3.35)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def build_evaluator(cfg: CfgNode) -> EvaluatorBase:\n name = cfg[\"name\"]\n evaluator = simple_build(name, cfg, EVALUATORS)\n return evaluator", "def __init__(self, configfile='settings.cfg'):\n \n self.configfile = configfile\n \n # Load parameters from config file\...
[ "0.570379", "0.5144712", "0.5104123", "0.5031111", "0.50029945", "0.49808338", "0.4967106", "0.49586195", "0.49571723", "0.49567527", "0.4941315", "0.4928048", "0.49261978", "0.49136803", "0.49050146", "0.48569816", "0.47679493", "0.47655988", "0.4754713", "0.47474837", "0.47...
0.6641442
0
Detect num_heads and hidden_size from a reshape node.
def get_num_heads_and_hidden_size(self, reshape_q: NodeProto) -> Tuple[int, int]: # we assume that reshape fusion has done, so the shape is a tensor like [0, 0, num_heads, head_size] q_shape = self.model.get_initializer(reshape_q.input[1]) if q_shape is None: logger.debug(f"{reshape...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dim_per_head(self):\n p = self.params\n return p.dim_per_head or p.hidden_dim // p.num_heads", "def _get_state_sizes(self):\n ds = self.builder.nodes[self.ds_inputs[0]]\n return [[ds.xdim]]", "def test_shape_of_classification_heads(batch_size: int, hidden_size: int, num_class: int):\n classi...
[ "0.62940603", "0.6027145", "0.5809231", "0.57093346", "0.56951624", "0.5590905", "0.5484823", "0.5436951", "0.5427202", "0.5419318", "0.5406444", "0.53963315", "0.5359452", "0.53477645", "0.53343844", "0.53333", "0.53208256", "0.5318247", "0.53155136", "0.531125", "0.53103936...
0.6661697
0
Retrieves the configured metadata navigation settings for the list with the specified url.
def get_configured_settings(context, url, return_type=None): if return_type is None: return_type = ClientResult(context, ConfiguredMetadataNavigationItemCollection()) payload = { "DecodedUrl": url } qry = ServiceOperationQuery(MetadataNavigationSettings(context),...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def GetRemoteConfigSetInfo(url):\n # Get the build item\n build_channel, locator = _GetAuthorizedBuildChannel()\n if build_channel.auth_state == ndb_models.AuthorizationState.UNAUTHORIZED:\n return None\n\n try:\n channel_path = locator.path\n path = channel_path + url.split(channel_path)[1]\n buil...
[ "0.53299725", "0.51049495", "0.50318044", "0.50195855", "0.4950807", "0.4947076", "0.49371886", "0.49119297", "0.490131", "0.48708272", "0.4856781", "0.48494557", "0.48400757", "0.4833989", "0.4802512", "0.47628623", "0.47514585", "0.47358742", "0.4726922", "0.47269213", "0.4...
0.66517675
0
Calibrates intern for every particleList in coalescenceList Search for overlap of particleList and when True, deplete a complete particleList
def calibrateDistance(self, initval, clusterList, coalescenceList): intServ = InteractionService() coalescenceList.sortList() #calibrate for each particleList in coalescenceList intServ.calibrateIntern(initval, clusterList, coalescenceList) #calibrate for all clu...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def coalescence(self, initval, clusterList, coalescenceList, smeasure):\n intServ = InteractionService()\n intServ.coalescence(initval, clusterList, coalescenceList, smeasure)", "def execute(self):\n while len(self.circle_list) != 0:\n # Haal de eerste cirkel van de lijst.\n ...
[ "0.62605816", "0.5935807", "0.5819974", "0.5738849", "0.56303966", "0.55941427", "0.55718774", "0.5396429", "0.5356154", "0.5279346", "0.52126783", "0.521245", "0.5176385", "0.5175134", "0.5159984", "0.5158453", "0.51507443", "0.51408154", "0.5125429", "0.5097505", "0.5075527...
0.6015029
1
Onehot encode integer labels y. The number of classes is assumed to be the largest value in y
def onehot_encode_labels(y): return OneHotEncoder(categories="auto", sparse=False).fit_transform(y.reshape(y.shape[0],1))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _onehot(y, n_classes=False):\n if not n_classes:\n \"\"\"Create one-hot encoded labels.\"\"\"\n n_classes = len(set(y))\n out = np.zeros((len(y), n_classes))\n for i, ii in enumerate(y):\n out[i][ii] += 1\n y_onehot = out.astype(int)\n return y_onehot", "def onehot_encode_...
[ "0.8922882", "0.8852088", "0.8606835", "0.8596903", "0.8584284", "0.84639335", "0.84183574", "0.837195", "0.8359242", "0.8348002", "0.83127004", "0.8293814", "0.8278722", "0.8263784", "0.82605064", "0.8256802", "0.8183106", "0.8183106", "0.8076087", "0.8067563", "0.8013488", ...
0.8860286
1
Compute the accuracy of predictions using onehot encoded labels
def accuracy_onehot(labels, preds): assert labels.shape[0]==preds.shape[0] return np.sum(np.argmax(preds, axis=1) == np.argmax(labels, axis=1))/float(labels.shape[0])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def accuracy_onehot(y_pred, y_label):\n return (y_pred.argmax(dim=1) == y_label).float().mean().item()", "def accuracy(preds, labels):\n correct = preds == labels\n return correct.sum().float() / correct.shape[0]", "def accuracy(probabilities: np.ndarray, labels: np.ndarray) -> float:\n # [...
[ "0.8403834", "0.78746563", "0.7833525", "0.7828252", "0.78266877", "0.78144145", "0.7745161", "0.76643187", "0.7623697", "0.7589688", "0.7578266", "0.75630087", "0.7504252", "0.74835384", "0.7456411", "0.74351454", "0.7418144", "0.7388466", "0.73777604", "0.73777604", "0.7372...
0.856095
0
Get the indices of a flattened image that lie within border_size of the edge of an image (use to pass to nullify argument in RATE function)
def get_nullify_idxs(original_size, border_size): assert border_size < original_size/2, "Border too large to be removed from image of this size" tmp = np.zeros((original_size, original_size), dtype=int) tmp[:border_size,:] = 1 tmp[-border_size:,:] = 1 tmp[:,-border_size:] = 1 tmp[:,:border_size] = 1 tmp = tmp.re...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def filterBankEdges(img):\n imgE = Views.extendBorder(img)\n opTop = as2DKernel(imgE, [-1]*3 + [0]*3 + [1]*3)\n opBottom = as2DKernel(imgE, [1]*3 + [0]*3 + [-1]*3)\n opLeft = as2DKernel(imgE, [-1, 0, 1] * 3)\n opRight = as2DKernel(imgE, [1, 0, -1] * 3)\n return [opTop, opBottom, opLeft, opRight]", "def fil...
[ "0.6444478", "0.61367375", "0.6058093", "0.60388213", "0.60090536", "0.59959275", "0.5980306", "0.5953438", "0.59423566", "0.5938645", "0.5914595", "0.58839625", "0.58818096", "0.58818096", "0.58818096", "0.58681613", "0.58544993", "0.5852138", "0.5842176", "0.5820167", "0.58...
0.7368915
0
Plot a histogram showing test accuracies. Just calls sampled_accuracies then plots the result.
def accuracy_hist(pred_proba_samples, labels): sampled_acc = sampled_accuracies(pred_proba_samples, labels) avg_accuracy = round(np.mean(sampled_acc) * 100, 3) print("average accuracy across " + str(pred_proba_samples.shape[0]) + " samples: " + str(avg_accuracy) + "%\n") fig, ax = plt.subplots(figsize=(10,5)) sns....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def PlotHist(self, label=None):\n ys, xs, patches = plt.hist(self.test_stats)\n plt.vlines(self.actual, 0, max(ys), linewidth=3, color='black')\n plt.xlabel('test statistic')\n plt.ylabel('count')\n plt.show()", "def make_accuracy_plot(num_trials=10):\n data = load_digits()\...
[ "0.6625193", "0.62798524", "0.6205323", "0.6075056", "0.6042614", "0.5866382", "0.5842051", "0.5830119", "0.58219534", "0.5791563", "0.5709052", "0.5706091", "0.56653875", "0.56548166", "0.56294185", "0.56039363", "0.5601551", "0.5594764", "0.55708694", "0.55563575", "0.55376...
0.7036827
0
Play a pretty_midi.MidiData object using pygame
def play_midi(midi_data): import pygame buff = io.BytesIO() midi_data.write(buff) buff.seek(0) pygame.mixer.init() pygame.mixer.music.load(buff) try: pygame.mixer.music.play() print(f'Playing... (Ctrl+C to stop)') while pygame.mixer.music.get_busy(): pyga...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def play_protobuf(self, notes):\n with open_output(self.midi_port) as outport:\n\n outport.send(Message('program_change', program=12))\n \n try:\n last_end_time = 0\n for n in notes:\n # Calculate sleep time for rests\n ...
[ "0.61988056", "0.6108362", "0.6070113", "0.5987053", "0.5824314", "0.56887764", "0.5626626", "0.5561946", "0.5504261", "0.550363", "0.55014604", "0.5491441", "0.54171914", "0.5401412", "0.53737944", "0.5286596", "0.528166", "0.52788943", "0.52770674", "0.52750474", "0.5212455...
0.7826396
0
Returns the current covariance matrix ``C`` of the proposal distribution. If the optional argument ``decomposed`` is set to ``True``, a tuple ``(R, S)`` will be returned such that ``R`` contains the eigenvectors of ``C`` while ``S`` is a diagonal matrix containing the squares of the eigenvalues of ``C``, such that ``C ...
def cov(self, decomposed=False): if decomposed: return self._R, self._S else: return np.copy(self._C)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def covariance_matrix(self):\n\n cov_filename = self.covariance_filename\n cov_press, cov_data = self._co_star_read(cov_filename)\n\n # \"Fix\" covariances that are not positive definite\n if not np.all(np.linalg.eigvals(cov_data) > 0):\n warnings.warn(\"Covariance matrix for...
[ "0.5596664", "0.54185134", "0.53921956", "0.5304809", "0.52677846", "0.5117257", "0.5035753", "0.50002146", "0.49979585", "0.49977702", "0.49910071", "0.4966881", "0.49304053", "0.4918271", "0.49094585", "0.49084648", "0.48652434", "0.48641112", "0.4828307", "0.48270136", "0....
0.6733042
0
Filters out all words that are not the same length as best_guess
def word_length_check(self): for word in self.all_words: if len(word) == len(self.best_guess): self.valid_words.add(word)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove_unsuitable_words(words):\n\n max_length = Board.SIZE\n return [word for word in words if word and \"-\" not in word and len(word) <= max_length]", "def filter_words_list(words,pattern,wrong_guess_lst):\r\n list_hints = same_length(words,pattern)\r\n list_hints = if_in_wrong_guess(w...
[ "0.6736049", "0.65261215", "0.64126825", "0.63802975", "0.63377374", "0.6326828", "0.6306336", "0.62399465", "0.6118622", "0.60933137", "0.6075063", "0.6071505", "0.6024145", "0.5962895", "0.59299856", "0.5880844", "0.58694714", "0.58676904", "0.5842464", "0.5833685", "0.5828...
0.67875123
0
Creates a dictionary of sequences with their header. Returns A dictionary of sequences.
def sequenceDict(self): with open(self.ff) as fastaFile: sequences = {} for name, seq in self.readFasta(fastaFile): sequences[name] = seq return sequences
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def extract_seq_header(input_file):\n header = {}\n while True:\n line = input_file.next()\n if not line.startswith(\";\"):\n break\n\n line = line.split(\";\")[-1]\n if line.index(\"=\") != -1:\n line = line.split(\"=\")\n\n if line[0] in VALID_HE...
[ "0.65488094", "0.6209878", "0.61872655", "0.60423625", "0.59885275", "0.592517", "0.59189767", "0.59156275", "0.59045804", "0.5899513", "0.58833224", "0.58761483", "0.5858198", "0.5856926", "0.58507216", "0.5839603", "0.58155817", "0.5812727", "0.5746326", "0.5744577", "0.570...
0.7266413
0
Extract the sequence corresponding to the given name.
def seqFromName(self, name): seqDict = self.sequenceDict() return seqDict[name]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_seq_by_name(self, name: str) -> Optional['Sequencer']:\n for seq in self.Sequencers:\n if seq.Name.lower() == name.lower():\n return seq\n return None", "def indexByName(seq, name):\n return indexMatching(seq, lambda x: x.name == name)", "def resolve(self,name...
[ "0.7749877", "0.6277533", "0.62159234", "0.6161398", "0.6062168", "0.60153437", "0.5866804", "0.58276886", "0.57846266", "0.5775215", "0.57691795", "0.5732978", "0.5730795", "0.56477594", "0.56127363", "0.561128", "0.56019044", "0.55933356", "0.55738556", "0.5538171", "0.5517...
0.85897297
0
Masks the sequence based on the given interval.
def maskSeq(self, name, interval, toLower=False, maskingChar='N'): seqDict = self.sequenceDict() sequence = seqDict[name] masker = SequenceManipulation(sequence) return masker.maskSequence(interval, toLower=False, maskingChar='N')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def maskAll(self, intervals, toLower=False, maskingChar='N'):\n\t\tseqDict = self.sequenceDict()\n\t\tfor i in range(len(seqDict.keys())):\n\t\t\tx = seqDict.keys()[i]\n\t\t\tinterval = intervals[i]\n\t\t\tprint self.maskSeq(x, interval, toLower=False, maskingChar='N')\n\t\treturn ''", "def remap_interval(val, i...
[ "0.66220945", "0.6304778", "0.6229919", "0.56331253", "0.554183", "0.55317307", "0.5524121", "0.5495529", "0.54830307", "0.5463715", "0.5463715", "0.5449605", "0.54493695", "0.54393435", "0.54389536", "0.54312617", "0.54217684", "0.5381869", "0.53664094", "0.53300136", "0.530...
0.6904403
0
Masks the sequences in the FASTA file based on the given intervals.
def maskAll(self, intervals, toLower=False, maskingChar='N'): seqDict = self.sequenceDict() for i in range(len(seqDict.keys())): x = seqDict.keys()[i] interval = intervals[i] print self.maskSeq(x, interval, toLower=False, maskingChar='N') return ''
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def maskSeq(self, name, interval, toLower=False, maskingChar='N'):\n\t\tseqDict = self.sequenceDict()\n\t\tsequence = seqDict[name]\n\t\tmasker = SequenceManipulation(sequence)\n\t\treturn masker.maskSequence(interval, toLower=False, maskingChar='N')", "def fix_fasta_file(file):\n fix_seq = []\n with open(...
[ "0.614429", "0.5527922", "0.539755", "0.5274567", "0.5262484", "0.5066138", "0.5004956", "0.4976049", "0.49671167", "0.48955667", "0.48864946", "0.48761702", "0.487294", "0.48467973", "0.48292848", "0.48230615", "0.4802303", "0.47898862", "0.47746125", "0.47661823", "0.476231...
0.6950524
0
Trims all the sequence in the FASTA file from both sides based on the intervals.
def trimAll(self, intervals, quality=None): seqDict = self.sequenceDict() for i in range(len(seqDict.keys())): x = seqDict.keys()[i] interval = intervals[i] print self.trimSeq(x, interval, quality = None) return ''
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def trim_sequences(seq_1, seq_2):\n start_index = 0\n end_index = 0\n\n for base_1, base_2 in zip(seq_1, seq_2):\n if base_1 == base_2:\n start_index += 1\n else:\n break\n seq_1 = seq_1[start_index:]\n seq_2 = seq_2[start_index:]\n\n for base_1, base_2 in zip(...
[ "0.6248088", "0.60530895", "0.5990144", "0.5879029", "0.5841177", "0.57132465", "0.5693943", "0.5680045", "0.5659152", "0.56584454", "0.5653351", "0.5643425", "0.5592913", "0.5584238", "0.5541814", "0.5540114", "0.54449254", "0.538202", "0.5317934", "0.53145164", "0.5287264",...
0.65075326
0
Provide py.path.local objects for content, template and export dirs, and a SiteGenerator object
def site_setup(self, tmpdir): templates = tmpdir.mkdir("templates") templates.join("def.html").write("{{ content }}") content = tmpdir.mkdir("content") output = tmpdir.mkdir("output") config_dict = { "theme_dir": str(templates), "default_template": "def.h...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setup_local_site(self):\n raise NotImplementedError", "def create_site(build_dir, content_dir, template_dir, no_cache, verbose):\n\n # set logging options\n logging.basicConfig(\n level=logging.DEBUG if verbose else logging.INFO,\n format='%(levelname)s: %(message)s',\n )\n\n ...
[ "0.620989", "0.6081808", "0.5978924", "0.5821657", "0.57425463", "0.57000035", "0.5676607", "0.5642326", "0.56345516", "0.56286216", "0.5618611", "0.55703175", "0.5520478", "0.55147", "0.5508889", "0.5418208", "0.54072964", "0.53687865", "0.5361989", "0.5312565", "0.53117096"...
0.70232576
0
Check that a title is generated based on filename if title not specified in page context. Check that if a title is specified it is used in breadcrumbs
def test_title_handling(self, site_setup): templates, content, output, s_gen = site_setup templates.join("t.html").write("{{ title }}") templates.join("b.html").write( "{{ breadcrumbs|map(attribute='title')|join(', ') }}" ) with_title = content.mkdir("with-title") ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _title(self, path):\n title = os.path.basename(os.path.splitext(path)[0])\n return title", "def page_title(step, title):\r\n\r\n with AssertContextManager(step):\r\n assert_equals(world.browser.title, title)", "def get_title(self):\n\n if self.title: return self.title\n ...
[ "0.6652735", "0.66207904", "0.6483766", "0.6360625", "0.6337741", "0.6319793", "0.63013184", "0.6280622", "0.62694204", "0.6182768", "0.6161411", "0.60478723", "0.6035799", "0.5976318", "0.595089", "0.5845818", "0.58402985", "0.58032763", "0.57985413", "0.57898", "0.57817245"...
0.7179237
0
Test that content directory defaults to directory containing config
def test_find_content_dir(self, tmpdir): cfg1 = self.create_config(tmpdir, cls=SiteConfig, content="/some/content/dir/", theme_dir="/blah/") assert cfg1.content == "/some/content/dir/" cfg2_file = tmpdir.join("second_content.ym...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_default_config_file_paths(\n config,\n):\n assert \"~/.config/yessssms.conf\" in CONFIG_FILE_PATHS\n assert \"/etc/yessssms.conf\" in CONFIG_FILE_PATHS", "def test_get_default_settings_path():\n\n root_path = application_services.get_pyrin_main_package_path()\n default_settings_path = os....
[ "0.7403168", "0.7146665", "0.70760983", "0.6754351", "0.6718227", "0.6693081", "0.6673153", "0.66428024", "0.6629399", "0.6570363", "0.6522195", "0.6498252", "0.64576167", "0.64243656", "0.64204663", "0.6397632", "0.6383991", "0.6381578", "0.63815427", "0.63582665", "0.633961...
0.7295535
1
Initializes the server's log file for client data.
def init_log_file(self): try: os.makedirs(config["server_log_path"]) except OSError: if not os.path.isdir(config["server_log_path"]): raise server_log_file = logging.FileHandler( config["server_log_path"] + 'server_log_' + time.strftime(...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def Init(log_file_path):\n global _LOG_FILE\n _LOG_FILE = log_file_path\n print \"Using log file: %s\" % _LOG_FILE", "def init():\n global logger\n\n with open(\"/app/log.json\", \"r\") as fd:\n logging.config.dictConfig(json.load(fd))\n\n logger = logging.getLogger()", "def _begin_logging(s...
[ "0.7203142", "0.701967", "0.6904332", "0.6864506", "0.6816234", "0.6795845", "0.67748404", "0.6711876", "0.66583043", "0.66501117", "0.66305506", "0.6618567", "0.6589741", "0.65381527", "0.64726347", "0.64594346", "0.6449135", "0.6445877", "0.6427664", "0.6423999", "0.6417975...
0.80862725
0
Handles a client connection Creates a ClientHandler instance for it. The ClientHandler is stored according to client_id in the client_list dictionary.
def handle_accept(self): pair = self.accept() if pair is not None: sock, addr = pair server_log.info('Client connection from {}, assigning client id {}'.format(repr(addr), self.client_id)) handler = ClientHandler(sock, addr, self.client_id) self.clie...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def handle_client(self):\n e = threading.Event()\n reg_t = threading.Thread(target=self.handle_reg_client, args=(e,))\n stream_t = threading.Thread(target=self.handle_stream_client,\n args=(e,))\n reg_t.start()\n stream_t.start()", "def on_cli...
[ "0.63900757", "0.59873056", "0.59562147", "0.5953207", "0.59450305", "0.5760294", "0.5757456", "0.5739578", "0.5724083", "0.5660717", "0.5658274", "0.5651186", "0.564319", "0.56130105", "0.5589581", "0.5576462", "0.5552205", "0.5495648", "0.54873526", "0.5483632", "0.54803264...
0.6751793
0
Run asyncore.loop until all clients are closed
def run_loop(self): server_log.info('Server now accepting client connections.') while not self.clients_done(): asyncore.loop(timeout=config["server_timeout"], count=config["server_loop_count"])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _background_loop(self):\n with self.cond:\n while self.clients:\n self.cond.wait()\n # all clients have exited now, so shut down\n trigger_exit(ExitMode.PARENT)", "async def run_all_clients():\n completed_clients = 0\n for client_re...
[ "0.737835", "0.69200724", "0.6884972", "0.6719924", "0.6547865", "0.6507496", "0.6496807", "0.64814967", "0.64595824", "0.6420458", "0.6339583", "0.6320468", "0.6311041", "0.62888294", "0.6278201", "0.6267851", "0.62426627", "0.62382513", "0.6209195", "0.62010014", "0.6194719...
0.77607787
0
Returns True if all clients have completed their tests and at least one client has connected.
def clients_done(self): if not self.client_list: return False elif len(asyncore.socket_map) > 1: return False else: return True
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def has_client(self):\n \n return len(self._clients) > 0", "def has_client(self):\n \n return len(self._clients) > 0", "def health_ok(self):\n for client in self.clients():\n if client.run_cmd('ls'):\n log.info('Vmware cluster is up.')\n ...
[ "0.68557036", "0.68557036", "0.68438685", "0.67901796", "0.6742768", "0.6742768", "0.6713238", "0.6616007", "0.6462098", "0.64204156", "0.6370444", "0.6345554", "0.633299", "0.63108575", "0.6297991", "0.6266595", "0.62613094", "0.6207049", "0.6206094", "0.6193173", "0.6192629...
0.7978028
0
Writes out a report that displays data for all clients that ran.
def write_report(self): self.end_time = time.strftime('%Y-%m-%d_%H:%M:%S') server_log.info('') server_log.info('=========================================================') server_log.info('All test clients completed!') server_log.info(' Start time: {}'.format(self.start_t...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def gen_report(self):\n self.report = '#Report for {0}\\n'.format(self.ip)\n self.report += 'This report was generated by the chameleon pentest bot. We cannot grant 100% accurate results.\\n'\n self.report += '###Services:\\n'\n for service in self.services:\n self.report += ...
[ "0.6989748", "0.6965497", "0.6780886", "0.675011", "0.6604654", "0.65979004", "0.6356908", "0.63534147", "0.63277817", "0.6318504", "0.62915075", "0.62662154", "0.62466437", "0.61990076", "0.61762094", "0.6135343", "0.6123757", "0.60989434", "0.60923785", "0.6041147", "0.6023...
0.8425468
0
Function that query tvmdb.org and return a list of movies
def search_movies(query,page=1): # Local variables languages_list=["fr"] complete_list=[] # Query the API using the query in parameter for cur_language in languages_list: movies_list=tmvdb_connect(os.path.join(app.config['API_URL'],("search/movie?api_key=" + app.config['API_KEY'] + "&language=" + cur_language +...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_movies():\n tree = get_tree()\n movie_list = [movie.get(\"title\") for movie in tree.getroot().findall(\"movie\")]\n return movie_list", "def get_all_movies():\n\n cnx,cur = connect_to_db() #get connection with db\n cur.execute(\"SELECT movie_id, title FROM movies\")\n lst = cur....
[ "0.7114451", "0.7090844", "0.70851374", "0.70629597", "0.6947036", "0.6938637", "0.68237203", "0.67912", "0.6786555", "0.6684187", "0.664331", "0.66030836", "0.65860033", "0.65728813", "0.6549369", "0.6544917", "0.65305495", "0.6529516", "0.649978", "0.64870983", "0.6485034",...
0.7152241
0
hex dump of packet (or header)
def packetDump(packet): hex = '' start = 0 size = 16 ln = len(packet) while start < ln: # print line number line = '%04x ' % start #print hex representation c = 0 asc = packet[start:min(start+size, ln)] for b in asc: if c == 8: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def hex_dump(data):\n for i in xrange(len(data)):\n print(\"0x%02x\" % ord(data[i]))\n if i != 0 and not (i+1) % 8:\n print(\"\")\n else:\n print(\" \")\n print", "def hexDump(bytes):\n for i in range(len(bytes)):\n sys.stdout.write(\"%2x \" % (ord(byte...
[ "0.6802987", "0.6764526", "0.6584395", "0.65594596", "0.6556234", "0.6477623", "0.6438826", "0.6366082", "0.63650584", "0.62856376", "0.6244264", "0.6226383", "0.6218719", "0.6217049", "0.620856", "0.61349416", "0.6107226", "0.60973054", "0.60741824", "0.6051891", "0.6047414"...
0.82250845
0
get CCSDS time from header part of packet
def get_ccsds_time(hdr): UTIME1980 = 315964800.0 b35, b36, b37, b38, b39 = struct.unpack('ccccc', hdr[34:39]) coarse_hex = b35.encode('hex') + b36.encode('hex') + b37.encode('hex') + b38.encode('hex') fine_hex = b39.encode('hex') scale = 16 # for hexadecimal coarse = int(coarse_hex, scale) + UTI...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_tsc(packet):\n return (ord(packet[TS.TSC_INDEX]) & TS.TSC_MASK) >> 6", "def wake_ssc_get_header(ser, ntpoffset, debug=0):\n ser.reset_output_buffer()\n\n xloop = 0\n while not ser.in_waiting:\n xloop += 1\n if xloop > 1000:\n return None, None\n time.sleep(0.01...
[ "0.656128", "0.6541873", "0.6343928", "0.6224531", "0.6142616", "0.6138412", "0.6056164", "0.5995594", "0.5950836", "0.59390134", "0.5923586", "0.59178567", "0.5864513", "0.58585227", "0.5834434", "0.58203495", "0.58161336", "0.58111405", "0.580176", "0.5792794", "0.57722306"...
0.77967405
0
get CCSDS sequence counter from header part of packet
def get_ccsds_sequence(hdr): VALUE_MASK = 0x0FFF b31, b32 = struct.unpack('cc', hdr[30:32]) my_hexdata = b31.encode('hex') + b32.encode('hex') #print my_hexdata scale = 16 # for hexadecimal #print int(my_hexdata, scale) #print bin(int(my_hexdata, scale)) #print bin(int(my_hexdata, scale)...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_continuity_counter(packet):\n return ord(packet[TS.CONTINUITY_COUNTER_INDEX]) & TS.CONTINUITY_COUNTER_MASK", "def __get_sequence_number(self):\n if self.counter > 999:\n self.counter = 0\n else:\n self.counter += 1\n\n str_sequence_num = self.counter + 256\n ...
[ "0.5951451", "0.59053767", "0.58980507", "0.583704", "0.57962173", "0.5770987", "0.57651114", "0.5749863", "0.5737394", "0.56442", "0.5605717", "0.5560121", "0.55492866", "0.5538046", "0.5533055", "0.5530552", "0.548211", "0.54563886", "0.54434186", "0.54238003", "0.54202646"...
0.711132
0
Create and return a pubkey message [V|T][Nick Len][Nickname\0][PubLen][PubKey]
def create_pubkey_message(sender_nickname, sender_pubkey): tag = (VERSION<<16) | publicKeyOnly out = struct.pack("<LL", tag, len(sender_nickname)) + sender_nickname out += struct.pack("<L", len(sender_pubkey)) + sender_pubkey return out
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sendPublicKey(g, p, s):\r\n status = \"120 PubKey \" + str(computePublicKey(g, p, s))\r\n return status", "def forge_public_key(value) -> bytes:\n prefix = value[:4]\n res = base58.b58decode_check(value)[4:]\n\n if prefix == 'edpk':\n return b'\\x00' + res\n elif prefix == 'sppk':\n ...
[ "0.65045893", "0.6377248", "0.61930734", "0.6128937", "0.6078243", "0.59287196", "0.5924388", "0.5846413", "0.58447284", "0.5818342", "0.5815753", "0.5806327", "0.5797298", "0.579287", "0.5781392", "0.57713336", "0.57713336", "0.57631433", "0.57480586", "0.57347906", "0.57264...
0.81676024
0
Create and return an encrypted message [V|T][Nick Len][Nickname\0][SndrPubLen][SndrPubKey] [RcvrPubLen][RcvrPubKey][NonceLen][Nonce][CipherLen][Cipher]
def create_encrypted_message(sender_nickname, sender_pubkey, sender_secretkey, dest_pubkey, message): nonce, cipher = nacl.nacl_encrypt(sender_secretkey, dest_pubkey...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_pubkey_message(sender_nickname, sender_pubkey):\n tag = (VERSION<<16) | publicKeyOnly\n \n out = struct.pack(\"<LL\", tag, len(sender_nickname)) + sender_nickname\n out += struct.pack(\"<L\", len(sender_pubkey)) + sender_pubkey\n \n return out", "def text(message):\n room = session.get('room'...
[ "0.6305998", "0.6171795", "0.6154709", "0.61068445", "0.60931355", "0.60631984", "0.5970933", "0.59465784", "0.59428024", "0.59104866", "0.5902761", "0.5863127", "0.58440626", "0.58182377", "0.5789286", "0.5761531", "0.5757969", "0.57447106", "0.57308614", "0.5711562", "0.571...
0.7250379
0
Parses a message and returns sender nick, sender pubkey, rcv pubkey, a nonce, and a ciphertext [V|T][Nick Len][Nickname\0][SndrPubLen][SndrPubKey] [RcvrPubLen][RcvrPubKey][NonceLen][Nonce][CipherLen][Cipher]
def parse_message(msg): idx = 8 tag, nickLen = struct.unpack("<LL", msg[:idx]) if VERSION != (tag>>16): raise Exception("Wrong version") sender_nickname = msg[idx:idx+nickLen] idx += nickLen length = struct.unpack("<L", msg[idx:idx+4])[0] idx += 4 sender_pubkey = msg[idx:idx+length] idx += leng...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse(msg):\n msg = msg.replace(\"\\r\", \"\").replace(\"\\n\", \"\").replace(\"\\b\", \"\")\n pseudo = user_account = ip = msg_type = content = target = \"\"\n msg_parsed = message_regex.search(msg)\n if msg_parsed:\n data = msg_parsed.groups()\n if len(data) >= 6:\n pseud...
[ "0.642444", "0.6410583", "0.63378567", "0.6130902", "0.6029436", "0.5945686", "0.5773587", "0.5708362", "0.568747", "0.5683443", "0.5628216", "0.5605319", "0.5598509", "0.5597969", "0.5582579", "0.5569689", "0.55627805", "0.55557734", "0.55504996", "0.55477136", "0.5507946", ...
0.8205853
0
make_atmosphere generates the parameters of the working fluid.
def make_atmosphere(self): raise NotImplementedError()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def prepare_atmosphere(overwrite=True):\n path = astropy.utils.data._find_pkg_data_path('../data/atmosphere.fits')\n if not overwrite and os.path.exists(path):\n print('Atmosphere file exists and overwrite is False.')\n return\n # Specify how SkyCalc will be called.\n params = dict(\n ...
[ "0.6460702", "0.60003054", "0.59530497", "0.58610725", "0.5814864", "0.5768266", "0.5745342", "0.5692124", "0.56393105", "0.559459", "0.5588982", "0.5533201", "0.54618025", "0.5375111", "0.5364124", "0.5310667", "0.5249095", "0.5241748", "0.52260303", "0.51352054", "0.5118521...
0.7430795
0
get_dynamic_pressure returns the dynamic pressure at a given velocity in this environment. Be careful to ensure consistant units with the model in use.
def get_dynamic_pressure(self, velocity): dynamic_press = 0.5 * self.Density * velocity**2 return dynamic_press
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_pressure(vv, tt, chemical_potential, gbar=2.0, *args, **kwargs):\n # type: (np.ndarray, np.ndarray, float, list, dict) -> np.ndarray\n y = chemical_potential / tt\n pressure = (\n gbar * np.sqrt(2) / (3 * np.pi ** 2) * tt ** (2.5) * _1d_call(_fdk, y, k=1.5)\n )\n return pressure", "...
[ "0.6063561", "0.5771036", "0.56866175", "0.5550248", "0.54784036", "0.5464602", "0.5461538", "0.5454981", "0.5406294", "0.53102523", "0.5305995", "0.525358", "0.52433705", "0.52364284", "0.521001", "0.51836723", "0.5177972", "0.5147309", "0.513841", "0.51174736", "0.50451267"...
0.8371995
0
get_reynolds_number returns the Reynolds number for a given flowise length and velocity in the specified environment. Be careful to ensure consistant units with the model in use.
def get_reynolds_number(self, velocity, refLength): re_num = self.Density * velocity * refLength / self.Dynamic_viscosity return re_num
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getR(self):\n # Reynolds number uses the absolute value of the velocity\n V = abs(self.V)\n return (V * self.D) / self.v # formula for Reynolds number", "def weber_velocity(weber_number, reynolds_number, d=2e-3):\n sigma = 0.07\n rho_g = 1.225\n u_l = velocity_calculator(reynold...
[ "0.63159084", "0.5067977", "0.48740846", "0.4719748", "0.46940824", "0.46886086", "0.46692067", "0.46486318", "0.4642592", "0.4632284", "0.4596806", "0.45696458", "0.45380768", "0.45145994", "0.45074502", "0.45062533", "0.44881535", "0.44799104", "0.44602907", "0.44600508", "...
0.7271312
0
get_mach_number returns the local Mach number for a given velocity in the specified environment. Be careful to ensure constant units with the model in use.
def get_mach_number(self, velocity): ma_num = velocity / self.Speed_of_sound return ma_num
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def machine_model_from_tile_count(self):\n tc = self.tile_count()\n\n machine=None\n if tc == 2:\n log.info(\"Detected %s tiles, interpreting as MiSeq nano run.\",tc)\n machine = {\"machine\":\"Illumina MiSeq\",\"lane_count\":1}\n elif tc == 8:\n log.inf...
[ "0.5143922", "0.5080543", "0.5061867", "0.5024037", "0.4961383", "0.4960304", "0.49488705", "0.49455035", "0.49367878", "0.49081814", "0.4871156", "0.48400524", "0.4785728", "0.47754022", "0.47244716", "0.47242123", "0.47220096", "0.47152975", "0.47112778", "0.47012293", "0.4...
0.72194606
0
Calls the superclass constructor to initialize the data, then constructs the model. Also accepts an optional temperature offset.
def __init__(self, alt=0, temp_offset=0): WorkingAtmosphere.__init__(self, alt) #self.temperature_offset = tOffset self.Temperature_offset = temp_offset self.make_environment()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, init=None, data=None, dq=None, err=None, dq_def=None,\n filt=None, temperature=None, **kwargs):\n super(MiriTelescopeEmissionModel, self).__init__(init=init, data=data,\n dq=dq, err=err,\n ...
[ "0.6704204", "0.64941555", "0.62065095", "0.61745036", "0.61563253", "0.61258876", "0.6087512", "0.6035568", "0.60286486", "0.60008746", "0.5996381", "0.59670883", "0.59656525", "0.59656525", "0.59646565", "0.59617573", "0.5959867", "0.5957996", "0.5956937", "0.59548426", "0....
0.6604483
1
Ping6 between all specified hosts.
def ping6(self, hosts=None, timeout=None): # should we check if running? packets = 0 lost = 0 ploss = None if not hosts: hosts = self.sensors output('*** Ping: testing ping reachability\n') for node in hosts: output('%s -> ' % node.name...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pingAll(self, timeout=None):\n return self.ping6(timeout=timeout)", "def _migrate_hosts_v6_to_v7(session, hosts_v6, hosts_v7):\n if 0 == len(hosts_v7):\n for host_v6 in hosts_v6:\n host_v7 = model.Host_v7()\n host_v7.data = host_v6.data\n nfvi_host_data = jso...
[ "0.6556351", "0.6417512", "0.6195803", "0.60187995", "0.5936656", "0.58972037", "0.58112824", "0.57595855", "0.57179636", "0.54771113", "0.54202265", "0.53702193", "0.5331894", "0.5314686", "0.5256871", "0.5243993", "0.52407134", "0.52376527", "0.5210037", "0.520053", "0.5192...
0.7465149
0
Get a PyTorch activation function, specified either directly or as a string. This function simplifies allowing users to specify activation functions by name. If a function is provided, it is simply returned unchanged. If a string is provided, the corresponding function in torch.nn.functional is returned.
def get_activation(fn: Union[Callable, str]): if isinstance(fn, str): return getattr(torch.nn.functional, fn) return fn
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_activation_fn(name: Optional[str]):\n if name in (None, 'linear'):\n return lambda x: x\n elif name in ('sigmoid', 'tanh'):\n return getattr(torch, name)\n else:\n return getattr(F, name)", "def get_activation(activation_string):\n act = activation_string.lower()\n if ...
[ "0.84378576", "0.823575", "0.8149811", "0.8090865", "0.807252", "0.80589396", "0.80355024", "0.77792335", "0.77071106", "0.76702833", "0.7656392", "0.7638833", "0.7634739", "0.76101136", "0.7522796", "0.7356847", "0.7295759", "0.7283287", "0.72785085", "0.72573024", "0.715440...
0.87998676
0
Computes the sum along segments of a tensor. Analogous to tf.unsorted_segment_sum.
def unsorted_segment_sum(data: torch.Tensor, segment_ids: torch.Tensor, num_segments: int) -> torch.Tensor: if len(segment_ids.shape) != 1: raise AssertionError("segment_ids have be a 1-D tensor") if data.shape[0] != segment_ids.shape[0]: raise AssertionError( ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _rowwise_unsorted_segment_sum(values, indices, n):\n batch, k = tf.unstack(tf.shape(indices), num=2)\n indices_flat = tf.reshape(\n indices, [-1]) + tf.div(tf.range(batch * k), k) * n\n ret_flat = tf.unsorted_segment_sum(\n tf.reshape(values, [-1]), indices_flat, batch * n)\n return t...
[ "0.7506605", "0.74699783", "0.72073925", "0.6586497", "0.6506094", "0.6485964", "0.6485964", "0.6485964", "0.6485964", "0.6485964", "0.6312732", "0.63053745", "0.6110864", "0.5963782", "0.595026", "0.59458345", "0.5915711", "0.57985264", "0.55721176", "0.551346", "0.5353314",...
0.7578235
0
This function computes the sum of values along segments within a tensor. It is useful when you have a tensor with segment IDs and you want to compute the sum of values for each segment.
def segment_sum(data: torch.Tensor, segment_ids: torch.Tensor) -> torch.Tensor: if not all(segment_ids[i] <= segment_ids[i + 1] for i in range(len(segment_ids) - 1)): raise AssertionError("elements of segment_ids must be sorted") if len(segment_ids.shape) != 1: raise AssertionErr...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def unsorted_segment_sum(data: torch.Tensor, segment_ids: torch.Tensor,\n num_segments: int) -> torch.Tensor:\n\n if len(segment_ids.shape) != 1:\n raise AssertionError(\"segment_ids have be a 1-D tensor\")\n\n if data.shape[0] != segment_ids.shape[0]:\n raise AssertionE...
[ "0.7163472", "0.7117668", "0.6811147", "0.6643343", "0.6410753", "0.64015526", "0.63132685", "0.63132685", "0.63132685", "0.63132685", "0.63132685", "0.6106327", "0.6084674", "0.6032285", "0.6013459", "0.5989602", "0.57810265", "0.56977224", "0.568112", "0.5653415", "0.559937...
0.7363645
0
apply given masks to zeroout learnable weights in model
def apply_masks(self, model: Model, masks: List[torch.Tensor]): learnableparams = [p for p in model.parameters() if p.requires_grad] assert len(learnableparams) == len(masks) for m, w in zip(masks, learnableparams): assert m.size() == w.size() w.data *= m.clone()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mask_weights(self, mask, weights):\n new_weights = list()\n for idx, layer in enumerate(self.model.layers):\n if len(layer.get_weights())>0:\n new_weights.append(weights[idx]*mask[idx])\n new_weights.append(layer.get_weights()[1])\n else:\n ...
[ "0.6907199", "0.6441398", "0.64071983", "0.63090414", "0.6304902", "0.6189421", "0.6170111", "0.61664665", "0.6131547", "0.6061211", "0.60496736", "0.60389096", "0.6014041", "0.6007253", "0.6000628", "0.5999864", "0.59812796", "0.597934", "0.59062207", "0.589865", "0.5879119"...
0.7005522
0
Visualize generator outputs during training.
def visualize_training_generator(train_step_num, start_time, data_np): print('Training step: %i' % train_step_num) time_since_start = (time.time() - start_time) / 60.0 print('Time since start: %f m' % time_since_start) print('Steps per min: %f' % (train_step_num / time_since_start)) plt.axis('off') ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def summarize(self):\n info(\"Running \" + self.title + \" generator\")", "def visualize_input_batch(input_gen):\n # Get a batch from the generator\n batch_inputs, batch_targets = input_gen[0]\n\n plt_num = 1\n for specgram in batch_inputs:\n plt.subplot(4, 8, plt_num)\n plt.pcol...
[ "0.6684696", "0.6677125", "0.65397733", "0.644812", "0.6431353", "0.6366485", "0.631945", "0.625001", "0.6122771", "0.6086541", "0.6056006", "0.6014803", "0.6014631", "0.60081434", "0.5982955", "0.59719384", "0.5969197", "0.593211", "0.5920369", "0.5908951", "0.5868416", "0...
0.7401334
0
Evaluate GAN losses. Used to check that the graph is correct.
def evaluate_tfgan_loss(gan_loss, name=None): with tf.Session() as sess: sess.run(tf.global_variables_initializer()) with queues.QueueRunners(sess): gen_loss_np = sess.run(gan_loss.generator_loss) dis_loss_np = sess.run(gan_loss.discriminator_loss) if name: print(...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def gan_loss(logits_real, logits_fake):\n\n G_loss = tf.reduce_sum(tf.losses.mean_squared_error(labels=tf.ones_like(logits_fake), predictions=logits_fake))\n D_loss = tf.reduce_sum(tf.losses.mean_squared_error(labels=tf.ones_like(logits_real), predictions=logits_real)) \\\n + tf.reduce_sum(tf.los...
[ "0.66212344", "0.6180738", "0.61630833", "0.61462635", "0.61352575", "0.61240166", "0.60776633", "0.6063268", "0.60393053", "0.5915879", "0.59136206", "0.5871818", "0.5871818", "0.5858124", "0.58497316", "0.58248895", "0.58224905", "0.5806047", "0.5795219", "0.579479", "0.578...
0.6763072
0
Get the mosaic filename Returns
def getMosaic(self): from .gsMosaic import Mosaic mfn = Mosaic(self.mosaicFilename, "r") return mfn
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mosaic_art_file_name(target_im):\n target_file_name = extract_file_name(target_im)\n now_dt = now_datetime()\n return '{0}_mosaic_{1}.png'.format(target_file_name, now_dt)", "def file(self):\n\n dlos_filename = super(DlosPhotoz, self).file()\n\n photoz_str = 'DLOS_photoz_'\n \n ...
[ "0.7708499", "0.6606807", "0.64587444", "0.64475816", "0.6422161", "0.64113533", "0.63816094", "0.63787526", "0.6374186", "0.6363668", "0.636102", "0.63525915", "0.6346686", "0.6340294", "0.6334211", "0.63274634", "0.63243693", "0.6322172", "0.6318359", "0.6304304", "0.628762...
0.75586784
1
Returns a list of grid names
def getGridNames(self): return list(self.gridName.values())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_grid_list (self):\n return [\n 'area', 'ald', 'poi', 'ice', 'lake pond',\n 'drainage', 'degree-day','climate event'\n ]", "def getGridFilenames(self):\n c = list(self.gridVars.keys())\n return self.gridVars[c[0]]", "def get_grid_names(fname):\r\n wit...
[ "0.7701269", "0.6967279", "0.6963452", "0.65994203", "0.6496864", "0.6332268", "0.62785465", "0.6247968", "0.6214973", "0.6210428", "0.61160517", "0.6096705", "0.6078077", "0.6066579", "0.60479856", "0.6047407", "0.6047247", "0.6030821", "0.60281056", "0.6019691", "0.6005941"...
0.8589929
0
Get a list of static variable filenames
def getStatFilenames(self, varName=None): if varName is not None: return self.statVars[varName] # return all the static var filenames return list(self.statVars.values())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def filenames(self):\n pass", "def get_filenames(self):\n return [doc['filename'] for doc in self.vocab]", "def getTimeFilenames(self, varName=None):\n if varName is not None:\n return self.timeVars[varName]\n # return all the time var filenames\n return list(self....
[ "0.6665744", "0.6433359", "0.64183706", "0.63616496", "0.6325286", "0.62240475", "0.61876273", "0.6157101", "0.6092526", "0.6071773", "0.6061151", "0.60205257", "0.6018264", "0.6018264", "0.59930205", "0.5985529", "0.59846896", "0.59782445", "0.59678173", "0.5951168", "0.5938...
0.7338962
0
Get a list of time dependent variable filenames
def getTimeFilenames(self, varName=None): if varName is not None: return self.timeVars[varName] # return all the time var filenames return list(self.timeVars.values())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getStatFilenames(self, varName=None):\n if varName is not None:\n return self.statVars[varName]\n # return all the static var filenames\n return list(self.statVars.values())", "def _get_recent_file_names():\n file_name_tpl = '{}-data.csv'\n date_fmt = '%Y-%m-%d'\n now...
[ "0.623482", "0.6201532", "0.619404", "0.6123084", "0.61184835", "0.60823447", "0.6009846", "0.6007771", "0.5979614", "0.59690094", "0.59690094", "0.59388673", "0.59059787", "0.58519924", "0.57494944", "0.5730421", "0.5725988", "0.56848276", "0.5663672", "0.5631348", "0.560843...
0.77151006
0
Coordinates variables contained within the host object Returns list of coordinate names
def getCoordinates(self): return list(self.gridVars.keys())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getMachineCoordinates(self):\n return (self.x, self.y, self.z)", "def coords(self):\n return nx.get_node_attributes(self.network, 'coords')", "def coordinates(self):", "def extractCoords(self):\n if not self.rank:\n logging.info('Extracting atomic poitions')\n\n # Extract coordin...
[ "0.6607652", "0.6462455", "0.6420147", "0.6416999", "0.6323455", "0.62805086", "0.6258724", "0.6232869", "0.6228053", "0.6190303", "0.61684424", "0.6141508", "0.6113874", "0.61050195", "0.6051566", "0.6051566", "0.60388356", "0.6029663", "0.6023467", "0.6023467", "0.6022147",...
0.7298523
0
Get number of time dependent data files Returns number time data files
def getNumTimeDataFiles(self): return self.nTimeDataFiles
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _count_data(path):\n matcher = re.compile(r'[0-9]+\\.dec')\n match = lambda name: bool(matcher.match(name))\n names = os.listdir(path)\n n_data = len(list(filter(match, names)))\n return n_data", "def getNumStatDataFiles(self):\n return self.nStatDataFiles", "def numberFiles(self):\n ...
[ "0.7182039", "0.7102317", "0.70543593", "0.69207406", "0.6838226", "0.68326515", "0.68241507", "0.68113047", "0.68033445", "0.67907757", "0.66755086", "0.6669724", "0.6634735", "0.65223354", "0.65201944", "0.6491068", "0.6471425", "0.6415917", "0.6402898", "0.6370581", "0.634...
0.8203114
0
List the given variables attributes
def listattribute(self, varName): fName = "" if varName in self.statVars: fName = self.statVars[varName][0] elif varName in self.timeVars: fName = self.timeVars[varName][0][0] if fName: var = cdms2.open(fName, 'r')(varName) return var.lista...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def variables(self):\n return {u for u in self if u.type == 'var'}", "def GetVariableAttributes(template_src, env=None):\n env = env or jinja2.Environment()\n abstract_syntax_tree = env.parse(template_src)\n node_visitor = _GetattrNodeVisitor()\n node_visitor.visit(abstract_syntax_tree)\n\n output = ...
[ "0.65601426", "0.65357316", "0.64982337", "0.64585227", "0.6444077", "0.64362997", "0.64314514", "0.64250094", "0.64156294", "0.6398745", "0.6361429", "0.6314901", "0.630744", "0.6302959", "0.6300251", "0.6296675", "0.62821263", "0.62786794", "0.62548614", "0.6248832", "0.621...
0.74926
0
List global attributes of host file Returns a list of the global attributes in the file
def listglobal(self): return list(self.attributes.keys())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read_global_attributes(self):\n return self._attrs.keys()", "def get_attributes():\n bot_id = socket.gethostname().lower().split('.', 1)[0]\n return os_utilities.get_attributes(bot_id)", "def attributes(self):\n return self.host.attributes", "def listattribute(self, varName):\n fNa...
[ "0.6995831", "0.6581437", "0.6498783", "0.6399885", "0.61457044", "0.5960228", "0.59415376", "0.5894605", "0.58932734", "0.5867633", "0.5853049", "0.5821752", "0.5815777", "0.5815777", "0.57023257", "0.5627382", "0.5600384", "0.5545758", "0.55299264", "0.55031115", "0.5438552...
0.70825267
0
Get the value of the global attribute
def getglobal(self, attName): return self.attributes[attName]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read_global_attribute(self, name):\n return self._attrs[name]", "def attribute_value(self) -> str:\n return pulumi.get(self, \"attribute_value\")", "def get_global_arg(self, key):\n return self.args[key]", "def read_value(self):\n return self.load_attr(\"value\")", "def getG...
[ "0.7874448", "0.65669024", "0.6469944", "0.64430743", "0.6430823", "0.6427242", "0.64198995", "0.63862455", "0.638394", "0.6352497", "0.63460743", "0.6335562", "0.6333359", "0.6313781", "0.63110405", "0.63098776", "0.63080233", "0.62845445", "0.62759", "0.62759", "0.62702984"...
0.76207507
1
Get a variable by name
def getVariable(self, varName): return self[varName]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_ref_by_name(self, name):\n if name in self.vars:\n return self.vars[name]\n #print 'Variable %s not found !' % name\n seq_name_and_index = name.split('|')\n\n if len(seq_name_and_index) == 2:\n seq_name, index = name.split('|')\n if seq_name in s...
[ "0.78054714", "0.759444", "0.74774885", "0.74056983", "0.74012774", "0.7306793", "0.7304104", "0.7228118", "0.7204261", "0.715558", "0.71331775", "0.71238", "0.70963156", "0.7073747", "0.70578474", "0.7054672", "0.70216876", "0.6971025", "0.69705945", "0.6932727", "0.6911514"...
0.7859933
0
Create relevant references to masters of referenced variants. If mulitple variants of a publication exist, only the master variant is considered. However, relevant publications might reference a nonmaster mastervariant, e. g., a preprint. This command adds references to the mastervariant, even though this reference is ...
def fix_references(self) -> None: self.log_info("--- Searching for references to variants ---") for publication in Publication.objects.filter(variant_of__isnull=False): variant = publication.variant_of origs = PublicationReference.objects.filter(reference=publication) for orig in origs: if Publication...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def addMaster(self,masterName):\n masterInfo = modInfos[masterName]\n self.masterNames.append(masterName)\n #--Map info\n iMod = len(self.masterNames)\n #--Map masters\n masterMap = self.getMasterMap(masterInfo)\n masterRefs = masterInfo.extras['FileRefs']\n ...
[ "0.61053914", "0.59393317", "0.54619515", "0.54258996", "0.5389747", "0.5275099", "0.527409", "0.52538985", "0.52129376", "0.52041095", "0.5181719", "0.5159691", "0.51094043", "0.5105929", "0.5093377", "0.5017443", "0.5012283", "0.5005401", "0.50019956", "0.49748862", "0.4956...
0.6314371
0
Get labels for agreement indices (single label or exact match case)
def calc_agreement_labels(self, agreement_indices, instance_labels): intersection_label_per_epoch = [] # repeat indices for each epoch for epoch in range(len(agreement_indices)): # for each epoch, select correctly identified indices among networks intersection_label_per_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_classify_labels(df):\n labels = np.ones((len(df), 1), dtype=dtype) * 2\n labels[df['A-coref']] = 0\n labels[df['B-coref']] = 1\n return labels", "def _get_labels(self, ind):\n pass", "def get_labels():\n return {\"contradiction\": 0, \"neutral\": 1, \"entailment\": 2}", "de...
[ "0.6518617", "0.6389074", "0.63585025", "0.63212913", "0.6220093", "0.621971", "0.62153774", "0.6203905", "0.6118303", "0.60789907", "0.5977403", "0.5974254", "0.59677845", "0.5957699", "0.5952099", "0.594445", "0.5939244", "0.59315485", "0.59183365", "0.5917939", "0.5898061"...
0.72215074
0
Load 'beagle_suitability.map' as simulation map Hex class has been modified since pickling so need to translate to new format hexes. TODO fresh pickle
def from_pickle(self, path): with open(path, 'rb') as hex_pickle: tmp_hexes = pickle.load(hex_pickle) for key,hex in tmp_hexes.items(): new_hex = Hex(self,key) new_hex.suitability = hex.properties['suitability'] new_hex.set_quality() self.hex...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_map(self, filename):\n with open(filename, 'rb') as file:\n self.current_obstacles = pickle.load(file)\n self.current_goal = pickle.load(file)\n try:\n setstate(pickle.load(file))\n except EOFError:\n print(\"No random state ...
[ "0.6059837", "0.582905", "0.5789754", "0.57623637", "0.57363003", "0.5624234", "0.54338914", "0.54338914", "0.53980166", "0.5397559", "0.53896356", "0.53431517", "0.53266084", "0.531096", "0.52858233", "0.5268164", "0.5264235", "0.52247584", "0.5213697", "0.521002", "0.518856...
0.6824516
0
Get first order neighborhood (radius 1). This is used frequently so we cache it. Sets self.fon to list of hexagons
def set_fon(self): self.fon = [hex for hex in self.grid.get_neighbors(self, 1) if hex is not None]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_neighbourhood(self, radius: int = 1) -> set:\n if radius == 0:\n return set()\n result = self.neighbours.copy()\n if radius > 1:\n # Recursively get neighbours of neighbours.\n for neighbour in self.neighbours:\n result |= neighbour.get_n...
[ "0.5939186", "0.5697176", "0.5654328", "0.56498045", "0.55275416", "0.5485302", "0.5485302", "0.5485302", "0.5485302", "0.5479929", "0.5457712", "0.5428452", "0.54273725", "0.5405022", "0.5401989", "0.5398534", "0.5372551", "0.5364398", "0.53522784", "0.5342827", "0.532013", ...
0.6540121
0
Set hexagon as unoccupied and update neighbors
def unoccupied(self): self.is_occupied = 0 for hex in self.fon: hex.remove_neighbor() hex.set_quality()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def occupied(self):\n self.is_occupied = 1\n for hex in self.fon:\n hex.add_neighbor()\n hex.set_quality()", "def set_neighbors(self):\n for loc, cell in self._land_cells.items():\n neighbor_cells = [\n self.landscape[(loc[0] - 1, loc[1])],\n ...
[ "0.7162605", "0.61993265", "0.6198233", "0.61626416", "0.61233974", "0.6055062", "0.60521346", "0.58941674", "0.57758003", "0.5774197", "0.57354283", "0.572306", "0.5668872", "0.5666313", "0.56604046", "0.56582975", "0.56582975", "0.5631811", "0.56291497", "0.56167483", "0.55...
0.7340622
0
Set hexagon as occupied and update neighbors
def occupied(self): self.is_occupied = 1 for hex in self.fon: hex.add_neighbor() hex.set_quality()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setNeighbors(self):\n for cellIndex in range(len(self.cells)):\n cell = self.cells[cellIndex]\n\n #Checks the 8 cells around the living one. \n for neighborsX in range(cell.x - 1, cell.x + 2):\n for neighborsY in range(cell.y - 1, cell.y + 2):\n\n ...
[ "0.6366868", "0.63519007", "0.6309558", "0.6191742", "0.61802065", "0.6168243", "0.60524607", "0.59805465", "0.5901733", "0.5857041", "0.58259887", "0.58250415", "0.58204204", "0.5759847", "0.5738866", "0.5713044", "0.5702036", "0.57006466", "0.56989104", "0.5677648", "0.5675...
0.75602955
0
Check for survival. Returns boolean
def survived(self,rates): # Juvenile or adult survival if self.age > 3: prob = rates[1] else: prob = rates[0] if np.random.binomial(1,prob): return True else: return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_vintage(self):\n return self.get_age() >= Guitar.VINTAGE_THRESHOLD", "def is_surveillance_terminated():\n return terminated", "def is_vintage(self):\n return self.get_age() >= VINTAGE_AGE", "def is_vintage(self):\n return self.get_age() >= VINTAGE_AGE", "def check_attack(self):...
[ "0.6153504", "0.5985338", "0.5867716", "0.5867716", "0.58664316", "0.5853647", "0.5832695", "0.57362854", "0.5721347", "0.5628604", "0.55949384", "0.55896246", "0.55755997", "0.55262524", "0.5429497", "0.5416008", "0.53543395", "0.53543395", "0.53446335", "0.5344602", "0.5334...
0.73646677
0
Get number of occupied neighbors in ring at distance n
def n_neighbors(self,n): return sum(1 for x in self.hex.get_neighbors_ring(n) if x is not None and x.is_occupied == 1)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def num_neighbors(self):\n return self._num_neighbors", "def degree( self, n ):\n return len(self._G.neighbors(n))", "def checkNumNeighbors():", "def calc_number_neighbours(num_electrons: int):\r\n if num_electrons < -4 or num_electrons > 4 : \r\n # if number of missing/extra e- highe...
[ "0.7145032", "0.7086741", "0.6995301", "0.695806", "0.69034326", "0.68997884", "0.6828517", "0.68146175", "0.6759187", "0.67498416", "0.6733002", "0.6728912", "0.67133117", "0.6663038", "0.66557914", "0.6625301", "0.6512811", "0.65105367", "0.65082884", "0.650676", "0.649858"...
0.8062505
0
Move agent to new hexagon
def move(self, hex): # If current has nest, set nest location to unoccupied if self.hex is not None: self.hex.unoccupied() # Set nest site to new hexagon self.hex = hex # Update occupancy of new hexagon self.hex.occupied() self.history = []
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def move_agent(self, agent):\n id_ = agent.id_\n p = agent.mobility.current\n x, y = to_geometry(p[0]), to_geometry(p[1])\n print('move agent{} {} {}'.format(id_, x, y))\n print('move agentr{} {} {}'.format(id_, x, y))", "def move(self, agent, action):\n\t\tpass", "def move(s...
[ "0.69817245", "0.6720855", "0.6227461", "0.6212848", "0.6197841", "0.61038727", "0.59502786", "0.59253806", "0.59253806", "0.59217143", "0.59097254", "0.5906638", "0.5865324", "0.5845179", "0.5833312", "0.582587", "0.58255166", "0.5817964", "0.57605606", "0.57604337", "0.5734...
0.7642785
0