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
Initialize the inference network, stream video to network, and output stats and video.
def infer_on_stream(args, client): # Initialise the class infer_network = Network() # Set Probability threshold for detections prob_threshold = args.prob_threshold ### TODO: Load the model through `infer_network` ### infer_network.load_model(args.model,args.cpu_extension,args.device) input_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def infer_on_stream(args, client):\n # Initialise the class\n infer_network = Network()\n # Set Probability threshold for detections\n prob_threshold = args.prob_threshold\n\n ### TODO: Load the model through `infer_network` ###\n infer_network.load_model(model=args.model,\n ...
[ "0.6657868", "0.6654198", "0.6620068", "0.6584362", "0.6474501", "0.62960565", "0.6276968", "0.6220246", "0.6160445", "0.59733164", "0.5964964", "0.59312594", "0.5894175", "0.5887097", "0.58308923", "0.5786715", "0.5768193", "0.57668513", "0.57543945", "0.57250965", "0.570893...
0.6824545
0
Load the network and parse the output.
def main(): # Grab command line args args = build_argparser().parse_args() #print(args) #Connect to the MQTT server client = connect_mqtt() #Perform inference on the input stream infer_on_stream(args, client)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_network(self):\t\t\r\n\t\tself.dqn.load_network(self.path)", "def __load_Model(self):\r\n PrintsForUser.printProcess(\"[INFO] Loading network...\")\r\n \r\n self.__model = load_model(self.__model_path)\r\n self.__lb = pickle.loads(open(self.__labels_path, \"rb\").read())", ...
[ "0.7355958", "0.6594214", "0.65300447", "0.64435625", "0.6269429", "0.6132971", "0.606932", "0.5980821", "0.5932085", "0.5918037", "0.591396", "0.59083337", "0.59021485", "0.58683854", "0.585857", "0.5845249", "0.5842063", "0.5813572", "0.57925004", "0.5786059", "0.5769666", ...
0.0
-1
The set of arguments for constructing a WorkbookTemplate resource.
def __init__(__self__, *, galleries: pulumi.Input[Sequence[pulumi.Input['WorkbookTemplateGalleryArgs']]], resource_group_name: pulumi.Input[str], template_data: Any, author: Optional[pulumi.Input[str]] = None, localized: Optional[pulum...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(__self__,\n resource_name: str,\n args: WorkbookTemplateArgs,\n opts: Optional[pulumi.ResourceOptions] = None):\n ...", "def __init__(__self__,\n resource_name: str,\n opts: Optional[pulumi.ResourceOptions] = None...
[ "0.7442528", "0.69924647", "0.65530205", "0.60074925", "0.5782132", "0.56032455", "0.558455", "0.557802", "0.5418834", "0.5376021", "0.5360666", "0.5296899", "0.5247379", "0.5242798", "0.51344776", "0.50795925", "0.50566286", "0.5038824", "0.50251013", "0.5014964", "0.5010997...
0.6734913
2
Workbook galleries supported by the template.
def galleries(self) -> pulumi.Input[Sequence[pulumi.Input['WorkbookTemplateGalleryArgs']]]: return pulumi.get(self, "galleries")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def galleries(self) -> pulumi.Output[Sequence['outputs.WorkbookTemplateGalleryResponse']]:\n return pulumi.get(self, \"galleries\")", "def get_galleries(self):\n data = self._get('get_gallery_list')\n return data['galleries']", "def Gallery():\n return render_template(\n 'Gallery...
[ "0.8052166", "0.6197946", "0.585732", "0.57718176", "0.5716009", "0.5657963", "0.5653665", "0.56315845", "0.5574098", "0.5572743", "0.5434536", "0.5415715", "0.530429", "0.5217824", "0.5189865", "0.5185198", "0.5181188", "0.51711136", "0.5099473", "0.5087812", "0.50609577", ...
0.82092285
0
The name of the resource group. The name is case insensitive.
def resource_group_name(self) -> pulumi.Input[str]: return pulumi.get(self, "resource_group_name")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def resource_group_name(self) -> str:\n return pulumi.get(self, \"resource_group_name\")", "def group_name(self) -> str:\n return pulumi.get(self, \"group_name\")", "def resource_group_name(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"resource_group_name\")", "def resource_gr...
[ "0.8591833", "0.83624226", "0.8203686", "0.8203686", "0.8203686", "0.8203686", "0.8203686", "0.8203686", "0.8203686", "0.8203686", "0.8203686", "0.8203686", "0.8203686", "0.8203686", "0.81753516", "0.80862474", "0.80862474", "0.80862474", "0.80862474", "0.80862474", "0.808624...
0.8088815
48
Valid JSON object containing workbook template payload.
def template_data(self) -> Any: return pulumi.get(self, "template_data")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_template_valid(template: JSONDict) -> JSONDict:\n\n errors = _rec_is_template_valid(template)\n errors.extend(_check_cyclic_defaults(template))\n\n if errors:\n msg = collate_errors(when=\"checking the template\", errors=errors)\n raise ParselglossyError(msg)\n\n return _reorder_te...
[ "0.62114877", "0.6071935", "0.5990931", "0.59413725", "0.5856608", "0.57829463", "0.5766327", "0.573466", "0.57027936", "0.55965626", "0.5435958", "0.54198736", "0.53931856", "0.5344035", "0.5329229", "0.53008455", "0.5250856", "0.5239073", "0.5200579", "0.517109", "0.5154547...
0.48666596
48
Information about the author of the workbook template.
def author(self) -> Optional[pulumi.Input[str]]: return pulumi.get(self, "author")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def author(self):\n\n for item in self.metadata:\n if item.tag.localname == \"creator\":\n if 'file-as' in item.tag:\n return item.tag['file-as']\n else:\n return item.tag.text", "def author(self) -> str:\n return pulumi...
[ "0.7333974", "0.7302022", "0.68595636", "0.68595636", "0.6820945", "0.6795719", "0.67476195", "0.67476195", "0.67476195", "0.670637", "0.664949", "0.65821403", "0.6567067", "0.64731705", "0.64731705", "0.6378395", "0.63490343", "0.634169", "0.6178657", "0.6116933", "0.6079131...
0.6291452
18
Key value pair of localized gallery. Each key is the locale code of languages supported by the Azure portal.
def localized(self) -> Optional[pulumi.Input[Mapping[str, pulumi.Input[Sequence[pulumi.Input['WorkbookTemplateLocalizedGalleryArgs']]]]]]: return pulumi.get(self, "localized")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def localized(self) -> pulumi.Output[Optional[Mapping[str, Sequence['outputs.WorkbookTemplateLocalizedGalleryResponse']]]]:\n return pulumi.get(self, \"localized\")", "def photo_dict(phrase):\n switcher = {\n '병원 위치': 'https://maps.googleapis.com/maps/api/staticmap?center=37.507144,127.063737&zo...
[ "0.59551746", "0.579176", "0.5739075", "0.5466263", "0.5320878", "0.5197395", "0.515548", "0.5117539", "0.5035321", "0.50232655", "0.5018956", "0.49866858", "0.4972195", "0.49670196", "0.49650854", "0.49545366", "0.4943", "0.49376488", "0.48790962", "0.48603863", "0.48575422"...
0.5682472
3
Priority of the template. Determines which template to open when a workbook gallery is opened in viewer mode.
def priority(self) -> Optional[pulumi.Input[int]]: return pulumi.get(self, "priority")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_template_names(self):\n self.object = self.get_object()\n\n tutor = self.request.user.profile.is_tutor()\n # return a different view if they are the owner\n if tutor and tutor == self.object.tutor:\n return self.OWNER_TEMPLATE\n # or if they booked it\n ...
[ "0.58201617", "0.5730717", "0.56210905", "0.5607988", "0.55770165", "0.54164374", "0.5394491", "0.5394491", "0.5391942", "0.5387773", "0.5371434", "0.5284352", "0.52258164", "0.5222704", "0.52201176", "0.51978165", "0.5177186", "0.5159384", "0.5130192", "0.511712", "0.5114135...
0.0
-1
The name of the Application Insights component resource.
def resource_name(self) -> Optional[pulumi.Input[str]]: return pulumi.get(self, "resource_name")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def name(self):\n return self.raw_resource[\"name\"]", "def name(self):\n\n return self.resource[\"metadata\"][\"name\"]", "def name(self) -> str:\n if self._name is None:\n return 'AutoML Metric'\n else:\n return self._name", "def name(self):\n\n retu...
[ "0.6259344", "0.62363994", "0.61032945", "0.60528404", "0.6051231", "0.60437256", "0.60437256", "0.60114765", "0.5920258", "0.5920258", "0.58952844", "0.58867717", "0.58867717", "0.5839472", "0.57963365", "0.5767712", "0.57452095", "0.5737283", "0.5734956", "0.5734956", "0.57...
0.54356354
74
An Application Insights workbook template definition.
def __init__(__self__, resource_name: str, opts: Optional[pulumi.ResourceOptions] = None, author: Optional[pulumi.Input[str]] = None, galleries: Optional[pulumi.Input[Sequence[pulumi.Input[pulumi.InputType['WorkbookTemplateGalleryArgs']]]]] = None, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_template(path_string) :\r\n today = datetime.now()\r\n today = today.strftime('%y%y%m%d%H%M%S')\r\n # print(today)\r\n temp_path = os.path.join(path_string, today)\r\n # temp_path = today\r\n # Create a workbook and add a worksheet.\r\n workbook = xlsxwriter.Workbook(f'{temp_path}.x...
[ "0.6370428", "0.58345425", "0.5721333", "0.57181656", "0.5714411", "0.55105186", "0.54626566", "0.53531194", "0.5312757", "0.5260449", "0.524681", "0.52356", "0.5232021", "0.5198732", "0.5188773", "0.5172345", "0.51696503", "0.51567936", "0.5105256", "0.51019734", "0.51006556...
0.5570428
5
An Application Insights workbook template definition.
def __init__(__self__, resource_name: str, args: WorkbookTemplateArgs, opts: Optional[pulumi.ResourceOptions] = None): ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_template(path_string) :\r\n today = datetime.now()\r\n today = today.strftime('%y%y%m%d%H%M%S')\r\n # print(today)\r\n temp_path = os.path.join(path_string, today)\r\n # temp_path = today\r\n # Create a workbook and add a worksheet.\r\n workbook = xlsxwriter.Workbook(f'{temp_path}.x...
[ "0.6370428", "0.58345425", "0.5721333", "0.57181656", "0.5570428", "0.55105186", "0.54626566", "0.53531194", "0.5312757", "0.5260449", "0.524681", "0.52356", "0.5232021", "0.5198732", "0.5188773", "0.5172345", "0.51696503", "0.51567936", "0.5105256", "0.51019734", "0.51006556...
0.5714411
4
Get an existing WorkbookTemplate resource's state with the given name, id, and optional extra properties used to qualify the lookup.
def get(resource_name: str, id: pulumi.Input[str], opts: Optional[pulumi.ResourceOptions] = None) -> 'WorkbookTemplate': opts = pulumi.ResourceOptions.merge(opts, pulumi.ResourceOptions(id=id)) __props__ = WorkbookTemplateArgs.__new__(WorkbookTemplateArgs) __props__.__d...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get(template_id):\n try:\n template = Template.objects.get(pk=template_id)\n except:\n raise CMException('template_get')\n\n if not template or template.state != template_states['active']:\n raise CMException('template_get')\n\n return template", "...
[ "0.60059094", "0.5583698", "0.5580275", "0.5527408", "0.54685605", "0.5425252", "0.5421419", "0.54145896", "0.5405498", "0.52019465", "0.5158618", "0.5141349", "0.5131247", "0.5115271", "0.50936675", "0.5086638", "0.5047412", "0.5034328", "0.5018827", "0.49963653", "0.4993864...
0.66030896
0
Information about the author of the workbook template.
def author(self) -> pulumi.Output[Optional[str]]: return pulumi.get(self, "author")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def author(self):\n\n for item in self.metadata:\n if item.tag.localname == \"creator\":\n if 'file-as' in item.tag:\n return item.tag['file-as']\n else:\n return item.tag.text", "def author(self) -> str:\n return pulumi...
[ "0.7333974", "0.7302022", "0.68595636", "0.68595636", "0.6820945", "0.6795719", "0.67476195", "0.67476195", "0.67476195", "0.664949", "0.65821403", "0.6567067", "0.64731705", "0.64731705", "0.6378395", "0.63490343", "0.634169", "0.6291452", "0.6178657", "0.6116933", "0.607913...
0.670637
9
Workbook galleries supported by the template.
def galleries(self) -> pulumi.Output[Sequence['outputs.WorkbookTemplateGalleryResponse']]: return pulumi.get(self, "galleries")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def galleries(self) -> pulumi.Input[Sequence[pulumi.Input['WorkbookTemplateGalleryArgs']]]:\n return pulumi.get(self, \"galleries\")", "def get_galleries(self):\n data = self._get('get_gallery_list')\n return data['galleries']", "def Gallery():\n return render_template(\n 'Galler...
[ "0.82092285", "0.6197946", "0.585732", "0.57718176", "0.5716009", "0.5657963", "0.5653665", "0.56315845", "0.5574098", "0.5572743", "0.5434536", "0.5415715", "0.530429", "0.5217824", "0.5189865", "0.5185198", "0.5181188", "0.51711136", "0.5099473", "0.5087812", "0.50609577", ...
0.8052166
1
Key value pair of localized gallery. Each key is the locale code of languages supported by the Azure portal.
def localized(self) -> pulumi.Output[Optional[Mapping[str, Sequence['outputs.WorkbookTemplateLocalizedGalleryResponse']]]]: return pulumi.get(self, "localized")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def photo_dict(phrase):\n switcher = {\n '병원 위치': 'https://maps.googleapis.com/maps/api/staticmap?center=37.507144,127.063737&zoom=16&size=640x480&markers=color:blue%7Clabel:S%7C37.507144,127.063737&key=AIzaSyCF-XXYf7IW1mkUZFeZF84BCcZdtC-z1M0',\n '병원 운영시간': 'http://gunn.pausd.org/sites/default/fil...
[ "0.579176", "0.5739075", "0.5682472", "0.5466263", "0.5320878", "0.5197395", "0.515548", "0.5117539", "0.5035321", "0.50232655", "0.5018956", "0.49866858", "0.4972195", "0.49670196", "0.49650854", "0.49545366", "0.4943", "0.49376488", "0.48790962", "0.48603863", "0.48575422",...
0.59551746
0
Priority of the template. Determines which template to open when a workbook gallery is opened in viewer mode.
def priority(self) -> pulumi.Output[Optional[int]]: return pulumi.get(self, "priority")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_template_names(self):\n self.object = self.get_object()\n\n tutor = self.request.user.profile.is_tutor()\n # return a different view if they are the owner\n if tutor and tutor == self.object.tutor:\n return self.OWNER_TEMPLATE\n # or if they booked it\n ...
[ "0.58201617", "0.5730717", "0.56210905", "0.5607988", "0.55770165", "0.54164374", "0.5394491", "0.5394491", "0.5391942", "0.5387773", "0.5371434", "0.5284352", "0.52258164", "0.5222704", "0.52201176", "0.51978165", "0.5177186", "0.5159384", "0.5130192", "0.511712", "0.5114135...
0.0
-1
Valid JSON object containing workbook template payload.
def template_data(self) -> pulumi.Output[Any]: return pulumi.get(self, "template_data")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_template_valid(template: JSONDict) -> JSONDict:\n\n errors = _rec_is_template_valid(template)\n errors.extend(_check_cyclic_defaults(template))\n\n if errors:\n msg = collate_errors(when=\"checking the template\", errors=errors)\n raise ParselglossyError(msg)\n\n return _reorder_te...
[ "0.62114877", "0.6071935", "0.5990931", "0.59413725", "0.5856608", "0.57829463", "0.5766327", "0.573466", "0.57027936", "0.55965626", "0.5435958", "0.54198736", "0.53931856", "0.5344035", "0.5329229", "0.53008455", "0.5250856", "0.5239073", "0.5200579", "0.517109", "0.5154547...
0.0
-1
This decorator is to handle the exceptions and print it in log
def handle_exception(function): def wrapper(*args, **kwargs): """ The wrapper function """ try: return function(*args, **kwargs) except Exception as ex: exc_type, exc_value, exc_traceback = sys.exc_info() error("The traceback is ::::\n"+"" \ ....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def exception_handler(exctype, val, trace):\n logger.info(\n ''.join(traceback.format_exception(exctype, val, trace)))", "def log_exceptions(view):\n def decorated(request, *args, **kwargs):\n try:\n return view(request, *args, **kwargs)\n except Exception as...
[ "0.73565656", "0.7343179", "0.7290134", "0.7258473", "0.7158605", "0.7137361", "0.7077733", "0.70336413", "0.70336413", "0.70140934", "0.69754803", "0.6966358", "0.6962238", "0.6924393", "0.6924393", "0.6917137", "0.6891868", "0.68603396", "0.68316257", "0.68050414", "0.68050...
0.0
-1
Test SNMPv3 script utilizing Kirks snmp_helper module
def main(): # Take path argument and list all text files ip = '10.1.10.100' a_user = 'cisco' auth_key = 'cisco123' encr_key = 'cisco123' snmp_user = (a_user, auth_key, encr_key) sw1 = (ip, 161) sysDescr = '1.3.6.1.2.1.1.1.0' sysObjectID = '1.3.6.1.2.1.1.2.0' sysUpTime = '1.3.6....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def quickstart():\n snmp.quickstart()\n return 0", "def handle_snmpconf():\n return 0", "def main():\n # CREATE EACH OID STRING USING THE FIRST ARGUMENT PASSED\n cmd_uptime = \"snmpget -v 1 -c public \" + argv[1] + \" 1.3.6.1.2.1.1.3.0\"\n # CREATE LISTS OUT OF EACH COMMAND\n clUptime = cm...
[ "0.63348025", "0.619772", "0.6136724", "0.5980005", "0.5947892", "0.58158255", "0.57572633", "0.5711977", "0.5508595", "0.53740776", "0.53207225", "0.5219235", "0.5182949", "0.5170424", "0.5160724", "0.5152555", "0.5085134", "0.50800693", "0.5075875", "0.5074044", "0.50578886...
0.64426136
0
Connect to the API and test connection
def connect_api(): print("INFO: Checking API connection and credentials...") conf = ConfigParser() conf.read(os.path.join(os.path.abspath( os.path.dirname(__file__)), '.', 'api.conf')) client = CBWApi(conf.get('cyberwatch', 'url'), conf.get( 'cyberwatch', 'api_key'), conf.get('cyberwatch...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def connect():\n return connection.Connection(username=api_user,\n api_key=api_key,\n region=api_region)", "def test_api_connection(server, username, password, api_key):\n global api_url\n api_url = \"http://\" + server + \"/i-doit/src/jsonrp...
[ "0.75394267", "0.71746594", "0.71069753", "0.70297796", "0.69757605", "0.6968587", "0.6940774", "0.6929308", "0.6752766", "0.67461467", "0.66849214", "0.6681502", "0.6624572", "0.66045177", "0.6603074", "0.6563905", "0.6545671", "0.6543918", "0.650036", "0.64967084", "0.64955...
0.7394636
1
Setup variables for SMTP
def setup_smtp(): print("INFO: Setting up SMTP variables...") conf = ConfigParser() conf.read(os.path.join(os.path.abspath( os.path.dirname(__file__)), '.', 'smtp.conf')) smtp = { "server": conf.get('smtp', 'smtp_server'), "login": conf.get('smtp', 'smtp_login'), "passwor...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, smtp_server, smtp_user, smtp_password,\n smtp_port=25, is_with_tls=False):\n self.smtp_server = smtp_server\n self.smtp_port = smtp_port\n self.smtp_user = smtp_user\n self.smtp_password = smtp_password\n self.is_with_tls = is_with_tls", "def ...
[ "0.65546256", "0.6469776", "0.6447924", "0.64182866", "0.63860655", "0.6361841", "0.62926346", "0.6200357", "0.6009188", "0.5971613", "0.59700364", "0.5938338", "0.58888084", "0.5881734", "0.5868435", "0.5861525", "0.5846991", "0.58270794", "0.57619554", "0.57489693", "0.5721...
0.7708062
0
Replace server list in file with recent one
def replace_file(servers): print("INFO: Replacing server list in file with recent one...") if os.path.exists(os.path.dirname(__file__) + '/communication_failure_list.txt'): try: os.remove(os.path.dirname(__file__) + '/communication_failure_list.txt') except OSEr...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_server_list(filename):\n if not os.path.isfile(filename):\n return #ignore this error for now\n fo=open(filename,\"r\")\n rd=fo.read()\n fo.close()\n __load_server_list(rd)", "def update_servers(self, output_file, current_time):\n\n # Check the servers le...
[ "0.6282345", "0.6164431", "0.5646351", "0.5629765", "0.55825335", "0.55205137", "0.54738104", "0.54054666", "0.53958476", "0.53949213", "0.53838426", "0.5362909", "0.53529775", "0.5349839", "0.53414625", "0.53314036", "0.5330049", "0.53072166", "0.5290604", "0.52862704", "0.5...
0.7886564
0
Find servers with status "Communication failure" and save them to a file
def find_communication_failure_servers(servers): print('INFO: Finding servers with "Communication failure" status and saving result in file') with open(os.path.dirname(__file__) + '/communication_failure_list.txt', 'w+') as file: for server in servers: if server.status == "server_update_comm...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_recovered_servers(client):\n print(\"INFO: Determining recovered servers by comparing current servers with list in file...\")\n current_servers_list = []\n for server in client.servers():\n if server.status == \"server_update_comm_fail\":\n current_servers_list.append({\"id\": s...
[ "0.64982885", "0.6221347", "0.61516804", "0.5741765", "0.57228017", "0.56389916", "0.56194955", "0.5510259", "0.5408489", "0.5404776", "0.53996354", "0.5329651", "0.5317809", "0.5298589", "0.5267512", "0.52575266", "0.5253678", "0.5225752", "0.5221685", "0.51375675", "0.51358...
0.85111237
0
Compare list of servers in file with current ones to find recovered servers
def find_recovered_servers(client): print("INFO: Determining recovered servers by comparing current servers with list in file...") current_servers_list = [] for server in client.servers(): if server.status == "server_update_comm_fail": current_servers_list.append({"id": server.id}) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def replace_file(servers):\n print(\"INFO: Replacing server list in file with recent one...\")\n if os.path.exists(os.path.dirname(__file__) + '/communication_failure_list.txt'):\n try:\n os.remove(os.path.dirname(__file__) +\n '/communication_failure_list.txt')\n ...
[ "0.67536014", "0.6489799", "0.6314629", "0.5987139", "0.5953733", "0.58189934", "0.5703676", "0.55950475", "0.55163497", "0.5493828", "0.54845756", "0.54702073", "0.54463625", "0.5411403", "0.53845555", "0.5359683", "0.5357033", "0.53492767", "0.52340114", "0.52160895", "0.51...
0.7713606
0
Fetch each server that recovered to help build the email report
def build_server_list(client, diff): print("INFO: Fetching each server not in 'Communication failure' anymore...") servers = [] for server in diff: servers.append(client.server(str(server.id))) return servers
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def grab_server_data(self):\n\n for server, channels in self.servers.items():\n for channel in channels:\n cutoff = self.get_last_scrape_date(server, channel)\n print('grabbing data for {} : {} back to {} ...'.format(server, channel, cutoff.isoformat()))\n ...
[ "0.66062176", "0.65178025", "0.6010534", "0.58261585", "0.5772471", "0.57689935", "0.57268775", "0.5719524", "0.5677154", "0.5617324", "0.5561407", "0.55595326", "0.55461943", "0.5514094", "0.5493302", "0.54723006", "0.54697764", "0.54529583", "0.54460496", "0.5421955", "0.54...
0.6223516
2
Make an HTML list from server list for email
def create_body_html(client, server_list): servers_html = "" for server in server_list: link = '<a href="{}/servers/{}">{}</a>'.format( client.api_url, server.id, server.hostname) html = """{}<br />""".format(link) servers_html += html return servers_html
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_list_html(self, items):\n html = \"\"\"\n <html>\n\t\t\t<head>\n\t\t\t\t<title>OpenFDA Cool App</title>\n\t\t\t</head>\n\t\t\t<body>\n <ol>\n \"\"\"\n\n for item in items:\n html += \"<li>\" + item + \"</li>\\n\"\n\n html += \"\"\"\n ...
[ "0.6742271", "0.61657894", "0.61091125", "0.60555714", "0.60321444", "0.5965353", "0.59480834", "0.5918078", "0.5883233", "0.5821413", "0.5801513", "0.5782404", "0.57817954", "0.57756126", "0.57365865", "0.5734727", "0.57307297", "0.56886506", "0.5656043", "0.5625895", "0.562...
0.7079043
0
Sends an email using smtp configuration specified in the file smtp.conf
def send_email(client, smtp, server_list): content = create_body_html(client, server_list) # Email Configuration message = MIMEMultipart("alternative") message["Subject"] = '[Cyberwatch] Servers recovered from "Communication failure" report - ' + \ date.today().strftime("%m/%d/%y") message[...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_email():\n recipients = configs[\"email_to\"].split(\", \")\n email_body = test_email_content()\n if configs[\"smtp_ssl\"] == 1:\n server = smtplib.SMTP_SSL(configs[\"smtp_server\"])\n elif configs[\"smtp_tls\"] == 1:\n server = smtplib.SMTP(configs[\"smtp_server\"])\n ser...
[ "0.7491373", "0.73841417", "0.713573", "0.7031402", "0.7000115", "0.68528783", "0.68497354", "0.67722887", "0.67548084", "0.67065614", "0.67023444", "0.66815484", "0.6659069", "0.6657875", "0.6656062", "0.66539705", "0.6637547", "0.6632005", "0.66252553", "0.66038924", "0.659...
0.0
-1
Create a new managed set s can be any iterable to initialize the set
def __init__(self, s=None): self._index_map = {} self._list = [] if s is not None: for item in s: self.add(item)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new_set(*, ctx: context.ContextLevel, **kwargs) -> irast.Set:\n ir_set = irast.Set(**kwargs)\n ctx.all_sets.append(ir_set)\n return ir_set", "def __init__(self):\n self.EntireSet = []", "def __init__(self,s={}) -> None:\n\n self.set=list()", "def getSet(unique_name):", "def getSe...
[ "0.7399817", "0.6877598", "0.6862654", "0.66539514", "0.66539514", "0.6611376", "0.65953755", "0.65797526", "0.65312886", "0.64626396", "0.6415495", "0.6413129", "0.6328426", "0.6302573", "0.62722033", "0.6265865", "0.62559974", "0.62554675", "0.61868936", "0.6185098", "0.617...
0.61764705
20
Returns True if the item is in the set
def __contains__(self, item): return item in self._index_map
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def has_item(self, item):\n return item in self.set", "def has_item(self, item):\n return item in self.set", "def __contains__(self, item):\n\t\treturn item in self.__dict__.values()", "def __contains__(self, item):\n return item in self._data", "def __contains__(self, item):\n ...
[ "0.880693", "0.880693", "0.8195229", "0.8118078", "0.80649304", "0.8029175", "0.80107844", "0.80002207", "0.7948576", "0.79076195", "0.7889809", "0.7824471", "0.7711623", "0.7678021", "0.7670866", "0.76645726", "0.76564676", "0.7634171", "0.762813", "0.7605421", "0.7605179", ...
0.7233767
47
Add an element to the ManagedSet if it doesn't yet exist
def add(self, item): if item not in self: self._index_map[item] = len(self._list) self._list.append(item)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add(self, item):\n item = self._prepare_item(len(self), item)\n if item not in self._data:\n self._data.append(item)\n self.__log__.append(SetAdd(value=item))", "def add(self, item):\n if not (item in self.set):\n self.set[item] = True\n heapq....
[ "0.69828415", "0.6847343", "0.65095526", "0.63862497", "0.61189485", "0.6077914", "0.6077128", "0.60621035", "0.60568106", "0.60124046", "0.5962723", "0.58497447", "0.58171266", "0.58133477", "0.57736415", "0.57612514", "0.57485837", "0.5700885", "0.56979096", "0.5677765", "0...
0.5560599
34
Remove an item from the ManagedSet if it exists
def remove(self, item): if item in self: item_index = self._index_map[item] last_item = self._list[-1] # Swap in the item from the end of the list self._list[item_index] = last_item self._list.pop() self._index_map[last_item] = item_inde...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove(self, item):\n try:\n entry = self.set.pop(item)\n entry[-1] = self.REMOVED\n except KeyError:\n print(\"Can't remove a non-existing item\")", "def remove(self, item):\n try:\n self._data.remove(item)\n except ValueError as exc:\n...
[ "0.7588221", "0.7376286", "0.68292063", "0.6777084", "0.6600415", "0.6574729", "0.65593547", "0.6528472", "0.6528472", "0.65188915", "0.649716", "0.64792234", "0.6471408", "0.64354444", "0.6390395", "0.63859606", "0.6358534", "0.6353678", "0.62763745", "0.6259627", "0.6246596...
0.6277959
18
Remove a random item from the set, and return it
def pop_random(self): rand_index = randint(0, len(self._list) - 1) item = self._list[rand_index] self.remove(item) return item
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def popitem(self):\n all_items = self.items()\n removed_item = random.choice(all_items)\n self[removed_item[0]] = None\n return removed_item", "def getRandom(self):\n n = len(self.keys)\n while n > 0:\n index = random.randint(0, n - 1)\n my_key = se...
[ "0.8282262", "0.7164812", "0.7115214", "0.69544333", "0.68911844", "0.68830067", "0.6759804", "0.67500526", "0.67464954", "0.67222595", "0.6633977", "0.6544951", "0.6462838", "0.6461487", "0.6363013", "0.6315286", "0.6308643", "0.62988245", "0.6254927", "0.6241444", "0.621253...
0.79628265
1
Generate a compressed name from keys wrt config.
def get_compressed_name_from_keys(config: Dict[str, Any], keys: Tuple[Tuple[str]], allow_missing: bool = True): assert not isinstance(config, list), config name = '' for pre_keys in keys: v = config pre_keys_str = '' missing = False ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _make_pack_name(names):\n assert names\n tokens_in_names = [name.split('/') for name in names]\n common_prefix_tokens = []\n\n # Find the longest common prefix of tokens.\n while True:\n first_token_in_names = set()\n for tokens in tokens_in_names:\n if not tokens:\n break\n first_t...
[ "0.64022315", "0.63604325", "0.6284187", "0.61198986", "0.592737", "0.5915452", "0.59024495", "0.5840366", "0.5840366", "0.5803846", "0.57972753", "0.5789273", "0.5788882", "0.57822824", "0.5780839", "0.5775445", "0.57516694", "0.57482225", "0.5740038", "0.5716991", "0.570401...
0.7821243
0
List the keys corresponding to List or callable.
def list_keys_to_expand(config, root=True, pre_keys=()): if isinstance(config, dict): keys = () for k, v in sorted(config.items()): keys += list_keys_to_expand(v, root=False, pre_keys=pre_keys + (k,)) return keys elif (not root and isinstance(config, list)) or callable(config): assert pre_keys...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_key_list(self) -> list:\n return self.key_functs.keys()", "def keys(self) -> List:\n pass", "def keys(self, *args, **kwargs):\n return self._list(*args, **kwargs)", "def keys(self) -> List[str]:\n raise NotImplementedError", "def keys(self):\n raise NotImplementedErro...
[ "0.8176447", "0.7777549", "0.749392", "0.7440805", "0.7102301", "0.7062519", "0.7041881", "0.7037035", "0.701955", "0.69905293", "0.6981548", "0.6934253", "0.6925223", "0.6922672", "0.69192296", "0.6856144", "0.6827365", "0.6809344", "0.6800845", "0.6785259", "0.67648435", ...
0.0
-1
Expand configuration distribution specification.
def sample_configuration_dist(config, root=True, num_samples_per_dist=1): if isinstance(config, dict): return { k: sample_configuration_dist( v, root=False, num_samples_per_dist=num_samples_per_dist) for k, v in sorted(config.items()) } elif isinstance(config, list) and root: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _expand_spec(spec, **kwargs):\n fixed_params = {}\n variable_params = {}\n for k, v in spec.items():\n if isinstance(v, list):\n variable_params[k] = v\n elif isinstance(v, dict):\n # Try handling as distribution\n res = sa...
[ "0.57830215", "0.5412506", "0.52475715", "0.5171691", "0.51531947", "0.49469507", "0.48409817", "0.482933", "0.4787844", "0.47850314", "0.4766017", "0.47597107", "0.46887043", "0.4663835", "0.46525776", "0.46523", "0.4652122", "0.46401262", "0.46399802", "0.4630195", "0.45890...
0.45457044
25
Get a sample of config.
def get_configuration_sample(config, root=True): if isinstance(config, dict): return { k: get_configuration_sample(v, root=False) for k, v in sorted(config.items()) } elif isinstance(config, list): if root: return get_configuration_sample( config[np.random.randint(len(con...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_sample(config, n_sample=1):\n if config['distribution'] == 'binary':\n data = np.random.choice([0, 1], size=n_sample, replace=True, p=config['pmf'])\n\n elif config['distribution'] == 'discrete':\n data = np.random.choice(config['category'], size=n_sample, replace=True, p=config['pmf'])...
[ "0.66725135", "0.65855396", "0.6482443", "0.64281243", "0.62920535", "0.62203", "0.62141085", "0.6211423", "0.61809164", "0.61482966", "0.6130489", "0.60582256", "0.60312045", "0.6018113", "0.6018113", "0.59389967", "0.5933204", "0.5931536", "0.5909174", "0.590119", "0.587822...
0.7430664
0
Pass the arguments given by command line.
def __init__(self, args=''): self._args = args # Support Logging self._logger = logging.getLogger(__name__) log_level = 'DEBUG' if self._args.debug else 'INFO' self._logger.setLevel(log_level) logformat = logging.Formatter("%(levelname)s: %(message)s") stdout = l...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def main():\n args = parse_args()\n process_args(args)", "def parse_arguments(args):", "def main(args):", "def main(args):", "def command_line_args(parser):\n AbyssAssembler.command_line_args(parser)\n SpadesAssembler.command_line_args(parser)\n TrinityAssembler.command_line_args(parser)\n ...
[ "0.7333819", "0.7315869", "0.709411", "0.709411", "0.7064864", "0.7001522", "0.6990702", "0.6989935", "0.6989935", "0.69459844", "0.6928525", "0.6928525", "0.687338", "0.6740708", "0.6681569", "0.6681569", "0.6681569", "0.6681569", "0.6681569", "0.6681569", "0.6681569", "0....
0.0
-1
Reads the preflop lookup table preflop_EHSs.txt.
def read_lookup_table(hole_cards, lookup_table): sorted_hole = sorted(hole_cards) sorted_hole.reverse() card_strings = [Card.int_to_str(card) for card in sorted_hole] if card_strings[0][1] != card_strings[1][1]: suited = False else: suited = True card_strings[0] = card_strings[0...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read_hlas(fasta_fai):\n out = []\n with open(fasta_fai) as in_handle:\n for line in in_handle:\n if line.startswith(\"HLA\"):\n out.append(line.split()[0])\n return out", "def load_lookup_tables(file_names):\n\n # Check input argument type - - - - - - - - - - - - - ...
[ "0.5214545", "0.51523465", "0.50774", "0.5070679", "0.50630456", "0.5054708", "0.5031981", "0.50247204", "0.49250507", "0.49062192", "0.4888807", "0.4881296", "0.48757115", "0.48680875", "0.48369682", "0.48359004", "0.48050416", "0.4792676", "0.47846827", "0.47832748", "0.478...
0.5086216
2
Initialization variables and loading data
def __init__(self): self.running = 1 self.room = 1 self.set_automatic = 1 self.set_thermostat = 0 self.set_humidifier = 0 self.set_sprinklers = 0 self.set_ventilation = 0 self.settings_path = "settings.csv" self.desired_path = "rooms_desired_value...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_data(self):", "def load_data(self) -> None:", "def load_data(self):\n if self.debug:\n print(\"Loading data\")", "def init(self, **kwargs):\n self._d = {}\n self._th = None\n self._run = True\n self.load()", "def _initialize_data(self):\n self.r...
[ "0.77343583", "0.7713693", "0.7421551", "0.74176455", "0.7195016", "0.7080848", "0.70373166", "0.7013087", "0.7001275", "0.69835466", "0.69801617", "0.69212013", "0.68836963", "0.68681973", "0.68602926", "0.6836477", "0.6830069", "0.6815077", "0.6807112", "0.67994136", "0.678...
0.0
-1
Automatically change devices settings
def auto(self): self.set_thermostat = 1 if self.desired_values[0] > self.data[0] else 0 self.set_humidifier = 1 if self.desired_values[1] > self.data[1] else 0 self.set_sprinklers = 1 if self.desired_values[2] > self.data[2] else 0 self.set_ventilation = 1 if (self.desired_values[3] > se...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_settings_devices(self):\n self.set_thermostat, self.set_humidifier, self.set_sprinklers, self.set_ventilation = self.settings[3:]", "def open_settings(self):\n self.android_device_driver.adb.exec_adb_cmd(\n \"shell am start -a android.settings.SETTINGS\").wait()", "def on(config: dict)...
[ "0.75717664", "0.6487387", "0.6348191", "0.61788106", "0.61683166", "0.61518466", "0.6148382", "0.61440235", "0.61389786", "0.6121356", "0.6088338", "0.60738426", "0.60651356", "0.60635734", "0.601406", "0.60068804", "0.59988713", "0.59903884", "0.59721637", "0.59567684", "0....
0.0
-1
Function for emulate a launching devices, get value of change and set that
def launch_devices(self): self.data[0], temp = alghoritm.temperature(self.data[0], self.set_thermostat, 0) # get value HC35_3S.launch(self.data_path, self.samples_size, temp) # set it via device self.data[1], humidi = alghoritm.humidity(self.data[1], self.set_humidifier, 0) humidifier...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_change_brightness_of_the_devicetrue():", "def change_device(self):\n if self.state.ser:\n UsbHost.close_port(self.state.ser)\n device = self.CBDevices.currentText()\n if device:\n comport = self.devices[int(device)]\n self.state.ser = UsbHost.open_po...
[ "0.63758236", "0.61740834", "0.6054749", "0.60433406", "0.6002026", "0.5946447", "0.5946447", "0.591832", "0.5867906", "0.58041674", "0.578171", "0.57716215", "0.5766558", "0.5715131", "0.57112956", "0.57107544", "0.5666014", "0.55885583", "0.55696195", "0.5569229", "0.554301...
0.5704855
16
Load data from CSV files
def read_data(self): temperature_data = RS485.read_temperature(self.data_path) humidity_data = RS485.read_humidity(self.data_path) moisture_data = RH_010_GN.read_moisture(self.data_path) o2_data = LB_856.read_o2(self.data_path) co2_data = LB_856.read_co2(self.data_path) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def loadCSV(input_file):", "def load_data_csv():\r\n \r\n # Load lookup table\r\n path = 'data/id_lookup.csv'\r\n lookup_table = pd.read_csv(path, index_col=0)\r\n\r\n # Load song data\r\n path2 = 'data/data_lyrics_features.csv'\r\n data = pd.read_csv(path2, index_col=0)\r\n\r\n return data, lookup_table...
[ "0.7877938", "0.759222", "0.75817806", "0.7457923", "0.74297255", "0.7366995", "0.7305696", "0.729182", "0.7266087", "0.72470284", "0.7156001", "0.7114432", "0.70937014", "0.70597565", "0.7055762", "0.69832", "0.6959449", "0.69565874", "0.6942449", "0.69329506", "0.6932639", ...
0.0
-1
Read actual desired values from CSV file
def read_desired_values(self): self.desired_values = read_desired_values(self.desired_path, self.room)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read_csv():", "def read_csv_file(self):\n pass", "def get_data(self, csv_file):\n pass", "def loadCSV(input_file):", "def __obtain_data_from_csv__(self, csvfile):\n data = csvfile.readlines()\n data = self.__parse_string_for_delimiter__(data)\n return data", "def _r...
[ "0.79397357", "0.7410742", "0.7244259", "0.709767", "0.68508065", "0.66784024", "0.6676786", "0.65691286", "0.65635836", "0.6503509", "0.6491671", "0.6421233", "0.6415983", "0.6389252", "0.6364315", "0.633871", "0.63328934", "0.6316609", "0.62922555", "0.6290482", "0.620337",...
0.0
-1
Read actual settings from CSV file
def read_settings(self): self.settings = read_settings(self.settings_path)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read_csv_file(self):\n pass", "def read_csv():", "def _read_csv(self):\n with open(self._file_path, 'rb') as f:\n reader = csv.DictReader(f, delimiter=',')\n self._content = [row for row in reader]", "def loadCSV(input_file):", "def load_csv(self):\n self.data...
[ "0.7020487", "0.6802786", "0.6636211", "0.6442558", "0.63362825", "0.62536347", "0.6252917", "0.614084", "0.611332", "0.6086529", "0.6083055", "0.607521", "0.6070219", "0.6068629", "0.60419023", "0.60315603", "0.60211563", "0.59968203", "0.5986851", "0.5957817", "0.5908996", ...
0.5869355
24
Set devices values on/off
def set_settings_devices(self): self.set_thermostat, self.set_humidifier, self.set_sprinklers, self.set_ventilation = self.settings[3:]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def resetDeviceStates(self):", "def set_toggle_devices_enabled(self, track, xclip, ident, value = None):\n for device in track.devices:\n if(hasattr(device, 'parameters')):\n self._parent._device_actions.set_device_on_off(device, track, xclip, ident);", "def Set(self,value):\n ...
[ "0.70645505", "0.7058006", "0.6706693", "0.66463596", "0.66042775", "0.64724237", "0.6445534", "0.63705325", "0.63676846", "0.6358413", "0.6253338", "0.6170214", "0.60686815", "0.5999802", "0.59865546", "0.5983928", "0.59829843", "0.5971754", "0.5971754", "0.59580594", "0.593...
0.6983819
2
Help function to check the correct operation of the program
def plot(self): x = np.arange(5) # labels = ['temp', 'humi', 'mais', 'o2', 'co2'] plt.bar(x - 0.35/2, self.data, 0.35, label='actual') plt.bar(x + 0.35/2, self.desired_values, 0.35, label='desired') plt.ylim(-5, 80) plt.legend() plt.draw() plt.pause(0.000...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def usage():", "def usage():", "def usage():\n print(\"This program runs with command line arguments.\\n\"\n \"Available parameters:\\n\"\n \"\\t-h --help : help\\n\"\n \"\\t-f : file name or path\\n\"\n \"\\t-k : key file\\n\"\n \"\\t-o : operaion\\n\"\...
[ "0.71139324", "0.71139324", "0.70727", "0.67588127", "0.67382795", "0.6703698", "0.6696139", "0.66096044", "0.66091365", "0.6601356", "0.65277493", "0.65181434", "0.64331025", "0.64223593", "0.64211553", "0.6416539", "0.6379288", "0.63616896", "0.6334443", "0.63264126", "0.63...
0.0
-1
sents is a list of sentences returned by nltk.sent_tokenize
def non_answers(sents): matches = [{'regex_id': r['regex_id'], 'sentence': s, 'phrase': r['re'].search(s).group() } for s in sents for r in regexes if r['re'].search(s) is not None] if not matches: return None ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def tokenize_sentences(self, sents):\n token_sentence_list = []\n for sentence in sents:\n token_sentence_list.append(self.tokenizer(sentence))\n return token_sentence_list", "def tokenize_sents(sents, tokenizer):\n return [tokenizer(sent) for sent in sents]", "def sentences(...
[ "0.8273085", "0.79840225", "0.73435074", "0.73435074", "0.728733", "0.72776616", "0.71518403", "0.7131324", "0.70658165", "0.70015174", "0.6960332", "0.6859285", "0.6750411", "0.669615", "0.6688754", "0.6679756", "0.6662568", "0.6653295", "0.66051084", "0.660379", "0.66018254...
0.0
-1
See Pelleg's and Moore's for more details.
def loglikelihood(R, R_n, variance, M, K): if 0 <= variance <= EPS: res = 0 else: res = R_n * (np.log(R_n) - np.log(R) - 0.5 * (np.log(2 * np.pi) + M * np.log(variance) + 1)) + 0.5 * K if res == np.inf: res = 0 return res
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def regular(self):", "def _regr_basic():", "def exo2():", "def substantiate():", "def degibber(self):", "def mezclar_bolsa(self):", "def sth():", "def falcon():", "def exercise_b2_53():\r\n pass", "def g():", "def __call__(self) -> None:", "def support(self):", "def exercise_b2_106():\r\...
[ "0.66036844", "0.6600318", "0.64866984", "0.6417649", "0.6405187", "0.6382748", "0.63440806", "0.6330827", "0.63170177", "0.6301254", "0.61618525", "0.61485845", "0.61482483", "0.61257714", "0.6109756", "0.6098478", "0.6098441", "0.6098441", "0.6098441", "0.6098441", "0.60984...
0.0
-1
output the indices of a pair of clusters whose distance is the smallest
def detec_mfo_dist(betas): k = len(betas) min_dist = np.inf for i in range(k-1): for j in range(i+1,k): distance = np.sum((betas[i,:] - betas[j,:])**2) if distance < min_dist: MFO_index = [i,j] min_dist = distance return MFO_index
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def smallest_distance(self, clusters):\n i, j = numpy.unravel_index(numpy.argmin(clusters), clusters.shape)\n return clusters[i, j], i, j", "def slow_closest_pair(cluster_list):\n dist, idx1, idx2 = float(\"inf\"), -1, -1\n for idx_u in range(len(cluster_list)):\n for idx_v in range(le...
[ "0.7430634", "0.71578205", "0.7152571", "0.713903", "0.7126042", "0.7021916", "0.69771445", "0.6973648", "0.6949951", "0.69442433", "0.6940495", "0.69324505", "0.6727459", "0.6701706", "0.65744245", "0.6561031", "0.6556481", "0.651129", "0.65077263", "0.6481209", "0.64430726"...
0.0
-1
Merge the two centers with manyfitone association
def merge(centroids, MFO_index): fussion_centroid = (centroids[MFO_index[0]] + centroids[MFO_index[1]])/2 centroids = np.delete(centroids, MFO_index, axis=0) return np.vstack((centroids, fussion_centroid))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def merge_pores(self, n1, n2, setcategory='union', radius=None, center=None, check_throats=True, inner_category='inner', verbose=False):\n\n if not self.graph.has_node(n1) or not self.graph.has_node(n2):\n warn(\"Nodes {} or {} does not exist. Cannot merge them\".format(u, v))\n return...
[ "0.6356105", "0.6121738", "0.6055336", "0.59658766", "0.59658766", "0.57911676", "0.57794744", "0.5777705", "0.575305", "0.5727767", "0.57131493", "0.569286", "0.5615065", "0.5598778", "0.55485994", "0.5525544", "0.5491827", "0.5486056", "0.5469901", "0.54665923", "0.54495573...
0.5773375
8
output the equivalent classes from pairwise relation [[1,2],[2,3],[4,5]] > [[1,2,3],[4,5]]
def compute_equivalent_class(record): equivalent_class = {} class_members=[] max_class_number = -1 for pair in record: if (pair[0] in equivalent_class) and (not (pair[1] in equivalent_class)): equivalent_class[pair[1]] = equivalent_class[pair[0]] if (not(pair[0] in equivalent...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def equivalence_classes(self):\n\n # Two states `a` and `b` are j-equivalent if and only if there\n # is a bijection `\\varphi` between paths of length <= j\n # starting at `a` and paths starting at `b` with the following\n # properties: Let `p_a` be a path from `a` to `a'` and `p_b` a\...
[ "0.62841934", "0.5959602", "0.58290446", "0.57107425", "0.57038814", "0.56956035", "0.5680738", "0.562982", "0.56069076", "0.5600357", "0.5521769", "0.5511383", "0.55074245", "0.55074245", "0.5487679", "0.5446884", "0.5439978", "0.54043436", "0.54010254", "0.5384444", "0.5356...
0.5683296
6
merge centers in the same equivalent class
def batch_fussion(betas, class_members): merge_centers = None all_merge_indices = [] for c, merge_indices in enumerate(class_members): all_merge_indices += merge_indices if isinstance(merge_centers,np.ndarray): merge_centers = np.vstack((merge_centers,np.mean(betas[merge_indices]...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mergeCenters(nCenters):\r\n\tpath = os.getcwd()\r\n\tos.chdir('Centers/')\r\n\tcenter = np.zeros((0,128))\t\t#: Populator for centers\r\n\r\n\tfor i in os.listdir(os.getcwd()):\r\n\t Center = open(i,\"rb\")\t\t#: File pointer for centers file\r\n\t center = np.vstack((center, pickle.load(Center)))\t#Popu...
[ "0.6535946", "0.6191329", "0.6115653", "0.6022905", "0.59900016", "0.59891766", "0.59014755", "0.5845771", "0.57922643", "0.57680273", "0.5742475", "0.573608", "0.573608", "0.5734842", "0.57274073", "0.57219094", "0.56922454", "0.56858224", "0.5681211", "0.5643599", "0.563533...
0.0
-1
Metodo para calcular los dias entre la fecha de inicio y la fecha final
def _compute_days_tarea(self, cr, uid, ids, field, arg, context=None): import datetime result = {} records = self.browse(cr, uid, ids, context=context) for r in records: if r.date_start_tarea: d = time.strptime(r.date_start_tarea,'%Y-%m-%d %H:%M:%S') f...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def diveDates(self,start,finish):\n start = datetime.strptime(start,\"%Y-%m-%d\")\n finish = datetime.strptime(finish,\"%Y-%m-%d\")\n return start+(finish-start)/2", "def dias_desde_caso_0(self):\n\n self.covidbr['dias_caso_0'] = self.covidbr['data'] - self.covidbr['data'].iloc[0]\n ...
[ "0.6835163", "0.65805006", "0.65312827", "0.6462369", "0.6450312", "0.6374033", "0.6307957", "0.6285137", "0.6246967", "0.6159689", "0.5938541", "0.59264344", "0.5821794", "0.58151656", "0.58118457", "0.58064634", "0.57955575", "0.5751022", "0.571991", "0.57169217", "0.571523...
0.0
-1
SQL Constraints para validar que La fecha de inicio debe ser menor que la fecha final
def _check_dates_tareas(self, cr, uid, ids, context=None): for leave in self.read(cr, uid, ids, ['date_start_tarea', 'date_end_tarea'], context=context): if leave['date_start_tarea'] and leave['date_end_tarea']: if leave['date_start_tarea'] > leave['date_end_tarea']: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_sequence_for_days(self):\n # delta = (max(self.giorni) - min(self.giorni)).days + 1 # the difference returns a timedelta\n try:\n delta = abs(max(self.giorni).daysTo(min(self.giorni))) + 1\n if delta != len(self.giorni):\n raise ValidationError('dates n...
[ "0.66802496", "0.64251286", "0.62597007", "0.6187541", "0.61812466", "0.6089486", "0.5985262", "0.5954238", "0.5907971", "0.5902994", "0.5886131", "0.5882439", "0.58634484", "0.58231837", "0.5763819", "0.573449", "0.5717921", "0.5682444", "0.56750387", "0.5667743", "0.5633855...
0.0
-1
SQL Constraints para validar que La fecha de inicio debe ser menor que la fecha final
def _check_dates_tarea_start(self, cr, uid, ids, context=None): for leave in self.read(cr, uid, ids, ['date_start_tarea', 'date_start_proyecto'], context=context): if leave['date_start_tarea'] and leave['date_start_proyecto']: if leave['date_start_tarea'] < leave['date_start_proyecto...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_sequence_for_days(self):\n # delta = (max(self.giorni) - min(self.giorni)).days + 1 # the difference returns a timedelta\n try:\n delta = abs(max(self.giorni).daysTo(min(self.giorni))) + 1\n if delta != len(self.giorni):\n raise ValidationError('dates n...
[ "0.6679988", "0.6426486", "0.62599313", "0.6188688", "0.6182176", "0.60900605", "0.5985967", "0.5954658", "0.59088355", "0.5904568", "0.5887064", "0.5884011", "0.58638287", "0.58248", "0.5765948", "0.57343364", "0.57197255", "0.5681957", "0.5675307", "0.5667842", "0.5634694",...
0.5406441
47
SQL Constraints para validar que La fecha de inicio debe ser menor que la fecha final
def _check_dates_tarea_end(self, cr, uid, ids, context=None): for leave in self.read(cr, uid, ids, ['date_end_tarea', 'date_end_proyecto'], context=context): if leave['date_end_tarea'] and leave['date_end_proyecto']: if leave['date_end_tarea'] > leave['date_end_proyecto']: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_sequence_for_days(self):\n # delta = (max(self.giorni) - min(self.giorni)).days + 1 # the difference returns a timedelta\n try:\n delta = abs(max(self.giorni).daysTo(min(self.giorni))) + 1\n if delta != len(self.giorni):\n raise ValidationError('dates n...
[ "0.6680427", "0.6425462", "0.62594205", "0.6187928", "0.61815345", "0.60895884", "0.59854025", "0.5954201", "0.590856", "0.5903359", "0.58866584", "0.588292", "0.5863781", "0.5823783", "0.5765027", "0.5733856", "0.57183605", "0.568202", "0.56756467", "0.56681573", "0.5634456"...
0.0
-1
Extract the images into a 4D tensor [image index, y, x, channels]. Values are rescaled from [0, 255] down to [0.5, 0.5].
def extract_data(filename): print('Extracting', filename) with gzip.open(filename) as bytestream: bytestream.read(16) buf = bytestream.read(28 * 28 * 10000 * 1) data = numpy.frombuffer(buf, dtype=numpy.uint8).astype(numpy.float32) data = (data - (255 / 2.0)) / 255 data = data.reshape(10000, 28, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _extract(self, images):\n if (images.ndim != 4 or images.shape[0] <= 0 or\n images.shape[0] > self.batch_size or images.shape[1] not in [1, 3]):\n raise ValueError(f'Input images should be with shape [batch_size, '\n f'channel, height, width], where '\n ...
[ "0.65527594", "0.6362516", "0.6347995", "0.63292974", "0.625947", "0.62585825", "0.62153494", "0.61934483", "0.6182799", "0.6160032", "0.61571723", "0.606164", "0.60403836", "0.59810907", "0.5967399", "0.59663445", "0.5935928", "0.5923294", "0.59225285", "0.58962965", "0.5895...
0.0
-1
Extract the labels into a vector of int64 label IDs.
def extract_labels(filename): print('Extracting', filename) with gzip.open(filename) as bytestream: bytestream.read(8) buf = bytestream.read(10000) labels = numpy.frombuffer(buf, dtype=numpy.uint8).astype(numpy.int64) return labels
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def convert_to_ids(self, terms):\n vec = [self.get_id(label) for label in terms]\n return vec", "def _label_to_id(self, sequence_labels, dict_map):\n label_id_list = []\n for label in sequence_labels:\n if label not in dict_map:\n self.logger.warn(\"Label not...
[ "0.7547486", "0.7505124", "0.7039012", "0.700775", "0.6873091", "0.6785202", "0.676922", "0.6675606", "0.6547229", "0.65472174", "0.6520041", "0.65026706", "0.65026706", "0.6430125", "0.6411952", "0.63387406", "0.6327159", "0.63106453", "0.6276933", "0.6254199", "0.6231591", ...
0.5816024
61
Test aperture_photometry when error has units (see 176).
def test_aperture_photometry_with_error_units(): data1 = np.ones((40, 40), dtype=float) data2 = u.Quantity(data1, unit=u.adu) error = u.Quantity(data1, unit=u.adu) radius = 3 true_flux = np.pi * radius * radius unit = u.adu position = (20, 20) table1 = aperture_photometry(data2, Circula...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_aperture_photometry_inputs_with_mask():\n\n data = np.ones((5, 5))\n aperture = CircularAperture((2, 2), 2.0)\n mask = np.zeros_like(data, dtype=bool)\n data[2, 2] = 100.0 # bad pixel\n mask[2, 2] = True\n error = np.sqrt(data)\n data_in = data.copy()\n error_in = error.copy()\n ...
[ "0.69079345", "0.6512504", "0.62657374", "0.6050535", "0.5927566", "0.57785326", "0.5778429", "0.5767613", "0.566218", "0.5603356", "0.5592774", "0.55879194", "0.5550571", "0.55201626", "0.5513671", "0.54968745", "0.5489606", "0.5488023", "0.54835194", "0.544789", "0.54413337...
0.82502395
0
Test that aperture_photometry does not modify the input data or error array when a mask is input.
def test_aperture_photometry_inputs_with_mask(): data = np.ones((5, 5)) aperture = CircularAperture((2, 2), 2.0) mask = np.zeros_like(data, dtype=bool) data[2, 2] = 100.0 # bad pixel mask[2, 2] = True error = np.sqrt(data) data_in = data.copy() error_in = error.copy() t1 = aperture...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_aperture_photometry_with_error_units():\n\n data1 = np.ones((40, 40), dtype=float)\n data2 = u.Quantity(data1, unit=u.adu)\n error = u.Quantity(data1, unit=u.adu)\n radius = 3\n true_flux = np.pi * radius * radius\n unit = u.adu\n position = (20, 20)\n table1 = aperture_photometry(...
[ "0.6387848", "0.62934524", "0.6213696", "0.60203755", "0.60186976", "0.6006882", "0.59526944", "0.58965045", "0.5882132", "0.5878645", "0.58625317", "0.5860351", "0.5847825", "0.58367264", "0.58344615", "0.58279014", "0.5787623", "0.57459146", "0.569849", "0.56977993", "0.567...
0.87002504
0
Test elliptical exact aperture photometry on a grid of pixel positions.
def test_ellipse_exact_grid(x, y, r): data = np.ones((10, 10)) aperture = EllipticalAperture((x, y), r, r, 0.0) t = aperture_photometry(data, aperture, method='exact') actual = t['aperture_sum'][0] / (np.pi * r**2) assert_allclose(actual, 1)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def phantom_ellipses(n_points,E):\n \n #Rescaling according to image size \n E[:,0] = E[:,0]*n_points/2 #semiaxis a\n E[:,1] = E[:,1]*n_points/2 #semiaxis b\n E[:,2] = E[:,2]*n_points/2 #x\n E[:,3] = E[:,3]*n_points/2 #y\n E[:,4] = E[:,4]*math.pi/180\n \n x,y = np.meshgrid(np.arange(0,n...
[ "0.66793174", "0.6369313", "0.635344", "0.5881113", "0.57845265", "0.5761885", "0.57279414", "0.561903", "0.55827296", "0.55767804", "0.55325985", "0.55246985", "0.55024266", "0.5493475", "0.5487103", "0.5459197", "0.54441357", "0.5431681", "0.5411385", "0.5358013", "0.535433...
0.7887095
0
Test that nans and infs are properly masked [267].
def test_nan_inf_mask(value): data = np.ones((9, 9)) mask = np.zeros_like(data, dtype=bool) data[4, 4] = value mask[4, 4] = True radius = 2.0 aper = CircularAperture((4, 4), radius) tbl = aperture_photometry(data, aper, mask=mask) desired = (np.pi * radius**2) - 1 assert_allclose(tb...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_annular_fpm():\n\n # test some semi-random cases - is the array size as expected? \n assert masks.annular_fpm(3, 2, np.inf).shape == (3*2*2, 3*2*2)\n assert masks.annular_fpm(3, 5, np.inf).shape == (3*5*2, 3*5*2)\n assert masks.annular_fpm(3, 5, 10).shape == (3*10*2, 3*10*2)\n assert masks....
[ "0.6896983", "0.65440094", "0.64346445", "0.6424667", "0.6418263", "0.6261051", "0.6158754", "0.6155667", "0.61021805", "0.6079935", "0.59743565", "0.5958104", "0.5948614", "0.59462935", "0.59143627", "0.5910886", "0.59006315", "0.5854176", "0.5841831", "0.5824284", "0.582298...
0.65316564
2
Regression test to check that length1 aperture list appends a "_0" on the column names to be consistent with list inputs.
def test_scalar_aperture(): data = np.ones((20, 20), dtype=float) ap = CircularAperture((10, 10), r=3.0) colnames1 = aperture_photometry(data, ap, error=data).colnames assert (colnames1 == ['id', 'xcenter', 'ycenter', 'aperture_sum', 'aperture_sum_err']) colnames2 = aper...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_add_list_to_df(self):\n self.assertEqual(self.test_df.shape[1] + 1, em.add_list_to_df(self.test_list, self.test_df).shape[1])", "def test_list_to_column(self):\n\n good_arg = [13, 14, 15, 16]\n bad_arg = [13, 14, 15, 16, 17]\n ld = Lambdata(self.df)\n\n good_df = ld.li...
[ "0.60576147", "0.5731071", "0.5648939", "0.5648777", "0.55926967", "0.5588755", "0.54673654", "0.54425526", "0.54072493", "0.5385336", "0.53755796", "0.5357961", "0.5279477", "0.52708286", "0.5265564", "0.5232351", "0.5222445", "0.52125543", "0.5208126", "0.52043056", "0.5203...
0.5623747
4
Regression test that nonfinite data values outside of the aperture mask but within the bounding box do not affect the photometry.
def test_nan_in_bbox(): data1 = np.ones((101, 101)) data2 = data1.copy() data1[33, 33] = np.nan data1[67, 67] = np.inf data1[33, 67] = -np.inf data1[22, 22] = np.nan data1[22, 23] = np.inf error = data1.copy() aper1 = CircularAperture((50, 50), r=20.0) aper2 = CircularAperture(...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_aperture_photometry_inputs_with_mask():\n\n data = np.ones((5, 5))\n aperture = CircularAperture((2, 2), 2.0)\n mask = np.zeros_like(data, dtype=bool)\n data[2, 2] = 100.0 # bad pixel\n mask[2, 2] = True\n error = np.sqrt(data)\n data_in = data.copy()\n error_in = error.copy()\n ...
[ "0.6720967", "0.6610739", "0.6296814", "0.61645174", "0.6088839", "0.60787433", "0.5982765", "0.59556407", "0.5947607", "0.58739126", "0.58470315", "0.58464575", "0.5712174", "0.57064", "0.57048935", "0.5660747", "0.5626591", "0.5626591", "0.5626591", "0.5622805", "0.5616519"...
0.7124479
0
Regression test to check that scalar SkyCoords are added to the table as a length1 SkyCoord array.
def test_scalar_skycoord(): data = make_4gaussians_image() wcs = make_wcs(data.shape) skycoord = wcs.pixel_to_world(90, 60) aper = SkyCircularAperture(skycoord, r=0.1 * u.arcsec) tbl = aperture_photometry(data, aper, wcs=wcs) assert isinstance(tbl['sky_center'], SkyCoord)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_xy(self):\n x = np.array([[1,3], [2,8], [1,3]])\n y = np.array([1,1,-1])\n lro = LogisticRegressionOptimiser(x,y)\n expected = np.array([[1,3], [2,8], [-1,-3]])\n for i in 0,1,2:\n for j in 0,1:\n self.assertEqual(lro.xy[i][j], expected[i][j])", "def test_scalar_index(self):\n...
[ "0.5772283", "0.5675139", "0.5644284", "0.5608696", "0.5585975", "0.5573823", "0.54413795", "0.5437408", "0.5400953", "0.5393124", "0.5352665", "0.53412086", "0.5340118", "0.53243935", "0.5320892", "0.531939", "0.5305857", "0.5282068", "0.52805465", "0.5274832", "0.5256645", ...
0.5873713
0
Constructor of user class.
def __init__(self, id_user, description, ratings): self.id_user = id_user self.description = description self.ratings = ratings self.seen = {} # Store key of the already seen films for rating in ratings: self.seen[rating[0]] = True
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, user=None):\n self.user = user", "def __init__(self, user):\n\n if isinstance(user, dict):\n # Every user must have these values\n self.id = user['id']\n self.name = user['first_name']\n\n # These are optional\n self.username...
[ "0.8175485", "0.80110633", "0.79697067", "0.78595746", "0.7674515", "0.75313747", "0.7475908", "0.74128264", "0.7325977", "0.73237973", "0.73103154", "0.73069423", "0.7303166", "0.72658205", "0.7237329", "0.7215348", "0.72081065", "0.718594", "0.71829504", "0.7182479", "0.718...
0.0
-1
User description formatted as string
def to_string(self): return "User: {} Description: {} Ratings: {}".format(self.id_user, self.description, self.ratings)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def clean_user_desc(self):\n desc = self.data['user']['description']\n if desc is not None:\n desc = ' '.join(re.sub(\"(RT : )|(@[\\S]+)|(&\\S+)|(http\\S+)\", \" \", desc).split())\n desc = \" \".join(re.sub(\"(#\\S+)\", ' ', desc).split())\n desc = ''.join(list(filte...
[ "0.74948144", "0.7465629", "0.7337709", "0.7337709", "0.73087656", "0.70717615", "0.70207506", "0.6989267", "0.6968106", "0.6956012", "0.6956012", "0.69315743", "0.6842594", "0.68080837", "0.68080837", "0.6773586", "0.67527544", "0.67507523", "0.6748187", "0.6743495", "0.6736...
0.6687835
51
Getter of the user id.
def get_user_id(self): return self.id_user
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_id(self):\n return self.user_id", "def get_id(self) -> int:\n return self.user_id", "def user_id(self):\n return self._user_id", "def user_id(self):\n return self._user_id", "def user_id(self):\n return self._user_id", "def user_id(self):\n return self._u...
[ "0.8740212", "0.8674682", "0.8466421", "0.8466421", "0.8466421", "0.8466421", "0.8466421", "0.84438294", "0.84438294", "0.8365442", "0.8362073", "0.83430153", "0.8284895", "0.8284895", "0.8263458", "0.8238554", "0.82361627", "0.82293457", "0.8197898", "0.8093313", "0.80851257...
0.8879019
0
Getter of ratings list for this user.
def get_ratings(self): return self.ratings
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_user_ratings(self, user_id):\n return self.ratings[self.ratings['user_id'] == user_id]", "def get_ratings(self):\n return Vote.objects.filter(content_type=self.get_content_type(), object_id=self.instance.pk, key=self.field.key)", "def user_ratings(user_id):\n return _fetch_records(f\"...
[ "0.7477732", "0.7453791", "0.73936325", "0.72100174", "0.7001172", "0.69021744", "0.68245584", "0.67234373", "0.6693334", "0.66076666", "0.65877724", "0.6586307", "0.6462181", "0.6363747", "0.63283545", "0.61764896", "0.6175898", "0.61114925", "0.61114925", "0.6096961", "0.60...
0.83241516
1
Method to check if a movie have been already seen for the given user.
def check_movie_seen(self, id_movie): if id_movie in self.seen: return True return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new_watched_movie(username: str, movie_id: int) -> bool:\n with connection:\n all_movies = connection.execute(MOVIES_IDS, (movie_id,)).fetchone()\n all_usernames = connection.execute(USERS_IDS, (username,)).fetchone()\n if all_usernames is not None and all_movies is not None:\n ...
[ "0.62960756", "0.6231976", "0.609444", "0.6070275", "0.60486317", "0.6042864", "0.6039808", "0.6021467", "0.5981415", "0.59635645", "0.5831276", "0.58286434", "0.5827806", "0.5819191", "0.579271", "0.5785383", "0.57851636", "0.5760467", "0.57585835", "0.57534826", "0.5748277"...
0.7359592
0
Constructor of the movie class
def __init__(self, id_movie, title, tags, ratings): self.id_movie = id_movie self.title = title self.tags = tags self.ratings = ratings
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, movie_title, movie_storyline, poster_image, trailer_youtube, imdb):", "def __init__(self, movie_title, poster_image, trailer_youtube, movie_release_data, genre):\n # initialize instance of class Movie\n self.title = movie_title\n self.poster_image_url = poster_image\n ...
[ "0.81332725", "0.8057832", "0.80372345", "0.8007488", "0.7876238", "0.7782773", "0.7781757", "0.7778634", "0.7770506", "0.7763023", "0.77430177", "0.7673336", "0.76395553", "0.75985646", "0.7590946", "0.75906765", "0.75757456", "0.7567521", "0.7497632", "0.74749136", "0.74370...
0.7570345
17
Getter of movie tags
def get_tags(self): return self.tags
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def tags():", "def getTags(self,):\n\t\treturn self.tags;", "def get_tags(self):\n return self.tags", "def tags(self):\n return self.get(\"tags\")", "def tags(self) -> Optional[Any]:\n return pulumi.get(self, \"tags\")", "def get_tag_object(self) -> Any:\n return self.tags", ...
[ "0.68689597", "0.6856743", "0.6677562", "0.66561365", "0.65500724", "0.65472263", "0.6528084", "0.64343613", "0.6412823", "0.6399436", "0.6379113", "0.6379113", "0.6379113", "0.6379113", "0.6375339", "0.6375339", "0.6369175", "0.6369175", "0.6369175", "0.6369175", "0.6369175"...
0.64078057
9
Getter of movie id
def get_movie_id(self): return self.id_movie
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_movie_id(self) -> str:\n return self.movie.id", "def _get_ID(self):\n raw_data = imdb.search_for_title(self.title)\n if len(raw_data) > 1:\n raw_data = raw_data[0] # Pulls the first value of the title (the closest match)\n # if there is more than one\n s...
[ "0.8985618", "0.72579557", "0.7143325", "0.6941592", "0.6938852", "0.68658173", "0.67975396", "0.6750645", "0.67016894", "0.66771835", "0.6601591", "0.6580242", "0.6561278", "0.65610945", "0.6541132", "0.6535963", "0.65356594", "0.65356594", "0.65356594", "0.65356594", "0.653...
0.8726083
1
Getter of movie title
def get_title(self): return self.title
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fetch_title(self, movie_id):\n movie = tmdbsimple.Movies(movie_id)\n request = movie.info()\n\n return movie.title", "def get_title():", "def getTitle(movieInfo):\n if \"title\" in movieInfo:\n #We remove the punctuation\n title = \"\".join(c for c in movieInfo[\"title...
[ "0.8006523", "0.79383", "0.79006845", "0.7776308", "0.7776308", "0.7776308", "0.7769293", "0.763644", "0.763644", "0.763644", "0.760456", "0.75924677", "0.75924677", "0.756542", "0.7538967", "0.75355107", "0.75276333", "0.7488611", "0.7444244", "0.7436668", "0.74352837", "0...
0.762117
10
Getter of ratings list for this movie. Pair (user, rating)
def get_ratings(self): return self.ratings
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def user_ratings(user_id):\n return _fetch_records(f\"SELECT item_id, rating_type FROM ratings WHERE user_id = {user_id}\")", "def _get_user_ratings(self, user_id):\n return self.ratings[self.ratings['user_id'] == user_id]", "def ratings_usuarios(username, ratings):\n return list(filter(lambda x: ...
[ "0.7654455", "0.75835025", "0.7034352", "0.7018935", "0.68056756", "0.67744166", "0.6699223", "0.66923803", "0.66044664", "0.6584102", "0.64854413", "0.63792723", "0.6326823", "0.63158023", "0.63092196", "0.62783813", "0.62779266", "0.6260052", "0.62443334", "0.62352544", "0....
0.77323925
1
Get users with their ratings of the films
def get_users(self): users = {} for index, row in self.users.iterrows(): user_id = int(row[0]) description = row[1] user_ratings = [] ratings = self.ratings.loc[self.ratings[0] == user_id] # Get user ratings for index_ratings, r...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def user_ratings(user_id):\n return _fetch_records(f\"SELECT item_id, rating_type FROM ratings WHERE user_id = {user_id}\")", "def get_users_movies(myRatings):\n #return [x[1] for x in myRatings]\n return list(myRatings.map(lambda x: x[1]).collect())", "def ratings_usuarios(username, ratings):\n re...
[ "0.6964112", "0.6809451", "0.67298615", "0.65244675", "0.6423165", "0.6373602", "0.63445354", "0.6316285", "0.6250459", "0.6183882", "0.6173987", "0.6153373", "0.614204", "0.6126653", "0.61181355", "0.6086368", "0.6040397", "0.59927994", "0.5991246", "0.59750855", "0.59494996...
0.0
-1
Get movies with their tags
def get_movies(self): movies = {} for index, movie in self.movies.iterrows(): id_movie = int(movie[0]) title = movie[1] movie_tags = [] movie_ratings = [] # Get tags for each movie tags = self.movies_tags.loc[self.movies_tags[0]...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_movies():\n tree = get_tree()\n movie_list = [movie.get(\"title\") for movie in tree.getroot().findall(\"movie\")]\n return movie_list", "def get_keywords_for_movie(url):\n pass", "def getMovies(idMovies):\n\n return [ getMovie(idMovie) for idMovie in idMovies ]", "def __tags_to_movies...
[ "0.69026285", "0.6240329", "0.6185785", "0.613752", "0.60744643", "0.6067202", "0.6046541", "0.60125107", "0.5992258", "0.5971938", "0.59680724", "0.59572107", "0.59348136", "0.5919582", "0.5892605", "0.5892192", "0.5872411", "0.5847143", "0.58261526", "0.58239055", "0.580909...
0.5151446
94
Write serialized object in a file
def write_serialized(self): # If file is yet created, return data and do not create it again if os.path.isfile(cfg.serialized): return None print("Creating users array...") users = self.get_users() print("Creating movies array...") movies = self.get_movies(...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_file(self, file_io):\n pickle.dump(self.__object, file_io)", "def pickle_write(file_path, obj):\n\n with open(file_path, 'wb') as file:\n pickle.dump(obj, file)", "def serialize_obj(obj, filename):\n\n f = open(filename, 'wb')\n pickle.dump(obj, f)\n f.close()", "def write_to_f...
[ "0.7990699", "0.78128994", "0.7747138", "0.77351314", "0.770084", "0.768513", "0.76555765", "0.76163775", "0.7589536", "0.7576737", "0.7561195", "0.75413436", "0.7528892", "0.75037986", "0.7498625", "0.7463269", "0.744505", "0.7435551", "0.74297565", "0.7413303", "0.73993945"...
0.0
-1
Load file from pickle or create it if not exists
def load_serialized(self): if not os.path.isfile(cfg.serialized): serialized = self.write_serialized() else: print("Serialized object exists. Reading from disk...") with open(cfg.serialized, 'rb') as file: serialized = pickle.load(file) return...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_or_create_db(self):\n try:\n with open(self._filename, 'rb') as f:\n self.db = pickle.load(f)\n except FileNotFoundError:\n pass", "def pickle_load(path):\n if os.path.isfile(path):\n file = pickle.load(open(path, \"rb\"))\n return file...
[ "0.73671395", "0.7074244", "0.7026601", "0.6962436", "0.69058627", "0.6887788", "0.68675435", "0.68597704", "0.68209445", "0.6775289", "0.6747543", "0.6731842", "0.67144233", "0.66686815", "0.6662018", "0.6662018", "0.6638949", "0.661873", "0.65994537", "0.659881", "0.6575704...
0.0
-1
Write similarities data to file
def write_similarities(self, data): # If file is yet created, return data and do not create it again if os.path.isfile(cfg.similarities): return None with open(cfg.similarities, 'wb') as similarities: print("Storing data as serialized object...") pickle.dump(...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def record_similarities(similarities):\n writer = open(\"similarities.txt\", \"w\")\n for userA in similarities.keys():\n for userB in similarities[userA].keys():\n writer.write(userA + \"\\t\" + userB + \"\\t\" +\n str(similarities[userA][userB]) + \"\\n\")\n wri...
[ "0.68487245", "0.6322778", "0.62223566", "0.608114", "0.6032401", "0.5957932", "0.5846", "0.581992", "0.58038425", "0.5798109", "0.5784611", "0.57362115", "0.56961566", "0.5652088", "0.56154805", "0.56049746", "0.55978143", "0.55934703", "0.55828327", "0.55662423", "0.5545500...
0.77305156
0
Load similarities pickle data
def load_similarities(self): if not os.path.isfile(cfg.similarities): return None else: print("Serialized object exists. Reading from disk...") with open(cfg.similarities, 'rb') as file: data = pickle.load(file) return data
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_data():\r\n f = gzip.open('mnist.pkl.gz', 'rb')\r\n training_data, validation_data, test_data = pickle.load(f,encoding='bytes')\r\n f.close()\r\n return (training_data, validation_data, test_data)", "def write_similarities(self, data):\n # If file is yet created, return data and do no...
[ "0.63505393", "0.63323516", "0.6323051", "0.6226563", "0.6211917", "0.6082885", "0.6041092", "0.6009795", "0.5966512", "0.58577603", "0.58408076", "0.5830951", "0.5827306", "0.57913244", "0.5778014", "0.5771801", "0.57601976", "0.57570964", "0.5746246", "0.57078785", "0.56944...
0.7810446
0
Initializes our connectors by giving them a handler function.
def initConnectors(self): def handlerFunc(message, responseFunc): for h in self._handlers: h.handleMessage(message, responseFunc) getLogger(__name__).debug('Initializing %d connectors...' % len(self._connectors)) for c in self._connectors: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _init(self, connection_strings):\n # Init connections\n self._connections = []\n for s in connection_strings:\n d = Dict() # don't do Dict(foo=x) bc PyScript only supports that for dict\n self._connections.append(d)\n d.fullname = s\n d.type = s...
[ "0.6854127", "0.6759487", "0.6748176", "0.6468161", "0.6428388", "0.63626826", "0.6295971", "0.62636906", "0.6258875", "0.62326473", "0.616134", "0.61134547", "0.60776216", "0.6075216", "0.60286105", "0.6026851", "0.6011213", "0.60032165", "0.5989295", "0.5989295", "0.5989295...
0.8177971
0
Iteratively splits data with stratification. This function is based on the iterative_train_test_split function from the skmultilearn.model_selection package, but uses pandas dataframes as input and output.
def iterative_train_test(X, y, test_size): stratifier = IterativeStratification(n_splits=2, order=2, sample_distribution_per_fold=[test_size, 1.0-test_size]) train_indexes, test_indexes = next(stratifier.split(X, y)) X_train, y_train = X.iloc[train_indexes], y[train_indexes] X_test, y_test = X.iloc[tes...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def split_data(input_df, output_df):\n return train_test_split(input_df, output_df, test_size=0.2, random_state=42,\n stratify=output_df)", "def split(df, stratify_by=None):\n \n if stratify_by == None:\n train, test = train_test_split(df, test_size=.3, random_state=123...
[ "0.7940847", "0.77700734", "0.73608685", "0.72325754", "0.7231763", "0.7201539", "0.7191493", "0.71370035", "0.7097345", "0.70749754", "0.7068613", "0.70635283", "0.703297", "0.7010203", "0.69998264", "0.6987067", "0.69493777", "0.6917207", "0.69099796", "0.6895471", "0.68920...
0.682493
24
Read a pulse of SPI data on a pin that corresponds to DYMO scale output protocol (12 bytes of data at about 14KHz), timeout is in seconds
def get_scale_data(pin, timeout=1.0): timestamp = time.monotonic() with pulseio.PulseIn(pin, maxlen=96, idle_state=True) as pulses: pulses.pause() pulses.clear() pulses.resume() while len(pulses) < 35: if (time.monotonic() - timestamp) > timeout: rais...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def s_read(self, timeout = 1):\n if self.s.is_open:\n data = [] \n b = bytearray()\n try:\n self.s.timeout = 3\n data = self.s.read(1)\n \n if not len(data):\n return b\n\n self....
[ "0.6665904", "0.6170786", "0.6145323", "0.61205214", "0.6039192", "0.6033334", "0.59552085", "0.5954513", "0.58192575", "0.5769836", "0.5758939", "0.56423473", "0.5639176", "0.5637689", "0.56207716", "0.56185025", "0.5606741", "0.5584944", "0.55758065", "0.5558758", "0.554726...
0.75666636
0
Summarizes all flag values in a string, to be used in output filenames.
def GetEncodedParams(): if FLAGS.debug: import ptvsd print("Waiting for debugger attach") ptvsd.enable_attach(address=('localhost', 5678), redirect_output=True) ptvsd.wait_for_attach() breakpoint() if FLAGS.use_signac: import signac project = signac.get_project(root=FLAGS.signac_root) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _parse_flags(self, flags):\n s = ''\n for flag in flags:\n if len(s):\n s += ' | '\n s += 'gf.sim.VariableFlag.%s' % (flag)\n if len(s):\n return s\n else:\n return '0'", "def parseFlags(self):\n # Blank return value.\n retVal = \"\"\n \n try...
[ "0.62020266", "0.596622", "0.58193195", "0.5534479", "0.54420453", "0.5390735", "0.5235439", "0.52093524", "0.5140313", "0.509892", "0.4991748", "0.49601457", "0.49280116", "0.49063626", "0.49063626", "0.48861432", "0.4871902", "0.48699248", "0.48682913", "0.48568994", "0.482...
0.0
-1
encode convex hulls to network input format
def _encode_convex_hull(record): max_encode_len = max(seq_len) max_decode_len = max(seq_len) + 1 + 1 total_len = max_encode_len + max_decode_len encoder_seq, hull = record encoder_seq_len = len(encoder_seq) # add new dimension for the [start] token encoder_seq = [(0., *e) for e in encoder_seq] # creat...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _convex_hull(points):\n\n # Sort the points lexicographically (tuples are compared lexicographically).\n # Remove duplicates to detect the case we have just one unique point.\n points = sorted(set(points))\n\n # Boring case: no points or a single point, possibly repeated multiple times.\n if len...
[ "0.58518094", "0.5845417", "0.57677484", "0.57292026", "0.5701482", "0.5699452", "0.5666843", "0.5633451", "0.5616808", "0.5535729", "0.5463705", "0.54190964", "0.5377508", "0.5347325", "0.5336038", "0.5333922", "0.5331519", "0.5311888", "0.5309981", "0.53056556", "0.52919686...
0.6956518
0
Stacks are comprised of multiple hosts. Each host may be located in different cloud accounts. This method returns a map of the underlying driver implementation and the hosts that running in the account. host_ids (list); a list of primary keys for the hosts we're interested in (dict); each key is a provider driver imple...
def get_driver_hosts_map(self, host_ids=None): host_queryset = self.get_hosts(host_ids) # Create an account -> hosts map accounts = {} for h in host_queryset: accounts.setdefault(h.get_account(), []).append(h) # Convert to a driver -> hosts map result = {} ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_host_configs(self, hostids, **kwargs):\n host_configs = {}\n for hostid in hostids:\n host_configs[hostid] = self.get_host_config(hostid, **kwargs)\n return host_configs", "def query_hosts(self, force=False):\n CACHE_KEY = 'salt-cloud-full-query'\n\n cached_r...
[ "0.6461176", "0.62735856", "0.60457814", "0.5975142", "0.5896362", "0.5873509", "0.5828188", "0.5788435", "0.5750981", "0.574665", "0.57066274", "0.56011957", "0.55321527", "0.55266124", "0.55064696", "0.54972166", "0.54785377", "0.5460819", "0.54548657", "0.54415405", "0.543...
0.7679804
0
Quick way of getting all hosts or a subset for this stack. (list); list of primary keys of hosts in this stack (QuerySet);
def get_hosts(self, host_ids=None): if not host_ids: return self.hosts.all() return self.hosts.filter(id__in=host_ids)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def list(self, **kwargs):\n\n return self.getResourceManager() \\\n .getSdk() \\\n .hosts \\\n .list(**kwargs)", "def get_hosts(self):\n\n raise NotImplementedError", "def hosts(self):\n\n return self._get_list_field(\"hosts\", lambda x...
[ "0.6386337", "0.6371365", "0.63523024", "0.63523024", "0.6272247", "0.6215245", "0.6201035", "0.6201035", "0.616472", "0.6138865", "0.6128013", "0.6115967", "0.6107518", "0.60520285", "0.6051724", "0.60374975", "0.6008605", "0.6000928", "0.599559", "0.59938854", "0.598613", ...
0.6725173
0
Creates host objects on this Stack. If no arguments are given, then all hosts available based on the Stack's blueprint host definitions will be created. If args are given, then only the `count` for the given `host_definition` will be created. host_definition (BlueprintHostDefinition object); the host definition to use ...
def create_hosts(self, host_definition=None, count=None, backfill=False): created_hosts = [] if host_definition is None: host_definitions = self.blueprint.host_definitions.all() else: host_definitions = [host_definition] for hostdef in host_definitions: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def post(self):\n\n try:\n if \"hosts\" in self.jbody:\n hostnames = self.jbody[\"hosts\"]\n else:\n hostnames = [{\"hostname\": self.jbody[\"hostname\"]}]\n except KeyError as err:\n raise exc.BadRequest(\n \"Missing Requi...
[ "0.4938579", "0.48584768", "0.47865078", "0.47671604", "0.47439453", "0.47246405", "0.4700411", "0.46670032", "0.45571178", "0.45547783", "0.44747478", "0.43636113", "0.43369415", "0.42789087", "0.4247567", "0.4242754", "0.4227977", "0.4216803", "0.42011896", "0.42005447", "0...
0.8422698
0
Uses saltcloud to query all the hosts for the given stack id.
def query_hosts(self, force=False): CACHE_KEY = 'salt-cloud-full-query' cached_result = cache.get(CACHE_KEY) if cached_result and not force: logger.debug('salt-cloud query result cached') result = cached_result else: logger.debug('salt-cloud query re...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def all_hosts(self):\n ...", "def get_stacking_stacks_by_stack_id(self, stack_id, *, fields=None, **kwargs):\n function_endpoint = urljoin(self._baseurl, 'stacking/stacks/{stack_id}'.format(stack_id=stack_id))\n return self._call('GET', function_endpoint, **kwargs)", "def get(self, request...
[ "0.6205435", "0.6024829", "0.60159945", "0.59807694", "0.595565", "0.5935895", "0.59275913", "0.58967364", "0.58842933", "0.5843488", "0.5838476", "0.58124864", "0.5785423", "0.5756203", "0.5662017", "0.56044453", "0.5555758", "0.5528058", "0.55251485", "0.55106646", "0.54707...
0.6475528
0
It should delegate to the hardware API to calibrate the gripper.
async def test_calibrate_gripper( decoy: Decoy, ot3_hardware_api: OT3API, _mock_ot3_calibration: None, params_probe: CalibrateGripperParamsJaw, expected_hc_probe: GripperProbe, ) -> None: subject = CalibrateGripperImplementation(hardware_api=ot3_hardware_api) params = CalibrateGripperParams...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def calibrate_gripper(self):\n self.gripper = Gripper(self.gripper_side)\n self.gripper.calibrate()\n self.gripper.open()\n self.vacuum_sensor = AnalogIO(self.gripper_side + '_vacuum_sensor_analog')\n if rospy.get_param('verbose'):\n rospy.loginfo('Calibrated gripper. ...
[ "0.75418216", "0.7135867", "0.67792577", "0.6580618", "0.65281117", "0.6497911", "0.6455138", "0.63598543", "0.6339586", "0.6328379", "0.62397826", "0.6181482", "0.6150413", "0.6126467", "0.61043966", "0.6070043", "0.6048816", "0.6010795", "0.59791523", "0.59572184", "0.59167...
0.5706692
26
It should delegate to hardware API to calibrate the gripper & save calibration.
async def test_calibrate_gripper_saves_calibration( decoy: Decoy, ot3_hardware_api: OT3API, _mock_ot3_calibration: None, ) -> None: subject = CalibrateGripperImplementation(hardware_api=ot3_hardware_api) params = CalibrateGripperParams( jaw=CalibrateGripperParamsJaw.REAR, otherJawOff...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _doCalibration(self):\n self._cmdCalibration(2)", "def photometric_calibration():\n pass", "def _calibrate(self, Otrain, Ftrain, Feval):\n raise NotImplementedError()", "def calibrate_gripper(self):\n self.gripper = Gripper(self.gripper_side)\n self.gripper.calibrate()\...
[ "0.7903501", "0.72188723", "0.715543", "0.6955527", "0.6883555", "0.68081695", "0.6804072", "0.67732644", "0.67554444", "0.66887903", "0.66198134", "0.6617778", "0.6552011", "0.65246826", "0.6487285", "0.6455561", "0.644588", "0.63531816", "0.62793285", "0.62448484", "0.62343...
0.5947198
36
Data should not be saved when an error is raised.
async def test_calibrate_gripper_does_not_save_during_error( decoy: Decoy, ot3_hardware_api: OT3API ) -> None: subject = CalibrateGripperImplementation(hardware_api=ot3_hardware_api) params = CalibrateGripperParams( jaw=CalibrateGripperParamsJaw.REAR, otherJawOffset=Vec3f(x=4.4, y=5.5, z=6....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save_data(self):\n pass", "def saveData(self):\n pass", "def save(self):\r\n try:\r\n self.process_save()\r\n except InputError as ex:\r\n print(ex)\r\n self.save()\r\n except KeyError:\r\n print(\"No saved data to save/load. Pl...
[ "0.6786101", "0.67231554", "0.6600586", "0.65661645", "0.6451117", "0.64248633", "0.629678", "0.62577516", "0.6201316", "0.6155443", "0.61142343", "0.611215", "0.6106852", "0.6094064", "0.6088099", "0.5968788", "0.596374", "0.5948944", "0.59184533", "0.591446", "0.59111434", ...
0.0
-1
It should raise with a descriptive error if run on an OT2, instead of OT3.
async def test_calibrate_gripper_raises_on_ot2( decoy: Decoy, ot2_hardware_api: OT2API, ) -> None: subject = CalibrateGripperImplementation(hardware_api=ot2_hardware_api) params = CalibrateGripperParams(jaw=CalibrateGripperParamsJaw.REAR) with pytest.raises(HardwareNotSupportedError): awai...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def experiment3():\n raise FAKE_ERROR", "def report_unexpected_exception(self, *args, **kwargs):\n pass", "def unexpected_error(self, exception):", "def test_error3(self):\n try:\n api = self.load_api_description('error3.json')\n self.fail('No error thrown for undefined input segment'...
[ "0.6747502", "0.6558903", "0.6558514", "0.653314", "0.6455933", "0.63935745", "0.6391505", "0.6379069", "0.6378044", "0.6333795", "0.6234843", "0.6221498", "0.61709213", "0.6087179", "0.60803807", "0.6072119", "0.6054898", "0.6038267", "0.6025209", "0.6005897", "0.59995884", ...
0.0
-1
Gets list of project users from taiga api, authorization token is provided Returns List of users emails
def project_users(): project_school = api.projects.get_by_slug('ps') users_list = [] for member in project_school.members: users_list.append(member.username + '@miem.hse.ru') #replaces some users usernames as they are different in taiga than in google groups for user...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fetch_all_users():\n url = \"{}/workspace/{}/users\".format(V1_API_URL, WORKSPACE_ID)\n responses = requests.get(url, headers=HEADERS)\n return [\n {\n \"acronym\": user[\"name\"].lower(),\n \"clockify_id\": user[\"id\"],\n \"email\":...
[ "0.73056626", "0.72447586", "0.70628095", "0.6971299", "0.69661814", "0.6821465", "0.68033063", "0.67938226", "0.674622", "0.6712039", "0.67060554", "0.6679689", "0.66765285", "0.66745746", "0.66613865", "0.6642741", "0.6589498", "0.65809524", "0.65250397", "0.6493682", "0.64...
0.70697045
2
Given an array it splits the array in two parts at index i
def split_i(array:list, i:int) -> (list, list): if i==len(array)-1: return array[i], array[:-1] else: pre = array[0:i] post = array[i+1:] l = pre + post x = array[i] return x, l
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def split_array(a):\n n = len(a)\n if n == 1:\n return a\n index = n // 2\n b = a[:index]\n c = a[index:]\n return b, c", "def even_split(a, n):\n n = min(n, len(a)) # if less elements in array than chunks to output, change chunks to array length\n k, m = divmod(len(a), n)\n ret...
[ "0.7665456", "0.7067053", "0.68895733", "0.6825084", "0.6575467", "0.6566739", "0.656526", "0.6551348", "0.65445685", "0.6517187", "0.64508444", "0.6435194", "0.6357571", "0.63475424", "0.6298871", "0.6265837", "0.6259398", "0.6205831", "0.6199721", "0.61938316", "0.61762506"...
0.77543867
0
Since the architecture uses features computed through the image and its mask we precompute them to speed up the usage at runtime (Equation (13))
def precompute_features(imgs:list, GTs:list, phi:models) -> list: G_Ts = [1 - GTn for GTn in GTs] IGms = [GTn * In for GTn, In in zip(GTs, imgs)] I_Gms = [G_Tn * In for G_Tn, In in zip(G_Ts, imgs)] features = [(phi(IGm), phi(I_Gm)) for IGm, I_Gm in zip(IGms, I_Gms)] return features
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def feature(input_dir, input_img, mask, output_dir, window_size):\n\t# Get the pixel array of the ROI\n\tws = int(float(window_size))\n\tfilename = os.path.join(input_dir, input_img)\n\tim = nib.load(filename)\n\taffine = im.affine\n\timg = im.get_data() \n\t# img= (img - img.min()) / (np.sort(img,axis=None)[-10] ...
[ "0.6926122", "0.67149717", "0.66896415", "0.6684665", "0.66838753", "0.65661734", "0.6509679", "0.6479813", "0.6467656", "0.64198256", "0.6404838", "0.6361878", "0.63541794", "0.6353836", "0.63225704", "0.62639576", "0.6259601", "0.62525296", "0.6243414", "0.62212324", "0.616...
0.62619364
16
Cross entropy loss for individual supervision, Equation (12)
def Ls(GTn:torch.tensor, Mn:torch.tensor) -> torch.tensor: return (-(GTn * torch.log(Mn+1e-15) + (1- GTn) * torch.log((1- Mn)+1e-15))).sum()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cross_entropy_loss():\n return nn.CrossEntropyLoss()", "def cross_entropy(y_observed, p):\n\n pass", "def cross_entropy_error(self, x, y):\n return -1 * sum([y[i] * np.log(self.logistic_function(self.weights.dot(x[i]))) + (1-y[i]) * np.log(1-self.logistic_function(self.weights.dot(x[i]))) for ...
[ "0.747013", "0.7422436", "0.7151027", "0.7125091", "0.68993956", "0.6885498", "0.68482375", "0.68349075", "0.6828572", "0.6810557", "0.6792025", "0.6763931", "0.6726077", "0.6725324", "0.6716315", "0.6703539", "0.6699556", "0.66880083", "0.6670996", "0.66659564", "0.66648346"...
0.0
-1
Triplet loss group wise constraint Equation (14)
def Lc(i:int, imgs:list, masks:list, features:list, phi:models) -> torch.tensor: Ion = phi(masks[i] * imgs[i]) fi, fts = split_i(features, 1) cumsum = 0 for IGm, I_Gm in fts: P = torch.sqrt(((Ion - IGm)**2)+1e-016) N = torch.sqrt(((Ion - I_Gm)**2)+1e-016) cumsum += softplus(P-N)....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _auxiliary_loss(self, expert_mask, router_prob):\n # density_1's shape: (dp_group, self.expert_dim)\n density_1 = self.reduce_mean(expert_mask, 1)\n # density_1_proxy's shape: (dp_group, self.expert_dim)\n density_1_proxy = self.reduce_mean2(router_prob, 1)\n loss = self.mul(...
[ "0.5800624", "0.5796773", "0.5785705", "0.5717265", "0.570551", "0.56547177", "0.5628578", "0.5609777", "0.56024534", "0.557875", "0.557706", "0.5565382", "0.55586576", "0.55550206", "0.5553454", "0.54859525", "0.54835945", "0.54827017", "0.5469203", "0.54655266", "0.54564786...
0.0
-1