query
stringlengths
9
3.4k
document
stringlengths
9
87.4k
metadata
dict
negatives
listlengths
4
101
negative_scores
listlengths
4
101
document_score
stringlengths
3
10
document_rank
stringclasses
102 values
Tests connection to Respond Analyst Server
def test_module(client): client.get_tenant_mappings()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_connection(self):\n req = requests.get(\"http://{}:{}\".format(self.config.options.get(\"Server\", \"ListenAddress\"),\n self.config.options.get(\"Server\", \"Port\")))\n\n self.assertEqual(req.status_code, 200)", "def test_connect(server):\n...
[ "0.74256337", "0.7079165", "0.69537556", "0.68980205", "0.68275255", "0.6822764", "0.6773933", "0.66543186", "0.65643054", "0.6558043", "0.64935684", "0.6442308", "0.6398292", "0.6385646", "0.6351113", "0.6344416", "0.6306147", "0.6291239", "0.6284397", "0.6237945", "0.622932...
0.0
-1
finds the respond tenant id that matches the external tenant id provided, if exists and accessible
def get_internal_tenant_from_mapping_with_external(tenant_mappings, external_tenant_id): for curr_internal_tid, curr_external_tid in tenant_mappings.items(): if external_tenant_id == curr_external_tid: return curr_internal_tid raise Exception( 'no respond tenant matches external tena...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_tenant_id(self, tenant_name):\n _url = \"http://\" + self.host_ip + \":35357/v2.0/tenants\"\n _headers = {'x-auth-token': self.cloud_admin_info['token_project']}\n _body = None\n\n response = self.request(\"GET\", _url, _headers, _body)\n if response is None:\n ...
[ "0.6791298", "0.66685784", "0.66443527", "0.6412366", "0.6134844", "0.5966822", "0.59410775", "0.5836731", "0.58017755", "0.57861495", "0.57861495", "0.57861495", "0.57861495", "0.57861495", "0.57861495", "0.57861495", "0.57861495", "0.57861495", "0.57861495", "0.56586814", "...
0.7206188
0
returns respond tenant id and external tenant id if the user is single tenant, otherwise raises exception
def get_tenant_map_if_single_tenant(user_tenant_mappings): if len(user_tenant_mappings) > 1: demisto.error( 'multi-tenant users must specify a tenant id in params, but no tenant id was found') raise Exception( 'multi-tenant users must specify a tenant id in params, but no ten...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_tenant_id(self, **kwargs):\n if self.authenticate() == 200:\n return self.tenant_id\n else:\n return None", "def get_tenant_id(self, tenant_name):\n _url = \"http://\" + self.host_ip + \":35357/v2.0/tenants\"\n _headers = {'x-auth-token': self.cloud_admin...
[ "0.7062849", "0.6790004", "0.6567938", "0.64502555", "0.64502555", "0.64502555", "0.64502555", "0.64502555", "0.64502555", "0.64502555", "0.64502555", "0.64502555", "0.64502555", "0.6437432", "0.6437432", "0.6383323", "0.6372479", "0.63325906", "0.629514", "0.629514", "0.6295...
0.5883067
30
given an email address and a list of Respond users, find the user id of the user with the provided email, and raise an exception if no user is found
def get_user_id_from_email(email, users): # find the user id that matches the email provided in user_to_add field for user in users: if user.get('email') == email: return user.get('userId') raise Exception('no user found with email ' + email)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_user_id(email: str):\n user_id = sdk.search_users(email=email)\n \n \"\"\" Customized logic block to check if an email address is associated with a Looker user\"\"\"\n if len(user_id) == 0: \n return 'There is no user associated with this email' \n else:\n return user_id[0]['id']", "def get_u...
[ "0.78303033", "0.7438993", "0.71716756", "0.7155806", "0.69510233", "0.6937138", "0.6776626", "0.6728193", "0.66594094", "0.66438246", "0.6626024", "0.6621654", "0.6596364", "0.6587094", "0.65866435", "0.6575921", "0.6572273", "0.6489863", "0.64741397", "0.64670396", "0.64641...
0.7865365
0
This function will execute each interval (default is 1 minute).
def fetch_incidents(rest_client, last_run): if last_run is None: last_run = dict() # get tenant ids tenant_mappings = rest_client.get_tenant_mappings() incidents = [] next_run = last_run max_fetch = int(demisto.params()['max_fetch']) if(len(tenant_mappings) > max_fetch): d...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def every_minute(self, time, function, args=None, kwargs=None, name=None):\n if args is None:\n args = list()\n if kwargs is None:\n kwargs = dict()\n if name is None:\n name = function.__name__+(f'_{len(self.config)+1}' if function.__name__ in self.config else...
[ "0.732588", "0.6826386", "0.66159225", "0.66091704", "0.6502294", "0.64287734", "0.63895667", "0.6377526", "0.62778056", "0.62756276", "0.6271155", "0.6271155", "0.62393624", "0.62345225", "0.62265986", "0.6221327", "0.6162584", "0.6117105", "0.6114198", "0.61114275", "0.6108...
0.0
-1
Executes an integration command
def main(): demisto.info('Command being called is ' + demisto.command()) """ PARSE AND VALIDATE INTEGRATION PARAMS """ rest_client = RestClient( base_url=BASE_URL, verify=VERIFY_CERT, ) try: if demisto.command() == 'test-module': test_module(rest_cl...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def execute_command(self):\n raise Exception(\"Not implemented\")", "def do_command(self, args):\n pass", "async def execute(self):\n args = self._args\n\n channel = self.queue_host.exchanges['opc'].queues['commands'].channel\n exchange_name = self.queue_host.exchanges['opc']...
[ "0.6845437", "0.6557429", "0.6546253", "0.651708", "0.6507503", "0.6389345", "0.6384941", "0.63575554", "0.6332937", "0.6325971", "0.63181293", "0.6283834", "0.62829137", "0.62711304", "0.6265557", "0.6260155", "0.6253126", "0.62317187", "0.62226796", "0.61916816", "0.6169082...
0.5890211
48
Get latest backup files using Frappe utils, push them to S3 and remove local copy
def push_backup(args: Arguments) -> None: files = get_files_from_previous_backup(args.site) bucket = get_bucket(args) for path in files: upload_file( path=path, site_name=args.site, bucket=bucket, bucket_directory=args.bucket_directory, ) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def upload_artifacts(ctx: Context, salt_version: str, artifacts_path: pathlib.Path):\n ctx.info(\"Preparing upload ...\")\n s3 = boto3.client(\"s3\")\n to_delete_paths: list[dict[str, str]] = []\n remote_path = f\"release-artifacts/{salt_version}\"\n try:\n ret = s3.list_objects(\n ...
[ "0.6482276", "0.6345482", "0.6258528", "0.6255586", "0.6162054", "0.6135203", "0.61243594", "0.609647", "0.60642684", "0.6008225", "0.59802324", "0.597014", "0.59692574", "0.59250724", "0.590495", "0.5896386", "0.58930147", "0.58853287", "0.5872126", "0.58527386", "0.58522874...
0.7075595
0
Prefix the ContentType objects of content items, to make them recognizable. Runs automatically at syncdb, and initial south model creation.
def _on_post_syncdb(app, verbosity=2, db=DEFAULT_DB_ALIAS, **kwargs): app_models = [m for m in get_models(app) if issubclass(m, ContentItem)] for model in app_models: update_model_prefix(model, verbosity=verbosity, db=db)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_contenttypes(sender, verbosity=2, db=DEFAULT_DB_ALIAS, **kwargs):\n from django.contrib.contenttypes.models import ContentType\n \n if verbosity >= 2:\n print(\"Running Djangae version of update_contenttypes on {}\".format(sender))\n\n try:\n apps.get_model('contenttypes', 'Con...
[ "0.61386204", "0.594458", "0.5770157", "0.5747259", "0.56587195", "0.555685", "0.5482608", "0.5481097", "0.53574556", "0.53456044", "0.52986324", "0.5290497", "0.52506703", "0.51700705", "0.5093248", "0.5090371", "0.5065744", "0.5023431", "0.50153744", "0.50094336", "0.500867...
0.6385645
0
Internal function to update all model prefixes.
def update_model_prefix(model, db=DEFAULT_DB_ALIAS, verbosity=2): prefix = "content:" ct = ContentType.objects.get_for_model(model) new_name = u"{0} {1}".format(prefix, model._meta.verbose_name_raw).strip() if ct.name != new_name: # Django 1.4/1.5 compatible .save(update_fi...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_ipam_prefixes_update(self):\n pass", "def test_ipam_prefixes_partial_update(self):\n pass", "def force_prefix_use(modeladmin, request, queryset):\n for obj in queryset.all() :\n obj.save()", "def rebuild_prefixes(vrf):\n def contains(parent, child):\n return child i...
[ "0.670243", "0.64542204", "0.6345608", "0.6326496", "0.62287533", "0.6184735", "0.6106257", "0.6028802", "0.5949916", "0.58989775", "0.5867867", "0.57160807", "0.5714598", "0.56702757", "0.5642338", "0.55902886", "0.55831724", "0.55579436", "0.5502311", "0.5485491", "0.548129...
0.56900597
13
Returns the calculated entropy (according to information theory) of the input message
def entropy(message): n = len(message) message = letter_freq(message) h = 0 for n_i in message.values(): p_i = n_i/n h += -p_i*(log2(p_i)) return h
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def entropy(message):\n message = letter_freq(message)\n n = sum(message.values())\n h = 0\n for n_i in message.values():\n p_i = n_i / n\n h += -p_i * log2(p_i)\n return h", "def entropy(message):\n # Should the import be here or should it be at the top of the page?\n freq_dic...
[ "0.8179265", "0.7819709", "0.7344961", "0.7160971", "0.7141463", "0.71327984", "0.7111015", "0.7095652", "0.706582", "0.70250344", "0.7019725", "0.700042", "0.69589937", "0.690922", "0.68974507", "0.68952984", "0.68520355", "0.6753812", "0.6741173", "0.67280805", "0.671165", ...
0.8245352
0
Given an OpenFF Interchange object, return singlepoint energies as computed by OpenMM.
def get_openmm_energies( interchange: Interchange, round_positions: Optional[int] = None, combine_nonbonded_forces: bool = True, detailed: bool = False, platform: str = "Reference", ) -> EnergyReport: if "VirtualSites" in interchange.collections: if len(interchange["VirtualSites"].key_ma...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_o_energies(mol):\n try:\n ev_to_hartree = 1./convertor(1,'hartree','eV')\n g=hack_parser.Gaussian(mol.calc.log, loglevel=50)\n d=g.parse()\n #lm, hm, lr\n o_component_es = np.array(d.oniomenergies)\n except AttributeError:\n return 0\n\n return (ev_to_hart...
[ "0.69773567", "0.65272796", "0.64571553", "0.6419705", "0.63294005", "0.62931216", "0.6201568", "0.6199804", "0.6066136", "0.6042173", "0.6034497", "0.5962602", "0.5949897", "0.592898", "0.5925742", "0.5923861", "0.590306", "0.58978987", "0.5897633", "0.58953375", "0.588566",...
0.53286237
89
Given prepared `openmm` objects, run a singlepoint energy calculation.
def _get_openmm_energies( system: "openmm.System", box_vectors: Optional["openmm.unit.Quantity"], positions: "openmm.unit.Quantity", round_positions: Optional[int], platform: str, ) -> dict[int, "openmm.unit.Quantity"]: for index, force in enumerate(system.getForces()): force.setForceGro...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def build_run_measure_openmm(structure, **kwargs):\n omm_system = structure.createSystem()\n\n integrator = openmm.VerletIntegrator(1.0)\n omm_context = openmm.Context(omm_system, integrator)\n omm_context.setPositions(structure.positions)\n\n set_omm_force_groups(omm_context)\n omm_force_groups ...
[ "0.6112542", "0.5922958", "0.585084", "0.561577", "0.5584573", "0.5571478", "0.5524176", "0.55001503", "0.54017144", "0.5376265", "0.5375187", "0.53144336", "0.5312692", "0.53094465", "0.53049", "0.5304483", "0.5300311", "0.5288765", "0.52692515", "0.5239305", "0.5211899", ...
0.0
-1
ExtraLink a model defined in OpenAPI
def __init__(self, class_ref=None, name=None, href=None): # noqa: E501 self.openapi_types = { 'class_ref': ClassReference, 'name': str, 'href': str } self.attribute_map = { 'class_ref': 'class_ref', 'name': 'name', 'href':...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_object_model_with_ref_props(self):\n from petstore_api.model import object_model_with_ref_props\n endpoint = self.api.object_model_with_ref_props\n assert endpoint.openapi_types['body'] == (object_model_with_ref_props.ObjectModelWithRefProps,)\n assert endpoint.settings['respon...
[ "0.55761033", "0.54850143", "0.5365918", "0.5328872", "0.53111845", "0.5306137", "0.5266135", "0.52364784", "0.522757", "0.51772225", "0.51772225", "0.51772225", "0.51772225", "0.51772225", "0.5171709", "0.515112", "0.51228297", "0.5117517", "0.5115439", "0.507241", "0.500767...
0.0
-1
Returns the dict as a model
def from_dict(cls, dikt) -> 'ExtraLink': return util.deserialize_model(dikt, cls)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def from_dict(cls, dikt) -> 'ModelClass':\n return util.deserialize_model(dikt, cls)", "def to_dict_model(self) -> dict:\n return dict((key, getattr(self, key)) for key in self.__mapper__.c.keys())", "def from_dict(cls, dikt):\n return util.deserialize_model(dikt, cls)", "def from_dict(cls, ...
[ "0.6939894", "0.68444926", "0.67725724", "0.67725724", "0.67725724", "0.67725724", "0.67725724", "0.67725724", "0.6739522", "0.6698291", "0.6698291", "0.66464084", "0.66383654", "0.66022646", "0.660082", "0.65999925", "0.6593835", "0.6580194", "0.65621036", "0.64150435", "0.6...
0.0
-1
Gets the class_ref of this ExtraLink.
def class_ref(self): return self._class_ref
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_class(self):\n\t\treturn self.CLASS", "def class_id(self):\n return self._class_id", "def get_class_attribute(self):\n return self.class_attr", "def _class(self):\n return self.__class", "def class_id(self) -> str:\n return self._class_id", "def class_id(self) -> str:\...
[ "0.65787274", "0.6499837", "0.6441003", "0.633477", "0.6297404", "0.6297404", "0.60447276", "0.6017914", "0.5997474", "0.5912678", "0.59080553", "0.5890727", "0.586411", "0.5799989", "0.5785895", "0.57600605", "0.57169163", "0.56916183", "0.5678962", "0.5666141", "0.56647825"...
0.81063294
0
Sets the class_ref of this ExtraLink.
def class_ref(self, class_ref): self._class_ref = class_ref
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def class_id(self, class_id):\n\n self._class_id = class_id", "def _class(self, _class):\n\n self.__class = _class", "def _class(self, _class):\n\n self.__class = _class", "def set_ref(self, new_ref):\n self.__ref = new_ref", "def class_ref(self):\n return self._class_ref...
[ "0.66160256", "0.6506323", "0.6506323", "0.61303324", "0.5789517", "0.5653708", "0.5653708", "0.5644072", "0.56309736", "0.55408466", "0.55408466", "0.5468603", "0.54295385", "0.5406994", "0.53981334", "0.5388326", "0.5387655", "0.5356944", "0.5233787", "0.52302057", "0.51907...
0.8206257
0
Gets the name of this ExtraLink.
def name(self): return self._name
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def name(self):\n return utf82unicode(pn_link_name(self._impl))", "def get_name(self):\n return self.attributes[\"name\"]", "def get_name(self) -> str:\n\n return self.name_", "def get_name(self):\n\n return self.name", "def get_name(self):\n\n return self.name", "def g...
[ "0.79793715", "0.73502254", "0.7302598", "0.72630215", "0.72630215", "0.7255761", "0.7255761", "0.7251672", "0.7251672", "0.7251672", "0.7251672", "0.7251672", "0.7251672", "0.7251672", "0.7251672", "0.7251672", "0.7251672", "0.7250691", "0.7246036", "0.7225374", "0.7225374",...
0.0
-1
Sets the name of this ExtraLink.
def name(self, name): self._name = name
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_name(self, name):\n self._name = name", "def set_name(self, name):\n self.name = name", "def set_name(self, name):\n self.name = name", "def set_name(self, name):\n self.name = name", "def set_name(self, name):\n self.name = name", "def set_name(self, name):\n ...
[ "0.7728652", "0.77218515", "0.77218515", "0.77218515", "0.77218515", "0.77218515", "0.76941884", "0.76941884", "0.76355064", "0.76140046", "0.7613152", "0.76041967", "0.75440353", "0.7519226", "0.74782056", "0.74782056", "0.74360126", "0.74360126", "0.74360126", "0.74360126", ...
0.74247396
100
Gets the href of this ExtraLink.
def href(self): return self._href
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def href(self) -> str:\n result = self.get_href()\n if result is None:\n raise ValueError(f\"{self} does not have an HREF set.\")\n return result", "def link(self):\n\n return self._get_field(\"link\")", "def getLink(self):\n return self.link", "def self_link(sel...
[ "0.80556744", "0.7481927", "0.7338868", "0.7316095", "0.71438384", "0.70453143", "0.7006507", "0.7006507", "0.7006507", "0.680164", "0.67074895", "0.665252", "0.665252", "0.66413647", "0.65683997", "0.65450996", "0.64210737", "0.63979083", "0.6385649", "0.63120645", "0.624084...
0.80447865
2
Sets the href of this ExtraLink.
def href(self, href): self._href = href
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def item_href(self, item_href):\n\n self._item_href = item_href", "def link(self, link):\n\n self._set_field(\"link\", link)", "def link(self, link):\n\n self._link = link", "def link(self, link):\n\n self._link = link", "def link(self, link):\n\n self._link = link", "d...
[ "0.64866495", "0.641666", "0.6201337", "0.6201337", "0.6201337", "0.6201337", "0.6201337", "0.6201337", "0.6201337", "0.60863066", "0.60482925", "0.60482925", "0.5887726", "0.5863164", "0.57704544", "0.5733876", "0.5725257", "0.57206154", "0.57206154", "0.57206154", "0.572061...
0.8182388
3
Method implemented because some requests on LIMS can show up with the date from the past
def check_missing_requests(): logger.info("ETL Check for missing requests") timestamp = int((datetime.datetime.now() - datetime.timedelta(hours=12)).timestamp()) * 1000 job = Job( run="beagle_etl.jobs.lims_etl_jobs.fetch_new_requests_lims", args={"timestamp": timestamp, "redelivery": False}...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_no_exception_when_from_year_before_1900(self):\n req = MockRequest(self.env, args={\n 'from': '1899-12-23',\n 'daysback': 7,\n })\n\n TimelineModule(self.env).process_request(req)\n\n self.assertIn('prev', req.chrome['links'])", "def _pull_now(self) -> N...
[ "0.6138586", "0.61205035", "0.6061146", "0.60295343", "0.5786953", "0.5769886", "0.5762466", "0.5757017", "0.5725323", "0.5718065", "0.57095534", "0.5695891", "0.56839526", "0.56680936", "0.5663048", "0.5662488", "0.5654137", "0.56365186", "0.5601281", "0.55615973", "0.555852...
0.0
-1
Uses the observer and executer.
def eval_policy_on_env(self, eval_gym_env, eval_episodes=10, seed=None): if not seed: eval_gym_env.seed(seed) else: eval_gym_env.seed(int(time.time())) avg_reward = 0. for i in range(eval_episodes): state, done = eval_gym_env.reset(), False obs = self.observer(state) step =...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def executor(self):", "def notifyObservers(self):", "def on_execute(self):\n pass", "def run(self, executor: Interface):\n\n pass # pragma: no cover", "def __register_observer(self, observer, compoennt) -> None:", "def subscribe(observer):", "def subscribe(observer):", "def run(self):\...
[ "0.6913333", "0.66306674", "0.65690774", "0.64383584", "0.63694745", "0.63179404", "0.63179404", "0.6194209", "0.6138332", "0.61335045", "0.6038883", "0.6031641", "0.6019831", "0.59792256", "0.5950956", "0.5950693", "0.588202", "0.58610684", "0.58178425", "0.5801147", "0.5795...
0.0
-1
Generate clean sentences from the file
def read_article(file_name): file = open(file_name, "r") filedata = file.readlines() sentences = [] for sentence in filedata: print("\n{} text: \n{}".format(file_name,sentence)) sentences.append(sentence.replace("[^a-zA-Z]", " ").split(" ")) # filter charachter only return se...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def process_corpus(self):\n sentences = []\n sentence = []\n with open(str(self.file), encoding=self.encoding) as f:\n\n line = f.readline()\n\n while line:\n\n if line.startswith(\"#\"):\n line = f.readline()\n continu...
[ "0.68490344", "0.6470325", "0.6447792", "0.64451754", "0.64132017", "0.6397299", "0.6362248", "0.6347981", "0.63382953", "0.6333839", "0.6309777", "0.6303324", "0.63016754", "0.6287297", "0.6280071", "0.6278829", "0.62539476", "0.6235777", "0.62313247", "0.62124974", "0.62100...
0.6408179
5
Generate clean sentences from the, split it to sentences
def read_article_2(filename): file = open(filename, "r") filedata = file.readlines() sentences = sent_tokenize(filedata[0]) return sentences
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def split_to_sentences(data):\r\n sentences = data.split(\"\\n\")\r\n \r\n sentences = [s.strip() for s in sentences]\r\n sentences = [s for s in sentences if len(s) > 0]\r\n \r\n return sentences", "def sentences(self) -> List[str]:\n\t\treturn [sentence for sentence in re.split('(?<=[.!?])', ...
[ "0.73972976", "0.7306974", "0.71485263", "0.7101714", "0.70420176", "0.7011064", "0.6938881", "0.6938881", "0.6937656", "0.6851375", "0.6845624", "0.68308455", "0.679346", "0.67769057", "0.67711115", "0.6770663", "0.6763881", "0.67389876", "0.6727957", "0.67212", "0.6690192",...
0.0
-1
Merge sentences to one array
def merge_sentences(sentences): full_sentences = [] for sentence in sentences: for arr_word in sentence: full_sentences.append(arr_word) return full_sentences
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sentences(a, b):\n\n # TODO\n return []", "def sentences(self) -> List[str]:\n\t\treturn [self.text[start:end] for start, end in self.tokenizations]", "def sentences(self) -> List[str]:\n\t\treturn [self.text[start:end] for start, end in self.tokenizations]", "def sentences(self) -> List[str]:\n\t\...
[ "0.69770706", "0.6601281", "0.6601281", "0.64054155", "0.63674307", "0.636191", "0.62882817", "0.6285933", "0.6236928", "0.62270564", "0.6223481", "0.6192691", "0.61609006", "0.61104393", "0.6108619", "0.6108619", "0.6104886", "0.610436", "0.6091728", "0.60737956", "0.6059608...
0.7643958
0
Do pre processing data, tokenization, remove stop words, and stemming
def preprocessing(data): #tokenizer = RegexpTokenizer(r'\w+') # allow charachter only #words = tokenizer.tokenize(data) # tokenize : convert to words words = word_tokenize(data) # remove stop words & stemming new_words = [] for word in words: if word not in stop_words: new_wo...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _preprocess(self):\n self.data['sentences'] = self.data['text'].apply(self._tokenize_sent)\n self.data['nouns'] = self.data['sentences'].apply(self._get_nouns)\n # self._get_frequent_features()\n # self._compactness_pruning()\n # self._redundancy_pruning()\n # self._ge...
[ "0.770828", "0.73175377", "0.71628886", "0.69962186", "0.69881225", "0.6972407", "0.69602007", "0.6924144", "0.6921391", "0.6892576", "0.6868782", "0.6824503", "0.6817865", "0.6762162", "0.67592436", "0.6708688", "0.6693218", "0.6692617", "0.66874915", "0.66873366", "0.668497...
0.82242334
0
Call in a loop to create terminal progress bar
def printProgressBar (iteration, total, prefix = '', suffix = '', decimals = 1, length = 100, fill = '█', printEnd = "\r"): percent = ("{0:." + str(decimals) + "f}").format(100 * (iteration / float(total))) filledLength = int(length * iteration // total) bar = fill * filledLength + '-' * (length - filledLen...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def make_progress_bar():\n\n if simple_tregex_mode:\n total_files = len(list(to_iterate_over.keys()))\n else:\n total_files = sum(len(x) for x in list(to_iterate_over.values()))\n\n par_args = {'printstatus': kwargs.get('printstatus', True),\n 'root': r...
[ "0.7400073", "0.7334518", "0.73030293", "0.72114635", "0.7152515", "0.7069976", "0.70643955", "0.70033044", "0.69770426", "0.697326", "0.6963388", "0.69553655", "0.69377124", "0.6929504", "0.6929504", "0.6929504", "0.6927856", "0.6923215", "0.691907", "0.691907", "0.69161355"...
0.68686455
33
Write result data to csv file
def write_tocsv(file_name, dataframe) : print("\nSaved result to {}\n".format(file_name)) dataframe.to_csv(file_name, mode='a', header=False,index=False)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def write_to_file(self, results):\n with open(self.outputFilename, \"w\") as csvFile:\n csvWriter = csv.writer(csvFile, delimiter=',') \n title_row = ('asset_id', 'component_id', 'latitude', 'longitude', 'installation_date', 'commissioning_date', 'street_name', 'cabinet_id', 'nominal...
[ "0.8265759", "0.7976227", "0.75813466", "0.7534625", "0.7492239", "0.7474653", "0.74614465", "0.74249005", "0.73776114", "0.7330693", "0.7322222", "0.7311779", "0.7279791", "0.72057503", "0.713426", "0.71226794", "0.71214706", "0.71208364", "0.71052146", "0.71013534", "0.7061...
0.6832679
55
How many users, activities and trackpoints are there in the dataset (after it is inserted into the database).
def query_one( self, table_name_users, table_name_activities, table_name_trackpoints ): query = ( "SELECT UserCount.NumUsers, ActivitiesCount.NumActivities, TrackpointCount.NumTrackpoints FROM " "(SELECT COUNT(*) as NumUsers FROM %s) AS UserCount," "(SELECT COUNT...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def count_data(self):\n try:\n ndata = len(self.x)\n logger.info(\"Number of data points: {0}\".format(ndata))\n except AttributeError:\n logger.error(\"Data object has not been defined\")\n ndata = 0\n return ndata", "def data_count(self):\n ...
[ "0.6853051", "0.6658661", "0.664958", "0.6428513", "0.63957375", "0.63667643", "0.6333834", "0.6332495", "0.63258004", "0.63125545", "0.6310754", "0.62764007", "0.62463677", "0.62404114", "0.6239707", "0.62346345", "0.6213612", "0.62124205", "0.62124205", "0.6201202", "0.6199...
0.5911083
66
Find the average, minimum and maximum number of activities per user.
def query_two(self, table_name): query = ( "SELECT MAX(count) as Maximum," "MIN(count) as Minimum," "AVG(count) as Average " "FROM (SELECT COUNT(*) as count FROM %s GROUP BY user_id) as c" ) self.cursor.execute(query % (table_name)) rows ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_user_avg(self, user):\n return calculate_user_numbers_avg(self._users_numbers, user)", "def compute_average_user_ratings(user_ratings):\n ave_ratings = {}\n \n for user,value in user_ratings.items():\n sum = 0\n movie_num=0\n for movieId, rating in value.items():\n ...
[ "0.6556652", "0.64607126", "0.61150926", "0.5986113", "0.59564763", "0.5658955", "0.5640222", "0.5634688", "0.5570091", "0.5513974", "0.55059135", "0.55002326", "0.54869884", "0.54645264", "0.54579765", "0.542411", "0.540431", "0.53959054", "0.5368874", "0.53450465", "0.53322...
0.0
-1
Find the top 10 users with the highest number of activities
def query_three(self, table_name_activities): query = ( "SELECT user_id, COUNT(*) as Count " "FROM %s " "GROUP BY user_id " "ORDER BY Count DESC " "LIMIT 10" ) self.cursor.execute(query % table_name_activities) rows = self.cur...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_all_from_top_ten(title,users,max = 3):\n \"\"\" ten prolific users \"\"\"\n \"\"\" max : number of user with related followers \"\"\"\n getAllUsers(users,all_users,users_set,proceeded_users,max,user_cpt,title)\n for data in users_set:\n print(data.id)", "def get_top(n=10):\r\n sql ...
[ "0.7368929", "0.7344022", "0.6710669", "0.66784954", "0.6555825", "0.6535713", "0.64940435", "0.6468146", "0.64122295", "0.6393935", "0.6384817", "0.6366222", "0.6358851", "0.63547736", "0.6283554", "0.6283363", "0.6254878", "0.6236455", "0.6217411", "0.6196639", "0.61705524"...
0.6007872
31
Find the number of users that have started the activity in one day and ended the activity the next day.
def query_four(self, table_name): query = ( "SELECT user_id, COUNT(*) as NumActivites " "FROM %s " "WHERE DATEDIFF(start_date_time, end_date_time) = -1 " "GROUP BY user_id " ) self.cursor.execute(query % (table_name)) rows = self.cursor.f...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def count_events(self, time_from='', time_to=''):\n count_from, count_up = self._validate_input(time_from, time_to)\n\n count = 0\n #assimption: the user more often is interested in newest data\n for i in reversed(self.events_by_seconds):\n if i[0] >= count_up:\n ...
[ "0.62942237", "0.6208868", "0.62016845", "0.6155571", "0.6101234", "0.59438586", "0.587805", "0.5864595", "0.5842169", "0.58003056", "0.5760895", "0.5736726", "0.57347304", "0.5697322", "0.566749", "0.5645066", "0.56308085", "0.56206423", "0.55819076", "0.5578228", "0.5560255...
0.57113695
13
Find activities that are registered multiple times. You should find the query even if you get zero results.
def query_five(self, table_name_activities): query = ( "SELECT user_id, transportation_mode, start_date_time, end_date_time, COUNT(*) AS NumDuplicates " "FROM %s " "GROUP BY user_id, transportation_mode, start_date_time, end_date_time " "HAVING NumDuplicates >1 " ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_list_activity_occurrences(self):\n pass", "def get_activities(self, user_id=None, group_id=None, app_id=None,\n activity_id=None, start_index=0, count=0):\n raise NotImplementedError()", "def activities(self):\n return self._activities", "def __ui_find_activities...
[ "0.63341004", "0.57011014", "0.5677445", "0.56412303", "0.5640431", "0.5504351", "0.546893", "0.5462067", "0.5432692", "0.54266936", "0.5410815", "0.53793097", "0.53693116", "0.5323399", "0.5299379", "0.5280299", "0.5255576", "0.52236176", "0.52144575", "0.52102506", "0.52045...
0.5983168
1
Find the number of users which have been close to each other in time and space (Covid19 tracking). Close is defined as the same minute (60 seconds) and space (100 meters).
def query_six(self, table_name_activities, table_name_trackpoints): query = ( "SELECT t1.user_id, t1.lat, t1.lon, t2.user_id, t2.lat, t2.lon " "FROM (SELECT user_id, lat, lon, date_time FROM %s inner join %s on Activity.id=TrackPoint.activity_id) as t1, " "(SELECT user_id, l...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def nearby_openness(game, player):\n radius = 4\n nearby_legal_move_count = 0\n\n current_location = game.get_player_location(player)\n\n min_row = current_location[0] - radius\n max_row = current_location[0] + radius + 1\n min_col = current_location[1] - radius\n max_col = current_location[1]...
[ "0.5593727", "0.54564375", "0.5203057", "0.5095816", "0.50687665", "0.50595754", "0.5052626", "0.5024759", "0.5016105", "0.4969579", "0.4965821", "0.49551564", "0.49421763", "0.49245408", "0.4910931", "0.4900106", "0.48929957", "0.48916903", "0.48914006", "0.48905036", "0.488...
0.5606755
0
Find all users that have never taken a taxi.
def query_seven(self, table_name_activities): query = ( "SELECT user_id " "FROM %s " "WHERE transportation_mode != 'taxi' AND transportation_mode <> 'None' " "GROUP BY user_id " ) self.cursor.execute(query % table_name_activities) rows = ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def tempfeeder_exp_nonzerotest_users():\n\n return [ user for user in tempfeeder_exp().user_ids if all(tempfeeder_exp()[user]['Load']['2005-10-01 00:00':]) ]", "def get_users_with_missing_data() -> Set[str]:\n users_data = {user[\"_source\"][\"VENDOR_UUID\"] for user in Handlers.elastic_handler.get_all_tod...
[ "0.6743502", "0.63802767", "0.5801765", "0.56963134", "0.5683992", "0.5671036", "0.56634355", "0.5619132", "0.55887246", "0.55581975", "0.5511557", "0.5457748", "0.5431759", "0.54315454", "0.54289573", "0.5428021", "0.54184586", "0.53961635", "0.5393834", "0.53802973", "0.537...
0.0
-1
Find all types of transportation modes and count how many distinct users that have used the different transportation modes. Do not count the rows where the transportation mode is null.
def query_eight(self, table_name): query = ( "SELECT transportation_mode as TransportationMode, COUNT(DISTINCT user_id) as NumDistinctUsers " "FROM %s " "WHERE transportation_mode <> 'None' " "GROUP BY transportation_mode" ) self.cursor.execute(qu...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def active_type_counts(self):\n names = self.visible()\n return {\n 'total': names.count(),\n 'personal': len([n for n in names if n.is_personal()]),\n 'organization': len([n for n in names if n.is_organization()]),\n 'event': len([n for n in names if n.is_...
[ "0.61126447", "0.5563086", "0.55279905", "0.5462258", "0.5416903", "0.52652234", "0.5176184", "0.51421887", "0.5133025", "0.5132203", "0.5088221", "0.5081676", "0.50632614", "0.50608855", "0.502527", "0.49960738", "0.498637", "0.49753973", "0.49554306", "0.49297845", "0.49210...
0.57151276
1
a) Find the year and month with the most activities.
def query_nine_a(self, table_name_activities): query = ( "SELECT YEAR(start_date_time) as Year, MONTH(start_date_time) as Month, COUNT(*) AS ActivityCount " "FROM %s " "GROUP BY YEAR(start_date_time), MONTH(start_date_time) " "ORDER BY ActivityCount DESC " ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def most_common_month(df):\n common_month = df['month'].mode()[0]\n print(\"Most common month is {}.\".format(get_month_name(common_month)))", "def get_month_most_posts(dates):\n posts_yr_mo = [post_date.strftime(\"%Y-%m\") for post_date in dates]\n posts_frequency = collections.Counter(posts_yr_mo)\...
[ "0.635691", "0.62816685", "0.5969048", "0.5869156", "0.58485764", "0.5803788", "0.57649577", "0.57571036", "0.57255596", "0.57208604", "0.5712416", "0.5706924", "0.5705092", "0.5695326", "0.56618917", "0.5649617", "0.5642169", "0.5630825", "0.5629095", "0.5619249", "0.5619231...
0.54729927
43
b) Which user had the most activities this year and month, and how many recorded hours do they have? Do they have more hours recorded than the user with the second most activities?
def query_nine_b(self, table_name_activities): query = ( "SELECT user_id, COUNT(*) AS ActivityCount" ", SUM(TIMESTAMPDIFF(HOUR, start_date_time, end_date_time)) as HoursActive " "FROM %s " "WHERE YEAR(start_date_time) = '2008' AND MONTH(start_date_time) = '11' " ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def time_stats(df):\n\n print('\\nCalculating The Most Frequent Times of Travel...\\n')\n start_time = time.time()\n\n # TO DO: display the most common month\n if len(df['Month'].unique()) != 1:\n a = df['Month'].mode()[0]\n print('The most popular month: ', a)\n\n # TO DO: display th...
[ "0.6475652", "0.64616454", "0.64578974", "0.64363235", "0.64292324", "0.6413384", "0.6412211", "0.640618", "0.6394706", "0.6383782", "0.63697183", "0.6365011", "0.63590086", "0.63465524", "0.6344959", "0.6342446", "0.6331201", "0.6329994", "0.63283557", "0.6324795", "0.632194...
0.6653954
0
Find the total distance (in km) walked in 2008, by user with id=112.
def query_ten(self, table_name_activities, table_name_trackpoints): query = ( "SELECT Activity.id,lat,lon " "FROM %s INNER JOIN %s on Activity.id = TrackPoint.activity_id " "WHERE user_id='112' and " "EXTRACT(YEAR FROM date_time) = 2008 " "and transpo...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_total_distance_by_user_on_foot(self, user_id: int):\n return self._get_total_distance_by_user(user_id, [ActivityType.Run, ActivityType.Walk])", "def get_position_total_distance_on_foot(self, user_id: int):\n return self._get_position_total_distance(user_id, [ActivityType.Run, ActivityType.W...
[ "0.74692726", "0.7009982", "0.6886206", "0.6750707", "0.66686654", "0.6530963", "0.62489533", "0.6235815", "0.6079774", "0.6079774", "0.6017214", "0.59642243", "0.58515024", "0.58402413", "0.5767565", "0.5739665", "0.57288766", "0.572131", "0.56991506", "0.5686757", "0.566886...
0.0
-1
Find the top 20 users who have gained the most altitude meters
def query_eleven(self, table_name_activities, table_name_trackpoints): query = ( "SELECT user_id, SUM(AltitudeTPTable.altitudeGained)*0.3048 AS MetersGained " "FROM %s INNER JOIN " " (SELECT id, activity_id, altitude, " " LAG(altitude) OVER (PARTITION BY acti...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getTopUsers(self):\n\n\t\tquery = \"\"\"select M.user_id, count( distinct M.venue_id) as cnt\n\t\t\t\t\tfrom\n\t\t\t\t\t(\n\t\t\t\t\tselect J.user_id, J.venue_id, J.latitude, J.longitude, J.Homelat, J.Homelong,\n\t\t\t\t\tCASE\n\t\t\t\t\t\tWHEN J.latitude = J.Homelat and J.longitude = J.Homelong THEN 1\n\t\t\t...
[ "0.6568995", "0.64117944", "0.62131083", "0.6068263", "0.6000632", "0.59643877", "0.5919633", "0.5916083", "0.5909876", "0.58972555", "0.58734846", "0.58697414", "0.583949", "0.5798814", "0.57958525", "0.5750908", "0.57456726", "0.5744258", "0.5727581", "0.57115686", "0.56923...
0.52221084
50
Find all users who have invalid activities, and the number of invalid activities per user An invalid activity is defined as an activity with consecutive trackpoints where the timestamps deviate with at least 5 minutes.
def query_twelve(self, table_name_activity, table_name_trackpoint): query = ( "WITH data as (SELECT user_id, date_time, TrackPoint.id as tid, activity_id, LEAD(date_time) OVER(PARTITION BY activity_id ORDER BY TrackPoint.id ASC) AS next_date_time, TIMESTAMPDIFF(MINUTE, date_time, LEAD(date_time) OVE...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_inactive_attendeelog_user_count(self, activeperiod_weeks=5):\n now = self.now\n total_user_count = len(list(self.client.smartsleep.attendeelogs.find({}).distinct(\"userId\")))\n result = []\n for i in range(activeperiod_weeks):\n pipeline = [\n {'$matc...
[ "0.62612104", "0.5898992", "0.58427453", "0.5635241", "0.5570983", "0.5561916", "0.5539598", "0.55278444", "0.5491312", "0.54186136", "0.54101896", "0.5398005", "0.53636575", "0.5359293", "0.5319331", "0.5274794", "0.52292824", "0.5228865", "0.5228001", "0.5214863", "0.521341...
0.5734951
3
show the index page
def show_homepage(): return render_template("blank-slate.html")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show_index_page():\n\n return render_template('index.html')", "def index():\n return render_template(\"index.html\",\n title='Index')", "def index(self):\n\t\treturn render_template('index.html')", "def index():\r\n return render_template('index.html')", "def ...
[ "0.84962547", "0.8126018", "0.8078417", "0.80677384", "0.80667824", "0.80554676", "0.8025317", "0.8025317", "0.80098003", "0.79683125", "0.79594547", "0.79392713", "0.79071647", "0.7883275", "0.7883275", "0.7875503", "0.78479445", "0.7777909", "0.77555305", "0.7745303", "0.77...
0.0
-1
For a given transfer sent to echo node, get the corresponding echoed transfer
def get_echoed_transfer(sent_transfer): app = address_to_app[sent_transfer.initiator] events = RaidenAPI(app.raiden).get_raiden_events_payment_history( token_address=token_address, ) def is_valid(event): return ( type(event) == EventPaymentReceive...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_transfer(self):\n return self._transfer", "def get_transfer_output_and_socket(ftp):\n try:\n transfer_type = transfer_menu()\n if transfer_type == \"1\":\n output, sock = ftp.port_cmd()\n elif transfer_type == \"2\":\n output, sock = ftp.pasv_cmd()\n ...
[ "0.5897282", "0.5155022", "0.5014647", "0.48934287", "0.48728555", "0.48627025", "0.48430175", "0.48427844", "0.4825058", "0.48053637", "0.47954482", "0.47850862", "0.47134098", "0.47083998", "0.4707706", "0.46917704", "0.4689539", "0.46554816", "0.46517766", "0.46489337", "0...
0.7087603
0
Return transfers received from echo_node when there's size transfers
def received_is_of_size(size): received = {} # Check that payout was generated and pool_size_query answered for handled_transfer in echo_node.seen_transfers: event = get_echoed_transfer(handled_transfer) if not event: continue received[event.id...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def BytesTransferred(self) -> int:", "def transfers(self):\n return _app_ctx_stack.top.zodb_connection.getTransferCounts()", "def get_bytes(records):\n return sum(r.transferred for r in records)", "def _get_echo_req_received_count(self):\n return self.__echo_req_received_count", "def _read_amt...
[ "0.62432814", "0.6062504", "0.57977045", "0.5765989", "0.576336", "0.5635981", "0.5635981", "0.55966115", "0.5589202", "0.5579786", "0.5575089", "0.5562043", "0.5562043", "0.55575556", "0.554723", "0.5467275", "0.53753185", "0.5346317", "0.53416675", "0.53409755", "0.5324103"...
0.60135996
2
get users from cohort
def get_users(cohort_expr): if search(COHORT_REGEX, cohort_expr): logging.info(__name__ + ' :: Processing cohort by expression.') users = [user for user in parse_cohorts(cohort_expr)] else: logging.info(__name__ + ' :: Processing cohort by tag name.') try: id = query...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_cohort_users(self, cohort):\n\t\tusers = []\n\t\tfor user, reg_date in self.customers.items():\n\t\t\tif self.is_cohort_user(cohort, reg_date):\n\t\t\t\tusers.append(user)\n\t\treturn users", "def users_in_cohort(request, course_key, cohort_id):\r\n # this is a string when we get it here\r\n course...
[ "0.8198461", "0.7491016", "0.72478765", "0.66976625", "0.66073895", "0.62768614", "0.626364", "0.62111694", "0.6118152", "0.6110392", "0.609846", "0.60714495", "0.6069182", "0.60221547", "0.60120255", "0.5936842", "0.5910387", "0.58776534", "0.5835856", "0.5805271", "0.579809...
0.72273976
3
Get the latest refresh datetime of a cohort. Returns current time formatted as a string if the field is not found.
def get_cohort_refresh_datetime(utm_id): # @TODO MOVE DB REFS INTO QUERY MODULE conn = dl.Connector(instance=settings.__cohort_data_instance__) query = """ SELECT utm_touched FROM usertags_meta WHERE utm_id = %s """ conn._cur_.execute(query, int(utm_id)) utm_touched = None try: utm_tou...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_last_meas_time(self):\n\n #if flag for whole data regeneration is set\n if self._process_type == 'full_gen':\n return datetime.datetime(1900, 1, 1, 0, 0, 0)\n \n \n res = self._db.Query(\"\"\"SELECT last_measurement_time\n FROM last...
[ "0.62165296", "0.616487", "0.6088386", "0.60617465", "0.6045005", "0.5971621", "0.5926703", "0.5917341", "0.59016716", "0.58545", "0.5838771", "0.5812011", "0.57949024", "0.5793899", "0.57753074", "0.57753074", "0.5775221", "0.5765011", "0.5749749", "0.5748395", "0.5720312", ...
0.7260143
0
Extract data from the global hash given a request object. If an item is successfully recovered data is returned
def get_data(request_meta, hash_result=True): hash_table_ref = read_pickle_data() # Traverse the hash key structure to find data # @TODO rather than iterate through REQUEST_META_BASE & # REQUEST_META_QUERY_STR look only at existing attributes logging.debug(__name__ + " - Attempting to pull data...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read_request(self, request):\n adapter = self.url_map.bind_to_environ(request.environ)\n endpoint, values = adapter.match()\n\n request_data = request.get_data(as_text=True)\n param = json.loads(request_data) if request_data else {}\n\n context_data = request.headers.get('X-S...
[ "0.56379586", "0.5580467", "0.54474115", "0.54155", "0.5414851", "0.53585744", "0.5352306", "0.53308815", "0.531813", "0.5292978", "0.5292057", "0.5272722", "0.5263837", "0.5239827", "0.52351373", "0.5232972", "0.5226501", "0.5200576", "0.5200576", "0.5200576", "0.51960737", ...
0.60611254
0
Given request metadata and a dataset create a key path in the global hash to store the data
def set_data(data, request_meta, hash_result=True): hash_table_ref = read_pickle_data() key_sig = build_key_signature(request_meta, hash_result=hash_result) logging.debug(__name__ + " :: Adding data to hash @ key signature = {0}". format(str(key_sig))) if hash_result: key_sig_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def make_external_key(self, data):\n return data['key']", "def upload():\n \n if request.method == 'GET':\n return jsonify({'status': 'Error!', 'message': 'Please use POST request'})\n else:\n data = session['data']\n arg1 = data['arg1'].lower()\n rel = data['rel'].low...
[ "0.57468635", "0.54577863", "0.5405114", "0.5376858", "0.53746635", "0.5367215", "0.5360612", "0.53402084", "0.5338125", "0.53335136", "0.53268045", "0.5267196", "0.5259356", "0.52559704", "0.5184614", "0.51756406", "0.5161057", "0.5160552", "0.5157643", "0.5156853", "0.51519...
0.617912
0
For each key in the key signature add a nested key to the hash.
def find_item(hash_table_ref, key_sig): if not hasattr(key_sig, '__iter___'): key_sig = [key_sig] last_item = key_sig[len(key_sig) - 1] for key in key_sig: if key != last_item: if hasattr(hash_table_ref, 'keys') and key in hash_table_ref: hash_table_ref = hash_ta...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _newKey(self, key):\n self._testKeySubNsAdd()\n self._getKeyList().append(key)", "def _flatten_dict(self, current, key, result):\n if isinstance(current, dict):\n for k in current:\n new_key = \"{1}\".format(key, k) if len(key) > 0 else k\n self._...
[ "0.5783704", "0.5574495", "0.5439365", "0.5429668", "0.53853", "0.53718305", "0.5360993", "0.5336976", "0.53031284", "0.52700204", "0.5266226", "0.5253205", "0.52503717", "0.524463", "0.52181035", "0.52034426", "0.51844513", "0.51731294", "0.51377225", "0.51211125", "0.510207...
0.0
-1
Given a RequestMeta object contruct a hashkey.
def build_key_signature(request_meta, hash_result=False): key_sig = list() # Build the key signature -- These keys must exist for key_name in REQUEST_META_BASE: key = getattr(request_meta, key_name) if key: key_sig.append(key_name + HASH_KEY_DELIMETER + key) else: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_key(\n request: PreparedRequest,\n ignored_params: Iterable[str] = None,\n include_get_headers: bool = False,\n **kwargs,\n) -> str:\n key = hashlib.sha256()\n key.update(encode((request.method or '').upper()))\n url = remove_ignored_url_params(request, ignored_params)\n url = ur...
[ "0.6666289", "0.6348019", "0.61674154", "0.6050588", "0.5945049", "0.5932106", "0.5922866", "0.5905479", "0.5856865", "0.5832915", "0.581081", "0.580476", "0.5729224", "0.571339", "0.5685138", "0.5685138", "0.56837296", "0.56794053", "0.5674972", "0.56635183", "0.56480783", ...
0.68788236
0
Compose a url from a set of keys
def get_url_from_keys(keys, path_root): query_str = '' for key in keys: parts = key.split(HASH_KEY_DELIMETER) if parts[0] in REQUEST_META_BASE: path_root += parts[1] + '/' elif parts[0] in REQUEST_META_QUERY_STR: query_str += parts[0] + '=' + parts[1] + '&' i...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def make_url(api_key, url, args=None):\n if args is None:\n args = []\n argsep = '&'\n if '?' not in url:\n argsep = '?'\n if '?apiKey=' not in url and '&apiKey=' not in url:\n args.insert(0, ('apiKey', api_key))\n return url + argsep + '&'.join(['='.join(t) for t in args])", ...
[ "0.6878986", "0.65894485", "0.649509", "0.6402911", "0.6257756", "0.60850906", "0.60804915", "0.6013498", "0.5980712", "0.5920877", "0.58935153", "0.58797026", "0.5854093", "0.58360004", "0.57937574", "0.5785422", "0.57762593", "0.57590055", "0.5758113", "0.5753998", "0.57346...
0.7288405
0
Ajoute la position de l'objet tracket dans point_que
def tick(self, iteration): frame = self.cam.get_current_fram() hsv = cv2.cvtColor(frame, cv2.COLOR_BGR2HSV) # on recupaire la zone qui on les zone de couleur mask = cv2.inRange(hsv, self.greenLower, self.greenUpper) # on fait une erosion et dilation pour supprimer les petit pixel...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setPosicion(self, posicion):\r\n\t\tif(isinstance(posicion, list)):\r\n\t\t\tself._x=posicion[0]+30\r\n\t\t\tself._y=posicion[1]+30\r\n\t\telse:\r\n\t\t\tself._x=posicion\r\n\t\t\r\n\t\tfor objeto in self.getObjetos():\r\n\t\t\tobjeto.setPosicion([self._x, self._y])", "def _add_point(self):\r\n self.c...
[ "0.62889117", "0.6213632", "0.61268955", "0.6069509", "0.6032954", "0.59505355", "0.5949627", "0.590713", "0.58873296", "0.588555", "0.5879063", "0.5860175", "0.5839", "0.5826849", "0.5817833", "0.58172137", "0.581329", "0.5798887", "0.579534", "0.5791834", "0.576231", "0.5...
0.0
-1
To determine whether a coor in inside or on the fringe of a rectangular coor is a tuple of two numbers. rec is represented with a list of 4 coor of the 4 corner
def isIn(self, coor, rec): x, y = coor[0], coor[1] top, bottom, left, right = rec[1][1], rec[0][1], rec[0][0], rec[1][0] # print(top, bottom, left, right) if left <= x <= right and bottom <= y <= top: return True else: return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def corners((u,v)):\r\n return ((u+1,v+1), (u+1,v), (u,v), (u,v+1))", "def overlap_rect(rec1, rec2):\n # true if rec2 is left of rec1\n a = rec2[2] <= rec1[0]\n \n # true if rec2 is right of rec1\n b = rec1[2] <= rec2[0]\n\n # true if rec2 is below rec1\n c = rec2[3] <= rec1[1]\n\n # t...
[ "0.59030926", "0.58912385", "0.58596796", "0.5801079", "0.57638234", "0.5733983", "0.57246816", "0.57164705", "0.5706039", "0.5702762", "0.5688784", "0.5657079", "0.564293", "0.5626091", "0.56171894", "0.5584251", "0.5580394", "0.5574595", "0.55681694", "0.55593956", "0.55397...
0.7361468
0
(A,B), (C,D) first rectangular (E,F), (G,H) second rectagular
def computeArea(self, A, B, C, D, E, F, G, H): R1 = [(A, B), (C, D), (A, D), (C, B)] R2 = [(E, F), (G, H), (E, H), (G, F)] R1_left, R1_top, R1_bot, R1_right = A, D, B, C R2_left, R2_top, R2_bot, R2_right = E, H, F, G A1 = abs(D - B) * (C - A) A2 = abs(H - F) * (G - E) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rectangular(m, n, len1=1.0, len2=1.0, origin = (0.0, 0.0)):\n\n from anuga.config import epsilon\n\n delta1 = float(len1)/m\n delta2 = float(len2)/n\n\n #Calculate number of points\n Np = (m+1)*(n+1)\n\n class Index(object):\n\n def __init__(self, n,m):\n self.n = n\n ...
[ "0.67612845", "0.65351796", "0.645701", "0.6438335", "0.63801545", "0.63302", "0.63084996", "0.63055015", "0.62689954", "0.6236781", "0.6081016", "0.59229267", "0.59201443", "0.59141636", "0.59073967", "0.5877455", "0.5877189", "0.5833216", "0.58306074", "0.58298683", "0.5825...
0.54118913
67
Generate grid representation of the state space. grid_params stores default values for bounds and grid density; the function constructs a grid with dimensionality dims from these defaults
def get_grid(grid_params, dims): orders = np.array(object=grid_params["orders"][:dims], dtype=int) grid_min = np.array(object=grid_params["lower bounds"][:dims], dtype=float) grid_max = np.array(object=grid_params["upper bounds"][:dims], dtype=float) # calculate number of grid points and generate index...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_param_grid():\n layer_width = [32, 64, 128, 256, 512]\n layers = [2, 3, 4, 5, 6]\n epochs = [10, 25, 50, 75, 100]\n batch_size = [32, 64, 96, 128, 160, 192, 224, 256]\n activation = ['softmax', 'softplus', 'softsign', 'relu', 'tanh', 'sigmoid', 'hard_sigmoid', 'linear']\n init_mode = ['un...
[ "0.7363759", "0.7167829", "0.6743477", "0.6558941", "0.65435964", "0.6514001", "0.64314175", "0.63536054", "0.6307485", "0.6304103", "0.6289735", "0.62861055", "0.62022144", "0.6196542", "0.6194783", "0.61569643", "0.6149171", "0.61468774", "0.6132944", "0.6113889", "0.608744...
0.68191546
2
Generate array of corner points of the state space.
def get_corner_points(grid): grid_min = np.array(object=[min(v) for _, v in grid.items()]) grid_max = np.array(object=[max(v) for _, v in grid.items()]) grids_bounds = [] for idx in range(len(grid_min)): tmp = [grid_min[idx], grid_max[idx]] grids_bounds.append(tmp) corner_points =...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def corners(self):\n from pyresample.spherical_geometry import Coordinate\n return [Coordinate(*self.get_lonlat(0, 0)),\n Coordinate(*self.get_lonlat(0, -1)),\n Coordinate(*self.get_lonlat(-1, -1)),\n Coordinate(*self.get_lonlat(-1, 0))]", "def get_corne...
[ "0.70012945", "0.6696991", "0.65799963", "0.6470418", "0.6437975", "0.63477683", "0.62575823", "0.62310547", "0.6206653", "0.6133613", "0.61113983", "0.61113983", "0.60686356", "0.60627633", "0.60199773", "0.6007752", "0.5985887", "0.5978325", "0.59677327", "0.5954052", "0.59...
0.5747624
35
Generate array of points on grid defining smallest ongrid hypercube containing point
def get_local_grid(point, grid): dims = len(grid) grids_bounds = np.full((dims, 2), np.nan) for dim in range(dims): tmp = np.searchsorted(grid[dim], point[dim]) grids_bounds[dim, :] = [grid[dim][tmp - 1], grid[dim][tmp]] local_grid = pd.DataFrame( index=pd.MultiIndex.from_prod...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _build_point_grid(n_per_side: int) -> np.ndarray:\n offset = 1 / (2 * n_per_side)\n points_one_side = np.linspace(offset, 1 - offset, n_per_side)\n points_x = np.tile(points_one_side[None, :], (n_per_side, 1))\n points_y = np.tile(points_one_side[:, None], (1, n_per_side))\n points = np.stack([p...
[ "0.7237867", "0.6963283", "0.6799047", "0.67594856", "0.67146623", "0.6666462", "0.66065866", "0.65853643", "0.65587133", "0.6533811", "0.65252405", "0.6500858", "0.64939386", "0.64838934", "0.6470796", "0.6464449", "0.6411113", "0.64089125", "0.6374347", "0.63415265", "0.632...
0.59074724
72
Convert idx to state array structured according to dims_state_grid
def state_from_id(index, dims_state_grid): entries = [index] * len(dims_state_grid) for i in range(1, len(dims_state_grid)): value = 1 for j in range(i, len(dims_state_grid)): value *= dims_state_grid[j] for k in range(i - 1, len(dims_state_grid)): if k == i - 1:...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def process_state(state):\n grid = state.grid\n pos = state.pos\n reshaped_grid = np.reshape(grid,(1, grid_size*grid_size)) # Only use squared for square matrices\n reshaped_grid = reshaped_grid[0]\n processed_state = np.concatenate((pos, reshaped_grid))\n processed_state = np.array([processed_st...
[ "0.65787387", "0.6121556", "0.58805615", "0.5752284", "0.5732881", "0.5709797", "0.55998015", "0.55990964", "0.556733", "0.55428475", "0.5519896", "0.55152744", "0.5499255", "0.54791164", "0.54601943", "0.54572254", "0.5454298", "0.5431956", "0.5429013", "0.5424711", "0.54229...
0.7723534
0
Translate points to index values.
def states_to_ids_batch(states, dims_state_grid): n_states, _ = states.shape ids = [] for idx in range(n_states): id_tmp = state_to_id(states[idx, :], dims_state_grid) ids.append(id_tmp) return ids
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def points_to_index(points, points_dict):\r\n index_locations = ''\r\n for point in points:\r\n index_locations += str(points_dict[point]) + ' '\r\n return index_locations", "def Indexes(self, latitudes, longitudes):\n res = self._transform.TransformPoints(\n np.column_stack((longitudes...
[ "0.71840924", "0.64750713", "0.64227825", "0.63274735", "0.62110543", "0.6152875", "0.59822124", "0.5956086", "0.5905138", "0.5886118", "0.58825165", "0.5877754", "0.58519626", "0.58460754", "0.5814262", "0.57861626", "0.57795036", "0.5767887", "0.57640713", "0.57640713", "0....
0.0
-1
Calculate mean squared error. If ``x1`` and ``x2`` have different shapes, then they need to broadcast. This uses
def mse(x1, x2, axis=0): x1 = np.asanyarray(x1) x2 = np.asanyarray(x2) return np.mean((x1 - x2) ** 2, axis=axis)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mean_squared_error(x0, x1):\n return MeanSquaredError()(x0, x1)", "def msre(x1, x2, axis=0):\n x1 = np.asanyarray(x1)\n x2 = np.asanyarray(x2)\n return np.mean((((x1 - x2) ** 2) / x1), axis=axis)", "def _mean_squared_error(img1, img2):\n err = np.sum((img1.astype(\"float\") - img2.astype(\"f...
[ "0.8226302", "0.7394932", "0.70136625", "0.70063365", "0.68697226", "0.67129135", "0.659804", "0.65663034", "0.65424967", "0.64867127", "0.64791524", "0.6449142", "0.64091104", "0.63836336", "0.62251514", "0.6153482", "0.6134623", "0.6100003", "0.60949916", "0.59974325", "0.5...
0.7577179
1
Calculate mean squared relative error. If ``x1`` and ``x2`` have different shapes, then they need to broadcast. This uses
def msre(x1, x2, axis=0): x1 = np.asanyarray(x1) x2 = np.asanyarray(x2) return np.mean((((x1 - x2) ** 2) / x1), axis=axis)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mean_squared_error(x0, x1):\n return MeanSquaredError()(x0, x1)", "def mean_absolute_error(x0, x1):\n return MeanAbsoluteError()(x0, x1)", "def mse(x1, x2, axis=0):\n x1 = np.asanyarray(x1)\n x2 = np.asanyarray(x2)\n return np.mean((x1 - x2) ** 2, axis=axis)", "def _mean_squared_error(img1...
[ "0.8137443", "0.73585516", "0.71538997", "0.69549376", "0.6705897", "0.6618502", "0.65939456", "0.6451038", "0.6431475", "0.641674", "0.64155227", "0.6316561", "0.6163102", "0.6124665", "0.6085341", "0.60831666", "0.6047767", "0.6047288", "0.60459423", "0.60148704", "0.592659...
0.7301853
2
Calculate root mean squared error. If ``x1`` and ``x2`` have different shapes, then they need to broadcast. This uses
def rmse(x1, x2, axis=0): x1 = np.asanyarray(x1) x2 = np.asanyarray(x2) return np.sqrt(mse(x1, x2, axis=axis))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mean_squared_error(x0, x1):\n return MeanSquaredError()(x0, x1)", "def msre(x1, x2, axis=0):\n x1 = np.asanyarray(x1)\n x2 = np.asanyarray(x2)\n return np.mean((((x1 - x2) ** 2) / x1), axis=axis)", "def mse(x1, x2, axis=0):\n x1 = np.asanyarray(x1)\n x2 = np.asanyarray(x2)\n return np....
[ "0.78830373", "0.6943362", "0.6918558", "0.66584045", "0.6587478", "0.6457376", "0.6454971", "0.6395561", "0.6346547", "0.6341031", "0.62864375", "0.62465763", "0.61936325", "0.61884624", "0.60828555", "0.6082177", "0.60781324", "0.6035756", "0.59945077", "0.59528786", "0.588...
0.6822552
3
Calculate root mean squared error. If ``x1`` and ``x2`` have different shapes, then they need to broadcast. This uses
def rmsre(x1, x2, axis=0): x1 = np.asanyarray(x1) x2 = np.asanyarray(x2) return np.sqrt(msre(x1, x2, axis=axis))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mean_squared_error(x0, x1):\n return MeanSquaredError()(x0, x1)", "def msre(x1, x2, axis=0):\n x1 = np.asanyarray(x1)\n x2 = np.asanyarray(x2)\n return np.mean((((x1 - x2) ** 2) / x1), axis=axis)", "def mse(x1, x2, axis=0):\n x1 = np.asanyarray(x1)\n x2 = np.asanyarray(x2)\n return np....
[ "0.78830373", "0.6943362", "0.6918558", "0.6822552", "0.66584045", "0.6587478", "0.6454971", "0.6395561", "0.6346547", "0.6341031", "0.62864375", "0.62465763", "0.61936325", "0.61884624", "0.60828555", "0.6082177", "0.60781324", "0.6035756", "0.59945077", "0.59528786", "0.588...
0.6457376
6
Get a set of random points on the domain of grid.
def get_interpolation_points(n_interpolation_points, grid, seed): np.random.seed(seed) grid_min = np.array(object=[min(v) for _, v in grid.items()]) grid_max = np.array(object=[max(v) for _, v in grid.items()]) points = [] for _ in range(n_interpolation_points): tmp = np.random.uniform(0....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_random_coordinates(self):\n array_shape = np.shape(self.cells) # type: tuple\n points_on_island = []\n for i in range(1, array_shape[0] - 1):\n for j in range(1, array_shape[1] - 1):\n points_on_island.append((i, j))\n random.shuffle(points_on_island)\...
[ "0.7219115", "0.71041113", "0.7010273", "0.700256", "0.70018864", "0.6935927", "0.68557435", "0.68551815", "0.6830986", "0.6814087", "0.67759377", "0.66951215", "0.6693187", "0.6635074", "0.65569764", "0.6485395", "0.6473435", "0.64639235", "0.6447996", "0.6423992", "0.640099...
0.6146287
39
Create profile widget from user informations dict.
def __init__(self, user, enabled=True): super().__init__() self.setObjectName("user-profile") self.enabled = enabled self.setProperty("follow-mouse", enabled) image, label = _get_visuals(user) grid = QGridLayout(self) i = QLabel() i.setPixmap(image) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def build_profile(first, last, **user_info):\n profile = {}\n profile['first_name'] = first\n profile['last_name'] = last\n for key, value in user_info.items():\n profile[key] = value\n return profile", "def build_profile(first, last, **user_info):\n profile = {}\n profile['first_name...
[ "0.69571817", "0.69571817", "0.69571817", "0.69520533", "0.69520533", "0.6913372", "0.6913372", "0.68299747", "0.6767779", "0.6767779", "0.6752301", "0.6614258", "0.6593329", "0.64128584", "0.6249735", "0.6246323", "0.6173511", "0.6100821", "0.60407597", "0.60271084", "0.6003...
0.6058074
18
Turn a file path into a URL
def path2support(path): parts = path.split(os.path.sep) # return '{{ site.baseurl}}' + IPYTHON_STATIC_DIR + '/' + '/'.join(quote(part) for part in parts) return '/' + IPYTHON_STATIC_DIR + '/' + '/'.join(quote(part) for part in parts)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_file_url(path):\n return urlparse.urljoin(BASE_URL, path)", "def _convert_file_to_url(filename, no_file_check = False):\n if no_file_check: # We already a priori know that the path is\n # correct and in its final form.\n return filename\n relpath = os.path.relpath(fi...
[ "0.79446596", "0.767792", "0.7495302", "0.7358315", "0.73362863", "0.70479834", "0.6959773", "0.6959135", "0.69537735", "0.690852", "0.67228836", "0.661052", "0.6607363", "0.660014", "0.65753865", "0.6530164", "0.64898086", "0.6404596", "0.6398583", "0.63867885", "0.6377413",...
0.0
-1
Train model for for a given number of epochs.
def fit(epochs, model, loss_func, opt, train_dl, valid_dl): def train(): """Train model for one epoch.""" model.train() for batch_index, (xb, yb) in enumerate(train_dl): loss = loss_func(model(xb), yb) loss.backward() opt.step() opt.zero_grad(...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def train(self, num_batches: int):", "def train_epoch(self) -> None:\n ct = self.config.training\n total_games = self._get_total_games()\n print(f\"Total Games: {total_games}\")\n train_size = int(0.9 * total_games)\n dataset_wrapper = DatasetWrapper(self.config)\n self....
[ "0.77265793", "0.77243054", "0.7700947", "0.76428485", "0.76428485", "0.76428485", "0.76428485", "0.75783145", "0.7527398", "0.745544", "0.7444217", "0.7433514", "0.7363857", "0.7294065", "0.7261669", "0.724258", "0.7226634", "0.72216165", "0.7214876", "0.7212035", "0.7170914...
0.0
-1
Train model for one epoch.
def train(): model.train() for batch_index, (xb, yb) in enumerate(train_dl): loss = loss_func(model(xb), yb) loss.backward() opt.step() opt.zero_grad()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def train_one_epoch(self):\n raise NotImplementedError", "def train(self):\n\t\tself.model.fit(self.training_data, self.training_labels)", "def train_one_epoch(self):\n\t\tself.model.train()\n\t\ttrain_loss = 0\n\n\t\tfor batch_idx, data in enumerate(self.data_loader.train_loader):\n\t\t\tInput = data[0...
[ "0.8315642", "0.81158996", "0.8114996", "0.79934317", "0.7859999", "0.7832085", "0.7832085", "0.7832085", "0.7832085", "0.7796434", "0.7772746", "0.7626866", "0.7623582", "0.76182914", "0.7606001", "0.7599833", "0.7576834", "0.7571574", "0.75617", "0.756099", "0.755712", "0...
0.7229657
59
Evaluate model using the validation set.
def evaluate(): model.eval() with torch.no_grad(): loss, n = 0, 0 for xb, yb in valid_dl: n += len(xb) loss += loss_func(model(xb), yb) * len(xb) return loss/n
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def validate(self):\n self.set_model_mode('eval')\n self.evaluator.reset()\n losses = MetricMeter()\n\n print('Do evaluation on {} set'.format('valid set'))\n data_loader = self.val_loader\n assert data_loader is not None\n for batch_idx, batch in enumerate(data_loa...
[ "0.7556931", "0.7128", "0.6986451", "0.69822556", "0.688941", "0.6866641", "0.68387544", "0.67861927", "0.6768624", "0.6768624", "0.6768624", "0.6747499", "0.6704247", "0.66950506", "0.6688258", "0.66860074", "0.66801274", "0.6664884", "0.66432977", "0.66401047", "0.65844405"...
0.6838491
7
Return the number of parameters in a model.
def count_parameters(model): return sum(p.numel() for p in model.parameters() if p.requires_grad)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def count_parameters(model):\n return sum(p.numel() for p in model.parameters())", "def params_count(model):\n return np.sum([p.numel() for p in model.parameters()]).item()", "def params_count(model):\n return np.sum([p.numel() for p in model.parameters()]).item()", "def params_count(model):\n re...
[ "0.8990342", "0.8886125", "0.8886125", "0.8886125", "0.86882824", "0.86644685", "0.85944074", "0.85823697", "0.82456934", "0.8147633", "0.8140825", "0.81132555", "0.80860305", "0.8082424", "0.80382115", "0.7976145", "0.7976018", "0.7961161", "0.79545635", "0.79340714", "0.790...
0.7784798
29
Show rows cols random samples from a batch (without labels).
def show_random_samples(batch, rows=5, cols=5, width=None, height=None, shuffle=True): if width is None: width = 1.5*cols if height is None: height = 1.5*rows if rows * cols == 1: axes = [plt.subplots(rows, cols, figsize=(width, height))[1]] else: axes = plt.subplots(rows, cols, figsize...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show_samples(model, dataset, epoch, logs, X_dev_batch, y_dev_batch):\n\n for _ in range(10):\n ind = random_randint(0, len(X_dev_batch))\n row_X, row_y = X_dev_batch[np.array([ind])], y_dev_batch[np.array([ind])]\n preds = model.predict_classes(row_X, verbose=0)\n q = dataset.cha...
[ "0.64462656", "0.6371136", "0.63103604", "0.6304433", "0.622922", "0.6163216", "0.6106708", "0.59904164", "0.5981648", "0.59786355", "0.5977816", "0.5953265", "0.58819944", "0.5839658", "0.5830676", "0.5830318", "0.58296937", "0.5824432", "0.5812563", "0.58024067", "0.5784958...
0.79881436
0
Plot contours of the Rosenbrock function.
def rosenbrock_contour(iterates=None, **kwargs): n = 250 X, Y = np.meshgrid(np.linspace(-2,2,n), np.linspace(-1,3,n)) fig = plt.figure(figsize=(14,8)) plt.contour(X, Y, rosenbrock([X,Y]), np.logspace(-0.5, 3.5, 20, base=10), cmap='gray') if iterates is not None: if is...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def plot(self):\n cs = plt.contour(self.X, self.Y, self.fitness_function)\n plt.clabel(cs, inline=1, fontsize=6)\n plt.imshow(self.fitness_function, extent=self.limits, origin=\"lower\", alpha=0.3)", "def visualizeObs():\n fcontourf(fObs, [-2, 2], [-1, 1], [0, 10])", "def plot(self, sho...
[ "0.6784001", "0.6583707", "0.63503087", "0.61764383", "0.60584694", "0.60448533", "0.6000889", "0.59889704", "0.5978711", "0.59696746", "0.5913963", "0.5912123", "0.5906355", "0.58828205", "0.5813682", "0.57681537", "0.5752467", "0.57482666", "0.5734589", "0.5712594", "0.5704...
0.5794955
15
Load json dataset and make the corresponding csv file.
def load_negotiation(path:str, include_breakdown: bool, ratio: float): negos = read_cb_negotiations(path, include_breakdown) print("There are {} completed negotiations.".format(len(negos))) dataset = [] bad_count = 0 breakdown_count = 0 for nego in negos: # remove short negos i...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def convert_to_csv(self, json_file: str):\n with open(json_file) as file:\n data = json.load(file)\n data = data[\"data\"]\n csv_file = open(json_file.replace(\".json\", \".csv\"), \"w\")\n csv_writer = csv.writer(csv_file)\n counter = 0\n for dat in data:\n ...
[ "0.7199526", "0.7092647", "0.6702539", "0.65314573", "0.65116316", "0.643534", "0.64266366", "0.64121383", "0.6354227", "0.63163817", "0.6284062", "0.61596465", "0.6144278", "0.6121313", "0.6100036", "0.60588914", "0.60225195", "0.5998722", "0.5974078", "0.59552324", "0.59325...
0.0
-1
Adds schema copying to the end of a pipeline. When the pipeline already has a final node, then the all except the last command are run before the copying, and the last command after.
def add_schema_copying_to_pipeline(pipeline: Pipeline, schema_name, source_db_alias: str, target_db_alias: str, max_number_of_parallel_tasks: int = 4): task_id = "copy_schema" description = f"Copies the {schema_name} schema to the {target_db_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def append(self, pipeline):\n for stage in pipeline.pipe:\n self._pipe.append(stage)\n return self", "def _copy_chunk(self, last_pk):\n self.execute(self.commands.copy_chunk(\n self.name,\n self._join_cols(self.intersection.dest_columns),\n self._q...
[ "0.5802347", "0.5191208", "0.51351225", "0.51165193", "0.50928503", "0.5007843", "0.4984623", "0.4981267", "0.49188995", "0.4882613", "0.48803213", "0.4875119", "0.48523596", "0.48431078", "0.48389772", "0.48251715", "0.4806743", "0.47955215", "0.47856268", "0.47797322", "0.4...
0.6730207
0
In parallel copies a PostgreSQL database schema from one database to another.
def __init__(self, id: str, description: str, max_number_of_parallel_tasks: int, source_db_alias: str, target_db_alias: str, schema_name: str, commands_before: [Command] = None, commands_after: [Command] = None) -> None: ParallelTask.__init__(self, id=id, description=descripti...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def copy_db():\n local('ssh %s pg_dump -U djangoproject -c djangoproject | psql djangoproject' % env.hosts[0])", "def add_schema_copying_to_pipeline(pipeline: Pipeline, schema_name,\n source_db_alias: str, target_db_alias: str,\n max_number_o...
[ "0.6823745", "0.6743913", "0.6515709", "0.63620615", "0.63418174", "0.6229657", "0.6121605", "0.6039485", "0.59533983", "0.5924135", "0.59076077", "0.5904337", "0.5877737", "0.5842821", "0.58174336", "0.5815715", "0.57975674", "0.57704043", "0.57704043", "0.57704043", "0.5770...
0.0
-1
Method used to consume the message on queue. Each message consumed will be parsed into JSON and persisted.
def callback(ch, method, properties, body): ch.basic_ack(delivery_tag=method.delivery_tag) print("Message received.") data = json.loads(body) persist(data)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _consume(self):\n # HACK: run_in_executor is used as a workaround to use boto\n # inside a coroutine. This is a stopgap solution that should be\n # replaced once boto has support for asyncio or aiobotocore has\n # a stable release.\n loop = asyncio.get_event_loop()\n r...
[ "0.7836809", "0.7244888", "0.7192824", "0.6982618", "0.6722213", "0.6701658", "0.6691658", "0.65856177", "0.6574574", "0.6531187", "0.65226364", "0.6471834", "0.64599025", "0.64520967", "0.6444883", "0.643958", "0.6426473", "0.63961583", "0.6391661", "0.63453704", "0.6281284"...
0.57639724
66
This method persists the new person into the database.
def persist(data): conn = psycopg2.connect(host="localhost", database="integration", user="postgres", password="postgres") cursor = conn.cursor() cursor.execute(INSERT_SQL, (data["name"], data["gender"], data["age"])) conn.commit() cursor.close()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save_person(self, person_id, person_name, person_role):\n cursor = self.cur()\n cursor.execute('INSERT OR IGNORE INTO person (person_id, name, role) VALUES(?, ?, ?)',\n (person_id, person_name, person_role)\n )", "def save_to_db(self):\n db.sessi...
[ "0.72265494", "0.68144745", "0.68144745", "0.68144745", "0.68144745", "0.6811693", "0.6801439", "0.67714465", "0.6753683", "0.67497957", "0.6721458", "0.6708184", "0.6708184", "0.6708184", "0.6708184", "0.6708184", "0.6708184", "0.6708184", "0.6708184", "0.67071325", "0.67051...
0.0
-1
Method used to create the person table on database. If the table already exists, this method will do nothing.
def create_table(): conn = psycopg2.connect(host="localhost", database="integration", user="postgres", password="postgres") cursor = conn.cursor() cursor.execute(CREATE_TABLE) conn.commit() cursor.close()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_table(self):\n pass", "def create_table(self):\n conn = self._connect_DB()\n cur = conn.cursor()\n cur.execute(\n \"CREATE TABLE IF NOT EXISTS movie_table (movie_title, people);\"\n )\n self._close_connection(conn)", "def create_table(self):\n ...
[ "0.7659636", "0.74957687", "0.74600124", "0.729078", "0.72662866", "0.7202228", "0.71528435", "0.71517426", "0.7098275", "0.7090704", "0.69826895", "0.69454247", "0.6936875", "0.6917683", "0.6896005", "0.6888188", "0.6882808", "0.68811303", "0.68655616", "0.6858145", "0.68185...
0.0
-1
Returns the trajectories array as an array with 1 (V > threshold) and 0 (otherwise)
def discrete_potential(function, threshold): return np.where(function >= threshold, 1, 0)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def threshold(X, thresh):\n Y = np.array(X)\n Y[Y >= thresh] = 1\n Y[Y < thresh] = 0\n return Y", "def test_soft_threshold_array():\n a = np.array([10, -10, 200, -200])\n np.testing.assert_allclose(snet.soft_threshold(a, 100),\n np.array([0, 0, 100, -100]))\n np...
[ "0.64190406", "0.62131786", "0.6116671", "0.60645044", "0.60542023", "0.5986206", "0.59682226", "0.59193355", "0.5842515", "0.5794457", "0.5792247", "0.5713836", "0.570914", "0.5706414", "0.56742436", "0.5665527", "0.56390643", "0.5630857", "0.56308335", "0.56271976", "0.5613...
0.5882726
8
Get the indexes of the potential peaks
def get_peak_ind(discrete_array): indexes = [j for j in range(discrete_array.size) if discrete_array[j-1]==0 and\ discrete_array[j]==1] return indexes
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def peak_indices(self, **kwargs):\n kwarg_defaults = {\n 'width': 5, # ensure small spikes are ignored\n }\n kwarg_defaults.update(kwargs)\n return signal.find_peaks(self.ys, **kwarg_defaults)", "def peaks(self, **kwargs):\n peaks, properties = self.peak_indices(**k...
[ "0.7416203", "0.71166277", "0.63835865", "0.63379997", "0.6203665", "0.61556125", "0.6147643", "0.61411285", "0.61273277", "0.61213607", "0.6109645", "0.6093378", "0.60870486", "0.60449725", "0.602112", "0.5981738", "0.597626", "0.5965741", "0.59562004", "0.59433883", "0.5937...
0.6307039
4
Return the periods of thetrajectory of neuron i
def get_periods(indexes, step): period = np.array([indexes[j+1] - indexes[j] for j in range(len(indexes) -1)])*step return period
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_periods(a,t):\n ex = get_extrema(a,t)[1]\n \n l = ipol(ex,0)\n \n diff = np.diff(l)\n \n return diff", "def period(self) -> int:", "def get_periods():\n return [\n relativedelta(),\n relativedelta(days=6),\n relativedelta(months=1),\n relativedelta(mo...
[ "0.6936276", "0.61068726", "0.6073322", "0.59679854", "0.58855665", "0.58448124", "0.56923974", "0.5629729", "0.5613269", "0.55943346", "0.5572579", "0.55323595", "0.5529906", "0.55260295", "0.5525814", "0.5524414", "0.5517219", "0.55161285", "0.54997855", "0.54787534", "0.54...
0.6372389
1
Get the spike indexes and the periods of all neurons
def get_spikes_periods(function, threshold, step): spikes = discrete_potential(function, threshold) index_list = [] periods_list = [] for neuron in range(len(function)): indexes = get_peak_ind(spikes[neuron]) periods = get_periods(indexes, step) if len(indexes) > 1 a...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def AllSpikeTimes(self):\n blah = []\n for neur in self.neurons:\n blah.append(np.array(neur.spikes))\n\n return blah", "def get_spike_data():\n neuron_spikes = []\n first = 0\n last = 0\n for i, file in enumerate(os.listdir(\"\"\"/Users/markusekvall/Desktop/\n ...
[ "0.6560615", "0.6069226", "0.57719684", "0.56720155", "0.55953044", "0.5565972", "0.5540211", "0.54534715", "0.5427242", "0.5383527", "0.5363488", "0.5276908", "0.52698076", "0.5263423", "0.5243345", "0.52306587", "0.5229192", "0.521121", "0.52057767", "0.519472", "0.51789373...
0.53662705
10
Attempt to turn bad data into a token. Use C{self} as the bad data, since it can't be encoded by JSON. Make sure we get a C{ValueError}.
def testBadDataToToken(self): key = createKey() self.assertRaises(ValueError, dataToToken, key, data=self)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def validate(self, data):\n try:\n payload = jwt.decode(data['token'], settings.SECRET_KEY, algorithms=['HS256'])\n except ExpiredSignatureError:\n raise serializers.ValidationError(\"The token has expired.\")\n except JWTError:\n raise serializers.ValidationEr...
[ "0.68236655", "0.6787887", "0.6655405", "0.64902526", "0.64316213", "0.6024007", "0.60178393", "0.59631366", "0.59598136", "0.59069157", "0.59021467", "0.58920705", "0.5872056", "0.57548034", "0.5734794", "0.56355244", "0.56324273", "0.56280214", "0.5611771", "0.5601851", "0....
0.67535573
2
Attempt to turn data into a token with a bad key. Make sure we get a C{ValueError}.
def testBadKeyToToken(self): key = 5 self.assertRaises(ValueError, dataToToken, key, data='hey')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def testTokenToDataWithBadKey(self):\n key = createKey()\n data = {u'user': u'aliafshar'}\n token = dataToToken(key, data)\n self.assertRaises(ValueError, tokenToData, createKey(), token=token)", "def testBadDataToToken(self):\n key = createKey()\n self.assertRaises(Valu...
[ "0.8194266", "0.8027495", "0.69188213", "0.6612661", "0.6293818", "0.62283367", "0.6205009", "0.6176913", "0.60678846", "0.60182106", "0.5991139", "0.5971257", "0.5946478", "0.59187376", "0.59060425", "0.59047776", "0.5899296", "0.57573247", "0.57479876", "0.5738873", "0.5738...
0.7604891
2
Attempt to turn data into a token with key info that's too short. Make sure we get a C{ValueError}.
def testKeyInfoTooShort(self): key = 5 self.assertRaises(ValueError, dataToToken, key, data='x', keyInfo='xx')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def testKeyInfoTooLong(self):\n key = 5\n self.assertRaises(ValueError, dataToToken, key, data='hey',\n keyInfo='xxxxx')", "def testBadDataToToken(self):\n key = createKey()\n self.assertRaises(ValueError, dataToToken, key, data=self)", "def testTokenToDataW...
[ "0.70762175", "0.607703", "0.60147566", "0.58342063", "0.55614984", "0.5477406", "0.53772527", "0.52765024", "0.5223486", "0.5218025", "0.5209739", "0.52083516", "0.51871884", "0.5180023", "0.5137369", "0.5118065", "0.5095644", "0.50949544", "0.50814134", "0.5077386", "0.5026...
0.7599055
0
Attempt to turn data into a token with key info that's too long. Make sure we get a C{ValueError}.
def testKeyInfoTooLong(self): key = 5 self.assertRaises(ValueError, dataToToken, key, data='hey', keyInfo='xxxxx')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def testKeyInfoTooShort(self):\n key = 5\n self.assertRaises(ValueError, dataToToken, key, data='x', keyInfo='xx')", "def testBadDataToToken(self):\n key = createKey()\n self.assertRaises(ValueError, dataToToken, key, data=self)", "def testTokenToDataWithBadKey(self):\n key =...
[ "0.7316048", "0.6184192", "0.60824144", "0.5804973", "0.57880867", "0.5631557", "0.55719686", "0.5516091", "0.5458997", "0.53713936", "0.5358326", "0.53580767", "0.5306614", "0.52973235", "0.52792686", "0.52790624", "0.52631515", "0.52393305", "0.5231974", "0.52234995", "0.52...
0.7421354
0
Attempt to turn a token into valid data using an invalid key. Make sure we get a C{ValueError}.
def testTokenToDataWithBadKey(self): key = createKey() data = {u'user': u'aliafshar'} token = dataToToken(key, data) self.assertRaises(ValueError, tokenToData, createKey(), token=token)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def testBadDataToToken(self):\n key = createKey()\n self.assertRaises(ValueError, dataToToken, key, data=self)", "def testBadKeyToToken(self):\n key = 5\n self.assertRaises(ValueError, dataToToken, key, data='hey')", "def testKeyInfoTooShort(self):\n key = 5\n self.ass...
[ "0.7641556", "0.7378524", "0.6560763", "0.6310796", "0.62208354", "0.6214384", "0.61293644", "0.595883", "0.5911464", "0.5843664", "0.5817309", "0.57752836", "0.5773261", "0.5734485", "0.56548244", "0.5645461", "0.56449616", "0.56429386", "0.5612306", "0.560686", "0.55679715"...
0.80681634
0
Test that we can roundtrip encrypt / decrypt without error.
def testRoundtrip(self): key = createKey() data = {u'user': u'aliafshar', u'id': u'91821212'} token = dataToToken(key, data) self.assertEqual(data, tokenToData(key, token))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_decrypt_encrypted(self):\n encrypted = encrypt('message')\n decrypted = decrypt(encrypted)\n\n assert decrypted == 'message'", "def testCryptMessageRoundtrip(self):\n try:\n cu = CryptUtils()\n ky = cu.newKey()\n msg = \"abcdefghijklmnopqrstuv...
[ "0.8004461", "0.77195823", "0.74543875", "0.7433178", "0.74147797", "0.7413684", "0.7333193", "0.7303228", "0.730269", "0.72082126", "0.7162571", "0.7066067", "0.69196343", "0.6901942", "0.68383145", "0.67804986", "0.6778265", "0.6764543", "0.67624986", "0.6761235", "0.674847...
0.0
-1
Test that we can roundtrip encrypt / decrypt after forking without error.
def testRoundtripAfterFork(self): if fork() == 0: key = createKey() data = {u'user': u'aliafshar', u'id': u'91821212'} token = dataToToken(key, data) self.assertEqual(data, tokenToData(key, token)) # This is horrible, but necessary: Turn the child into...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_encrypt_creates_and_restores_backup(\n self,\n mock_os,\n mock_shutil,\n mock_subprocess,\n ):\n mock_subprocess.run.return_value.returncode = 1\n\n with self.assertRaises(RuntimeError):\n self.mikla.encrypt('Chunky Hunky', 'plain', 'enc')\n\n ...
[ "0.6426856", "0.6424985", "0.63377774", "0.627262", "0.6084893", "0.60583663", "0.5969925", "0.59437805", "0.59314126", "0.58886117", "0.58823997", "0.5869974", "0.5838037", "0.5835891", "0.5832072", "0.58096397", "0.57812876", "0.5772174", "0.5755509", "0.57499325", "0.57485...
0.71512514
0
================================================================== NOTE!!!!!! The Numdifftools from PyPI may do this a lot faster and more accurately!!!! =================================================================== Perform numerical differentiation using 3point, Lagrangian interpolation. Seems to be a lack of go...
def deriv(y, x=None): n = len(y) if n < 3: raise ValueError('y must have at least 3 elements!') if(x is not None): if len(x) != len(y): raise ValueError('vectors x and y must have the same size!') x1 = np.asarray(x, dtype=np.float64) x0 = np.roll(x1, 1) x2...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fourPtFiniteDiff(x,y):\n dydx = np.zeros(y.shape,float)\n for i in range(2,len(y)-2):\n a = y[i-2]\n b = y[i-1]\n c = y[i+1]\n d = y[i+2]\n dydx[i] = (a-8*b+8*c-d)/(12*(x[1]-x[0]))\n dydx[-1] = (y[-1]-y[-2])/(x[-1]-x[-2])\n dydx[-2] = (y[-2]-y[-3])/(x[-2]-x[-3])\n...
[ "0.66823614", "0.662995", "0.65764284", "0.656985", "0.64884615", "0.6321366", "0.6291796", "0.6262398", "0.62608707", "0.62471175", "0.6162253", "0.61286527", "0.61258644", "0.6050832", "0.60202855", "0.60091645", "0.5969339", "0.59686005", "0.59637904", "0.594464", "0.59291...
0.59955436
16
Generalises the numerical differentiation function deriv to calculate the partial derivative of a 2D array representing a twovariable function with respect to x or y given by dim
def pderiv2D(field, xld, dim = 0): n_x, n_y = field.shape dfield = np.zeros_like(field) if (dim not in [0, 1]): raise ValueError("2-D function, enter dim = 0 (df/dx) or dim = 1 (df/dy)") if (dim == 0): # check if len(x) equals M if len(xld) != n_x : raise ValueError...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def diffuse_2d(t,y,D,shape):\n m,n = shape\n Fliq0 = np.reshape(np.ascontiguousarray(y),(m,n))\n dy = np.zeros((m,n))\n\n # Calculate derivatives in the interior\n dy[1:-1, 1:-1] = (\n D * (Fliq0[:-2, 1:-1] - 2 * Fliq0[1:-1, 1:-1] + Fliq0[2:, 1:-1])\n + D * (Fliq0[1:-1, :-2] - 2 * Fliq...
[ "0.71400756", "0.7021378", "0.70070183", "0.6926722", "0.6923472", "0.6883543", "0.68410754", "0.6825765", "0.6825765", "0.6823402", "0.6761243", "0.6683259", "0.66645986", "0.6662775", "0.6586452", "0.6581192", "0.65791905", "0.6511668", "0.6491774", "0.6467675", "0.6455269"...
0.73236173
0
The same as pderiv2D above, except for 3dimensions
def pderiv3D(infield, xld, dim = 0): n_x, n_y, n_z = infield.shape outfield = np.zeros_like(infield) if (dim == 0): if len(xld) != n_x: raise ValueError('x-lengths do not match') for j in range(n_y): for k in range(n_z): outfield[:, j, k] = deriv(in...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _2ndderiv_xyz(self, x, y, z, i, j):\n return (\n 4.0\n * numpy.pi\n * self._b\n * self._c\n * _2ndDerivInt(\n x,\n y,\n z,\n lambda m: self._mdens(m),\n lambda m: self._mdens...
[ "0.68689644", "0.68664634", "0.68423975", "0.663951", "0.6624382", "0.6590153", "0.6518782", "0.6483307", "0.64791375", "0.63544554", "0.6321809", "0.62879235", "0.62656766", "0.62179154", "0.62086415", "0.61880726", "0.61565596", "0.61552215", "0.6138077", "0.61370593", "0.6...
0.64563835
9
Starts displaying the logs
def start_log(self, message, args): if not self.running: self.running = True self.thread.start() return 'Starting' else: return 'Already running'
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def start(self):\n log.startLoggingWithObserver(self.emit, setStdout=0)", "def on_start(self):\r\n self.log()", "def startLogger(self):\n #------------------------------------------\n # Initialize logger\n log_level = getattr(logging, str(self.loglevel).upper())\n logg...
[ "0.7475585", "0.73508584", "0.73137593", "0.7058594", "0.7038118", "0.69904995", "0.69037366", "0.68957275", "0.68682766", "0.67675006", "0.6718143", "0.66624564", "0.6532045", "0.6508446", "0.6504403", "0.6495794", "0.64694417", "0.6462074", "0.64157116", "0.6332411", "0.626...
0.62124234
23
Triggers on plugin activation
def activate(self): super(Pfsense, self).activate() default_identifier = self.config.get('DEFAULT_IDENTIFIER_STR', '') if not default_identifier: self.log.warn('No default identifier set') self.default_identifier = self.build_identifier(default_identifier) self.threa...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def on_activate(self) -> None:", "def on_activate(self):", "def plugin_loaded():\n events.broadcast(\"plugin_loaded\")", "def will_activate(self):\n pass", "def activate(self):\n pass", "def activate(self):\n pass", "def activated(self):", "def control_plugin(self):\n pass"...
[ "0.75387883", "0.7426618", "0.7344148", "0.7110269", "0.6968123", "0.692177", "0.68231404", "0.67499655", "0.67335844", "0.67062676", "0.6431321", "0.6357042", "0.6339266", "0.6339266", "0.63229895", "0.62744755", "0.6246405", "0.6239904", "0.6202175", "0.6199077", "0.6195307...
0.0
-1
Triggers on plugin deactivation You should delete it if you're not using it to override any default behaviour
def deactivate(self): super(Pfsense, self).deactivate()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def on_deactivate(self):", "def on_deactivate(self) -> None:", "def unload_plugin(self):\n pass", "def shutdown_plugin(self):\n pass", "def consider_deactivation(self):\n pass", "def deactivate(self):\n pass", "def deactivate(self):\n pass", "def deactivate(self):\n ...
[ "0.77934206", "0.77932763", "0.76948136", "0.71362555", "0.7009319", "0.6981416", "0.68895817", "0.68895817", "0.68305236", "0.66079843", "0.66013384", "0.6597607", "0.65306985", "0.6499409", "0.6492059", "0.64710546", "0.6440707", "0.6418329", "0.6414627", "0.64075315", "0.6...
0.6351632
25
Defines the configuration structure this plugin supports
def get_configuration_template(self): return CONFIG_TEMPLATE
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def configuration():", "def config(self):\n raise NotImplementedError", "def config(self):\n pass", "def config(self):\n pass", "def config(self):\n return {}", "def config(self) -> Dict[str, Any]:", "def config():", "def config():", "def get_config(self):\n config = {\n ...
[ "0.77755755", "0.7437863", "0.72979873", "0.72979873", "0.7052743", "0.7051588", "0.6998176", "0.6998176", "0.697551", "0.6974882", "0.6933964", "0.6863067", "0.685125", "0.68507224", "0.6826979", "0.6765858", "0.67204964", "0.6644861", "0.6644861", "0.66274387", "0.6588393",...
0.0
-1
Triggers when the configuration is checked, shortly before activation
def check_configuration(self, configuration): # If we specified a LOG_FILE path, check to see if it actually exists if configuration.get('LOG_FILE') and not path.isfile(configuration.get('LOG_FILE')): raise ValidationException(f'Could not find file {configuration["LOG_FILE"]}')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def will_activate(self):\n pass", "def on_activate(self) -> None:", "def pre_config_checks(self):\n\n\t\tif self.host is not None:\n\t\t\tself.tell(\"Doing pre-config checks\")\n\n\t\tself.do_checklist([])", "def _configure(self):\n InitialCondition._configure(self)", "def onConfigureMessage(...
[ "0.6875177", "0.6558857", "0.64269495", "0.63770574", "0.63073653", "0.6289996", "0.62548673", "0.6254173", "0.62288475", "0.62274116", "0.62242854", "0.6197526", "0.61884844", "0.616781", "0.6146094", "0.6136984", "0.61358976", "0.6131124", "0.60680306", "0.60674596", "0.605...
0.0
-1
Triggers when bot is connected
def callback_connect(self): pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def on_connect():\n print(\"User connected!\")", "async def on_ready():\n print(\"Logged in as {0.user}\".format(bot))", "async def on_ready():\n logging.info(\"Logged in as %s\", bot.user)", "async def on_ready():\n print(f\"{client.user} has connected to Discord!\")", "def on_connect(self):\n...
[ "0.7703879", "0.7507737", "0.7433326", "0.73538226", "0.73535776", "0.7327646", "0.73192364", "0.7236039", "0.72251964", "0.72183293", "0.7181976", "0.7168702", "0.71312255", "0.70636314", "0.70580405", "0.70478606", "0.7007495", "0.7001763", "0.6972997", "0.69330394", "0.691...
0.0
-1
Triggered for every received message that isn't coming from the bot itself
def callback_message(self, message): pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def callback_botmessage(self, message):\n pass", "def callback_botmessage(self, message):\n pass", "def callback_botmessage(self, message):\n pass", "async def on_message(self, message):\n if message.author.bot:\n return # Ignore all bots.\n await self.process_co...
[ "0.75991315", "0.75991315", "0.75991315", "0.7452486", "0.7445942", "0.7296193", "0.7242182", "0.7126518", "0.7051749", "0.7040767", "0.7027394", "0.6999151", "0.6965114", "0.6933753", "0.69162774", "0.6888043", "0.68454033", "0.6839931", "0.68327653", "0.68213314", "0.681822...
0.6519853
40
Triggered for every message that comes from the bot itself
def callback_botmessage(self, message): pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def on_message(self, message):\n if message.author.bot:\n return # Ignore all bots.\n await self.process_commands(message)", "async def on_message(self, message: \"steam.Message\") -> None:", "def handle_message(self, message):", "def handle_message(self, msg):\n pass", ...
[ "0.7715539", "0.75247985", "0.7509456", "0.7493988", "0.74032956", "0.7374639", "0.7278484", "0.719331", "0.71895707", "0.718867", "0.7171636", "0.7121195", "0.70884424", "0.70714325", "0.70514", "0.7029807", "0.70114267", "0.7008904", "0.70032173", "0.69914603", "0.6962079",...
0.7951723
2