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 |
|---|---|---|---|---|---|---|
Find the well fractions for GTO observations | def check_gto_wellFracs():
inList = ascii.read('lists/gto_saturation_check.csv')
pdGrism = yaml.load(open('yaml/grism_example.yaml'))
outWell = []
for oneObs in inList:
pdGrism['scene'][0]['spectrum']['normalization']['norm_flux'] = float(oneObs['Kmag'])
pdGrism['scene'][0]['spectru... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_well_depth_image(self):\n rampTime = self.result['information']['exposure_specification']['saturation_time']\n wellFrac = rampTime * self.result['2d']['detector'] / self.fullWell\n \n return wellFrac",
"def abw(og, fg):\n\n oe = sg2plato(og)\n re = real_extract(og, fg)\n... | [
"0.572671",
"0.5690358",
"0.5686861",
"0.5647664",
"0.559538",
"0.5576184",
"0.55691975",
"0.5558908",
"0.5542845",
"0.5529217",
"0.5393365",
"0.53496575",
"0.5326906",
"0.5325143",
"0.53237337",
"0.5273734",
"0.5273734",
"0.52213407",
"0.5204086",
"0.5188169",
"0.5176759",
... | 0.6191586 | 0 |
Given a filename, returns the locale it applies to | def get_language(fn):
# FIXME - this expects the fn to be '.../XX/LC_MESSAGES/messages.po'
return fn.split(os.sep)[-3] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_language_from_file_name(filename: str) -> str:\n return Path(filename).resolve().with_suffix(\"\").name",
"def get_locale():\n return \"he\"",
"def get_localised_file(self, language, filename):\n return os.path.join(\n self.get_localised_dir(language),\n filename\n ... | [
"0.72358316",
"0.67703694",
"0.6676295",
"0.61455345",
"0.61441773",
"0.6122228",
"0.6095614",
"0.60787696",
"0.6077188",
"0.59768355",
"0.5964287",
"0.5899094",
"0.5898608",
"0.58685327",
"0.5831718",
"0.5797318",
"0.5732347",
"0.57126147",
"0.5694869",
"0.56353456",
"0.5634... | 0.7120739 | 1 |
Given a locale dir, returns a list of all .po files in that tree | def get_locale_files(localedir):
po_files = []
for root, dirs, files in os.walk(localedir):
po_files.extend(
[os.path.join(root, fn) for fn in files
if fn.endswith('.po')])
return po_files | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_available_translations(localedir=None):\n\n localedir = localedir or gettext._default_localedir\n\n # usually there are no message files for en\n messagefiles = sorted(glob.glob(localedir + \"/*/LC_MESSAGES/anaconda.mo\") +\n [\"blob/en/blob/blob\"])\n trans_gen = (path... | [
"0.715304",
"0.7075419",
"0.6569268",
"0.636514",
"0.63320595",
"0.62748593",
"0.61004376",
"0.60533893",
"0.6045961",
"0.6020732",
"0.6015324",
"0.59953296",
"0.5983413",
"0.5948179",
"0.591046",
"0.5907473",
"0.58771574",
"0.5862566",
"0.57609594",
"0.5750607",
"0.5743489",... | 0.86774373 | 0 |
Parses .po file and returns completion data for that .po file | def get_completion_data_for_file(fn):
app_to_translations = {}
lang = get_language(fn)
try:
pofile = polib.pofile(fn)
except IOError as ioe:
print 'Error opening file: {fn}'.format(fn=fn)
print ioe.message
return 1
for poentry in pofile:
if poentry.obsolete... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def read_po(self, inputfile):\n is_index = False\n lines = inputfile.readlines()\n index = ''\n value = ''\n for line in lines:\n if line.startswith('#'):\n continue\n elif line.startswith('msgid'):\n is_index = True\n self.translations[index] = value\n index = ... | [
"0.67148054",
"0.59461695",
"0.57656866",
"0.5626472",
"0.54239917",
"0.5400268",
"0.53283405",
"0.5319237",
"0.5230417",
"0.52153844",
"0.51657945",
"0.5162457",
"0.5157852",
"0.5109392",
"0.51073414",
"0.50884837",
"0.50881433",
"0.50701857",
"0.50613",
"0.50596195",
"0.505... | 0.6613015 | 1 |
Merges values from second tree into the first This takes care to add values of the same key where appropriate. | def merge_trees(data, new_data):
for key, val in new_data.items():
if isinstance(val, dict):
if key not in data:
data[key] = new_data[key]
else:
merge_trees(data[key], new_data[key])
else:
if key not in data:
data[k... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def merge(self, a, b, path=None):\n if path is None: path = []\n for key in b:\n if key in a:\n if isinstance(a[key], dict) and isinstance(b[key], dict):\n if key == 'attributes':\n self.merge_attribute_defs(b, a)\n ... | [
"0.73867387",
"0.6935604",
"0.6919466",
"0.6867284",
"0.6860104",
"0.68457955",
"0.6838499",
"0.678527",
"0.67787033",
"0.6766994",
"0.6763959",
"0.67574173",
"0.6741961",
"0.67215466",
"0.6613493",
"0.6566744",
"0.65166056",
"0.6501641",
"0.6485997",
"0.64794993",
"0.6468637... | 0.7092472 | 1 |
Traverses a tree and calculates percents at appropriate levels | def calculate_percents(data):
# calculate the percent for this node if appropriate
if 'translated' in data and 'total' in data:
total = float(data['total'])
translated = float(data['translated'])
data['percent'] = int((100.00 / total) * translated)
# traverse the tree to calculate a... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_percentile_depth(self,percent):\n lengths = []\n for t in self.tree.get_terminals():\n lengths.append(len(self.tree.get_path(t)))\n self.percentile_depth = np.percentile(lengths,percent)",
"def depth_percent(self, depth_percent):\n\n self.container['depth_percent'] ... | [
"0.6781879",
"0.61348087",
"0.6036483",
"0.5997102",
"0.5978927",
"0.5956449",
"0.5921852",
"0.58115125",
"0.57759273",
"0.57759273",
"0.5764222",
"0.5761157",
"0.573205",
"0.5683828",
"0.5659171",
"0.565281",
"0.5652223",
"0.56486857",
"0.5575707",
"0.5568963",
"0.55575",
... | 0.7597541 | 0 |
Given a list of .po files, returns a dict of all completion data | def get_completion_data(locale_files):
data = {}
for fn in locale_files:
new_data = get_completion_data_for_file(fn)
merge_trees(data, new_data)
calculate_percents(data)
return data | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_completion_data_for_file(fn):\n app_to_translations = {}\n\n lang = get_language(fn)\n\n try:\n pofile = polib.pofile(fn)\n except IOError as ioe:\n print 'Error opening file: {fn}'.format(fn=fn)\n print ioe.message\n return 1\n\n for poentry in pofile:\n i... | [
"0.7264206",
"0.6257899",
"0.59265995",
"0.5871068",
"0.5800909",
"0.5743992",
"0.557618",
"0.5566966",
"0.5561954",
"0.5559486",
"0.5511781",
"0.5445948",
"0.5437604",
"0.54354066",
"0.54237103",
"0.54148847",
"0.5393",
"0.5385633",
"0.53724873",
"0.536288",
"0.53408545",
... | 0.7331883 | 0 |
Calculates one Euler step for the Izhikevich neuron. | def euler_forward(self, u, v, I):
# The constants 0.04, 5, 140 are the one fits all parameters from Simple Model of Spiking Neurons E. Izhikevich.
# These constants are justified when simulating large networks of neurons.
# TODO: Parameterise the four constants 0.04, 5, 140.
_v = v + sel... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def euler_step(u, f, dt):\n \n return u + dt * f(u)",
"def euler_step(u, t, f, dt):\n \n return u + dt * f(u,t)",
"def euler_timestep(x, u, timestep):\r\n return (x + timestep * u).astype('float')",
"def eulerphi(n):\r\n\treturn euler_phi(n)",
"def eulerphi(n):\n\treturn euler_phi(n)",
"de... | [
"0.7010102",
"0.671609",
"0.6490144",
"0.6257486",
"0.62208086",
"0.6204299",
"0.61506695",
"0.6087525",
"0.6081337",
"0.60573834",
"0.5954343",
"0.59101236",
"0.5862761",
"0.5837766",
"0.58035856",
"0.5754436",
"0.5704458",
"0.56292146",
"0.5620163",
"0.5564086",
"0.5561778"... | 0.67170453 | 1 |
Calculates the spike train produced by the external current. | def get_spike_trains(self, current=None):
# For compability with sciunit as many spike trains are generated as there exists ground truth observations
spike_trains = []
if current:
self.set_external_current(current)
self.simulate(T_max=TMAX)
voltage_trial = self.v
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fit(self, spike_times, input_current, window, dt):\n spks_in_window = self._get_spikes_in_window(spike_times, window, dt)\n\n # Compute and store summary metrics.\n ISIs = [np.diff(x) for x in spks_in_window]\n self.CV = [x.std() / x.mean() if len(x) > 0 else 0 for x in ISIs]\n\n ... | [
"0.5946974",
"0.5928832",
"0.59220827",
"0.5873604",
"0.5820528",
"0.5808362",
"0.5796341",
"0.57842207",
"0.57663137",
"0.5754062",
"0.5754062",
"0.5754062",
"0.5754062",
"0.5754062",
"0.57429945",
"0.57381624",
"0.5706361",
"0.57013875",
"0.5698591",
"0.5619772",
"0.5617287... | 0.6869489 | 0 |
This function reads a cDNA file into a dictionary. | def read_cDNA_file_to_dict(filename):
#initialize dictionary
cDNA_dictionary = {}
#open file
with open(cDNA_file) as f:
#loop through file line by line
for line in f:
#remove newline
line = line.rstrip()
#get gene name
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def read_fasta(fasta_file):\n\n seq_dict = dict() # Declare a new dictionary\n\n with open(fasta_file,'r') as f:\n lines = f.readlines()\n defline = \"\"\n for li in lines:\n li = li.rstrip() # remove newlines\n if '>' in li:\n defline = li # if i use... | [
"0.73520845",
"0.7311494",
"0.7293495",
"0.7289216",
"0.7001016",
"0.69862384",
"0.6984554",
"0.6928176",
"0.6903437",
"0.6880591",
"0.686282",
"0.68146276",
"0.6766541",
"0.6742158",
"0.6703688",
"0.66834295",
"0.6666098",
"0.664703",
"0.66463274",
"0.6628158",
"0.6625318",
... | 0.8629482 | 0 |
break the ASCII message into a 64bit (16 hex bytes) words | def getHexwords(msg):
hexwords = []
for i in range(0, len(msg), 8):
msgBlock = msg[i:i+8]
m = stringToHex(msgBlock)
hexwords.append(m)
last = hexwords[-1]
hexwords[-1] += ''.join(['0'] * (16-len(last)))
return hexwords | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def bytes2words(data, length=8):\n return(np.fromstring(data, dtype=np.uint64))",
"def hexlify(self: str, verbose=False):\n nbytes = len(_chunk_bs(self))\n buf = b''\n strlen = ''\n for b in to_bytes(_chunk_bs(self)):\n buf+=b\n# for s in _from_list(_chunk_bs(self)):\n# strlen+=f'... | [
"0.6075862",
"0.5940788",
"0.59226835",
"0.58748376",
"0.58517516",
"0.5834127",
"0.57397085",
"0.5737568",
"0.5706216",
"0.5675195",
"0.5631814",
"0.5630442",
"0.5611233",
"0.5598934",
"0.55579466",
"0.55575067",
"0.5536068",
"0.5521853",
"0.5519781",
"0.5496311",
"0.5496129... | 0.69092196 | 0 |
Initialize webContent for firsttime use | def initializeWebContent(WebContent):
if not WebContent.query.first():
importCSV = open(
"main_app/WebContent_Example_Settings.csv",
"r",
)
for row in importCSV:
column = row.split(",")
webContent = WebContent(
sectionName=colum... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def init_page_elements(self):\n pass",
"def __init__(self, web_dir, title, refresh=0):\n self.title = title\n self.web_dir = web_dir\n os.makedirs(self.web_dir, exist_ok=True)\n self.doc = dominate.document(title=title)\n if refresh > 0:\n with self.doc.head:\... | [
"0.6685005",
"0.6411956",
"0.632039",
"0.6290268",
"0.6231442",
"0.6206955",
"0.61340904",
"0.60591406",
"0.60273194",
"0.60273194",
"0.60273194",
"0.60273194",
"0.60273194",
"0.60273194",
"0.60273194",
"0.60273194",
"0.60273194",
"0.60273194",
"0.60273194",
"0.60273194",
"0.... | 0.68860084 | 0 |
This function creates a dictionary for webContent data stored in the database. | def getWebContent(WebContent):
webContentDB = WebContent.query.all()
webContent = {}
for content in webContentDB:
if content.sectionName in webContent:
# print("sectionName found: ", content.sectionName)
if content.contentName in webContent[content.sectionName]:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _build_db_data(self):\n self.logger.debug('Bulding task db document.')\n db_data = {}\n db_data.update(self.query)\n db_data['condition'] = False\n db_data['records'] = []\n self.db_collection.insert_one(db_data)\n return db_data",
"def get_keyword_dict(url):\... | [
"0.61669624",
"0.6133241",
"0.59914696",
"0.59557307",
"0.59140056",
"0.59094316",
"0.58244437",
"0.58161587",
"0.57899266",
"0.5753575",
"0.57071376",
"0.5663416",
"0.5654436",
"0.56483734",
"0.5648127",
"0.56415564",
"0.56415564",
"0.56408906",
"0.561976",
"0.5562609",
"0.5... | 0.73326635 | 0 |
returns the list of all available Assignments for the user ordered first with the opened Assignments and after that the closed Assignments | def get_assignments_ordered() -> list:
user_assignments = Assignment.query.all() if current_user.is_admin else current_user.classgroup.assignments
open_assignments = [x for x in user_assignments if not x.expired]
closed_assignments = [x for x in user_assignments if x.expired]
return open_assignments + c... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_all(self):\n return gnome_sort(self.__assignments, sort_function=lambda assignment_a, assignment_b: assignment_a.get_assignment_id() <= assignment_b.get_assignment_id())",
"def fetch_current_user_assignments(s):",
"def get_assignments(self) -> List :\n return self.assignments",
"def get_ass... | [
"0.64117813",
"0.6328831",
"0.59946954",
"0.59253955",
"0.5776345",
"0.5639999",
"0.5586405",
"0.5513792",
"0.5512011",
"0.5512011",
"0.5407128",
"0.53931355",
"0.5333514",
"0.5179123",
"0.51572895",
"0.51365405",
"0.51161677",
"0.5094304",
"0.50590956",
"0.50582683",
"0.5046... | 0.78587586 | 0 |
Performs an authentication using either the private token, or the username/password pair. The user attribute will hold a CurrentUser object on success. | def auth(self):
ok = False
if self.private_token:
ok = self.token_auth()
if not ok:
self.credentials_auth() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def authenticate(self):\n #it's weird i have to do this here, but the code makes this not simple\n auth_json={'email':self.user, 'password':self.password}\n #send a post with no auth. prevents an infinite loop\n auth_response = self.post('/auth', data = json.dumps(auth_json), auth =\n ... | [
"0.722709",
"0.70916885",
"0.6988652",
"0.6988652",
"0.6909717",
"0.6818285",
"0.6804313",
"0.67606723",
"0.66913086",
"0.664361",
"0.66054755",
"0.66023993",
"0.6555029",
"0.65524256",
"0.6513868",
"0.6494089",
"0.64777535",
"0.6474295",
"0.6428449",
"0.6426741",
"0.64157885... | 0.74369997 | 0 |
Get the components of the PCA which are the score and the ladings | def getpara(pca, normalized):
scores = pca.transform(normalized)
loadings = pca.components_
scores = pd.DataFrame(scores, index=normalized.index, columns=[str(i) for i in range(pca.n_components_)])
loadings = pd.DataFrame(loadings, index=[str(i) for i in range(pca.n_components_)], columns=normalized.co... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_pca():\n from sklearn.decomposition import PCA\n return PCA()",
"def pca(self):\n self.pca_mean = self.X.mean(axis=1)\n X_meanC = self.X - self.pca_mean[:, None]\n (self.pca_U, self.pca_S, self.pca_V) = np.linalg.svd(X_meanC, full_matrices=False)\n self.pc_weights = np.d... | [
"0.6714376",
"0.6601578",
"0.65530044",
"0.64918506",
"0.6447218",
"0.6399657",
"0.6395391",
"0.6339005",
"0.63169724",
"0.62718177",
"0.61937666",
"0.6188977",
"0.6180121",
"0.6169277",
"0.61550593",
"0.61506516",
"0.60975885",
"0.6075814",
"0.6066212",
"0.6037378",
"0.60040... | 0.70869935 | 0 |
Extract a Serie from a big dataframe To avoid memmory problems | def extractserie(filename, colname):
values = []
indexes =[]
chunksize = 1000
for i, chunk in enumerate(pd.read_csv(filename, chunksize=chunksize, sep=';', encoding='latin1')):
print(i)
values.append(chunk.loc[:, colname])
# indexes.append(chunk.index)
print('check1')
df_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def station_stats(df):",
"def getObjectComponents(df):\n return df.loc[getObjectComponentIndexes(df)]",
"def series_from_dataframe(df, index_column: str, value_column: str=None):\n\n if len(df.columns) > 2:\n df = df[[index_column, value_column]].copy()\n else:\n df = df.copy()\n df.s... | [
"0.60018545",
"0.56795555",
"0.5634045",
"0.55751365",
"0.5532231",
"0.55117774",
"0.54565835",
"0.5448218",
"0.5431247",
"0.5362524",
"0.52935916",
"0.5289045",
"0.52884555",
"0.5279789",
"0.5277763",
"0.5253255",
"0.52410376",
"0.5217044",
"0.52060676",
"0.52034706",
"0.520... | 0.5817701 | 1 |
Get upper andlower quantile of dataframe | def getquantile(df, low=0.1, high=0.9):
q1 = df.quantile(low)
q3 = df.quantile(high)
print(q1)
print(q3)
return df[df<q1],df[df>q3] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def Quartiles(data):\n q = np.percentile(data, [25, 50, 75])\n\n return q[0], q[1], q[2]",
"def quartile(db: pd.DataFrame, col: str) -> pd.DataFrame:\n _, bins = pd.qcut(x=db[col],\n q=[0.25, 0.75], # [0.0, 0.25, 0.5, 0.75, 1.0],\n retbins=True, duplicates='dro... | [
"0.7058964",
"0.69517267",
"0.69203097",
"0.6902817",
"0.6843194",
"0.6779333",
"0.6776067",
"0.66477454",
"0.6614946",
"0.6611694",
"0.6608562",
"0.65918976",
"0.6586586",
"0.657616",
"0.6555758",
"0.6514577",
"0.6505057",
"0.6477352",
"0.6468778",
"0.6468122",
"0.6463169",
... | 0.77326363 | 0 |
Find the common element of two list | def common_elements(list1, list2):
result = []
for element in list1:
if element in list2:
result.append(element)
return result | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def common_items(self, list1, list2):\n common_list = [value for value in list1 if value in list2]\n print(\"Common elements from both lists\")\n print(common_list)",
"def common_elements(s1, s2):\n\n return set(s1 & s2)",
"def common_member(lst1, lst2):\n for i in lst1:\n for... | [
"0.78554016",
"0.74775904",
"0.7394922",
"0.737992",
"0.73571146",
"0.73563135",
"0.73114115",
"0.729555",
"0.7272055",
"0.72601426",
"0.7096697",
"0.7094079",
"0.7052948",
"0.70486367",
"0.7030626",
"0.7004853",
"0.70036983",
"0.697852",
"0.6972796",
"0.69636726",
"0.6962632... | 0.79831666 | 0 |
Fonts have consistent Units Per Em? | def com_adobe_fonts_check_family_consistent_upm(ttFonts):
upm_set = set()
for ttFont in ttFonts:
upm_set.add(ttFont['head'].unitsPerEm)
if len(upm_set) > 1:
yield FAIL,\
Message("inconsistent-upem",
f"Fonts have different units per em: {sorted(upm_set)}.")... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def GetMeasuringFont(self):\r\n\r\n return self._measuring_font",
"def GetMeasuringFont(self):\r\n\r\n return self._measuring_font",
"def useUnits():",
"def test_the_same_encodings_of_glyphs_across_family(self):\n encoding = None\n for font_metadata in self.familymetadata.fonts:\n... | [
"0.6498324",
"0.6498324",
"0.6270842",
"0.60312843",
"0.60043776",
"0.5991756",
"0.59501827",
"0.59288883",
"0.59099555",
"0.59099555",
"0.5885162",
"0.58398443",
"0.5838937",
"0.5837152",
"0.5792411",
"0.5785108",
"0.5779795",
"0.5773365",
"0.5746863",
"0.5730017",
"0.573001... | 0.6842595 | 0 |
This is meant to be a quickanddirty test to see if a glyph is empty. Ideally we'd use the glyph_has_ink() method for this, but for a family of large CJK CFF fonts with tens of thousands of glyphs each, it's too slow. | def _quick_and_dirty_glyph_is_empty(font, glyph_name):
if 'glyf' in font:
glyph = font['glyf'][glyph_name]
if not glyph.isComposite():
if glyph.numberOfContours == 0:
return True
return False
elif 'CFF2' in font:
top_dict = font['CFF2'].cff.topDictInde... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_empty(self) -> bool:\n return self._start_symbol not in self.get_generating_symbols()",
"def com_adobe_fonts_check_find_empty_letters(ttFont):\n cmap = ttFont.getBestCmap()\n passed = True\n\n # http://unicode.org/reports/tr44/#General_Category_Values\n letter_categories = {\n 'L... | [
"0.7208356",
"0.70942694",
"0.67696595",
"0.6753493",
"0.67274374",
"0.6722678",
"0.66682",
"0.66682",
"0.6659372",
"0.6646585",
"0.66306794",
"0.6609911",
"0.6605314",
"0.6596777",
"0.6595461",
"0.6594335",
"0.6594196",
"0.6594196",
"0.6594196",
"0.6594196",
"0.6594196",
"... | 0.8758482 | 0 |
Letters in font have glyphs that are not empty? | def com_adobe_fonts_check_find_empty_letters(ttFont):
cmap = ttFont.getBestCmap()
passed = True
# http://unicode.org/reports/tr44/#General_Category_Values
letter_categories = {
'Ll', 'Lm', 'Lo', 'Lt', 'Lu',
}
invisible_letters = {
0x115F, 0x1160, 0x3164, 0xFFA0, # Hangul filler... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def com_google_fonts_check_047(ttFont, missing_whitespace_chars):\n if missing_whitespace_chars != []:\n yield FAIL, (\"Whitespace glyphs missing for\"\n \" the following codepoints:\"\n \" {}.\").format(\", \".join(missing_whitespace_chars))\n else:\n yield PASS, \"Font con... | [
"0.65865105",
"0.65865105",
"0.64539105",
"0.6359933",
"0.6359933",
"0.62827164",
"0.6174377",
"0.61350894",
"0.6119825",
"0.6071575",
"0.6071575",
"0.60459805",
"0.6023552",
"0.60192025",
"0.5954681",
"0.59517604",
"0.59517604",
"0.5950742",
"0.59395266",
"0.59394217",
"0.59... | 0.77460766 | 0 |
First row of Updated splits has start value of 0 | def test_update_splits():
assert new_log.iloc[0]['start'] == 0 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def OldStartingIndex(self) -> int:",
"def prevSplit(self):\n pass",
"def NewStartingIndex(self) -> int:",
"def refresh( self ):\n\n def get_bucket( line_spec,value ):\n if not self.has_column(value.column_name):\n self.add_column(Column(name=value.column_name))\n ... | [
"0.6303802",
"0.6049807",
"0.5762687",
"0.55552834",
"0.54961044",
"0.54618585",
"0.5458135",
"0.54075414",
"0.5405218",
"0.5381889",
"0.53662956",
"0.5346535",
"0.5288801",
"0.52531475",
"0.5250441",
"0.52362436",
"0.522956",
"0.52265674",
"0.5144676",
"0.5139834",
"0.511055... | 0.7183041 | 0 |
aud_from_log behaves the same, regardless of index values | def test_aud_from_log_ignores_index():
assert True | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def log(a):",
"def event_based_log_a(value):\n\n # significant difference between readings\n threshold = 0.1\n\n # if the readings are steady, we want to measure slowly\n regular_meas_interval = \"00:15:00\"\n\n # if there is a significant difference, we want to measure more frequently\n fast_m... | [
"0.58837754",
"0.56698364",
"0.55805284",
"0.5411854",
"0.5366024",
"0.5363531",
"0.53232753",
"0.53180903",
"0.52797824",
"0.52729416",
"0.5268474",
"0.5255628",
"0.5253176",
"0.5221653",
"0.5212596",
"0.51727664",
"0.51727664",
"0.5171099",
"0.51586556",
"0.51553607",
"0.51... | 0.75710076 | 0 |
Proceeding gap is invariant to row order | def test_insert_gaps_order_invariant():
gaps1 = insert_gaps(log)
gaps2 = insert_gaps(log.iloc[[1,0]])
get_gaps = lambda x: x[x['name'] == 'gap']['length'].reset_index(drop=True)
assert (get_gaps(gaps1) == get_gaps(gaps2.iloc[::-1])).all() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_gaps( rows ):\n\n n = len(rows) - 1\n gaps = [ rows[i+1][0]-rows[i][1] for i in range(n) ]\n return gaps",
"def gaps(df):\n return [(round(df[i][\"o\"] - df[i - 1][\"c\"], 2)) for i in range(1, len(df))]",
"def __addNextRow(row, start, finish, data):\n if row == data.n:\n data.set... | [
"0.6917875",
"0.63974816",
"0.6268827",
"0.61886567",
"0.60424745",
"0.59512144",
"0.58186567",
"0.5753591",
"0.573413",
"0.57067263",
"0.5675107",
"0.56580997",
"0.5625126",
"0.5586148",
"0.55795914",
"0.55538464",
"0.55336237",
"0.55005985",
"0.5492634",
"0.54652417",
"0.54... | 0.7005421 | 0 |
Scale the filters accordingly to (multiplier, base). | def _scale_filters(filters, multiplier, base=8):
round_half_up = int(int(filters) * multiplier / base + 0.5)
result = int(round_half_up * base)
return max(result, base) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def scale(self, factor):\n self.b = factor * self.b",
"def scale_bases(bases, scaling_parameters):\n\n assert len(bases) == len(scaling_parameters) + 1\n\n logging.info('Scaling bases')\n\n b_sp_iter = zip(bases[:-1], scaling_parameters)\n\n new_bases = [b * sp['scale'] for b, sp in b_sp_iter]... | [
"0.6305586",
"0.62127304",
"0.60260546",
"0.60222226",
"0.5967723",
"0.59608346",
"0.5918966",
"0.59137255",
"0.59087425",
"0.5860667",
"0.58430034",
"0.5828087",
"0.58186597",
"0.5817398",
"0.58163357",
"0.580947",
"0.5784985",
"0.5756188",
"0.57544243",
"0.5730007",
"0.5701... | 0.8387624 | 0 |
Inverted bottleneck layer without the first 1x1 expansion convolution. | def _inverted_bottleneck_no_expansion(x,
filters,
activation_fn=tf.nn.relu6,
kernel_size=3,
strides=1,
use_se=False,
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def conv_backward_naive(dout, cache):\n dx, dw, db = None, None, None\n ###########################################################################\n # TODO: Implement the convolutional backward pass. #\n ###########################################################################... | [
"0.62135154",
"0.6089795",
"0.6089768",
"0.593624",
"0.58924824",
"0.5860757",
"0.58606637",
"0.5848816",
"0.58145773",
"0.5809656",
"0.5793639",
"0.56659687",
"0.56395704",
"0.5616862",
"0.55927134",
"0.5589929",
"0.5589029",
"0.55877304",
"0.55786616",
"0.55780774",
"0.5561... | 0.66171896 | 0 |
Tucker convolution layer (generalized bottleneck). | def _tucker_conv(x,
filters,
activation_fn=tf.nn.relu6,
kernel_size=3,
input_rank_ratio=0.25,
output_rank_ratio=0.25,
strides=1,
residual=True,
normalization_op_params=None):
if n... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def clConvolution(self, size, mask):",
"def TCN(input_dim): \r\n # Number of dilations in order to use for the temporal blocks.\r\n dilations = np.array([1, 2, 4, 8, 16, 32])\r\n\r\n input_dim.insert(0,1)\r\n print(f\"input_dim: {input_dim}\")\r\n input_layer = Input(shape=input_dim)\r\n croppi... | [
"0.63552445",
"0.6157616",
"0.6142197",
"0.59835434",
"0.5962057",
"0.59608597",
"0.59307116",
"0.5929765",
"0.58995163",
"0.5861103",
"0.5851162",
"0.5849794",
"0.58290553",
"0.5823188",
"0.581777",
"0.5800905",
"0.57888544",
"0.5770666",
"0.57636654",
"0.572194",
"0.5719529... | 0.6874727 | 0 |
Return the Laplacian matrix of a graph. | def get_laplacian(adjacency: sparse.csr_matrix) -> sparse.csr_matrix:
weights = adjacency.dot(np.ones(adjacency.shape[0]))
return sparse.diags(weights) - adjacency | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def generate_graph_laplacian(A):\r\n\r\n #Create symmetric matrix\r\n #A=0.5* (A+ A.T)\r\n \r\n #D is just the identity matrix (because sum(P)=1)\r\n Degree=np.sum(A,1)\r\n D=np.diag(Degree)\r\n \r\n #Laplacian matrix\r\n L=D-A\r\n return L",
"def LaplacianMatrix(adjmatrix):... | [
"0.7361109",
"0.7281358",
"0.7034393",
"0.6867382",
"0.6839834",
"0.6679743",
"0.6462736",
"0.6272242",
"0.618237",
"0.618237",
"0.61405194",
"0.6097265",
"0.6002928",
"0.5974012",
"0.5950377",
"0.5923095",
"0.5923095",
"0.5892518",
"0.5891382",
"0.5881883",
"0.58397967",
"... | 0.72841907 | 1 |
Get all snmp objects | def get_all(isvgAppliance, check_mode=False, force=False):
return isvgAppliance.invoke_get("Get all snmp objects",
"/rsp_snmp_objs") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get(self, oids):\n return self.snmpProxy.get(oids,\n self.snmpConnInfo.zSnmpTimeout,\n self.snmpConnInfo.zSnmpTries)",
"def select_all_mip_objects():\n\n for mip in Mip.objects.all():\n print mip",
"def all(self):\n ... | [
"0.6295117",
"0.6184468",
"0.6140432",
"0.6140432",
"0.6140432",
"0.6140432",
"0.6140432",
"0.6140432",
"0.6138671",
"0.61100274",
"0.6104036",
"0.60216576",
"0.5947183",
"0.58934385",
"0.5891261",
"0.58744675",
"0.58430845",
"0.5831381",
"0.5828711",
"0.5821826",
"0.578006",... | 0.7338134 | 0 |
Get a specific snmp object | def get(isvgAppliance, uuid, check_mode=False, force=False):
return isvgAppliance.invoke_get("Get a specific snmp object",
"/rsp_snmp_objs/{0}".format(uuid)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get(self, oids):\n return self.snmpProxy.get(oids,\n self.snmpConnInfo.zSnmpTimeout,\n self.snmpConnInfo.zSnmpTries)",
"def snmp_get(self, oid):\n\n errorIndication, errorStatus, errorIndex, varBinds = next(\n getCmd(... | [
"0.7529217",
"0.7213121",
"0.6652757",
"0.659671",
"0.6498105",
"0.63328505",
"0.6052949",
"0.60334074",
"0.6011221",
"0.59883666",
"0.59045464",
"0.5899793",
"0.58816385",
"0.58224565",
"0.579061",
"0.56844294",
"0.5611613",
"0.5564969",
"0.5542661",
"0.5541574",
"0.55342543... | 0.7374536 | 1 |
Add a snmp object | def add(isvgAppliance, name, trapAddress, trapCommunity, trapNotificationType=None, trapVersion='V1', trapPort=162,
objType='snmp', username=None, authEnabled=None, authType=None, authPassPhrase=None, privEnabled=None,
privType=None, privPassPhrase=None, informSnmpEngineID=None, informTimeout=None, comm... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __add_snmp_management(self, tag, address,\n port_num=\"161\", auth_string=\"community\"):\n manage = etree.SubElement(tag, \"management\", type=\"snmp\")\n addr = etree.SubElement(manage, \"address\")\n addr.text = address\n port = etree.SubElement(manag... | [
"0.63178045",
"0.6082493",
"0.6019915",
"0.596138",
"0.59592867",
"0.59592867",
"0.59592867",
"0.59592867",
"0.59592867",
"0.59592867",
"0.59592867",
"0.59592867",
"0.5879775",
"0.5879775",
"0.58250785",
"0.58250785",
"0.5749959",
"0.5714942",
"0.5574149",
"0.5565817",
"0.554... | 0.71308666 | 0 |
Update a specific snmp object | def update(isvgAppliance, uuid, name, trapAddress, trapCommunity, trapNotificationType=None, trapVersion='V1',
trapPort=162, objType='snmp', username=None, authEnabled=None, authType=None, authPassPhrase=None,
privEnabled=None, privType=None, privPassPhrase=None, informSnmpEngineID=None, informTim... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_object(self, name: str) -> None:",
"def updateItem(self, object):\n pass",
"def update_object(self, name: str) -> None:\n try:\n object = Object.from_name(name)\n except Object.NotFound as error:\n log.warning(f'Cannot add new objects using TNSQueryManager'... | [
"0.6375592",
"0.6199039",
"0.61481917",
"0.6096296",
"0.6095698",
"0.59718704",
"0.5958295",
"0.59453654",
"0.58640176",
"0.58598524",
"0.57817835",
"0.57305294",
"0.5719775",
"0.5719775",
"0.5719775",
"0.5719775",
"0.5719425",
"0.5716001",
"0.5668945",
"0.5667492",
"0.565886... | 0.666451 | 0 |
Compare snmp objects between two appliances | def compare(isvgAppliance1, isvgAppliance2):
ret_obj1 = get_all(isvgAppliance1)
ret_obj2 = get_all(isvgAppliance2)
for obj in ret_obj1['data']['snmpObjects']:
del obj['uuid']
for obj in ret_obj2['data']['snmpObjects']:
del obj['uuid']
return ibmsecurity.utilities.tools.json_compare... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def compare(isamAppliance1, isamAppliance2):\n ret_obj1 = get_all(isamAppliance1)\n ret_obj2 = get_all(isamAppliance2)\n\n return tools.json_compare(ret_obj1, ret_obj2, deleted_keys=[])",
"def compare(isamAppliance1, isamAppliance2):\n ret_obj1 = get_all(isamAppliance1)\n ret_obj2 = get_all(isamAp... | [
"0.6843558",
"0.6843558",
"0.68048644",
"0.6677407",
"0.65991956",
"0.6346593",
"0.6163811",
"0.57372975",
"0.5689148",
"0.55918074",
"0.5501179",
"0.5450728",
"0.54135436",
"0.5392775",
"0.5339265",
"0.5245765",
"0.5220405",
"0.52153987",
"0.5164473",
"0.51551235",
"0.514899... | 0.7543021 | 0 |
Initialize the user's bank account details. | def __init__(self, bank_name, account_num, balance):
self._bank_name = bank_name
self._account_num = account_num
self._balance = balance | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self):\n self.__account_number = self.__generate_acct_number()\n self.__account_pin = self.__generate_pin()\n self.card_number = BankAccount.BIN + self.__account_number \\\n + self.__calculate_checksum(BankAccount.BIN + self.__account_number)\n self.__balance = 0... | [
"0.7241929",
"0.6872748",
"0.66344535",
"0.66015023",
"0.6580289",
"0.6542164",
"0.64426255",
"0.64356387",
"0.6431768",
"0.64041346",
"0.6368054",
"0.6367499",
"0.6365742",
"0.6344973",
"0.6334896",
"0.63194376",
"0.62900966",
"0.62642276",
"0.62319744",
"0.6179763",
"0.6171... | 0.6877421 | 1 |
Get prefix string for two strings | def get_prefix(cls, string1, string2):
prefix = ""
for i in range(min(len(string1), len(string2))):
if string1[i] == string2[i]:
prefix += string1[i]
else:
return prefix
return prefix | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_shared_prefix(word1: str, word2: str) -> str:\n shared_prefix = \"\"\n for char1, char2 in zip(word1, word2):\n if char1 == char2:\n shared_prefix += char1\n else:\n break\n return shared_prefix",
"def common_prefix(s1, s2):\n if not s1 or not s2:\n ... | [
"0.8103269",
"0.74005544",
"0.70454293",
"0.7013807",
"0.6962554",
"0.6876404",
"0.67749685",
"0.677017",
"0.67191875",
"0.6713069",
"0.6652531",
"0.6627867",
"0.6519276",
"0.65062493",
"0.6503414",
"0.6471801",
"0.6465757",
"0.6414279",
"0.64046407",
"0.6403216",
"0.63862455... | 0.8606351 | 0 |
Check if the two strings have any prefix in common | def has_prefix(cls, string1, string2):
return len(cls.get_prefix(string1, string2)) > 0 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def equalPrefix(self, other):\n return self.prefix.strip().upper() == other.prefix.strip().upper() and \\\n self.suffix.strip().upper() == other.suffix.strip().upper()",
"def get_shared_prefix(word1: str, word2: str) -> str:\n shared_prefix = \"\"\n for char1, char2 in zip(word1, word2... | [
"0.8014959",
"0.7737291",
"0.7647793",
"0.75641924",
"0.752911",
"0.71241945",
"0.7101313",
"0.70341134",
"0.7014249",
"0.6991727",
"0.69884753",
"0.68824863",
"0.68735",
"0.6825838",
"0.68157184",
"0.6796857",
"0.67696387",
"0.6761794",
"0.6752686",
"0.6721839",
"0.67184365"... | 0.83436626 | 0 |
test that adding a sdram resource to a resoruce container works correctly | def test_sdram(self):
sdram = SDRAMResource(128 * (2**20))
self.assertEqual(sdram.get_value(), 128 * (2**20))
sdram = SDRAMResource(128 * (2**19))
self.assertEqual(sdram.get_value(), 128 * (2**19))
sdram = SDRAMResource(128 * (2**21))
self.assertEqual(sdram.get_value(), 1... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_resource_container(self):\n sdram = SDRAMResource(128 * (2**20))\n dtcm = DTCMResource(128 * (2**20) + 1)\n cpu = CPUCyclesResource(128 * (2**20) + 2)\n\n container = ResourceContainer(dtcm, sdram, cpu)\n self.assertEqual(container.sdram.get_value(), 128 * (2**20))\n ... | [
"0.737539",
"0.6306135",
"0.6083565",
"0.604649",
"0.60093606",
"0.5965922",
"0.59655774",
"0.59527063",
"0.58696723",
"0.5852464",
"0.58522576",
"0.58402056",
"0.58313215",
"0.57675797",
"0.573628",
"0.5724731",
"0.5675911",
"0.5656183",
"0.5639416",
"0.5637677",
"0.5635275"... | 0.6665227 | 1 |
test that adding a cpu resource to a resoruce container works correctly | def test_cpu(self):
cpu = CPUCyclesResource(128 * (2**20))
self.assertEqual(cpu.get_value(), 128 * (2**20))
cpu = CPUCyclesResource(128 * (2**19))
self.assertEqual(cpu.get_value(), 128 * (2**19))
cpu = CPUCyclesResource(128 * (2**21))
self.assertEqual(cpu.get_value(), 128... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_resource_container(self):\n sdram = SDRAMResource(128 * (2**20))\n dtcm = DTCMResource(128 * (2**20) + 1)\n cpu = CPUCyclesResource(128 * (2**20) + 2)\n\n container = ResourceContainer(dtcm, sdram, cpu)\n self.assertEqual(container.sdram.get_value(), 128 * (2**20))\n ... | [
"0.70040923",
"0.61487305",
"0.6085243",
"0.6074056",
"0.6044571",
"0.60291135",
"0.60044336",
"0.5970007",
"0.5949127",
"0.5937202",
"0.58982515",
"0.5870926",
"0.5828455",
"0.5820654",
"0.58098066",
"0.57981443",
"0.57495105",
"0.5676899",
"0.56636506",
"0.56561136",
"0.564... | 0.6987524 | 1 |
Get Magen User mongo collection | def get_collection(self):
mongo_id_db = IdDatabase.get_iddb_instance()
return mongo_id_db.magen_user | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_collection(self):\n db = self._get_db()\n return getattr(db, global_settings.MONGODB_COLLECTION)",
"def get_collection(cls):\n return mongo_db[cls.__collection__]",
"def _get_collection(self) -> Any:\n return self.anki.Collection(self.db_location, log=True)",
"def collect... | [
"0.66875654",
"0.6476266",
"0.63175386",
"0.6304807",
"0.62353045",
"0.6183402",
"0.5921672",
"0.5908037",
"0.5866713",
"0.5853938",
"0.5829096",
"0.5775794",
"0.5743159",
"0.5734664",
"0.57274604",
"0.57215816",
"0.5696761",
"0.5676783",
"0.566661",
"0.56338555",
"0.56309885... | 0.8253174 | 0 |
Gets each tensor along a particular axis of t1, perform elementwise multiplication of those slices with t2 and returns the resulting matricies stacked. | def axis_element_wise_multiplication(t1, t2, which_axis):
# assert len(K.int_shape(t1)) == len(K.int_shape(t2)) + 1, "rank(t1) should be rank(t2) + 1"
slices = tf.unstack(t1, axis=which_axis)
# assert K.int_shape(slices[0]) == K.int_shape(t2), "Slices of t1 were not the same shape as t2"
multiplies = []... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def tensor_outer_product(tensor1, tensor2):\n shape_1 = tensor1.shape\n shape_2 = tensor2.shape\n s1 = len(shape_1)\n s2 = len(shape_2)\n \n shape_1 = shape_1 + (1, )*s2\n shape_2 = (1, )*s1 + shape_2\n return np.reshape(tensor1, shape_1) * np.reshape(tensor2, shape_2)",
"def product_on_b... | [
"0.6681546",
"0.65422964",
"0.6529",
"0.64389604",
"0.6426006",
"0.64031273",
"0.63606447",
"0.6165386",
"0.6092945",
"0.6063823",
"0.60503554",
"0.60468453",
"0.5990678",
"0.5987892",
"0.59782016",
"0.5930094",
"0.59217334",
"0.59072626",
"0.58531284",
"0.58524007",
"0.57787... | 0.7647763 | 0 |
Test client detail view | def test_client_detail(self):
response = self.client.get(reverse('targetadmin:client-detail',
args=[self.test_client.pk]))
self.assertStatusCode(response, 200)
client = response.context['client']
self.assertEqual(client.name, 'mockclient')
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_client_card_view(self):\r\n response = self.test_client.get(\r\n reverse('client_card', kwargs={'pk': self.client1_id}))\r\n self.assertEqual(response.status_code, 200)\r\n self.assertEqual(\r\n self.client1.get_client_data(), response.context['client'])\r\n\r\n ... | [
"0.74119246",
"0.7249144",
"0.724762",
"0.71007204",
"0.700989",
"0.6966953",
"0.6966919",
"0.69577324",
"0.6906973",
"0.6882566",
"0.684884",
"0.68412864",
"0.68372315",
"0.68264425",
"0.6803692",
"0.6766485",
"0.6764969",
"0.6728915",
"0.66973937",
"0.6674482",
"0.66736233"... | 0.76748925 | 0 |
The inverse of a diagonal matrix is just the reciprocal of each of its diagonal elements | def diag_inv(A):
return diag(1. / diag(A)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def inverse(self):\n # find the determinant of the matrix\n determinant = self.determinant()\n # find the matrix of minors of the matrix\n matrix_of_minors = self.matrix_of_minors()\n # find the cofactor of the matrix of minors\n cofactor_matrix = self.cofactor_matrix(matr... | [
"0.7514297",
"0.7467738",
"0.7400105",
"0.7307104",
"0.7299538",
"0.7280765",
"0.72439235",
"0.72015333",
"0.71566224",
"0.7144356",
"0.714121",
"0.7131086",
"0.7122124",
"0.7111445",
"0.7071807",
"0.70510703",
"0.7049688",
"0.70124006",
"0.6998528",
"0.6991911",
"0.69906116"... | 0.7711026 | 0 |
returns shortest distance between a and b under mod m | def dist_mod(m, a, b):
diff = abs(a-b)
if diff < m/2:
return diff
else:
return m - diff | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def distance(a,b):\n n, m = len(a), len(b)\n if n > m:\n # Make sure n <= m, to use O(min(n,m)) space\n a,b = b,a\n n,m = m,n\n current = range(n+1)\n for i in range(1,m+1):\n previous, current = current, [i]+[0]*n\n for j in range(1,n+1):\n add, delete = p... | [
"0.67232835",
"0.67147946",
"0.66880906",
"0.6630895",
"0.65993816",
"0.6444303",
"0.6378592",
"0.63441885",
"0.6329001",
"0.6294213",
"0.62897474",
"0.6261869",
"0.6240147",
"0.622547",
"0.62136644",
"0.6200348",
"0.6187172",
"0.6183742",
"0.6174923",
"0.6147786",
"0.6123944... | 0.82035065 | 0 |
Separates image into bins by HSV and creates histograms | def get_hsv_hist(img):
hsv = cv2.cvtColor(img.data, cv2.COLOR_BGR2HSV)
hue_counts = {}
hue_pixels = {}
for rnum, row in enumerate(hsv):
for cnum, pix in enumerate(row):
hue = pix[0]
val = pix[2]
sat = pix[1]
#ignore white
if not (sat ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def HsvHistogram(self):\n if not self._hsvHistogram is 0:\n return self._hsvHistogram\n if not self._bicHistogram is 0:\n self._hsvHistogram = self._bicHistogram[:28] + self._bicHistogram[28:]\n return self._hsvHistogram\n hsvimg = self.HsvImage()\n #Not... | [
"0.75467247",
"0.74963117",
"0.7277678",
"0.727673",
"0.71882635",
"0.70354944",
"0.68741673",
"0.67402565",
"0.66887426",
"0.6617435",
"0.6546843",
"0.6461194",
"0.6458271",
"0.644324",
"0.6436696",
"0.6430623",
"0.6396616",
"0.6357633",
"0.63395464",
"0.6304268",
"0.6277575... | 0.770932 | 0 |
Separates image into bins by HSV and creates visualization | def view_hsv(img):
_, pixels = get_hsv_hist(img)
view = np.zeros(img.data.shape)
for hsv_col in pixels.keys():
points = pixels[hsv_col]
for p in points:
#black case
if hsv_col == -1:
view[p[0]][p[1]] = [0, 255, 255]
else:
v... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def color_segmentation(self):\n cv.namedWindow(\"Segmentation parameters\")\n self.create_trackbar(\"h-u\", \"Segmentation parameters\")\n self.create_trackbar(\"h-l\",\"Segmentation parameters\")\n self.create_trackbar(\"s-u\",\"Segmentation parameters\")\n self.create_trackbar(... | [
"0.70735836",
"0.7004225",
"0.695724",
"0.6759722",
"0.6748382",
"0.6731498",
"0.6632722",
"0.65713376",
"0.6562051",
"0.65067375",
"0.64830685",
"0.64766514",
"0.6465019",
"0.6440547",
"0.64179415",
"0.6345443",
"0.62953174",
"0.62935096",
"0.62903285",
"0.6172698",
"0.61593... | 0.70589906 | 1 |
Finds any grasps within the pile | def grasps_within_pile(color_mask):
hue_counts, hue_pixels = get_hsv_hist(color_mask)
individual_masks = []
#color to binary
focus_mask = color_to_binary(color_mask)
#segment by hsv
for block_color in hue_counts.keys():
#same threshold values for number of objects
if hue_count... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def scan(self, cut_off, r0 = 4, dr = 2, rmax = 80, bg_global = 3419, sigma = 3.5 * 13.8):\r\n \r\n start_time = time.time()\r\n for trial in range(self.dimension):\r\n \r\n max_count, max_rank = self.pick_largest(cut_off = cut_off)\r\n fitted = 0 ... | [
"0.5700745",
"0.56778735",
"0.5663008",
"0.551711",
"0.5505818",
"0.5467908",
"0.54580426",
"0.54253745",
"0.5397337",
"0.5391374",
"0.53785056",
"0.53503054",
"0.5346534",
"0.5280048",
"0.52569604",
"0.5242405",
"0.5228067",
"0.52153265",
"0.5209555",
"0.5197621",
"0.5191942... | 0.6209156 | 0 |
This function computes and returns the Cost and its derivative. The is function uses the Squared Error Cost function > (1/2m)sum(Y Y_hat)^.2 | def compute_cost(Y, Y_hat):
m = Y.shape[1]
cost = (1 / (2 * m)) * np.sum(np.square(Y - Y_hat))
cost = np.squeeze(cost) # remove extraneous dimensions to give just a scalar
dY_hat = -1 / m * (Y - Y_hat) # derivative of the squared error cost function
return cost, dY_hat | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def compute_cost_derivative(AL, Y):\n pass",
"def cost_derivative(self,output_results,y):\r\n\t\treturn (output_results-y)",
"def cost_derivative(self, y_pred, Y, X):\n # Derivative of loss wrt b0\n D_b0 = -2 * sum((Y - y_pred) * y_pred * (1 - y_pred))\n # Derivative of loss wrt b1\... | [
"0.812347",
"0.80893224",
"0.79064614",
"0.77905023",
"0.7478093",
"0.74645007",
"0.7383541",
"0.7267131",
"0.7229721",
"0.7212447",
"0.72122484",
"0.71903235",
"0.7165545",
"0.7165545",
"0.7165545",
"0.7165545",
"0.71442056",
"0.70984364",
"0.709404",
"0.70934206",
"0.707401... | 0.8288331 | 1 |
This function computes and returns the Cost and its derivative. The is function uses the Squared Error Cost function > (1/2m)sum(Y Y_hat)^.2 | def compute_cost(Y, Y_hat):
m = Y.shape[1]
cost = (1 / (2 * m)) * np.sum(np.square(Y - Y_hat))
cost = np.squeeze(cost) # remove extraneous dimensions to give just a scalar
dY_hat = -1 / m * (Y - Y_hat) # derivative of the squared error cost function
return cost, dY_hat | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def compute_cost_derivative(AL, Y):\n pass",
"def cost_derivative(self,output_results,y):\r\n\t\treturn (output_results-y)",
"def cost_derivative(self, y_pred, Y, X):\n # Derivative of loss wrt b0\n D_b0 = -2 * sum((Y - y_pred) * y_pred * (1 - y_pred))\n # Derivative of loss wrt b1\... | [
"0.8125291",
"0.8090249",
"0.79081434",
"0.7791853",
"0.74763405",
"0.7463601",
"0.7385305",
"0.72685295",
"0.7231089",
"0.7213873",
"0.72098875",
"0.71926355",
"0.7166958",
"0.7166958",
"0.7166958",
"0.7166958",
"0.7142707",
"0.70961875",
"0.7093396",
"0.70911926",
"0.707407... | 0.8287495 | 0 |
Init a CategoriesSampler and generate a labelindex list. | def __init__(
self,
label_list,
label_num,
episode_size,
episode_num,
way_num,
image_num,
):
super(CategoriesSampler, self).__init__(label_list)
self.episode_size = episode_size
self.episode_num = episode_num
self.way_num = way... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _init_al_dataset(self):\n\n self._init_dataset()\n\n train_dataset = self.datasets['train']\n\n dataset_size = len(train_dataset)\n self.budget = math.ceil(self.budget_frac*dataset_size)\n Sampler.__init__(self, config, self.budget) # TODO: Weird place to initialise this\... | [
"0.60528046",
"0.5913382",
"0.5825555",
"0.5751711",
"0.5690263",
"0.5567944",
"0.55531305",
"0.55322915",
"0.55263925",
"0.5524283",
"0.54621285",
"0.54616654",
"0.54534256",
"0.5411806",
"0.53977334",
"0.5395416",
"0.5387874",
"0.5377008",
"0.5363207",
"0.53631413",
"0.5361... | 0.7535229 | 0 |
Return an array with the parameter values | def param_values(self, pnames=None):
l = self.get_params(pnames)
v = [p.__get__(self)() for p in l]
return np.array(v) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def param(self):\r\n\r\n return []",
"def get_params(self):\n return self.arr",
"def param(self):\r\n return []",
"def param(self):\n return []",
"def param(self):\n return []",
"def param_values(self):\n return self._param_values",
"def parameters(self):\n ... | [
"0.75753117",
"0.7570276",
"0.7528684",
"0.75195676",
"0.75195676",
"0.7383272",
"0.7365027",
"0.7295904",
"0.7203417",
"0.7176539",
"0.7086868",
"0.7049823",
"0.70424426",
"0.70424426",
"0.6982062",
"0.6945605",
"0.69351304",
"0.68981147",
"0.68842196",
"0.68287617",
"0.6828... | 0.76150453 | 0 |
Return an string with the parameter values | def param_str(self, pnames=None):
l = self.get_params(pnames)
s = ""
for p in l:
s += "%s : %s\n" % (p.public_name, p.tostr(self))
return s | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __str__(self):\r\n res = [self.Name + ' parameters:']\r\n for t in self._tracked_properties:\r\n res.append(t + ':' + str(getattr(self, t)))\r\n for k, v in sorted(self.Params.items()):\r\n res.append(str(k) + ':' + str(v))\r\n return '\\n'.join(res)",
"def _... | [
"0.72047156",
"0.7102308",
"0.7086348",
"0.7065233",
"0.7047773",
"0.7035444",
"0.6995541",
"0.69386697",
"0.6914346",
"0.6812443",
"0.6797536",
"0.67912376",
"0.676514",
"0.67525",
"0.6674416",
"0.6665586",
"0.6616467",
"0.6604542",
"0.65836656",
"0.6577053",
"0.65337116",
... | 0.76984614 | 0 |
Check the results of a requested classification. If the classification has not been completed yet, all of the updates will be sent in the response instead. | def check_results(request):
# Check if an ID was supplied.
if ('ID' not in request.GET):
response = HttpResponse()
response.status_code = 400 # Bad Request
response.reason_phrase = ("No ID was passed. The ID used to start "
"the classification job m... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def classifier(self):\n\n print \"Starting Classification\"\n self.detections.rotationClass = [ self.detections.rotationTimeTags[index] for index, theta in enumerate(self.detections.rotations) if theta > 30]\n if len(self.detections.rotationClass) < 1:\n print \"Too little rotation ... | [
"0.59364176",
"0.58425266",
"0.5835213",
"0.58156556",
"0.5774377",
"0.57704085",
"0.5754579",
"0.5739283",
"0.5717862",
"0.5662213",
"0.5661778",
"0.5644612",
"0.5622222",
"0.561191",
"0.55892646",
"0.55750364",
"0.5530005",
"0.5466623",
"0.5452442",
"0.5431951",
"0.5424697"... | 0.6289281 | 0 |
Sends a response to the request containing the results for the specified job. Returns the response for the request. | def job_results(request, job):
# Retrieve the results for the job.
result = job.jobresult
# Send all of the result information in a request and indicate that the
# job is finished.
data = {'Finished': True,
'ClassName': result.sample_class.name,
'Clas... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def view_result(job_id):\n job = fetch_data.AsyncResult(job_id, app=app)\n if job.successful():\n result = job.result\n return jsonify({'job_id': job_id, 'result': job.result})\n else:\n result = 'job was not finished or was not successful'\n return jsonify({'job_id': job_id, 'resu... | [
"0.6654233",
"0.6361448",
"0.63421184",
"0.6322436",
"0.6210682",
"0.6202289",
"0.62017584",
"0.6187572",
"0.60882515",
"0.60873276",
"0.6063468",
"0.60171777",
"0.5937204",
"0.5932853",
"0.5906379",
"0.59030396",
"0.58939797",
"0.5892046",
"0.5882518",
"0.5792019",
"0.578654... | 0.67318314 | 0 |
Sends a response to the request containing all of the job updates for the specified job. Returns the response for the request. | def job_updates(request, job):
# Retrieve all of the job updates for the job, ordered by the time they
# were created.
updates = job.jobupdate_set.all().order_by('time')
updates = [update.message for update in updates]
# Delete the updates so that they are not sent multiple times.
job.... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_all():\n req_data = request.get_json()\n jobs = JobModel.get_one_job(job_id)\n if not jobs:\n return custom_response({'Error': 'Job Not Found'}, 404)\n\n data, error = job_schema.load(req_data, partial=True)\n if error:\n return custom_response(error, 400)\n\n for job in jobs:\n job.u... | [
"0.7298146",
"0.6808775",
"0.672092",
"0.6141314",
"0.6029491",
"0.5990149",
"0.5990149",
"0.5990149",
"0.5990149",
"0.59676373",
"0.5962157",
"0.59370065",
"0.5849994",
"0.579716",
"0.57914615",
"0.5790366",
"0.5787602",
"0.5779768",
"0.5779768",
"0.5779768",
"0.5734023",
... | 0.8100603 | 0 |
Classify the requested file. The request should not include the file to classify; instead, the file should have already been uploaded when it was validated and the request should include the ID that the validation service responded with. | def classify(request):
# Check if an ID was supplied.
if ('ID' not in request.POST):
response = HttpResponse()
response.status_code = 400 # Bad Request
response.reason_phrase = ('No ID was passed. The ID of the file to '
'classify should have been r... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def classify_file(self, filename: str, handler: int = 0):\n return self.get_func(\"DC_ClassifyFile\", [c_char_p, POINTER(c_int)], c_char_p)(filename, handler)",
"def identify_file(self, file):",
"def http_classify(self, req):\n \n if len(req.files) != 0:\n img = np.fromstrin... | [
"0.63167673",
"0.6156386",
"0.571084",
"0.56800425",
"0.5679512",
"0.5655756",
"0.56255037",
"0.5468291",
"0.54213476",
"0.5397764",
"0.5368126",
"0.53660095",
"0.528343",
"0.5240198",
"0.52355516",
"0.52228576",
"0.5218117",
"0.5216528",
"0.51971716",
"0.51776224",
"0.516061... | 0.73272914 | 0 |
Perform the job for the specified file. | def perform_job(file):
# Retrieve the job for the file.
job = file.job
# Load in the sample saved in the file.
sample_path = os.path.join(_samples_folder, file.file_name)
with load_sample(sample_path) as sample:
# Determine which classification to perform.
file_type = ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def do_file(self, filename):\n with open(filename, \"r\") as infile:\n self._run_cmd(infile.read())",
"def process_file(self, file, target_dir):\n raise NotImplementedError(\"Process file method not implemented\")",
"def runFile(self, f, name=None):\n return self.run(f.read(), n... | [
"0.73262656",
"0.6995201",
"0.644655",
"0.63697857",
"0.6254706",
"0.6191237",
"0.61737394",
"0.6166839",
"0.6074814",
"0.60704416",
"0.6038266",
"0.6029415",
"0.6016472",
"0.5987411",
"0.5961683",
"0.58971196",
"0.5867939",
"0.5847505",
"0.5800055",
"0.57834244",
"0.5754814"... | 0.76816344 | 0 |
Validate that the sent file can be classified. If the file is valid, a response will be sent with the content "Valid". If the file is invalid, a response will be sent with the content "Invalid". If any error occurs, a proper status code will be set for the response. | def validate(request):
# If no file was passed, send a failed status code.
if ('file' not in request.FILES):
response = HttpResponse()
response.status_code = 400; # Bad Request
response.reason_phrase = ("No file was passed. File is expected as a "
"... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def validate(self, file):\n if self.maxFileSize and file['size'] < self.maxFileSize:\n raise HTTPError(406, \"File too big\")\n\n if not self.acceptedFileType(file['type']):\n raise HTTPError(406, \"File of unsupported type\")",
"def check_file(self):\n\n # File manipul... | [
"0.6747372",
"0.6144095",
"0.6088044",
"0.6086097",
"0.59429485",
"0.5937669",
"0.5935392",
"0.5925456",
"0.58384174",
"0.5818982",
"0.57784456",
"0.5731618",
"0.5656309",
"0.56412494",
"0.5616315",
"0.55925643",
"0.55822515",
"0.55419767",
"0.5540341",
"0.5514947",
"0.551044... | 0.62825346 | 1 |
Save the sample to a file and create a response for the specified request that indicates that the file was valid and includes the file's ID. Returns the created response. | def save_sample(request, sample, file_type):
# Save the sample in the files directory.
sample.save(_samples_folder)
# Add a record for the file in the database.
File(file_name=sample.identifier, file_type=file_type).save()
# Return a valid response with the sample's ID.
response_c... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def post(self):\n request_data = request.get_json(force=True)\n current_path = self.get_current_path()\n file_name = request_data.get('file_name')\n\n if not file_name:\n abort(400, message=\"File name must not be empty!\")\n\n full_path = os.path.join(current_path, fi... | [
"0.5846986",
"0.5686665",
"0.5616435",
"0.56103086",
"0.5589675",
"0.55661184",
"0.5535623",
"0.5512116",
"0.5505146",
"0.546633",
"0.5452064",
"0.54391396",
"0.5425361",
"0.5391359",
"0.5382535",
"0.5376695",
"0.53602445",
"0.53600895",
"0.53305113",
"0.529475",
"0.529457",
... | 0.7216557 | 0 |
generated source for method getUncachedGameKeys | def getUncachedGameKeys(self):
theKeys = HashSet()
for game in theCacheDirectory.listFiles():
theKeys.add(game.__name__.replace(".zip", ""))
return theKeys | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_dead_keys(self):\n return self.dead_keys",
"def cache_key(self):",
"def get_keys(self):\r\n return self._keys",
"def _private_keys(self) -> List[Tuple[str, str]]:\n\n directory = tedious.config.CONFIG[\"KEYS\"]['private-keys']\n if self._cached_private_keys is None:\n ... | [
"0.66179377",
"0.6406456",
"0.63957995",
"0.6382918",
"0.63566726",
"0.6280916",
"0.61665016",
"0.612659",
"0.6033928",
"0.6021346",
"0.6012064",
"0.59575635",
"0.59394735",
"0.5928928",
"0.5918334",
"0.5910157",
"0.59081644",
"0.58889747",
"0.5887267",
"0.5879665",
"0.583434... | 0.7435073 | 0 |
generated source for method getUncachedGame | def getUncachedGame(self, theKey):
cachedGame = loadGameFromCache(theKey)
if cachedGame != None:
return cachedGame
# Request the game directly on a cache miss.
return RemoteGameRepository(self.theRepoURL).getGame(theKey) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_cached_games(self, user_id: str) -> Optional[List[types.GameInformation]]:\n raise NotImplementedError",
"def loadGameFromCache(self, theKey):\n theGameFile = File(self.theCacheDirectory, theKey + \".zip\")\n theLine = None\n try:\n theLine = br.readLine()\n ... | [
"0.6439026",
"0.63923717",
"0.63372177",
"0.608383",
"0.60353434",
"0.59412175",
"0.57001454",
"0.56867296",
"0.56367916",
"0.56364006",
"0.55533665",
"0.55476934",
"0.5547684",
"0.5538095",
"0.5521241",
"0.5511014",
"0.548265",
"0.54409134",
"0.54333836",
"0.54299265",
"0.54... | 0.7713912 | 0 |
generated source for method saveGameToCache | def saveGameToCache(self, theKey, theGame):
if theGame == None:
return
theGameFile = File(self.theCacheDirectory, theKey + ".zip")
try:
theGameFile.createNewFile()
pw.print_(theGame.serializeToJSON())
pw.flush()
pw.close()
g... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"async def save(self, res: dict):\n self.___cache_data(res['games'])",
"def save_cache(self):\n with open(self.get_cache_filename(), 'wb+') as f:\n out = dict()\n out['timestamp'] = self.get_last_update()\n out['cache'] = self.cache\n f.write(pickle.dumps(... | [
"0.69549197",
"0.6453514",
"0.62758523",
"0.6238041",
"0.62120354",
"0.6203205",
"0.6164972",
"0.61067784",
"0.6100005",
"0.6081788",
"0.6064427",
"0.6057861",
"0.60123265",
"0.6003487",
"0.5968659",
"0.59384173",
"0.59155583",
"0.58803445",
"0.58596665",
"0.5849361",
"0.5842... | 0.77490395 | 0 |
generated source for method loadGameFromCache | def loadGameFromCache(self, theKey):
theGameFile = File(self.theCacheDirectory, theKey + ".zip")
theLine = None
try:
theLine = br.readLine()
br.close()
ir.close()
gIn.close()
fIn.close()
except Exception as e:
if theLine... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def run(self):\n try:\n if myGameVersion != None:\n myVersionedRepoURL = myGameVersion.getRepositoryURL()\n if not versionedRepoURL == myVersionedRepoURL:\n # Cache miss: we don't have the current version for\r\n # ... | [
"0.6896462",
"0.6758682",
"0.65946525",
"0.6574387",
"0.6532768",
"0.6439862",
"0.621828",
"0.61384666",
"0.6078982",
"0.600412",
"0.598672",
"0.59276843",
"0.5895739",
"0.58835745",
"0.5873395",
"0.5870607",
"0.5841377",
"0.58352375",
"0.58318496",
"0.583129",
"0.578287",
... | 0.76834697 | 0 |
generated source for method getCacheEntryAge | def getCacheEntryAge(self, theKey):
theGameFile = File(self.theCacheDirectory, theKey + ".zip")
if theGameFile.exists():
return System.currentTimeMillis() - theGameFile.lastModified()
return System.currentTimeMillis() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_cached_data_age(name):\n cache_path = get_cachefile('%s.cache' % name)\n if not os.path.exists(cache_path):\n return 0\n return time.time() - os.stat(cache_path).st_mtime",
"def age(self, url):\r\n cached_object = self.translate_url(url)\r\n if not os.path.exists(cached_object):\r\n... | [
"0.6948329",
"0.6731192",
"0.6617251",
"0.64748996",
"0.6416334",
"0.63742226",
"0.6353629",
"0.63218516",
"0.62555164",
"0.62397337",
"0.61830986",
"0.61497116",
"0.61343306",
"0.6110807",
"0.6084063",
"0.6056708",
"0.605656",
"0.605064",
"0.605064",
"0.605064",
"0.605064",
... | 0.7664409 | 0 |
Returns a DataFrame comparing queries against metrics for a single system. | def get_query_metric_df(self, field_name, system):
if system not in self.base_result.systems:
raise ValueError("System not in result_list.")
return self._get_field_from_summary(field_name).loc[system] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_system_metric_df(self, field_name, query):\n if query not in self.base_result.queries:\n raise ValueError(\"Query not in result_list.\")\n return self._get_field_from_summary(field_name).xs(query, level=1)",
"def get_system_query_df(self, field_name, metric):\n summary_fie... | [
"0.71064156",
"0.6610411",
"0.6347162",
"0.6082875",
"0.6055855",
"0.60265374",
"0.6024889",
"0.601505",
"0.59907573",
"0.5986729",
"0.59768796",
"0.59762657",
"0.5914002",
"0.5889267",
"0.58185625",
"0.5810626",
"0.57791346",
"0.5748937",
"0.5743667",
"0.5741198",
"0.5720005... | 0.76674765 | 0 |
Returns a DataFrame comparing systems against metrics for a single query. | def get_system_metric_df(self, field_name, query):
if query not in self.base_result.queries:
raise ValueError("Query not in result_list.")
return self._get_field_from_summary(field_name).xs(query, level=1) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_query_metric_df(self, field_name, system):\n if system not in self.base_result.systems:\n raise ValueError(\"System not in result_list.\")\n return self._get_field_from_summary(field_name).loc[system]",
"def get_system_query_df(self, field_name, metric):\n summary_field = ... | [
"0.7355454",
"0.6312902",
"0.6247978",
"0.6147297",
"0.6034233",
"0.59722394",
"0.5960379",
"0.5922952",
"0.5881963",
"0.58798486",
"0.5835453",
"0.58137053",
"0.579053",
"0.5769042",
"0.5752151",
"0.57353324",
"0.57205665",
"0.56961364",
"0.56408674",
"0.5587816",
"0.5581781... | 0.70628 | 1 |
Returns a DataFrame comparing systems against queries for a single metric. | def get_system_query_df(self, field_name, metric):
summary_field = self._get_field_from_summary(field_name)
if metric not in summary_field.columns.values:
raise ValueError("Metric not calculated for this field.")
return summary_field.loc[:, metric].unstack(1) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_query_metric_df(self, field_name, system):\n if system not in self.base_result.systems:\n raise ValueError(\"System not in result_list.\")\n return self._get_field_from_summary(field_name).loc[system]",
"def get_system_metric_df(self, field_name, query):\n if query not in ... | [
"0.71142274",
"0.66009295",
"0.59842867",
"0.57437176",
"0.5674894",
"0.5596833",
"0.5518226",
"0.5503252",
"0.5474194",
"0.5430966",
"0.54092735",
"0.5387824",
"0.53653073",
"0.53534776",
"0.5318835",
"0.53186226",
"0.530908",
"0.53087306",
"0.5302849",
"0.5297443",
"0.52904... | 0.6765421 | 1 |
Computes the rankbiased overlap (RBO) of two systems across all queries. | def rank_biased_overlap(self, identifier='id', systems=None, p=0.9):
if len(self.base_result.systems) < 2:
raise RuntimeError('There are less than 2 systems in the results but RBO requires 2 systems.')
if systems:
try:
if len(systems) != 2:
rai... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def TwoQubitRB(q1: qreg, q2: qreg, seqs, add_cals=True):\n\n # Original:\n # seqsBis = []\n # for seq in seqs:\n # seqsBis.append(reduce(operator.add, [clifford_seq(c, q1, q2) for c in seq]))\n\n # # Add the measurement to all sequences\n # for seq in seqsBis:\n # seq.append(MEAS(q1, q... | [
"0.58383423",
"0.58126193",
"0.5594058",
"0.55805284",
"0.5506961",
"0.5498973",
"0.549845",
"0.54878706",
"0.5442857",
"0.54245013",
"0.54245013",
"0.54245013",
"0.53840387",
"0.5361688",
"0.53158635",
"0.5315644",
"0.531379",
"0.53026104",
"0.53005093",
"0.53005093",
"0.529... | 0.746017 | 0 |
check if resource exists. ${HOME}/.aphla will be checked first, then the installed global settings. | def has(resname):
# check HOME directory first
if os.path.exists(os.path.join(os.getenv("HOME"), ".aphla", resname)):
return True
else:
return resource_exists(__name__, resname) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def inHome(resname):\n prv_filename = os.path.join(os.getenv(\"HOME\"), \".aphla\", resname)\n if os.path.exists(prv_filename):\n return True\n else:\n return False",
"def getResource(resname, loc = None):\n # check the HOME for personal config file\n prv_filename = os.path.join(os.g... | [
"0.6992636",
"0.64363134",
"0.62269026",
"0.6153953",
"0.61438257",
"0.61180335",
"0.60764027",
"0.6029513",
"0.60285354",
"0.5987965",
"0.59775203",
"0.5959386",
"0.59405845",
"0.5922354",
"0.5922354",
"0.5905138",
"0.58706754",
"0.5854545",
"0.585021",
"0.5840566",
"0.58202... | 0.79416054 | 0 |
returns the true filename for resource check ${HOME}/.aphla first, then the installed global settings. | def getResource(resname, loc = None):
# check the HOME for personal config file
prv_filename = os.path.join(os.getenv("HOME"), ".aphla", resname)
if os.path.exists(prv_filename):
return prv_filename
elif loc and resource_exists(loc, resname):
# use the config within distribution
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def filename(resname):\n # check the HOME for personal config file\n prv_filename = os.path.join(os.getenv(\"HOME\"), \".aphla\", resname)\n if os.path.exists(prv_filename):\n return prv_filename\n else:\n # use the config within distribution\n return resource_filename(__name__, re... | [
"0.7460817",
"0.640426",
"0.6269975",
"0.6156728",
"0.6124719",
"0.59542465",
"0.58734393",
"0.58391565",
"0.5788296",
"0.5785266",
"0.57055366",
"0.5705314",
"0.5704315",
"0.5701873",
"0.5682768",
"0.5672945",
"0.56165487",
"0.5608573",
"0.55846107",
"0.5561497",
"0.5559342"... | 0.67486995 | 1 |
returns the true filename for resource check ${HOME}/.aphla first, then the installed global settings. | def filename(resname):
# check the HOME for personal config file
prv_filename = os.path.join(os.getenv("HOME"), ".aphla", resname)
if os.path.exists(prv_filename):
return prv_filename
else:
# use the config within distribution
return resource_filename(__name__, resname) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getResource(resname, loc = None):\n # check the HOME for personal config file\n prv_filename = os.path.join(os.getenv(\"HOME\"), \".aphla\", resname)\n if os.path.exists(prv_filename):\n return prv_filename\n elif loc and resource_exists(loc, resname):\n # use the config within distri... | [
"0.67481834",
"0.64014363",
"0.6272578",
"0.61559355",
"0.61250615",
"0.59536314",
"0.58748424",
"0.5836668",
"0.5788391",
"0.57870114",
"0.570727",
"0.5707242",
"0.57043403",
"0.5702242",
"0.56834996",
"0.5672589",
"0.56158954",
"0.5608748",
"0.5583943",
"0.55604464",
"0.555... | 0.74616015 | 0 |
check if resource is in user's HOME directory | def inHome(resname):
prv_filename = os.path.join(os.getenv("HOME"), ".aphla", resname)
if os.path.exists(prv_filename):
return True
else:
return False | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def user_home_dir_exists(self, username: str) -> bool:\n try:\n user = pwd.getpwnam(username)\n home_dir = user.pw_dir\n return os.path.isdir(home_dir)\n except KeyError:\n return False",
"def has(resname):\n # check HOME directory first\n if os.pat... | [
"0.70986116",
"0.6844657",
"0.68098575",
"0.64073557",
"0.6332181",
"0.62723243",
"0.61814904",
"0.61542815",
"0.61520696",
"0.61351526",
"0.60769224",
"0.60760933",
"0.6073499",
"0.60550076",
"0.6038296",
"0.603524",
"0.60182077",
"0.59737253",
"0.59684306",
"0.59550196",
"0... | 0.76874775 | 0 |
returns the base leaf shape mesh | def get_shape(cls, leaf_type, g_scale, scale, scale_x):
u_v = []
if leaf_type < 0: # blossom
if leaf_type < -3: # out of range
leaf_type = -1
shape = leaf_geom.blossom(abs(leaf_type + 1))
else: # leaf
if leaf_type < 1 or leaf_type > 10: #... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_mesh(self):\n return self.mesh",
"def CreateDummyLowerDimensionalMesh(self):\n\n\n sys.stdout = open(os.devnull, \"w\")\n p = self.InferPolynomialDegree()\n mesh = Mesh()\n if self.element_type == \"tet\":\n mesh.Rectangle(nx=1,ny=1, element_type=\"tri\")\n ... | [
"0.6105787",
"0.60268056",
"0.60063434",
"0.5987261",
"0.5969061",
"0.596201",
"0.5896222",
"0.58812934",
"0.58724713",
"0.58724713",
"0.58724713",
"0.58724713",
"0.5786679",
"0.5748955",
"0.57107836",
"0.5672531",
"0.5671892",
"0.56309205",
"0.56309205",
"0.5613922",
"0.5613... | 0.64369184 | 0 |
Rolls dice and returns the total. | def simple_roll(dice):
return roll(dice).total | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def roll_dice():\n return (random.randint(1, 6) + random.randint(1, 6))",
"def roll_dice(self):\n self.roll = (random.randint(1,6), random.randint(1,6))\n return self.roll",
"def roll_dice(num_rolls, dice=six_sided):\n # These assert statements ensure that num_rolls is a positive integer.\n... | [
"0.79147685",
"0.7902073",
"0.77183014",
"0.7665277",
"0.760193",
"0.75431806",
"0.74448",
"0.7345227",
"0.7326711",
"0.73117656",
"0.73091745",
"0.7188134",
"0.718435",
"0.71810174",
"0.7175744",
"0.7110553",
"0.71006495",
"0.70891243",
"0.70889044",
"0.70850086",
"0.7028073... | 0.8359366 | 0 |
Stops evaluation of an alias and shows the user an error. | def err(reason):
raise AliasException(reason) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_useless_alias():\n with pytest.raises(ValueError, match='duplicate'):\n alias('name', ('name',))",
"def _delalias(optalias):\n\n optalias = _sanitizeName(optalias) # sanitize name so it conforms.\n with sqlite3.connect(DB) as db:\n cursor = db.cursor()\n cursor.execute(\"DE... | [
"0.6205554",
"0.5999336",
"0.59698236",
"0.5794364",
"0.5626621",
"0.56120867",
"0.5583333",
"0.55621547",
"0.55467844",
"0.5423734",
"0.5423734",
"0.5423734",
"0.53943986",
"0.5388895",
"0.53852844",
"0.5379129",
"0.5371467",
"0.53507924",
"0.53507924",
"0.53507924",
"0.5346... | 0.69712406 | 0 |
Configures the analyzer from a config object. If the PARSER attribute is set on the class, it uses it automatically to parse and validate the config. | def configure(self, config: Config) -> Config:
return config.parse(self.PARSER) if self.PARSER else config | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def parse_analyzer(config: Config) -> Analyzer:\n config = config.parse(PARSER)\n cls: t.Type[Analyzer] = config['class'].value\n analyzer: Analyzer = cls()\n analyzer.configure(config.get('config', {}))\n return analyzer",
"def ParseOptions(cls, options, config_object):",
"def from_config(confi... | [
"0.7279012",
"0.6115905",
"0.57657087",
"0.5765277",
"0.5709646",
"0.5650597",
"0.5634595",
"0.56336",
"0.5620726",
"0.5620726",
"0.5612772",
"0.5598921",
"0.55959696",
"0.5592163",
"0.5592163",
"0.5580475",
"0.5528585",
"0.5499089",
"0.5496871",
"0.5484191",
"0.5482322",
"... | 0.6642449 | 1 |
Parses an analyzer from a config. | def parse_analyzer(config: Config) -> Analyzer:
config = config.parse(PARSER)
cls: t.Type[Analyzer] = config['class'].value
analyzer: Analyzer = cls()
analyzer.configure(config.get('config', {}))
return analyzer | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_analyzer(cls, analyzer_name):\n return cls._class_registry[analyzer_name.lower()]",
"def parse_config(self):\n # TODO: parse config file\n pass",
"def configure(self, config: Config) -> Config:\n return config.parse(self.PARSER) if self.PARSER else config",
"def set_analyz... | [
"0.5687916",
"0.56200397",
"0.5572718",
"0.54735047",
"0.53837824",
"0.5229909",
"0.5186728",
"0.51830727",
"0.5141829",
"0.5107143",
"0.5096509",
"0.5088099",
"0.5082229",
"0.50795484",
"0.5070381",
"0.5060042",
"0.5014825",
"0.4994182",
"0.4979376",
"0.497919",
"0.49174964"... | 0.8402701 | 0 |
Tests whether union and intersection just have the opposite value of 0 and 1 | def test_union_intersection():
X = np.random.randn(d, 100)
assert np.array_equal(lincon.indicator_intersection(X), 1-lincon.indicator_union(X)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_union(self) -> bool:\n return False",
"def is_union(self):\n return False",
"def intersection_over_union(gt_box, pred_box):\n combined = torch.stack((gt_box, pred_box), dim=1)\n max_0 = torch.max(combined[:, :, 0].T, dim = 0).values\n max_1 = torch.max(combined[:, :, 1].T, dim=0).... | [
"0.6530437",
"0.6471448",
"0.6461723",
"0.6404478",
"0.6357259",
"0.634712",
"0.61564225",
"0.61499554",
"0.6035872",
"0.60308576",
"0.60206515",
"0.60184103",
"0.59791976",
"0.59772986",
"0.5944956",
"0.5943528",
"0.592422",
"0.59218556",
"0.5901407",
"0.5878861",
"0.5877310... | 0.73501617 | 0 |
Encode given data as a DID of this type. If `scaling` is ``False`` no scaling of datas is performed. >>> foo = db.get_did_by_name('Foo') | def encode(self, data, scaling=True):
encoded = encode_data(data,
self._codec['datas'],
self._codec['formats'],
scaling)
encoded |= (0x80 << (8 * self._length))
encoded = hex(encoded)[4:].rstrip('L')
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def encode_data(self, data):\n if self.unit == \"char\":\n data = self.char_encoding(data)\n elif self.unit == \"char-ngram\":\n data = self.ngram_encoding(data)\n elif self.unit == \"morpheme\" or self.unit == \"oracle\":\n data = self.morpheme_encoding(data)\... | [
"0.5016485",
"0.49834743",
"0.49751264",
"0.49213058",
"0.4877217",
"0.47953728",
"0.47856757",
"0.47749007",
"0.4741698",
"0.47310862",
"0.4730063",
"0.47281894",
"0.47281894",
"0.47180304",
"0.4695116",
"0.46833947",
"0.46808097",
"0.4680291",
"0.4608045",
"0.4579615",
"0.4... | 0.549835 | 0 |
Decode given data as a DID of this type. If `decode_choices` is ``False`` scaled values are not converted to choice strings (if available). If `scaling` is ``False`` no scaling of datas is performed. >>> foo = db.get_did_by_name('Foo') >>> foo.decode(b'\\x01\\x45\\x23\\x00\\x11') | def decode(self,
data,
decode_choices=True,
scaling=True,
allow_truncated=False):
return decode_data(data[:self._length],
self.length,
self._codec['datas'],
self._codec['... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def decode(data):\n raise NotImplementedError",
"def _decode(data: BencodedString) -> Union[bytes, dict, int, list]:\n if not data.bytes:\n raise ValueError(\"Cannot decode an empty bencoded string.\")\n\n if data.bytes[0] == START_DICT:\n return _decode_dict(data)\n\n if data.bytes... | [
"0.62186205",
"0.60514945",
"0.5850234",
"0.5833881",
"0.57557684",
"0.57239896",
"0.56754816",
"0.56624156",
"0.56543386",
"0.56543386",
"0.5643396",
"0.5642651",
"0.5575247",
"0.55632657",
"0.5531106",
"0.5463697",
"0.5446942",
"0.5444163",
"0.5364614",
"0.5333969",
"0.5311... | 0.7824451 | 0 |
Function to measure the number of dead neurons in a trained neural network. For each neuron, we create a boolean variable initially set to 1. If it has an activation unequals 0 at any time, we set this variable to 0. After running through the whole training set, only dead neurons will have a 1. | def measure_number_dead_neurons(net):
neurons_dead = [
torch.ones(layer.weight.shape[0], device=device, dtype=torch.bool)
for layer in net.layers[:-1]
if isinstance(layer, nn.Linear)
] # Same shapes as hidden size in BaseNetwork
net.eval()
for imgs, labels in tqdm(train_loader,... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def count_dead_node(self):\n count = 0\n for node in self.node:\n if node.energy < 0:\n count += 1\n return count",
"def getNeuronCount(self):\n\t\treturn self.loader.getNeuronCount()",
"def evaluate(self):\n # initialize delta_weights\n Loss = 0\n ... | [
"0.6163028",
"0.57067394",
"0.5648098",
"0.5591782",
"0.55739427",
"0.5572552",
"0.55069",
"0.5503387",
"0.5485773",
"0.5467348",
"0.5456946",
"0.5401582",
"0.5396724",
"0.53706217",
"0.53699374",
"0.53506994",
"0.5345681",
"0.5340436",
"0.53363454",
"0.5317463",
"0.53152573"... | 0.7655995 | 0 |
Splits a ZWJemoji into its constituents. | def split(self) -> Union['EmojiMatchZWJ', 'EmojiMatch']:
if self.is_zwj():
return EmojiMatchZWJ(self)
else:
return self | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def tokenize(string, keep_zwj: bool) -> Iterator[Token]:\n\n tree = get_search_tree()\n EMOJI_DATA = unicode_codes.EMOJI_DATA\n # result: [ Token(oldsubstring0, EmojiMatch), Token(char1, char1), ... ]\n result = []\n i = 0\n length = len(string)\n ignore = [] # index of chars in string that a... | [
"0.5979293",
"0.57081175",
"0.5234913",
"0.5234139",
"0.5198696",
"0.51688725",
"0.5094077",
"0.50913626",
"0.50502056",
"0.4972493",
"0.49461815",
"0.48667604",
"0.48568326",
"0.48553005",
"0.48174593",
"0.48101",
"0.47786912",
"0.47699484",
"0.4745892",
"0.47433725",
"0.473... | 0.6049724 | 0 |
Joins a ZWJemoji into a string | def join(self) -> str:
return _ZWJ.join(e.emoji for e in self.emojis) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fix_emoji(val):\n def _emoji_debugger(val):\n s = val.replace('<span class=\"emoji emoji1f450\"></span',\n '<span class=\"emoji emoji1f450\"></span>')\n\n def __fix_miss_match(m):\n return '<span class=\"emoji emoji%s\"></span>' % ({\n '1f63c':... | [
"0.6369777",
"0.61084837",
"0.589218",
"0.58239853",
"0.57895166",
"0.578887",
"0.5756324",
"0.575586",
"0.575586",
"0.575586",
"0.57133234",
"0.5708115",
"0.56580573",
"0.5655002",
"0.5608788",
"0.56029147",
"0.55229723",
"0.55226135",
"0.54552615",
"0.54537284",
"0.5435943"... | 0.6890309 | 0 |
Cleanup Deployment BatchPrcess working directory | def cleanup(self):
try:
LOGGER.info('Deleting deployment cwd={0}'.format(self.cwd))
# Clean up working directory
delete_directory_tree(self.cwd)
LOGGER.info('Deleted deploy deployment cwd.')
except Exception as e:
err_message = \
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cleanup(self):\n\n print \"Cleaning up...\",\n sys.stdout.flush()\n\n builddir = os.path.join(self.build)\n\n comm = 'rm -rf '+builddir\n #+' '+libdir+' '+logdir\n (output, error, retz) = runShellCommand(comm)\n\n print \"done.\"",
"def clean():\n local('rm... | [
"0.7004988",
"0.6882273",
"0.6872585",
"0.6844769",
"0.68099725",
"0.6806426",
"0.6769003",
"0.6579264",
"0.6576992",
"0.65441555",
"0.6494206",
"0.64859027",
"0.6454752",
"0.6453837",
"0.6416755",
"0.6407938",
"0.6394955",
"0.638954",
"0.6382774",
"0.6368195",
"0.63498956",
... | 0.70624125 | 0 |
Get a batch of commands for the deployment | def get_deployment_batch(self):
pkg_path = self.package.path
pkg_name = self.package.name
self.batch.clear()
# add unpacking script to batch
LOGGER.info('Adding batch to unpack {0} from {1}'.format(
pkg_name, pkg_path))
self.get_package_batch()
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def commands(self) -> List[Command]:\n return []",
"def get_commands():\n\n commands = {}\n\n if not settings.configured:\n return commands\n\n for app_config in reversed(list(apps.get_app_configs())):\n if app_config.label.startswith(lib_name):\n path = os.path.join(app_... | [
"0.67040193",
"0.6539083",
"0.6495143",
"0.6480016",
"0.64443487",
"0.6396208",
"0.6373868",
"0.6362239",
"0.636052",
"0.63411766",
"0.6330448",
"0.63280696",
"0.6285322",
"0.6263869",
"0.6252216",
"0.6244549",
"0.62440044",
"0.6215771",
"0.6215771",
"0.6215771",
"0.6215771",... | 0.6729678 | 0 |
Get a batch of commands for preparing the package | def get_package_batch(self):
dst_path = self.cwd
src_path = self.package.path
pkg_name = self.package.name
# no need this copy command if package path is used as cwd
if (not self.cwd_use_package_path):
copy_cmd = [
'cp', '-rf',
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_commands(package_name):\n # pylint: disable=line-too-long\n def lookup(cmd, dct):\n if not cmd:\n return dct\n if len(cmd) == 1:\n return dct[cmd[0]]\n return lookup(cmd[1:], dct[cmd[0]])\n\n def walking_import(module, cmd, dct):\n car, cdr = cmd[... | [
"0.66139495",
"0.66101074",
"0.6515506",
"0.64529806",
"0.64286214",
"0.634378",
"0.6299586",
"0.6265519",
"0.6229068",
"0.62273914",
"0.61662954",
"0.6128158",
"0.6128158",
"0.6128158",
"0.6128158",
"0.60775167",
"0.6075039",
"0.6073141",
"0.6055749",
"0.59619385",
"0.592247... | 0.68499786 | 0 |
Analyze tweets Tweets is expected to be list of tuples (topic, tweets) | def analyze_tweets(tweets, model, w2v_model):
# TODO DO EVERYTHING HERE
#tweets = [("StarWars", tc.query_tweets("StarWars"))]
#tweets = tc.query_tweets('starwars')
df = pd.DataFrame(columns=['pos', 'neu', 'neg'])
if not os.path.isdir('results'):
os.mkdir('results')
for topic, topic_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def analyse_tweets(nb_tweets, classifier, Resource, threshold, language='en'):\n return [(bytes(line, 'utf-8'), _minimal_analysis(bytes(line, 'utf-8'), classifier, Resource, threshold, language))\n for line in\n collect_tweet(nb_tweets)]",
"def get_tweets(self, kafka_obj):\n\n try... | [
"0.7036888",
"0.6642697",
"0.6601227",
"0.6599942",
"0.6596974",
"0.6460681",
"0.6351102",
"0.6335207",
"0.62915856",
"0.6278537",
"0.62406254",
"0.62389606",
"0.62155265",
"0.61610544",
"0.6141383",
"0.6123396",
"0.6041781",
"0.6027237",
"0.598759",
"0.5980404",
"0.59797096"... | 0.6865782 | 1 |
Return the catalog object of functional.alltypes serialized to string. | def _get_catalog_object(self):
return self.cluster.catalogd.service.read_debug_webpage(
"catalog_object?object_type=TABLE&object_name=functional.alltypes") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_catalog():\n return jsonify(getCatalog())",
"def serialize_catalog(catalog, with_extra=False):\n data, acls, collabs = _recursve_catalog(catalog)\n if with_extra:\n return json.dumps(data), json.dumps(acls), json.dumps(collabs)\n else:\n return json.dumps(data)",
"def __str__(... | [
"0.61948466",
"0.6157384",
"0.6011944",
"0.5909532",
"0.5736282",
"0.56696075",
"0.55949026",
"0.55857337",
"0.55411494",
"0.54581016",
"0.54552215",
"0.5454403",
"0.5440993",
"0.53937805",
"0.53920406",
"0.53877395",
"0.5336692",
"0.53246844",
"0.53148526",
"0.529139",
"0.52... | 0.6298216 | 0 |
Regression test for IMPALA7606. Tables failed to be loaded don't have a last used time and shouldn't be considered for invalidation. | def test_invalid_table(self):
self.execute_query_expect_failure(self.client, "select * from functional.bad_serde")
# The table expires after 1 second. Sleeping for another logbufsecs=5 seconds to wait
# for the log to be flushed. Wait 4 more seconds to reduce flakiness.
time.sleep(10)
assert "Unexpe... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_invalidate_error():\n \n test_object = fa.read_in_envision(data_csv=plate_2_repeat, platemap_csv=plate_map_file, data_type='plate', size=384)\n test_object.invalidate() # execute the invalidate function without specifying well ids, rows or columns to be invalidated",
"def load_failed_tas():\n... | [
"0.61563843",
"0.61460286",
"0.5978097",
"0.59511995",
"0.59404856",
"0.5936607",
"0.59324765",
"0.5922087",
"0.5912061",
"0.5865343",
"0.586045",
"0.58550894",
"0.58546704",
"0.58163124",
"0.5814111",
"0.5782934",
"0.57562464",
"0.5755153",
"0.5740357",
"0.5737231",
"0.57334... | 0.66487557 | 0 |
creates a web map, adds feature layers to web map, and defines properties for layers and the web map | def create_new_webmap(project_name, layer_names, *args):
if not isinstance(project_name, str):
raise TypeError('expected project name to be type of str')
if not isinstance(layer_names, list):
raise TypeError('expected layer names to be type of list')
for layer_name in layer_names:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def webmap(self, gis=None):\n if gis is None and active_gis is not None:\n gis = active_gis\n elif gis is None:\n gis = GIS()\n\n webmap = gis.map()\n webmap.basemap = 'topo-vector'\n webmap.extent = {\n 'xmin': self.extent[0],\n 'ymin'... | [
"0.6883925",
"0.6289845",
"0.62637126",
"0.6031782",
"0.599892",
"0.5975795",
"0.59443295",
"0.59277666",
"0.5923749",
"0.58929616",
"0.5862496",
"0.58609647",
"0.5832016",
"0.57745546",
"0.57150847",
"0.56926876",
"0.5691151",
"0.5678225",
"0.567117",
"0.5665986",
"0.5663971... | 0.74685335 | 0 |
gets feature layers collection of a project in ArcGIS Enterprise/Portal | def get_feature_layers_collection(project_name):
feature_layers_collection = get_portal_item(
portal_connection=PORTAL_CONNECTION,
item_name="{}_Map".format(project_name),
item_type="Feature Layer"
)
return feature_layers_collection | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_geoserver_layers(geoserver_url, geoserver_username, geoserver_password):\n\tgeoserver_rest_url = geoserver_url + 'rest'\n\teprint(\"retrieving GeoServer layer info via {}\".format(geoserver_rest_url))\n\tcat = Catalog(geoserver_rest_url, username=geoserver_username, password=geoserver_password)\n\tall_laye... | [
"0.6563222",
"0.62584984",
"0.61868995",
"0.6140141",
"0.6128541",
"0.6110078",
"0.60860145",
"0.6053692",
"0.60213447",
"0.6002254",
"0.5993012",
"0.5993012",
"0.5986397",
"0.5931002",
"0.58666074",
"0.5857235",
"0.5839819",
"0.5803731",
"0.57503146",
"0.5731979",
"0.5705514... | 0.8449311 | 0 |
gets properties of a project and applies them for portal contents | def get_properties_from_project(project_name, content_type, project_additional_info):
title_not_used = {'title'}
item_title = "{}_{}".format(project_name, content_type)
access_information = "Data Center"
license_info = 'All rights reserved.'
item_tags = [project_name] + project_additional_i... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def run_properties(self, expanded, unexpanded) :\n\t\treturn self.manage_view_properties(expanded, unexpanded, \"/manage_propertiesForm\", perms = \"Manage properties\")",
"def project_section(self, context):\n site = getSite()\n self.catalog = getToolByName(site, 'portal_catalog', None)\n p... | [
"0.6167686",
"0.61280733",
"0.6103713",
"0.6031881",
"0.6031881",
"0.6031881",
"0.5791755",
"0.57654536",
"0.5737456",
"0.5654737",
"0.5641196",
"0.5579371",
"0.55043143",
"0.54972106",
"0.5492145",
"0.5462517",
"0.54618317",
"0.5445242",
"0.53990775",
"0.53990775",
"0.539907... | 0.65914744 | 0 |
uses Python API methods to protect a portal item from deletion and shares it in organization | def protect_share_item(portal_item):
# protect portal item from deletion
portal_item.protect(enable=True)
print('protecting portal item of', portal_item.title, 'from deletion')
# share portal item in the organization
portal_item.share('org')
print('sharing', portal_item.title, 'in organi... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_deleteorganizations_item(self):\n pass",
"def test_deletehardwares_item(self):\n pass",
"def test_dashboards_v2_delete_share(self):\n pass",
"def test_delete_reusableitem_api_fails(self):\n self.client.force_authenticate(user=self.user_1)\n\n response = self.client... | [
"0.62157136",
"0.5961071",
"0.5956066",
"0.59470344",
"0.5940537",
"0.57217646",
"0.5719005",
"0.5608642",
"0.5604696",
"0.5592704",
"0.5588232",
"0.55627966",
"0.55531514",
"0.5550621",
"0.55494153",
"0.5539993",
"0.5525847",
"0.5498605",
"0.5497315",
"0.5479598",
"0.5471175... | 0.79458004 | 0 |
creates popups for web map operational layers | def create_popups(web_map, project_name, layer_names):
if layer_names:
for layer_name in layer_names:
# popup
feature_layer_popup(
map_service_name='{}_{}'.format(project_name, 'Map'),
map_service_type='Feature Layer',
web_map=we... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def feature_layer_popup(map_service_name, map_service_type, web_map, layer_name):\r\n # get operational layer of a web map\r\n operational_layer = get_webmap_operational_layers(\r\n web_map=web_map,\r\n layer_name=layer_name\r\n )\r\n # get feature layer from feature layer collection\r\n ... | [
"0.7547918",
"0.67719895",
"0.6680022",
"0.6541141",
"0.6251284",
"0.621188",
"0.6051858",
"0.5996679",
"0.5978635",
"0.5973949",
"0.5921405",
"0.5805597",
"0.5786626",
"0.57383704",
"0.56734556",
"0.5673127",
"0.56557435",
"0.56329775",
"0.5626302",
"0.5600188",
"0.5599308",... | 0.8254537 | 0 |
includes all steps to create and customize popups for both registered and hosted feature layers in a web map | def feature_layer_popup(map_service_name, map_service_type, web_map, layer_name):
# get operational layer of a web map
operational_layer = get_webmap_operational_layers(
web_map=web_map,
layer_name=layer_name
)
# get feature layer from feature layer collection
target_layer = g... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_popups(web_map, project_name, layer_names):\r\n if layer_names:\r\n for layer_name in layer_names:\r\n # popup\r\n feature_layer_popup(\r\n map_service_name='{}_{}'.format(project_name, 'Map'),\r\n map_service_type='Feature Layer',\r\n ... | [
"0.7814722",
"0.6430567",
"0.63989633",
"0.6300565",
"0.60229284",
"0.6021858",
"0.59557515",
"0.5905633",
"0.583295",
"0.57530475",
"0.57206756",
"0.5714939",
"0.5712119",
"0.5699761",
"0.5677354",
"0.5672749",
"0.5636728",
"0.5633238",
"0.5621861",
"0.55139464",
"0.5497765"... | 0.7735694 | 1 |
creates description for popups of layers by using an HTML format for font and fields information | def customize_popup_description(operational_layer, map_service_type):
layer_popup_description = '''<font color='#dc143c' face='Arial' size='2'>'''
if map_service_type == 'Feature Layer':
operational_layer_popup = operational_layer['popupInfo']
for field in operational_layer_popup['fieldInf... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def feature_layer_popup(map_service_name, map_service_type, web_map, layer_name):\r\n # get operational layer of a web map\r\n operational_layer = get_webmap_operational_layers(\r\n web_map=web_map,\r\n layer_name=layer_name\r\n )\r\n # get feature layer from feature layer collection\r\n ... | [
"0.63989687",
"0.62595993",
"0.6214632",
"0.60126054",
"0.5903325",
"0.5856269",
"0.582426",
"0.5594018",
"0.5566868",
"0.5548228",
"0.55036265",
"0.5448218",
"0.5400469",
"0.5386349",
"0.5383866",
"0.5380613",
"0.5379091",
"0.5373678",
"0.5347627",
"0.5341074",
"0.53371906",... | 0.7961874 | 0 |
gets a feature layer in feature layer collection | def get_feature_layer_from_feature_service(map_service_name, map_service_type, layer_name):
# access a feature service and gets its data
feature_layers = get_portal_item(
portal_connection=PORTAL_CONNECTION,
item_name=map_service_name,
item_type=map_service_type
)
feature_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_feature(self, layer_name):\n if (\n layer_name in self.config[\"layers\"]\n and \"feature\" in self.config[\"layers\"][layer_name]\n ):\n return self.config[\"layers\"][layer_name][\"feature\"]\n else:\n return 0",
"def getFeatures(self,la... | [
"0.70366573",
"0.6941904",
"0.6698407",
"0.6685524",
"0.66284376",
"0.65756834",
"0.6503584",
"0.64415306",
"0.6426288",
"0.64080954",
"0.63857603",
"0.63327396",
"0.6325013",
"0.6324486",
"0.631384",
"0.63056284",
"0.62780887",
"0.61979157",
"0.61840385",
"0.61840385",
"0.61... | 0.713758 | 0 |
gets index of layers in a feature layer collection | def get_feature_layer_index(feature_layer_collection, layer_name):
for index, url in zip(range(len(feature_layer_collection.layers)),
feature_layer_collection.layers):
if layer_name in feature_layer_collection.layers[index].properties.name:
layer_index = index
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def LayerNumbers(self):\n\t\treturn self.acad.ActiveDocument.Layers.Count",
"def get_layer_index(self, layer_name):\n for i, layer in enumerate(self.tmx_data.layers):\n if layer.name == layer_name:\n return i\n return -1",
"def ret_layer_index(file):\n\t\tnames={}\n\t\tf... | [
"0.7323323",
"0.7239316",
"0.6977674",
"0.6920422",
"0.69179136",
"0.6863296",
"0.66008615",
"0.6490613",
"0.6420222",
"0.64066446",
"0.6390747",
"0.63792527",
"0.63792527",
"0.6340347",
"0.6283278",
"0.62040836",
"0.61788064",
"0.61588717",
"0.6158475",
"0.6088829",
"0.60844... | 0.8153657 | 0 |
gets operational layers of a web map | def get_webmap_operational_layers(web_map, layer_name):
web_map_definition = web_map.definition
for layer in web_map_definition['operationalLayers']:
if layer_name in layer['title']:
operational_layer = layer
return operational_layer | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_layers(url):\n wms = WebMapService(url, version='1.3.0')\n layer_names = list(wms.contents)\n return layer_names",
"def map_service_catalogue():\n if deployment_settings.get_security_map() and not s3_has_role(\"MapAdmin\"):\n unauthorised()\n\n subtitle = T(\"List Layers\")\n # S... | [
"0.7087886",
"0.6786647",
"0.66430825",
"0.6633061",
"0.66267085",
"0.64588314",
"0.64385444",
"0.6359344",
"0.63375133",
"0.63375133",
"0.6259919",
"0.6234727",
"0.6232674",
"0.62034893",
"0.6153238",
"0.6149616",
"0.6134108",
"0.6037833",
"0.59157574",
"0.58431995",
"0.5841... | 0.77331144 | 0 |
splits strings that have uppercase | def split_uppercase(word):
final_word = ''
for i in word:
final_word += ' %s' % i if i.isupper() else i
return final_word.strip() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def question_8(upper_string: str) -> str:\n newString = []\n for i,n in enumerate(upper_string):\n if n.isupper():\n newString.append(str(i))\n return newString",
"def split_capital(phrase):\n format_capital = []\n #words = [phrase]\n #format_capital.append(words[0].isupper())... | [
"0.6937431",
"0.6806303",
"0.66549724",
"0.6654103",
"0.6622381",
"0.66142285",
"0.6457966",
"0.6413815",
"0.64076775",
"0.6391348",
"0.63473594",
"0.6346323",
"0.631441",
"0.62810075",
"0.6255081",
"0.62322724",
"0.62213683",
"0.6195765",
"0.61913526",
"0.6182886",
"0.618221... | 0.7719224 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.