query
stringlengths
9
9.05k
document
stringlengths
10
222k
metadata
dict
negatives
listlengths
30
30
negative_scores
listlengths
30
30
document_score
stringlengths
4
10
document_rank
stringclasses
2 values
samples a set of unique integers with length size from the interval \[0,max\]
def unique_sample_of_int(max,size): idxs=set() num_left = size - len(idxs) while num_left > 0: idxs = idxs.union(set(np.random.random_integers(0,max,size=num_left))) num_left = size - len(idxs) return idxs
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generate_testdata(N: int, min_value: int, max_value: int) -> list:\r\n numbers = set([])\r\n while len(numbers) < N:\r\n random = randint(min_value, max_value)\r\n numbers.add(random)\r\n return list(numbers)", "def choose_m_n(li,min,max):\n n_items = random.randrange(min,max+1)\n ...
[ "0.7025099", "0.6946078", "0.6803426", "0.6712467", "0.6691708", "0.65714836", "0.6532559", "0.6503982", "0.64042825", "0.6374597", "0.6359894", "0.63190323", "0.6311178", "0.62729216", "0.62661505", "0.6262865", "0.6239398", "0.62374264", "0.621685", "0.62101054", "0.6199613...
0.8324977
0
returns set of all geneIDs linked to the SNPs of sig_snp in snp_dict
def get_sig_gene_set(snp_dict,sig_snp): geneIDs=[] for chrom in sig_snp.keys(): for bps in sig_snp[chrom]['bps']: idx = snp_dict[chrom]['bps'].searchsorted(bps) if (idx < len(snp_dict[chrom]['bps'])) and snp_dict[chrom]['bps'][idx] == bps and snp_dict[chrom]['genes'][idx]: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_genesets(snp_dict,gene_file):\n inf = open(gene_file,\"r\")\n for i in snp_dict.keys():\n snp_dict[i]['genes']=np.empty(len(snp_dict[i]['bps']), dtype=set)\n for line in inf:\n if re.match(\"\\#\",line):\n continue\n line.rstrip()\n fields=line.split()\n ...
[ "0.6257982", "0.6162774", "0.59048253", "0.59010804", "0.5849605", "0.56463474", "0.54594696", "0.54492325", "0.5428095", "0.5416582", "0.5408381", "0.5408381", "0.53714514", "0.53380275", "0.5297365", "0.5293599", "0.527684", "0.5273915", "0.5239893", "0.5224164", "0.5209268...
0.8354356
0
Gets the mapSquare object at x,y
def get_square(self, x, y): if x < 0 or x > self.width-1 or y < 0 or y > self.height-1: return MapSquare(x, y, Tile.Wall, '~') # return a wall if at end of map return self.mapArray[y][x]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getSquare(x, y):\n\n\tglobal theMap, width, height\n\n\treturn theMap[x + y * width]", "def get_map_square(x, y):\n result = MAP_SQUARE_ROCK\n if ((x >=0 and x< width) and (y>= 0 and y< height)): # LT i think done TODO: Replace False with a condition that checks if the values x and y are valid. Valid ...
[ "0.8520868", "0.7586103", "0.685801", "0.68072706", "0.66959095", "0.6570747", "0.65456736", "0.6534609", "0.65282583", "0.65212566", "0.6491779", "0.64886266", "0.64586496", "0.6385448", "0.6362551", "0.63256884", "0.63170105", "0.6296599", "0.6267629", "0.6230384", "0.62274...
0.81357706
1
Gets the display object at a square, for use by Viewport class
def get_display_object(self, x, y): if x < 0 or x >= self.width: return DisplayObject.StaticObject(chr(0b11110111)) if y < 0 or y >= self.height: return DisplayObject.StaticObject(chr(0b11110111)) return self.mapArray[y][x].get_display_object()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_display_object(self):\n if len(self.objects) == 0:\n return self.tile.get_display_object()\n else:\n return self.objects[-1].get_display_object()", "def get_square(self, x, y):\n if x < 0 or x > self.width-1 or y < 0 or y > self.height-1:\n return Map...
[ "0.6762274", "0.6488981", "0.6479352", "0.638152", "0.62307405", "0.6205239", "0.61711794", "0.61711794", "0.611314", "0.6035994", "0.5998655", "0.59058344", "0.58368677", "0.58368266", "0.58320564", "0.58320564", "0.58320564", "0.58304864", "0.5829658", "0.5827257", "0.58223...
0.7273723
0
Gets the appropriate object for rendering on a Display. Will be the tile if there are no objects in the square. Otherwise, will be the topmost object.
def get_display_object(self): if len(self.objects) == 0: return self.tile.get_display_object() else: return self.objects[-1].get_display_object()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_display_object(self, x, y):\n if x < 0 or x >= self.width:\n return DisplayObject.StaticObject(chr(0b11110111))\n if y < 0 or y >= self.height:\n return DisplayObject.StaticObject(chr(0b11110111))\n return self.mapArray[y][x].get_display_object()", "def getone(s...
[ "0.7496521", "0.6938144", "0.6659613", "0.6383434", "0.63334805", "0.6095585", "0.60727197", "0.60512614", "0.6021134", "0.6013403", "0.59988815", "0.596359", "0.5947265", "0.59074265", "0.5899318", "0.58803385", "0.5866117", "0.58558357", "0.58558357", "0.58558357", "0.58542...
0.8527499
0
Transform string of form '2020W10' into tuple (2020, 10)
def get_yearweek(yearweekstr: str) -> tuple: return tuple(map(int, yearweekstr.split('-W')))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def split_date_string(date_string: str):\n try:\n units,_,epoch = date_string.split(None, 2)\n except ValueError:\n raise ValueError(f'Invalid format: {date_string}')\n else:\n return (units.lower(), parse(epoch))", "def split_date_string(date_string: str):\n try:\n units,...
[ "0.5761229", "0.5761229", "0.56280375", "0.5603652", "0.55228376", "0.5497433", "0.5434086", "0.54046214", "0.5305967", "0.5301249", "0.5266323", "0.52434844", "0.5174696", "0.5173403", "0.5165354", "0.51584536", "0.5139238", "0.51305723", "0.5117815", "0.5103784", "0.5088147...
0.76194024
0
Get the week number from ISO formatted string
def get_week_from_datestr(datestr: str) -> int: return date.fromisoformat(datestr).isocalendar()[1]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def findWeekend(str):\n return int(re.search(\"(?<=wknd=)\\d*\", str)[0])", "def ISOWEEKNUM(date):\n return _make_datetime(date).isocalendar()[1]", "def get_weekday_number(date):\n return date.strftime('%w')", "def GetWeekNum(self, date):\n (y, m, d) = date.split('-')\n return (dt.date(int(y), i...
[ "0.7321482", "0.7087024", "0.69715667", "0.68040544", "0.6613867", "0.6562995", "0.6536886", "0.6459331", "0.63348484", "0.61817926", "0.61559933", "0.61237025", "0.61049557", "0.6078325", "0.60460734", "0.6043959", "0.6013798", "0.60136014", "0.5982375", "0.5924236", "0.5898...
0.77668357
0
Function that normalises the admission to be per 100k of the population of that country.
def normalize_admission_val(get_population: Callable, row: pd.Series) -> float: val = row['value'] # Note that in the provided admission dataframe, only the daily data is given in absolute value if row['indicator'] in (ADMISSION_INDICATORS['weekly_norm'], ADMISSION_INDICATORS['weekly_icu']): return...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def improve_population(self):\r\n for index in range(len(self.district_population)):\r\n district = self.district_population[index]\r\n districtsolution = hillclimber.HillClimber(district, self.cable_cost, self.battery_cost)\r\n self.district_population[index] = districtsolu...
[ "0.5837532", "0.56250906", "0.55420405", "0.5459075", "0.53852814", "0.5379061", "0.5376545", "0.5342104", "0.5329432", "0.53068197", "0.5255592", "0.5225455", "0.5216194", "0.5173729", "0.5161948", "0.51232946", "0.5116454", "0.51086277", "0.5097741", "0.50803447", "0.508034...
0.66003275
0
Function that process the admission dataset, returning normalised weekly admission number for both normal and icu The weekly data is found by either 1. summing daily_norm, normalised by the population, of the same week 2. using the weekly norm
def process_admission(admission_df: pd.DataFrame): get_population = Populations() # Populations() is set up as a closure, enabling O(1) lookup admission_df['year_week'] = admission_df['year_week'].apply(get_yearweek) # change week string into tuple of ints admission_df['value'] = admission_df.apply(parti...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def normalize_admission_val(get_population: Callable, row: pd.Series) -> float:\n val = row['value']\n\n # Note that in the provided admission dataframe, only the daily data is given in absolute value\n if row['indicator'] in (ADMISSION_INDICATORS['weekly_norm'], ADMISSION_INDICATORS['weekly_icu']):\n ...
[ "0.57838684", "0.5630602", "0.53852296", "0.5338406", "0.5294488", "0.5282174", "0.5200791", "0.51800346", "0.5177649", "0.5170467", "0.5109907", "0.51097554", "0.5109729", "0.51078874", "0.51069164", "0.5098266", "0.5095416", "0.5071187", "0.50578314", "0.5039682", "0.500486...
0.635556
0
Saves our custom form fields in the event.
def _save_extra_fields(self, event): term = self.cleaned_data["term_name"] week = self.cleaned_data["term_week"] day = self.cleaned_data["day_of_week"] year = int(settings.DEFAULT_ACADEMIC_YEAR) date = datetimes.termweek_to_date(year, term, week, day) start_hou...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def on_post(self):\n return \"Ok, the stuff is being saved\"", "def post_save(self, request, instance, instance_data, created): # NOQA: C901\n # import wdb; wdb.set_trace()\n if \"appendix_table\" in instance_data:\n for data in instance_data[\"appendix_table\"]:\n ...
[ "0.6323458", "0.6105032", "0.60823196", "0.6060079", "0.59963053", "0.59963053", "0.59963053", "0.59842247", "0.5925766", "0.59208643", "0.592074", "0.59128934", "0.5910204", "0.5910204", "0.58927155", "0.58364564", "0.5804914", "0.57820785", "0.57811224", "0.57811224", "0.57...
0.705376
0
Return datetime.datetime instance from any filename as tryydoyhhmmss.hld.root.root or styydoyhhmmss.hld.root.root
def date_from_filename(filename: str) -> datetime.datetime: if not filename.startswith(("st", "tr")) or not filename.endswith(".hld.root.root"): raise Exception("Filename must be like tryydoyhhmmss.hld.root.root " "or styydoyhhmmss.hld.root.root") yy = int(f"20{filename[2:4]}")...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def extract_datetime(filename) -> datetime:\n date_part = filename[-26:-7]\n return datetime.strptime(date_part, '%Y-%m-%d_%H-%M-%S')", "def extract_datetime(fpath):\n try:\n handle = open(fpath, 'rb')\n if hexlify(handle.read(2)) != hexlify(u'MZ'):\n handle.close()\n ...
[ "0.7622054", "0.7068473", "0.7055876", "0.7017632", "0.7011796", "0.6778424", "0.65450853", "0.6536547", "0.6466029", "0.64422166", "0.6317801", "0.62757915", "0.61950606", "0.615876", "0.61342496", "0.6119123", "0.6091253", "0.60516626", "0.60343385", "0.6009402", "0.5997254...
0.7839974
0
Sets the created_by_id of this BigqueryConnection.
def created_by_id(self, created_by_id): self._created_by_id = created_by_id
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def created_by_id(self, created_by_id):\n self._created_by_id = created_by_id", "def created_by(self, created_by):\n\n self._created_by = created_by", "def created_by(self, created_by):\n\n self._created_by = created_by", "def created_by(self, created_by):\n\n self._created_by = c...
[ "0.7827399", "0.7238225", "0.7238225", "0.7238225", "0.7238225", "0.7238225", "0.7238225", "0.6770423", "0.6478218", "0.6478218", "0.6478218", "0.6478218", "0.61777014", "0.6108819", "0.58232164", "0.5540735", "0.5509084", "0.5416939", "0.5345631", "0.52725977", "0.52501637",...
0.78331757
0
Sets the type of this BigqueryConnection.
def type(self, type): allowed_values = ["postgres", "redshift", "snowflake", "bigquery"] # noqa: E501 if type not in allowed_values: raise ValueError( "Invalid value for `type` ({0}), must be one of {1}" # noqa: E501 .format(type, allowed_values) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setDataSetType(self, type):\n self.__data_set_type__ = type", "def set_type(self, type):\n self.type = type", "def set_type(self, type):\n self.type = type", "def set_type(self, type):\n self._type = type", "def type(self, type: str):\n\n self._type = type", "def ty...
[ "0.66367114", "0.6553918", "0.6553918", "0.6532762", "0.6192238", "0.6190833", "0.6190833", "0.6190833", "0.6190833", "0.6190833", "0.6190833", "0.6190833", "0.6190833", "0.6190833", "0.6190833", "0.6190833", "0.6190833", "0.6190833", "0.6190833", "0.6190833", "0.6190833", ...
0.7026672
0
Sets the timeout_seconds of this BigqueryConnection.
def timeout_seconds(self, timeout_seconds): self._timeout_seconds = timeout_seconds
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_timeout(self, seconds):\n self._timeout = seconds", "def set_timeout(self, timeout_secs):\n self._timeout_secs = timeout_secs", "def set_timeout(self, timeout: float) -> None:\n self._timeout = timeout", "def set_timeout(timeout):\n\n if timeout is None:\n raise Typ...
[ "0.7122399", "0.69995874", "0.68101287", "0.67899984", "0.66791314", "0.66160035", "0.65482914", "0.63968164", "0.6396411", "0.63825697", "0.6294084", "0.6264204", "0.62599796", "0.6172657", "0.6167423", "0.6155155", "0.6151825", "0.61297095", "0.6107146", "0.61068237", "0.61...
0.76349115
1
Sets the private_key_id of this BigqueryConnection.
def private_key_id(self, private_key_id): self._private_key_id = private_key_id
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def private_key(self, private_key):\n\n self._private_key = private_key", "def set_key_id(self, key_id=''):\n self.key_id = key_id", "def key_id(self, key_id):\n\n self._key_id = key_id", "def vscr_ratchet_group_session_set_private_key(self, ctx, my_private_key):\n vscr_ratchet_gr...
[ "0.7320087", "0.6217251", "0.60491544", "0.5960115", "0.57581747", "0.5692094", "0.5617272", "0.5451287", "0.5451287", "0.54292107", "0.52818465", "0.522966", "0.522202", "0.5207448", "0.51840496", "0.5178242", "0.5171025", "0.5107503", "0.5091602", "0.5078473", "0.5045052", ...
0.78219444
0
Sets the private_key of this BigqueryConnection.
def private_key(self, private_key): self._private_key = private_key
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def private_key_id(self, private_key_id):\n\n self._private_key_id = private_key_id", "def __init__(self, private_key):\n self._sk = ed25519.Ed25519PrivateKey.from_private_bytes(private_key.bytes)", "def setPrivate(self, private):\n\n self.private = private", "def private(self, private):...
[ "0.7102385", "0.6089998", "0.6048516", "0.5918505", "0.5918505", "0.59148234", "0.58247757", "0.5821729", "0.5623071", "0.561844", "0.55904317", "0.54883444", "0.5413316", "0.5371647", "0.5363073", "0.5352474", "0.53235835", "0.52944875", "0.5232665", "0.5206534", "0.5205057"...
0.7588765
0
Sets the client_email of this BigqueryConnection.
def client_email(self, client_email): self._client_email = client_email
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def email(self, email):\n if self.local_vars_configuration.client_side_validation and email is None: # noqa: E501\n raise ValueError(\"Invalid value for `email`, must not be `None`\") # noqa: E501\n\n self._email = email", "def setEmail(self, email):\n self.email = email\n ...
[ "0.630568", "0.6241642", "0.6155655", "0.6155655", "0.6155655", "0.6155655", "0.6155655", "0.6155655", "0.6155655", "0.6155655", "0.6155655", "0.6155655", "0.6093457", "0.60278374", "0.6026907", "0.6026907", "0.6026907", "0.6026907", "0.58056325", "0.57187164", "0.5657896", ...
0.805182
0
Sets the client_id of this BigqueryConnection.
def client_id(self, client_id): self._client_id = client_id
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def client_id(self, client_id):\n if client_id is None:\n raise ValueError(\"Invalid value for `client_id`, must not be `None`\") # noqa: E501\n\n self._client_id = client_id", "def client_id(self, client_id):\n if client_id is None:\n raise ValueError(\"Invalid value ...
[ "0.7170458", "0.7170458", "0.6344065", "0.61503285", "0.6066484", "0.6047273", "0.6016593", "0.599482", "0.597772", "0.5858523", "0.5840003", "0.58148485", "0.57910585", "0.57744676", "0.5738312", "0.56799054", "0.56576747", "0.5600492", "0.55908877", "0.5560438", "0.551247",...
0.77427274
0
Sets the auth_uri of this BigqueryConnection.
def auth_uri(self, auth_uri): self._auth_uri = auth_uri
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_uri(self, uri):\n self.__uri = uri", "def __init__(self, auth, base_url=ANACODE_API_URL):\n self.auth = auth\n self.base_url = base_url", "def set_uri(self, uri):\r\n self.uri = uri", "def authentication_endpoint(self, authentication_endpoint):\n\n self._authenticat...
[ "0.54572105", "0.53156954", "0.5259753", "0.5188325", "0.5149119", "0.5088627", "0.5087125", "0.5057519", "0.5033262", "0.5033262", "0.50223464", "0.50223464", "0.4960993", "0.49558327", "0.4926186", "0.49088418", "0.49088418", "0.489337", "0.48925218", "0.48908177", "0.48800...
0.73561597
0
Sets the token_uri of this BigqueryConnection.
def token_uri(self, token_uri): self._token_uri = token_uri
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def access_token_url(self, access_token_url):\n\n self._access_token_url = access_token_url", "def auth_token_provider_endpoint(self, auth_token_provider_endpoint):\n\n self._auth_token_provider_endpoint = auth_token_provider_endpoint", "def auth_uri(self, auth_uri):\n\n self._auth_uri = a...
[ "0.60428053", "0.57762086", "0.56720537", "0.5606755", "0.5600332", "0.55200356", "0.5468206", "0.54573166", "0.54573166", "0.5306066", "0.5302382", "0.5284382", "0.52734005", "0.52444065", "0.5219296", "0.51599866", "0.5157792", "0.5157434", "0.5098574", "0.5070664", "0.5063...
0.73389703
0
Sets the auth_provider_x509_cert_url of this BigqueryConnection.
def auth_provider_x509_cert_url(self, auth_provider_x509_cert_url): self._auth_provider_x509_cert_url = auth_provider_x509_cert_url
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def client_x509_cert_url(self, client_x509_cert_url):\n\n self._client_x509_cert_url = client_x509_cert_url", "def set_ssl_context(self, ssl_verify, ssl_cafile):\n if not ssl_verify:\n self.ssl_context = ssl.create_default_context()\n self.ssl_context.check_hostname = False\n ...
[ "0.6002955", "0.52392286", "0.5176855", "0.49263972", "0.4875974", "0.48706037", "0.48231563", "0.47724578", "0.47715896", "0.47594145", "0.4745421", "0.47402442", "0.47371715", "0.47316852", "0.47306815", "0.47133183", "0.469183", "0.4654107", "0.46396813", "0.45899627", "0....
0.8237836
0
Sets the client_x509_cert_url of this BigqueryConnection.
def client_x509_cert_url(self, client_x509_cert_url): self._client_x509_cert_url = client_x509_cert_url
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def client_cert(self, client_cert):\n\n self._client_cert = client_cert", "def auth_provider_x509_cert_url(self, auth_provider_x509_cert_url):\n\n self._auth_provider_x509_cert_url = auth_provider_x509_cert_url", "def org_apache_felix_https_clientcertificate(self, org_apache_felix_https_clientcer...
[ "0.67225325", "0.63417757", "0.6191684", "0.6082272", "0.5772625", "0.5432383", "0.53903365", "0.52588344", "0.5203637", "0.5203637", "0.5203637", "0.5203637", "0.51629514", "0.51223", "0.51223", "0.5081893", "0.5026269", "0.501235", "0.50076276", "0.4981881", "0.49137843", ...
0.8200095
0
Select all Mip objects & print.
def select_all_mip_objects(): for mip in Mip.objects.all(): print mip
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def printall():\n print listAll()", "def uglyprint(self):\n\n ctmp = self.conn.cursor()\n ctmp.execute(\"SELECT * FROM ATOM\")\n print(ctmp.fetchall())", "def printAllPion(self):\n idx = 0\n for pion in self.arrayPion:\n print(\"ID = \", idx, end=\" --> \")\n ...
[ "0.64728993", "0.57332945", "0.5684565", "0.5627472", "0.5613597", "0.55839", "0.5563493", "0.55597293", "0.55313796", "0.5501408", "0.5500758", "0.5500569", "0.5489608", "0.54356", "0.54109913", "0.5383435", "0.53405464", "0.53245205", "0.5307608", "0.53062916", "0.53043556"...
0.7677657
0
Select all Mip objects located on specific reference sequence.
def select_mips_from_reference_seq(reference_name): for mip in Mip.objects.filter(reference_id=reference_name): print mip
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def select_all_mip_objects():\n\n for mip in Mip.objects.all():\n print mip", "def _query_sequence_sources(self):\n pass", "def selectRefs(*args):\n sel = cmds.textScrollList(widgets[\"shotAssListTSL\"], q=True, si=True)\n roots = []\n nodes = []\n if sel:\n for s in sel:\n ...
[ "0.6281258", "0.57194257", "0.5556252", "0.5519967", "0.51685905", "0.5045356", "0.5012468", "0.48961517", "0.48957306", "0.4891946", "0.4857247", "0.48408654", "0.47919556", "0.47807539", "0.4718705", "0.46947885", "0.46761888", "0.464906", "0.46303573", "0.46256158", "0.462...
0.76783764
0
Select and print all Mip objects for specific sample_id.
def select_mips_for_sample(sample_id): for sam in Samples.objects.filter(sample_fk_id=sample_id): print sam.mip_fk_id
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def select_all_mip_objects():\n\n for mip in Mip.objects.all():\n print mip", "def get_sample_by_id():\n sample_id = demisto.getArg('id')\n r = req('GET', SUB_API + 'samples/' + sample_id)\n sample = sample_to_readable(r.json().get('data'))\n md = tableToMarkdown('ThreatGrid - Sample', [sam...
[ "0.6150542", "0.56571805", "0.5590531", "0.54004705", "0.5333475", "0.53170794", "0.5293591", "0.5280334", "0.5169264", "0.5124405", "0.5093849", "0.5081533", "0.50650054", "0.5033113", "0.50301886", "0.4978106", "0.49227232", "0.48732486", "0.48366436", "0.48184904", "0.4813...
0.69826764
0
Returns the ith score, counting from 1.
def getScore(self, i): return self.scores[i - 1]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def score(self, n):\r\n \r\n if self.scores:\r\n return self.scores[n]\r\n else:\r\n return None", "def __get_score(self):\n for pair in zip(self.nu[self.nu_idx:], self.sw[self.sw_idx:]):\n if pair[0] == pair[1]:\n self.score += 1\n ...
[ "0.6945054", "0.6740462", "0.65219384", "0.64139384", "0.6372708", "0.6367158", "0.6245017", "0.6234426", "0.62299573", "0.6182613", "0.61144584", "0.60755754", "0.60625494", "0.602287", "0.6008089", "0.59876007", "0.5977155", "0.593884", "0.5938777", "0.59238005", "0.5923437...
0.7393736
0
Returns the average score.
def getAverage(self): return sum(self.scores) / len(self.scores)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_average(self) -> float:\n return sum(self._scores) / len(self._scores)", "def get_mean_score(rating_scores):\n return sum(rating_scores) / len(rating_scores)", "def get_avg_score(game_id):\r\n\r\n scores = []\r\n game = Game.query.get(game_id)\r\n for rating in game.ratings:\r\n ...
[ "0.83748543", "0.82793206", "0.79504865", "0.79358387", "0.7766926", "0.76965094", "0.7663437", "0.7629189", "0.75364333", "0.7511791", "0.7506461", "0.750374", "0.745132", "0.744752", "0.7421295", "0.7383909", "0.73567045", "0.7320738", "0.73039734", "0.72678035", "0.7239264...
0.85833955
0
Returns the highest score.
def getHighScore(self): return max(self.scores)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def max_score(self):\n return max(self._extract_set('score') or [0])", "def max_score(self):\r\n return self.lcp.get_max_score()", "def getNextHighest(self):\r\n maxScore = -1\r\n idx = -1\r\n for i, s in enumerate(self.scores):\r\n if s.score > maxScore:\r\n ...
[ "0.8818188", "0.84807724", "0.835259", "0.8324772", "0.82806855", "0.81326896", "0.80440915", "0.79591155", "0.7943476", "0.7934118", "0.785137", "0.7810449", "0.7779032", "0.76996386", "0.7575776", "0.7553467", "0.7516782", "0.74972826", "0.74240077", "0.74194306", "0.741132...
0.8535671
1
Tweaks the continuum by randomly removing units ("false negatives"). Every unit (for each annotator) have a probability equal to the magnitude of being removed. If this probability is one, a single random unit (for each annotator) will be left alone.
def false_neg_shuffle(self, continuum: Continuum) -> None: for annotator in continuum.annotators: security = np.random.choice(continuum._annotations[annotator]) # security : if an annotator doesnt have any annotations gamma cant be computed. for unit in list(continuum[annotat...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def false_pos_shuffle(self, continuum: Continuum) -> None:\n ref_units = self._reference_continuum[self._reference_annotator]\n avg_dur = np.average([unit.segment.end - unit.segment.start for unit in ref_units])\n var_dur = np.std([unit.segment.end - unit.segment.start for unit in ref_units])\...
[ "0.636054", "0.59033686", "0.584821", "0.5758323", "0.56914926", "0.5662757", "0.56101835", "0.56001", "0.54565287", "0.5447088", "0.53587425", "0.5317047", "0.5300742", "0.5276981", "0.52715397", "0.5239773", "0.52153003", "0.52076566", "0.51970094", "0.51903534", "0.517286"...
0.74843484
0
Tweaks the continuum by randomly adding "false positive" units. The number of added units per annotator is constant & proportionnal to the magnitude of the CST. The chosen category is random and depends on the probability of occurence of the category in the reference. The length of the segment is random (normal distrib...
def false_pos_shuffle(self, continuum: Continuum) -> None: ref_units = self._reference_continuum[self._reference_annotator] avg_dur = np.average([unit.segment.end - unit.segment.start for unit in ref_units]) var_dur = np.std([unit.segment.end - unit.segment.start for unit in ref_units]) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def false_neg_shuffle(self, continuum: Continuum) -> None:\n for annotator in continuum.annotators:\n security = np.random.choice(continuum._annotations[annotator])\n # security : if an annotator doesnt have any annotations gamma cant be computed.\n for unit in list(continuu...
[ "0.5862996", "0.5669793", "0.5645949", "0.54679686", "0.54564303", "0.53577137", "0.52172846", "0.520848", "0.51407593", "0.5131064", "0.5100705", "0.5077602", "0.506642", "0.50296015", "0.5014514", "0.5014449", "0.4957839", "0.49536094", "0.49509683", "0.49455702", "0.493904...
0.60997105
0
Shuffles the categories of the annotations in the given continuum using the process described in
def category_shuffle(self, continuum: Continuum, overlapping_fun: Callable[[str, str], float] = None, prevalence: bool = False): category_weights = self._reference_continuum.category_weights # matrix "A" nb_categories = len(category_weights) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def splits_shuffle(self, continuum: Continuum):\n for _ in range(int(self.magnitude *\n self.SPLIT_FACTOR *\n self._reference_continuum.avg_num_annotations_per_annotator)):\n for annotator in continuum.annotators:\n units = contin...
[ "0.66190857", "0.60596675", "0.5748635", "0.5743178", "0.56422764", "0.54873806", "0.5344997", "0.5321224", "0.51596314", "0.5148415", "0.5089022", "0.5050082", "0.5033594", "0.50281596", "0.5023817", "0.500936", "0.49773428", "0.49739432", "0.4970692", "0.49623668", "0.49614...
0.6433183
1
Tweak the continuum by randomly splitting segments. Number of splits per annotator is constant & proportionnal to the magnitude of the CST and the number of units in the reference. A splitted segment can be resplitted.
def splits_shuffle(self, continuum: Continuum): for _ in range(int(self.magnitude * self.SPLIT_FACTOR * self._reference_continuum.avg_num_annotations_per_annotator)): for annotator in continuum.annotators: units = continuum._annot...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def split(self):\n\n ratio_c = 1 - self.ratio\n self.train, self.test = self.df.randomSplit([self.ratio, ratio_c], seed=12345)", "def shift_shuffle(self, continuum: Continuum) -> None:\n shift_max = self.magnitude * self.SHIFT_FACTOR * \\\n self._reference_continuum.avg_length_uni...
[ "0.565537", "0.5480135", "0.54776907", "0.54391086", "0.5423783", "0.5409851", "0.539458", "0.5373258", "0.53153485", "0.5310843", "0.52797747", "0.52563226", "0.5236451", "0.5226697", "0.520109", "0.51921284", "0.51742184", "0.5147782", "0.5139677", "0.5136137", "0.5089941",...
0.73318213
0
Generates a new shuffled corpus with the provided (or generated) reference annotation set,
def corpus_shuffle(self, annotators: Union[int, Iterable[str]], shift: bool = False, false_pos: bool = False, false_neg: bool = False, split: bool = False, cat_shuffle: bool = False,...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def shuffle_annotations(annotations):\n shuffled_annotations = []\n while len(annotations)>0:\n random_index = random.randrange(len(annotations))\n line = annotations[random_index]\n shuffled_annotations.append(line)\n annotations.remove(line)\n return shuffled_annotations", ...
[ "0.574516", "0.5633824", "0.53477716", "0.53092796", "0.5275466", "0.5191949", "0.51811427", "0.51632196", "0.51452035", "0.5106954", "0.5081439", "0.50716454", "0.50579906", "0.5056524", "0.50563395", "0.5044877", "0.50380534", "0.5030752", "0.50278974", "0.50206995", "0.500...
0.60172826
0
Generates a QWERTY Manhattan distance resemblance matrix Costs for letter pairs are based on the Manhattan distance of the corresponding keys on a standard QWERTY keyboard.
def qwerty_distance(): from collections import defaultdict import math R = defaultdict(dict) R['-']['-'] = 0 zones = ["dfghjk", "ertyuislcvbnm", "qwazxpo"] keyboard = ["qwertyuiop", "asdfghjkl", "zxcvbnm"] for num, content in enumerate(zones): for char in content: R['-'][...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def distance_matrix(self, x, y, keyboard_weight=None):\r\n # create distance matrix\r\n size_x = len(x) + 1\r\n size_y = len(y) + 1\r\n dist_matrix = np.zeros((size_x, size_y))\r\n for i in range(size_x):\r\n dist_matrix[i, 0] = i\r\n for j in range(size_y):\r\n...
[ "0.63121146", "0.60487026", "0.58539367", "0.57887495", "0.5680378", "0.5640274", "0.5589275", "0.5494875", "0.5494359", "0.5468434", "0.5434783", "0.5410972", "0.54078287", "0.5402172", "0.53882927", "0.5361496", "0.5337732", "0.53260463", "0.53234446", "0.53033936", "0.5294...
0.60570216
1
Difference sanity test Given a simple resemblance matrix, test that the reported difference is the expected minimum. Do NOT assume we will always use this resemblance matrix when testing!
def test_diff_sanity(self): alphabet = ascii_lowercase + '-' # The simplest (reasonable) resemblance matrix: R = dict( [ ( a, dict( [ ( b, (0 if a==b else 1) ) for b in alphabet ] ) ) for a in alphabet ] ) # Warning: we may (r...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def testMatrix(m):\n print \"Testing the spread matrix:\"\n for i in m.matrix:\n if float('%.3g' % sum(i)) != 1.000 and sum(i) != 0:\n print \"The spread is not as expected\", sum(i)\n return\n print \"Matrix is acceptable\"", "def test_compare(self):...
[ "0.67408186", "0.6515446", "0.64991003", "0.6317342", "0.6263982", "0.62471825", "0.6171229", "0.60156643", "0.60129744", "0.59566", "0.5921032", "0.5915475", "0.58995837", "0.58891666", "0.58565575", "0.5831528", "0.5819044", "0.58110535", "0.5809865", "0.5804188", "0.580079...
0.7200956
0
Given 8 values corresponding to corners of a cube and a threshold value, this function returns the coordinates of a polygon to be plotted that divides the cube along edges where the threshold is crossed.
def marchingCubesPolygons(values, threshold): # define vertices of cube in (x,y,z) coordinates VERTICES = [ (0, 0, 0), (1, 0, 0), (1, 1, 0), (0, 1, 0), (0, 0, 1), (1, 0, 1), (1, 1, 1), (0, 1, 1)] # define edges of cube as combination of two ver...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def SH_FindOverlap(xcenter, ycenter, xlength, ylength, xp_corner, yp_corner):\n\n areaClipped = 0.0\n top = ycenter + 0.5 * ylength\n bottom = ycenter - 0.5 * ylength\n\n left = xcenter - 0.5 * xlength\n right = xcenter + 0.5 * xlength\n\n nVertices = 4 # input detector pixel vertices\n MaxVer...
[ "0.62861145", "0.62825006", "0.592349", "0.5918668", "0.5912606", "0.5804889", "0.58029455", "0.57807434", "0.5765746", "0.57598764", "0.57540196", "0.5722212", "0.57113737", "0.56979305", "0.56829304", "0.5670733", "0.5652377", "0.5641534", "0.56261015", "0.5614263", "0.5611...
0.714773
0
Converts the camera's polar position to cartesian and store the result in self.cameraPosition
def polarCameraToCartesian(self): x = self.cameraPolar[0] * np.sin(self.cameraPolar[1] * np.pi / 180) * np.sin(self.cameraPolar[2] * np.pi / 180) y = self.cameraPolar[0] * np.cos(self.cameraPolar[2] * np.pi / 180) z = self.cameraPolar[0] * np.cos(self.cameraPolar[1] * np.pi / 180) * np.sin(self....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _polar_to_cartesian(self, radius: float, radians: float) -> None:\n self.x = round(radius * math.cos(radians), EPSILON_EXP_MINUS_1)\n self.y = round(radius * math.sin(radians), EPSILON_EXP_MINUS_1)", "def polar(self):\n return PolarCoord((self._polar[0], self._polar[1]), self._polar[2])"...
[ "0.693107", "0.6905906", "0.6819338", "0.6803397", "0.67851555", "0.6774124", "0.66581005", "0.66437465", "0.65992516", "0.657186", "0.65377104", "0.6503731", "0.6501307", "0.64989936", "0.6482384", "0.64411527", "0.64346915", "0.64143777", "0.6405472", "0.6399689", "0.636128...
0.8749414
0
Renders scene in OpenGL. The main axes and bounding box of the world are always drawn, but the visualization of the world data depends on the current drawing mode selected by the user
def drawScene(self): glBegin(GL_LINES) # draw axes glColor3f(1, 0, 0) glVertex3f(0, 0, 0) glVertex3f(self.worldSize / 2, 0, 0) glColor3f(0, 1, 0) glVertex3f(0, 0, 0) glVertex3f(0, self.worldSize / 2, 0) glColor3f(0, 0, 1) glVertex3f(0, 0, 0...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def paintGL(self):\n self._sceneviewer.renderScene()\n # paintGL end", "def draw_scene():\n # Place the camera\n camera.placeCamera()\n \n \n # Set up the global ambient light. (Try commenting out.)\n amb = [ 0*brightness, 0*brightness, 0*brightness, 1.0 ]\n glLightModelfv(GL_...
[ "0.7506204", "0.74406266", "0.7282392", "0.7179098", "0.70508254", "0.69576925", "0.69117737", "0.6708232", "0.6666103", "0.663896", "0.6623787", "0.6541221", "0.6501028", "0.64759177", "0.64395064", "0.6425605", "0.64179164", "0.64148545", "0.6398485", "0.638504", "0.6370898...
0.8281561
0
Perform MarchingCubesPolygons algorithm across the worldspace to generate an array of polygons to plot
def findPolygons(self): # perform marching cubes algorithm for x in range(self.worldSize - 1): for y in range(self.worldSize - 1): for z in range(self.worldSize - 1): # format values for entry values = [self.world[x][y][z], self.world[x...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generatePolygons():", "def marchingCubesPolygons(values, threshold):\n # define vertices of cube in (x,y,z) coordinates\n VERTICES = [\n (0, 0, 0),\n (1, 0, 0),\n (1, 1, 0),\n (0, 1, 0),\n (0, 0, 1),\n (1, 0, 1),\n (1, 1, 1),\n (0, 1, 1)]\n # d...
[ "0.70632774", "0.69024783", "0.6398612", "0.63738394", "0.6349219", "0.629017", "0.61750984", "0.60984653", "0.6011764", "0.60001856", "0.59929866", "0.5986397", "0.5956049", "0.5908103", "0.59058756", "0.5896524", "0.5848426", "0.57612944", "0.5757789", "0.57517886", "0.5666...
0.7548078
0
Forces to update striatum response history. In normal situation striatum do it automatically.
def update_response(self, response): self.stri.update_response(response)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_response(self, response):\r\n self.stri_ext.update_response(response)\r\n self.stri_int.update_response(response)", "def update_state(self, slate_documents, responses):", "async def update_session_history(request, call_next):\n response = await call_next(request)\n history = requ...
[ "0.62283283", "0.60817045", "0.59958225", "0.59683615", "0.5823295", "0.5782251", "0.5748286", "0.5663176", "0.55442536", "0.55053854", "0.54971474", "0.5492235", "0.54634976", "0.5441245", "0.5435336", "0.5413573", "0.53847986", "0.537717", "0.5324745", "0.5322132", "0.53182...
0.6470134
1
Forces to update striatum response history. In normal situation striatum do it automatically.
def update_response(self, response): self.stri.update_response(response)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_response(self, response):\r\n self.stri_ext.update_response(response)\r\n self.stri_int.update_response(response)", "def update_state(self, slate_documents, responses):", "async def update_session_history(request, call_next):\n response = await call_next(request)\n history = requ...
[ "0.6231142", "0.60827225", "0.5993901", "0.59652436", "0.58213335", "0.57789826", "0.57437676", "0.5659112", "0.55398905", "0.55027115", "0.54957896", "0.5486744", "0.54617155", "0.54379827", "0.54329455", "0.5409475", "0.53816503", "0.5377957", "0.5323756", "0.5322567", "0.5...
0.6472602
0
Function to plot, in log scale, the differential storage modulus, k as a function of stress, strain, or both. INPUT
def plot_k(x, k, linewidth = 1.5, marker = 'o', color = 'k', marker_facecolor = 'k'): # Plot the first variable x1 = x[0] plt.figure(figsize = (9,5)) plt.plot(x1, k, c = color, lw = linewidth, marker = marker, mec = color, mfc = marker_facecolor) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def exo1():\n x = [.5; .5]\n niter = 20\n E = []\n D = []\n X = []\n for i in 1: niter:\n X(: , i) = x\n E(end + 1) = f(x)\n D(end + 1) = norm(x)\n x = x - tau*Gradf(x)\n h = plot(log10(E))\n set(h, 'LineWidth', 2)\n axis tight\n title('log_{10}(x^{(k)})')"...
[ "0.620244", "0.59672105", "0.5958095", "0.5921367", "0.58973336", "0.588664", "0.5876698", "0.58317745", "0.57675505", "0.5748258", "0.5699336", "0.5636468", "0.5604143", "0.5548979", "0.55203366", "0.5516201", "0.55131924", "0.5496997", "0.5495823", "0.54898053", "0.54882056...
0.62799585
0
Function to compute the mean curve for the differential elastic modulus for all the data within a file Note that it is based on interpolation! INPUT
def mean_kall_interp(filename, xvariable,num_interp = 100, show_plot = True, sample_header = 'Sample Description', stress_header = 'Stress (Pa)', strain_header = 'Strain (%)', k_header = 'K prime (Pa)', ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getMeanE(self):\n\n\n\t\tEBefore, EAfter = self.getEnergyEvolution()\n\n\t\tmeanBefore = np.mean(EBefore[-self.__Nkicks//5:])\n\t\tmeanAfter = np.mean(EAfter[-self.__Nkicks//5:])\n\t\tmeanTot = (meanBefore+meanAfter)/2\n\n\t\treturn meanBefore, meanAfter, meanTot", "def ex1_get(alpha,beta,pace,delta):\n\t\n\...
[ "0.6035233", "0.59857315", "0.5804135", "0.5775241", "0.57595766", "0.5643076", "0.56369853", "0.5624777", "0.560856", "0.56008756", "0.5565176", "0.5548366", "0.5544753", "0.55032843", "0.5495962", "0.5483974", "0.5464041", "0.54538137", "0.5447607", "0.5447298", "0.54315394...
0.6105286
0
parse the product detail page.
def parse_detail(self, response): loader = BeiBeiProductLoader(BeibeiProduct(), response=response) match = re.search(r'/detail/p/([0-9]+)\.html', response.url) if not match: self.logger.warn("product id not found from URL: %s", response.url) retu...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_detail_page(self, response):\n self.logger.info('Parse Detail Page function called on %s', response.url)\n item = response.meta.get('item', {})\n item['url'] = response.url\n item['title'] = response.css(TITLE_SELECTOR).extract_first(\"\").strip()\n item['price'] = self...
[ "0.7332074", "0.70028687", "0.682712", "0.66167986", "0.655458", "0.6486167", "0.6345658", "0.6335755", "0.6321414", "0.6278564", "0.627526", "0.6249362", "0.6188311", "0.6187878", "0.6165495", "0.6099834", "0.60969275", "0.6072641", "0.60128343", "0.60072505", "0.5989429", ...
0.79251844
0
Convert local time to stock time.
def __get_stock_time(stock_tz: timezone) -> datetime: return datetime.now().astimezone(stock_tz)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def timestampfromlocal(local):\n return local.timestamp()", "def local_time():\n return datetime.datetime.now().isoformat()[:len('2017-01-24T10:44:00')]", "def local_time(self) -> SmartNvmeLocalTime:\n return self._local_time", "def local_time(self, local_time: SmartNvmeLocalTime):\n\n se...
[ "0.6390957", "0.62333965", "0.61749357", "0.61194736", "0.6035789", "0.60283273", "0.5905837", "0.58786947", "0.58271265", "0.57655567", "0.5695081", "0.56771725", "0.5636829", "0.5636829", "0.5608826", "0.5582738", "0.5571458", "0.5569241", "0.5568407", "0.5536695", "0.54661...
0.6539263
0
Get the difference between stock price of yesterday and the day before yesterday. Information is gotten from Alpha Vantage API.
def get_stock_difference(stock_symbol: str) -> float: av_params = { "function": "TIME_SERIES_DAILY", "symbol": stock_symbol, "apikey": config.AV_API_KEY } response = requests.get("https://www.alphavantage.co/query", params=av_params) response.raise_for_status() stock_daily_d...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_power_consumption_yesterday(self):\n return self.power_consumption_yesterday", "def previous_date(self):\n yesterday = pendulum.yesterday('UTC')\n last_update = self.storage.last_update(self.feed)\n if not last_update or last_update < yesterday:\n last_update = yest...
[ "0.68710786", "0.6384263", "0.6358718", "0.6214671", "0.60386467", "0.6026378", "0.60053504", "0.58787036", "0.5804829", "0.574149", "0.5725666", "0.5675212", "0.5655568", "0.5632252", "0.56037617", "0.55869097", "0.5582911", "0.55560523", "0.5548148", "0.55467075", "0.554399...
0.7740488
0
Invert the bits in the bytestring `s`. This is used to achieve a descending order for blobs and strings when they are part of a compound key, however when they are stored as a 1tuple, it
def invert(s): return s.translate(INVERT_TBL)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reverseString1(self, s):\n for i in range(len(s)//2):\n s[i], s[~i] = s[~i], s[i]", "def reverseComplement(s):\n\tcomplement = {'A':'T', 'C':'G', 'G':'C', 'T':'A', 'N':'N'}\n\tt = ''\n\tfor base in s:\n\t\tt = complement[base] + t\n\treturn t", "def reverseString(self, s):\n for i ...
[ "0.66461504", "0.6160725", "0.6132901", "0.60731655", "0.5983622", "0.594542", "0.59285384", "0.59088534", "0.5840628", "0.5825385", "0.5814925", "0.57725865", "0.5744192", "0.5703233", "0.56617624", "0.56421524", "0.5639878", "0.5639233", "0.5598104", "0.55823743", "0.555605...
0.66995716
0
Given a bytestring `s`, return the most compact bytestring that is greater than any value prefixed with `s`, but lower than any other value.
def next_greater(s): assert s # Based on the Plyvel `bytes_increment()` function. s2 = s.rstrip('\xff') return s2 and (s2[:-1] + chr(ord(s2[-1]) + 1))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def minWindow(self, s: str, t: str) -> str:\n ct = Counter(t)\n right = left = 0\n length = inf\n res = \"\"\n needed_for_t = len(t)\n for right, ch in enumerate(s):\n if ch in ct:\n if ct[ch] > 0:\n needed_for_t -= 1\n ct[ch] -= 1\n while needed...
[ "0.6012119", "0.59964544", "0.59740466", "0.5591786", "0.5585872", "0.5546276", "0.5545449", "0.5528146", "0.55005383", "0.54773486", "0.5462731", "0.5455454", "0.5421001", "0.5377825", "0.53701454", "0.53483087", "0.5336918", "0.53265125", "0.5279389", "0.5211155", "0.518747...
0.6833631
0
Return True if an entry with the exact tuple `x` exists in the index.
def has(self, x, txn=None): x = tuplize(x) tup, key = next(self.pairs(x), (None, None)) return tup == x
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __contains__(self, x):\n indexes = self.get_indexes(x)\n return self.sketch[indexes] > 0", "def __contains__(self, idx):\n return idx in self._data", "def contains(self, x):\n raise NotImplementedError", "def does_exist(self, index):\n if index in self.map:\n return ...
[ "0.7002768", "0.69785744", "0.6783254", "0.6741981", "0.6699613", "0.6592085", "0.6581825", "0.65470314", "0.6491138", "0.6491138", "0.64818466", "0.64338917", "0.63576055", "0.6340422", "0.62632", "0.6249271", "0.6247083", "0.62031204", "0.61727875", "0.61569077", "0.6147019...
0.7292057
0
Yield `get(x)` for each `x` in the iterable `xs`.
def gets(self, xs, txn=None, rec=None, default=None): return (self.get(x, txn, rec, default) for x in xs)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def itervalues(self, *args, **kwargs):\n for key in self.iterkeys():\n yield self._get(key, *args, **kwargs)", "def __iter__(self):\n\n # For each key in set of keys\n for key in self.keys_set:\n\n # Yield that key and associated value\n yield key, self.__get...
[ "0.58548295", "0.56954026", "0.55972797", "0.5475167", "0.5433384", "0.5421819", "0.5411479", "0.52709156", "0.52600944", "0.52473813", "0.5232616", "0.52298725", "0.5229124", "0.5228351", "0.5143503", "0.5112543", "0.51098645", "0.5067082", "0.5049542", "0.5047411", "0.50272...
0.63888204
0
Associate an index with the collection. Index metadata will be created in the storage engine it it does not exist. Returns the `Index` instance describing the index. This method may only be invoked once for each unique `name` for each collection.
def add_index(self, name, func): assert name not in self.indices info_name = 'index:%s:%s' % (self.info['name'], name) info = self.store._get_info(info_name, index_for=self.info['name']) index = Index(self, info, func) self.indices[name] = index if IndexKeyBuilder: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_index(collection, index):\n db[collection].create_index(index)", "def init_index(self, index_name):\n return Index(self, index_name)", "def create_index(index_name, index_config, client):\n client.create(index=index_name, body=index_config)", "def create_index(index_name):\n resp =...
[ "0.7036111", "0.619484", "0.60897195", "0.6011374", "0.59855175", "0.5938999", "0.58643657", "0.58643657", "0.5846917", "0.58329785", "0.5789435", "0.57819605", "0.5722402", "0.5661722", "0.56147593", "0.55916554", "0.5569049", "0.5557823", "0.5556489", "0.551957", "0.5513929...
0.66456324
1
Return the first matching record, or None. Like ``next(itervalues(), default)``.
def find(self, key=None, lo=None, hi=None, reverse=None, include=False, txn=None, rec=None, default=None): it = self.values(key, lo, hi, reverse, None, include, txn, rec) v = next(it, default) if v is default and rec and default is not None: v = Record(self.coll, default...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def first(self, **opts):\n try:\n return next(self.find(**opts))\n except StopIteration:\n if 'default' in opts:\n return opts['default']\n else:\n raise KeyError(\"no matching objects\")", "def find(self, args=None, lo=None, hi=None, r...
[ "0.7420567", "0.729406", "0.70402557", "0.70098037", "0.6747233", "0.6573423", "0.65181947", "0.64708954", "0.6462105", "0.64256006", "0.6267125", "0.6262828", "0.62594527", "0.62209195", "0.62129086", "0.6191699", "0.6148562", "0.6146063", "0.61223197", "0.609467", "0.609323...
0.7424811
0
Fetch a record given its key. If `key` is not a tuple, it is wrapped in a 1tuple. If the record does not exist, return ``None`` or if `default` is provided, return it instead. If `rec` is ``True``, return
def get(self, key, default=None, rec=False, txn=None): key = tuplize(key) it = self._iter(txn, None, key, key, False, None, True, None) tup = next(it, None) if tup: txn_id = getattr(txn or self.engine, 'txn_id', None) obj = self.encoder.unpack(tup[2]) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get(self, x, txn=None, rec=None, default=None):\n for tup in self.items(lo=x, hi=x, include=False, rec=rec):\n return tup[1]\n if rec and default is not None:\n return Record(self.coll, default)\n return default", "def find(self, key=None, lo=None, hi=None, reverse=...
[ "0.64899474", "0.6472775", "0.6147658", "0.61328465", "0.5905932", "0.57399994", "0.5697584", "0.5677325", "0.5673076", "0.5657559", "0.5626687", "0.5621607", "0.560914", "0.5548576", "0.55469507", "0.55213857", "0.55031437", "0.549219", "0.54708385", "0.5448695", "0.5428925"...
0.6975982
0
Search the key range lo..hi for individual records, combining them into a batches. Returns `(found, made, last_key)` indicating the number of records combined, the number of batches produced, and the last key visited before `max_phys` was exceeded. Batch size is controlled via `max_recs` and `max_bytes`; at least one m...
def batch(self, lo=None, hi=None, max_recs=None, max_bytes=None, preserve=True, packer=None, txn=None, max_phys=None, grouper=None): assert max_bytes or max_recs, 'max_bytes and/or max_recs is required.' txn = txn or self.engine packer = packer or self.packer ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read_entries_(self, start_key=None, end_key=None):\n # TODO (andrin): fetch a couple of shards instead of just one based on\n # method argument\n current_key = start_key\n if current_key == None:\n current_key = (\"\", )\n limit_shard_name = RecordIOShard.key_name(\n s...
[ "0.5377973", "0.5250813", "0.52094275", "0.51410776", "0.5034519", "0.5006585", "0.49998978", "0.49376148", "0.49375245", "0.4912089", "0.49118918", "0.48698753", "0.486148", "0.4849708", "0.48431614", "0.48383713", "0.48327553", "0.4824959", "0.48236606", "0.4813737", "0.480...
0.6473588
0
Delete a record value without knowing its key. The deleted record is returned, if it existed.
def delete_value(self, val, txn=None): assert self.derived_keys return self.delete(self.key_func(val), txn)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete(self, key):\n if key not in self.db:\n raise LookupError(\"No record for key \\\"%s\\\" exists.\" % key)\n\n record = self.db[key]\n del self.db[key]\n return record", "def delete(self, record):\n temp = self.hashing(record.get_key())\n if self.__bu...
[ "0.7265244", "0.6861643", "0.6856352", "0.6801288", "0.66860753", "0.66188616", "0.65957475", "0.6586024", "0.6570801", "0.65685195", "0.6555317", "0.6539724", "0.639691", "0.63921463", "0.6376713", "0.6362288", "0.6362288", "0.6340162", "0.6297596", "0.6295939", "0.6291092",...
0.74312586
0
Substitute a Sympy matrix with some points
def matrix_subs(matrix_2x2, point): arr = [] for el in matrix_2x2: arr.append(el.subs(x1, point[0]).subs(x2, point[1])) M = Matrix([[arr[0], arr[1]], [arr[2], arr[3]]]) return M
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def with_matsym(*simplifies):\n from sympy.matrices import MatrixSymbol\n from symplus.setplus import AbstractSet\n def simplify_with_matsym(expr, *args, **kwargs):\n # expand MatrixSymbol as Matrix: A -> [ A[0,0] ,..]\n mats = list(expr.atoms(MatrixSymbol))\n agents = list(Dummy(str(...
[ "0.63315576", "0.6180127", "0.5928219", "0.5822502", "0.57564455", "0.569143", "0.55408376", "0.55001694", "0.5494007", "0.5492283", "0.540052", "0.5382228", "0.536797", "0.53523666", "0.5345227", "0.526552", "0.52366996", "0.51955366", "0.51734364", "0.5167767", "0.5157274",...
0.6811872
0
Get the Jacobian matrix from a gradient; or two functions in a 1d array
def get_jacobian(gradient): gradient_of_x1 = get_gradient(gradient[0]) fx1x1 = gradient_of_x1[0] fx2x1 = gradient_of_x1[1] gradient_of_x2 = get_gradient(gradient[1]) fx1x2 = gradient_of_x2[0] fx2x2 = gradient_of_x2[1] M = Matrix([[fx1x1, fx2x1], [fx1x2, fx2x2]]) return M
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def jacobian(f, x):\n\n B, N = x.shape\n x.requires_grad = True\n in_ = torch.zeros(B, 1)\n \n y = f(in_, x)\n jacobian = list()\n \n for i in range(N):\n v = torch.zeros_like(y)\n v[:, i] = 1.\n dy_i_dx = torch.autograd.grad(y,\n x,\n ...
[ "0.7145842", "0.68220186", "0.67845017", "0.67727375", "0.6742965", "0.66961354", "0.66790104", "0.65935296", "0.65695715", "0.6567825", "0.6539777", "0.65281737", "0.6505052", "0.6449393", "0.64071274", "0.6402486", "0.63869303", "0.6353686", "0.6327738", "0.6325424", "0.630...
0.7826469
0
Simply load the predictions associated with the VERSION data
def load_predict(path=MODEL_PATH, version=VERSION, namePredictor=DEFAULT_PREDICTOR): logging.info("trying to load {}".format(path + namePredictor + version + '.npz')) return np.load(path + namePredictor + version + '.npz')['pred']
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _load_version(cls, unpickler, version):\n model = unpickler.load()\n if version == 0:\n feature = model._state['features']\n model._state['output_column_name'] = 'extracted.' + feature\n return model", "def predict(self, data, version='default'):\n if self.tr...
[ "0.6604535", "0.62928057", "0.62380624", "0.6178517", "0.6116927", "0.6114995", "0.6087761", "0.6059424", "0.6027648", "0.5998679", "0.5942684", "0.59116244", "0.5828584", "0.581421", "0.58066016", "0.57952", "0.57886976", "0.5787052", "0.5781026", "0.5778934", "0.5777145", ...
0.70246345
0
Retrieve the HTML from the website at `url`.
def get_html(url): return urllib.request.urlopen(url)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_html_from_url(url):\n request = requests.get(url)\n data = request.text\n return data", "def get_html(url):\n req = urllib.request.Request(\n url,\n headers={\n 'User-Agent': 'Python Learning Program',\n 'From': 'hklee310@gmail.com'\n }\n )\n r...
[ "0.8416072", "0.8373522", "0.8318817", "0.82229555", "0.8126572", "0.8060912", "0.79980475", "0.79878724", "0.7985769", "0.7910303", "0.7863441", "0.78517896", "0.78509027", "0.78275955", "0.77782696", "0.77640617", "0.7740524", "0.7684471", "0.76605576", "0.7652579", "0.7646...
0.8443978
0
Get the HTML of online clubs with Penn.
def get_clubs_html(): url = 'https://ocwp.apps.pennlabs.org' return get_html(url)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_courses_html():\r\n r = requests.get(URL_CS_ALL_REQ)\r\n if r.status_code == 200:\r\n return r.text\r\n else:\r\n return None", "def test_get_html(self):\r\n _html = self.peer_grading.get_html()", "def show_clubs(self):\n self.client.get(f\"{host}/board\")", "def ...
[ "0.6088996", "0.5787258", "0.5756878", "0.5625098", "0.5575333", "0.5504629", "0.54450583", "0.5413097", "0.5376512", "0.53630584", "0.53621113", "0.5361559", "0.5302013", "0.5288246", "0.52757317", "0.524258", "0.5232825", "0.521696", "0.52091354", "0.5189585", "0.5163789", ...
0.7841981
0
Returns a list of elements of type "elt" with the class attribute "cls" in the HTML contained in the soup argument. For example, get_elements_with_class(soup, 'a', 'navbar') will return all links with the class "navbar". Important to know that each element in the list is itself a soup which can be queried with the Beau...
def get_elements_with_class(soup, elt, cls): return soup.findAll(elt, {'class': cls})
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_and_get_all_elements_by_class_name(element, class_name):\r\n if element is None or not class_name:\r\n return []\r\n try:\r\n return element.find_elements_by_class_name(class_name) \r\n except NoSuchElementException:\r\n return []", "def get_tags_with_class(self, class_nam...
[ "0.67307174", "0.6583558", "0.6581643", "0.6082963", "0.6076023", "0.60375786", "0.59123343", "0.5773693", "0.574763", "0.57319593", "0.5679493", "0.56563056", "0.5533203", "0.55314994", "0.5527751", "0.5484552", "0.5425862", "0.54025394", "0.5370151", "0.53265786", "0.531989...
0.8594822
0
This function should return a list of soups which each correspond to the html for a single club.
def get_clubs(soup): return get_elements_with_class(soup, 'div', 'box')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_clubs_html():\n url = 'https://ocwp.apps.pennlabs.org'\n return get_html(url)", "def get_club_tags(club):\n\n div = get_elements_with_class(club, 'div', '')[0]\n if len(div) < 1:\n return []\n\n tags = get_elements_with_class(div, 'span', 'tag is-info is-rounded')\n\n return [tag...
[ "0.70870376", "0.6348181", "0.6346335", "0.61832196", "0.59886855", "0.59778345", "0.5971089", "0.59584236", "0.5805674", "0.5787261", "0.5758521", "0.5743293", "0.57430327", "0.5740194", "0.5737127", "0.5732994", "0.5730185", "0.57068115", "0.56748796", "0.5651923", "0.56408...
0.69576275
1
Returns the string of the name of a club, when given a soup containing the data for a single club. We've implemented this method for you to demonstrate how to use the functions provided.
def get_club_name(club): elts = get_elements_with_class(club, 'strong', 'club-name') if len(elts) < 1: return '' return elts[0].text
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def club_id(self, club_name):\r\n # UTF-8 comparison\r\n headers = {\"Content-type\": \"application/x-www-form-urlencoded\", \"Accept\": \"text/plain\",\r\n 'Referer': 'http://' + self.domain + '/', \"User-Agent\": user_agent}\r\n req = self.session.get('http://' + self.domai...
[ "0.64601535", "0.64196163", "0.64184594", "0.6161314", "0.60368645", "0.5965522", "0.5939414", "0.593849", "0.5840082", "0.57630974", "0.5689154", "0.559938", "0.5528548", "0.5501211", "0.54695916", "0.54668534", "0.5447831", "0.54451835", "0.54218644", "0.5407108", "0.539453...
0.7737461
0
Extract club description from a soup of
def get_club_description(club): elts = get_elements_with_class(club, 'em', '') if len(elts) < 1: return '' return elts[0].text return ''
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def scrape_description(main_soup):\n rich_text = main_soup.find('div', {'class': 'rich-text'})\n description = rich_text.find('p').text\n\n return description", "def get_description(soup_recipe):\n description = soup_recipe.find(\"div\", {\"itemprop\": \"description\"})\n if not description:\n ...
[ "0.66733843", "0.64373165", "0.6436903", "0.63030756", "0.6302489", "0.62915045", "0.6276174", "0.6223921", "0.6218478", "0.6093889", "0.60505897", "0.59689254", "0.59336525", "0.5850197", "0.58073604", "0.5769218", "0.57675534", "0.5733685", "0.571832", "0.5702604", "0.56606...
0.7447845
0
Increment the the club favourite amount by either 1 or 1.
def inc_dec_fav_count(clubname, amt): clubs = read_json() for i, club in enumerate(clubs): if club["name"] == clubname: print(clubs[i]) clubs[i]["favourites"] += amt break # Stop loop when the club is found write_json(clubs)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def incr_circuit_fav_count(self, circuit_id):\n key = ':'.join(\n [CIRCUIT_NMBR_FAVS_1, \n str(circuit_id), \n CIRCUIT_NMBR_FAVS_2]\n ) \n self.RS.incr(key)", "def increase_count(self, number=1):\n self.count += number", "def like(self, n: int...
[ "0.65473634", "0.6530351", "0.64911497", "0.6480591", "0.6480568", "0.6459364", "0.64345556", "0.6331934", "0.6280161", "0.6274599", "0.619152", "0.6143345", "0.61095226", "0.6072142", "0.6072142", "0.60591125", "0.6053504", "0.6045872", "0.6042607", "0.60403013", "0.6009018"...
0.72904503
0
Add a new club if no club with that name alread exists. If the club exists, then update its information.
def write_new_club(name, description, categories): clubs = read_json() if name in [club["name"] for club in clubs]: # if club already exists, update it for i, club in enumerate(clubs): if name == club["name"]: updated_club = clubs[i] updated_club["name"] = n...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_club(self, club):\n sql = ''' INSERT INTO clubs(code_fede, dpt, nb_clubs, year) VALUES(?, ?, ?, ?) '''\n self.__cur.execute(sql, club)\n return self.__cur.lastrowid", "def add_club_comment(user, club, comment):\n with open('club_comments.json') as json_file:\n comments =...
[ "0.6627244", "0.64997935", "0.62884676", "0.5672625", "0.5598938", "0.54096884", "0.5290357", "0.5247473", "0.5242618", "0.50834304", "0.50773954", "0.50768083", "0.50752026", "0.5064006", "0.5048289", "0.50311404", "0.50113213", "0.5007416", "0.50011957", "0.49295354", "0.49...
0.68238854
0
Adds a favourites field to the json of scraped data.
def add_favourites_field(): existing = read_json() if 'favourites' not in existing[0].keys(): # if the field has not already been added, add it. for club in existing: club['favourites'] = 0 write_json(existing)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def favourite(self, favourite):\n\n self._favourite = favourite", "def favorites(self):\n path = self._get_path('favorites')\n \n response = self._GET(path)\n self._set_attrs_to_values(response)\n return self._clean_return(response)", "def favorite(self):\n url ...
[ "0.65756124", "0.6529356", "0.6501094", "0.62727886", "0.61769885", "0.6144672", "0.61340266", "0.60702753", "0.6036172", "0.6008245", "0.6002118", "0.59143424", "0.5912242", "0.58768296", "0.58584183", "0.58416903", "0.58340627", "0.5818007", "0.5809916", "0.5793181", "0.574...
0.8033423
0
Create the file that stores comments with all of the clubs that are in the clubs json file.
def create_comment_file(): club = read_json() comment_dict = {} for club in clubs: comment_dict[club.name] = [] with open('club_comments.json', 'w') as outfile: json.dump(comment_dict, outfile)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_club_comment(user, club, comment):\n with open('club_comments.json') as json_file:\n comments = json.load(json_file)\n if club in comments.keys():\n if comments[club] is None: # If there are no comments associated with the club Python returns None\n comments[club...
[ "0.7101525", "0.6485747", "0.6191754", "0.6072703", "0.5943167", "0.57518977", "0.56992775", "0.5630235", "0.5627743", "0.5570938", "0.55540836", "0.5501463", "0.5486059", "0.547262", "0.54247934", "0.54052603", "0.5391565", "0.5380575", "0.5356663", "0.5330073", "0.5302979",...
0.9017318
0
Add a new comment to an existing club.
def add_club_comment(user, club, comment): with open('club_comments.json') as json_file: comments = json.load(json_file) if club in comments.keys(): if comments[club] is None: # If there are no comments associated with the club Python returns None comments[club] = [user ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_comment(self, comment):\n assert isinstance(comment, Comment)\n self._comments.append(comment)\n return None", "def addComment(self, comment):\r\n comment.topicId = self.topicId\r\n self.comments.append(comment)\r\n return len(self.comments)-1", "def cli(ctx, c...
[ "0.7195255", "0.71707064", "0.7056008", "0.7054779", "0.70507956", "0.7042315", "0.6959034", "0.68218344", "0.67307377", "0.66941494", "0.66941494", "0.6638886", "0.6618629", "0.6611672", "0.660841", "0.657663", "0.65676564", "0.65323", "0.65181214", "0.6402509", "0.63962823"...
0.7891196
0
Hits the designated endpoint (volume/posts) and gets data for a specified timespan. The ratelimit is burned through ASAP and then backed off for one minute.... ???? .
def get_data_from_endpoint(self, from_, to_, endpoint): endpoint = self.make_endpoint(endpoint) from_, to_ = str(from_), str(to_) payload = { 'auth': self.auth_token, 'id': self.monitor_id, 'start': from_, 'end': to_, 'extendLimit': 'tr...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rest_rate_limit(r):\n\n try:\n #limit = int(r.headers[\"X-Rate-Limit-Limit\"])\n remain = int(r.headers[\"X-Rate-Limit-Remaining\"])\n reset = int(r.headers[\"X-Rate-Limit-Reset\"])\n curtime = times.to_unix(times.parse(r.headers[\"date\"]))\n ...
[ "0.5955437", "0.57257915", "0.56286526", "0.5615483", "0.5610118", "0.55875003", "0.5550483", "0.5543635", "0.5483358", "0.544748", "0.54263824", "0.5417483", "0.54158425", "0.5409253", "0.53897715", "0.53879756", "0.5376069", "0.5351717", "0.5316987", "0.53047615", "0.528698...
0.6245338
0
returns an n period exponential moving average for the time series s s is a list ordered from oldest (index 0) to most recent (index 1) n is an integer returns a numeric array of the exponential moving average
def ema(s, n): ema = [] j = 1 #get n sma first and calculate the next n period ema sma = sum(s[:n]) / n multiplier = 2 / float(1 + n) ema.append(sma) #EMA(current) = ( (Price(current) - EMA(prev) ) x Multiplier) + EMA(prev) ema.append(( (s[n] - sma) * multiplier) + sma) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def moving_average(a, n: int = 3) -> np.array:\n ret = np.cumsum(a, dtype=float)\n ret[n:] = ret[n:] - ret[:-n]\n return ret[n - 1:] / n", "def moving_average(a, n=5):\n ret = np.cumsum(a, dtype=float)\n ret[n:] = ret[n:] - ret[:-n]\n ret[n-1:] *= 1 / n\n ret[:n-1] *= 1 / np.arange(1, n)\n ...
[ "0.74028605", "0.7296576", "0.72747", "0.7268313", "0.72586125", "0.71004415", "0.7091385", "0.7057606", "0.70309013", "0.69481266", "0.69246125", "0.6874147", "0.67940295", "0.6785554", "0.6768282", "0.6737907", "0.6717414", "0.6709948", "0.6671454", "0.66080034", "0.6595614...
0.7348136
1
Update the snapshot so it'll only have the fields described in config.
def filter_snapshot(snap, config): for field in ALL_FIELDS: if field not in config: snap.ClearField(field)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def snapshot(self):\n pass", "def serialize_snapshot(self, snapshot, fields=None, version=None):\n fields = fields or self.snapshot_fields\n version = version or self.snapshot_version\n serialized_snapshot = serializers.serialize(\n 'python', [snapshot], fields=fields\n ...
[ "0.62075865", "0.5945219", "0.5891311", "0.55987465", "0.55950725", "0.55518705", "0.5527521", "0.54823714", "0.5481986", "0.546261", "0.54572856", "0.54442203", "0.54154104", "0.53831637", "0.53712493", "0.53712493", "0.5336485", "0.5313484", "0.53123206", "0.52995414", "0.5...
0.6623801
0
Upload the sample from the file to the server, using the hello>config>snapshot protocol.
def upload_sample(host, port, path, read_type='protobuf'): with Connection.connect(host, port) as conn: zipped = (path.endswith(".gz")) r = Reader(path, read_type, zipped) hello = r.read_hello() hello_bytes = hello.SerializeToString() num_snapshot = 1 for snap in r: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def upload_samples(args):\n clarity_epp.upload.samples.from_helix(lims, config.email, args.input_file)", "def upload_sample(self, file):\n return self._upload_sample(file)", "def upload_samples():\n # Retrieve a list of all files and paths within the target\n paths = Path(Config.target_dir).glo...
[ "0.6297403", "0.6237045", "0.58038926", "0.5784324", "0.56973356", "0.562496", "0.56072026", "0.55800873", "0.55693907", "0.5512037", "0.547841", "0.5458376", "0.54101336", "0.54032856", "0.53795666", "0.53617495", "0.5348523", "0.5347984", "0.53423697", "0.5332347", "0.53312...
0.681721
0
Instantiate PSQL db connection and return db cursor with given query result
def db_connection(query): db = psycopg2.connect(database=DBNAME) c = db.cursor() c.execute(query) return c.fetchall() db.close()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def psql_connection(query):\n try:\n conn = psycopg2.connect(database=DB)\n cur = conn.cursor()\n cur.execute(query)\n except Exception:\n (\"Error connecting to database\")\n else:\n print(\"Calling database...\")\n print(\"\")\n results = cur.fetchall()\n...
[ "0.7395502", "0.69118047", "0.6840957", "0.68388003", "0.6829422", "0.68154687", "0.6758602", "0.6728761", "0.6728179", "0.6697794", "0.6604093", "0.6601227", "0.6562602", "0.6542697", "0.6531216", "0.6530874", "0.6519317", "0.6513908", "0.6486032", "0.6468667", "0.6456323", ...
0.7045057
1
Test all API urls
def test_urls(self): self.base_check_request("get", "/") self.base_check_request("get", "apartments/") self.base_check_request("get", "complexes/") self.base_check_request("get", "locations/") self.base_check_request("get", "companies/") self.base_check_request("get", "co...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_smoke_test(self):\n urls = [ ]\n urls.append('/')\n urls.append(reverse('api_doc'))\n urls.append(reverse('laws'))\n urls.append(reverse('issue_list_user', args=['test0']))\n\n for url in urls:\n response = self.client.get(url)\n self.assertE...
[ "0.7839706", "0.7648727", "0.745794", "0.7436893", "0.731011", "0.71979964", "0.71921796", "0.7125115", "0.70737904", "0.7020486", "0.7014052", "0.6991493", "0.6971624", "0.6966466", "0.68834203", "0.6853621", "0.68137467", "0.68028086", "0.6798513", "0.6750252", "0.67475736"...
0.78406894
0
Test base API url
def test_base_url(self): r = self.base_check_request("get", "/") base_urls = { 'apartments': self.build_url('apartments/'), 'companies': self.build_url('companies/'), 'companies-types': self.build_url('companies-types/'), 'complexes': self.build_url('comp...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_base_url(self):\n\n # Each of these URLs should be invalid\n for url in [\n \"test.com/123\",\n \"http://:80/123\",\n \"//xyz.co.uk\",\n ]:\n with self.assertRaises(Exception):\n a = api.InvenTreeAPI(url, connect=False)\n\n ...
[ "0.7750673", "0.77456576", "0.7652821", "0.74328506", "0.716898", "0.71184355", "0.7075185", "0.7028354", "0.7003112", "0.69900703", "0.6973003", "0.6941978", "0.6894864", "0.6894864", "0.6892169", "0.6889323", "0.6861361", "0.6855039", "0.68360007", "0.6826019", "0.68183166"...
0.7842747
0
Check count apartments url
def test_count_apartments_urls(self): r = self.base_check_request("get", "count/apartments/") self.assertIsInstance(r, dict) self.assertIsInstance(r['count'], int)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def countdots(url): \r\n return url.count('.')", "def check_url_format(self):\r\n m = re.match(\"^http://www.tesco.com/direct/[0-9a-zA-Z-]+/[0-9-]+\\.prd$\", self.product_page_url)\r\n n = re.match(\"^http://www.tesco.com/.*$\", self.product_page_url)\r\n return (not not m) or (not not n)...
[ "0.6570135", "0.62185955", "0.61818105", "0.60949767", "0.5965347", "0.59338355", "0.589852", "0.58700925", "0.5813304", "0.57668436", "0.57417595", "0.56799453", "0.5673117", "0.5641667", "0.5640872", "0.5614625", "0.56092155", "0.558392", "0.554869", "0.5544998", "0.5539954...
0.6989395
0
Check count complexes url
def test_count_complexes_urls(self): r = self.base_check_request("get", "count/complexes/") self.assertIsInstance(r, dict) self.assertIsInstance(r['count'], int)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def countdots(url): \r\n return url.count('.')", "def countSubDir(url):\r\n return url.count('/')", "def CountAt(url):\r\n return url.count('@')", "def test_count_apartments_urls(self):\n r = self.base_check_request(\"get\", \"count/apartments/\")\n self.assertIsInstance(r, dict)\n ...
[ "0.6884328", "0.66283315", "0.65081114", "0.638867", "0.6249238", "0.62182957", "0.6169778", "0.611569", "0.6075261", "0.58923984", "0.58567244", "0.5837225", "0.5818708", "0.57962257", "0.5749233", "0.57347083", "0.57246214", "0.5721146", "0.5709762", "0.56962866", "0.568627...
0.8033261
0
Check apartments search form url
def test_search_form_apartments_urls(self): r_keys = ['balcony_types', 'bathroom_type', 'building_floors_max', 'building_floors_min', 'building_type', 'decoration', 'elevators_type', 'floor_max', 'floor_min', 'infrastructure', 'living_area_max', 'living_area...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def search(request):\n\n # get form data \n searchItem = request.GET.get(\"q\")\n # if searchItem is an exact match redirect to that page\n if (util.get_entry(searchItem) is not None):\n return HttpResponseRedirect(reverse(\"entry\", kwargs={\n \"title\": searchItem\n }...
[ "0.6154764", "0.6144359", "0.6003847", "0.5999131", "0.5904226", "0.5864869", "0.5856176", "0.5819513", "0.5761393", "0.5717995", "0.5688156", "0.5688023", "0.5634919", "0.5621996", "0.5603309", "0.5553236", "0.5548065", "0.5510001", "0.5509159", "0.5471066", "0.54406667", ...
0.6176141
0
Check complexes search form url
def test_search_form_complexes_urls(self): r_keys = ['balcony_types', 'bathroom_type', 'building_floors_max', 'building_floors_min', 'building_type', 'decoration', 'elevators_type', 'floor_max', 'floor_min', 'infrastructure', 'living_area_max', 'living_area_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def query(url):", "def test_filter_search_form_is_valid(self):\r\n response = self.client.get(reverse('search_results'), {\r\n 'name': 'nutella',\r\n 'category': '1',\r\n 'nutriscore': 'd'\r\n })\r\n self.assertTrue(response.context['product_list'])", "def ...
[ "0.62470764", "0.61839455", "0.61307776", "0.60680735", "0.60604334", "0.6051853", "0.5925678", "0.5914352", "0.59062356", "0.588627", "0.5855097", "0.58526474", "0.5848683", "0.5813221", "0.57736385", "0.5726085", "0.57079494", "0.5657176", "0.56479686", "0.5645858", "0.5622...
0.6926931
0
Check main search form url
def test_search_form_main_urls(self): r_keys = ['price_max', 'price_min', 'rooms_count'] r = self.check_request_keys("get", "search-forms/main/", r_keys) self.assertIsInstance(r['price_min'], int) self.assertIsInstance(r['price_max'], int) self.check_list_items_type(r['rooms_cou...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def search(request):\n\n if request.method == \"POST\":\n form = SearchForm(request.POST)\n\n if form.is_valid():\n title = form.cleaned_data[\"title\"]\n entryMD = util.get_entry(title)\n\n print('search request: ', title)\n\n if entryMD:\n return redirect(rever...
[ "0.6459624", "0.62796915", "0.6123323", "0.6115619", "0.61025727", "0.6093292", "0.607711", "0.6075454", "0.60183024", "0.5996655", "0.59779406", "0.5963711", "0.58934385", "0.5891925", "0.5888652", "0.5886857", "0.5879968", "0.58128816", "0.5796384", "0.5794324", "0.5788601"...
0.65516233
0
Check autocomplete companies url
def test_autocomplete_companies_urls(self): r = self.base_check_request("get", "autocomplete/companies/") self.assertIsInstance(r, list) self.assertEqual(len(r), 10, "Invalid default count") ac_keys = ['id', 'name', 'type_name'] for ac in r: # check response objects ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def API_company(request):\n query = request.GET\n if any(key for key in query if key not in API_COMPANY_VALIDKEYS):\n #print([(key,key not in API_COMPANY_VALIDKEYS) for key in query])\n return django.http.HttpResponseBadRequest(\"Invalid query\")\n if \"search\" in query:\n return API...
[ "0.6253605", "0.58379394", "0.57610047", "0.573596", "0.57312334", "0.5679476", "0.5679242", "0.56641346", "0.56231385", "0.56179494", "0.5549065", "0.5520094", "0.55199593", "0.55163765", "0.55016613", "0.54806185", "0.5457696", "0.5435207", "0.5428943", "0.54196036", "0.541...
0.6856514
0
Check autocomplete complexes url
def test_autocomplete_complexes_urls(self): r = self.base_check_request("get", "autocomplete/complexes/") self.assertIsInstance(r, list) self.assertEqual(len(r), 10, "Invalid default count") ac_keys = ['id', 'name', 'type_name'] for ac in r: # check response objects ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def validate_url(self):\n pass", "def check_url(url):\n return 'products.json' in url", "def test_autocomplete_locations_urls(self):\n r = self.base_check_request(\"get\", \"autocomplete/locations/\")\n self.assertIsInstance(r, list)\n self.assertEqual(len(r), 10, \"Invalid defau...
[ "0.64022815", "0.6359344", "0.6158054", "0.6140897", "0.59668964", "0.5876774", "0.5855907", "0.5841358", "0.5820167", "0.57811606", "0.5778149", "0.5756644", "0.57285386", "0.56883585", "0.5687888", "0.5670359", "0.5656254", "0.5651676", "0.5642779", "0.5618405", "0.5603773"...
0.64943016
0
Check autocomplete locations url
def test_autocomplete_locations_urls(self): r = self.base_check_request("get", "autocomplete/locations/") self.assertIsInstance(r, list) self.assertEqual(len(r), 10, "Invalid default count") ac_keys = ['ancestors', 'id', 'is_region', 'name', 'prepositional_name', 'slu...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def validate_url(self):\n pass", "def test_locationSearch(self):\n sel = self.selenium\n \n # Login\n self.login()\n\n # L2inL0\n # Create a new Shelter\n self.create_header()\n # Open the Search box\n sel.click(\"gis_location_search-btn\")\n ...
[ "0.5915492", "0.58113354", "0.57620513", "0.5706289", "0.5672959", "0.5648629", "0.557731", "0.5552593", "0.5551483", "0.5526195", "0.5514765", "0.55085653", "0.54948395", "0.5471785", "0.54306555", "0.542994", "0.54257005", "0.542408", "0.54149646", "0.54077256", "0.53922635...
0.72685176
0
Patch out render_template with a mock. Use when the return value of the view is not important to the test; rendering templates uses a ton of runtime.
def patch_render_template(self): mock_render = Mock(spec=render_template) mock_render.return_value = '' with patch('app.main.render_template', mock_render): yield mock_render
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_render_call_without_request(self, mock_render):\n context = MagicMock()\n render('template_name.html', context)\n mock_render.assert_called_with('template_name.html', context)", "def render_to_template_mock(*_args):", "def test_render_call_with_request(self, mock_rende...
[ "0.79456276", "0.7762128", "0.75975364", "0.6913007", "0.6731079", "0.6667107", "0.66639966", "0.6500641", "0.62945276", "0.62749934", "0.62602276", "0.6258427", "0.62050587", "0.6040006", "0.5983413", "0.5940503", "0.5893055", "0.58894944", "0.5863483", "0.585568", "0.585513...
0.87866557
0
Assert that the following code creates a Flask flash message. The message must contain the given snippet to pass.
def assert_flashes(self, snippet, message=None): if message is None: message = "'{}' not found in any flash message".format(snippet) mock_flash = Mock(spec=flash) with patch('app.main.flash', mock_flash): yield mock_flash for call_args in mock_flash.call_args_list...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_messages(client, test_db):\n login(client, app.config[\"USERNAME\"], app.config[\"PASSWORD\"])\n rv = client.post(\n \"/add\",\n data=dict(title=\"<Hello>\", text=\"<strong>HTML</strong> allowed here\"),\n follow_redirects=True,\n )\n assert b\"No entries here so far\" not...
[ "0.5874714", "0.5859291", "0.5777571", "0.56764233", "0.5541651", "0.5541651", "0.5482096", "0.54655033", "0.54281986", "0.5292355", "0.525658", "0.522889", "0.5216381", "0.5192509", "0.5183022", "0.5176257", "0.5148801", "0.5143383", "0.5133528", "0.5115431", "0.50823", "0...
0.77274686
0
Generates the logger and the doing() context manager for a given name. The doing() context manager will display a message in the logs and handle exceptions occurring during execution, displaying them in the logs as well. If an exception occurs, the program is exited.
def make_doer(name): logger = getLogger(name) @contextmanager def doing(message): logger.info(message) # noinspection PyBroadException try: yield except LuhError as e: logger.error(e.message) exit(1) except Exception: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def main():\n flags = parser_create()\n config_data = config_loader_yaml(flags.config_file)\n loggers_config = get_loggers_config(config_data)\n logging_queue = multiprocessing.Queue()\n logging_worker = LoggingWorker(loggers_config, logging_queue)\n logging_worker.start()\n\n class_name = \"\...
[ "0.56715065", "0.5547985", "0.55348605", "0.5509056", "0.55090016", "0.5430356", "0.54287386", "0.53950167", "0.538413", "0.5351113", "0.52963126", "0.5291368", "0.52313596", "0.5222739", "0.51738536", "0.51407766", "0.5124997", "0.51218605", "0.50439346", "0.502796", "0.5026...
0.7915124
0
Imports a Python file as a module named luh3417.{name}
def import_file(name: Text, file_path: Text): spec = spec_from_file_location(f"luh3417.{name}", file_path) module = module_from_spec(spec) spec.loader.exec_module(module) return module
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def import_module(self, location, name):", "def load_module(name):\n return __import__(\"metaswitch.%s\" % name,\n fromlist=[\"ROUTES\"])", "def _import_module(name):\r\n __import__(name)\r\n return sys.modules[name]", "def _import_module(name):\r\n __import__(name)\r\n re...
[ "0.7269499", "0.652222", "0.6388376", "0.6388376", "0.6388376", "0.6348975", "0.6348975", "0.6311361", "0.62959266", "0.62948275", "0.6222974", "0.61776567", "0.6171849", "0.6134908", "0.6124925", "0.6088499", "0.60543156", "0.60247666", "0.59827363", "0.5958609", "0.5942658"...
0.7448031
0
Fetch the URL from the Neutron service for a particular endpoint type. If none given, return publicURL.
def url_for(self, attr=None, filter_value=None, service_type='network', endpoint_type='publicURL'): catalog = self.catalog['access'].get('serviceCatalog', []) matching_endpoints = [] for service in catalog: if service['type'] != service_type: c...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_endpoint(self, datacenter=None, network=None):\r\n if datacenter is None:\r\n datacenter = 'dal05'\r\n if network is None:\r\n network = 'public'\r\n try:\r\n host = ENDPOINTS[datacenter][network]\r\n return \"https://%s\" % host\r\n e...
[ "0.66849047", "0.6626688", "0.625258", "0.62082934", "0.61906004", "0.6171439", "0.6171439", "0.6152799", "0.60892427", "0.604996", "0.60300756", "0.5963532", "0.5956159", "0.5900996", "0.58805144", "0.5862944", "0.58121765", "0.5770395", "0.57648194", "0.5754705", "0.5751773...
0.6814899
0
Set the client's service catalog from the response data.
def _extract_service_catalog(self, body): self.service_catalog = ServiceCatalog(body) try: sc = self.service_catalog.get_token() self.auth_token = sc['id'] self.auth_tenant_id = sc.get('tenant_id') self.auth_user_id = sc.get('user_id') excep...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_srv_response(self, srvs):\n with self._context.lock:\n self._context.data[\"services\"] = srvs", "def _set_catalog(self, catalog: cat.Catalog) -> None:\n self._catalog_interface = CatalogInterface(catalog)\n self._catalog = catalog", "def deserialize_catalog(cata...
[ "0.636587", "0.6025779", "0.5972524", "0.5868126", "0.56682014", "0.53990924", "0.53895503", "0.53510207", "0.5188658", "0.5188658", "0.5188658", "0.5188658", "0.5188658", "0.5160498", "0.51434344", "0.51307184", "0.51307184", "0.51307184", "0.51051885", "0.50766647", "0.5069...
0.6341135
1
Returns the integer status code from the response. Either a Webob.Response (used in testing) or requests.Response is returned.
def get_status_code(self, response): if hasattr(response, 'status_int'): return response.status_int else: return response.status_code
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_status_code(self, response):\n if hasattr(response, 'status_int'):\n return response.status_int\n return response.status", "def _get_status_code(response: Response) -> int:\n status_code = response.status_code\n if isinstance(status_code, HTTPStatus):\n r...
[ "0.8706974", "0.8433784", "0.81698084", "0.79378104", "0.7715872", "0.7612964", "0.7612964", "0.7554774", "0.7411476", "0.72669125", "0.7237965", "0.7231767", "0.72067887", "0.7142123", "0.71238506", "0.6979288", "0.6972776", "0.68875885", "0.6868603", "0.6837098", "0.6793999...
0.86493224
1
Recursive method to convert data members to XML nodes.
def _to_xml_node(self, parent, metadata, nodename, data, used_prefixes): result = etree.SubElement(parent, nodename) if ":" in nodename: used_prefixes.append(nodename.split(":", 1)[0]) #TODO(bcwaldon): accomplish this without a type-check if isinstance(data, list): ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def data_to_xml(data, xml=None):\n\n for element in data:\n name = element[0]\n val = element[1]\n if len(element) > 2:\n converter = element[2]\n else:\n converter = None\n\n if val is not None:\n if convert...
[ "0.55837137", "0.55511117", "0.55470467", "0.5507946", "0.5457745", "0.5439807", "0.5430423", "0.5406567", "0.53041154", "0.52765614", "0.52231044", "0.511099", "0.5077055", "0.50718933", "0.50695", "0.5063672", "0.504861", "0.50350535", "0.5003575", "0.49517578", "0.49235386...
0.6046614
0
Serialize a dictionary into the specified content type.
def serialize(self, data, content_type): return self._get_serialize_handler(content_type).serialize(data)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_dict(self, dictionary):\n dictionary['type'] = self.type_code", "def serialize_dict(container: Dict) -> Dict:\n for key, value in container.items():\n container[key] = serialize_obj(value)\n return container", "def serialize_dict(container: Dict) -> Dict:\n for key, value in conta...
[ "0.6238056", "0.57195693", "0.57195693", "0.56067234", "0.5586985", "0.5327035", "0.5265228", "0.521467", "0.51638", "0.5133741", "0.5116739", "0.5113826", "0.5064935", "0.5064935", "0.5040795", "0.5020376", "0.49975267", "0.498446", "0.49824035", "0.49813008", "0.49763197", ...
0.6142456
1
Deserialize a string to a dictionary. The string must be in the format of a supported MIME type.
def deserialize(self, datastring, content_type): return self.get_deserialize_handler(content_type).deserialize( datastring)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mmtf_bytes_to_mmtf_dict(bytestring):\n\n raw = msgpack.unpackb(bytestring)\n return decode_dict(raw)", "def parse_bytes_to_dict(bytes_to_parse):\n return ast.literal_eval(bytes_to_parse.decode(\"utf-8\"))", "def json_loads(s: Union[bytes, str]) -> Dict[str, Any]:\n return json.loads(ensure_text...
[ "0.63770974", "0.6286723", "0.6270054", "0.62124544", "0.5952388", "0.59262204", "0.59089375", "0.59001184", "0.5857306", "0.5854179", "0.583345", "0.58254915", "0.5811731", "0.5762951", "0.5674565", "0.5623781", "0.56214863", "0.5615988", "0.5598508", "0.5587685", "0.5584029...
0.632472
1
Returns the first environment variable set. if none are nonempty, defaults to '' or keyword arg default.
def env(*vars, **kwargs): for v in vars: value = os.environ.get(v) if value: return value return kwargs.get('default', '')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def env(*vars, **kwargs):\n for v in vars:\n value = os.environ.get(v, None)\n if value:\n return value\n return kwargs.get('default', '')", "def env(*vars, **kwargs):\n for v in vars:\n value = os.environ.get(v, None)\n if value:\n return value\n ret...
[ "0.7659608", "0.7659608", "0.765618", "0.754722", "0.75204015", "0.70700836", "0.704792", "0.6990025", "0.69792265", "0.69578755", "0.6949888", "0.68441415", "0.6825165", "0.6794135", "0.6680647", "0.66783625", "0.66763157", "0.6639027", "0.6628669", "0.66113937", "0.6609096"...
0.76820445
0
Returns the client class for the requested API version
def get_client_class(api_name, version, version_map): try: client_path = version_map[str(version)] except (KeyError, ValueError): msg = _("Invalid %(api_name)s client version '%(version)s'. must be " "one of: %(map_keys)s") msg = msg % {'api_name': api_name, 'versio...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_client_impl(self):\n api_version = self._get_api_version(None)\n if api_version not in self._client_impls:\n self._create_client_impl(api_version)\n return self._client_impls[api_version]", "def get(host, port=None, version=None):\n port = 8081 if port is None else...
[ "0.7603729", "0.69440734", "0.6819133", "0.6434926", "0.6426967", "0.64204526", "0.6384498", "0.633332", "0.63202596", "0.62628543", "0.62604326", "0.6218951", "0.62035966", "0.61787295", "0.61738944", "0.6160897", "0.6139946", "0.6088289", "0.60710144", "0.60686547", "0.6056...
0.8210274
0
Return a tuple containing the item properties.
def get_item_properties(item, fields, mixed_case_fields=[], formatters={}): row = [] for field in fields: if field in formatters: row.append(formatters[field](item)) else: if field in mixed_case_fields: field_name = field.replace(' ', '_') ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def items(self) -> Tuple[Item]:\n return tuple(self.__items)", "def items(self) -> tuple[tuple[Any, Any], ...]: # type: ignore\n return tuple(zip(self.keys(), self.values()))", "def getProperties():", "def items(self) -> tuple[tuple[Hashable, Any], ...]:\n return tuple(zip(self.keys(), s...
[ "0.7156068", "0.6725318", "0.6662332", "0.6658762", "0.66519535", "0.6637251", "0.6589536", "0.65703964", "0.65554535", "0.64712626", "0.6470728", "0.6409408", "0.6409408", "0.6399682", "0.63823044", "0.63823044", "0.6360324", "0.63506", "0.63309497", "0.6298649", "0.62954336...
0.6922289
1
Install a _() function using the given translation domain. Given a translation domain, install a _() function using gettext's install() function. The main difference from gettext.install() is that we allow overriding the default localedir (e.g. /usr/share/locale) using a translationdomainspecific environment variable (...
def install(domain, lazy=False): if lazy: # NOTE(mrodden): Lazy gettext functionality. # # The following introduces a deferred way to do translations on # messages in OpenStack. We override the standard _() function # and % (format string) operation to build Message obj...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __initializeLocale(self):\n langdomain = 'tortugaStrings'\n\n # Locate the Internationalization stuff\n localedir = '../share/locale' \\\n if os.path.exists('../share/locale') else \\\n os.path.join(self._cm.getRoot(), 'share/locale')\n\n gettext.install(langdo...
[ "0.6045004", "0.5466799", "0.526115", "0.51772755", "0.5106761", "0.49439147", "0.49150738", "0.4845263", "0.48276627", "0.48242715", "0.4787425", "0.47347873", "0.47273436", "0.46018976", "0.45374277", "0.44985", "0.4474104", "0.44217488", "0.44217035", "0.4414562", "0.43916...
0.76936036
0
Create and return a Message object. Lazy gettext function for a given domain, it is a factory method for a project/module to get a lazy gettext function for its own translation domain (i.e. nova, glance, cinder, etc.) Message encapsulates a string so that we can translate it later when needed.
def _lazy_gettext(msg): return Message(msg, domain)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def createMessage( self, *args, **kw ):\n return MailMessage( *args, **kw )", "def install(domain, lazy=False):\r\n if lazy:\r\n # NOTE(mrodden): Lazy gettext functionality.\r\n #\r\n # The following introduces a deferred way to do translations on\r\n # messages in OpenStack...
[ "0.6170995", "0.6077606", "0.6022286", "0.60164195", "0.60164195", "0.5980296", "0.595576", "0.5942685", "0.58777326", "0.5782563", "0.57686394", "0.5751088", "0.5735052", "0.5731552", "0.57014626", "0.5689661", "0.5685707", "0.566268", "0.5620519", "0.559923", "0.55693084", ...
0.81580895
0
Lists the available languages for the given translation domain.
def get_available_languages(domain): if domain in _AVAILABLE_LANGUAGES: return copy.copy(_AVAILABLE_LANGUAGES[domain]) localedir = '%s_LOCALEDIR' % domain.upper() find = lambda x: gettext.find(domain, localedir=os.environ.get(localedir), ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def langs(self, context):\n languages = get_langs(context.message.guild)\n await context.channel.send(LANG_LIST.format(nb_lang=len(languages), langs=enum(languages)))", "def languages():\n r = requests.get('http://translate.yandex.net/api/v1/tr.json/getLangs')\n return r.json['dirs']", ...
[ "0.6588208", "0.64708924", "0.6436626", "0.6404924", "0.63879085", "0.6371736", "0.6343199", "0.6338791", "0.6254754", "0.61821175", "0.6165501", "0.6159573", "0.6158885", "0.6088327", "0.6040539", "0.602944", "0.5906514", "0.58874905", "0.58680695", "0.5818944", "0.5817654",...
0.75461453
0