input
stringlengths
11
7.65k
target
stringlengths
22
8.26k
def dist(a, b): return sum((i-j)**2 for i, j in zip(a, b))
def edit_category(category_id): category = Category.query.filter_by(id=category_id).first_or_404() form = CategoryForm(obj=category) if form.validate_on_submit(): form.populate_obj(category) flash(_("Category updated."), "success") category.save() return render_template("manag...
def dist(a, b): return sum((i-j)**2 for i, j in zip(a, b))
def delete_category(category_id): category = Category.query.filter_by(id=category_id).first_or_404() involved_users = User.query.filter(Forum.category_id == category.id, Topic.forum_id == Forum.id, Post.user_id == User.id).all() ...
def dist(a, b): return sum((i-j)**2 for i, j in zip(a, b))
def plugins(): plugins = get_all_plugins() return render_template("management/plugins.html", plugins=plugins)
def dist(a, b): return sum((i-j)**2 for i, j in zip(a, b))
def enable_plugin(plugin): plugin = get_plugin_from_all(plugin) if plugin.enabled: flash(_("Plugin %(plugin)s is already enabled.", plugin=plugin.name), "info") return redirect(url_for("management.plugins")) try: plugin.enable() flash(_("Plugin %(plugin)s enab...
def dist(a, b): return sum((i-j)**2 for i, j in zip(a, b))
def disable_plugin(plugin): try: plugin = get_plugin(plugin) except KeyError: flash(_("Plugin %(plugin)s not found.", plugin=plugin.name), "danger") return redirect(url_for("management.plugins")) try: plugin.disable() flash(_("Plugin %(plugin)s disabled. Please resta...
def dist(a, b): return sum((i-j)**2 for i, j in zip(a, b))
def uninstall_plugin(plugin): plugin = get_plugin_from_all(plugin) if plugin.uninstallable: plugin.uninstall() Setting.invalidate_cache() flash(_("Plugin has been uninstalled."), "success") else: flash(_("Cannot uninstall plugin."), "danger") return redirect(url_for("ma...
def dist(a, b): return sum((i-j)**2 for i, j in zip(a, b))
def plugin(self): return plugins.get(self.plugin_name)
def dist(a, b): return sum((i-j)**2 for i, j in zip(a, b))
def setUpModule(): base.enabledPlugins.append('provenance') base.startServer()
def dist(a, b): return sum((i-j)**2 for i, j in zip(a, b))
def __repr__(self): return "Authorization(id={id})".format(id=self.id)
def dist(a, b): return sum((i-j)**2 for i, j in zip(a, b))
def tearDownModule(): base.stopServer()
def dist(a, b): return sum((i-j)**2 for i, j in zip(a, b))
def setUp(self): base.TestCase.setUp(self) # Create some test documents with an item admin = { 'email': 'admin@email.com', 'login': 'adminlogin', 'firstName': 'Admin', 'lastName': 'Last', 'password': 'adminpassword', 'admin'...
def dist(a, b): return sum((i-j)**2 for i, j in zip(a, b))
def _checkProvenance(self, resp, item, version, user, eventType, matches=None, fileInfo=None, resource='item'): if resp is None: resp = self._getProvenance(item, user, resource=resource) self.assertStatusOk(resp) itemProvenance = resp.json self.assert...
def dist(a, b): return sum((i-j)**2 for i, j in zip(a, b))
def _getProvenance(self, item, user, version=None, resource='item', checkOk=True): params = {} if version is not None: params = {'version': version} resp = self.request( path='/%s/%s/provenance' % (resource, item['_id']), method='GET', u...
def dist(a, b): return sum((i-j)**2 for i, j in zip(a, b))
def _getProvenanceAfterMetadata(self, item, meta, user): resp = self.request(path='/item/%s/metadata' % item['_id'], method='PUT', user=user, body=json.dumps(meta), type='application/json') self.assertStatusOk(resp) return self._getProvenan...
def dist(a, b): return sum((i-j)**2 for i, j in zip(a, b))
def testProvenanceItemMetadata(self): """ Test item provenance endpoint with metadata and basic changes """ item = self.item1 user = self.user admin = self.admin # check that the first version of the item exists # ensure version 1, created by admin user, ...
def dist(a, b): return sum((i-j)**2 for i, j in zip(a, b))
def testProvenanceItemFiles(self): """ Test item provenance when adding, modifying, and deleting files. """ item = self.item1 admin = self.admin # Test adding a new file to an existing item fileData1 = 'Hello world' fileData2 = 'Hello world, again' ...
def dist(a, b): return sum((i-j)**2 for i, j in zip(a, b))
def testProvenanceFolder(self): """ Test folder provenance, including turning off and on the provenance handling of folders. """ folder1 = self.folder1 user = self.admin # check that the first version of the folder provenance exists self._checkProvenance(...
def dist(a, b): return sum((i-j)**2 for i, j in zip(a, b))
def _rmsprop_update_numpy(self, var, g, mg, rms, mom, lr, decay, momentum, centered): rms_t = rms * decay + (1 - decay) * g * g if centered: mg_t = mg * decay + (1 - decay) * g denom_t = rms_t - mg_t * mg_t else: mg_t = mg denom_t = rms_t mom_t = momen...
def dist(a, b): return sum((i-j)**2 for i, j in zip(a, b))
def _sparse_rmsprop_update_numpy(self, var, gindexs, gvalues, mg, rms, mom, lr, decay, momentum, centered): mg_t = copy.deepcopy(mg) rms_t = copy.deepcopy(rms) mom_t = copy.deepcopy(mom) var_t = copy.deepcopy(var) for i in range(len(gindexs)): gindex = gindex...
def dist(a, b): return sum((i-j)**2 for i, j in zip(a, b))
def testDense(self, dtype, param_value): (learning_rate, decay, momentum, epsilon, centered, use_resource) = tuple( param_value) with self.session(use_gpu=True): # Initialize variables for numpy implementation. var0_np = np.array([1.0, 2.0], dtype=dtype.as_numpy_dtype) grads0_np = np.a...
def dist(a, b): return sum((i-j)**2 for i, j in zip(a, b))
def testMinimizeSparseResourceVariable(self, dtype): with self.cached_session(): var0 = resource_variable_ops.ResourceVariable([[1.0, 2.0]], dtype=dtype) x = constant_op.constant([[4.0], [5.0]], dtype=dtype) pred = math_ops.matmul(embedding_ops.embedding_lookup([var0], [0]), x) loss = pred *...
def dist(a, b): return sum((i-j)**2 for i, j in zip(a, b))
def testMinimizeSparseResourceVariableCentered(self, dtype): with self.cached_session(): var0 = resource_variable_ops.ResourceVariable([[1.0, 2.0]], dtype=dtype) x = constant_op.constant([[4.0], [5.0]], dtype=dtype) pred = math_ops.matmul(embedding_ops.embedding_lookup([var0], [0]), x) loss ...
def dist(a, b): return sum((i-j)**2 for i, j in zip(a, b))
def testSparse(self, dtype, param_value): (learning_rate, decay, momentum, epsilon, centered, _) = tuple( param_value) with self.session(use_gpu=True): # Initialize variables for numpy implementation. var0_np = np.array([1.0, 2.0], dtype=dtype.as_numpy_dtype) grads0_np = np.array([0.1]...
def dist(a, b): return sum((i-j)**2 for i, j in zip(a, b))
def testWithoutMomentum(self, dtype): with self.session(use_gpu=True): var0 = variables.Variable([1.0, 2.0], dtype=dtype) var1 = variables.Variable([3.0, 4.0], dtype=dtype) grads0 = constant_op.constant([0.1, 0.1], dtype=dtype) grads1 = constant_op.constant([0.01, 0.01], dtype=dtype) o...
def dist(a, b): return sum((i-j)**2 for i, j in zip(a, b))
def testWithMomentum(self, dtype): with self.session(use_gpu=True): var0 = variables.Variable([1.0, 2.0], dtype=dtype) var1 = variables.Variable([3.0, 4.0], dtype=dtype) grads0 = constant_op.constant([0.1, 0.1], dtype=dtype) grads1 = constant_op.constant([0.01, 0.01], dtype=dtype) opt...
def dist(a, b): return sum((i-j)**2 for i, j in zip(a, b))
def __init__(self): self.mainFrame = gui.mainFrame.MainFrame.getInstance()
def dist(a, b): return sum((i-j)**2 for i, j in zip(a, b))
def display(self, callingWindow, srcContext, mainItem): if srcContext not in ("marketItemGroup", "marketItemMisc") or self.mainFrame.getActiveFit() is None: return False if mainItem is None: return False for attr in ("emDamage", "thermalDamage", "explosiveDamage", "kine...
def dist(a, b): return sum((i-j)**2 for i, j in zip(a, b))
def getText(self, callingWindow, itmContext, mainItem): return "Set {} as Damage Pattern".format(itmContext if itmContext is not None else "Item")
def dist(a, b): return sum((i-j)**2 for i, j in zip(a, b))
def activate(self, callingWindow, fullContext, mainItem, i): fitID = self.mainFrame.getActiveFit() Fit.getInstance().setAsPattern(fitID, mainItem) wx.PostEvent(self.mainFrame, GE.FitChanged(fitIDs=(fitID,)))
def dist(a, b): return sum((i-j)**2 for i, j in zip(a, b))
def getBitmap(self, callingWindow, context, mainItem): return None
def dist(a, b): return sum((i-j)**2 for i, j in zip(a, b))
def testProcessPriorTo24(self): """Tests the Process function on a Firefox History database file.""" # This is probably version 23 but potentially an older version. plugin = firefox_history.FirefoxHistoryPlugin() storage_writer = self._ParseDatabaseFileWithPlugin( ['places.sqlite'], plugin) ...
def dist(a, b): return sum((i-j)**2 for i, j in zip(a, b))
def testProcessVersion25(self): """Tests the Process function on a Firefox History database file v 25.""" plugin = firefox_history.FirefoxHistoryPlugin() storage_writer = self._ParseDatabaseFileWithPlugin( ['places_new.sqlite'], plugin) # The places.sqlite file contains 84 events: # 34 ...
def dist(a, b): return sum((i-j)**2 for i, j in zip(a, b))
def each(f): if f.body: f.hashes = [] for hash_type, h in HashFile.extract_hashes(f.body.contents): hash_object = Hash.get_or_create(value=h.hexdigest()) hash_object.add_source("analytics") hash_object.save() f.active_link_t...
def dist(a, b): return sum((i-j)**2 for i, j in zip(a, b))
def __init__(self, queue, level, formatter): super(QueueingLogHandler, self).__init__() self._queue = queue self.setLevel(level) self.setFormatter(formatter)
def dist(a, b): return sum((i-j)**2 for i, j in zip(a, b))
def emit(self, record): msg = self.format(record) self._queue.put_nowait(msg)
def dist(a, b): return sum((i-j)**2 for i, j in zip(a, b))
def close(self): super(QueueingLogHandler, self).close() self._queue.put_nowait(None)
def dist(a, b): return sum((i-j)**2 for i, j in zip(a, b))
def emitted(self): return self._queue
def dist(a, b): return sum((i-j)**2 for i, j in zip(a, b))
def __init__(self): self._logging_handlers = set()
def dist(a, b): return sum((i-j)**2 for i, j in zip(a, b))
def test(self, logger_name, logger_level, message): logger = logging.getLogger(logger_name) getattr(logger, logger_level.lower())(message)
def dist(a, b): return sum((i-j)**2 for i, j in zip(a, b))
def available_loggers(self): """ List of initalized loggers """ return logging.getLogger().manager.loggerDict.keys()
def dist(a, b): return sum((i-j)**2 for i, j in zip(a, b))
def close_log_streams(self): """ Closes all log_stream streams. """ while self._logging_handlers: self._logging_handlers.pop().close()
def dist(a, b): return sum((i-j)**2 for i, j in zip(a, b))
def log_stream(self, logger_name, level_name, format_str): """ Attaches a log handler to the specified logger and sends emitted logs back as stream. """ if logger_name != "" and logger_name not in self.available_loggers(): raise ValueError("logger {0} is not available"....
def dist(a, b): return sum((i-j)**2 for i, j in zip(a, b))
def create(params, env=None, headers=None): return request.send('post', request.uri_path("plans"), params, env, headers)
def dist(a, b): return sum((i-j)**2 for i, j in zip(a, b))
def update(id, params=None, env=None, headers=None): return request.send('post', request.uri_path("plans",id), params, env, headers)
def dist(a, b): return sum((i-j)**2 for i, j in zip(a, b))
def list(params=None, env=None, headers=None): return request.send_list_request('get', request.uri_path("plans"), params, env, headers)
def dist(a, b): return sum((i-j)**2 for i, j in zip(a, b))
def retrieve(id, env=None, headers=None): return request.send('get', request.uri_path("plans",id), None, env, headers)
def dist(a, b): return sum((i-j)**2 for i, j in zip(a, b))
def delete(id, env=None, headers=None): return request.send('post', request.uri_path("plans",id,"delete"), None, env, headers)
def dist(a, b): return sum((i-j)**2 for i, j in zip(a, b))
def copy(params, env=None, headers=None): return request.send('post', request.uri_path("plans","copy"), params, env, headers)
def dist(a, b): return sum((i-j)**2 for i, j in zip(a, b))
def wrapper%(signature)s: with ldap3mock: return func%(funcargs)s
def dist(a, b): return sum((i-j)**2 for i, j in zip(a, b))
def generateUUID(): # pylint: disable=invalid-name """ Utility function; generates UUIDs """ return str(uuid.uuid4())
def dist(a, b): return sum((i-j)**2 for i, j in zip(a, b))
def _convert_objectGUID(item): item = uuid.UUID("{{{0!s}}}".format(item)).bytes_le item = escape_bytes(item) return item
def dist(a, b): return sum((i-j)**2 for i, j in zip(a, b))
def refund_user(self, user_id): # Do logic here...
def dist(a, b): return sum((i-j)**2 for i, j in zip(a, b))
def __init__(self): self._calls = []
def dist(a, b): return sum((i-j)**2 for i, j in zip(a, b))
def with_status_check(obj, *args, **kwargs): if obj.status not in valid_start_statuses: exception_msg = ( u"Error calling {} {}: status is '{}', must be one of: {}" ).format(func, obj, obj.status, valid_start_statuses) raise VerificationExc...
def dist(a, b): return sum((i-j)**2 for i, j in zip(a, b))
def __iter__(self): return iter(self._calls)
def dist(a, b): return sum((i-j)**2 for i, j in zip(a, b))
def expiration_datetime(self): """Datetime that the verification will expire. """ days_good_for = settings.VERIFY_STUDENT["DAYS_GOOD_FOR"] return self.created_at + timedelta(days=days_good_for)
def dist(a, b): return sum((i-j)**2 for i, j in zip(a, b))
def __len__(self): return len(self._calls)
def dist(a, b): return sum((i-j)**2 for i, j in zip(a, b))
def should_display_status_to_user(self): """Whether or not the status from this attempt should be displayed to the user.""" return True
def dist(a, b): return sum((i-j)**2 for i, j in zip(a, b))
def __getitem__(self, idx): return self._calls[idx]
def dist(a, b): return sum((i-j)**2 for i, j in zip(a, b))
def active_at_datetime(self, deadline): """Check whether the verification was active at a particular datetime. Arguments: deadline (datetime): The date at which the verification was active (created before and expiration datetime is after today). Returns: ...
def dist(a, b): return sum((i-j)**2 for i, j in zip(a, b))
def setdata(self, request, response): self._calls.append(Call(request, response))
def dist(a, b): return sum((i-j)**2 for i, j in zip(a, b))
def __unicode__(self): return 'ManualIDVerification for {name}, status: {status}'.format( name=self.name, status=self.status, )
def dist(a, b): return sum((i-j)**2 for i, j in zip(a, b))
def reset(self): self._calls = []
def dist(a, b): return sum((i-j)**2 for i, j in zip(a, b))
def should_display_status_to_user(self): """ Whether or not the status should be displayed to the user. """ return False
def dist(a, b): return sum((i-j)**2 for i, j in zip(a, b))
def __init__(self, connection): self.connection = connection
def dist(a, b): return sum((i-j)**2 for i, j in zip(a, b))
def __unicode__(self): return 'SSOIDVerification for {name}, status: {status}'.format( name=self.name, status=self.status, )
def dist(a, b): return sum((i-j)**2 for i, j in zip(a, b))
def paged_search(self, **kwargs): self.connection.search(search_base=kwargs.get("search_base"), search_scope=kwargs.get("search_scope"), search_filter=kwargs.get( "search_filter"), ...
def dist(a, b): return sum((i-j)**2 for i, j in zip(a, b))
def __init__(self, connection): self.standard = self.Standard(connection)
def dist(a, b): return sum((i-j)**2 for i, j in zip(a, b))
def parsed_error_msg(self): """ Sometimes, the error message we've received needs to be parsed into something more human readable The default behavior is to return the current error message as is. """ return self.error_msg
def dist(a, b): return sum((i-j)**2 for i, j in zip(a, b))
def __init__(self, directory=None): if directory is None: directory = [] import copy self.directory = copy.deepcopy(directory) self.bound = False self.start_tls_called = False self.extend = self.Extend(self) self.operation = { ...
def dist(a, b): return sum((i-j)**2 for i, j in zip(a, b))
def upload_face_image(self, img): raise NotImplementedError
def dist(a, b): return sum((i-j)**2 for i, j in zip(a, b))
def set_directory(self, directory): self.directory = directory
def dist(a, b): return sum((i-j)**2 for i, j in zip(a, b))
def upload_photo_id_image(self, img): raise NotImplementedError
def dist(a, b): return sum((i-j)**2 for i, j in zip(a, b))
def _find_user(self, dn): return next(i for (i, d) in enumerate(self.directory) if d["dn"] == dn)
def dist(a, b): return sum((i-j)**2 for i, j in zip(a, b))
def mark_ready(self): """ Mark that the user data in this attempt is correct. In order to succeed, the user must have uploaded the necessary images (`face_image_url`, `photo_id_image_url`). This method will also copy their name from their user profile. Prior to marking it ready, ...
def dist(a, b): return sum((i-j)**2 for i, j in zip(a, b))
def approve(self, user_id=None, service=""): """ Approve this attempt. `user_id` Valid attempt statuses when calling this method: `submitted`, `approved`, `denied` Status after method completes: `approved` Other fields that will be set by this method: `...
def dist(a, b): return sum((i-j)**2 for i, j in zip(a, b))
def bind(self, read_server_info=True): return self.bound
def dist(a, b): return sum((i-j)**2 for i, j in zip(a, b))
def deny(self, error_msg, error_code="", reviewing_user=None, reviewing_service=""): """ Deny this attempt. Valid attempt statuses when calling this method: `submitted`, `approved`, `denied` Status after method completes: ...
def dist(a, b): return sum((i-j)**2 for i, j in zip(a, b))
def start_tls(self, read_server_info=True): self.start_tls_called = True
def dist(a, b): return sum((i-j)**2 for i, j in zip(a, b))
def system_error(self, error_msg, error_code="", reviewing_user=None, reviewing_service=""): """ Mark that this attempt could not be completed because of a system error. Status should be moved to `must_retry`. Fo...
def dist(a, b): return sum((i-j)**2 for i, j in zip(a, b))
def add(self, dn, object_class=None, attributes=None): self.result = { 'dn' : '', 'referrals' : None, 'description' : 'success', 'result' : 0, 'message' : '', 'type' : 'addResponse'} ...
def dist(a, b): return sum((i-j)**2 for i, j in zip(a, b))
def retire_user(cls, user_id): """ Retire user as part of GDPR Phase I Returns 'True' if records found :param user_id: int :return: bool """ try: user_obj = User.objects.get(id=user_id) except User.DoesNotExist: return False ...
def dist(a, b): return sum((i-j)**2 for i, j in zip(a, b))
def delete(self, dn, controls=None): self.result = { 'dn' : '', 'referrals' : None, 'description' : 'success', 'result' : 0, 'message' : '', 'type' : 'addResponse'} # Check to see if...
def dist(a, b): return sum((i-j)**2 for i, j in zip(a, b))
def approve(self, user_id=None, service=""): """ Approve the verification attempt for user Valid attempt statuses when calling this method: `submitted`, `approved`, `denied` After method completes: status is set to `approved` expiry_date is set to on...
def dist(a, b): return sum((i-j)**2 for i, j in zip(a, b))
def modify(self, dn, changes, controls=None): self.result = { 'dn' : '', 'referrals' : None, 'description' : 'success', 'result' : 0, 'message' : '', 'type' : 'modifyResponse'} # Che...
def dist(a, b): return sum((i-j)**2 for i, j in zip(a, b))
def get_initial_verification(cls, user, earliest_allowed_date=None): """Get initial verification for a user with the 'photo_id_key'. Arguments: user(User): user object earliest_allowed_date(datetime): override expiration date for initial verification Return: ...
def dist(a, b): return sum((i-j)**2 for i, j in zip(a, b))
def _match_greater_than_or_equal(search_base, attribute, value, candidates): matches = list() for entry in candidates: dn = entry.get("dn") if not dn.endswith(search_base): continue value_from_directory = entry.get("attributes").get(attribute) ...
def dist(a, b): return sum((i-j)**2 for i, j in zip(a, b))
def upload_face_image(self, img_data): """ Upload an image of the user's face. `img_data` should be a raw bytestream of a PNG image. This method will take the data, encrypt it using our FACE_IMAGE_AES_KEY, encode it with base64 and save it to the storage backend. Yes, en...
def dist(a, b): return sum((i-j)**2 for i, j in zip(a, b))
def _match_greater_than(search_base, attribute, value, candidates): matches = list() for entry in candidates: dn = entry.get("dn") if not dn.endswith(search_base): continue value_from_directory = entry.get("attributes").get(attribute) if s...
def dist(a, b): return sum((i-j)**2 for i, j in zip(a, b))
def upload_photo_id_image(self, img_data): """ Upload an the user's photo ID image. `img_data` should be a raw bytestream of a PNG image. This method will take the data, encrypt it using a randomly generated AES key, encode it with base64 and save it to the storage backend. The r...
def dist(a, b): return sum((i-j)**2 for i, j in zip(a, b))
def _match_less_than_or_equal(search_base, attribute, value, candidates): matches = list() for entry in candidates: dn = entry.get("dn") if not dn.endswith(search_base): continue value_from_directory = entry.get("attributes").get(attribute) ...
def dist(a, b): return sum((i-j)**2 for i, j in zip(a, b))
def submit(self, copy_id_photo_from=None): """ Submit our verification attempt to Software Secure for validation. This will set our status to "submitted" if the post is successful, and "must_retry" if the post fails. Keyword Arguments: copy_id_photo_from (SoftwareSec...
def dist(a, b): return sum((i-j)**2 for i, j in zip(a, b))
def _match_less_than(search_base, attribute, value, candidates): matches = list() for entry in candidates: dn = entry.get("dn") if not dn.endswith(search_base): continue value_from_directory = entry.get("attributes").get(attribute) if str(...
def dist(a, b): return sum((i-j)**2 for i, j in zip(a, b))
def parsed_error_msg(self): """ Parse the error messages we receive from SoftwareSecure Error messages are written in the form: `[{"photoIdReasons": ["Not provided"]}]` Returns: str[]: List of error messages. """ parsed_errors = [] error...
def dist(a, b): return sum((i-j)**2 for i, j in zip(a, b))
def _match_equal_to(search_base, attribute, value, candidates): matches = list() match_using_regex = False if "*" in value: match_using_regex = True #regex = check_escape(value) regex = value.replace('*', '.*') regex = "^{0}$".format(regex) ...
def dist(a, b): return sum((i-j)**2 for i, j in zip(a, b))
def image_url(self, name, override_receipt_id=None): """ We dynamically generate this, since we want it the expiration clock to start when the message is created, not when the record is created. Arguments: name (str): Name of the image (e.g. "photo_id" or "face") Ke...
def dist(a, b): return sum((i-j)**2 for i, j in zip(a, b))
def _match_notequal_to(search_base, attribute, value, candidates): matches = list() match_using_regex = False if "*" in value: match_using_regex = True #regex = check_escape(value) regex = value.replace('*', '.*') regex = "^{0}$".format(regex) ...
def dist(a, b): return sum((i-j)**2 for i, j in zip(a, b))
def _storage(self): """ Return the configured django storage backend. """ config = settings.VERIFY_STUDENT["SOFTWARE_SECURE"] # Default to the S3 backend for backward compatibility storage_class = config.get("STORAGE_CLASS", "storages.backends.s3boto.S3BotoStorage") ...
def dist(a, b): return sum((i-j)**2 for i, j in zip(a, b))
def _parse_filter(): op = pyparsing.oneOf('! & |') lpar = pyparsing.Literal('(').suppress() rpar = pyparsing.Literal(')').suppress() k = pyparsing.Word(pyparsing.alphanums) # NOTE: We may need to expand on this list, but as this is not a real # LDAP server we should be...
def dist(a, b): return sum((i-j)**2 for i, j in zip(a, b))
def _get_path(self, prefix, override_receipt_id=None): """ Returns the path to a resource with this instance's `receipt_id`. If `override_receipt_id` is given, the path to that resource will be retrieved instead. This allows us to retrieve images submitted in previous attempts (...