query
stringlengths
10
2k
document
stringlengths
20
51.2k
metadata
dict
negatives
listlengths
0
101
negative_scores
listlengths
0
101
document_score
stringlengths
3
10
document_rank
stringclasses
102 values
This function prints and plots the confusion matrix. Normalization can be applied by setting `normalize=True`.
def plot_confusion_matrix1(cm, classes, normalize=False, title='Confusion matrix', cmap=plt.cm.Blues): if normalize: cm = cm.astype('float') / cm.sum(axis=1)[:, np.newaxis] print("Normalized confusion matrix") else: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def plot_confusion_matrix(cm, classes=[0,1], normalize=False, title='Confusion matrix', print_matrix=False):\n\n if normalize:\n cm = cm.astype('float') / cm.sum(axis=1)[:, np.newaxis]\n print(\"Normalized confusion matrix\")\n else:\n print('Confusion matrix, without normalization')\n\n...
[ "0.8194862", "0.80949175", "0.8029915", "0.8019153", "0.79941195", "0.7991258", "0.7980955", "0.7976606", "0.79610753", "0.79590565", "0.79378676", "0.7934962", "0.7934504", "0.79313844", "0.7926313", "0.7924577", "0.79241234", "0.7923211", "0.7923023", "0.7921931", "0.791787...
0.0
-1
Writes the text in the current paragraph. Should only be used after a start_paragraph and before an end_paragraph. Not all backends support s_tags, then the same happens as with write_text. Backends supporting write_markup will overwrite this method
def write_markup(self, text, s_tags, mark=None): self.write_text(text, mark=mark)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def paragraph(self, on, **kw):\n if self._terse:\n return ''\n FormatterBase.paragraph(self, on)\n tag = 'p'\n if on:\n tagstr = self._open(tag, **kw)\n else:\n tagstr = self._close(tag)\n return tagstr", "def write_text(self, text):\n ...
[ "0.6865519", "0.6829972", "0.6826349", "0.6388663", "0.62817895", "0.6262358", "0.6230746", "0.6228621", "0.6163076", "0.61500466", "0.6109052", "0.60628057", "0.5995166", "0.5986104", "0.59745467", "0.596526", "0.59477645", "0.5942742", "0.5921858", "0.59203964", "0.58624923...
0.6557993
3
Method creates top model. This model will be added at the top of keras application model.
def create_model_tail(self, model): # Creating a sequential model to at as top layers top_model = keras.Sequential() top_model.add(keras.layers.Flatten(input_shape=model.output_shape[1:])) # Add multiple layers for layer_num, layer_dim in enumerate(self.num_nodes): t...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_top_model(self):\n model = ModelHelper.load_model(filename_weight=self.top_model_path + '.h5',\n filename_model=self.top_model_path + '.json')\n\n return model", "def build(bottom_model, num_classes):\n\n top_model = bottom_model.output\n top_mode...
[ "0.73633105", "0.6960287", "0.6919673", "0.65092564", "0.6374208", "0.62201995", "0.6214374", "0.61819416", "0.61679876", "0.6164631", "0.6162851", "0.61620754", "0.6161317", "0.6142316", "0.6136363", "0.60989064", "0.6071444", "0.60667586", "0.6061216", "0.60570145", "0.6054...
0.80240077
0
Operations should be able to accept Enum values naturally.
def test_request_report_enums_accepted( self, api_instance: Reports, report_type, marketplace_id ): params = api_instance.request_report( report_type=report_type, marketplace_ids=marketplace_id, ) assert params["ReportType"] == "_GET_FLAT_FILE_OPEN_LISTINGS_DA...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def enum(self):\r\n raise NotImplementedError", "def test_test_enum_parameters(self):\n pass", "def test_get_enum_by_value():\n assert BusinessType.get_enum_by_value('CP') == BusinessType.COOPERATIVE\n assert BusinessType.get_enum_by_value('FM') == BusinessType.PARTNERSHIP_AND_SOLE_PROP\n ...
[ "0.73542905", "0.7274136", "0.6486379", "0.63655627", "0.6344009", "0.6325961", "0.63249874", "0.63218087", "0.63166285", "0.63075346", "0.6301543", "0.6242816", "0.62301284", "0.6214935", "0.6179849", "0.6176506", "0.61732835", "0.6154527", "0.6125673", "0.6105288", "0.60964...
0.0
-1
Generate colormap for N lines/points from the given colormap Later used in loop for each line/point by colorVal = scalarMap.to_rgba(i) i from 0
def LineColorCoding(N,cmap='jet'): colormap_name = cmap cm = plt.get_cmap(colormap_name) cNorm = colors.Normalize(vmin=0, vmax=N-1) scalarMap = cmx.ScalarMappable(norm=cNorm, cmap=cm) return scalarMap
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_color_map(n):\n jet = plt.get_cmap('jet')\n cNorm = colors.Normalize(vmin=0, vmax=n-1)\n scalarMap = cmx.ScalarMappable(norm=cNorm, cmap=jet)\n outmap = []\n for i in range(n):\n outmap.append( scalarMap.to_rgba(i) )\n return outmap", "def display_cmap_color_range(cmap_style='ra...
[ "0.75112605", "0.6632478", "0.6578862", "0.6532801", "0.64647084", "0.64263225", "0.64244705", "0.63608927", "0.635885", "0.63546515", "0.63398165", "0.6310235", "0.6309026", "0.63089347", "0.62898755", "0.6284386", "0.62525696", "0.623394", "0.62333196", "0.6223972", "0.6186...
0.7548113
0
Setting up testing model
def setUp(self): self.m = m = ConcreteModel() m.t = ContinuousSet(bounds=(0, 10)) m.v1 = Var(m.t) m.dv1 = DerivativeVar(m.v1) m.s = Set(initialize=[1, 2, 3], ordered=True)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setUp(self):\n self.mock_model = Mock()", "def create_model(self):\n self.skipTest(\"Base module should not be tested.\")", "def setUp(self):\n self.base1 = BaseModel()", "def test_model():\n pass", "def setUpClass(self):\n\n base_model = BaseModel()", "def test_settingmode...
[ "0.7845025", "0.78247887", "0.77878684", "0.7740696", "0.77405584", "0.77213913", "0.7561998", "0.7539715", "0.7495202", "0.7462158", "0.7433301", "0.73712236", "0.7337238", "0.73222625", "0.73222625", "0.7316911", "0.7304841", "0.7303187", "0.72945654", "0.72531086", "0.7253...
0.69268125
95
Secure the size of the uploaded file is smaller than MAX_FILESIZE
def secure_filesize(filepath): return os.path.getsize(filepath) <= MAX_FILESIZE
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _check_max_file_size(self, file_size):\n # NOTE: this method does not check the file size before upload,\n # but checks after the file is uploaded to the server\n if file_size > constants.MAX_UPLOAD_FILE_SIZE_BYTES:\n raise ArtifactMaxSizeError(\n f'Artifact size ...
[ "0.727252", "0.7133552", "0.70251024", "0.69188094", "0.6799686", "0.6660166", "0.6615638", "0.6607412", "0.6486542", "0.644599", "0.64264923", "0.6355493", "0.6347269", "0.62421507", "0.6239919", "0.6224063", "0.6214218", "0.61739886", "0.61398435", "0.61218286", "0.609277",...
0.7341425
0
checks if ExpiryService supports given provider
def provider(provider): if provider in ("alditalk", "netzclub", "congstar"): return True else: return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def has_expired(self) -> bool:\n raise NotImplementedError() # pragma: nocover", "def _validate_provider(provider):\n if PROVIDERS.get(provider, None):\n return PROVIDERS[provider]()\n else:\n return None", "def _validate_exp(self):\n now = timegm(datetime.utcnow().utctimetup...
[ "0.6162787", "0.5903158", "0.5848611", "0.58237255", "0.57934093", "0.576993", "0.5721815", "0.5663499", "0.5626392", "0.55726016", "0.5539378", "0.54887146", "0.546047", "0.545522", "0.5441179", "0.5441048", "0.5434389", "0.54284096", "0.5425315", "0.5424123", "0.54206216", ...
0.5720034
7
Returns distance between two neighbours. The inputs to this method are always neighbours, so Euclidean distance is sufficient.
def distance_between(self, first_node_object, second_node_object): (first_column, first_row) = first_node_object (second_column, second_row) = second_node_object return numpy.sqrt((first_row - second_row) ** 2 + (first_column - second_column) ** 2)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def calc_dist(self, neighboring_pos):\n vec = np.array([i[1] - i[0] for i in zip(self.pos, neighboring_pos)])\n dist = np.linalg.norm(vec)\n return vec, dist", "def distance(self, c1, c2):\r\n x = (c2.x - c1.x) ** 2\r\n y = (c2.y - c1.y) ** 2\r\n d = int(round(math.sqrt(...
[ "0.72673136", "0.725836", "0.72009814", "0.71982306", "0.71426696", "0.71318465", "0.71016884", "0.70836747", "0.7062026", "0.7054939", "0.70502394", "0.7045556", "0.7033712", "0.7011416", "0.7003073", "0.69915885", "0.6982461", "0.69786894", "0.69786894", "0.6973766", "0.696...
0.7096832
7
Duplicate username (email) should not be allowed, as this leads to conflicting login credentials.
def test_duplicate_username(self, clean_mongo_tenant_migration): tenantadm_cli = cli.CliTenantadm() self.logger.debug("Starting `test_duplicate_username`") self.logger.debug("First tenant creation call") uuidv4 = str(uuid.uuid4()) name, username, password = ( "test.m...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_registeration_duplicate_username(self):\n self.signup_a_user(self.user_data)\n response_duplicate = self.signup_a_user(\n self.user_data_duplicate_username)\n self.assertEqual(response_duplicate.status_code,\n status.HTTP_400_BAD_REQUEST)\n se...
[ "0.7409204", "0.7189609", "0.71210605", "0.7102304", "0.705187", "0.7051585", "0.69906384", "0.6977101", "0.69675106", "0.696455", "0.6934737", "0.6919309", "0.6911945", "0.6896342", "0.6877307", "0.68579966", "0.68542403", "0.6816319", "0.68159825", "0.6776343", "0.6753667",...
0.0
-1
It should be allowed to create duplicate organizations as long as the user emails (login credentials) differ.
def test_duplicate_organization(self, clean_mongo_tenant_migration): self.logger.debug("Starting `test_duplicate_username`") tenantadm_cli = cli.CliTenantadm() uuidv4 = str(uuid.uuid4()) name, username, password = ( "test.mender.io-" + uuidv4, "some.user+" + uuid...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_create_organization_failure(self):\n self.client.force_authenticate(user=self.system_admin)\n data = {}\n response = self.client.post(\"/organization/\", data, format='json')\n self.assertEqual(response.status_code, status.HTTP_400_BAD_REQUEST)", "def test_add_organization(se...
[ "0.6749599", "0.6736119", "0.6513024", "0.6448117", "0.6388017", "0.6321886", "0.62049836", "0.6120972", "0.61076343", "0.60964805", "0.60940254", "0.60757685", "0.604642", "0.6044863", "0.6016764", "0.5972821", "0.5962959", "0.5945855", "0.59020007", "0.5888568", "0.5880644"...
0.620028
7
Creates a dictionary where the keys are the employee ID and the values associate with it are the employees name, salary, and email address
def make_employee_dict(names, ID_numbers, salaries, email_addresses): d = dict() for i in range(len(names)): d[ID_numbers[i]] = Employee(names[i], ID_numbers[i], salaries[i], email_addresses[i]) return d
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def employee_id(self):\n for i in self.emp_dict:\n self.emp_id[i] = self.emp_dict[i][0]\n #print(self.emp_id)\n return self.emp_id", "def create_employee_structure(employees):\n employees_dict = {}\n for employee in position_sort(employees):\n if not employee.is_secre...
[ "0.6583202", "0.64773506", "0.63519627", "0.6321661", "0.63113487", "0.6213478", "0.6001616", "0.59993625", "0.5955378", "0.59340984", "0.5930626", "0.59140646", "0.58262366", "0.5825099", "0.5823625", "0.57922107", "0.57843775", "0.5739199", "0.5734489", "0.57167673", "0.565...
0.85496974
0
Optionally restricts the returned purchases to a given user, by filtering against a `username` query parameter in the URL.
def get_queryset(self): queryset = Article.objects.all() username = self.request.query_params.get('username', None) if username is not None: queryset = queryset.filter(author__username__iexact=username) tag = self.request.query_params.get('tag', None) if tag is not No...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_queryset(self):\n username = self.kwargs.get('username', None)\n filters = {}\n if username:\n filters['user__username'] = username\n return super(PhotosListView, self).get_queryset().filter(**filters)", "def filter_queryset(self, request, queryset, view):\n ...
[ "0.59682834", "0.59662503", "0.59339905", "0.59121907", "0.59062797", "0.56636876", "0.5653978", "0.5544974", "0.5541318", "0.55099636", "0.5504582", "0.5494414", "0.5487761", "0.5483002", "0.5471986", "0.5471543", "0.5451524", "0.54157865", "0.54070425", "0.53802735", "0.537...
0.0
-1
Get all the articles ever posted in the application
def get(self, request): self.queryset = self.queryset.all() serializer = self.serializer_class(self.queryset, many=True) page = self.paginate_queryset(self.queryset) if page is not None: serializer = self.serializer_class(page, many=True) # removing body and comme...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def articles(self):\n return self.get_queryset().filter(content_type__model='article').order_by('-articles__published_at')", "def articles(self):\n articles = Post.objects.live().descendant_of(self)\n articles = articles.order_by('-date')\n\n return articles", "def get_articles(db:S...
[ "0.7787458", "0.7702132", "0.74091494", "0.7254118", "0.719956", "0.7127673", "0.70351017", "0.7021796", "0.7002338", "0.69403607", "0.6907534", "0.69053626", "0.68398845", "0.68362623", "0.6831707", "0.68249404", "0.6772308", "0.67231226", "0.6716085", "0.67119485", "0.66466...
0.61962825
50
Get all the articles ever posted in the application
def get(self, request, slug): rate = self.request.query_params.get('rate', None) if rate is not None: return Response({"average": self.get_average_rating()}) serializer = self.serializer_class(self.get_queryset(), many=True) page = self.paginate_queryset(self.get_queryset())...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def articles(self):\n return self.get_queryset().filter(content_type__model='article').order_by('-articles__published_at')", "def articles(self):\n articles = Post.objects.live().descendant_of(self)\n articles = articles.order_by('-date')\n\n return articles", "def get_articles(db:S...
[ "0.7787458", "0.7702132", "0.74091494", "0.7254118", "0.719956", "0.7127673", "0.70351017", "0.7021796", "0.7002338", "0.69403607", "0.6907534", "0.69053626", "0.68398845", "0.68362623", "0.6831707", "0.68249404", "0.6772308", "0.67231226", "0.6716085", "0.67119485", "0.66466...
0.0
-1
Create a new NetworkitBackend instance, using a Networkit.graph.Graph object to store and manage network structure.
def __init__(self, directed: bool = False, metadata_store: MetadataStore = None): self._directed = directed self._meta = metadata_store or DictMetadataStore() self._nk_graph = networkit.graph.Graph(directed=directed) self._names = NodeNameManager()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, network: Network):\n self.graph = network.graph", "def create_graph():\n with tf.gfile.FastGFile(os.path.join(\n config['inference']['model_dir'], 'output_graph.pb'), 'rb') as f:\n graph_def = tf.GraphDef()\n graph_def.ParseFromString(f.read())\n _ = tf.import_graph_def(g...
[ "0.6621306", "0.6416461", "0.63786495", "0.6358946", "0.63411415", "0.63283116", "0.630598", "0.62910914", "0.62809217", "0.62725455", "0.6262756", "0.6226599", "0.6198408", "0.6134232", "0.61340976", "0.6099635", "0.6088564", "0.60302883", "0.6011021", "0.6003893", "0.596592...
0.5972971
20
Return true if the node exists in the graph.
def has_node(self, u: Hashable) -> bool: return u in self._names
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def node_exists(self):\n if not self.node:\n return False\n count = (\n self.transaction.db_driver.nodes(self.node.__class__)\n .ids(self.node.node_id)\n .count()\n )\n return count > 0", "def has_node(self, node: str) -> bool:\n retu...
[ "0.82739633", "0.81863356", "0.81487614", "0.8036294", "0.7899973", "0.7784053", "0.77641773", "0.7764157", "0.76640135", "0.7412834", "0.7412834", "0.7400942", "0.72762567", "0.72552204", "0.71918076", "0.70686996", "0.6991342", "0.6975389", "0.686546", "0.6816985", "0.68011...
0.74154234
9
The dplace shift of a term t above cutoff c
def typeShiftAbove(d, c, tyT): tymap = TypeMap( onvar=lambda c, x, n: TyVar(x+d, n+d) if x >= c else TyVar(x, n+d), cutoff=c) return tymap.visit(tyT)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dspmt(t):\n t = np.asarray(t)\n return spmt(t) - spmt(t - 1)", "def _squash_correction(t):\n # TODO: Refer to OpenAI implementation for more numerically stable correction\n # https://github.com/openai/spinningup/blob/master/spinup/algos/pytorch/sac/core.py\n return torch.sum(torch....
[ "0.5693871", "0.55972594", "0.55784374", "0.5518223", "0.5509465", "0.5506729", "0.54885364", "0.5475864", "0.5453303", "0.54527485", "0.5408065", "0.5370242", "0.53084266", "0.528154", "0.5248789", "0.52028376", "0.51881176", "0.5181443", "0.5175417", "0.5173579", "0.5173435...
0.64094704
0
Generates a random string of length 20 with letters and numbers to be stored as a user's secret key.
def _generateSecretKey(): return ''.join(SystemRandom().choice(string.ascii_letters + string.digits) for _ in range(20))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def gen_key():\n key = []\n chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789'\n for i in xrange(20):\n key.append(random.choice(chars))\n return ''.join(key)", "def get_random_secret_key():\n chars = 'abcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*(-_=+)'\n...
[ "0.84760064", "0.83303833", "0.80883294", "0.7991474", "0.79716235", "0.78556705", "0.7825114", "0.7793576", "0.7765287", "0.7759033", "0.76967126", "0.7645301", "0.76375616", "0.758583", "0.757601", "0.75389576", "0.7536386", "0.7506599", "0.7499383", "0.7496711", "0.7472499...
0.86365056
0
Adds a new doc to Cloudant if a doc with the same value for unique_property_name does not exist.
def add_doc_if_not_exists(self, doc, unique_property_name): doc_type = doc['type'] property_value = doc[unique_property_name] existing_doc = self.find_doc(doc_type, unique_property_name, property_value) if existing_doc is not None: print('Returning {} doc where {}={}'.format(...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_document(obj):\n index = obj.get_index_name()\n doc_type = obj.get_document_type()\n body = obj.get_document_body()\n exists = ES.exists(index=index, doc_type=doc_type, id=obj.pk)\n\n if not exists:\n ES.create(index=index, doc_type=doc_type, body=body, id=obj.pk)\n return N...
[ "0.611054", "0.5632766", "0.5597991", "0.55933577", "0.54912066", "0.5417457", "0.53981847", "0.53293335", "0.5327089", "0.5323742", "0.526858", "0.52545476", "0.5241042", "0.5233962", "0.522708", "0.5196779", "0.51897454", "0.51704806", "0.51538277", "0.5063545", "0.50605637...
0.8177068
0
Return all ways to pick a kset from an nset, represented by an array of truthy values of length n.
def indicated_combinations(n, k): # - This singleton list is mutated and yielded, in order not to waste too # much memory. # - * is safe as integers are immutable # - I'm using integers so it's easier to skim when debugging indicator = [0] * n for combination in combinations(range(n), k): ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def build_possible_naked_sets(c, setlength=2):\n ns = {}\n pairs = [p for p in c.values() if len(p) == setlength]\n for k, v in c.items():\n if v in pairs:\n ns[k] = sorted(v)\n return ns", "def allcombinations(orgset, k):\n return itertools.chain(*[combination(orgset, i) for i i...
[ "0.67668533", "0.67628735", "0.66775584", "0.66138315", "0.65901273", "0.64204156", "0.6387719", "0.62883735", "0.61560315", "0.6149759", "0.608652", "0.60710835", "0.6043199", "0.6033082", "0.5985013", "0.5959775", "0.5916754", "0.58844054", "0.5882562", "0.5881801", "0.5872...
0.5776907
25
Returns the BaseTable subclass instance from which this TableRow originated.
def getTable(self): return self.table
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_table_attribute_from_base_class(self, source_table_name: str):\n return getattr(self.connection.base.classes, source_table_name)", "def get_table_class(self):\r\n if self.table_class:\r\n return self.table_class\r\n raise ImproperlyConfigured(\"A table class was not specif...
[ "0.6435579", "0.62322146", "0.62163913", "0.6172069", "0.59742546", "0.5929036", "0.59165496", "0.5886187", "0.5885914", "0.5841531", "0.58268", "0.57230175", "0.57230175", "0.56350595", "0.55845547", "0.5564515", "0.55475926", "0.5512529", "0.54857904", "0.5476513", "0.54545...
0.58892214
7
Closes the file associated with this TableReader. Does nothing by default; so might need to be overriden by child classes.
def close(self): pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def close_file(self):\r\n self.file.close()", "def close_file(self):\n self.file.close()", "def close_file(self):\n self.file.close()", "def close_csv_file(self):\n if self.file is not None:\n self.file.close()", "def close(self):\n self.__file.close()", "def close(sel...
[ "0.68259126", "0.6783816", "0.6783816", "0.67456055", "0.6711149", "0.66444004", "0.66444004", "0.6623016", "0.6619866", "0.66124773", "0.66124773", "0.6609649", "0.6609649", "0.6603344", "0.6574963", "0.65742487", "0.65004945", "0.6491931", "0.6449768", "0.6449768", "0.64278...
0.0
-1
Add an undirected edge to the graph
def add_edge(self, v1, v2): if v1 in self.vertices and v2 in self.vertices: self.vertices[v1].edges.add(v2) self.vertices[v2].edges.add(v1) else: raise IndexError("That vertex does not exist!")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_edge(self, edge):\n assert edge not in self.edges\n self.edges.append(edge)", "def add_edge(self, edge):\n if(self.has_edge(edge) == 0):\n self.__graph_dict[edge[0]].append(edge[1])", "def add_edge(self, edge):\n src = edge.get_source()\n dest = edge.get_de...
[ "0.7865", "0.78355986", "0.77554756", "0.7723153", "0.76283425", "0.7609168", "0.76072603", "0.7577147", "0.7548283", "0.7519275", "0.75040096", "0.73821694", "0.7368773", "0.73575443", "0.73438126", "0.7327635", "0.73179865", "0.73135585", "0.7309023", "0.7287673", "0.727965...
0.7005843
37
Add a directed edge to the graph
def add_directed_edge(self, v1, v2): if v1 in self.vertices: self.vertices[v1].edges.add(v2) else: raise IndexError("That vertex does not exist!")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_edge(self, edge):\n src = edge.get_source()\n dest = edge.get_destination()\n #weightEdge = WeightedEdge(src, dest, edge.get_total_distance(), edge.get_outdoor_distance())\n if not (src in self.edges and dest in self.edges):\n raise ValueError('Node not in graph')\n ...
[ "0.8015505", "0.79607785", "0.7775231", "0.77532995", "0.7729604", "0.76811075", "0.7618941", "0.76063526", "0.75842005", "0.7577965", "0.7535009", "0.7482374", "0.7479285", "0.74776787", "0.7473104", "0.7470197", "0.7468396", "0.7455426", "0.74327624", "0.7406552", "0.734486...
0.79365623
2
Computes the 3 axisymmetric Acoefficients associated with orientation of the vector w.r.t. to the D_rot ellipsoid. v can be many dimensions, as lons as the X/Y/Z cartesian dimensions is the last. e.g. v.shape = (M,N,3) Note the current implementation is probably a bit slower on small sizes comapred to the trivial. This...
def A_coefficients_symmtop(v, bProlate=True): v=_sanitise_v(v) if bProlate: # Use z-dim. z2=np.square(v.take(-1,axis=-1)) else: # Use x-dim. z2=np.square(v.take(0,axis=-1)) onemz2=1-z2 A0 = np.multiply( 3.0, np.multiply(z2,onemz2)) A1 = np.multiply(0.75, np.square...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def A_coefficients_ellipsoid(v, DD, bDDisDelta=False):\n #v can be given as an array with X/Y/Z cartesian dimensions being the last.\n #\"\"\"\n if bDDisDelta:\n delta=DD\n else:\n delta=Ddelta_ellipsoid(dd)\n #v=_sanitise_v(v)\n #v2=np.square(v)\n #v4=np.square(v2)\n #fact2=n...
[ "0.65471244", "0.63981587", "0.6358327", "0.61069584", "0.60980535", "0.60576284", "0.5950037", "0.593224", "0.59102297", "0.5898678", "0.58856267", "0.5826456", "0.57454294", "0.5704868", "0.56803524", "0.56785", "0.5676309", "0.56459516", "0.56048304", "0.5567015", "0.55537...
0.5080665
88
Allocates tensors for the optimizer state to allow direct compilation of the model before the first step.
def preinitialize(self): for group in self.param_groups: for p in group['params']: if group['momentum'] != 0: self.state[p]["momentum_buffer"] = torch.zeros_like( p, device="cpu" ).to(p.device)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _initalize_state(self):\n\n self.memories.append(tf.tanh(\n tf.random_normal(shape=(self.memory_capacity, self.memory_vector_size), stddev=0.5)))\n self.ww_t.append(tf.nn.softmax(tf.range(self.memory_capacity, 0, -1, dtype=tf.float32)))\n self.rw_t.append(tf.nn.softmax(tf.range(...
[ "0.7075337", "0.68024665", "0.66032326", "0.651239", "0.6449832", "0.63652307", "0.6330712", "0.6323323", "0.63111883", "0.6264637", "0.62335074", "0.619684", "0.619684", "0.6181374", "0.6179314", "0.6170764", "0.6157225", "0.61245596", "0.61193943", "0.61077696", "0.6093256"...
0.0
-1
Set the name of the character.
def set_name(self, name): # XXX: convert name to unicode, if it's a plain string? d = analyze_name(name, canonical=0) self.data.update(d)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_character_name(self, character_name):\n self.name = character_name", "def characterName(self, characterName):\n self._characterName = characterName", "def set_name(self, name: str) -> None:\n lib.wlr_seat_set_name(self._ptr, name.encode())", "def setName(self, name):\n sel...
[ "0.89501476", "0.82549185", "0.7734155", "0.75344384", "0.7511335", "0.74626625", "0.74626625", "0.7368366", "0.7368366", "0.7368366", "0.7368366", "0.7368366", "0.73563784", "0.7346184", "0.7298834", "0.72952807", "0.7294164", "0.7280826", "0.721163", "0.7199756", "0.7199756...
0.6915806
59
The Character is "false" if the self.data does not contain a name.
def __nonzero__(self): # XXX: check the name and the characterID? if self.data.get('name'): return 1 return 0
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def has_name(self):\n return self.unpack_word(0x2) != 0", "def has_ascii_name(self):\n return self.unpack_word(0x10) & 1 == 1", "def is_named(self):\n return self._name != \"\"", "def has_name_data(self):\n\n matches = set(self.broader_tags()) & LANGUAGES_WITH_NAME_DATA\n r...
[ "0.68924284", "0.6734916", "0.6635937", "0.65906084", "0.64795727", "0.643622", "0.63792413", "0.6378379", "0.636715", "0.63221276", "0.6321745", "0.62450135", "0.6176524", "0.61372274", "0.61087155", "0.60998607", "0.6054378", "0.60481435", "0.59773386", "0.59672993", "0.592...
0.7693617
0
Return true if this Character was portrayed in the given Movie or it was impersonated by the given Person.
def __contains__(self, item): from Movie import Movie from Person import Person if isinstance(item, Person): for m in flatten(self.data, yieldDictKeys=1, scalar=Movie): if item.isSame(m.currentRole): return 1 elif isinstance(item, Movie): ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_actor(self):\n return True", "def is_actor():\n return False", "def _is_authored_by_target(self, speech):\n speaker = speech.find(\"p\", klasse=\"redner\").redner.find(\"name\")\n\n if not speaker.vorname or not speaker.nachname:\n return False\n\n first_name = ...
[ "0.6456716", "0.6168211", "0.59273756", "0.57318056", "0.57080626", "0.56861764", "0.5646706", "0.5539991", "0.54835707", "0.54454577", "0.5397814", "0.5388086", "0.538147", "0.53624105", "0.5348565", "0.53358245", "0.5296581", "0.5289821", "0.52864164", "0.52445006", "0.5225...
0.51047575
38
Return a deep copy of a Character instance.
def __deepcopy__(self, memo): c = Character(name=u'', characterID=self.characterID, myName=self.myName, myID=self.myID, data=deepcopy(self.data, memo), notes=self.notes, accessSystem=self.accessSystem, titlesRefs=deepcopy(self.title...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def copy(self) -> 'Rune':\n return self.__copy__()", "def copy(self) -> 'Rune':\n return self.__copy__()", "def copy(self) -> 'Cell':\n new = Cell(self.letter)\n new.player = self.player\n return new", "def copy(self):\n return LetterBag(self.string())", "def copy(...
[ "0.70646316", "0.70646316", "0.6972674", "0.64444566", "0.63464975", "0.6324347", "0.6317154", "0.62851924", "0.6243672", "0.62268496", "0.6195071", "0.6195071", "0.6195071", "0.6195071", "0.6191595", "0.6176384", "0.6176384", "0.6176384", "0.6176384", "0.6176384", "0.6176384...
0.741937
0
String representation of a Character object.
def __repr__(self): r = '<Character id:%s[%s] name:_%s_>' % (self.characterID, self.accessSystem, self.get('name')) if isinstance(r, unicode): r = r.encode('utf_8', 'replace') return r
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def stringify(self):\n return self.char", "def string(self):\n return \"\".join((str(c) for c in self.characters))", "def __repr__(self):\n return '{}<{}, line {} char {}>'.format(\n self.__class__.__name__, repr(self._data),\n self._lineno, self._charno)", "def __s...
[ "0.7833714", "0.7424265", "0.70127326", "0.69779426", "0.68161", "0.6614953", "0.65942895", "0.64902914", "0.645844", "0.643535", "0.6384426", "0.6310432", "0.63066906", "0.6212264", "0.6205719", "0.6198091", "0.6185423", "0.6185423", "0.6183249", "0.6183249", "0.6183249", ...
0.74232304
2
Compute log(\sum_i exp(Z_i)) for some array Z.
def log_sum_exp(Z): return np.max(Z) + np.log(np.sum(np.exp(Z - np.max(Z))))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def logistic_function(z):\n\tg = 1/(1+np.exp(-z))\n\t#g = np.exp(z)/(1+np.exp(z))\n\treturn g", "def log_sum_exp(x):\n # TF ordering\n axis = len(x.shape) - 1\n m = paddle.max(x, axis=axis)\n m2 = paddle.max(x, axis=axis, keepdim=True)\n return m + paddle.log(paddle.sum(paddle.exp(x - m2), axis=ax...
[ "0.72955406", "0.70000017", "0.69763386", "0.6947724", "0.6854341", "0.6854341", "0.68434733", "0.6835322", "0.6835322", "0.68340427", "0.68242425", "0.67890185", "0.678535", "0.67170584", "0.67069113", "0.6685326", "0.6638205", "0.6539537", "0.6538283", "0.653539", "0.648778...
0.853284
0
Get local output level. This method returns either the local logger level set when calling initialize, or if that was not set then the logger level set in the Initializer configuration.
def get_output_level(self): outlvl = self._local_logger_level if outlvl is None: outlvl = self.config.output_level return outlvl
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_logging_level(self):\n return self.logging_level", "def log_level(self) -> LogLevel:\n if self.is_quiet:\n return LogLevel.NONE\n return LogLevel(self.logger.getEffectiveLevel())", "def getLogLevel() -> Optional[int]:\n\n if not logger.disabled:\n return logger...
[ "0.68613553", "0.6751319", "0.67467946", "0.6674586", "0.66413873", "0.64126235", "0.63684386", "0.6364565", "0.6358256", "0.6274128", "0.620987", "0.6177266", "0.60777044", "0.6032914", "0.6021324", "0.60062045", "0.5992274", "0.5992274", "0.5970048", "0.5932795", "0.5932795...
0.8477695
0
Get and store current state of variables (fixed/unfixed) and constraints/objectives activated/deactivated in model.
def get_current_state(self, model: Block): self.initial_state[model] = to_json(model, wts=StoreState, return_dict=True) return self.initial_state[model]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def variables(self) -> PyTree:\n return flax.core.freeze({\"params\": self.parameters, **self.model_state})", "def variabilize(self):\n if self.nvars>=0:\n pass #already done\n else:\n varTab = syt.SymbolTable()\n def convertArgs(args):\n retur...
[ "0.64224166", "0.6374878", "0.6295922", "0.6177371", "0.6170138", "0.61354345", "0.6135017", "0.6124848", "0.6111449", "0.61046994", "0.60919756", "0.6090844", "0.6084547", "0.60525256", "0.60161644", "0.5988815", "0.59854853", "0.5981811", "0.59513646", "0.59505635", "0.5930...
0.0
-1
Restore model state to that stored in self.initial_state.
def restore_model_state(self, model: Block): if model in self.initial_state: from_json(model, sd=self.initial_state[model], wts=StoreState) else: self._update_summary(model, "status", InitializationStatus.Error) raise ValueError("No initial state stored.")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reset_states(self):\n self.model.reset_states()", "def reset(self):\n self.set_state(self._initial_state)", "def reset(self):\n self._current_state = self._initial_state\n return self._current_state", "def restore_state(self, state):\n state_ref = self.ale.decodeState(s...
[ "0.7463039", "0.73698086", "0.7294601", "0.71570307", "0.7149184", "0.7149184", "0.7149184", "0.703696", "0.69934034", "0.6952096", "0.6935206", "0.6890805", "0.68177515", "0.680695", "0.6728974", "0.6728974", "0.6728974", "0.6728974", "0.6728974", "0.6728974", "0.6728974", ...
0.77374345
0
Initialize the Layer Manager's model.
def SetUpLayerManager(self): pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initialize_model(self):\n pass", "def init_model(self):\n pass", "def _init_layers(self):\n self._init_predictor()\n if self.use_edge_fusion:\n self._init_edge_module()", "def init_model(self):\n cxnlib.CXNNetInitModel(self.handle)", "def initialize(self, m...
[ "0.7288466", "0.7279331", "0.7026693", "0.7020394", "0.6874338", "0.65884787", "0.6567816", "0.6567816", "0.64982116", "0.64774096", "0.64710635", "0.64489335", "0.64408183", "0.6439161", "0.637311", "0.63661605", "0.6364058", "0.63477635", "0.63448393", "0.6319277", "0.63047...
0.76564676
0
For a given RNA, get the p values for all proteins by negative binomial.
def pval_at_rna_by_nbinom( self, pos_dict_of_counts: Mapping[str, List], neg_vals_at_rna: np.array, gene_and_type, log_if_values_above=1E9, log_values=False, which='per_read', verbose=False): if len(neg_vals_at_rna) == 0: return None log_scale_high_value = (...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def base_binom_pro(pro,n0):\n res = stats.binom.pmf(range(n0+1), n0, 1/2.0)\n a = 0\n for i in range(n0+1):\n a = a + res[i]\n if a>=pro: \n return i", "def calculate_pvalues(\n self, which='per_read', log_values=False, \n log_if_values_above=1E9, apply_bh_adjust...
[ "0.64295244", "0.61206096", "0.6092632", "0.5937054", "0.5915439", "0.5897987", "0.5843961", "0.57824105", "0.57793957", "0.5767617", "0.5760822", "0.5756754", "0.5744418", "0.5713776", "0.5706442", "0.5702385", "0.5693384", "0.5687943", "0.5681183", "0.56736696", "0.5654586"...
0.625052
1
A data generator for generating triplets, i.e, (input_image, positive_image, negative_image) on the fly before training. Select a random input image from the training set and select an positive_image with same product id and negative image with different product id and generate batch of triplets The function keeps yiel...
def s2s_data_generator(s2s_df=duplets, all_catalog=catalog_images, batch_size=None): orig_index_list = duplets.index.tolist() all_shop_index_list = catalog_images.index.tolist() dummy = np.zeros((1, 3 * N)) while True: q_list = list() p_list = list() n_list = list() ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def gen_batch_function(data_folder, image_shape, seed=None, samples_limit=None):\n # Grab image and label paths\n image_paths = glob(os.path.join(data_folder, 'image_2', '*.png'))\n label_paths = {\n re.sub(r'_(lane|road)_', '_', os.path.basename(path)): path\n for path in glob(os.path.join(...
[ "0.6670975", "0.6518714", "0.6311734", "0.62550783", "0.62339956", "0.6226525", "0.62081903", "0.62033963", "0.6192986", "0.6186082", "0.618001", "0.61669344", "0.61635137", "0.61606437", "0.6137136", "0.61250395", "0.6095593", "0.6051026", "0.60404116", "0.6019593", "0.60158...
0.5884833
32
Is portfolio get all returning a list of Portfolio instances?
def test_02_portfolio_get_all(self): self.assertTrue(isinstance(Portfolio.get_all(), list), msg="Portfolio is NOT returning a list of all instances") print("Portfolio get_all method is returning the following list: {}".format( Portfolio.get_all(), ))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def portfolio(self):\n self.update_portfolio()\n return self._immutable_portfolio", "def test_06_get_all_portfolio_transactions(self):\n p = Portfolio.get_portfolio_by_slug(\"test\")\n t = Transaction.get_transactions(p)\n self.assertTrue(isinstance(t, list),\n ...
[ "0.7062169", "0.69397235", "0.6546505", "0.63734484", "0.62883407", "0.6234493", "0.6177684", "0.616726", "0.6156453", "0.59769446", "0.59720457", "0.5965514", "0.5940291", "0.5923666", "0.58675176", "0.5859177", "0.58466095", "0.58249974", "0.5822161", "0.57810724", "0.57732...
0.812841
0
Is portfolio get transaction assets returning an unique list of Transaction assets?
def test_08_transaction_assets_of_portfolio(self): p = Portfolio.get_portfolio_by_slug("test") t = Transaction.get_transaction_assets(p) self.assertTrue(isinstance(t, list), msg="Transaction is NOT returning a list of unique transaction assets") print("Transaction...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_09_transactions_by_asset(self):\n p = Portfolio.get_portfolio_by_slug(\"test\")\n user = \"automated unit tester\"\n\n buy_stock_ibm = Transaction.buy_stock(\n portfolio=p,\n asset=\"IBM\",\n t_currency=TRANSACTION_CURRENCY_USD,\n amount=32,...
[ "0.69945604", "0.694181", "0.6821842", "0.6712087", "0.6373541", "0.63606733", "0.6324977", "0.60800743", "0.605254", "0.6031225", "0.5916209", "0.58847517", "0.58741885", "0.5818111", "0.5714047", "0.5686146", "0.5644342", "0.56390864", "0.56340545", "0.56191", "0.56149846",...
0.85128826
0
Is portfolio get transactions by asset returning a list of Transactions?
def test_09_transactions_by_asset(self): p = Portfolio.get_portfolio_by_slug("test") user = "automated unit tester" buy_stock_ibm = Transaction.buy_stock( portfolio=p, asset="IBM", t_currency=TRANSACTION_CURRENCY_USD, amount=32, unit_p...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_08_transaction_assets_of_portfolio(self):\n p = Portfolio.get_portfolio_by_slug(\"test\")\n t = Transaction.get_transaction_assets(p)\n self.assertTrue(isinstance(t, list),\n msg=\"Transaction is NOT returning a list of unique transaction assets\")\n prin...
[ "0.7884124", "0.75701594", "0.6596491", "0.6386773", "0.63495964", "0.62921685", "0.62614506", "0.61750096", "0.6090789", "0.60896486", "0.60391206", "0.6009348", "0.6002427", "0.5961729", "0.59453547", "0.5912782", "0.58792007", "0.5861768", "0.5806336", "0.5805966", "0.5804...
0.7743377
1
Checks if a location is on the board, if it is returns True.
def in_bounds(self, location: tuple) -> bool: return 0 <= min(location) and max(location) <= 7
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _check_if_position_on_board(coord: tuple, board_size: int):\n in_row = coord[0] in range(board_size)\n in_col = coord[1] in range(board_size)\n return in_row and in_col", "def is_on_board(x: int, y: int) -> bool:\n return x >= 0 and x < BOARDWIDTH and y < BOARDHEIGHT", "def is_cell_on_board(cel...
[ "0.74486387", "0.7303566", "0.70326304", "0.69853187", "0.697615", "0.69737786", "0.69399995", "0.69195354", "0.68025", "0.67903817", "0.6759761", "0.6739166", "0.67048043", "0.66956395", "0.6690133", "0.6663193", "0.66379786", "0.6626786", "0.6599799", "0.6587071", "0.657922...
0.62807804
61
Returns a location to which we can safely move.
def move_to_safe_location(self, obs, location: tuple): # Create a mapping of positions and danger level danger_map = self.create_danger_map(obs) # Check if our current position is safe, if so we can go/stay there. return self.find_reachable_safe_location(obs['board'], danger_map, locat...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def move_toward(state, location):\n return move_relative(state, location, True)", "def _calculate_move_location(self, direction):\n current_row = self._current_loc.get_row()\n current_column = self._current_loc.get_column()\n\n # Calculate the new location for a left move\n if (dir...
[ "0.68402696", "0.6645437", "0.64134586", "0.6402261", "0.6401443", "0.6365496", "0.63403916", "0.6289275", "0.6260041", "0.6241965", "0.6212907", "0.61765695", "0.6175093", "0.6167111", "0.6164323", "0.6143258", "0.61229134", "0.6118263", "0.610832", "0.6099639", "0.60875195"...
0.68152356
1
Fix duplicate field names by appending an integer to repeated names.
def fix_duplicate_field_names(self,names): used = [] new_names = [] for name in names: if name not in used: new_names.append(name) else: new_name = "%s_%d"%(name,used.count(name)) new_names.append(new_name) used....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove_duplicates(self):\n names: Dict[str, int] = dict()\n for step in self.Sequence:\n if isinstance(step, Repeater):\n continue\n name = step.Name\n if name != '':\n if name not in names:\n names[name] = 1\n ...
[ "0.67453194", "0.6440248", "0.6375717", "0.59917706", "0.58438915", "0.5807908", "0.5782446", "0.56516784", "0.5629432", "0.5595076", "0.55664474", "0.5514417", "0.55063826", "0.5475275", "0.5426433", "0.5420128", "0.53905916", "0.5383994", "0.5356543", "0.5355158", "0.535031...
0.815471
0
Build the url with the appended request if provided.
def url(self, request_path=""): return f"{self.scheme}://{self.host}/{request_path}"
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def build_url(self, request, action, **query):\n base = urlparse.urljoin(request['base_url'], self.auth_prefix + '/' + action)\n return appendArgs(base, query)", "def _build_request_url(self, params, kwargs, post=False):\n if post:\n return '%s%s' % (self.endpoint, self.methodname...
[ "0.79692763", "0.7254912", "0.7187679", "0.6979685", "0.69671714", "0.69655365", "0.69655365", "0.69041055", "0.67990327", "0.67837423", "0.6766316", "0.6761845", "0.6694898", "0.6689456", "0.6659014", "0.6642371", "0.6629415", "0.6613108", "0.6561013", "0.65125006", "0.65077...
0.6392476
24
Get the user with the provided id
def get_user(self, object_id): return self.get_object("user", object_id)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_user_by_id(self, id):\n\t\treturn self.users.get(id)", "def get(id):\n return User.query.filter_by(id=id).first()", "def get_single_user(self, id):\n for user in self.users:\n if user['id'] == id:\n return user", "def get_user(id):\n pass", "def getUser(se...
[ "0.9023855", "0.8664333", "0.8585364", "0.85791296", "0.85102224", "0.84687114", "0.8437379", "0.84248155", "0.8382619", "0.8363252", "0.8358248", "0.8322038", "0.831863", "0.83111", "0.8308937", "0.8265049", "0.8222677", "0.8192917", "0.8164613", "0.81605667", "0.81605667", ...
0.78946465
51
A primality test. >>> [is_prime(n) for n in (857, 859, 863, 877, 881, 883, 887, 907, 911)] [True, True, True, True, True, True, True, True, True] >>> is_prime(861) False >>> [is_prime(n) for n in (1, 2, 4, 6, 8, 7)] [False, True, False, False, False, True]
def is_prime(p): if p == 1: return False for n in range(2, int(math.sqrt(p))+1): if p % n == 0: return False return True
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_prime(n):\n if SIEVE[n]:\n return True\n else:\n return False", "def isprime(n):\n if n % 2 == 0:return False\n return all(n % i for i in range(3, int(n**0.5) + 1, 2))", "def isprime(n):\r\n\treturn is_prime(n)", "def is_prime(n):\n return mr_prime(n)", "def isprime(n)...
[ "0.771079", "0.77059245", "0.7697917", "0.76606923", "0.7651121", "0.76310545", "0.7582879", "0.75709045", "0.7523891", "0.74345404", "0.7411377", "0.7390217", "0.7378277", "0.73780245", "0.7373386", "0.73607373", "0.7352041", "0.73334414", "0.73332", "0.7327298", "0.7322893"...
0.73416173
17
Convert comma separated list of column names and ranges to indices.
def _range2cols(areas: str) -> list[int]: cols: list[int] = [] for rng in areas.split(","): if ":" in rng: rngs = rng.split(":") cols.extend(range(_excel2num(rngs[0]), _excel2num(rngs[1]) + 1)) else: cols.append(_excel2num(rng)) return cols
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index_range(raw):\n if not raw:\n return None\n\n indices = set()\n try:\n with open(raw, 'r') as f:\n for l in f:\n l = l.strip()\n if len(l) == 0 or l[0] == '#':\n continue\n if \" \" in l:\n ...
[ "0.6271139", "0.59360015", "0.58300525", "0.5817749", "0.5779524", "0.5596657", "0.5590307", "0.5585735", "0.5569682", "0.553597", "0.5459676", "0.5414293", "0.54004407", "0.5380438", "0.53774476", "0.534839", "0.5332412", "0.5327949", "0.53014314", "0.529832", "0.52869046", ...
0.5581468
8
The device Android version.
def android_version(self): if not self._android_version: # Get the Android version from the connected device cmd = ["getprop", "ro.build.version.release"] # TODO: surround with try/except? tmp = subprocess.check_output(self.shell + cmd).decode() self._...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_version(self):\r\n return self._arm.get_version()", "def hardware_version(self) -> str:\n return self.camera_info[\"main_hw_version\"]", "def get_sdk_version(self):\n return int(self.get_property(ADB.VERSION_SDK_PROPERTY))", "def library_version():\n\n return appium_version.ve...
[ "0.728132", "0.7243305", "0.7096307", "0.7047162", "0.68846136", "0.68696684", "0.68512815", "0.68475586", "0.67665094", "0.6745548", "0.66814363", "0.665434", "0.66414535", "0.6626868", "0.66016096", "0.66016096", "0.6588704", "0.6516657", "0.65029305", "0.65025693", "0.6498...
0.8584862
0
Get the directory matching the given path from a connected device. The path must be a directory.
def get_dir(self, path): path = os.path.normpath(path) cmd = ["ls", "-ldZ", "'" + path + "'"] listing = subprocess.check_output(self.shell + cmd).decode().split('\n') line = listing[0].strip("\r") # Parse ls -ldZ output for a directory try: f = File(line, os.p...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getDirectory(path):\n\tfrom os.path import split\n\tpath = normalizePath(path)\n\treturn split(path)[0]", "def get_directory(path):\n return mangle_path(path).rsplit('/',1)[0]", "def get_directory(path):\n path = os.path.expanduser(path)\n path = os.path.normpath(path)\n path = os.path.abspath(...
[ "0.75760823", "0.7206234", "0.7135575", "0.6613675", "0.6525836", "0.6469089", "0.6371758", "0.636219", "0.63208586", "0.6316571", "0.62652737", "0.623589", "0.62309635", "0.6203044", "0.6164292", "0.61558557", "0.6091325", "0.6082039", "0.6038978", "0.60140264", "0.5993293",...
0.71436876
2
Get the file class
def security_class(self): return self._security_class
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def file(self):\r\n return self._get_instantiation()[0]", "def get_class_file_name(name):\n name = _strip_class_name(name)\n return name + FILE_EXTENSION", "def get_class(fileName):\n module = __import__(fileName)\n return getattr(module, fileName)", "def getFilesystemTypeFromClass...
[ "0.7350407", "0.6957804", "0.6814747", "0.67628294", "0.65856117", "0.655752", "0.6460984", "0.6456215", "0.64387596", "0.64387596", "0.64387596", "0.6414171", "0.63495946", "0.6287545", "0.62732863", "0.62375987", "0.6218352", "0.6207857", "0.61908466", "0.61908466", "0.6186...
0.0
-1
Get the file size in Bytes, if available.
def size(self): if hasattr(self, "_size"): return self._size else: return None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_file_size(self) -> int:\n return self.get_main_information()['FileSize']", "def file_size():\n return os.path.getsize(FILE_NAME)", "def get_file_size(self):\n try:\n return os.path.getsize(self.get_full_path())\n except Exception as e:\n raise SystemExit(f\...
[ "0.84936786", "0.8428093", "0.838306", "0.8283282", "0.8253737", "0.81616104", "0.81616104", "0.8150866", "0.8137746", "0.81308514", "0.8069001", "0.8069001", "0.8069001", "0.8002018", "0.79804486", "0.7972367", "0.7963873", "0.79202974", "0.7907865", "0.7893577", "0.7867854"...
0.0
-1
Get the file basename
def basename(self): return self._basename
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_file_basename(self):\n return self._basename[:]", "def basename(self):\n return get_basename(self.filename)", "def basename(file_path):\n return os.path.basename(file_path)", "def basename(self):\n return self._getbyspec(\"basename\")[0]", "def basename(self):\n retur...
[ "0.87719274", "0.8735816", "0.8710294", "0.8682129", "0.86057115", "0.8584476", "0.85607356", "0.83748215", "0.83733696", "0.82951725", "0.8268515", "0.82577753", "0.82519525", "0.8236792", "0.81958103", "0.8160816", "0.8100247", "0.80857176", "0.8051255", "0.7982047", "0.796...
0.81792635
15
Get the file absolute name
def absname(self): return self._absname
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getAbsFileName(fname):\n\tfileAbsPath=os.path.abspath(fname)\n\treturn fileAbsPath", "def get_file_name(self):\n return self.path.name[6:]", "def get_file_name(self):\n return str(self.get_file())", "def get_abs_filename(filename):\n absolute_current_dir = os.path.abspath(os.path.dirname...
[ "0.81569433", "0.7838035", "0.77766085", "0.7764686", "0.7674127", "0.7660703", "0.75777906", "0.7505313", "0.7484599", "0.74674976", "0.74625427", "0.7458229", "0.7444796", "0.7419286", "0.7394074", "0.73682773", "0.73552865", "0.73462456", "0.73387575", "0.7338748", "0.7311...
0.0
-1
Get the process name
def name(self): return self._name
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_process_name(self):\n\n return self._args.t", "def get_process_name(pid):\n proc = subprocess.Popen(['ps', '-p', pid, '-o', 'comm='],\n stdout=subprocess.PIPE,\n stderr=subprocess.PIPE)\n out, err=proc.communicate()\n return out.strip(...
[ "0.8540508", "0.8186103", "0.7787348", "0.7665088", "0.7560937", "0.74781615", "0.7391654", "0.7027333", "0.69708735", "0.68173873", "0.67580676", "0.6750514", "0.672062", "0.6711601", "0.6711601", "0.66987085", "0.6658858", "0.6635752", "0.6603424", "0.65922517", "0.6558821"...
0.0
-1
Reads all the text from a text file, and returns this as a single string.
def read_text_from_file(file_path): validate_txt_extension(file_path) with open(file_path) as file: # Read all the lines from the file, and concatenate into a single string. return ''.join([line for line in file])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def simple_text_reader(text_file):\n with open(text_file, 'rt') as file:\n data = file.read()\n return data", "def _read_data(self, txtfile):\n data_string = open(txtfile,'r').read()\n return data_string", "def readFromTextFile(self, file_name):\n with open(file_name, 'r') as ...
[ "0.7316784", "0.72672963", "0.7229631", "0.7083923", "0.7055522", "0.70383984", "0.703616", "0.70302117", "0.69800526", "0.69755685", "0.69214934", "0.6918536", "0.6873002", "0.6791377", "0.67871165", "0.6734747", "0.673225", "0.67118716", "0.66837186", "0.6672363", "0.661160...
0.67958784
13
assert exception is raised for nonexistent path
def test_nonexistent_path(tmpdir_factory): folder = Path(tmpdir_factory.mktemp('git')) path = folder.joinpath('nonexistent') with pytest.raises(ValueError): gitb.pull(path)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def verify_non_existing_path(self) -> None:\n path = \"/some/non/existing/path\"\n with self.assertRaises(NotFoundException):\n verify_file_path(path)", "def test_invalid_path(self):\n self.assertRaises(argparse.ArgumentTypeError, generic.check_path, 'foo')", "def verify_restric...
[ "0.8268219", "0.7502979", "0.75024366", "0.7451902", "0.7424781", "0.7392558", "0.72852635", "0.72728455", "0.72660863", "0.7231714", "0.72289926", "0.721946", "0.72025144", "0.71912223", "0.7178884", "0.7130148", "0.71187955", "0.71096396", "0.7096285", "0.7026923", "0.70209...
0.6659672
54
assert exception is raised if not a repo
def test_path_not_repo(folder): with pytest.raises(ValueError): gitb.pull(folder)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_unknownRepository(self):\n self.assertRaises(NotWorkingDirectory, getRepositoryCommand, self.repos)", "def test_fetch_invalid_github_repo(self):\n url = 'https://github.com/archi'\n with self.assertRaises(Exception):\n GitHubRepoFetcher().fetch(url)", "def test_fetch_no...
[ "0.761208", "0.7560967", "0.74026674", "0.7380079", "0.73506886", "0.71984696", "0.7144186", "0.7142813", "0.7048591", "0.70252424", "0.69973695", "0.6893283", "0.6803735", "0.67844695", "0.67088515", "0.67071533", "0.66571397", "0.6635888", "0.6630313", "0.6550595", "0.65361...
0.732144
5
assert exception is raised if a repo has no tracking branch
def test_repo_no_remote(repo): with pytest.raises(ValueError): gitb.pull(repo.working_tree_dir)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_branch_fail(repository: Repository) -> None:\n with pytest.raises(KeyError):\n repository.branch(\"branch\")", "def test_heads_contains_false(repository: Repository) -> None:\n assert \"branch\" not in repository.heads", "def test_path_not_repo(folder):\n\n with pytest.raises(ValueErro...
[ "0.75480485", "0.7263348", "0.7199445", "0.7009176", "0.6826254", "0.6780176", "0.6755103", "0.67515707", "0.67448026", "0.6742422", "0.67161465", "0.66541594", "0.6649784", "0.66389626", "0.66336024", "0.6609925", "0.6602508", "0.6420919", "0.64028436", "0.6387867", "0.63641...
0.7269188
1
Sets the id of this StoreUrlConfiguration.
def id(self, id): if id is None: raise ValueError("Invalid value for `id`, must not be `None`") # noqa: E501 self._id = id
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_id(self, id_):\n\n self.id_ = id_", "def set_id(self, id):\n self.data['id'] = id", "def set_id(self, id):\n self.__id = id", "def id(self, id: str):\n \n self._id = id", "def SetId(self, id):\n self.id = int(id)", "def store_id(self, store_id):\n ...
[ "0.66508585", "0.6592743", "0.6566896", "0.64278495", "0.64161736", "0.64060926", "0.6399919", "0.6399919", "0.6399919", "0.6358866", "0.631308", "0.631308", "0.631308", "0.631308", "0.631308", "0.6270708", "0.6270708", "0.6270708", "0.6270708", "0.6270708", "0.6270708", "0...
0.0
-1
Sets the transaction_notification_url of this StoreUrlConfiguration.
def transaction_notification_url(self, transaction_notification_url): self._transaction_notification_url = transaction_notification_url
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def recurring_transaction_notification_url(self, recurring_transaction_notification_url):\n\n self._recurring_transaction_notification_url = recurring_transaction_notification_url", "def notify_url(self, notify_url):\n\n self._notify_url = notify_url", "def method_notification_url(self, method_no...
[ "0.743379", "0.6348347", "0.617391", "0.5849823", "0.50333273", "0.4990913", "0.49459577", "0.49224275", "0.4912939", "0.4912939", "0.4905969", "0.48247993", "0.4809686", "0.47674695", "0.47674695", "0.47510424", "0.46979332", "0.4695061", "0.46826473", "0.46764046", "0.46138...
0.86247927
0
Sets the recurring_transaction_notification_url of this StoreUrlConfiguration.
def recurring_transaction_notification_url(self, recurring_transaction_notification_url): self._recurring_transaction_notification_url = recurring_transaction_notification_url
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def transaction_notification_url(self, transaction_notification_url):\n\n self._transaction_notification_url = transaction_notification_url", "def method_notification_url(self, method_notification_url):\n\n self._method_notification_url = method_notification_url", "def notify_url(self, notify_url...
[ "0.73366183", "0.5945408", "0.58616453", "0.49812144", "0.47298342", "0.47298342", "0.46253613", "0.46181828", "0.45913643", "0.45379418", "0.45312813", "0.44840717", "0.44351047", "0.43826178", "0.43701798", "0.43670374", "0.43431824", "0.43294266", "0.4326882", "0.42897275", ...
0.84907234
0
Sets the response_success_url of this StoreUrlConfiguration.
def response_success_url(self, response_success_url): self._response_success_url = response_success_url
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def with_success_url(self, url):\n self.__success_url = url\n return self", "def on_success_url(self, on_success_url):\n\n self._on_success_url = on_success_url", "def get_success_url(self):\n if not self.success_url:\n return self.request.get_full_path()\n return ...
[ "0.71014994", "0.684946", "0.63355774", "0.6243574", "0.6171999", "0.6091107", "0.60322094", "0.5935141", "0.59321535", "0.59321535", "0.5891836", "0.58217734", "0.5745798", "0.5708686", "0.5694084", "0.567529", "0.56572485", "0.5510942", "0.5470778", "0.5441133", "0.539344",...
0.8465847
0
Sets the response_failure_url of this StoreUrlConfiguration.
def response_failure_url(self, response_failure_url): self._response_failure_url = response_failure_url
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def response_success_url(self, response_success_url):\n\n self._response_success_url = response_success_url", "def response_kafka_connection_url(self, response_kafka_connection_url: str):\n\n self._response_kafka_connection_url = response_kafka_connection_url", "def with_error_url(self, url):\n ...
[ "0.67325926", "0.61840147", "0.6133804", "0.5944127", "0.5575882", "0.5515315", "0.5437121", "0.53560185", "0.52995324", "0.5281394", "0.5277041", "0.5269514", "0.52312785", "0.5195577", "0.5164423", "0.5101275", "0.50832057", "0.50669324", "0.50382894", "0.50128365", "0.4986...
0.8542002
0
Sets the skip_result_page_for_success of this StoreUrlConfiguration.
def skip_result_page_for_success(self, skip_result_page_for_success): self._skip_result_page_for_success = skip_result_page_for_success
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def skip_result_page_for_failure(self, skip_result_page_for_failure):\n\n self._skip_result_page_for_failure = skip_result_page_for_failure", "def v2_runner_on_skipped(self, result):\n super(Callback, self).v2_runner_on_skipped(result)\n self._store(result, STATUS_SKIPPED)", "def set_skip(...
[ "0.7781596", "0.57031137", "0.52726793", "0.49588716", "0.49287266", "0.4810245", "0.473015", "0.4712832", "0.45400152", "0.45209688", "0.45202103", "0.45113936", "0.44433716", "0.44041428", "0.43869552", "0.43729672", "0.4371329", "0.4352022", "0.43146196", "0.43135968", "0....
0.84920037
0
Returns true if both objects are equal
def __eq__(self, other): if not isinstance(other, StoreUrlConfiguration): return False return self.__dict__ == other.__dict__
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __eq__(self, other):\n return are_equal(self, other)", "def __eq__(self, other):\n return are_equal(self, other)", "def __eq__(self,other):\n try: return self.object==other.object and isinstance(self,type(other))\n except: return False", "def __eq__(self, other):\n if i...
[ "0.8088132", "0.8088132", "0.8054589", "0.7982687", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", ...
0.0
-1
Returns true if both objects are not equal
def __ne__(self, other): return not self == other
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __ne__(self, other: object) -> bool:\n if self.__eq__(other):\n return False\n return True", "def __ne__(self, other: object) -> bool:\n return not self.__eq__(other)", "def __ne__(self, other) -> bool:\n return not self.__eq__(other)", "def __eq__(self, other):\n ...
[ "0.845611", "0.8391477", "0.8144138", "0.81410587", "0.8132492", "0.8093973", "0.80920255", "0.80920255", "0.80920255", "0.8085325", "0.8085325", "0.8076365", "0.8076365", "0.8065748" ]
0.0
-1
Dot product between two points
def dot(p1, p2): return p1[0] * p2[0] + p1[1] * p2[1]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dot(a, b):\n return a[0]*b[0] + a[1]*b[1] + a[2]*b[2]", "def dot(a,b):\n return a[0]*b[0]+a[1]*b[1]+a[2]*b[2]", "def dot(x,y):\n\treturn sum([xi*yi for (xi,yi) in zip(x,y)])", "def dot(x, y):\n res = x[0] * y[0]\n for a, b in zip(x, y):\n res += a * b\n return res", "def dot(a, b)...
[ "0.80575734", "0.80163157", "0.7981756", "0.78800917", "0.7833627", "0.78089905", "0.777131", "0.776726", "0.7749556", "0.7709001", "0.7671875", "0.766193", "0.76345164", "0.7632237", "0.7632237", "0.763077", "0.7625666", "0.76185733", "0.7605201", "0.7595505", "0.75636303", ...
0.8218893
0
Creates a line from two points
def line(p1, p2): A = (p1[1] - p2[1]) B = (p2[0] - p1[0]) C = (p1[0]*p2[1] - p2[0]*p1[1]) return A, B, -C
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generate_line(point_1, point_2):\r\n A = point_1.y - point_2.y\r\n B = point_2.x - point_1.x\r\n C = point_1.y * B + point_1.x * A\r\n return np.matrix([[A],[B],[-C]])", "def line(x1, y1, x2, y2):\r\n\r\n x1 = normalize(x1)\r\n y1 = normalize(y1)\r\n x2 = normalize(x2)\r\n y2 = normal...
[ "0.8127765", "0.78903234", "0.78226745", "0.77153796", "0.76861584", "0.7526297", "0.7425139", "0.7300555", "0.72701234", "0.72337586", "0.7218913", "0.72030354", "0.7201003", "0.7183471", "0.71760195", "0.7072573", "0.70341897", "0.70269936", "0.70102984", "0.69804555", "0.6...
0.66081494
45
Euclidean distance between two (tracktotrip) points
def distance_tt_point(a, b): return math.sqrt((b.lat-a.lat)**2 + (b.lon-a.lon)**2)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __get_distance(point1: np.ndarray, point2: np.ndarray) -> float:\n return np.sqrt(np.sum(np.square(point1 - point2)))", "def distance(a: Point, b: Point) -> float:\n return math.sqrt(math.pow(b.x - a.x, 2) + math.pow(b.y - a.y, 2))", "def distance(self, pt1, pt2):\r\n # productive #frequent\r\...
[ "0.7570923", "0.7556414", "0.746476", "0.7439545", "0.7412407", "0.73951024", "0.7394975", "0.7373433", "0.73733133", "0.73496294", "0.7324275", "0.7317081", "0.7305315", "0.72701055", "0.7267547", "0.7261338", "0.7249864", "0.7248064", "0.7246902", "0.7240861", "0.7212386", ...
0.68871725
91
Yield the positions of atoms in the batch. Yields
def get_positions(self): yield from self._positions
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def iter_positions(self):\n for loc in self.iter_locations():\n yield loc.position", "def iter_positions(self, include_alt_loc=False):\n for atom in self:\n if include_alt_loc:\n for loc in atom.iter_positions():\n yield loc\n else:...
[ "0.7544001", "0.7362795", "0.6769089", "0.6741607", "0.6710273", "0.6702326", "0.66945636", "0.66754526", "0.646947", "0.63678926", "0.63566256", "0.63406646", "0.6335163", "0.63197887", "0.6276833", "0.6276194", "0.62350243", "0.6230621", "0.6223185", "0.620386", "0.6182705"...
0.69317377
2
Get the dialogue_reference of the message.
def dialogue_reference(self) -> Tuple[str, str]: enforce(self.is_set("dialogue_reference"), "dialogue_reference is not set.") return cast(Tuple[str, str], self.get("dialogue_reference"))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_message(self):\n return self.message", "def get_message(self):\n return self.message", "def _get_message(self):\n return self.__message", "def get_message (self) :\n return self._message", "def get_message(self):\n return self.__mess", "def get_reference(self):\...
[ "0.5959654", "0.5959654", "0.5914954", "0.5835652", "0.5816795", "0.58139884", "0.5798165", "0.56435615", "0.5603565", "0.55960155", "0.55960155", "0.5579671", "0.5579671", "0.5579671", "0.5579671", "0.5579671", "0.5565717", "0.55399346", "0.55399346", "0.55309427", "0.552806...
0.79154986
0
Get the message_id of the message.
def message_id(self) -> int: enforce(self.is_set("message_id"), "message_id is not set.") return cast(int, self.get("message_id"))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def message_id(self):\n return self._message_id", "def getMessageID(self):\n return self._payload[1]", "def message_id(self) -> str:\n return self[\"Sns\"][\"MessageId\"]", "def msg_id(self):\n return struct.unpack('<H', self.pkt.payload[0:2])[0]", "def get_message_by_id(message...
[ "0.8787715", "0.8481341", "0.80076957", "0.7417332", "0.6884192", "0.6880647", "0.68433136", "0.6767874", "0.67058575", "0.67058575", "0.66893184", "0.6680958", "0.6643317", "0.6600039", "0.6521175", "0.64887494", "0.6466459", "0.64267176", "0.6333503", "0.633283", "0.6313509...
0.8594349
1
Convert sparse matrix to tuple representation.
def sparse_to_tuple(sparse_mx): def to_tuple(mx): if not sp.isspmatrix_coo(mx): mx = mx.tocoo() coords = np.vstack((mx.row, mx.col)).transpose() values = mx.data shape = mx.shape return coords, values, shape if isinstance(sparse_mx, list): for i in ra...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sparse_to_tuple(sparse_mx):\n def to_tuple(mx):\n if not sp.isspmatrix_coo(mx):\n mx = mx.tocoo()\n coords = np.vstack((mx.row, mx.col)).transpose()\n values = mx.data\n shape = mx.shape\n return coords, values, shape", "def sparse_to_tuple(sparse_mx):\r\n ...
[ "0.85870504", "0.82527", "0.82527", "0.8091624", "0.7986327", "0.602773", "0.59843755", "0.5971062", "0.59706587", "0.59447116", "0.59443593", "0.5910293", "0.5910293", "0.5910293", "0.5910293", "0.5910293", "0.58940256", "0.58499134", "0.5845008", "0.577404", "0.5689886", ...
0.82655305
7
Symmetrically normalize adjacency matrix.
def normalize_adj(adj): adj = sp.coo_matrix(adj) rowsum = np.array(adj.sum(1)) d_inv_sqrt = np.power(rowsum, -0.5).flatten() d_inv_sqrt[np.isinf(d_inv_sqrt)] = 0. d_mat_inv_sqrt = sp.diags(d_inv_sqrt) return adj.dot(d_mat_inv_sqrt).transpose().dot(d_mat_inv_sqrt).tocoo()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def normalize_adj(adj):\n\n rowsum = np.array(adj.sum(1))\n d_inv_sqrt = np.power(rowsum, -0.5).flatten()\n d_inv_sqrt[np.isinf(d_inv_sqrt)] = 0.\n d_mat_inv_sqrt = np.diag(d_inv_sqrt)\n return adj.dot(d_mat_inv_sqrt).transpose().dot(d_mat_inv_sqrt)", "def normalize_adj(adj):\r\n adj = sp.coo_m...
[ "0.788518", "0.7691616", "0.759434", "0.7566608", "0.7335597", "0.730491", "0.72684425", "0.688461", "0.68616927", "0.686005", "0.6832041", "0.682895", "0.6750887", "0.6750057", "0.67278", "0.66282207", "0.6616473", "0.64879745", "0.6486613", "0.63610464", "0.63610464", "0....
0.7698141
8
A function to compute the jensenshannon distances between columns of similar DataFrames. For categorical columns, the probability of each category will be computed separately for `df_baseline` and `df_sample`, and the Jensen Shannon distance between the 2 probability arrays will be computed. For numerical columns, the ...
def js_metric(df_1, df_2, numerical_columns, categorical_columns): res = {} STEPS = 100 for col in categorical_columns: # to ensure similar order, concat before computing probability col_baseline = df_1[col].to_frame() col_sample = df_2[col].to_frame() col_baseline["source"...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def compute_js_divergence(df_1, df_2, n_bins=30):\n a = np.concatenate((df_1, df_2), axis=0)\n e, p = prob_mass_fun(df_1, n = n_bins, range = (a.min(), a.max()))\n _, q = prob_mass_fun(df_2, n = e, range = (a.min(), a.max()))\n\n return scipy.spatial.distance.jensenshannon(p, q)", "def calculateDista...
[ "0.64014757", "0.61950874", "0.59821224", "0.5697888", "0.54592794", "0.5174234", "0.5137397", "0.5131423", "0.5122167", "0.511841", "0.51071995", "0.5100075", "0.5094216", "0.50908756", "0.5061743", "0.50580746", "0.5043095", "0.50322914", "0.50091624", "0.49507222", "0.4939...
0.72510445
0
Plots a confusion matrix using Seaborn's heatmap().
def plot_conf_mat(y_test, y_preds): sns.set(font_scale=1.5) # Increase font size fig, ax = plt.subplots(figsize=(3, 3)) ax = sns.heatmap(confusion_matrix(y_test, y_preds), annot=True, # Annotate the boxes cbar=False) plt.xlabel("Predicted label") # prediction...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def plot_confusion_matrix(cm, classes=None, title='Confusion matrix'):\n if classes is not None:\n sns.heatmap(cm, xticklabels=classes, yticklabels=classes, vmin=0., vmax=1., annot=True)\n else:\n sns.heatmap(cm, vmin=0., vmax=1.)\n plt.title(title)\n plt.ylabel('True label')\n plt.xla...
[ "0.84595305", "0.8404798", "0.83949465", "0.8206685", "0.81137764", "0.809828", "0.8045054", "0.8013182", "0.7954737", "0.794583", "0.7920782", "0.78986645", "0.7851107", "0.78444636", "0.78387344", "0.77890563", "0.77542657", "0.77488065", "0.77433497", "0.7734367", "0.77288...
0.8383667
3
Computes the L2 norm bound of a vector after rounding (Thm. 1, Eq. 2).
def post_rounding_l2_norm_bound(x, l2_norm_bound, beta): beta = tf.cast(beta, x.dtype) dim = tf.cast(tf.size(x), x.dtype) if l2_norm_bound is None: x_norm = tf.norm(x, ord=2) else: x_norm = tf.cast(l2_norm_bound, x.dtype) # We consider 2 (scaled) norm bounds and take the min (Propositio...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def norm_l2(v):\n return np.sqrt((v**2).sum())", "def l2_norm(v):\n res = 0\n for e in v:\n res += e * e\n return math.sqrt(res)", "def l2(vec):\n return np.linalg.norm(vec)", "def two_norm(v):\n return math.sqrt(dot_product(v, v))", "def norm_L2(u):\n return norm_l2(u)/sqrt...
[ "0.7870646", "0.77247846", "0.7705849", "0.74021274", "0.7346353", "0.7112624", "0.7027149", "0.7002231", "0.69005", "0.6825025", "0.6820498", "0.67820287", "0.67647725", "0.6749962", "0.67238563", "0.6668505", "0.6658945", "0.66543186", "0.6644088", "0.661958", "0.6601495", ...
0.73359406
5
Pads a vector with shape (d,) with zeros to the next power of two.
def pad_zeros(x): dim = tf.shape(x)[0] log2_dim = tf.math.log(tf.cast(dim, tf.float32)) / tf.math.log(2.0) pad_dim = tf.pow(2, tf.cast(tf.math.ceil(log2_dim), tf.int32)) with tf.control_dependencies([tf.debugging.assert_rank(x, 1)]): return tf.pad(x, [[0, tf.maximum(0, pad_dim - dim)]])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def zero_pad(data):\n N = len(data)\n pow_2 = np.ceil(np.log2(N))\n return np.pad(data,(0,int((2**pow_2)-N)),'constant')", "def _pad_trunc_vector(self, vec1, n, val):\r\n if len(vec1) < n:\r\n vec1 = np.pad(vec1, (0, n-len(vec1)), 'constant', constant_values=val)\r\n else:\r\n ...
[ "0.63801193", "0.61805403", "0.5929952", "0.58702296", "0.586949", "0.5804458", "0.57253265", "0.57067007", "0.5633425", "0.55662155", "0.55635613", "0.55554175", "0.5510453", "0.5500605", "0.544494", "0.5421047", "0.54187894", "0.5418709", "0.54041296", "0.54020995", "0.5400...
0.5898861
3
Simple helper function that groups a list into pairs. For example, [1,2,3,4,5] would return [1,2],[3,4]
def pairs(lst): for i in range(1, len(lst), 2): yield lst[i-1], lst[i]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def list_to_pairs(l):\n return {(l[2*i], l[2*i+1]) for i in range(len(l)/2)}", "def get_pairs(my_list):\n return [(current, my_list[idx + 1] if - 1 else None) for idx, current in enumerate(my_list) if idx < len(my_list) - 1]", "def group(lst, n):\n return zip(*[lst[i::n] for i in range(n)])", "def...
[ "0.7544938", "0.7045488", "0.7019172", "0.6966148", "0.69476837", "0.680975", "0.6743494", "0.6712265", "0.6687029", "0.66334724", "0.6593827", "0.6549743", "0.65470976", "0.6513818", "0.64491403", "0.6429426", "0.63867474", "0.63702846", "0.6325235", "0.62996686", "0.6261211...
0.7495571
1
Basic test of find_max_seat_id()
def test_find_max_seat_id(): data = [ {"seat_id": 100}, {"seat_id": 101}, {"seat_id": 99}, ] assert find_max_seat_id(data) == 101
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_end_to_end_max_seat_id():\n assert process_max_seat_id(\"test/test_input.txt\") == 820", "def highest_seat_id(raw_seat_string):\n\n seat_list = raw_seat_string.split('\\n')\n\n return max(list(map(find_seat, seat_list)))", "def check_maximum_seat_number(data: list) -> int:\n max_id: int = ...
[ "0.77137196", "0.7553079", "0.75166106", "0.7501319", "0.7238762", "0.71223587", "0.6671076", "0.625585", "0.6194733", "0.61750185", "0.6145588", "0.59299815", "0.5890674", "0.5838614", "0.58339375", "0.58192277", "0.5777797", "0.5762046", "0.568597", "0.56781447", "0.5644486...
0.8820734
0
Get the data corresponding to a given indices.
def get_data_from_indices(self, data_dictionary, indices): data = {} for tag in self.data_tags: try: data[tag] = data_dictionary[tag][indices] except KeyError: print("no this key in the current data file!") return data
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_data_by_indexes(indexes: list, data: np.ndarray) -> np.ndarray:\n return np.asarray([data[i, j] for i, j in indexes])", "def get_data(features, labels_aud, labels_foc, files, indices):\n features = [features[idx] for idx in indices]\n labels_aud = [labels_aud[idx] for idx in indices]\n labels...
[ "0.7586238", "0.73127365", "0.70574576", "0.67401016", "0.6729097", "0.6729097", "0.67080015", "0.66936725", "0.6658126", "0.6643573", "0.65621924", "0.6513033", "0.6510402", "0.6452007", "0.6452007", "0.64503914", "0.64347494", "0.64340377", "0.6278575", "0.62494344", "0.623...
0.7435763
1
transforms pandas series into array of values
def transform_series(obj): vals = obj.values return transform_array(vals)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_real_series(self, data: pd.Series) -> pd.Series:\n ...", "def as_series(self, arraylike: Iterable) -> pd.Series:\n return pd.Series(arraylike, index=self.data.index)", "def to_series(self) -> pd.Series:\n df = self.to_dataframe(\"* values *\")\n dims = self.dims_list\n ...
[ "0.71704954", "0.7061575", "0.7031719", "0.69319797", "0.69065505", "0.68227774", "0.67641383", "0.67072475", "0.66763926", "0.66559494", "0.65532196", "0.6527722", "0.65187865", "0.6429818", "0.63917977", "0.6334467", "0.6334109", "0.63249093", "0.63155305", "0.6302324", "0....
0.7271901
0
Transform arrays into lists of json safe types also handles pandas series, and replacing nans and infs with strings
def transform_array(obj): # Check for astype failures (putative Numpy < 1.7) dt2001 = np.datetime64('2001') legacy_datetime64 = (dt2001.astype('int64') == dt2001.astype('datetime64[ms]').astype('int64')) ## not quite correct, truncates to ms.. if obj.dtype.kind == 'M': ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def jsonify(data):\n\n for key in data:\n if type(data[key]) == numpy.ndarray:\n data[key] = data[key].tolist()\n\n if isinstance(data[key], list):\n data[key] = [0 if isinstance(x, float) and math.isnan(x) else x for x in data[key]]\n\n return data...
[ "0.691161", "0.6357955", "0.61296874", "0.61226934", "0.6014269", "0.59589815", "0.58300644", "0.57798976", "0.573751", "0.5733376", "0.56800723", "0.5652168", "0.55829626", "0.55093217", "0.54728806", "0.54601216", "0.54508823", "0.5444295", "0.5437409", "0.5432883", "0.5417...
0.55578816
13
Generate the operator in the complete Hilbert space of the system by taking tensor products.
def generateOperator(onQubits: Union[int, List[int]], matrices: Union[numpy.ndarray, List[numpy.ndarray]], sysLevel: Union[int, List[int]], qubitNum: int) -> numpy.ndarray: # Each qubit of the system has the same energy level. if isinstance(sysLevel, int): # We first define the ide...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def tensor_product(G, H):\n GH = _init_product_graph(G, H)\n GH.add_nodes_from(_node_product(G, H))\n GH.add_edges_from(_directed_edges_cross_edges(G, H))\n if not GH.is_directed():\n GH.add_edges_from(_undirected_edges_cross_edges(G, H))\n return GH", "def product_on_basis(self, t1, t2):\n...
[ "0.63826", "0.6133825", "0.6024412", "0.6009062", "0.5969987", "0.5946628", "0.5868395", "0.57984704", "0.5777967", "0.5750121", "0.5720918", "0.564446", "0.5631822", "0.5598328", "0.55919385", "0.55734795", "0.55693686", "0.55377257", "0.55348843", "0.5529705", "0.55268717",...
0.57783306
8
Get the unitary operator corresponding to the evolution governed by the Hamiltonian.
def getUnitary(ham: Dict[str, Any]) -> numpy.ndarray: result = simulate(ham) return result["unitary"]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def current_operator(h0):\n h = h0.copy()\n h = h0.get_multicell() # multicell Hamiltonian\n if h.dimensionality != 1: raise # only for 1d\n if not h.is_multicell: # no multicell\n def fj(k):\n phik = np.exp(1j*2.*np.pi*k) # complex phase\n jk = 1j*(h.inter*phik - h.inter.H*np.conjugate(phik)) \n ...
[ "0.69397897", "0.65074074", "0.64563507", "0.6416185", "0.6388841", "0.63132447", "0.6234237", "0.62290835", "0.6201878", "0.6201878", "0.6201878", "0.61858284", "0.6143468", "0.6143468", "0.6143468", "0.6143468", "0.6143468", "0.6143468", "0.6143468", "0.6143468", "0.6143468...
0.0
-1
Transform the Hamiltonian dictionary to a string.
def toJson(ham: Dict[str, Any]) -> str: jham = copy.deepcopy(ham) clearCache(jham) maxDt = jham["circuit"]["max_time_dt"] dt = jham["circuit"]["dt"] # Check whether the waveFuncs are callable def wave2Seq(waveForm: Dict[str, Any]) -> List[float]: """ Translate callable waveform to seq...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def display_hamiltonian(H):\n terms = split_hamiltonian(H)\n\n def label(s):\n if s == 'H0':\n return r'\\hat{H}_0'\n elif s == 'Hint':\n return r'\\hat{H}_{\\text{int}}'\n else:\n try:\n prefix, ind = s.split('_')\n except Value...
[ "0.63096815", "0.60522574", "0.5930102", "0.57651013", "0.5684819", "0.5667677", "0.5636836", "0.56141305", "0.5579487", "0.5538844", "0.5538328", "0.5493518", "0.54401326", "0.5422144", "0.5412672", "0.5403245", "0.5392862", "0.53916574", "0.53879666", "0.5385236", "0.537964...
0.5326751
28
Adjust the parameters of the layer by using the optimizer
def adjust_parameters(self, mini_batch_size): pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setOptimizerParams(self,lr,momentum,decay):\n self.optimizer = SGD(lr=lr,momentum=momentum,decay=decay)", "def update_optimizer(self, context, optimizer, host):\n pass", "def adjust_learning_rate(self, optimizer, epoch, args):\n lr = args.learning_rate * (0.1 ** (epoch // 30))\n ...
[ "0.71678865", "0.7030835", "0.68808085", "0.68347955", "0.6777706", "0.67733604", "0.674914", "0.6741614", "0.673294", "0.668111", "0.6672885", "0.66728824", "0.6666251", "0.6638807", "0.6637646", "0.6636848", "0.6634975", "0.6631258", "0.6631105", "0.6631105", "0.6631105", ...
0.0
-1
Return a dictionary specifying the defaults for this form. This dictionary shall be used to inject the initial values for an Angular controller using the directive 'nginit={{thisform.get_initial_data|js|safe}}'.
def get_initial_data(self): data = {} for name, field in self.fields.items(): if hasattr(field, 'widget') and 'ng-model' in field.widget.attrs: data[name] = self.initial and self.initial.get(name) or field.initial return data
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def defaults():\n\n dummy = FieldTemplate.dummy\n\n return {\"disease_demographic_id\": dummy(\"demographic_id\"),\n }", "def your_reservation_defaults(self, defaults):\n\n default_email = self.email()\n if default_email:\n defaults['email'] = self.email()\n\...
[ "0.70314217", "0.7019184", "0.69623965", "0.6813803", "0.67751884", "0.67474955", "0.663069", "0.6547036", "0.64795905", "0.6336114", "0.63260394", "0.6297748", "0.62811136", "0.6272118", "0.626164", "0.6257755", "0.6234373", "0.6230987", "0.6228861", "0.6204141", "0.61935157...
0.715202
0
Used when angular's query() method is called Build an array of all objects, return json response
def ng_query(self, request, *args, **kwargs): return self.build_json_response(self.get_queryset())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_all_data():\n return jsonify(service.get_all_data())", "def get_all_products(self):\n try: \n data = [ProductService.self_json(product) \n for product in self.productModel.query.all()] \n \n return Response(\n response=json.d...
[ "0.6735071", "0.66806215", "0.6582834", "0.6573205", "0.65703523", "0.65511554", "0.6521539", "0.64924604", "0.64832145", "0.6463034", "0.64612055", "0.6439454", "0.64274085", "0.6410017", "0.6385594", "0.6356347", "0.63551503", "0.63498086", "0.6339762", "0.6311569", "0.6296...
0.77316815
0
Evaluate the log density at th th is a numpy array of shape (d,) or (n_samples, d)
def log_prob(self, th): mask = self.__low <= th <= self.__high if len(th.shape) == 1: length = 1 elif len(th.shape) == 2: length = th.shape[0] else: raise RuntimeError("th must be either (d,) or (n_samples, d)") logprobs = np.empty(length) logprobs[mask] = 0. logprobs[~mask] = -float('inf') re...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def log_predictive_density(self, y_test, mu_star, var_star):\r\n raise NotImplementedError", "def log_predictive_density(self, x_test, y_test):\r\n mu_star, var_star = self._raw_predict(x_test)\r\n return self.likelihood.log_predictive_density(y_test, mu_star, var_star)", "def log_normal_d...
[ "0.6885609", "0.6806024", "0.6674962", "0.6660521", "0.6604686", "0.6587067", "0.6571452", "0.65640014", "0.6537668", "0.64906", "0.6487277", "0.6470818", "0.6467356", "0.6417878", "0.6353183", "0.6353183", "0.63112515", "0.6305143", "0.6305143", "0.62966925", "0.62405676", ...
0.59863806
47
returns a humanfriendly representation of a file size.
def formatSize(val, sf=1): if val<1e3: return "%d Bytes"%int(val) elif val<1e6: return "%.*fkiB"%(sf, val/1024.) elif val<1e9: return "%.*fMiB"%(sf, val/1024./1024.) else: return "%.*fGiB"%(sf, val/1024./1024./1024)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def format(self,size):\n if self.__units is None:\n # Human-readable\n return bcf_utils.format_file_size(size)\n elif self.__units == 'bytes':\n # Raw bytes\n return size\n else:\n return bcf_utils.format_file_size(size,units=self.__units)...
[ "0.8058449", "0.80552155", "0.804821", "0.7806828", "0.7783957", "0.77127343", "0.771252", "0.75167257", "0.7506917", "0.74860644", "0.7473085", "0.74531823", "0.74407184", "0.73682183", "0.73258245", "0.7252712", "0.7244792", "0.7216793", "0.7213372", "0.7186753", "0.7148769...
0.6962758
35
returns a UTC datetime object in the format requried by http. This may crap when you fuzz with the locale. In general, when handling "real" times within the DC, prefer unix timestamps over datetimes and use the other RFC2616 functions.
def datetimeToRFC2616(dt): return dt.strftime('%a, %d %b %Y %H:%M:%S GMT')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def http_date(epoch_seconds=None):\n return formatdate(epoch_seconds, usegmt=True)", "def human_to_utc_datetime(x):\n\n return parsedatetime.Calendar().parseDT(datetimeString=x,\n sourceTime=datetime.utcnow(),\n tzinfo=ti...
[ "0.6338576", "0.6329292", "0.6308086", "0.6242978", "0.62164724", "0.6139425", "0.6133208", "0.6133208", "0.6126177", "0.6095178", "0.6017702", "0.6012535", "0.5992282", "0.5921262", "0.5918444", "0.58962435", "0.58649343", "0.58569807", "0.58372575", "0.5803685", "0.5803685"...
0.6159236
5
returns seconds since unix epoch representing UTC from the HTTPcompatible time specification s.
def parseRFC2616Date(s): parts = emailutils.parsedate_tz(s) return emailutils.mktime_tz(parts)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _current_epoch_secs():\n now = datetime.datetime.utcnow()\n epoch = datetime.datetime(1970, 1, 1)\n return (now - epoch).total_seconds()", "def parse_time(s):\n\n dt = dateutil.parser.parse(s)\n# epoch_time = int((dt - datetime(1970, 1, 1, tzinfo=timezone.utc)).total_seconds())\n epoch_time = int...
[ "0.72132", "0.7173617", "0.69503516", "0.6915451", "0.6843297", "0.6758395", "0.66292876", "0.6612739", "0.6607527", "0.65920275", "0.65612143", "0.65402836", "0.65402836", "0.6498623", "0.6465838", "0.64443916", "0.6438595", "0.6376012", "0.6367665", "0.635215", "0.6338115",...
0.0
-1
returns an RFC2616 date string for UTC seconds since unix epoch.
def formatRFC2616Date(secs=None): if secs is None: secs = time.time() return emailutils.formatdate(secs, localtime=False, usegmt=True)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def http_date(epoch_seconds=None):\n return formatdate(epoch_seconds, usegmt=True)", "def epoch2UTCstr(timestamp=time(), fmat=\"%Y-%m-%d %H:%M:%S\"):\n return strftime(fmat, gmtime(timestamp))", "def rfc3999(date):\n if not date: return ''\n date = date + datetime.timedelta(seconds = -time.timezone...
[ "0.70827997", "0.68862337", "0.6663131", "0.6659183", "0.6577747", "0.64988923", "0.637579", "0.6354921", "0.63463706", "0.62043566", "0.6177568", "0.61761963", "0.61582744", "0.6157967", "0.61409354", "0.6135716", "0.61010104", "0.6094307", "0.60888696", "0.60529083", "0.603...
0.7186623
0
returns some ISO8601 representation of a datetime instance. The reason for preferring this function over a simple str is that datetime's default representation is too difficult for some other code (e.g., itself); hence, this code suppresses any microsecond part and always adds a Z (where strftime works, utils.isoTimest...
def formatISODT(dt): if dt is None: return None return dt.replace(microsecond=0, tzinfo=None).isoformat()+"Z"
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def datetime_to_isoformat(obj: datetime.datetime) -> str:\n return obj.replace(tzinfo=datetime.timezone.utc).isoformat().replace(\"+00:00\", \"Z\")", "def to_iso_datetime(value: Union[datetime.datetime, datetime.time]) -> str:\n retval = value.isoformat()\n if value.tzinfo is None:\n retval += 'Z...
[ "0.7416491", "0.72285634", "0.7103629", "0.7078754", "0.7071707", "0.70313394", "0.69976014", "0.6958733", "0.6911778", "0.6786292", "0.6687942", "0.6662748", "0.66269565", "0.66113424", "0.65770954", "0.6558364", "0.6536537", "0.6460257", "0.645084", "0.64418143", "0.6441345...
0.7679552
0
returns s with exactly one trailing slash.
def ensureOneSlash(s): return s.rstrip("/")+"/"
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def noTrailingSlash(path):\n return path.split('/')[0]", "def ends_slash(url):\n return url if url.endswith(\"/\") else url + \"/\"", "def remove_trailing_slash(path):\n if len(path) > 0:\n if path[len(path) - 1] == \"/\":\n return path[0:-1]\n else:\n return pa...
[ "0.74095285", "0.7214548", "0.7014402", "0.6937832", "0.67677695", "0.67522174", "0.6741746", "0.66087866", "0.64388007", "0.6331296", "0.62603635", "0.6188933", "0.61769015", "0.6120291", "0.6117025", "0.6114627", "0.60587126", "0.6023046", "0.60170954", "0.6016922", "0.5998...
0.8243863
0
returns a random string of harmless printable characters.
def getRandomString(length): return "".join( random.choice(_RANDOM_STRING_OK_CHARS) for c in range(length))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rand_string():\n out = ''\n for _ in range(24):\n out += choice(ascii_letters)\n return out", "def generate_random_string():\n return \"\".join(random.choice(string.ascii_lowercase + string.digits) for _ in range(16)) # nosec", "def create_random_string(total_character):\n feed=strin...
[ "0.74269366", "0.7230842", "0.7166727", "0.71631926", "0.7130199", "0.7080146", "0.70368505", "0.70176977", "0.6992308", "0.6985256", "0.6973733", "0.69231623", "0.68380547", "0.6823979", "0.680392", "0.67901033", "0.67643464", "0.67517096", "0.67489433", "0.6740124", "0.6738...
0.6437645
57
Method should return a standardisation matrix of the vector
def getStandardisation(): global standardisation return standardisation
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def calculateStandardisation(vector):\r\n global standardisation\r\n # from http://sebastianraschka.com/Articles/2014_about_feature_scaling.htm\r\n std_scale = preprocessing.StandardScaler().fit(vector)\r\n standardisation = std_scale.transform(vector)", "def standardise(self):\n if self.vecto...
[ "0.72598976", "0.65828854", "0.65278476", "0.6473063", "0.6401042", "0.629671", "0.6273627", "0.6264433", "0.61407506", "0.60999334", "0.6048403", "0.60418576", "0.60410947", "0.6029571", "0.6023645", "0.60013324", "0.59972024", "0.5983273", "0.59739894", "0.59585786", "0.595...
0.0
-1