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 |
|---|---|---|---|---|---|---|
Checks if the version of installed rpm packages is correct. | def test_compatibility_of_version_of_installed_rpm_packages(self):
incompatible_packages = get_incompatible_packages()
error_msg = linesep + 'List of incompatible packages: '
for package in incompatible_packages:
error_msg += linesep + package
self.assertFalse(incompatible_pa... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _checkUpdateNeeded(self):\n try:\n currentVersionLine = str(subprocess.run(['pacman', '-Q', '-i', self._name],\n stdout=subprocess.PIPE, stderr=subprocess.STDOUT, check=True).stdout)\n currentVersion = re.sub(r'.*Version\\s*: ([\\d|\\.]*)-.*'... | [
"0.7852912",
"0.7744108",
"0.74765617",
"0.722893",
"0.7203099",
"0.6904861",
"0.69024515",
"0.6862261",
"0.6854691",
"0.6753462",
"0.6753374",
"0.66951555",
"0.6654005",
"0.6623651",
"0.657141",
"0.656669",
"0.65392005",
"0.65318364",
"0.65151733",
"0.64916784",
"0.6486697",... | 0.79414594 | 0 |
deterimines chunks to extract based on label_file, which is a csv file with "start" and "stop" collumns with units in seconds | def get_segments(label_file, window=5):
labels = pd.read_csv(label_file).sort_values('start').reset_index(
drop=True)
wlabels = labels.copy()
wlabels.start -= window
wlabels.stop += window
# union segments
b = []
for x in wlabels.itertuples():
if len(b) == 0:
b.ap... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def loadLabels(start, stop, csvFile):\n return csvFile[start:stop]",
"def read_segmentation_gt(gt_file):\n with open(gt_file, 'rt') as f_handle:\n reader = csv.reader(f_handle, delimiter='\\t')\n start_times = []\n end_times = []\n labels = []\n for row in reader:\n ... | [
"0.66373134",
"0.61332214",
"0.58027667",
"0.56053984",
"0.55925703",
"0.5534379",
"0.54143345",
"0.5382332",
"0.53556275",
"0.5346271",
"0.5344915",
"0.5299307",
"0.52677697",
"0.52677697",
"0.52677697",
"0.52345",
"0.52211416",
"0.5209329",
"0.52085185",
"0.51855546",
"0.51... | 0.63667774 | 1 |
This function should be called if one of the Plan objects throws an Exception. It takes the PlanMap argument and calls the getNextAbort function just like executePlans does with todoPlans. This dynamically generates an abort plan list based on what plans were originally executed. | def abortPlans(update):
out.header('Aborting plans %r\n' % (update.plans))
sameError = False
while(True):
# This function either returns None or a tuple just like generate added to it
p = update.plans.getNextAbort()
# No more to do?
if(not p):
break
# Ex... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def abortAll(self):\n for partition in self.PCAs:\n self.abortFunction(partition.id)",
"def check_open_close(plan: Iterator[Any]) -> None:\n open_stack = []\n run_keys = []\n staged_devices = []\n for i, msg in enumerate(plan):\n if msg.command == 'open_run':\n if ... | [
"0.5369754",
"0.51029485",
"0.5076365",
"0.49998215",
"0.4907014",
"0.49007797",
"0.48655084",
"0.48058763",
"0.47596413",
"0.4690968",
"0.46876854",
"0.46536204",
"0.46379238",
"0.46336308",
"0.46239394",
"0.46237203",
"0.46237203",
"0.46054095",
"0.45971686",
"0.45605525",
... | 0.7149478 | 0 |
Returns an individual's birth date, or if that's unknown, 0. | def birth_date_or_min_year(individual):
year = fuzzy_date_year(individual.birth_date)
if year:
return year
return 0 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def birthdate_date(self):\n\n bday = self.birthdate\n if bday:\n dt = datetime.datetime.strptime(\n bday,\n \"%d %b %Y\") # not sure if this format even complies with spec\n # dt = dateutil.parser.parse(bday) # this will guess at a bunch of differe... | [
"0.73392165",
"0.70833445",
"0.70410717",
"0.6988813",
"0.69771373",
"0.6824823",
"0.68032897",
"0.68017995",
"0.6784833",
"0.671493",
"0.65630984",
"0.6454364",
"0.6369196",
"0.63487625",
"0.6340397",
"0.63205796",
"0.63127697",
"0.6205873",
"0.6160483",
"0.60823447",
"0.606... | 0.7756651 | 0 |
Returns a partnership's married date, or if that's unknown, 0. | def married_date_or_min_year(partnership):
year = fuzzy_date_year(partnership.married_date)
if year:
return year
return 0 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def paid(self):\n try:\n start_date = self.member_membership.start_date\n except AttributeError:\n # not available\n start_date = None\n try:\n paid_date = self.member_membership.membership_paid\n except AttributeError:\n # not avai... | [
"0.5553924",
"0.54773486",
"0.5348029",
"0.53429747",
"0.52663684",
"0.5184913",
"0.5136976",
"0.5133511",
"0.50035965",
"0.49861515",
"0.49825463",
"0.49593318",
"0.49374533",
"0.49257797",
"0.49196377",
"0.4900989",
"0.48931015",
"0.4887172",
"0.48670453",
"0.48432726",
"0.... | 0.7873832 | 0 |
return a string representation of the cell located at x,y. | def getCellStr(self, x, y): # TODO: refactor regarding issue #11
c = self.board.getCell(x, y)
if c == 0:
return '.' if self.__azmode else ' .'
elif self.__azmode:
az = {}
for i in range(1, int(math.log(self.board.goal(), 2))):
az[2 ** i] = ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cell_value(self, x, y):\n if x == 8 and y == 0:\n return \"--\"\n (r, g) = self[(x, y)]\n return \"%s%s\" % (r, g)",
"def __str__(self):\n return '{},{}'.format(str(self.row), str(self.column))",
"def __str__(self):\n return str(self._cells)",
"def to_str(sel... | [
"0.788797",
"0.7260427",
"0.71835595",
"0.707998",
"0.70519143",
"0.7034503",
"0.69905657",
"0.6951408",
"0.69193673",
"0.69156873",
"0.6877278",
"0.68747514",
"0.6849739",
"0.6845785",
"0.68311644",
"0.67720103",
"0.6732464",
"0.6722741",
"0.67162824",
"0.66855407",
"0.66854... | 0.7445095 | 1 |
Custom template tag to determine if a user likes a post or not | def post_liker(a, args):
if args.likes.filter(user=a).exists():
exists = True
else:
exists = False
return exists | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def like_post(request, pk):\r\n post = get_object_or_404(Post, id=request.POST.get('id'))\r\n liked = False\r\n\r\n # If the user already liked the post\r\n if post.likes.filter(id=request.user.id).exists():\r\n # unlike\r\n post.likes.remove(request.user)\r\n liked = False\r\n ... | [
"0.67493147",
"0.6695211",
"0.66789323",
"0.66789323",
"0.66342455",
"0.6617383",
"0.6525173",
"0.6469742",
"0.6360969",
"0.6289476",
"0.626976",
"0.6231449",
"0.6128516",
"0.6080136",
"0.60572493",
"0.6026303",
"0.60150063",
"0.600495",
"0.5945798",
"0.5938192",
"0.5935283",... | 0.67068267 | 1 |
Metoda koja vraca negirani literal. Vraca ~L. | def get_negative(self):
return Literal(self.label, not self.positive_state) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def negations(self) -> str:",
"def negate(self):\n self.formula = '!(' + self.formula + ')'",
"def __neg__(self):\n return self.neg()",
"def __neg__(self):\n return self.negated()",
"def __neg__(self):\n return self[::-1].complement",
"def neg(self, a):\n return -a",
... | [
"0.7321333",
"0.6513684",
"0.6369699",
"0.63333154",
"0.6295556",
"0.6273483",
"0.62235636",
"0.6168626",
"0.6155626",
"0.61450183",
"0.61259454",
"0.6108843",
"0.6074916",
"0.6072738",
"0.6067678",
"0.60676676",
"0.6066174",
"0.6026729",
"0.60178274",
"0.60093564",
"0.600886... | 0.72343713 | 1 |
returns True/False if the programming language is dynamically typed or not | def is_dynamic(self):
if self.typing == "Dynamic":
return True
else:
return False | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_dynamic(self):\n if self.typing ='Static':\n print(\"{}, Dynamic Typing,\")",
"def w_is_typed(tokens):\n return (\n 'type' in tokens or\n 'answerblock' in tokens or\n 'drawbox' in tokens or\n 'answerfigure' in tokens\n )",
"def is_scala(self):\r\n r... | [
"0.6529406",
"0.6491379",
"0.64084905",
"0.60378075",
"0.59303284",
"0.59293705",
"0.59267235",
"0.5905952",
"0.58502895",
"0.58409554",
"0.5817962",
"0.5801978",
"0.5788853",
"0.5745239",
"0.5738714",
"0.5730851",
"0.57018995",
"0.5664359",
"0.56108254",
"0.5584493",
"0.5580... | 0.67413986 | 0 |
Format used the platform api url | def _format_api_url(self, url):
user_name = self._get_user_name()
# format and return url
return url.format(
user_name = user_name,
element = urllib.quote(self.qnet_element.encode('utf-8'), safe=''),
token = self._md5("%s:%s:%s" % (user_name, self.iteration_id... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def api_url(url_base):\n return f\"{url_base}/api/v2\"",
"def url(self, api_name):\n return \"https://%s/api/%s/%s/\" % (self.host, self.api_version, api_name)",
"def api(self) -> str:",
"def _get_api_url(self):\n return \"%s/%s/\" % (settings.API_URL, settings.API_VERSION)",
"def format_u... | [
"0.7239803",
"0.706021",
"0.7001952",
"0.6994442",
"0.6979708",
"0.68984735",
"0.6861527",
"0.68556416",
"0.681708",
"0.67981505",
"0.6779937",
"0.6750629",
"0.67478085",
"0.6706687",
"0.66963685",
"0.66950226",
"0.66950226",
"0.6625504",
"0.6609462",
"0.6603447",
"0.65932554... | 0.7448275 | 0 |
Hash input using md5 | def _md5(input):
m = hashlib.md5()
m.update(input)
return m.hexdigest() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __hash_md5__(self, text):\n key = hashlib.md5()\n key.update(text.encode('utf-8'))\n return key.digest()",
"def md5(input_string):\n return hashlib.md5(input_string.encode('utf-8')).hexdigest()",
"def __md5_hash(txt) -> str:\n\n return md5_crypt.hash(txt)",
"def hash(se... | [
"0.79710877",
"0.7859499",
"0.77280575",
"0.76927924",
"0.7670944",
"0.76213074",
"0.76108474",
"0.75367707",
"0.7496188",
"0.7434134",
"0.7415327",
"0.7412276",
"0.73915625",
"0.73668045",
"0.73507416",
"0.7309988",
"0.73086524",
"0.73031527",
"0.7290363",
"0.72788733",
"0.7... | 0.83514374 | 0 |
Comment field of the Hosted Zone. | def comment(self) -> str:
return pulumi.get(self, "comment") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def comment(self):\r\n return self._comment if self._comment is not None else \"\"",
"def comment(self):\n\t\treturn self.comment_",
"def comment(self) -> str:\n return self._comment",
"def comment(self) -> str:\n return self._comment",
"def comment(self) -> str:\n return self._... | [
"0.6299503",
"0.62799174",
"0.62564224",
"0.62564224",
"0.62564224",
"0.61525965",
"0.6135229",
"0.60769546",
"0.5994276",
"0.59541243",
"0.58434516",
"0.5792613",
"0.57871586",
"0.5673079",
"0.54575706",
"0.539304",
"0.5381592",
"0.53808695",
"0.5352892",
"0.52961195",
"0.52... | 0.6534602 | 0 |
The number of Record Set in the Hosted Zone. | def resource_record_set_count(self) -> int:
return pulumi.get(self, "resource_record_set_count") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def host_count(self) -> list:\n return self.__host_count",
"def get_num_records(self):\n return self.__num_records",
"def get_num_servers():\n return 1",
"def GetCount(self):\n return self._server.get_count()",
"def size(self):\n return len(self.records)",
"def valid_re... | [
"0.67740184",
"0.66367716",
"0.63688356",
"0.63507205",
"0.6305662",
"0.6289728",
"0.6289531",
"0.62798434",
"0.626668",
"0.62558305",
"0.6211027",
"0.6208782",
"0.6194545",
"0.61868024",
"0.61858153",
"0.6164547",
"0.6160839",
"0.61591697",
"0.61557496",
"0.612175",
"0.61214... | 0.72843736 | 0 |
Method to check if the server is online. | def check_status(self):
try:
self.server.ping()
return True
except Exception as e:
return False | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_online(self) -> bool:\n return self.data[Attribute.ONLINE]",
"def online(self) -> bool:\n\t\treturn self._raw_result['data']['online']",
"def online(self):\n return False",
"def is_online(self) -> bool:\n return not self.config['local_db']",
"def is_connected(self):\n if ... | [
"0.77992815",
"0.7575708",
"0.7477461",
"0.7391489",
"0.73827904",
"0.73047626",
"0.7302724",
"0.7254714",
"0.7207145",
"0.7203586",
"0.7185473",
"0.71298015",
"0.71276796",
"0.7092198",
"0.7084505",
"0.7034005",
"0.70100087",
"0.69958395",
"0.69871825",
"0.6985079",
"0.69778... | 0.78663933 | 0 |
Method to get the current number of online players on the server. | def get_players(self):
return self.server.status().players.online | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def countPlayers():\n conn = connect()\n cur = conn.cursor()\n cur.execute(\"SELECT COUNT(*) FROM players\")\n players = int(cur.fetchone()[0])\n conn.close()\n return players",
"def countPlayers():\n conn = connect()\n cursor = conn.cursor()\n cursor.execute(\"SELECT count(*) FROM pla... | [
"0.7582035",
"0.7411029",
"0.7400161",
"0.7369294",
"0.73268086",
"0.7305472",
"0.72864294",
"0.7281656",
"0.7223753",
"0.71603715",
"0.71402276",
"0.7063319",
"0.7059221",
"0.70582587",
"0.70467985",
"0.70306456",
"0.70293796",
"0.69649446",
"0.69197816",
"0.6860911",
"0.675... | 0.7746294 | 0 |
Method to get the names of the online players on the server. | def get_player_names(self):
names = [user['name'] for user in self.server.status().raw['players']['sample']]
return names | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_players(self):\n return self.server.status().players.online",
"async def do_playerlist():\n\n download = urllib.request.urlopen(server_api2)\n data = json.loads(download.read())\n player_list = []\n try:\n for i in data['players']['sample']:\n ... | [
"0.8191454",
"0.7486142",
"0.7462232",
"0.7379445",
"0.7337121",
"0.7306165",
"0.7172897",
"0.7167493",
"0.71578574",
"0.7095188",
"0.70402354",
"0.6976687",
"0.69514036",
"0.68795854",
"0.6839602",
"0.6758238",
"0.6731101",
"0.6723271",
"0.6690739",
"0.66675806",
"0.662479",... | 0.7698575 | 1 |
Gets the saved coordinates from json file. | def load_coords(self):
file = open(self.coords_file, 'r')
return file.readlines() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def openPositionsFile():\n jsonPath = raw_input(\"Enter JSON file path in the following format: path_to_file/file_name\\n\")\n with open(jsonPath) as json_file:\n data = json.load(json_file)\n if printDebugInfo:\n for p in data['position']:\n print(p)\n return data"... | [
"0.67354447",
"0.6412808",
"0.63184804",
"0.62361187",
"0.622031",
"0.60825586",
"0.60539967",
"0.6048165",
"0.60118973",
"0.59567255",
"0.59064776",
"0.589559",
"0.5869195",
"0.58554953",
"0.5798748",
"0.5766442",
"0.5745784",
"0.5727415",
"0.5724693",
"0.5724643",
"0.572399... | 0.65379596 | 1 |
Checks if coordinates json file was already created. | def check_coords_file(self):
if path.exists(self.coords_file):
return True
return False | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def doesJsonFileExists(json_filename):\n return os.path.exists(json_filename)",
"def check_if_file_exists():\n try:\n if file_name in os.listdir(path_to_txt_file):\n return True\n else:\n with open(os.path.join(path_to_txt_file, file_name), \"a\") as f:\n ... | [
"0.6746882",
"0.64690447",
"0.6355706",
"0.62859267",
"0.62608707",
"0.6204504",
"0.618769",
"0.6005419",
"0.5969335",
"0.59210336",
"0.59087235",
"0.58973306",
"0.58772624",
"0.5873809",
"0.58198476",
"0.58173376",
"0.5788313",
"0.5749534",
"0.5734379",
"0.5707005",
"0.56662... | 0.7352912 | 0 |
clinvar_path_count is a df, the return value of data_for_lollipop | def plot_lollipop(clinvar_path_count):
os.chdir("/Users/Files/nogit/generisk/lollipop/figure")
app = '/Users/files/work/bin/lollipops'
for i in x.itertuples(False, None):
# uid, variants, gn
os.system("%s -domain-labels=fit -U %s -o %s.svg %s" % (app, i[0], i[2], i[1]))
# os.syste... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def counter(data, location):\n\n df = pd.DataFrame(data)\n df.columns = ['Path']\n df['Category'] = df['Sub-Category'] = ''\n\n # Split in categories and sub-categories\n for i in range(len(df)):\n tmp_categories = df['Path'][i].split(location)[1].split(\"\\\\\")[1:3]\n df['Category'].... | [
"0.60737485",
"0.57466406",
"0.54247874",
"0.5375222",
"0.5329486",
"0.5303458",
"0.52731305",
"0.5210808",
"0.51929486",
"0.51618755",
"0.51459765",
"0.5144362",
"0.5116025",
"0.51139134",
"0.50974935",
"0.50899947",
"0.5063606",
"0.505901",
"0.50228804",
"0.50226504",
"0.50... | 0.60626435 | 1 |
Verify that the widget can be constructed via CustomWidgetFactory (Issue 293) | def test_customWidgetFactory(self):
value_type = TextLine(__name__='bar')
self.field = List(__name__='foo', value_type=value_type)
request = TestRequest()
# set up the custom widget factory and verify that it works
sw = CustomWidgetFactory(ListSequenceWidget)
widget = s... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_widget(self):\n pass",
"def _call_widget_constructed(widget):\n if Widget._widget_construction_callback is not None and callable(Widget._widget_construction_callback):\n Widget._widget_construction_callback(widget)",
"def createWidget(self, QWidget): # real signature unknown... | [
"0.67102534",
"0.6389362",
"0.637193",
"0.63219786",
"0.6232894",
"0.62249875",
"0.6219074",
"0.6214956",
"0.6096169",
"0.6074959",
"0.6070172",
"0.605517",
"0.5981613",
"0.5856861",
"0.584954",
"0.5783246",
"0.5742729",
"0.5724761",
"0.5700318",
"0.5696485",
"0.56520283",
... | 0.66995114 | 1 |
This test verifies that the specified subwidget is not ignored. (Issue 293) | def test_subwidget(self):
self.field = List(__name__='foo',
value_type=TextLine(__name__='bar'))
request = TestRequest()
class PollOption:
pass
ow = CustomWidgetFactory(ObjectWidget, PollOption)
widget = SequenceWidget(
self.fiel... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_lacking_parent(self):\n pass",
"def test_empty_ui(self):",
"def test_recipe_nutrition_label_widget(self):\n pass",
"def doctest_widgeterrors(self):",
"def test_filter_not_available_plugins(plugin_dialog_constructor):\n item = plugin_dialog_constructor.available_list.item(0)\n w... | [
"0.61120284",
"0.6052781",
"0.5949088",
"0.5937731",
"0.5806545",
"0.57675236",
"0.57296896",
"0.5712875",
"0.5647386",
"0.56221986",
"0.5621786",
"0.559281",
"0.5587294",
"0.5586787",
"0.558327",
"0.55618143",
"0.55410874",
"0.5523015",
"0.55062604",
"0.5474863",
"0.5452454"... | 0.6886723 | 0 |
Test the get_album_tracks_lastfm function. | def test_album_tracks_lastfm(monkeypatch, bot):
song = Song('Sabaton', '1 6 4 8')
with monkeypatch.context() as mkp:
# An empty list should be returned if we can't find the album's name
mkp.setattr(song, 'fetch_album_name', lambda: None)
assert bot.get_album_tracks_lastfm(song) == []
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_album_tracks_lastfm_notfound(bot, monkeypatch):\n\n def get_lastfm(*args, **kwargs):\n return []\n\n song = Song('Horrendous', 'The Idolater', album='Idol')\n monkeypatch.setattr(bot, 'get_lastfm', get_lastfm)\n assert bot.get_album_tracks_lastfm(song) == []",
"def test_get_gm_track_a... | [
"0.7396314",
"0.73466265",
"0.7263434",
"0.7177026",
"0.7151662",
"0.7119123",
"0.7052538",
"0.6996615",
"0.6951498",
"0.6951156",
"0.6921699",
"0.68897605",
"0.68730336",
"0.68409187",
"0.6780899",
"0.67523515",
"0.67197675",
"0.6712656",
"0.6706053",
"0.66966254",
"0.665186... | 0.86596155 | 0 |
Test get_album_tracks_lastfm when the album isn't found in the lastfm database. | def test_album_tracks_lastfm_notfound(bot, monkeypatch):
def get_lastfm(*args, **kwargs):
return []
song = Song('Horrendous', 'The Idolater', album='Idol')
monkeypatch.setattr(bot, 'get_lastfm', get_lastfm)
assert bot.get_album_tracks_lastfm(song) == [] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_album_tracks_lastfm(monkeypatch, bot):\n song = Song('Sabaton', '1 6 4 8')\n with monkeypatch.context() as mkp:\n # An empty list should be returned if we can't find the album's name\n mkp.setattr(song, 'fetch_album_name', lambda: None)\n assert bot.get_album_tracks_lastfm(song)... | [
"0.78057355",
"0.7289795",
"0.7252033",
"0.7206001",
"0.7122318",
"0.70326763",
"0.69643843",
"0.69070643",
"0.6903369",
"0.6797229",
"0.6772743",
"0.6771438",
"0.6686256",
"0.6536612",
"0.6468081",
"0.64060736",
"0.63993305",
"0.6380914",
"0.63439864",
"0.62933856",
"0.62925... | 0.7764682 | 1 |
Test get the next song when there is no "last result". | def test_next_song_no_last(bot):
assert bot._get_next_song(1) == "You haven't searched for anything yet" | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_next_song(monkeypatch, bot, bot_arg, update):\n tracks = [fake_res['title'], 'crop killer']\n song_next = Song(fake_res['artist'], 'crop killer', fake_res['album'])\n bot.log_result('chat_id', fake_log)\n monkeypatch.setattr(bot, 'get_album_tracks', lambda x: tracks)\n monkeypatch.setattr(b... | [
"0.71742153",
"0.6990518",
"0.6872411",
"0.6839317",
"0.67882067",
"0.6705445",
"0.6655186",
"0.6606213",
"0.65747505",
"0.655576",
"0.65492976",
"0.64845383",
"0.6454853",
"0.6401809",
"0.63818043",
"0.63159424",
"0.62914926",
"0.62914926",
"0.62609434",
"0.624791",
"0.62369... | 0.8162643 | 0 |
Test get the last song when a database error is thrown. | def test_next_song_dberror(bot):
bot.DB.get_last_res = raise_sqlite_error
assert bot._get_next_song(1).startswith('There was an error while') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_next_song_no_last(bot):\n assert bot._get_next_song(1) == \"You haven't searched for anything yet\"",
"def test_get_song_from_string_lastres(bot):\n chat_id = 'chat_id'\n assert bot.get_song_from_string('', chat_id) is None\n\n song = Song(fake_res['artist'], 'the spectral burrows')\n bot... | [
"0.69886935",
"0.6453285",
"0.63909763",
"0.6252335",
"0.6249146",
"0.60535055",
"0.6013169",
"0.59707844",
"0.5965629",
"0.5878197",
"0.58155",
"0.57550037",
"0.57537675",
"0.5752658",
"0.57273436",
"0.57097805",
"0.5668873",
"0.5655142",
"0.5654345",
"0.5623878",
"0.5611177... | 0.8314661 | 0 |
Test the next_song function, in a similar manner to _get_next_song. | def test_next_song(monkeypatch, bot, bot_arg, update):
tracks = [fake_res['title'], 'crop killer']
song_next = Song(fake_res['artist'], 'crop killer', fake_res['album'])
bot.log_result('chat_id', fake_log)
monkeypatch.setattr(bot, 'get_album_tracks', lambda x: tracks)
monkeypatch.setattr(bot, 'get_l... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_next_song_no_last(bot):\n assert bot._get_next_song(1) == \"You haven't searched for anything yet\"",
"def test_next_song_existing(bot, monkeypatch):\n tracks = [fake_res['title'], 'war squids']\n song_next = Song(fake_res['artist'], 'war squids', fake_res['album'])\n bot.log_result('chat_id... | [
"0.80616593",
"0.70833504",
"0.6551184",
"0.6547794",
"0.6443022",
"0.63304055",
"0.6254037",
"0.61435354",
"0.6135437",
"0.6078019",
"0.60705954",
"0.59717166",
"0.59537244",
"0.59254426",
"0.59226817",
"0.5877128",
"0.58664715",
"0.58157194",
"0.5801898",
"0.5790758",
"0.57... | 0.7598171 | 1 |
Test the 'other' function when there is no last result. | def test_other_no_lastres(bot, bot_arg, update):
other(bot_arg, update)
expect = "You haven't searched for anything yet"
assert bot_arg.msg_log[0] == expect | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_original_failure_no_result(self):\n dr = EventualResult(Deferred(), None)\n self.assertIdentical(dr.original_failure(), None)",
"def test_other_no_sources(monkeypatch, bot, bot_arg, update):\n monkeypatch.setattr(fake_log, 'source', lyricfetch.sources[-1])\n bot.log_result('chat_id',... | [
"0.58186775",
"0.5798683",
"0.5745258",
"0.5676391",
"0.5519439",
"0.5500581",
"0.5474225",
"0.54740494",
"0.5442785",
"0.5411829",
"0.5395616",
"0.5394265",
"0.5384417",
"0.5369499",
"0.53414977",
"0.53362775",
"0.5331309",
"0.53170604",
"0.5310758",
"0.52819824",
"0.5265766... | 0.6440197 | 0 |
Test the 'other' function when a database error is thrown. | def test_other_dberror(monkeypatch, bot, bot_arg, update):
monkeypatch.setattr(bot.DB, 'get_last_res', raise_sqlite_error)
other(bot_arg, update)
expect = "There was an error"
assert bot_arg.msg_log[0].startswith(expect) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_database_error(self):\n self.mocked_cursor.execute.side_effect = psycopg2.Error('testing')\n\n db = database.Database()\n\n with self.assertRaises(database.DatabaseError):\n db.execute(sql=\"SELECT * from FOO WHERE bar LIKE 'baz'\")",
"def test_operational_error_asis(self... | [
"0.706118",
"0.6862969",
"0.68514043",
"0.6611012",
"0.6540552",
"0.6519421",
"0.65068513",
"0.64066577",
"0.6398573",
"0.62811404",
"0.62338924",
"0.6158034",
"0.6150795",
"0.61429304",
"0.60860145",
"0.60612416",
"0.6022419",
"0.6011335",
"0.6010869",
"0.5997017",
"0.599402... | 0.7879741 | 0 |
Test the 'other' function when there are no sources left to search. | def test_other_no_sources(monkeypatch, bot, bot_arg, update):
monkeypatch.setattr(fake_log, 'source', lyricfetch.sources[-1])
bot.log_result('chat_id', fake_log)
other(bot_arg, update)
assert 'No other sources' in bot_arg.msg_log[0] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _exhaust_sources(self):\n return self._exhaust_sinks(False)",
"def test_other_study_not_in_queryset(self):\n # Delete all but five source traits, so that there are 5 from each study.\n study2 = factories.StudyFactory.create()\n datasets2 = factories.SourceDatasetFactory.create_bat... | [
"0.60342205",
"0.60309976",
"0.60309976",
"0.6021816",
"0.5878495",
"0.5837152",
"0.58095074",
"0.5807957",
"0.5797928",
"0.5783555",
"0.5783555",
"0.5677167",
"0.5624478",
"0.55803376",
"0.5540973",
"0.5465158",
"0.5462644",
"0.5429145",
"0.5402934",
"0.53961384",
"0.5387592... | 0.7218802 | 0 |
Test get a song from string when there is no hyphen and we must get the last result from the database. | def test_get_song_from_string_lastres(bot):
chat_id = 'chat_id'
assert bot.get_song_from_string('', chat_id) is None
song = Song(fake_res['artist'], 'the spectral burrows')
bot.log_result(chat_id, fake_log)
assert get_song_from_string('the spectral burrows', chat_id) == song | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_next_song_no_last(bot):\n assert bot._get_next_song(1) == \"You haven't searched for anything yet\"",
"def get_genius_song(song_name, artist_name, genius):\n song_search = song_name\n for i in range(0, 2):\n song = genius.search_song(song_search, artist_name)\n if isinstance(song,... | [
"0.6347689",
"0.6228285",
"0.5924302",
"0.582431",
"0.5809196",
"0.5759926",
"0.5721979",
"0.5701278",
"0.55461097",
"0.5545594",
"0.5538054",
"0.5502107",
"0.550056",
"0.54373854",
"0.5379616",
"0.5351564",
"0.53450495",
"0.53434765",
"0.5327869",
"0.5308426",
"0.5305262",
... | 0.7282192 | 0 |
Call get_lyrics with an invalid song string. | def test_get_lyrics_invalid_format(bot):
assert get_lyrics('asdf', 1) == 'Invalid format!' | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def song_lyrics(message):\n spaceless_message = message.partition(' ')[2]\n if \":\" in spaceless_message:\n # Try and find the lyrics.\n band_name = spaceless_message[0]\n song_title = spaceless_message[2]\n\n response = requests.get(\"https://api.lyrics.ovh/v1/{}/{}\".format(ban... | [
"0.6738101",
"0.6445078",
"0.63653356",
"0.6246173",
"0.62159735",
"0.6191903",
"0.60005915",
"0.5986469",
"0.59748304",
"0.59558654",
"0.5863106",
"0.5796768",
"0.5692051",
"0.5686115",
"0.5656031",
"0.5635698",
"0.5610595",
"0.5536044",
"0.5534624",
"0.55328876",
"0.5510843... | 0.73288596 | 0 |
Test get_lyrics when no lyrics are found. | def test_get_lyrics_notfound(monkeypatch, bot):
def assert_not_found(msg):
msg = get_lyrics(song, 1)
msg = msg.lower()
assert song.artist in msg
assert song.title in msg
assert 'could not be found' in msg
song = Song('nothing more', 'christ copyright')
result = Noth... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_metrolyrics(self):\n bad_res = lw.get_lyrics('metrolyrics', 'eminem', 'los yourself')\n good_res = lw.get_lyrics('metrolyrics', 'eminem', 'lose yourself')\n self.assertEqual(bad_res, 404)\n self.assertTrue(good_res)",
"def fetch_lyrics(self) -> None:\n if self.artist i... | [
"0.7500179",
"0.74694115",
"0.71349835",
"0.70423263",
"0.6872192",
"0.6845288",
"0.67770845",
"0.6532795",
"0.6516938",
"0.6410143",
"0.6322516",
"0.62454045",
"0.6184087",
"0.6180595",
"0.61677897",
"0.61660856",
"0.61308",
"0.6092821",
"0.606668",
"0.6049119",
"0.60426885"... | 0.76229817 | 0 |
Test the 'unknown' function. | def test_unknown(bot_arg, update):
unknown(bot_arg, update)
assert "didn't understand that" in bot_arg.msg_log[0] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_unknown(self):\n\t\tunknown_value = yield self.conn.get(\"unknown_value\")\n\t\tself.assertEqual(unknown_value, None)",
"def is_unknown(t):\n if isinstance(t, (pytd.ClassType, pytd.NamedType, pytd.Class, StrictType)):\n return escape.is_unknown(t.name)\n elif isinstance(t, str):\n return escape.... | [
"0.64093006",
"0.64027274",
"0.6377091",
"0.6197272",
"0.6132028",
"0.60361356",
"0.5997667",
"0.59964794",
"0.59891725",
"0.59784913",
"0.5956408",
"0.5928595",
"0.5904926",
"0.5896253",
"0.58878225",
"0.58861905",
"0.58815604",
"0.5880036",
"0.5879943",
"0.58641994",
"0.585... | 0.6681351 | 0 |
Test sending a message that is longer than the maximum allowed by telegram. | def test_send_message_not_fitting(bot_arg, monkeypatch):
monkeypatch.setattr(telegram.constants, 'MAX_MESSAGE_LENGTH', 5)
msg = 'helloworld'
send_message(msg, bot_arg, 1)
assert bot_arg.msg_log[0] == 'hello'
assert bot_arg.msg_log[1] == 'world' | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_long_message(self):\n message = \"few characters\"\n message_displayed = truncate_message(message, limit=5)\n\n self.assertLessEqual(len(message_displayed), 5)\n self.assertEqual(message_displayed, \"fe...\")",
"def test_small_message(self):\n message = \"few character... | [
"0.7167605",
"0.69018114",
"0.6781949",
"0.6755295",
"0.6729733",
"0.6699064",
"0.6553883",
"0.65251297",
"0.65142053",
"0.65109736",
"0.6484465",
"0.64429766",
"0.6396204",
"0.63294137",
"0.62985414",
"0.6297835",
"0.6297835",
"0.6251885",
"0.6240822",
"0.6238086",
"0.623278... | 0.70073664 | 1 |
Flush the cache, keeping the .gitkeep file | def clear_cache():
path = join("data", "cache")
file_list = os.listdir(path)
file_list.remove(".gitkeep") # Exclude .gitkeep
for filename in file_list:
os.remove(join(path, filename)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def flush_cache(self):\n if self.cache_modified:\n self.cache_manager.write(self.cache_file, self.cache)",
"def flush():\n for k in cache._thecache.keys():\n del cache._thecache[k]",
"def clear(self, cacheDir):",
"def clear_cache():\n # TODO\n pass",
"def _purge():\r... | [
"0.72660595",
"0.6947423",
"0.6709483",
"0.6554378",
"0.65490085",
"0.65429986",
"0.6541775",
"0.64756626",
"0.6425061",
"0.6403782",
"0.6373244",
"0.63501006",
"0.63453245",
"0.6305221",
"0.6297528",
"0.62951314",
"0.6263235",
"0.6243842",
"0.62367994",
"0.62316805",
"0.6226... | 0.7597939 | 0 |
Return whether we are performing a forcedrun execution. This setting is configured in each deployment by the absence or the value of the environment variable. By default, the variable is undefined. As a consequence, execution is NOT a forcedrun. If the variable is defined in the deployment with an appropriate value, th... | def is_forced_run(self):
try:
v = environment.get("Run")
return v.lower() == "force"
except KeyError:
return False | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_dry_run():\n return 'DRY_RUN' in os.environ and os.environ['DRY_RUN']=='true'",
"def force_run_ingestion(self):\n # Set this value when you want to run the ingestion forcefully (ignores runtime).\n return os.environ.get('SNYK_INGESTION_FORCE_RUN', 'false').lower() in ('1', 'yes', 'true')"... | [
"0.6732974",
"0.6503736",
"0.6381244",
"0.61980015",
"0.6027737",
"0.5841637",
"0.5828859",
"0.5728668",
"0.568781",
"0.5658217",
"0.5606263",
"0.5547213",
"0.5488605",
"0.54747444",
"0.5451495",
"0.5408955",
"0.5407869",
"0.54043424",
"0.53674996",
"0.53574234",
"0.5347121",... | 0.6823267 | 0 |
Return quick run file size limit, if any. This setting is configured in each deployment by the absence or the value of the environment variable. By default, the variable is undefined. As a consequence, execution is NOT limited to a quick run. If the variable is defined in the deployment with an appropriate value, then ... | def quick_run_limit(self):
try:
return int(environment.get("Quick"))
except KeyError:
return maxsize | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_max_file_size(organization):\n if features.has('organizations:large-debug-files', organization):\n return MAX_FILE_SIZE\n else:\n return options.get('system.maximum-file-size')",
"def bytes_limit_per_file(self) -> Optional[float]:\n return pulumi.get(self, \"bytes_limit_per_fil... | [
"0.6571388",
"0.64634013",
"0.6419328",
"0.6321344",
"0.6202629",
"0.6162283",
"0.60888207",
"0.60778314",
"0.6070589",
"0.60394925",
"0.6031797",
"0.6027629",
"0.5937823",
"0.59000057",
"0.5899499",
"0.58935416",
"0.58409464",
"0.5825278",
"0.5821842",
"0.5804557",
"0.578575... | 0.8254428 | 0 |
Return disk space to reserve in bytes. In the absence of a defined value for the environment variable, we use the maximum integer value as a default. | def reserved_disk_space_in_bytes(self):
try:
return int(environment.get("ReservedDiskSpaceInBytes"))
except KeyError:
return maxsize | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def disk_size_gb(self) -> Optional[int]:\n return pulumi.get(self, \"disk_size_gb\")",
"def os_disk_size_gb(self) -> Optional[pulumi.Input[int]]:\n return pulumi.get(self, \"os_disk_size_gb\")",
"def disk_size_gb(self) -> Optional[pulumi.Input[int]]:\n return pulumi.get(self, \"disk_size_g... | [
"0.7575747",
"0.74775064",
"0.7430429",
"0.7430429",
"0.73794925",
"0.73093605",
"0.72992253",
"0.7247521",
"0.7247521",
"0.72284746",
"0.71383595",
"0.70958656",
"0.7090148",
"0.70897526",
"0.7083347",
"0.7045148",
"0.7026462",
"0.6994101",
"0.6975483",
"0.697373",
"0.695814... | 0.8526449 | 0 |
Return whether we should fake the data processing during execution. This setting is configured in each deployment by the absence or presence of the environment variable. By default, the variable is undefined. As a consequence, execution performs real data processing. If the variable is defined in the deployment, then d... | def should_fake_it(self):
try:
environment.get("FakeIt")
return True
except KeyError:
return False | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _set(env_var: str) -> bool:\n return os.getenv(env_var) not in [None, \"0\"]",
"def force_run_ingestion(self):\n # Set this value when you want to run the ingestion forcefully (ignores runtime).\n return os.environ.get('SNYK_INGESTION_FORCE_RUN', 'false').lower() in ('1', 'yes', 'true')",
... | [
"0.6212216",
"0.61703634",
"0.59573674",
"0.58269876",
"0.57648176",
"0.56822157",
"0.5667479",
"0.5660275",
"0.5635705",
"0.5562188",
"0.5525948",
"0.5517411",
"0.5516783",
"0.55129766",
"0.54685026",
"0.5456239",
"0.54477954",
"0.5447645",
"0.5403436",
"0.5378102",
"0.53766... | 0.62784916 | 0 |
Process dynamic (version, buildNumber, etc.) variables in configsToBump, then append overrides files to both configsToBump and configsToOverride. | def bump(repo, configsToBump, configsToOverride):
# First pass. Bump variables in configsToBump.
configs = ['%s/%s' % (repo, x) for x in configsToBump.keys()]
cmd = ['python', BUMP_SCRIPT, '--bump-version', '--revision=tip']
cmd.extend(configs)
run_cmd(cmd)
# Second pass.... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def process_overrides(recipes, args, production_cat, pkginfo_template):\n for recipe in recipes:\n print SEPARATOR\n\n if recipe in RECIPE_EXCLUSIONS:\n print_error(\"Not overriding %s because it is in the list of \"\n \"exclusions.\" % recipe)\n contin... | [
"0.59467167",
"0.54992634",
"0.5489483",
"0.53910244",
"0.5206356",
"0.5183219",
"0.51365805",
"0.49758023",
"0.49654534",
"0.4964415",
"0.49213427",
"0.49041483",
"0.48747543",
"0.48483053",
"0.4837319",
"0.4816934",
"0.4809147",
"0.48077822",
"0.47929424",
"0.47876462",
"0.... | 0.72006035 | 0 |
Polynomial path with 2dof. | def test_2_dof():
pi = PolynomialPath([[1, 2, 3], [-2, 3, 4, 5]])
# [1 + 2s + 3s^2]
# [-2 + 3s + 4s^2 + 5s^3]
assert pi.dof == 2
npt.assert_allclose(
pi.eval([0, 0.5, 1]), [[1, -2], [2.75, 1.125], [6, 10]])
npt.assert_allclose(
pi.evald([0, 0.5, 1]), [[2, 3], [5, 10.75], [8, 26]]... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def poly(x, y, pd) :\n # Maximum polynomial degree allowed is 7.\n maxD = 7\n if pd > maxD :\n exit(\"Please choose a reasonable polynomial degree (0 <= pd <= \" + maxD + \").\")\n \n # Make the polynomial matrix one degree at a time.\n p = np.zeros((len(x), int((pd+1)*(pd+2)/2)), float)\n... | [
"0.5877362",
"0.5713289",
"0.55781525",
"0.5546463",
"0.54761523",
"0.54538196",
"0.53673464",
"0.53640336",
"0.535978",
"0.53562754",
"0.5353242",
"0.5334628",
"0.53283787",
"0.5319906",
"0.5314824",
"0.5310812",
"0.5289601",
"0.527042",
"0.52448535",
"0.5244457",
"0.5226753... | 0.7183994 | 0 |
Returns this assets parent. | def parent(self) -> "Asset":
if self.parent_id is None:
raise ValueError("parent_id is None")
return self._cognite_client.assets.retrieve(id=self.parent_id) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_parent(self) :\n return self.parent",
"def get_parent(self):\n return self.__parent",
"def get_parent(self):\n return self.__parent",
"def get_parent(self):\n return self.parent",
"def get_parent(self):\n return self.parent",
"def get_parent(self):\n retu... | [
"0.81516725",
"0.81502897",
"0.81502897",
"0.8144744",
"0.8144744",
"0.8144744",
"0.8117658",
"0.8098476",
"0.8074495",
"0.80494434",
"0.8011738",
"0.8011738",
"0.8011738",
"0.8011738",
"0.8011738",
"0.8011738",
"0.8011738",
"0.8011738",
"0.8011738",
"0.8011738",
"0.8011738",... | 0.8629353 | 0 |
Returns the children of this asset. | def children(self) -> "AssetList":
return self._cognite_client.assets.list(parent_ids=[self.id], limit=None) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def children(self):\n \n return self._children",
"def children(self):\n return self._children",
"def children(self):\n return self._children",
"def get_children(self):\n return self.children",
"def get_children(self):\n return self.children",
"def get_children(se... | [
"0.8182547",
"0.8090556",
"0.8090556",
"0.80696243",
"0.80696243",
"0.80696243",
"0.8058236",
"0.8041726",
"0.80314463",
"0.8005118",
"0.8002561",
"0.7948167",
"0.78151447",
"0.7815106",
"0.7764449",
"0.7716112",
"0.7673882",
"0.76692855",
"0.7637924",
"0.7501374",
"0.7501374... | 0.81256473 | 1 |
Returns the subtree of this asset up to a specified depth. | def subtree(self, depth: int = None) -> "AssetList":
return self._cognite_client.assets.retrieve_subtree(id=self.id, depth=depth) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def walk_up(self, depth):\n\n for child in list(self.children):\n if depth != 0:\n for grandchild in child.walk_up(depth - 1):\n yield grandchild\n yield child",
"def at_depth(self, depth):\n\n for child in list(self.children):\n if... | [
"0.59168005",
"0.57649565",
"0.57136005",
"0.56063646",
"0.55760044",
"0.55460095",
"0.5531996",
"0.55264354",
"0.5516027",
"0.54754025",
"0.5431022",
"0.54032105",
"0.53749126",
"0.53643876",
"0.5359537",
"0.53325975",
"0.52972066",
"0.5295351",
"0.52882385",
"0.5285441",
"0... | 0.66020304 | 0 |
Retrieve all time series related to this asset. | def time_series(self, **kwargs) -> "TimeSeriesList":
return self._cognite_client.time_series.list(asset_ids=[self.id], **kwargs) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def time_series(self) -> \"TimeSeriesList\":\n from cognite.client.data_classes import TimeSeriesList\n\n return self._retrieve_related_resources(TimeSeriesList, self._cognite_client.time_series)",
"def series(self):\n self._build_series_cache()\n return self._series_cache_list",
"d... | [
"0.78280294",
"0.6735956",
"0.6566788",
"0.6363838",
"0.6363037",
"0.6135289",
"0.6128475",
"0.6043039",
"0.5996767",
"0.5895782",
"0.58563006",
"0.58355224",
"0.5823913",
"0.5767158",
"0.5719882",
"0.5693506",
"0.56537366",
"0.561991",
"0.55686986",
"0.5562515",
"0.55389047"... | 0.8124298 | 0 |
Retrieve all events related to this asset. | def events(self, **kwargs) -> "EventList":
return self._cognite_client.events.list(asset_ids=[self.id], **kwargs) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_events(self):\n return self.s.query(Event).all()",
"def get_events(self):\n return self.events",
"def events(self):\r\n return resources.Events(self)",
"def events(self):\n return self.properties.get('events', EventCollection(self.context, ResourcePath(\"events\", self.res... | [
"0.78071976",
"0.7439992",
"0.742171",
"0.72335243",
"0.7150037",
"0.7131724",
"0.7094069",
"0.70850044",
"0.7005549",
"0.6855032",
"0.6823917",
"0.6823917",
"0.67939377",
"0.67784935",
"0.6756036",
"0.6756036",
"0.67382383",
"0.66848636",
"0.6676697",
"0.6664099",
"0.6653721... | 0.79029495 | 0 |
Retrieve all time series related to these assets. | def time_series(self) -> "TimeSeriesList":
from cognite.client.data_classes import TimeSeriesList
return self._retrieve_related_resources(TimeSeriesList, self._cognite_client.time_series) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def time_series(self, **kwargs) -> \"TimeSeriesList\":\n return self._cognite_client.time_series.list(asset_ids=[self.id], **kwargs)",
"def series(self):\n self._build_series_cache()\n return self._series_cache_list",
"async def allseries(self, ctx):\n\n await self.all_series_db.cal... | [
"0.7652075",
"0.65272546",
"0.6403004",
"0.6245555",
"0.6024957",
"0.59737056",
"0.5937228",
"0.5864775",
"0.5862282",
"0.5846199",
"0.5826165",
"0.576861",
"0.57455385",
"0.5719519",
"0.57088",
"0.56329936",
"0.5610572",
"0.55971056",
"0.55544055",
"0.5515932",
"0.54976714",... | 0.74349123 | 1 |
Uses the derivative of a signal to determine if a given contact has a lot of erroneous tracking. If it does, we remove to contact episode by setting cbool for that segment equal to 0 | def remove_bad_contacts(var_in,cbool,thresh=100):
var = var_in.copy()
cbool = cbool.astype('bool').ravel()
cc = cbool_to_cc(cbool)
var = scale_by_contact(var, cc)
d = get_d(var)
d[np.isnan(d)]=0
# get an estimate of energy. Seems to work better thatn just normal energy, but that could be c... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_for_deletion(self, track, **kwargs):\n\n track_covar_trace = np.trace(track.state.covar)\n\n if(track_covar_trace > self.covar_trace_thresh):\n return True\n return False",
"def can_fix_intersection(self, segment):\n\n points = segment.points\n points = [po... | [
"0.5459756",
"0.5209768",
"0.5206624",
"0.5117817",
"0.50691277",
"0.50636363",
"0.49198657",
"0.4851125",
"0.48395166",
"0.48337877",
"0.4827968",
"0.4823247",
"0.48087165",
"0.48003036",
"0.4800204",
"0.47899467",
"0.4772986",
"0.47655606",
"0.47613236",
"0.47513783",
"0.47... | 0.6851415 | 0 |
Generates an HTMLformatted title. | def html_title(title):
return '<center><h1>%s</h1></center>' % (title) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def generate_title(self, title=None):\n if title is None:\n title = self.header.get('title', self.title)\n\n title = self.generate(title)\n title = title.replace('<p>', '').replace('</p>', '')\n # no trailing newlines\n title = re.sub(r'\\n+', ' ', title).rstrip()\n return title",
"def htm... | [
"0.8341459",
"0.82716215",
"0.7656434",
"0.7573626",
"0.7361194",
"0.7356363",
"0.72149956",
"0.7210016",
"0.7207191",
"0.71843785",
"0.71535987",
"0.71287",
"0.71263456",
"0.705341",
"0.6992501",
"0.6969818",
"0.69469106",
"0.6933752",
"0.69260454",
"0.68983936",
"0.68831086... | 0.8386166 | 0 |
Navigation bar to the TLSMD output files. | def html_job_nav_bar(job_id):
if mysql.job_get_via_pdb(job_id) == 1 and \
mysql.job_get_state(job_id) != "running":
pdb_id = mysql.job_get_structure_id(job_id)
job_dir = os.path.join(conf.WEBTLSMDD_PDB_DIR, pdb_id)
job_url = os.path.join(conf.TLSMD_PUBLIC_URL, "pdb", pdb_id)
else:... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def printMenu():\n # tWelc = PrettyTable(['Welcome to the CLI-of the repository classifier'])\n print('Welcome to the CLI of the repository classifier')\n print(strStopper1)\n t = PrettyTable(['Action', ' Shortcut '])\n t.add_row(['Show Menu', '- m -'])\n t.add_row([' Predict repositori... | [
"0.6057359",
"0.6034846",
"0.59859174",
"0.5957672",
"0.58030015",
"0.57526445",
"0.573904",
"0.5686016",
"0.5654994",
"0.5625777",
"0.56099063",
"0.5605777",
"0.5597462",
"0.5560662",
"0.55291206",
"0.55291206",
"0.55291206",
"0.55291206",
"0.55291206",
"0.55291206",
"0.5529... | 0.60747164 | 0 |
Retrieves and confirms the job_id from a incoming form. Returns None on error, or the job_id on success. | def check_job_id(form):
if form.has_key("job_id"):
job_id = form["job_id"].value
if len(job_id) < conf.MAX_JOB_ID_LEN:
if job_id.startswith("TLSMD"):
if mysql.job_exists(job_id):
return job_id
return None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def job_id(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"job_id\")",
"def job_id(self):\n return self._properties.get(\"jobReference\", {}).get(\"jobId\")",
"def job_id(self):\n return self._job_id",
"def get_job_id(html_job_container):\n match = re.search(r'jobListingId=(\... | [
"0.7360215",
"0.70471656",
"0.70252824",
"0.6964862",
"0.6888575",
"0.68521976",
"0.68464434",
"0.6845232",
"0.6697045",
"0.6658918",
"0.66413057",
"0.6624893",
"0.6577838",
"0.6487356",
"0.64441955",
"0.6359855",
"0.6330652",
"0.6330601",
"0.6286953",
"0.62242323",
"0.613467... | 0.769435 | 0 |
Vet email addresses. The local part (the part before the '@') must not exceed 64 characters and the domain part (after the '@') must not exceed 255 characters. The entire email address length must not exceed 320 characters. | def vet_email(email_address):
## FIXME: Doesn't warn user!
if not re.match(r'^([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})$', email_address):
return False
local_part = re.sub(r'^([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})$', '\\1', email_address)
domain_part = re.sub(r'^([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def emailValidate(form, field):\n\n if ' ' in field.data:\n raise ValidationError(message='Invalid e-mail address')\n\n if field.data.count('.') < 1:\n raise ValidationError(message='Invalid e-mail address')\n\n if field.data.count('@') < 1:\n raise ValidationError(message='Invalid e-... | [
"0.62115145",
"0.5893035",
"0.5863252",
"0.5832122",
"0.58221656",
"0.58091474",
"0.57968146",
"0.5789164",
"0.57875025",
"0.5701058",
"0.56536895",
"0.5594931",
"0.55809003",
"0.55536616",
"0.55411094",
"0.5538588",
"0.5529117",
"0.5527824",
"0.5512873",
"0.550115",
"0.54929... | 0.7470432 | 0 |
PDB ID must be exactly four characters long, alphanumeric, and the first character must be an integer. | def vet_pdb_id(pdbid):
if len(pdbid) < 4 or not \
pdbid.isalnum() or not \
re.match(r'^[0-9][A-Za-z0-9]{3}$', pdbid):
return False
return True | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def validateID(id):\n\n if re.compile('[0-9]+').match(id) == None:\n output.completeOutputError(InvalidArgumentCount(descape =\"'%s' is not a valid Id. ID should be numeric with Length = '%s' \" \n\t\t\t% (id, lib.constants._ATTR_ID_LENGHT)))\n return -1\n else:\n # Check for the lenght ... | [
"0.6196791",
"0.6030777",
"0.60025144",
"0.5935318",
"0.590224",
"0.5859689",
"0.58503926",
"0.58375835",
"0.58206254",
"0.58169824",
"0.57689923",
"0.56995773",
"0.5696125",
"0.5684135",
"0.5674832",
"0.56671983",
"0.56293136",
"0.5590236",
"0.5587784",
"0.5584495",
"0.55659... | 0.7514391 | 0 |
Extract the input from the Job Edit Form and update the MySQL database with the information. | def extract_job_edit_form(form):
if not form.has_key("edit_form"):
return False
job_id = check_job_id(form)
if job_id is None:
return False
mysql.job_set_submit_time(job_id, time.time())
## TODO: Immediately create job dir + log.txt + ANALYSIS dir, 2009-05-26
if form.has_key(... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update(\n self,\n email,\n company_name,\n location,\n job_profile,\n salary,\n username,\n password,\n security_question,\n security_answer,\n notes,\n date_applied,\n status,\n):",
"def resubmit(self, _):\n kw = {}\n for k, v in self.form.items():\n ... | [
"0.6087179",
"0.60766715",
"0.60754335",
"0.5994368",
"0.58765996",
"0.5817481",
"0.57356733",
"0.5715622",
"0.57083696",
"0.56895345",
"0.568941",
"0.562106",
"0.5611653",
"0.55972356",
"0.55624634",
"0.5561959",
"0.5534011",
"0.5532841",
"0.55032957",
"0.55013615",
"0.54914... | 0.7030493 | 0 |
Returns a list of chain IDs and their sizes. | def chain_size_string(self, jdict):
## class QueuePage()
if jdict.has_key("chains") == False:
return "---"
listx = []
for cdict in jdict["chains"]:
if cdict["selected"]:
## Only show chains used selected for analysis
listx.append("... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def make_size_list(self) -> list[int]:\n content_size = sum(self.content.values())\n child_lists = [child.make_size_list() for child in self.children.values()]\n child_sizes = sum([child[-1] for child in child_lists])\n total_size = content_size + child_sizes\n result_list = list... | [
"0.6227316",
"0.60787",
"0.6010704",
"0.6010704",
"0.5907034",
"0.5645598",
"0.5639126",
"0.56307775",
"0.5604173",
"0.55451787",
"0.5543693",
"0.55387825",
"0.5531075",
"0.5517201",
"0.5495587",
"0.54524547",
"0.5447559",
"0.5445797",
"0.5430416",
"0.541095",
"0.540277",
"... | 0.607887 | 1 |
Checks if a PID exists for a given job_id. Returns True if PID exists; False otherwise. | def pid_exists(self, job_id):
## class QueuePage()
pid = mysql.job_get_pid(job_id)
if pid == None:
## job PID somehow did not get stored in the database, so return
## False => state='syserror'; job may still be running!
return False
else:
p... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def job_exists(self, job_id):\n\n return True if self.get_status(job_id) else False",
"def pidExists(self, pid):\n\n prochash = self.getHash( 'datahash' ) # safely get copy of process dict\n\n try:\n prochash[pid]\n return 1\n except KeyError:\n retu... | [
"0.75628537",
"0.7496444",
"0.7496444",
"0.7120322",
"0.7101424",
"0.7055036",
"0.7005929",
"0.6987888",
"0.68405396",
"0.6824123",
"0.68228626",
"0.6774983",
"0.6741999",
"0.66183275",
"0.65123653",
"0.64408153",
"0.64406836",
"0.64200723",
"0.6347286",
"0.62750775",
"0.6273... | 0.81589544 | 0 |
Calculate the total number of residues (with/without chains). | def total_number_of_residues(self, jdict):
chain_sizes = jdict["chain_sizes"]
total = 0
if chain_sizes == None:
return "NULL"
## Sum total number of residues from each chain (ignore type)
for c in chain_sizes.split(';'):
chid, length, selected, type = mis... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def numResidues(self):\n\n\t\tnres = 0\n\t\tfor chain in self.chain:\n\t\t\tnres += chain.numResidues()\n\n\t\treturn nres",
"def count_standard_residues(self):\n n = 0\n for na in self.iter_standard_residues():\n n += 1\n return n",
"def numAtoms(self):\n\n\t\tnatoms = 0\n\t\tf... | [
"0.80411106",
"0.69895184",
"0.6955774",
"0.6865094",
"0.6831306",
"0.67419803",
"0.6703559",
"0.6703559",
"0.65640444",
"0.6520846",
"0.64611775",
"0.63095415",
"0.6283391",
"0.62161195",
"0.6189576",
"0.6189576",
"0.61683124",
"0.6150403",
"0.61333907",
"0.6111731",
"0.6105... | 0.7481122 | 1 |
Constructs an HTML table of currently running TLSMD jobs. | def html_running_job_table(self, job_list):
## class QueuePage()
## get an array of "running" jobs from the job dictionary
run_jdict = []
for jdict in job_list:
if jdict["state"] == "running":
if self.pid_exists(jdict["job_id"]) == False:
m... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def html_completed_job_table(self, job_list):\n ## class QueuePage()\n completed_list = []\n for jdict in job_list:\n if jdict.get(\"state\") in [\"success\",\n \"errors\", # completed w/errors\n \"warnings\... | [
"0.7605129",
"0.7180135",
"0.7151896",
"0.66669893",
"0.65529746",
"0.6499379",
"0.64359367",
"0.64256793",
"0.63074625",
"0.6213433",
"0.6171387",
"0.61331993",
"0.61044794",
"0.6097313",
"0.6087599",
"0.6082376",
"0.60589355",
"0.60233265",
"0.6011055",
"0.5921703",
"0.5771... | 0.8019889 | 0 |
Constructs an HTML table of currently queued TLSMD jobs. | def html_queued_job_table(self, job_list):
## class QueuePage()
queued_list = []
for jdict in job_list:
if jdict.get("state") == "queued":
## Populate queued list for XHTML table below
queued_list.append(jdict)
l = ['<center>',
'<... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def html_running_job_table(self, job_list):\n ## class QueuePage()\n ## get an array of \"running\" jobs from the job dictionary\n run_jdict = []\n for jdict in job_list:\n if jdict[\"state\"] == \"running\":\n if self.pid_exists(jdict[\"job_id\"]) == False:\n ... | [
"0.7865275",
"0.77305275",
"0.73756",
"0.67556727",
"0.6353226",
"0.62651986",
"0.61604804",
"0.60441345",
"0.60264397",
"0.6026279",
"0.60135585",
"0.59753984",
"0.59500635",
"0.59109086",
"0.583598",
"0.582497",
"0.58104855",
"0.5794076",
"0.5787355",
"0.5772024",
"0.570150... | 0.7951832 | 0 |
Constructs an HTML table of completed TLSMD jobs. | def html_completed_job_table(self, job_list):
## class QueuePage()
completed_list = []
for jdict in job_list:
if jdict.get("state") in ["success",
"errors", # completed w/errors
"warnings", # completed w/wa... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def html_running_job_table(self, job_list):\n ## class QueuePage()\n ## get an array of \"running\" jobs from the job dictionary\n run_jdict = []\n for jdict in job_list:\n if jdict[\"state\"] == \"running\":\n if self.pid_exists(jdict[\"job_id\"]) == False:\n ... | [
"0.79591656",
"0.7440728",
"0.7374591",
"0.7078178",
"0.6794457",
"0.6604795",
"0.654275",
"0.62499547",
"0.6249119",
"0.6238693",
"0.62038714",
"0.61548877",
"0.6083998",
"0.59550744",
"0.58611035",
"0.5830356",
"0.58148694",
"0.5792985",
"0.5791959",
"0.57863826",
"0.574132... | 0.8162022 | 0 |
Constructs an HTML table of those TLSMD jobs currently in limbo. | def html_limbo_job_table(self, job_list):
## class QueuePage()
limbo_list = []
for jdict in job_list:
if jdict.get("state") not in ["queued",
"running",
"success",
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def html_running_job_table(self, job_list):\n ## class QueuePage()\n ## get an array of \"running\" jobs from the job dictionary\n run_jdict = []\n for jdict in job_list:\n if jdict[\"state\"] == \"running\":\n if self.pid_exists(jdict[\"job_id\"]) == False:\n ... | [
"0.75187105",
"0.7404917",
"0.6946317",
"0.6457395",
"0.6262728",
"0.6255164",
"0.6093605",
"0.60876936",
"0.60097134",
"0.59574497",
"0.5902616",
"0.58288616",
"0.5747897",
"0.5660192",
"0.5650838",
"0.5645835",
"0.5624689",
"0.5598187",
"0.55505246",
"0.55477077",
"0.554445... | 0.79820454 | 0 |
Kick PID of stuck job past current process and continue with next step. | def kick(self, job_id):
if webtlsmdd.signal_job(job_id):
x = ''
x += '<center>'
x += '<h3>Job %s has been signaled ' % (job_id)
x += 'to kick it past the process it was stuck on.</h3>'
x += '</center>'
else:
x = ''
x +... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _kill_self():\n os.kill(os.getpid(), signal.SIGKILL)",
"def kill_job(self , index):\n job = self.jobs.__getitem__( index )\n if job:\n job.kill()",
"async def job_kill(self, uid):\n self._require_running()\n await self._get_job(uid).kill()",
"def _kill_process(se... | [
"0.61652076",
"0.60445166",
"0.59813386",
"0.5910622",
"0.57984287",
"0.5788192",
"0.56946504",
"0.56780726",
"0.5641419",
"0.5641419",
"0.5605281",
"0.5594397",
"0.5495558",
"0.54627633",
"0.5455051",
"0.5431215",
"0.5414584",
"0.53885907",
"0.5375496",
"0.53733313",
"0.5370... | 0.64572847 | 0 |
Prepares the entered pdb id by first running some sanity checks on it. | def prepare_pdbid_entry(self):
## class Submit2Page
pdbid = self.form["pdbid"].value.upper()
if vet_pdb_id(pdbid) == False:
if pdbid is None or pdbid == "":
raise SubmissionException("No PDB file uploaded and no PDB ID given. Please try again.")
else:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def prep_id(self, prep_id):\n self.logger.debug(\"In 'prep_id' setter.\")\n\n self._prep_id = prep_id",
"def __post_init__(self):\n if len(self.spec_id) != LENGTH_SPEC_ID:\n raise ParseMismatchLength(\n 'spec id', len(self.spec_id), LENGTH_SPEC_ID\n )\n\n... | [
"0.6196702",
"0.5832721",
"0.54301536",
"0.54139745",
"0.54075736",
"0.53966755",
"0.53393596",
"0.53216696",
"0.531195",
"0.526282",
"0.5184505",
"0.5173359",
"0.5113412",
"0.50911635",
"0.5053502",
"0.5045845",
"0.5041388",
"0.5033705",
"0.5032461",
"0.502209",
"0.5006323",... | 0.6534044 | 0 |
Provides a summary table of the userselected chains. | def submission_summary_info(self, job_id):
## TODO: Post-sanity checks, 2009-01-08
#sanity = self.form["pdbfile"].value
chains = mysql.job_get_chain_sizes(job_id).rstrip(";")
## E.g.,
# name: CHAINA
# selected: True
# chain_id: A
# length: 39
# pr... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def printSummary(self):\n pass",
"def _print_summary(results):\n if not len(results) > 0:\n print 'No results to show in summary.'\n return\n\n table = {}\n for res in results:\n for k, v in res.iteritems():\n table.setdefault(k, []).append(v)\n print tabulate(t... | [
"0.5559637",
"0.5503203",
"0.54575735",
"0.5446811",
"0.5392895",
"0.5383742",
"0.53080225",
"0.530398",
"0.52894455",
"0.526215",
"0.5260733",
"0.5246037",
"0.5200263",
"0.5187482",
"0.5164535",
"0.5163648",
"0.5153294",
"0.513919",
"0.51374733",
"0.51342547",
"0.51106805",
... | 0.6068563 | 0 |
If a given PDB (from pdb.org) has already been analyzed, inform the user and redirect them to the correct analysis page. | def redirect_page(self, pdbid):
## class SubmitPDBPage
## check to see if this job is still running
try:
os.chdir(conf.WEBTLSMDD_PDB_DIR + '/' + pdbid)
except OSError:
title = "This structure is currently being analyzed, please check back later."
page... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def reanalyze_entry(brain_dump_id):\n\n # grabs the specific brain_dump id\n brain_dump = User_Brain_Dump.query.get(brain_dump_id)\n\n # grabs the entry's user id\n user_id = brain_dump.user_id\n\n # empty's all analysis columns from database\n brain_dump.analysis_confirmation = None\n brain_d... | [
"0.5920752",
"0.5909068",
"0.5081756",
"0.5032059",
"0.49532756",
"0.49447525",
"0.47622675",
"0.4739772",
"0.47024348",
"0.47015706",
"0.46805862",
"0.4677247",
"0.46757302",
"0.4665837",
"0.4665152",
"0.46339783",
"0.4605046",
"0.4603905",
"0.4594616",
"0.45904678",
"0.4568... | 0.6363265 | 0 |
If a given PDB (from pdb.org) has already been analyzed in the TLSMD database, inform the user and redirect them to the correct analysis page. | def redirect_page_path(self, pdbid, path_head, path_tail):
## class SubmitPDBPage
## check to see if this job is still running
try:
os.chdir(os.path.join(path_head, path_tail, pdbid))
except OSError:
title = "This structure is currently being analyzed, please che... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def redirect_page(self, pdbid):\n ## class SubmitPDBPage\n\n ## check to see if this job is still running\n try:\n os.chdir(conf.WEBTLSMDD_PDB_DIR + '/' + pdbid)\n except OSError:\n title = \"This structure is currently being analyzed, please check back later.\"\n ... | [
"0.65128624",
"0.58158886",
"0.5203128",
"0.5102974",
"0.4995786",
"0.4874221",
"0.48734334",
"0.48516473",
"0.4729247",
"0.46415758",
"0.455805",
"0.45578498",
"0.45173198",
"0.4513715",
"0.45094627",
"0.45094225",
"0.44990155",
"0.44984642",
"0.44962436",
"0.44876322",
"0.4... | 0.6068858 | 1 |
Calculates a running standard deviation for residue windows the same size as whatever the global 'min_subsegment_size' in conf.py is set to. | def min_subsegment_stddev(atomnum, restype, resnum, chain, tfactor):
## TODO: Doesn't do anything yet, 2009-06-05
min_subsegment_size = conf.globalconf.min_subsegment_size | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def stddev(r):\n avg = average(r)\n sdsq = sum([(i - avg) ** 2 for i in r])\n return (sdsq / (len(r) - 1 or 1)) ** 0.5",
"def _calc_sigma_sub(self):\n # concatenate all required frames\n sub_dfs = []\n for me_id in self.me_map[\"sub\"].keys():\n sub_dfs.append(self.draws[... | [
"0.6327944",
"0.61621475",
"0.5976758",
"0.59436226",
"0.58374864",
"0.58168095",
"0.58041745",
"0.5778454",
"0.5762257",
"0.5735945",
"0.571572",
"0.56945294",
"0.56935984",
"0.56887364",
"0.5675468",
"0.5648539",
"0.5646231",
"0.5619839",
"0.5584428",
"0.55778575",
"0.55490... | 0.7251237 | 0 |
upload data defined in suite config files | def upload(ctx, include, exclude, glob, suite_type, role, config_type, **kwargs):
ctx.obj.update(**kwargs)
ctx.obj.post_process()
namespace = ctx.obj["namespace"]
config_inst = ctx.obj["config"]
if ctx.obj["extend_sid"] is not None:
config_inst.extend_sid = ctx.obj["extend_sid"]
if ctx.o... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _setup_configfiles(self, Testboard):\n\n # Delete all root files which are already in the directory\n root_files = glob.glob(Testboard.testdir+'/*.root')\n for f in root_files:\n os.remove(f)\n # Change testboard name\n\tif Testboard.DTB and os.path.isfile(Testboard.testd... | [
"0.62134314",
"0.6128272",
"0.60044724",
"0.58380556",
"0.58147264",
"0.578947",
"0.5762027",
"0.5740328",
"0.5735863",
"0.56887776",
"0.5674667",
"0.5667179",
"0.56594956",
"0.5640938",
"0.56368756",
"0.55949014",
"0.5578448",
"0.5573602",
"0.5572225",
"0.5568002",
"0.556772... | 0.7054541 | 0 |
Creates the underlying QScrollAreacontrol. | def create(self, parent):
self.widget = QtGui.QScrollArea(parent) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initialize(self):\n super(QtScrollArea, self).initialize()\n self.widget.setWidgetResizable(True)\n shell = self.shell_obj\n self.set_horizontal_policy(shell.horizontal_scrollbar_policy)\n self.set_vertical_policy(shell.vertical_scrollbar_policy)\n self.update_scrolled... | [
"0.6846372",
"0.67334235",
"0.6563476",
"0.65526",
"0.63849133",
"0.60289884",
"0.58899915",
"0.5800125",
"0.5770922",
"0.5725076",
"0.5717068",
"0.57034504",
"0.5682479",
"0.56770515",
"0.5591207",
"0.55775094",
"0.5566369",
"0.5523448",
"0.549629",
"0.5468452",
"0.5455471",... | 0.7525216 | 0 |
The change handler for the 'horizontal_scrollbar_policy' attribute of the shell object. | def shell_horizontal_scrollbar_policy_changed(self, policy):
self.set_horizontal_policy(policy) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def shell_vertical_scrollbar_policy_changed(self, policy):\n self.set_vertical_policy(policy)",
"def set_horizontal_policy(self, policy):\n self.widget.setHorizontalScrollBarPolicy(SCROLLBAR_POLICY_MAP[policy])",
"def shell_scrolled_component_changed(self, component):\n self.update_scrolle... | [
"0.7937227",
"0.7118671",
"0.6365163",
"0.60562176",
"0.59975076",
"0.5772787",
"0.5753864",
"0.558016",
"0.549142",
"0.5431542",
"0.53283864",
"0.5290599",
"0.5285086",
"0.52777797",
"0.5272945",
"0.51884675",
"0.51543146",
"0.5131622",
"0.51261693",
"0.5123183",
"0.5068976"... | 0.8787408 | 0 |
The change handler for the 'vertical_scrollbar_policy' attribute of the shell object. | def shell_vertical_scrollbar_policy_changed(self, policy):
self.set_vertical_policy(policy) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_vertical_policy(self, policy):\n self.widget.setVerticalScrollBarPolicy(SCROLLBAR_POLICY_MAP[policy])",
"def shell_horizontal_scrollbar_policy_changed(self, policy):\n self.set_horizontal_policy(policy)",
"def _verticalLimit_changed(self):\n self.masterContainer.range2d.y_range.hig... | [
"0.73047817",
"0.70711106",
"0.6194338",
"0.61012226",
"0.6046099",
"0.5949231",
"0.5576599",
"0.5524259",
"0.54865617",
"0.54580563",
"0.5428458",
"0.538405",
"0.5283747",
"0.52358115",
"0.5208182",
"0.51148343",
"0.5110776",
"0.5100401",
"0.507341",
"0.5054894",
"0.50375354... | 0.88103604 | 0 |
Returns the pixel thickness of the scrollbar. | def horizontal_scrollbar_thickness(self):
return self._scrollbar_thickness(QtCore.Qt.Vertical) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _scrollbar_thickness(self, orientation):\n style = self.widget.style()\n options = QtGui.QStyleOptionSlider()\n options.orientation = orientation\n return style.pixelMetric(style.PM_ScrollBarExtent, options)",
"def vertical_scrollbar_thickness(self):\n return self._scrollba... | [
"0.81709373",
"0.7844087",
"0.70843136",
"0.69537735",
"0.6344168",
"0.6329697",
"0.63109493",
"0.6309036",
"0.63083583",
"0.6265546",
"0.62330115",
"0.61421156",
"0.61327064",
"0.60814065",
"0.6075257",
"0.60746574",
"0.60697436",
"0.6052102",
"0.60397506",
"0.60163426",
"0.... | 0.81261456 | 1 |
Scrolls the area such that position is visible with a minimum of margin points surrounding position. | def scroll_to_position(self, position, margin):
widget = self.widget
pos_x, pos_y = position
margin_x, margin_y = margin
widget.ensureVisible(pos_x, pos_y, margin_x, margin_y) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def scroll(self):\n x_position = self._player.get_position()[0]\n half_screen = self._master.winfo_width() / 2\n world_size = self._world.get_pixel_size()[0] - half_screen\n\n # Left side\n if x_position <= half_screen:\n self._view.set_offset((0, 0))\n\n # Betw... | [
"0.60477823",
"0.5771134",
"0.57528",
"0.568",
"0.56134474",
"0.55925626",
"0.549162",
"0.54896694",
"0.5444044",
"0.53946215",
"0.53735566",
"0.53594327",
"0.53421456",
"0.5341912",
"0.5330037",
"0.53266895",
"0.5315439",
"0.5314461",
"0.5307887",
"0.52936685",
"0.5254515",
... | 0.71465665 | 0 |
Set the horizontal scrollbar policy of the widget. | def set_horizontal_policy(self, policy):
self.widget.setHorizontalScrollBarPolicy(SCROLLBAR_POLICY_MAP[policy]) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def shell_horizontal_scrollbar_policy_changed(self, policy):\n self.set_horizontal_policy(policy)",
"def shell_vertical_scrollbar_policy_changed(self, policy):\n self.set_vertical_policy(policy)",
"def set_vertical_policy(self, policy):\n self.widget.setVerticalScrollBarPolicy(SCROLLBAR_PO... | [
"0.85504943",
"0.6672799",
"0.6206158",
"0.6092626",
"0.60145926",
"0.59022164",
"0.585062",
"0.57646316",
"0.5703384",
"0.5661059",
"0.5519735",
"0.55050296",
"0.510845",
"0.50691545",
"0.5028846",
"0.5028241",
"0.49248978",
"0.49080238",
"0.48861855",
"0.4885169",
"0.486976... | 0.868837 | 0 |
Set the vertical scrollbar policy of the widget. | def set_vertical_policy(self, policy):
self.widget.setVerticalScrollBarPolicy(SCROLLBAR_POLICY_MAP[policy]) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def shell_vertical_scrollbar_policy_changed(self, policy):\n self.set_vertical_policy(policy)",
"def shell_horizontal_scrollbar_policy_changed(self, policy):\n self.set_horizontal_policy(policy)",
"def _verticalLimit_changed(self):\n self.masterContainer.range2d.y_range.high = self.vertica... | [
"0.85757303",
"0.68146354",
"0.6376428",
"0.63734496",
"0.6206161",
"0.6160069",
"0.60783726",
"0.6061402",
"0.59966534",
"0.59714824",
"0.59625477",
"0.58701825",
"0.58362955",
"0.5811372",
"0.57900536",
"0.57039064",
"0.56290835",
"0.5555288",
"0.5437929",
"0.5432088",
"0.5... | 0.8727134 | 0 |
Returns the thickness of a scrollbar for the given orientation. | def _scrollbar_thickness(self, orientation):
style = self.widget.style()
options = QtGui.QStyleOptionSlider()
options.orientation = orientation
return style.pixelMetric(style.PM_ScrollBarExtent, options) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def horizontal_scrollbar_thickness(self):\n return self._scrollbar_thickness(QtCore.Qt.Vertical)",
"def vertical_scrollbar_thickness(self):\n return self._scrollbar_thickness(QtCore.Qt.Vertical)",
"def thickness(self):\n return self._thickness",
"def thickness(self, axis):\n self_... | [
"0.7322356",
"0.6980638",
"0.625378",
"0.60684514",
"0.59250116",
"0.56509924",
"0.54864556",
"0.53987056",
"0.53709817",
"0.5364809",
"0.5345227",
"0.531622",
"0.5300283",
"0.5216611",
"0.51905346",
"0.51728487",
"0.5159143",
"0.51531655",
"0.5147755",
"0.50983024",
"0.50983... | 0.8164339 | 0 |
Extracts a datetime from the response | def extract_datetime(self, response):
query = self.extract_datetime_query
extracted = response.css(query).extract()[1]
return parser.parse(extracted) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"async def _parse_source_response_date_time(self, response: Response) -> datetime:\n datetime_parts = [\n int(part) for part in (await self._soup(response)).find(id=\"start_of_the_test\").string.split(\".\")\n ]\n return datetime(*datetime_parts) # type: ignore",
"async def _parse... | [
"0.79426366",
"0.7339397",
"0.71386427",
"0.68361497",
"0.66566765",
"0.6571443",
"0.6484362",
"0.6456434",
"0.6424568",
"0.64067703",
"0.617769",
"0.6177138",
"0.6139293",
"0.6116735",
"0.6039263",
"0.6028237",
"0.6001679",
"0.5983113",
"0.5980621",
"0.59433204",
"0.5908383"... | 0.8225655 | 0 |
Wait indefinitely until clipboard updates. | def clipboard_get_new(delay):
old_value = clipboard.paste()
while True:
time.sleep(delay)
if old_value != clipboard.paste():
return clipboard.paste() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def process(self, clipboard):\n self.tellDataReady(clipboard)",
"def process(self, clipboard):\n self.tellJobDone(clipboard)",
"def wait(self):\n time.sleep(0.010)",
"def do_copy_button( self, event ):\n #rint( \" do_copy_button -- this is all \")\n data = self.msg_text.g... | [
"0.6809803",
"0.6657096",
"0.6005997",
"0.6005507",
"0.5936657",
"0.5913045",
"0.58616984",
"0.573949",
"0.573949",
"0.5706624",
"0.57012093",
"0.567593",
"0.56694824",
"0.5657187",
"0.55992585",
"0.55943197",
"0.5541146",
"0.55321795",
"0.55294585",
"0.55167407",
"0.5512626"... | 0.7066206 | 0 |
This Test function checks if created profile are stored properly | def test_creation_profile_5():
assert tuple_NT[0][4] == LIST_dict[0]['current_location'], "current_location' of profile is not getting stored properly" | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_user_profile_creation_is_successful(self):\n user_profile = UserProfile.objects.get(user_id=self.user_1.id)\n user_profile_count = UserProfile.objects.count()\n self.assertEqual(user_profile_count, 2)\n self.assertEqual(\n str(user_profile), \"{}'s profile\".format(u... | [
"0.7674644",
"0.7580885",
"0.75541806",
"0.7524186",
"0.7501352",
"0.7460986",
"0.7457584",
"0.7432721",
"0.73937774",
"0.73869324",
"0.73411703",
"0.7335702",
"0.73339915",
"0.7233293",
"0.7205926",
"0.7176779",
"0.712169",
"0.7119602",
"0.71054715",
"0.70917386",
"0.7051787... | 0.7818645 | 0 |
This Test checks speed of tuple of Named tuple vs List dictionary for 10000 profiles and 100 runs | def test_output_named_tuple_vs_dictionary_6():
assert delta2 > delta1, "Dictionary cannot be faster than named tuple" | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_creation_profile_1():\n assert tuple_NT[0][0] == LIST_dict[0]['name'], \"Name is not getting stored properly\"",
"def test_Stock_output_named_tuple_vs_dictionary_6():\n assert Stock_tuple[0][5] == Stock_list_dict[0][\"low\"], \"low is not getting stored properly\"",
"def test_Stock_output_named_... | [
"0.70121634",
"0.67443585",
"0.6736364",
"0.6672604",
"0.66200393",
"0.66166884",
"0.65688723",
"0.65532845",
"0.64768153",
"0.6465727",
"0.6439946",
"0.6432236",
"0.6425947",
"0.6380838",
"0.6335102",
"0.6250028",
"0.6230545",
"0.62303644",
"0.6226985",
"0.6206824",
"0.61906... | 0.72535396 | 0 |
Inherit name_search method to display only open period unless order close period by sending closed=True in context | def name_search(self, cr, uid, name, args=None, operator='ilike', context=None, limit=100):
if args is None:
args = []
if context is None:
context = {}
if not context.get('closed',False):
args.append(('state', '=', 'draft'))
return super(account_period... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def open_orders_for(self, symbol, **kwargs):\n pass",
"def check_open():\n print(\"***** Check if Business is Open/Closed *****\")\n while True:\n print()\n business_object = query_business_name()\n if business_object == \"back\":\n return\n elif business_objec... | [
"0.5439018",
"0.51086134",
"0.5074537",
"0.5014528",
"0.49597806",
"0.49188626",
"0.48757815",
"0.48425967",
"0.48119548",
"0.47705466",
"0.4760275",
"0.47557947",
"0.4748828",
"0.4740203",
"0.4728358",
"0.47148955",
"0.4681894",
"0.46631843",
"0.46542174",
"0.4633037",
"0.46... | 0.73366 | 0 |
Change record state to 'Close Extension Period'. | def action_close_extension_period(self, cr, uid, ids, context=None):
return self.write(cr, uid, ids, {'state': 'close_ext_period'}, context=context) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def close(self):\n if self.SE == 6:\n self.evr.polarity.put('VAL', 0)\n else:\n self.S_CLOSE = 1",
"def period():\n frequencyText.config(state = NORMAL)\n frequencyText.delete(\"1.0\", END)\n frequencyText.config(state = DISABLED)\n periodText.config(state = NORMAL... | [
"0.5360056",
"0.5283381",
"0.52647996",
"0.5101046",
"0.49256963",
"0.49256963",
"0.48778805",
"0.48285052",
"0.48243603",
"0.47544706",
"0.47275758",
"0.47134134",
"0.46966076",
"0.46900168",
"0.4663706",
"0.46563756",
"0.46095902",
"0.46050274",
"0.45834",
"0.45804593",
"0.... | 0.7069386 | 0 |
Update dict. of values to set interval_number depend on company_id | def onchange_company_id(self, cr, uid, ids, company_id, context=None):
# update related fields
values =super(account_config_settings,self).onchange_company_id(cr, uid, ids, company_id, context=context).get('value',{})
if company_id:
company = self.pool.get('res.company').bro... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _assign_interval(self, interval):\n # Assigning the new value to the interval attribute of the object\n self._interval = interval",
"def onchange_company_id(self, cr, uid, ids, company_id, context=None):\n # update related fields\n values = super(account_config_settings,self).onch... | [
"0.5722361",
"0.5711779",
"0.55583733",
"0.53475827",
"0.5331267",
"0.52638215",
"0.50676507",
"0.50386846",
"0.5000705",
"0.4980619",
"0.497043",
"0.4954634",
"0.49486285",
"0.49357754",
"0.49312472",
"0.4919323",
"0.48698786",
"0.4828236",
"0.4818634",
"0.48091066",
"0.4784... | 0.7145936 | 0 |
Return a class with a subclassing relation defined by condition. For example, a dataclass is a subclass of `meta(dataclasses.is_dataclass)`, and a class which name starts with "X" is a subclass of | def meta(condition):
class M(metaclass=_MetaMC):
@classmethod
def chk(cls, sub):
return condition(sub)
return M | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _class(self, class_):\r\n\r\n if class_:\r\n if hasattr(class_, '__mro__'):\r\n #this is a class\r\n return class_\r\n else:\r\n #this is an instance\r\n return type(class_)",
"def is_child_class(obj, classinfo):\n tr... | [
"0.58191466",
"0.55645275",
"0.55467886",
"0.55431736",
"0.5519225",
"0.5449369",
"0.54199857",
"0.5418476",
"0.54139614",
"0.54121",
"0.5364774",
"0.53476655",
"0.5340456",
"0.53266644",
"0.5319524",
"0.53147954",
"0.52681905",
"0.5266746",
"0.52517116",
"0.5250117",
"0.5245... | 0.5679015 | 1 |
Represent a class from an external module without importing it. For instance, `deferred("numpy.ndarray")` matches instances of numpy.ndarray, but it does not import numpy. When tested against a class, if the first part of class's `__module__` is `numpy`, then we do get the class and perform a normal issubclass check. I... | def deferred(ref):
module, _ = ref.split(".", 1)
if module in sys.modules:
return _getcls(ref)
@meta
def check(cls):
full_cls_mod = getattr(cls, "__module__", None)
cls_module = full_cls_mod.split(".", 1)[0] if full_cls_mod else None
if cls_module == module:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_cls(module_name, class_name, relaxed=True):\n try:\n module = importlib.import_module(module_name)\n except ImportError:\n if relaxed:\n return None\n else:\n raise ImportError(\"Cannot load module: %s\" % module_name)\n try:\n return getattr(modul... | [
"0.6054352",
"0.5656998",
"0.5559863",
"0.5437937",
"0.54031074",
"0.5366114",
"0.53174484",
"0.529934",
"0.5240702",
"0.5238219",
"0.52198845",
"0.5152897",
"0.51476014",
"0.51416516",
"0.51343495",
"0.51325387",
"0.5116952",
"0.51117676",
"0.50882465",
"0.50772965",
"0.5070... | 0.70132655 | 0 |
Match subclasses but not the base class. | def strict_subclass(base_cls):
@meta
def check(cls):
return (
isinstance(cls, type)
and issubclass(cls, base_cls)
and cls is not base_cls
)
return check | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_subclasses(self):\n subclasses = Route.get_subclasses()\n self.assertIn(RouteSubclass, subclasses)",
"def test_subclasses():\n\n class Foo:\n pass\n\n class FooSubclass1(Foo):\n pass\n\n class FooSubclass2(Foo):\n pass\n\n class FooSubSubclass(FooSubclass1)... | [
"0.6850487",
"0.6563661",
"0.64253914",
"0.63384956",
"0.6297802",
"0.62747264",
"0.62641436",
"0.62198013",
"0.6169413",
"0.6158218",
"0.614798",
"0.6123201",
"0.6085547",
"0.6055682",
"0.6036065",
"0.60155594",
"0.60061586",
"0.60010296",
"0.5998444",
"0.5998444",
"0.598039... | 0.6567737 | 1 |
Parse a map file and get the list and address of functions that need an EBC call signature MapPath Map file absolute path a list of call names with their address and source location | def ParseMap(MapPath):
Status = 0
CallList = []
with file(MapPath, 'r') as f:
for Line in f:
Line = Line.strip()
if Status == 0:
m = LoadRegexp.match(Line)
if m != None:
LoadAddr, = m.groups(0)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def extract_functions(elf_path):\n text_data = objdump_section(elf_path, '.text')\n name_to_addr = parse_func_names(text_data)\n return name_to_addr",
"def test_name_to_func_map(self):\n test_file = 'tests/commentsForProtobuf'\n options = Namespace()\n options.already = set()\n ... | [
"0.6285392",
"0.5960005",
"0.587519",
"0.5840056",
"0.5734801",
"0.56902933",
"0.56179845",
"0.5556671",
"0.55402553",
"0.5540253",
"0.5483655",
"0.546308",
"0.54578567",
"0.5428473",
"0.54148024",
"0.53862196",
"0.5375418",
"0.53696966",
"0.536472",
"0.53612435",
"0.53144807... | 0.7930335 | 0 |
Parse the list of files passed as arguments, and try to locate and open the matching signature files to build a complete EBC signature list. as the signature file to ensure that the signatures we need are present. FileList A list of .sig or .lib files a list of function calls with their signature data | def BuildSignatureList(FileList):
global Options
SigList = {}
for File in FileList:
File = os.path.splitext(File)[0]+'.sig'
try:
with open(File, 'rb') as f:
SavedList = pickle.load(f)
SigList.update(SavedList)
if Options.... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def InsertSignatures(EfiPath, MapList, SigList):\r\n global Options\r\n\r\n with file(EfiPath, 'r+b') as f:\r\n Width = max(len(Entry[0]) for Entry in MapList) + 3\r\n for Entry in MapList:\r\n f.seek(Entry[1] + 4)\r\n f.write(struct.pack('I', EBC_CALL_SIGNATURE + SigList[... | [
"0.6704335",
"0.6595664",
"0.57943064",
"0.57535946",
"0.550284",
"0.537398",
"0.53610235",
"0.5359635",
"0.53594905",
"0.5335583",
"0.5281481",
"0.5260002",
"0.5256223",
"0.5252075",
"0.5228386",
"0.518648",
"0.51670545",
"0.5163091",
"0.5162656",
"0.51602685",
"0.51576895",... | 0.7607971 | 0 |
Sanity check to ensures that the signatures' data and addresses are valid. EfiPath EFI binary absolute path MapList Function calls requiring signature, with their address SigList Function calls signature dictionary True if the check passed | def CheckSignatures(EfiPath, MapList, SigList):
for Entry in MapList:
# Check for missing signatures
assert Entry[0] in SigList, Entry[0] + ": missing signature"
# Make sure the signature fits in 16 bits
assert SigList[Entry[0]] < 0x10000, Entry[0] + ": invalid signature"
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def verify_signature(self, inputs, signature):\n pass",
"def verify_signature(self, inputs, signature):\n pass",
"def check_sig(self):\n check_sig(self.path)\n dsc = self.get_dsc()\n if dsc is not None:\n check_sig(dsc)",
"def check_signature(func, args_list):\n ... | [
"0.6454883",
"0.6454883",
"0.6203771",
"0.6082283",
"0.60066277",
"0.589725",
"0.5780829",
"0.5754323",
"0.5745128",
"0.5704351",
"0.5690329",
"0.56869555",
"0.5671711",
"0.5637689",
"0.5632027",
"0.5616482",
"0.5605421",
"0.55926627",
"0.5592033",
"0.5582589",
"0.557417",
... | 0.76248276 | 0 |
Check the EFI binary to ensure we have the right signature addresses EfiPath EFI binary absolute path Maplist Function calls requiring signature, with their address SigList Function calls signature dictionary True if the signatures were successfully patched | def InsertSignatures(EfiPath, MapList, SigList):
global Options
with file(EfiPath, 'r+b') as f:
Width = max(len(Entry[0]) for Entry in MapList) + 3
for Entry in MapList:
f.seek(Entry[1] + 4)
f.write(struct.pack('I', EBC_CALL_SIGNATURE + SigList[Entry[0]]))
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def CheckSignatures(EfiPath, MapList, SigList):\r\n\r\n for Entry in MapList:\r\n # Check for missing signatures\r\n assert Entry[0] in SigList, Entry[0] + \": missing signature\"\r\n # Make sure the signature fits in 16 bits\r\n assert SigList[Entry[0]] < 0x10000, Entry[0] + \": inv... | [
"0.7423387",
"0.60030615",
"0.58278054",
"0.58134854",
"0.5771612",
"0.5715014",
"0.56960934",
"0.5694912",
"0.562864",
"0.562864",
"0.5564306",
"0.5447875",
"0.54326224",
"0.54109347",
"0.54098487",
"0.53810513",
"0.53389",
"0.5337648",
"0.5286845",
"0.5285099",
"0.5271251",... | 0.6480063 | 1 |
Warn the user about the consequences of private | def private_warn(*arg):
private = private_var.get()
if private:
response = tkmb.askokcancel(
"Are you sure?",
"Do you really want to encrypt this message?"
)
if not response:
private_var.set(False) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_private():",
"def is_private(self):\n return self.has_label(PRIVATE_LABEL)",
"def test_anon_private_owned(self):\n self.do_visible(False, 'pattieblack', False)",
"def unprotected_method():\n return {\"message\": \"Anyone access this function\"}",
"def test_anon_private(self):\n s... | [
"0.77440107",
"0.69688815",
"0.6957758",
"0.6921175",
"0.6896972",
"0.6894112",
"0.6877255",
"0.67691714",
"0.6722827",
"0.66259295",
"0.6572739",
"0.6530249",
"0.6516653",
"0.6504658",
"0.6504658",
"0.64209527",
"0.6383976",
"0.6333687",
"0.628751",
"0.62787426",
"0.62485266... | 0.7313388 | 1 |
Set the size of the text widget font from font_size | def set_font_size(*args):
size = font_size.get()
message_inp.configure(font=f'TKDefault {size}') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def font_size(self, font_size):\n\n self._font_size = font_size",
"def set_font_size(window, size):\n\n font = window.GetFont()\n\n clone = clone_font(font)\n clone.SetPointSize(size)\n\n window.SetFont(clone)\n\n sizer = window.GetSizer()\n if sizer is not None:\n sizer.Layout()\... | [
"0.825011",
"0.79229647",
"0.78743696",
"0.7262421",
"0.72342724",
"0.7176061",
"0.7148596",
"0.7000839",
"0.68073326",
"0.67930865",
"0.6782111",
"0.6718226",
"0.6685616",
"0.6653118",
"0.66332054",
"0.6600073",
"0.6575207",
"0.6569996",
"0.65508795",
"0.65224886",
"0.650452... | 0.83728653 | 0 |
Checking contains model in the list models | def check_model_in_the_list_models(model_list, insert_model):
for model in model_list:
if model == insert_model:
return
assert False, "Not Contains model in the list:\nModel_list:\n{model_list}\nInsert model:\n{insert_model}" \
.format(model_list='\n'.join(str(item) for item in model... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def all_words_in_model( wordlist, model ):\n for w in wordlist:\n if w not in model:\n return False\n return True",
"def __contains__(self, key):\n if isinstance(key, Model):\n key = key.get_id()\n return (str(key) in self.get_models())",
"def checkModel(self, m... | [
"0.7080808",
"0.6962256",
"0.6932167",
"0.6728187",
"0.672587",
"0.65640444",
"0.6505589",
"0.636146",
"0.62668175",
"0.626506",
"0.62137306",
"0.611053",
"0.60696316",
"0.6004021",
"0.6002861",
"0.597503",
"0.59138095",
"0.58687663",
"0.57763255",
"0.5771381",
"0.57686424",
... | 0.7467477 | 0 |
Run a single line of code, must specify language as first argument | async def runl(self, ctx: commands.Context, lang: str, *, code: str):
result = await self._run_code(lang=lang, code=code)
await self._send_result(ctx, result) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def evaluateCode(lang, code):",
"async def run(self, ctx: commands.Context, *, codeblock: str):\n matches = self.regex.findall(codeblock)\n if not matches:\n return await ctx.reply(embed=discord.Embed(title=\"Uh-oh\", description=\"Couldn't quite see your codeblock\"))\n lang = ma... | [
"0.7044243",
"0.70122194",
"0.69232357",
"0.6322827",
"0.6150624",
"0.60517126",
"0.60388607",
"0.5983013",
"0.5939188",
"0.58721954",
"0.58721334",
"0.5833688",
"0.574606",
"0.57401377",
"0.5726221",
"0.57081676",
"0.5682621",
"0.5670822",
"0.56631815",
"0.5631168",
"0.55212... | 0.7195875 | 0 |
Gets a single value from the row matching the given constraints. The table is inferred if the primary key column (named table + '_id') is the one and only constraint or the requested field. | def get(self, field, table=None, **constraints):
keys = constraints.keys()
table = (table or
(len(keys) == 1 and keys[0].endswith('_id') and keys[0][:-3]) or
(field.endswith('_id') and field[:-3]))
condition = ' and '.join(key + ' = %s' for key in keys)
for row in... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getOne(table, field, val):\n\n try:\n # return session.query(table).filter(getattr(table, field).like(val)).all()[0]\n return session.query(table).filter(getattr(table, field) == val).all()[0]\n except:\n return None",
"def get_row(self, pk):\n ans = self.execute(self.comman... | [
"0.67048126",
"0.65927976",
"0.62563574",
"0.61939067",
"0.6178963",
"0.617605",
"0.60721767",
"0.6057886",
"0.5971899",
"0.59341055",
"0.5895349",
"0.58888155",
"0.5871119",
"0.58566594",
"0.58557665",
"0.582698",
"0.57385176",
"0.57148165",
"0.57008827",
"0.5698757",
"0.567... | 0.78790146 | 0 |
Gets a list of the columns in a given table. | def get_columns(self, table):
if table not in self.columns:
self.columns[table] = [
row[0] for row in self.db.iter('describe ' + table)]
return self.columns[table] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_column_names(self, table):\n try:\n logging.info(f'Getting column names of table `{table}`')\n return list(self.execute(f'SELECT * FROM `{table}`'))\n except:\n logging.exception('Something went wrong getting column names. Check trace.')\n return",
... | [
"0.82274866",
"0.79291666",
"0.7908811",
"0.7837672",
"0.78036994",
"0.77943957",
"0.77833015",
"0.7763458",
"0.77592397",
"0.7706186",
"0.77030563",
"0.7658905",
"0.7624156",
"0.7621459",
"0.75971925",
"0.75971925",
"0.755043",
"0.75394607",
"0.75087816",
"0.75017136",
"0.74... | 0.8356804 | 0 |
Replaces the list of answers for a concept with the given list. | def set_concept_answers(concept_id, answer_concept_ids):
db.execute(
'delete from concept_answer where concept_id = %s', concept_id)
for i, answer_concept_id in enumerate(answer_concept_ids):
odb.insert('concept_answer', concept_id=concept_id,
answer_concep... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def updated_quiz(quiz_needs_update, qnum_to_replace, correct_response, qnum_list):\n\tnew_quiz = []\n\tnew_quiz_str = \"\"\n\treplace_word = \"\"\n\tquiz_list = quiz_needs_update.split()\n\tword_qnum = \"\"\n\tfor word in quiz_list:\n\t\tif qnum_in_quiz(word, qnum_list) == qnum_to_replace:\n\t\t\tword_qnum = qnum_... | [
"0.5492367",
"0.54707813",
"0.54546285",
"0.5310326",
"0.52870154",
"0.5186385",
"0.51176447",
"0.50884527",
"0.5084637",
"0.50743634",
"0.50642085",
"0.50445503",
"0.4990626",
"0.49629927",
"0.495043",
"0.49467948",
"0.49466908",
"0.49065292",
"0.48768532",
"0.48615122",
"0.... | 0.7063697 | 0 |
Creates or updates a concept with the given name, type, and class. | def put_concept(concept_id, name, locale, new_datatype_id, class_id):
datatype_id = db.get('datatype_id', concept_id=concept_id)
# Changing the datatype of an existing concept is illegal in OpenMRS.
if datatype_id and new_datatype_id != datatype_id:
raise ValueError("Concept %d: cann... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _create_concept(self, name, sco, cgi):\n\n # now define the class\n new_class = type(name, sco, {})\n\n self.name_mapping[name] = new_class\n self.new_classes.append(new_class)\n self.concepts.append(new_class)\n\n if cgi:\n # store that property in the clas... | [
"0.67004555",
"0.6327827",
"0.56523705",
"0.56393856",
"0.5569886",
"0.50180244",
"0.5006628",
"0.49734372",
"0.4960577",
"0.48982468",
"0.48790115",
"0.48628348",
"0.4843453",
"0.48377153",
"0.478348",
"0.4782703",
"0.47799903",
"0.47602475",
"0.47305244",
"0.47235557",
"0.4... | 0.762407 | 0 |
Removes all the form_fields from the given form. | def clear_form(form_id):
db.execute('update form_field set parent_form_field = null'
' where form_id = %s', form_id) # remove foreign keys
db.execute('delete from form_field where form_id = %s', form_id) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remove_all_fields(self):\n self.fields = None",
"def remove_ei_form(self, form):\n if form in self.ei_forms:\n self.ei_forms.remove(form)",
"def whitelist_form_fields(form, whitlisted_fields):\n for schema in getAdditionalSchemata(form):\n behavior_interface_name = schema... | [
"0.7328138",
"0.67329144",
"0.66833776",
"0.6117829",
"0.6116454",
"0.60049677",
"0.59082365",
"0.58605945",
"0.58189774",
"0.58025384",
"0.57722956",
"0.5757917",
"0.5715277",
"0.56766737",
"0.5645078",
"0.56342024",
"0.56286347",
"0.55984867",
"0.55777204",
"0.55396205",
"0... | 0.6876661 | 1 |
Applies the chart definition given rows from the chart tab. | def apply_chart(rows, form_id):
clear_form(form_id)
section = None
sections = []
section_rows = []
for row in rows:
if row['section'].strip():
if section and section_rows:
sections.append((section, section_rows))
se... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def apply_chart_sections(sections, form_id):\n clear_form(form_id)\n\n for i, (section, rows) in enumerate(sections):\n if section == '[chart_divider]':\n section_type = 'CHART_DIVIDER'\n else:\n section_type = section[:1] == '[' and 'TILE_ROW' or '... | [
"0.62310606",
"0.5419096",
"0.51259845",
"0.49639848",
"0.48974058",
"0.48543647",
"0.48513275",
"0.48392624",
"0.48142222",
"0.47633168",
"0.47146022",
"0.4655497",
"0.46546173",
"0.46359724",
"0.46314582",
"0.46309438",
"0.4615816",
"0.46020654",
"0.45901495",
"0.45556933",
... | 0.7453639 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.