Search is not available for this dataset
id int64 0 10.8M | vector listlengths 1.54k 1.54k | ast_depth int64 3 164 | ast_data stringlengths 297 510k | full_path stringlengths 0 319 | code stringlengths 60 56.5k |
|---|---|---|---|---|---|
12,801 | [
0.023505955934524536,
-0.011100675910711288,
-0.013911924324929714,
0.006193981040269136,
-0.049736570566892624,
0.010304059833288193,
0.030571596696972847,
0.02337895892560482,
0.012919039465487003,
-0.014096646569669247,
-0.014408365823328495,
-0.018599260598421097,
0.016509586945176125,
... | 8 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "reference_dt", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "reference_doc", "annotation": null, "type_comment": null}... | def generate_message_preview(reference_dt, reference_doc, message=None, subject=None):
frappe.has_permission("Auto Repeat", "write", throw=True)
doc = frappe.get_doc(reference_dt, reference_doc)
subject_preview = _("Please add a subject to your email")
msg_preview = frappe.render_template(message, {"doc": doc})
if... | |
12,802 | [
0.011776489205658436,
0.06259553134441376,
0.018406126648187637,
-0.015893971547484398,
-0.03222910314798355,
0.02602837048470974,
-0.02327112667262554,
0.013210255652666092,
-0.03352807089686394,
0.017817914485931396,
0.015416049398481846,
-0.040366031229496,
0.018418380990624428,
-0.0143... | 7 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "doctype", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "txt", "annotation": null, "type_comment": null}}, {"_type": "a... | def get_auto_repeat_doctypes(doctype, txt, searchfield, start, page_len, filters):
res = frappe.get_all(
"Property Setter",
{
"property": "allow_auto_repeat",
"value": "1",
},
["doc_type"],
)
docs = [r.doc_type for r in res]
res = frappe.get_all(
"DocType",
{
"allow_auto_repeat": 1,
},
["n... | |
12,803 | [
0.002381829544901848,
-0.014381063170731068,
-0.019535096362233162,
-0.004845555406063795,
0.004438802134245634,
0.002321771811693907,
0.018508657813072205,
-0.007452601101249456,
0.000910418457351625,
0.005874724127352238,
-0.01904371567070484,
0.005825586151331663,
0.016423020511865616,
... | 9 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "name", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []... | def default(name):
def decorator(wrapped):
def wrapper():
if hasattr(settings, name):
return getattr(settings, name)
return wrapped()
update_wrapper(wrapper, wrapped)
return wrapped
return decorator | |
12,804 | [
0.008900381624698639,
-0.026006318628787994,
-0.01210981234908104,
-0.017414748668670654,
0.005409711040556431,
0.0038242964074015617,
0.03017527051270008,
-0.004844476468861103,
0.016565516591072083,
0.03476332128047943,
-0.019576426595449448,
-0.0013841361505910754,
0.005497943144291639,
... | 8 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "wrapped", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs":... | def decorator(wrapped):
def wrapper():
if hasattr(settings, name):
return getattr(settings, name)
return wrapped()
update_wrapper(wrapper, wrapped)
return wrapped | |
12,805 | [
-0.029462892562150955,
-0.02179783768951893,
0.03972572833299637,
0.0055697266943752766,
-0.01406863797456026,
-0.004690437112003565,
-0.008937220089137554,
-0.008017840795218945,
-0.0076543656177818775,
0.04417295753955841,
-0.0008665949571877718,
-0.0638006329536438,
-0.05135694518685341,
... | 11 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}}, "body": [{"_type": "If", "_fields": {"body": [{"_type": "Raise", "_fields": {"exc"... | def get_languages():
if settings.SITE_ID != hash(settings.SITE_ID):
raise ImproperlyConfigured(
"SITE_ID must be an integer"
)
if not settings.USE_I18N:
return _ensure_languages_settings(
{settings.SITE_ID: [{'code': settings.LANGUAGE_CODE, 'name': settings.LANGUA... | |
12,806 | [
0.010149751789867878,
0.0011144339805468917,
0.030923131853342056,
0.002768865553662181,
-0.029137833043932915,
-0.002329428680241108,
-0.011439134366810322,
-0.010524444282054901,
-0.007835476659238338,
0.050561413168907166,
-0.0056066084653139114,
-0.07167642563581467,
-0.05280956625938415... | 12 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "languages", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs... | def _ensure_languages_settings(languages):
valid_language_keys = ['code', 'name', 'fallbacks', 'hide_untranslated', 'redirect_on_fallback', 'public']
required_language_keys = ['code', 'name']
simple_defaults = ['public', 'redirect_on_fallback', 'hide_untranslated']
if not isinstance(languages, dict):
... | |
12,807 | [
-0.02445339411497116,
-0.034868307411670685,
0.03076615184545517,
0.0014386024558916688,
-0.004942525178194046,
-0.018767353147268295,
-0.02019171230494976,
-0.0007990653393790126,
0.03707890957593918,
0.007224348373711109,
0.010477583855390549,
-0.004187615122646093,
-0.02584356814622879,
... | 7 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}}, "body": [{"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"a... | def get_unihandecode_host():
host = getattr(settings, 'CMS_UNIHANDECODE_HOST', None)
if not host:
return host
if host.endswith('/'):
return host
else:
return host + '/' | |
12,808 | [
-0.0081767113879323,
0.015428380109369755,
0.005434622056782246,
0.013104762881994247,
-0.01747668720781803,
0.03521767258644104,
0.03704573214054108,
-0.04730929434299469,
0.054445333778858185,
-0.008975110948085785,
0.03766242787241936,
-0.04314660653471947,
0.00009351941116619855,
-0.01... | 10 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "name", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []... | def get_cms_setting(name):
if name in COMPLEX:
return COMPLEX[name]()
elif name in DEPRECATED_CMS_SETTINGS:
new_setting = 'CMS_%s' % name
old_setting = 'CMS_%s' % DEPRECATED_CMS_SETTINGS[name]
return getattr(settings, new_setting, getattr(settings, old_setting, DEFAULTS[name]))
... | |
12,809 | [
0.0029091699980199337,
0.0016226390143856406,
0.030436132103204727,
-0.06670190393924713,
-0.034887444227933884,
-0.0578896589577198,
0.008236058056354523,
-0.005711011588573456,
0.00017087842570617795,
0.04573328047990799,
0.03271827846765518,
0.0402199812233448,
-0.0013980962103232741,
-... | 10 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "func", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []... | def install_autotest_and_run(func):
def wrapper(self, mytest):
host, at, outputdir = self._install()
try:
host.erase_dir_contents(outputdir)
func(self, mytest, host, at, outputdir)
finally:
# the test class can define this flag to make us remove the
... | |
12,810 | [
0.01771148107945919,
-0.005644121672958136,
0.02811950258910656,
-0.06951369345188141,
-0.019245920702815056,
-0.05333665385842323,
0.03642212972044945,
0.0023180153220891953,
-0.007547303102910519,
0.010479391552507877,
0.033900417387485504,
0.037516459822654724,
-0.01050912868231535,
-0.... | 9 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "mytest", "annotation": null, "type_comment": null}}], "kwarg": nu... | def wrapper(self, mytest):
host, at, outputdir = self._install()
try:
host.erase_dir_contents(outputdir)
func(self, mytest, host, at, outputdir)
finally:
# the test class can define this flag to make us remove the
# sysinfo install files and output... | |
12,811 | [
0.016783669590950012,
-0.0036613265983760357,
-0.011935054324567318,
-0.06693576276302338,
-0.027276571840047836,
-0.013787474483251572,
0.03456192836165428,
0.004699427634477615,
-0.0010513104498386383,
0.0011095870286226273,
0.043662406504154205,
-0.0006713467882946134,
-0.0474915690720081... | 10 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "mytest", "annotation": null, "type_comment": null}}, {"_type": "a... | def after_iteration_hook(self, mytest, host, at, outputdir):
if not self.disable_hooks:
# push latest sysinfo state to the client
self._push_pickle(host, outputdir)
# run the post-test iteration sysinfo script
at.run(_sysinfo_iteration_script %
... | |
12,812 | [
0.028107091784477234,
-0.008584883064031601,
-0.010705135762691498,
-0.08666760474443436,
-0.04526463896036148,
-0.022778963670134544,
0.04458029195666313,
-0.0023356382735073566,
-0.00903704110532999,
-0.024807563051581383,
0.04802646487951279,
-0.006574615370482206,
-0.03265310823917389,
... | 10 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "mytest", "annotation": null, "type_comment": null}}, {"_type": "a... | def before_iteration_hook(self, mytest, host, at, outputdir):
if not self.disable_hooks:
# this function is called after before_hook() se we have sysinfo state
# to push to the server
self._push_pickle(host, outputdir)
# run the pre-test iteration sysinfo script
... | |
12,813 | [
0.014577323570847511,
-0.008337605744600296,
0.013066844083368778,
-0.05432930216193199,
-0.0075823660008609295,
-0.0076722754165530205,
0.023963872343301773,
0.007995949126780033,
-0.009985946118831635,
-0.032295484095811844,
0.04128643125295639,
0.030545245856046677,
-0.03502873331308365,
... | 10 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "mytest", "annotation": null, "type_comment": null}}, {"_type": "a... | def after_hook(self, mytest, host, at, outputdir):
if not self.disable_hooks:
self._push_pickle(host, outputdir)
# run the post-test sysinfo script
at.run(_sysinfo_after_test_script % outputdir,
results_dir=self.job.resultdir)
self._pull_sysinf... | |
12,814 | [
0.020223373547196388,
0.00012957744183950126,
0.03664914518594742,
-0.06323235481977463,
-0.04342077299952507,
-0.052708882838487625,
-0.004978633020073175,
-0.00361172528937459,
-0.014984513632953167,
0.042093899101018906,
0.05879419669508934,
0.003065533936023712,
-0.018393203616142273,
... | 12 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "host_close", "annotation": null, "type_comment": null}}], "kwarg"... | def cleanup(self, host_close=True):
if self.host and self.autotest:
try:
try:
self.autotest.uninstall()
finally:
if host_close:
self.host.close()
else:
self.hos... | |
12,815 | [
0.023722277954220772,
0.033030103892087936,
0.012519084848463535,
-0.018820879980921745,
-0.03976650536060333,
-0.002257539890706539,
0.026752451434731483,
-0.013460732065141201,
0.004020111169666052,
0.01924341544508934,
0.014426524750888348,
0.02272026799619198,
0.017227323725819588,
-0.... | 10 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "job", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "url", "annotation": null, "type_comment": null}}, {"_type": "arg",... | def runtest(job, url, tag, args, dargs):
if not dargs.pop('disable_sysinfo', False):
logger = _sysinfo_logger(job)
logging_args = [logger.before_hook, logger.after_hook,
logger.before_iteration_hook,
logger.after_iteration_hook]
else:
logge... | |
12,816 | [
0.011083378456532955,
0.01818072609603405,
0.02053912729024887,
-0.04672513157129288,
-0.031821805983781815,
0.011592704802751541,
0.011869512498378754,
-0.019786210730671883,
-0.010668166913092136,
0.003327227896079421,
0.023096831515431404,
0.016796687617897987,
0.008470314554870129,
0.0... | 9 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "mytest", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "existing_hook", "annotation": null, "type_comment": null}}], "k... | def log_kernel_hook(mytest, existing_hook=logging_args[0]):
if mytest.host_parameter:
host = dargs[mytest.host_parameter]
if host:
host.log_kernel()
# chain this call with any existing hook
if existing_hook:
existing_hook(mytest) | |
12,817 | [
0.00950645562261343,
-0.027521809563040733,
-0.039190538227558136,
-0.03282773867249489,
0.013965808786451817,
-0.042188603430986404,
-0.03136105835437775,
0.00014339892368298024,
-0.008449583314359188,
-0.033863041549921036,
-0.007053002715110779,
-0.05150633305311203,
-0.02151489444077015,... | 17 | {"_type": "Module", "_fields": {"body": [{"_type": "ClassDef", "_fields": {"body": [{"_type": "Assign", "_fields": {"value": {"_type": "Constant", "_fields": {"kind": null, "value": "biccamera"}}, "targets": [{"_type": "Name", "_fields": {"id": "name", "ctx": {"_type": "Store", "_fields": {}}}}], "type_comment": null}}... | class BiccameraSpider(scrapy.Spider):
name = "biccamera"
start_urls = [
'http://www.biccamera.com/bc/c/contents/sitemap/index.jsp'
]
@staticmethod
def _extract_disp_no(url):
dispNo = re.findall(r'dispNo=(\d+)', url)
if len(dispNo) == 1:
return dispNo[0]
... | |
12,818 | [
-0.033367350697517395,
-0.015454229898750782,
-0.05836987867951393,
-0.04005460813641548,
0.01779821701347828,
-0.01518995687365532,
-0.05161368101835251,
0.02169337309896946,
-0.004188153892755508,
-0.0018728917930275202,
0.02796698547899723,
-0.03853790834546089,
-0.02472676895558834,
-0... | 13 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "response", "annotation": null, "type_comment": null}}], "kwarg": ... | def parse(self, response):
for link in response.css('div.tolinkcategory'):
url = link.css('a::attr("href")').extract_first()
dispNo = self._extract_disp_no(url)
if dispNo is not None:
yield {
'type': 'category_top',
'pa... | |
12,819 | [
0.012684223242104053,
-0.007924619130790234,
0.007374969776719809,
0.0006998972967267036,
-0.013988886028528214,
-0.000532661855686456,
-0.00706088449805975,
0.013143271207809448,
0.00379318674094975,
-0.00003904834375134669,
-0.016054602339863777,
-0.05431263521313667,
-0.004777723923325539... | 10 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "message", "annotation": null, "type_comment": null}}, {"_type": "... | def _respond_with_error(self, message, start_response):
instance_logs = self._instance_logs_getter()
if instance_logs:
message += '\n\n' + instance_logs
# TODO: change 'text/plain' to 'text/plain; charset=utf-8'
# throughout devappserver2.
start_response('500 Internal Server Error',
... | |
12,820 | [
-0.00524553656578064,
0.008421514183282852,
-0.05760803818702698,
-0.008352529257535934,
0.027721481397747993,
-0.02496206760406494,
-0.05399957671761513,
0.002571029355749488,
0.011854860000312328,
0.002487451070919633,
0.018838295713067055,
-0.03472614288330078,
-0.015314738266170025,
-0... | 16 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "response", "annotation": null, "type_comment": null}}], "kwarg": ... | def page_parse(self, response):
parent_dispNo = self._extract_disp_no(response.url)
count_cat_link = 0
for link in response.css('#catNav ul >li >a'):
url = link.css('::attr("href")').extract_first()
dispNo = self._extract_disp_no(url)
if dispNo is not None a... | |
12,821 | [
0.013959692791104317,
0.010482590645551682,
0.0014000720111653209,
-0.0002591479569673538,
-0.004838710650801659,
-0.04373558238148689,
0.01769321784377098,
-0.002050105482339859,
-0.006718294229358435,
0.041950877755880356,
0.033417101949453354,
-0.031509313732385635,
0.0608031265437603,
... | 8 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "blob_uri", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs"... | def extract_names_from_blob_uri(blob_uri):
# HACK: ditch this once python SDK supports get by URI
m = re.match('^https://(?P<accountname>[^\.]+)\.blob\.core\.windows\.net/'
'(?P<containername>[^/]+)/(?P<blobname>.+)$', blob_uri)
if not m:
raise Exception("unable to parse blob uri '%... | |
12,822 | [
-0.019888339564204216,
0.03426152095198631,
0.010158022865653038,
-0.019021671265363693,
0.010732049122452736,
0.033991388976573944,
-0.00593723775818944,
-0.008587890304625034,
0.02060868591070175,
0.09026852250099182,
-0.023613885045051575,
-0.040406983345746994,
0.009477069601416588,
0.... | 11 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []... | def __init__(self):
self.module_arg_spec = dict(
resource_group=dict(type='str', required=True),
name=dict(type='str', required=True),
state=dict(choices=['present', 'absent'], default='present', type='str'),
location=dict(type='str'),
short_hostname=... | |
12,823 | [
0.008977537043392658,
0.047202374786138535,
-0.03262199088931084,
-0.0024891032371670008,
-0.009372332133352757,
0.06130684167146683,
-0.052048079669475555,
0.04581788554787636,
0.08648721128702164,
0.006527642719447613,
0.047461964190006256,
0.01086498238146305,
-0.03188648074865341,
-0.0... | 10 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []... | def power_off_vm(self):
self.log("Powered off virtual machine {0}".format(self.name))
self.results['actions'].append("Powered off virtual machine {0}".format(self.name))
try:
poller = self.compute_client.virtual_machines.power_off(self.resource_group, self.name)
self.get_... | |
12,824 | [
-0.00533956428989768,
0.04473348334431648,
0.010613096877932549,
-0.04855131730437279,
0.0002663779305294156,
0.05484233796596527,
0.01476709172129631,
0.014947178773581982,
0.026532743126153946,
0.07698097079992294,
0.004343085922300816,
-0.019485358148813248,
-0.0046312240883708,
-0.0091... | 19 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": {"_type": "arg", "_fields": {"arg": "kwargs", "annotation": null, "type_comment": null}}, "v... | def exec_module(self, **kwargs):
for key in self.module_arg_spec.keys() + ['tags']:
setattr(self, key, kwargs[key])
# make sure options are lower case
self.remove_on_absent = set([resource.lower() for resource in self.remove_on_absent])
changed = False
powerstate_c... | |
12,825 | [
0.009670333005487919,
0.04597649350762367,
-0.022882211953401566,
0.010603434406220913,
-0.03036823682487011,
0.0409504659473896,
-0.022542903199791908,
0.06306923180818558,
0.05255062133073807,
0.025787552818655968,
0.005890207830816507,
-0.0038941113743931055,
-0.035224609076976776,
-0.0... | 10 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []... | def restart_vm(self):
self.results['actions'].append("Restarted virtual machine {0}".format(self.name))
self.log("Restart virtual machine {0}".format(self.name))
try:
poller = self.compute_client.virtual_machines.restart(self.resource_group, self.name)
self.get_poller_res... | |
12,826 | [
0.01052170991897583,
0.02969658002257347,
-0.023356860503554344,
0.01969761960208416,
0.008708772249519825,
0.043577227741479874,
-0.042376019060611725,
0.05329813063144684,
0.05022837221622467,
-0.0005297002498991787,
0.033923059701919556,
0.03410101681947708,
-0.02876230515539646,
-0.036... | 10 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []... | def power_on_vm(self):
self.results['actions'].append("Powered on virtual machine {0}".format(self.name))
self.log("Power on virtual machine {0}".format(self.name))
try:
poller = self.compute_client.virtual_machines.start(self.resource_group, self.name)
self.get_poller_re... | |
12,827 | [
-0.005500958301126957,
0.04093959182500839,
0.008005752228200436,
-0.03015340119600296,
0.003116011153906584,
0.04022051393985748,
-0.001963985851034522,
0.05896452069282532,
0.03132789582014084,
0.05723872780799866,
0.0588686428964138,
-0.016838444396853447,
-0.006591562181711197,
-0.0112... | 13 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "vm", "annotation": null, "type_comment": null}}], "kwarg": null, ... | def delete_vm(self, vm):
vhd_uris = []
nic_names = []
pip_names = []
if self.remove_on_absent.intersection(set(['all','virtual_storage'])):
# store the attached vhd info so we can nuke it after the VM is gone
self.log('Storing VHD URI for deletion')
v... | |
12,828 | [
0.0027252240106463432,
0.04990743100643158,
-0.023811886087059975,
0.023205289617180824,
-0.0062086936086416245,
0.032042570412158966,
-0.06356179714202881,
0.03827505186200142,
0.048765603452920914,
-0.0039042215794324875,
0.06403756141662598,
-0.01899479702115059,
-0.02630963735282421,
-... | 10 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []... | def deallocate_vm(self):
self.results['actions'].append("Deallocated virtual machine {0}".format(self.name))
self.log("Deallocate virtual machine {0}".format(self.name))
try:
poller = self.compute_client.virtual_machines.deallocate(self.resource_group, self.name)
self.get... | |
12,829 | [
0.01324741542339325,
0.006905106827616692,
-0.040932781994342804,
-0.025477463379502296,
0.0025014777202159166,
0.023312853649258614,
-0.024416804313659668,
0.04796776548027992,
0.05506768822669983,
0.010043791495263577,
0.0497860386967659,
0.004935311619192362,
-0.030585944652557373,
-0.0... | 10 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "name", "annotation": null, "type_comment": null}}], "kwarg": null... | def delete_nic(self, name):
self.log("Deleting network interface {0}".format(name))
self.results['actions'].append("Deleted network interface {0}".format(name))
try:
poller = self.network_client.network_interfaces.delete(self.resource_group, name)
except Exception as exc:
... | |
12,830 | [
0.02933630160987377,
0.009429525583982468,
-0.014040636830031872,
0.020696772262454033,
-0.005518765654414892,
0.007978398352861404,
-0.0415056012570858,
0.05584878847002983,
0.03094991110265255,
-0.021940596401691437,
0.0611826628446579,
-0.024876466020941734,
-0.014275954104959965,
-0.05... | 10 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "name", "annotation": null, "type_comment": null}}], "kwarg": null... | def delete_pip(self, name):
self.results['actions'].append("Deleted public IP {0}".format(name))
try:
poller = self.network_client.public_ip_addresses.delete(self.resource_group, name)
self.get_poller_result(poller)
except Exception as exc:
self.fail("Error de... | |
12,831 | [
-0.00463142478838563,
-0.023233700543642044,
0.013795008882880211,
-0.04692118242383003,
-0.02849758416414261,
0.0054000201635062695,
-0.012978199869394302,
0.019115617498755455,
-0.030970703810453415,
0.025094211101531982,
0.0006101257167756557,
-0.030766500160098076,
-0.0553615503013134,
... | 11 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []... | def get_image_version(self):
try:
versions = self.compute_client.virtual_machine_images.list(self.location,
self.image['publisher'],
self.image['offer'],
... | |
12,832 | [
0.01307945977896452,
0.004855254199355841,
0.012468870729207993,
-0.02109210193157196,
0.0039045563898980618,
-0.005859512370079756,
0.027380097657442093,
0.02545192278921604,
0.025751860812306404,
-0.0020339577458798885,
0.05107523873448372,
0.006266572047024965,
0.0485900342464447,
-0.05... | 11 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "vhd_uris", "annotation": null, "type_comment": null}}], "kwarg": ... | def delete_vm_storage(self, vhd_uris):
for uri in vhd_uris:
self.log("Extracting info from blob uri '{0}'".format(uri))
try:
blob_parts = extract_names_from_blob_uri(uri)
except Exception as exc:
self.fail("Error parsing blob URI {0}".format(st... | |
12,833 | [
-0.05032968893647194,
-0.03054308332502842,
-0.059315554797649384,
-0.041122499853372574,
-0.004708725493401289,
0.019532080739736557,
-0.008670473471283913,
-0.04074624553322792,
0.008913932368159294,
0.03330966830253601,
0.027533041313290596,
-0.027953561395406723,
-0.007646837271749973,
... | 13 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "url", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}... | def resolve(url):
try:
try: referer = urlparse.parse_qs(urlparse.urlparse(url).query)['referer'][0]
except: referer = url
page = urlparse.parse_qs(urlparse.urlparse(url).query)['live'][0]
page = 'http://www.yocast.tv/embed.php?live=%s&vw=600&vh=450' % page
result = client.r... | |
12,834 | [
0.01267385296523571,
-0.06453023105859756,
0.05006655678153038,
-0.005454110447317362,
-0.0031321831047534943,
0.035481952130794525,
0.0037005716003477573,
0.01778934895992279,
0.0033649804536253214,
0.04518083482980728,
-0.00853792019188404,
-0.03420005366206169,
0.02047407627105713,
0.00... | 8 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []... | def test_is_coord_subset(self):
c1 = [0,0,0]
c2 = [0,1.2,-1]
c3 = [3,2,1]
c4 = [3-9e-9, 2-9e-9, 1-9e-9]
self.assertTrue(is_coord_subset([c1, c2, c3], [c1, c4, c2]))
self.assertTrue(is_coord_subset([c1], [c2, c1]))
self.assertTrue(is_coord_subset([c1, c2], [c2, c1]... | |
12,835 | [
0.013648506253957748,
-0.02306247688829899,
0.08548398315906525,
-0.01222532894462347,
-0.025757182389497757,
0.026223797351121902,
0.006025174167007208,
-0.022315891459584236,
0.037912517786026,
0.027553651481866837,
0.017078131437301636,
-0.003765004687011242,
0.030539991334080696,
0.007... | 8 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []... | def test_coord_list_mapping_pbc(self):
c1 = [0.1, 0.2, 0.3]
c2 = [0.2, 0.3, 0.3]
c3 = [0.5, 0.3, 0.6]
c4 = [1.5, -0.7, -1.4]
a = np.array([c1, c3, c2])
b = np.array([c4, c2, c1])
inds = coord_list_mapping_pbc(a, b)
diff = a - b[inds]
diff -= np.r... | |
12,836 | [
-0.0037520327605307102,
-0.018139658495783806,
0.06754818558692932,
-0.03164001554250717,
-0.02846209704875946,
0.002983649028465152,
-0.007805619854480028,
-0.03194157034158707,
0.01715380698442459,
0.02623523399233818,
0.004679892677813768,
-0.018476007506251335,
0.029877083376049995,
0.... | 8 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []... | def test_coord_list_mapping(self):
c1 = [0,.124,0]
c2 = [0,1.2,-1]
c3 = [3,2,1]
a = np.array([c1, c2])
b = np.array([c3, c2, c1])
inds = coord_list_mapping(a, b)
self.assertTrue(np.allclose(a, b[inds]))
self.assertRaises(Exception, coord_list_mapping, [c1,... | |
12,837 | [
-0.011635554023087025,
-0.03322061151266098,
0.012618589214980602,
0.0027554756961762905,
0.005079011898487806,
0.0030742171220481396,
-0.04337267577648163,
-0.06605992466211319,
-0.005254766438156366,
0.046780530363321304,
-0.017921017482876778,
-0.010640604421496391,
0.04075125232338905,
... | 8 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []... | def test_find_in_coord_list(self):
coords = [[0, 0, 0], [0.5, 0.5, 0.5]]
test_coord = [0.1, 0.1, 0.1]
self.assertFalse(find_in_coord_list(coords, test_coord))
self.assertEqual(find_in_coord_list(coords, test_coord, atol=0.15)[0],
0)
self.assertFalse(find_... | |
12,838 | [
0.03931611776351929,
-0.03978652507066727,
0.05431962385773659,
0.01465689018368721,
0.01107932161539793,
0.049268938601017,
0.01459499541670084,
-0.0038468148559331894,
0.048501431941986084,
0.03446349874138832,
0.011463074944913387,
0.010027095675468445,
-0.005638693924993277,
0.00547467... | 7 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []... | def test_pbc_diff(self):
self.assertArrayAlmostEqual(pbc_diff([0.1, 0.1, 0.1], [0.3, 0.5, 0.9]),
[-0.2, -0.4, 0.2])
self.assertArrayAlmostEqual(pbc_diff([0.9, 0.1, 1.01],
[0.3, 0.5, 0.9]),
... | |
12,839 | [
0.022550158202648163,
-0.04892110452055931,
0.06103276088833809,
0.0099328076466918,
-0.02574663609266281,
0.044700756669044495,
0.019516000524163246,
0.021676119416952133,
0.014646364375948906,
0.030915942043066025,
0.006661411374807358,
-0.013335308991372585,
0.04569965600967407,
0.00821... | 8 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []... | def test_is_coord_subset_pbc(self):
c1 = [0, 0, 0]
c2 = [0, 1.2, -1]
c3 = [2.3, 0, 1]
c4 = [1.3-9e-9, -1-9e-9, 1-9e-9]
self.assertTrue(is_coord_subset_pbc([c1, c2, c3], [c1, c4, c2]))
self.assertTrue(is_coord_subset_pbc([c1], [c2, c1]))
self.assertTrue(is_coord_su... | |
12,840 | [
-0.0021297645289450884,
-0.031294990330934525,
0.057075873017311096,
0.014692200347781181,
-0.009710153564810753,
0.011705391108989716,
-0.02401539869606495,
-0.047401998192071915,
0.008156287483870983,
0.03414878621697426,
-0.007110299542546272,
0.007267500273883343,
0.04331478476524353,
... | 8 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []... | def test_find_in_coord_list_pbc(self):
coords = [[0, 0, 0], [0.5, 0.5, 0.5]]
test_coord = [0.1, 0.1, 0.1]
self.assertFalse(find_in_coord_list_pbc(coords, test_coord))
self.assertEqual(find_in_coord_list_pbc(coords, test_coord,
atol=0.15)[0]... | |
12,841 | [
-0.025014277547597885,
-0.03905908018350601,
0.0869809165596962,
0.0229075588285923,
-0.003502120031043887,
-0.025474367663264275,
-0.004827901255339384,
-0.0480913445353508,
0.009928222745656967,
0.026297682896256447,
-0.030414262786507607,
-0.030390048399567604,
-0.03191560506820679,
0.0... | 10 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []... | def test_lattice_points_in_supercell(self):
supercell = np.array([[1, 3, 5], [-3, 2, 3], [-5, 3, 1]])
points = lattice_points_in_supercell(supercell)
self.assertAlmostEqual(len(points), abs(np.linalg.det(supercell)))
self.assertGreaterEqual(np.min(points), -1e-10)
self.assertLess... | |
12,842 | [
-0.026239601895213127,
-0.022697756066918373,
0.07467810809612274,
-0.036266524344682693,
-0.0160505548119545,
-0.008293410763144493,
0.005172469187527895,
-0.012352816760540009,
0.008617664687335491,
0.02808535471558571,
0.01195373572409153,
-0.00038563579437322915,
0.017409926280379295,
... | 9 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []... | def test_barycentric(self):
#2d test
simplex1 = np.array([[0.3, 0.1], [0.2, -1.2], [1.3, 2.3]])
pts1 = np.array([[0.6, 0.1], [1.3, 2.3], [0.5, 0.5], [.7, 1]])
output1 = barycentric_coords(pts1, simplex1)
#do back conversion to cartesian
o_dot_s = np.sum(output1[:, :, None... | |
12,843 | [
-0.011955183930695057,
-0.023346148431301117,
0.05045375972986221,
-0.0015241762157529593,
0.016186829656362534,
-0.0038366925437003374,
0.006914823316037655,
-0.013578882440924644,
0.04027273505926132,
0.017340345308184624,
-0.0008721892954781651,
-0.06053448095917702,
0.04476141184568405,
... | 11 | {"_type": "Module", "_fields": {"body": [{"_type": "ClassDef", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs... | class SimplexTest(PymatgenTest):
def setUp(self):
coords = []
coords.append([0, 0, 0])
coords.append([0, 1, 0])
coords.append([0, 0, 1])
coords.append([1, 0, 0])
self.simplex = Simplex(coords)
def test_equal(self):
c2 = list(self.simplex.coords)
... | |
12,844 | [
-0.009973716922104359,
-0.04508405551314354,
0.04663129150867462,
-0.0018819737015292048,
0.010128440335392952,
0.014270270243287086,
0.009943962097167969,
-0.01319910679012537,
0.031611207872629166,
0.027612198144197464,
0.008569302968680859,
-0.04601239785552025,
0.024315396323800087,
0.... | 8 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []... | def test_2dtriangle(self):
s = Simplex([[0, 1], [1, 1], [1, 0]])
self.assertArrayAlmostEqual(s.bary_coords([0.5, 0.5]),
[0.5, 0, 0.5])
self.assertArrayAlmostEqual(s.bary_coords([0.5, 1]), [0.5, 0.5, 0])
self.assertArrayAlmostEqual(s.bary_coords([0.5, 0... | |
12,845 | [
-0.022493738681077957,
-0.019984202459454536,
-0.04010654240846634,
-0.01925896853208542,
0.007626459468156099,
-0.0075631458312273026,
-0.02910141833126545,
-0.008685530163347721,
0.04779631644487381,
0.05691353231668472,
0.02889420837163925,
-0.004584509413689375,
-0.013100243173539639,
... | 10 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}}, "body": [{"_type": "Assign", "_fields": {"value": {"_type": "Dict", "_fields": {"k... | def test_wavefunction():
Psi = {
0: (1/sqrt(2 * pi)),
1: (1/sqrt(2 * pi)) * exp(I * x),
2: (1/sqrt(2 * pi)) * exp(2 * I * x),
3: (1/sqrt(2 * pi)) * exp(3 * I * x)
}
for n in Psi:
assert simplify(wavefunction(n, x) - Psi[n]) == 0 | |
12,846 | [
-0.007584823295474052,
-0.004970584064722061,
-0.04171924293041229,
0.002118809847161174,
0.03301054239273071,
-0.006786706391721964,
0.021934635937213898,
0.01225950662046671,
-0.01773230731487274,
-0.03991669416427612,
0.00034951537963934243,
-0.057030051946640015,
0.00016763164603617042,
... | 10 | {"_type": "Module", "_fields": {"body": [{"_type": "ClassDef", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "response", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "user", "annotation... | class Instagram(ExtraActionsAbstractMixin, ExtraDataAbstractMixin, InstagramOAuth2):
@staticmethod
def save_extra_data(response, user):
if response['data']['bio']:
user.about = response['data']['bio']
user.save()
@staticmethod
def get_profile_image(strategy, details, respon... | |
12,847 | [
0.010964769870042801,
0.014909151941537857,
0.044519536197185516,
0.035224247723817825,
0.03732791915535927,
0.02671172097325325,
-0.01744089461863041,
-0.0066290078684687614,
-0.0019767775665968657,
0.035762395709753036,
0.003271696623414755,
0.01841934584081173,
0.01528830174356699,
-0.0... | 8 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []... | def testTrustanchorDotServer(self):
expected = dns.rrset.from_text_list(
'trustanchor.server.', 86400, dns.rdataclass.CH, 'TXT',
['". 20326"', '"powerdns.com. 44030"'])
query = dns.message.make_query('trustanchor.server', 'TXT',
dns.rdatacla... | |
12,848 | [
-0.0226359311491251,
0.02442825585603714,
0.019903576001524925,
0.023726366460323334,
0.03145968168973923,
0.013899915851652622,
-0.012759345583617687,
-0.017233889549970627,
0.0007324403268285096,
0.038202833384275436,
-0.011944652535021305,
0.0018643935909494758,
0.0009862484876066446,
-... | 8 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []... | def testNegativerustanchorDotServer(self):
expected = dns.rrset.from_text_list(
'negativetrustanchor.server.', 86400, dns.rdataclass.CH, 'TXT',
['"example."', '"example.com. some reason"'])
query = dns.message.make_query('negativetrustanchor.server', 'TXT',
... | |
12,849 | [
0.004784929566085339,
-0.014960161410272121,
-0.021306896582245827,
0.0025984018575400114,
0.000801634625531733,
-0.04812019318342209,
-0.03569209203124046,
-0.0022736017126590014,
-0.011272641830146313,
0.06417500227689743,
0.01502650324255228,
-0.04515690729022026,
0.014805362559854984,
... | 15 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "request", "annotation": null, "type_comment": null}}, {"_type": "... | def field_view(self, request, field, value=None):
easy_model = EasyModel(self.site, self.model)
easy_field = easy_model.field(field.name)
if value is not None:
obj_list = easy_model.objects(**{field.name: value})
return render_to_response('databrowse/fieldchoice_detail.ht... | |
12,850 | [
0.004891290329396725,
0.0075681861490011215,
0.006475003436207771,
0.003980305045843124,
-0.012086673639714718,
-0.015282129868865013,
-0.022827891632914543,
-0.038233354687690735,
-0.04343578219413757,
0.0519794225692749,
-0.011593339964747429,
-0.07368610054254532,
0.04280790314078331,
-... | 9 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "request", "annotation": null, "type_comment": null}}, {"_type": "... | def model_view(self, request, model_databrowse, url):
self.model, self.site = model_databrowse.model, model_databrowse.site
self.fields = self.field_dict(self.model)
# If the model has no fields with choices, there's no point in going
# further.
if not self.fields:
r... | |
12,851 | [
-0.00806039571762085,
0.0070638577453792095,
0.0044899266213178635,
0.002035745419561863,
0.024599622935056686,
0.0020481334067881107,
-0.044728588312864304,
0.04276854917407036,
0.041359081864356995,
0.03237372264266014,
0.0010474660666659474,
-0.04483870416879654,
0.015283919870853424,
-... | 9 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "request", "annotation": null, "type_comment": null}}], "kwarg": n... | def authenticate(self, request):
client = cas.get_client() # Returns a CAS server client
try:
auth_header_field = request.META["HTTP_AUTHORIZATION"]
auth_token = cas.parse_auth_header(auth_header_field)
except (cas.CasTokenError, KeyError):
return None # If ... | |
12,852 | [
-0.01113602053374052,
-0.042430829256772995,
-0.039468128234148026,
-0.013052452355623245,
0.06625673174858093,
-0.018045533448457718,
0.011612538248300552,
0.026042750105261803,
0.0303935669362545,
0.003729271935299039,
0.0030921881552785635,
-0.007997216656804085,
0.000700533390045166,
0... | 8 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "request", "annotation": null, "type_comment": null}}], "kwarg": n... | def authenticate(self, request):
cookie_val = request.COOKIES.get(settings.COOKIE_NAME)
if not cookie_val:
return None
session = get_session_from_cookie(cookie_val)
if not session:
return None
user_id = session.data.get('auth_user_id')
user = User.... | |
12,853 | [
0.003922149073332548,
-0.04477186128497124,
0.03285267949104309,
-0.03382096812129021,
0.0023025693371891975,
0.00825927872210741,
-0.035365622490644455,
-0.046109024435281754,
0.002002860652282834,
0.0028515548910945654,
0.02658185176551342,
0.0015979658346623182,
-0.01520445104688406,
-0... | 10 | {"_type": "Module", "_fields": {"body": [{"_type": "ClassDef", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "patched_conf", "annota... | class GetHostname(unittest.TestCase):
@mock.patch('airflow.utils.net.socket')
@mock.patch('airflow.utils.net.conf')
def test_get_hostname_unset(self, patched_conf, patched_socket):
patched_conf.get = mock.Mock(return_value=None)
patched_socket.getfqdn = mock.Mock(return_value='first')
... | |
12,854 | [
-0.02689245715737343,
0.010512401349842548,
0.04234815761446953,
-0.04896218329668045,
0.020404737442731857,
-0.0071594566106796265,
-0.006315478589385748,
-0.008003434166312218,
-0.012240545824170113,
0.032450079917907715,
-0.008945014327764511,
-0.02553750015795231,
0.04645895957946777,
... | 8 | {"_type": "Module", "_fields": {"body": [{"_type": "ClassDef", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs... | class Tests(unittest.TestCase):
def test_lookup(self):
settings = {
'mako.lookup.directories': 'tangled.mako.tests:templates',
}
lookup = create_lookup(settings)
lookup.get_template('test.mako')
def test_lookup_asset_path(self):
lookup = create_lookup({})
... | |
12,855 | [
0.012378658168017864,
0.0077186827547848225,
-0.05588134378194809,
0.009248036891222,
-0.04303285479545593,
-0.0134525615721941,
-0.016060613095760345,
-0.006313978228718042,
0.022225970402359962,
0.0208835918456316,
0.055114272981882095,
-0.0012063438771292567,
-0.022302677854895592,
-0.0... | 9 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "text", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []... | def sanitize_html(text):
try:
cleaner = Cleaner(style=True, links=True, add_nofollow=False, page_structure=True, safe_attrs_only=False, allow_tags = ["img", "a"])
clean_html = cleaner.clean_html(text)
clean_html = re.sub(r'</p>$', '', re.sub(r'^<p>', '', clean_html))
except Exception:
... | |
12,856 | [
-0.004392554052174091,
0.011017000302672386,
-0.006278845947235823,
-0.034950483590364456,
0.023532480001449585,
0.007049191277474165,
0.008700686506927013,
0.04022682458162308,
0.015797365456819534,
0.006041410379111767,
-0.001753064221702516,
-0.02899876981973648,
-0.02889324352145195,
-... | 9 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}}, "body": [{"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"a... | def xqueue_login():
session = requests.session()
xqueue_login_url = urlparse.urljoin(settings.XQUEUE_INTERFACE['url'], project_urls.XqueueURLs.log_in)
(success, xqueue_msg) = login(
session,
xqueue_login_url,
settings.XQUEUE_INTERFACE['django_auth']['username'],
settings.XQUE... | |
12,857 | [
0.045497577637434006,
0.019484926015138626,
-0.026067230850458145,
-0.030127953737974167,
0.00026999859255738556,
-0.015784427523612976,
0.059513624757528305,
0.00745557714253664,
-0.019201112911105156,
0.003176534315571189,
-0.005441588815301657,
-0.020718427374958992,
0.017956696450710297,... | 11 | {"_type": "Module", "_fields": {"body": [{"_type": "ClassDef", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "user", "annotation": n... | class ProfileImageManager(models.Manager):
def save_from_info(self, user, info):
profile, created = self.get_or_create(user=user)
image = Image.open(StringIO.StringIO(info['content']))
profile.image = '%s%s.%s' % (settings.PROFILE_IMAGE_UPLOAD_DIR, user.id, image.format.lower())
imag... | |
12,858 | [
0.016094136983156204,
-0.030515329912304878,
0.0652659609913826,
-0.03686827793717384,
-0.00931765791028738,
-0.003965298645198345,
0.018074138090014458,
-0.04231063649058342,
-0.03384003788232803,
-0.001051545375958085,
-0.029901210218667984,
-0.0375247485935688,
0.021388260647654533,
-0.... | 11 | {"_type": "Module", "_fields": {"body": [{"_type": "ClassDef", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": {"_type": "arg", "_fields": {"arg": "options", "a... | class Command(BaseCommand):
def handle(self, *args, **options):
fixture_dir = os.path.join(django_settings.SITE_ROOT,'fixtures')
for fixture in fixtures:
filepath = os.path.join(fixture_dir,fixture)
if os.path.isfile(filepath):
self.stdout.write('Installin... | |
12,859 | [
0.07930371165275574,
0.014790191315114498,
-0.02453245222568512,
0.01154683530330658,
0.016021691262722015,
-0.0013839132152497768,
0.02015514113008976,
-0.017204418778419495,
0.019789349287748337,
0.04465101659297943,
0.043578024953603745,
0.00204843538813293,
-0.05755127966403961,
0.0202... | 11 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "value", "annotation": null, "type_comment": null}}], "kwarg": nul... | def clean(self, value):
value = super(MXRFCField, self).clean(value)
if value in EMPTY_VALUES:
return ''
value = value.upper()
if self._has_homoclave(value):
if not value[-1] == self._checksum(value[:-1]):
raise ValidationError(self.error_messages[... | |
12,860 | [
0.0003359659167472273,
-0.018155651167035103,
0.05397042632102966,
-0.040089234709739685,
-0.02739538811147213,
-0.011484907008707523,
0.030352968722581863,
-0.03693735972046852,
-0.03719642013311386,
0.015359983779489994,
-0.006039290688931942,
-0.026769332587718964,
0.009363869205117226,
... | 10 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": {"_type": "arg", "_fields": {"arg": "options", "annotation": null, "type_comment": null}}, "... | def handle(self, *args, **options):
fixture_dir = os.path.join(django_settings.SITE_ROOT,'fixtures')
for fixture in fixtures:
filepath = os.path.join(fixture_dir,fixture)
if os.path.isfile(filepath):
self.stdout.write('Installing ' + fixture)
ca... | |
12,861 | [
0.03101637028157711,
0.02051852084696293,
0.07152600586414337,
0.01319765392690897,
-0.0261190477758646,
0.020581306889653206,
0.01457894966006279,
0.0062597813084721565,
0.006052587181329727,
0.09709253907203674,
-0.01490543782711029,
-0.03382918983697891,
0.03558720275759697,
0.069366164... | 8 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "min_length", "annotation": null, "type_comment": null}}, {"_type"... | def __init__(self, min_length=18, max_length=18, *args, **kwargs):
states_re = r'(AS|BC|BS|CC|CL|CM|CS|CH|DF|DG|GT|GR|HG|JC|MC|MN|MS|NT|NL|OC|PL|QT|QR|SP|SL|SR|TC|TS|TL|VZ|YN|ZS|NE)'
consonants_re = r'[B-DF-HJ-NP-TV-Z]'
curp_re = (r'^[A-Z][AEIOU][A-Z]{2}%s[HM]%s%s{3}[0-9A-Z]\d$' %
... | |
12,862 | [
0.07843033969402313,
0.005561370402574539,
-0.023352457210421562,
0.0242356825619936,
-0.000018538516087573953,
0.01999620348215103,
0.03273819014430046,
-0.015238567255437374,
0.02115028351545334,
0.03978043422102928,
0.04602188616991043,
0.008679153397679329,
-0.034622400999069214,
0.018... | 9 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "value", "annotation": null, "type_comment": null}}], "kwarg": nul... | def clean(self, value):
value = super(MXCURPField, self).clean(value)
if value in EMPTY_VALUES:
return ''
value = value.upper()
if value[-1] != self._checksum(value[:-1]):
raise ValidationError(self.error_messages['invalid_checksum'])
if self._has_inconven... | |
12,863 | [
0.036284852772951126,
0.023943228647112846,
-0.0008765358361415565,
-0.010354312136769295,
-0.004117853473871946,
0.013594884425401688,
0.06416689604520798,
0.014287160709500313,
0.018572116270661354,
0.00015227479161694646,
0.020983148366212845,
-0.007239066995680332,
-0.030818253755569458,... | 9 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "value", "annotation": null, "type_comment": null}}], "kwarg": nul... | def __checksum(self, value):
multipliers = [1 if i % 2 == 0 else 2 for i in range(10)]
s = [int(v) * m for v, m in zip(value, multipliers)]
s = sum(map(int, ''.join(map(str, s))))
checksum = 10 - s % 10
if checksum == 10:
return '0'
return six.text_type(chec... | |
12,864 | [
0.03305903449654579,
0.00028083432698622346,
-0.03712499514222145,
0.014230864122509956,
0.021519560366868973,
0.013364536687731743,
0.019347967579960823,
0.02635944075882435,
0.023748908191919327,
0.015824904665350914,
0.0032804913353174925,
0.0015521690947934985,
-0.02407233789563179,
-0... | 11 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "value", "annotation": null, "type_comment": null}}], "kwarg": nul... | def _checksum(self, value):
chars = '0123456789ABCDEFGHIJKLMN&OPQRSTUVWXYZ'
s = sum(i * chars.index(c) for i, c in zip(reversed(range(19)), value))
checksum = 10 - s % 10
if checksum == 10:
return '0'
return six.text_type(checksum) | |
12,865 | [
0.00466901995241642,
-0.027376731857657433,
-0.025668781250715256,
0.001112334430217743,
-0.017252787947654724,
-0.025371745228767395,
-0.0328223742544651,
-0.00919571053236723,
0.017921116203069687,
0.022079607471823692,
0.0241217240691185,
-0.031163929030299187,
-0.029926283285021782,
0.... | 11 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "client_1", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs"... | def verify_traffic_routed(client_1):
posts_1 = client_1.example.posts
posts_1.insert({u"the data": u"it moves"})
self.assertEqual(
u"it moves",
client_1.example.posts.find_one()[u"the data"]
) | |
12,866 | [
-0.002955962438136339,
-0.05310943350195885,
-0.01801164448261261,
0.005647920072078705,
-0.029022715985774994,
-0.008922764100134373,
-0.018521856516599655,
0.015840280801057816,
0.004313065204769373,
0.029354946687817574,
0.03490794450044632,
-0.025415640324354172,
-0.024632524698972702,
... | 12 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "client_1", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs"... | def verify_traffic_routed(client_1):
posts_1 = client_1.example.posts
posts_1.insert({u"the data": u"it moves"})
d = get_mongo_client(
self.node_2.public_address, self.external_port)
d.addCallback(lambda client_2: self.assertEqual(
posts_1... | |
12,867 | [
0.00924861989915371,
-0.009777850471436977,
-0.01969768851995468,
-0.0021733934991061687,
-0.025893554091453552,
-0.022743990644812584,
-0.03872416168451309,
-0.0007680291892029345,
0.004301608540117741,
0.004798568785190582,
0.031005144119262695,
-0.03180544450879097,
-0.03872416168451309,
... | 13 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "page", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [{"_type": "Constant", "_fields": {"kind": null, "value": ... | def get_quote(page=0):
page = str(page)
error = "ERROR: No such quotation number."
quote = str(error)
while quote == error:
with urlopen(f'http://www.quotationspage.com/quote/{page}.html') as response:
html = str(response.read())
iso_to_utf = {'\\x92': "'", '\\x97': '-',... | |
12,868 | [
0.032816868275403976,
-0.0384022556245327,
0.012833351269364357,
-0.02264581248164177,
-0.006020048167556524,
0.01760375127196312,
0.017386419698596,
0.020668108016252518,
-0.024449653923511505,
0.022580614313483238,
0.017560284584760666,
-0.008774708956480026,
-0.036728814244270325,
0.011... | 8 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}}, "body": [{"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"a... | def get_cipher():
alpha = list(ascii_uppercase)
shuffle(alpha) # shuffle the alphabet list
cipher = {} # create empty dict to hold cipher
for i, c in enumerate(alpha):
cipher[c] = alpha[i - 1]
return cipher | |
12,869 | [
0.0013147111749276519,
0.029250001534819603,
0.024877360090613365,
0.008453420363366604,
-0.0247500017285347,
-0.019390331581234932,
0.008559552021324635,
-0.024771226570010185,
-0.0010089180432260036,
0.05756603926420212,
-0.027445755898952484,
0.033983491361141205,
0.0019992629531770945,
... | 10 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "text", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "wrap", "annotation": null, "type_comment": null}}], "kwarg": null... | def word_wrap(text, wrap=80):
words = []
for word in text.split():
if len(' '.join(words)) + len(word) < wrap:
words.append(word)
else:
print(' '.join(words))
words = [word]
else:
print(' '.join(words)) | |
12,870 | [
0.03997863084077835,
0.017015602439641953,
0.004882513545453548,
-0.006957797333598137,
-0.01987450011074543,
0.018657458946108818,
0.005307329818606377,
-0.01210151519626379,
-0.011716884560883045,
0.02622377686202526,
0.02907119132578373,
0.031252678483724594,
-0.024340808391571045,
0.02... | 13 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}}, "body": [{"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"a... | def main():
cipher = get_cipher()
page, quote, author = get_quote()
def word_wrap(text, wrap=80):
words = []
for word in text.split():
if len(' '.join(words)) + len(word) < wrap:
words.append(word)
else:
print(' '.join(words))
... | |
12,871 | [
-0.0013350656954571605,
0.009854523465037346,
0.0012037156848236918,
0.001695134793408215,
-0.02045140229165554,
0.011940441094338894,
-0.037891555577516556,
0.026515726000070572,
0.04194837808609009,
0.05930488556623459,
0.004791337065398693,
-0.03245458006858826,
0.024320023134350777,
0.... | 11 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "request", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "resolver", "annotation": null, "type_comment": null}}, {"_type... | def get_exception_response(request, resolver, status_code, exception, sender=None):
try:
callback, param_dict = resolver.resolve_error_handler(status_code)
# Unfortunately, inspect.getargspec result is not trustable enough
# depending on the callback wrapping in decorators (frequent for hand... | |
12,872 | [
-0.020780684426426888,
-0.016355592757463455,
0.0008562837028875947,
0.013079877011477947,
0.011384550482034683,
0.010183454491198063,
-0.043906088918447495,
0.042687755078077316,
0.01672339253127575,
0.015918830409646034,
0.0023131154011934996,
-0.06923829764127731,
0.013643070124089718,
... | 14 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "request", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "exc", "annotation": null, "type_comment": null}}], "kwarg": nu... | def response_for_exception(request, exc):
if isinstance(exc, Http404):
if settings.DEBUG:
response = debug.technical_404_response(request, exc)
else:
response = get_exception_response(request, get_resolver(get_urlconf()), 404, exc)
elif isinstance(exc, PermissionDenied):... | |
12,873 | [
0.015347967855632305,
-0.008388872258365154,
0.00807887688279152,
0.0064972639083862305,
0.0037863804027438164,
-0.034770168364048004,
-0.046436142176389694,
-0.01581612415611744,
0.003821175778284669,
0.030063290148973465,
-0.025761304423213005,
-0.016765091568231583,
0.01909322664141655,
... | 9 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}}, "body": [{"_type": "Assign", "_fields": {"value": {"_type": "List", "_fields": {"c... | def list_devices():
device_list = []
grows_list = []
UUID = str(uuid.uuid4())
username = current_user.get_id()
devices = db.devices.find({'username': current_user.get_id()})
for device in devices:
device_list.append((device['device_name'], device['type'], \
device['sensors'], device['actuators'], device['ki... | |
12,874 | [
0.00813580397516489,
-0.03224810212850571,
-0.08032514154911041,
-0.001297838520258665,
0.02709699049592018,
0.005402630195021629,
-0.018270347267389297,
-0.006774247623980045,
0.003906929865479469,
0.023340972140431404,
-0.02355560101568699,
-0.02613115683197975,
0.024776307865977287,
-0.... | 10 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "new_device_id", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonly... | def add_device(new_device_id):
username = current_user.get_id()
existing_device = db.devices.find_one({'device_name' :
request.form['device_name']})
if not existing_device:
if request.form['kit'] == "standard":
new_device = {'username' : username, 'device_id': new_devi... | |
12,875 | [
0.05118059366941452,
-0.0038362161722034216,
-0.03900250047445297,
0.020036807283759117,
-0.01568249799311161,
0.032901812344789505,
0.008423375897109509,
0.025753293186426163,
0.02421647682785988,
0.016427619382739067,
0.010408428497612476,
-0.019524535164237022,
-0.0027258091140538454,
0... | 8 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "device_id", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs... | def delete_device(device_id):
username = current_user.get_id()
result = db.grows.update_many(
{ "device_id" : device_id },
{
'$set': {'device_name': "", 'device_id':"", 'sensors' : [], 'actuators' : {}, 'controls':{}}
},
upsert=True
)
device = db.devices.delete_one({'device_id' :... | |
12,876 | [
0.030871521681547165,
0.004566469695419073,
-0.03292233124375343,
0.003968316596001387,
-0.0058072092942893505,
0.00362993311136961,
-0.014806846156716347,
-0.005414137616753578,
-0.008387811481952667,
0.02917618490755558,
-0.0014236037386581302,
-0.033113740384578705,
0.019769804552197456,
... | 11 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "device_id", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs... | def edit_device(device_id):
sensors =[]
if request.form['Lux'] == 'on':
sensors.append("Lux")
if request.form['Water_Temp'] == 'on':
sensors.append("Water_Temp")
if request.form['Air_Temp'] == 'on':
sensors.append("Air_Temp")
if request.form['Humidity'] == 'on':
sensors.append("Humidity")
if request.form[... | |
12,877 | [
0.04451136663556099,
0.033696647733449936,
-0.0033359439112246037,
0.025820447131991386,
0.018979955464601517,
0.000709038635250181,
0.020750293508172035,
0.052459824830293655,
0.030637694522738457,
-0.016908539459109306,
0.04484857618808746,
-0.029818762093782425,
-0.027265621349215508,
0... | 9 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "inptr", "annotation": null, "type_comment": null}}, {"_type": "ar... | def hook(self, inptr, outptr, size):
# minimize the chances that the garbage collector kicks in during a
# cython __dealloc__ call and causes a double delete of the current
# object. To avoid this fully the hook would have to avoid all python
# api calls, e.g. by being implemented in C l... | |
12,878 | [
0.049939826130867004,
-0.011826899833977222,
-0.05974426120519638,
0.04066666588187218,
-0.032552652060985565,
0.034001585096120834,
0.013450910337269306,
0.0460035614669323,
0.02900277078151703,
0.017833927646279335,
0.005702147725969553,
-0.01586579531431198,
0.010975653305649757,
-0.012... | 10 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "device_id", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs... | def emergency_stop(device_id):
result = db.devices.update_one(
{ "device_id" : device_id},
{
'$set': {'emergency_stop': request.form['emergency_stop_status']}
},
upsert=True
)
return redirect(url_for('devices.list_devices')) | |
12,879 | [
0.01899724267423153,
0.05053218826651573,
0.02884148433804512,
-0.003453231416642666,
-0.010535484179854393,
0.0350865013897419,
0.014456496573984623,
-0.01936670020222664,
0.008890804834663868,
0.029890265315771103,
0.05205768719315529,
0.03120124340057373,
0.0046927002258598804,
0.018532... | 9 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []... | def check_line_changed(self):
line = self.get_code_line()
if line != self.current_line and (self.current_line is not None):
# move pending events into the allocation_trace
max_size = self.total_bytes
bytes_allocated = 0
bytes_freed = 0
num_allo... | |
12,880 | [
-0.020833704620599747,
0.018282638862729073,
0.055887237191200256,
-0.03895099461078644,
0.01814091205596924,
-0.024164263159036636,
-0.012637224048376083,
-0.04121860861778259,
0.0029230962973088026,
0.0017700971802696586,
0.06817014515399933,
-0.008403163403272629,
0.027400337159633636,
... | 11 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "filename", "annotation": null, "type_comment": null}}], "kwarg": ... | def write_html(self, filename):
f = open(filename, "w")
f.write('<HTML><HEAD><script src="sorttable.js"></script></HEAD><BODY>\n')
f.write('<TABLE class="sortable" width=100%>\n')
f.write("<TR>\n")
cols = "event#,lineinfo,bytes allocated,bytes freed,#allocations,#frees,max memory... | |
12,881 | [
0.017804786562919617,
-0.012714337557554245,
-0.00827787071466446,
-0.04310384392738342,
-0.008136468939483166,
-0.0024259169586002827,
-0.0022565298713743687,
0.060802578926086426,
-0.020067207515239716,
0.09176947176456451,
0.025829313322901726,
-0.054722320288419724,
0.0019737272523343563... | 8 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "url", "annotation": null, "type_comment": null}}, {"_type": "arg"... | def fill_entries_for_url(self, url, config):
entries = []
rss = feedparser.parse(url)
status = rss.get('status', False)
if status != 200 and status != 301: # in cae of redirection...
log.error('Search result not 200 (OK), received %s' % status)
raise
... | |
12,882 | [
0.02041950263082981,
-0.01927691511809826,
-0.03396085649728775,
-0.06262735277414322,
-0.032987963408231735,
-0.022546298801898956,
-0.026946956291794777,
0.027150586247444153,
-0.001303086755797267,
0.037128426134586334,
-0.005065280944108963,
-0.012410080060362816,
0.002194672357290983,
... | 10 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "config", "annotation": null, "type_comment": null}}], "kwarg": nu... | def build_config(self, config):
if config['category'] == 'tv':
config['category'] = 'tvsearch'
log.debug(config['category'])
if 'url' not in config:
if 'apikey' in config and 'website' in config:
params = {
't': config['category'],
... | |
12,883 | [
0.037881381809711456,
0.014222369529306889,
0.012065422721207142,
-0.06043945252895355,
-0.019772013649344444,
-0.007403271272778511,
-0.02561374567449093,
0.060664135962724686,
-0.021288618445396423,
0.03230926766991615,
-0.02021014504134655,
-0.04450950026512146,
0.02173798158764839,
0.0... | 9 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "entry", "annotation": null, "type_comment": null}}, {"_type": "ar... | def search(self, entry, config=None):
config = self.build_config(config)
if config['category'] == 'movie':
return self.do_search_movie(entry, config)
elif config['category'] == 'tvsearch':
return self.do_search_tvsearch(entry, config)
else:
entries = [... | |
12,884 | [
0.0275020282715559,
-0.010050986893475056,
-0.034067317843437195,
-0.062990702688694,
-0.028066055849194527,
0.0009799994295462966,
-0.017022378742694855,
0.017530005425214767,
-0.012498870491981506,
0.039324063807725906,
0.00001638106186874211,
-0.03670697286725044,
0.046566192060709,
-0.... | 9 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "arg_entry", "annotation": null, "type_comment": null}}, {"_type":... | def do_search_tvsearch(self, arg_entry, config=None):
log.info('Searching for %s' % (arg_entry['title']))
# normally this should be used with emit_series who has provided season and episodenumber
if 'series_name' not in arg_entry or 'series_season' not in arg_entry or 'series_episode' not in arg... | |
12,885 | [
0.01602025516331196,
0.016961971297860146,
-0.007350926287472248,
-0.05180547386407852,
-0.01681794412434101,
-0.0208174679428339,
-0.006082379259169102,
0.04768408089876175,
-0.03385746851563454,
0.0431859977543354,
-0.015222566202282906,
-0.055350758135318756,
0.03498752787709236,
-0.017... | 9 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "arg_entry", "annotation": null, "type_comment": null}}, {"_type":... | def do_search_movie(self, arg_entry, config=None):
entries = []
log.info('Searching for %s (imdbid:%s)' % (arg_entry['title'], arg_entry['imdb_id']))
# normally this should be used with emit_movie_queue who has imdbid (i guess)
if 'imdb_id' not in arg_entry:
return entries
... | |
12,886 | [
-0.04381866380572319,
0.053088463842868805,
0.05391569063067436,
-0.011301371268928051,
-0.010340329259634018,
0.01712845079600811,
0.022079642862081528,
0.0033241116907447577,
0.00518841203302145,
0.02936653420329094,
0.011593333445489407,
-0.03676291182637215,
-0.025935977697372437,
-0.0... | 16 | {"_type": "Module", "_fields": {"body": [{"_type": "ClassDef", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "context", "annotation"... | class UnitTerminology(TextStemmer):
def __init__(self, context):
super(UnitTerminology, self).__init__(context)
if not self.is_terminology:
raise ValueError("Unit must be a terminology unit")
@property
def is_terminology(self):
return (
self.context.store.na... | |
12,887 | [
-0.048245664685964584,
0.06278277933597565,
0.05975827947258949,
-0.030049877241253853,
-0.01824456825852394,
0.02172030508518219,
-0.0018125661881640553,
-0.019415343180298805,
-0.00878690555691719,
0.01880556344985962,
-0.010671121068298817,
-0.06385599076747894,
-0.046343155205249786,
-... | 13 | {"_type": "Module", "_fields": {"body": [{"_type": "ClassDef", "_fields": {"body": [{"_type": "Assign", "_fields": {"value": {"_type": "Constant", "_fields": {"kind": null, "value": "pootle.terminology.matcher"}}, "targets": [{"_type": "Name", "_fields": {"id": "ns", "ctx": {"_type": "Store", "_fields": {}}}}], "type_c... | class UnitTerminologyMatcher(TextStemmer):
ns = "pootle.terminology.matcher"
sw_version = PootleTerminologyConfig.version
similarity_threshold = .2
max_matches = 10
@property
def revision_context(self):
term_tp = TranslationProject.objects.select_related("directory").filter(
... | |
12,888 | [
0.02180209755897522,
0.038347870111465454,
0.0791814923286438,
-0.0271878894418478,
-0.022630680352449417,
-0.008758384734392166,
0.007036484777927399,
-0.011930304579436779,
-0.0006902163731865585,
0.07182781398296356,
0.021840937435626984,
-0.04324169084429741,
-0.0024193983990699053,
-0... | 8 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []... | def stem(self):
stems = self.stems
existing_stems = self.existing_stems
missing_stems = self.missing_stems
if existing_stems:
self.clear_stems(existing_stems - stems)
if missing_stems:
self.create_stems(missing_stems)
if stems - existing_stems:
... | |
12,889 | [
0.02146327868103981,
0.015018508769571781,
0.010020053014159203,
0.013039954006671906,
-0.008938211016356945,
0.024043498560786247,
0.00728941522538662,
0.017332609742879868,
0.0345957949757576,
0.016071423888206482,
0.011524218134582043,
-0.013502773828804493,
0.006809239275753498,
-0.016... | 9 | {"_type": "Module", "_fields": {"body": [{"_type": "ClassDef", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "powerline", "annotatio... | class PowerlinePrompt(BasePrompt):
def __init__(self, powerline, powerline_last_in, old_prompt):
self.powerline = powerline
self.powerline_last_in = powerline_last_in
self.powerline_segment_info = IPythonInfo(old_prompt.cache)
self.cache = old_prompt.cache
if hasattr(old_prompt, 'sep'):
self.sep = old_pro... | |
12,890 | [
-0.001267816056497395,
-0.021836336702108383,
0.01726539060473442,
-0.040333278477191925,
-0.02088898979127407,
-0.006157752126455307,
0.0012448724592104554,
-0.013783891685307026,
-0.005805457942187786,
0.036851778626441956,
-0.05361981317400932,
-0.05489873141050339,
-0.029320374131202698,... | 12 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "results", "annotation": null, "type_comment": null}}], "kwarg": n... | def similar(self, results):
matches = []
matched = []
for result in results:
target_pair = (
result.source_f.lower().strip(),
result.target_f.lower().strip())
if target_pair in matched:
continue
similarity = self... | |
12,891 | [
0.033392708748579025,
0.02483428083360195,
0.0292371716350317,
0.01186059508472681,
-0.01594192534685135,
0.01654794253408909,
0.013839421793818474,
0.023053336888551712,
0.034431591629981995,
0.017042648047208786,
0.008372912183403969,
-0.013851789757609367,
0.018019694834947586,
0.014606... | 12 | {"_type": "Module", "_fields": {"body": [{"_type": "ClassDef", "_fields": {"body": [{"_type": "Assign", "_fields": {"value": {"_type": "Constant", "_fields": {"kind": null, "value": "in"}}, "targets": [{"_type": "Name", "_fields": {"id": "powerline_prompt_type", "ctx": {"_type": "Store", "_fields": {}}}}], "type_commen... | class PowerlinePrompt1(PowerlinePrompt):
powerline_prompt_type = 'in'
powerline_is_prompt = True
rspace = re.compile(r'(\s*)$')
def __str__(self):
self.cache.prompt_count += 1
self.set_p_str()
self.cache.last_prompt = self.p_str_nocolor.split('\n')[-1]
return string(self.p_str)
def set_p_str(self):
sup... | |
12,892 | [
0.015485391952097416,
0.008899280801415443,
-0.016641976311802864,
0.007504953537136316,
-0.00002395748015260324,
0.04063469544053078,
-0.0021766291465610266,
0.0017621861770749092,
0.03911828622221947,
0.027295412495732307,
0.030765168368816376,
0.004510682541877031,
0.013364985585212708,
... | 7 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "powerline", "annotation": null, "type_comment": null}}, {"_type":... | def __init__(self, powerline, powerline_last_in, old_prompt):
self.powerline = powerline
self.powerline_last_in = powerline_last_in
self.powerline_segment_info = IPythonInfo(old_prompt.cache)
self.cache = old_prompt.cache
if hasattr(old_prompt, 'sep'):
self.sep = old_prompt.sep
self.pad_left = False | |
12,893 | [
0.0203830786049366,
0.023642482236027718,
0.02007603459060192,
0.010646202601492405,
-0.008892502635717392,
0.01813928782939911,
0.00922907143831253,
-0.003569400869309902,
0.05640184506773949,
0.002651217393577099,
0.010746583342552185,
-0.008136698976159096,
0.0144075071439147,
0.0101856... | 9 | {"_type": "Module", "_fields": {"body": [{"_type": "ClassDef", "_fields": {"body": [{"_type": "Assign", "_fields": {"value": {"_type": "Constant", "_fields": {"kind": null, "value": "out"}}, "targets": [{"_type": "Name", "_fields": {"id": "powerline_prompt_type", "ctx": {"_type": "Store", "_fields": {}}}}], "type_comme... | class PowerlinePromptOut(PowerlinePrompt):
powerline_prompt_type = 'out'
powerline_is_prompt = False
def set_p_str(self):
super(PowerlinePromptOut, self).set_p_str()
spaces = ' ' * self.powerline_last_in['nrspaces']
self.p_str += spaces
self.p_str_nocolor += spaces | |
12,894 | [
0.005674077197909355,
0.017458699643611908,
0.010146374814212322,
0.005237610079348087,
-0.03132999688386917,
0.020711278542876244,
0.021620089188218117,
0.030229859054088593,
0.027766507118940353,
-0.007419947534799576,
0.0033602018374949694,
0.011551440693438053,
-0.0065470123663544655,
... | 10 | {"_type": "Module", "_fields": {"body": [{"_type": "ClassDef", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "config_overrides", "an... | class ConfigurableIPythonPowerline(IPythonPowerline):
def init(self, config_overrides=None, theme_overrides={}, config_paths=None):
self.config_overrides = config_overrides
self.theme_overrides = theme_overrides
self.config_paths = config_paths
super(ConfigurableIPythonPowerline, self).init()
def ipython_mag... | |
12,895 | [
-0.00858241319656372,
0.03454556316137314,
-0.016503602266311646,
-0.004459886346012354,
-0.006905738729983568,
0.011058628559112549,
0.03249441832304001,
0.053275734186172485,
0.04685242101550102,
-0.004102285485714674,
0.031819701194763184,
0.006632477976381779,
-0.01274542324244976,
-0.... | 9 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "ip", "annotation": null, "type_comment": null}}, {"_type": "arg",... | def do_setup(self, ip, shutdown_hook):
last_in = {'nrspaces': 0}
for attr, prompt_class in (
('prompt1', PowerlinePrompt1),
('prompt2', PowerlinePrompt2),
('prompt_out', PowerlinePromptOut)
):
old_prompt = getattr(ip.IP.outputcache, attr)
prompt = prompt_class(self, last_in, old_prompt)
setattr(... | |
12,896 | [
-0.02234935574233532,
0.016206208616495132,
-0.002160340081900358,
0.012649033218622208,
-0.007518042344599962,
0.009197168983519077,
0.017388032749295235,
0.029791340231895447,
0.0448625274002552,
0.013058575801551342,
0.007453685626387596,
0.009969450533390045,
-0.023694997653365135,
-0.... | 10 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [], "kwarg": {"_type": "arg", "_fields": {"arg": "kwargs", "annotation": null, "type_comment": null}}, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}}... | def setup(**kwargs):
ip = get_ipython()
powerline = ConfigurableIPythonPowerline(**kwargs)
shutdown_hook = ShutdownHook()
def late_startup_hook():
powerline.setup(ip, shutdown_hook)
raise TryNext()
ip.IP.hooks.late_startup_hook.add(late_startup_hook)
ip.IP.hooks.shutdown_hook.add(shutdown_hook) | |
12,897 | [
0.009008887223899364,
-0.05245174467563629,
0.020709319040179253,
-0.04804740101099014,
-0.012645808979868889,
0.0003767605812754482,
-0.02169918455183506,
0.030096357688307762,
0.0006179707706905901,
0.06032618135213852,
-0.013846994377672672,
-0.03103061392903328,
0.00026814648299477994,
... | 10 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "only_wlan", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "only_eth", "annotation": null, "type_comment": null}}], "kwa... | def get_interfaces(only_wlan=False, only_eth=False):
logger.debug("getting all interfaces")
interfaces = netifaces.interfaces()
if 'lo' in interfaces:
interfaces.remove('lo')
if only_wlan:
for x in interfaces:
if not x.startswith('wlan'):
interfa... | |
12,898 | [
-0.007732565514743328,
-0.04351583495736122,
-0.0224361140280962,
-0.0582582950592041,
0.017666494473814964,
0.016743700951337814,
0.0034993889275938272,
0.019145186990499496,
-0.002633575117215514,
0.02577151358127594,
0.021057482808828354,
-0.004764060955494642,
0.008799892850220203,
-0.... | 11 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}}, "body": [{"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"arg... | def ethernet_info():
logger.debug("getting ethernet information")
ethernet = {}
session = Session()
ethernet['interface'] = session.query(InterfaceDefinition).filter_by(interface='eth0').first()
session.close()
interfaces = netifaces.interfaces()
if 'eth0' in interfaces:
... | |
12,899 | [
-0.01400513295084238,
0.004842746537178755,
0.04906289651989937,
-0.05750962346792221,
-0.0007650031475350261,
0.015917841345071793,
-0.02062900923192501,
-0.03964056074619293,
0.021463412791490555,
0.03856225684285164,
0.022965338081121445,
-0.04901154711842537,
0.0075673931278288364,
-0.... | 14 | {"_type": "Module", "_fields": {"body": [{"_type": "ClassDef", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "cls", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs"... | class TestFunctionManager(unittest.TestCase):
@classmethod
def setUpClass(cls):
cls.project = angr.Project(os.path.join(TEST_LOCATION, "x86_64", "fauxware"), auto_load_libs=False)
def test_amd64(self):
expected_functions = { 0x4004e0, 0x400510, 0x400520, 0x400530, 0x400540, 0x400550, 0x4005... | |
12,900 | [
-0.00573321245610714,
0.05093132331967354,
0.011053839698433876,
-0.010979345068335533,
-0.01965508982539177,
-0.01618250086903572,
0.019299808889627457,
-0.028880950063467026,
-0.04082299396395683,
0.00661282055079937,
0.009397769346833229,
-0.022336892783641815,
-0.018566325306892395,
0.... | 9 | {"_type": "Module", "_fields": {"body": [{"_type": "ClassDef", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "app", "annotation": nu... | class OpenedFileLabel(GUIObject):
#--- model -> view calls:
# refresh()
#
def __init__(self, app):
GUIObject.__init__(self)
self.app = app
self.text = "Working on: Nothing"
def _view_updated(self):
self.view.refresh()
def refresh(self):
self... |