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
13,101
[ 0.015412310138344765, -0.031255558133125305, 0.07138333469629288, -0.044310394674539566, 0.002238650806248188, 0.003599585732445121, 0.00715481024235487, -0.03069787472486496, 0.014892651699483395, 0.015082770958542824, -0.020152609795331955, -0.010893816128373146, -0.0696088895201683, -0....
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_wavelengths_equiv(self): s = SixS() s.altitudes.set_sensor_satellite_level() s.altitudes.set_target_sea_level() serial_res = SixSHelpers.Wavelengths.run_vnir(s, spacing=0.05, output_name='apparent_radiance', n=1) for i in range(2, 10, 2): parallel_res = SixSHelpers.Wavelengths.run_vnir(s, spac...
13,102
[ 0.00956645142287016, 0.03042467124760151, 0.03775559365749359, -0.07744461297988892, -0.009076380170881748, -0.007445048540830612, 0.03437209129333496, 0.015400308184325695, 0.02822270803153515, -0.003608398139476776, -0.014460446313023567, -0.006887844763696194, -0.059721507132053375, -0....
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_after_prev_run(self): s = SixS() s.run() try: results = SixSHelpers.Wavelengths.run_vnir(s, spacing=0.05, output_name='apparent_radiance', n=1) except OutputParsingError: self.fail("OutputParsingError raised by run_vnir after previous SixS.run")
13,103
[ -0.0099842743948102, -0.03431575372815132, 0.05117978900671005, -0.019138123840093613, 0.011562083847820759, 0.011855927295982838, -0.018703747540712357, -0.02340523526072502, 0.02621590718626976, -0.008610878139734268, -0.002210210543125868, -0.04502186179161072, -0.0046408032067120075, 0...
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_angles_equiv(self): s = SixS() serial_res = SixSHelpers.Angles.run360(s, 'view', output_name='apparent_radiance', n=1) for i in range(2, 10, 2): parallel_res = SixSHelpers.Angles.run360(s, 'view', output_name='apparent_radiance', n=i) np.testing.assert_allclose(parallel_res[0], serial_res[0])
13,104
[ -0.0025034782011061907, -0.00882746558636427, 0.04877118766307831, -0.023564781993627548, 0.03131026774644852, 0.009148328565061092, 0.006596348248422146, -0.010036299005150795, 0.04963677376508713, -0.005279317032545805, -0.023326000198721886, -0.029683565720915794, -0.015431275591254234, ...
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_run360(self): s = SixS() res0 = np.array([ 163.599, 160.769, 152.359, 138.612, 119.949, 97.014, 70.809, 43.092, 17.56 , 0.685, 163.599, 160.769, 152.359, 138.612, 119.949, 97.014, 70.809, 43.092, 17.56 , 0.685, 163.599, 160.769, 152.359, 138.61...
13,105
[ -0.010760691948235035, -0.007046470884233713, 0.05072585865855217, -0.02706543356180191, 0.02657068893313408, 0.013292619958519936, 0.001127726398408413, -0.02380594052374363, 0.04534187540411949, 0.0010686117457225919, -0.02325299009680748, -0.0350104458630085, -0.0020426397677510977, -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}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs...
class AllAnglesTests(unittest.TestCase): def test_run360(self): s = SixS() res0 = np.array([ 163.599, 160.769, 152.359, 138.612, 119.949, 97.014, 70.809, 43.092, 17.56 , 0.685, 163.599, 160.769, 152.359, 138.612, 119.949, 97.014, 70.809, 43.092, 17.56 , 0....
13,106
[ 0.0014858385547995567, -0.0059746019542217255, 0.04892174154520035, -0.031147925183176994, 0.006962036248296499, 0.0003751703188754618, -0.017736319452524185, 0.0037091278936713934, 0.06384574621915817, -0.026498235762119293, -0.025073330849409103, 0.0032154107466340065, -0.03537264466285705...
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}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs...
class RadiosondeImportTest(unittest.TestCase): def test_simple_radiosonde_import(self): s = SixS() s.altitudes.set_sensor_satellite_level() s.altitudes.set_target_sea_level() s.atmos_profile = SixSHelpers.Radiosonde.import_uow_radiosonde_data("http://weather.uwyo.edu/cgi-bin/sounding?region=europe&TYPE=TEXT%3...
13,107
[ 0.0017548725008964539, -0.019997453317046165, 0.044406816363334656, -0.0705905333161354, 0.0351993553340435, 0.014806268736720085, 0.004786560777574778, 0.03354489058256149, 0.02078871987760067, 0.023186497390270233, -0.05044921487569809, -0.027022939175367355, 0.009896821342408657, -0.018...
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 AERONETImportTest(unittest.TestCase): def test_import_aeronet(self): s = SixS() s = SixSHelpers.Aeronet.import_aeronet_data(s, os.path.join(test_dir, "070101_101231_Marambio.dubovik"), "2008-02-22") s.run() self.assertAlmostEqual(s.outputs.apparent_radiance, 137.324, delta=0.002) def test_i...
13,108
[ 0.0046118018217384815, -0.0032631633803248405, 0.03987633064389229, -0.03545767441391945, 0.004147571977227926, -0.0038459922652691603, -0.025820670649409294, 0.006993945222347975, 0.07216233760118484, -0.018975820392370224, -0.029710713773965836, 0.00029946217546239495, -0.04711424931883812...
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_simple_radiosonde_import(self): s = SixS() s.altitudes.set_sensor_satellite_level() s.altitudes.set_target_sea_level() s.atmos_profile = SixSHelpers.Radiosonde.import_uow_radiosonde_data("http://weather.uwyo.edu/cgi-bin/sounding?region=europe&TYPE=TEXT%3ALIST&YEAR=2012&MONTH=02&FROM=2712&TO=2712&STNM=0...
13,109
[ 0.002475183689966798, -0.03708361089229584, -0.012549564242362976, 0.014845216646790504, 0.011590099893510342, 0.05344748869538307, 0.018635984510183334, -0.05024534836411476, -0.035247087478637695, 0.012584881857037544, -0.0003044314216822386, -0.03578862547874451, 0.008805885910987854, 0...
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 TestChebWin(object): def test_cheb_odd(self): cheb_odd = signal.chebwin(53, at=-40) assert_array_almost_equal(cheb_odd, cheb_odd_true, decimal=4) def test_cheb_even(self): cheb_even = signal.chebwin(54, at=-40) assert_array_almost_equal(cheb_even, cheb_even_true, decimal=...
13,110
[ -0.04137036204338074, -0.027187639847397804, -0.004576258827000856, 0.013176681473851204, 0.01698000729084015, 0.01818234845995903, 0.00895621720701456, -0.05825221911072731, -0.016476986929774284, 0.021053245291113853, 0.017384877428412437, 0.0026316556613892317, 0.02581353671848774, 0.07...
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 TestGetWindow(object): def test_boxcar(self): w = signal.get_window('boxcar', 12) assert_array_equal(w, ones_like(w)) def test_cheb_odd(self): w = signal.get_window(('chebwin', -40), 53, fftbins=False) assert_array_almost_equal(w, cheb_odd_true, decimal=4) def test_c...
13,111
[ 0.032028838992118835, 0.012943613342940807, 0.037708181887865067, -0.012844555079936981, -0.004361315164715052, -0.018931135535240173, 0.03403201699256897, -0.016498705372214317, -0.011479752138257027, 0.00890974048525095, -0.0026759491302073, 0.009003295563161373, 0.04052583873271942, -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": "type", "annotation": {"_type": "Name", "_fields": {"id": "str", "...
def __init__( self, type: str, client_conn: connections.ClientConnection, server_conn: connections.ServerConnection, live: bool=None ) -> None: self.type = type self.id = str(uuid.uuid4()) self.client_conn = client_conn self...
13,112
[ 0.07522002607584, -0.026344960555434227, -0.00019845676433760673, -0.011304321698844433, 0.02082463726401329, -0.002465632511302829, -0.0027966275811195374, -0.018468400463461876, -0.020488031208515167, -0.01551749650388956, 0.04160439223051071, 0.0007931258296594024, 0.00775874825194478, ...
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 copy(self): f = copy.copy(self) f.id = str(uuid.uuid4()) f.live = False f.client_conn = self.client_conn.copy() f.server_conn = self.server_conn.copy() f.metadata = self.metadata.copy() if self.error: f.error = self.error.copy() return f
13,113
[ 0.016719624400138855, 0.001568702864460647, -0.03801535442471504, -0.00853810179978609, -0.010865774005651474, -0.05970728024840355, 0.024306846782565117, 0.02327672764658928, 0.007607032544910908, -0.015818269923329353, 0.031002620235085487, 0.052932266145944595, -0.002216241555288434, -0...
9
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "node", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "coinbase", "annotation": null, "type_comment": null}}, {"_type": ...
def create_transaction(node, coinbase, to_address, amount): from_txid = node.getblock(coinbase)['tx'][0] inputs = [{ "txid" : from_txid, "vout" : 0}] outputs = { to_address : amount } rawtx = node.createrawtransaction(inputs, outputs) signresult = node.signrawtransaction(rawtx) tx = CTransaction...
13,114
[ 0.05911589413881302, 0.015585317276418209, 0.07326904684305191, -0.011361034587025642, -0.0480918362736702, -0.03028004616498947, 0.011607752181589603, 0.009664100594818592, -0.029293175786733627, 0.028595145791769028, 0.040124669671058655, 0.00710064684972167, -0.03846384212374687, -0.021...
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 finalize_options(self): if self.bdist_dir is None: bdist_base = self.get_finalized_command('bdist').bdist_base self.bdist_dir = os.path.join(bdist_base, 'wheel') self.data_dir = self.wheel_dist_name + '.data' self.plat_name_supplied = self.plat_name is not None ...
13,115
[ 0.030148781836032867, -0.027143295854330063, -0.015755321830511093, 0.007607636507600546, -0.024983102455735207, -0.031416721642017365, -0.011910412460565567, -0.007983322255313396, -0.0021543230395764112, -0.0015232883160933852, 0.01603708602488041, -0.0018079876899719238, -0.00733761256560...
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_tag(self): # bdist sets self.plat_name if unset, we should only use it for purepy # wheels if the user supplied it. if self.plat_name_supplied: plat_name = self.plat_name elif self.root_is_pure: plat_name = 'any' else: plat_name = self....
13,116
[ -0.004775602370500565, 0.01918807066977024, -0.01148928515613079, 0.009674342349171638, 0.01587941311299801, 0.005621504969894886, -0.013127552345395088, 0.015890121459960938, -0.007666662335395813, 0.027518605813384056, 0.02871786057949066, -0.032465528696775436, 0.002666199579834938, -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": "client_id", "annotation": null, "type_comment": null}}, {"_type":...
def validate_code(self, client_id, code, client, request, *args, **kwargs): try: grant = Grant.objects.get(code=code, application=client) if not grant.is_expired(): request.scopes = grant.scope.split(' ') request.user = grant.user return Tr...
13,117
[ 0.02646872028708458, 0.005156427621841431, 0.046653665602207184, -0.03862941265106201, -0.043828222900629044, 0.0017800271743908525, 0.011900752782821655, 0.02956540323793888, -0.0549265518784523, 0.031373683363199234, 0.013030928559601307, 0.0030175698921084404, -0.031825754791498184, -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 run(self): build_scripts = self.reinitialize_command('build_scripts') build_scripts.executable = 'python' if not self.skip_build: self.run_command('build') install = self.reinitialize_command('install', reinit_subcommands=True...
13,118
[ -0.049687307327985764, -0.0068726008757948875, 0.0704265758395195, 0.007294546812772751, -0.025943269953131676, -0.022772284224629402, 0.010529464110732079, -0.01262001320719719, -0.0007344093173742294, 0.0356735922396183, 0.047488074749708176, -0.038435421884059906, 0.011693011038005352, ...
14
{"_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 grc_regions_from_url(url): GrcRegion = namedtuple("GrcRegion", "chrom,start,end,name") with closing(urllib2.urlopen(url)) as in_handle: header = in_handle.next() for parts in (l.split("\t") for l in in_handle): try: chrom = int(parts[5]) except ValueEr...
13,119
[ -0.01268765702843666, 0.01857718825340271, 0.1049526110291481, -0.031245235353708267, -0.05310382694005966, -0.019283147528767586, 0.044370848685503006, -0.04254058375954628, -0.0007815394201315939, -0.018825581297278404, 0.05119512230157852, 0.009164397604763508, -0.010399825870990753, -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": "Assign", "_fields": {"value": {"_type": "Constant", "_fields":...
def main(): out_file = "GRC_patch_regions.bed" regions = [] for dname in dirs: cur_url = base_url + dname + sub_url for region in grc_regions_from_url(cur_url): regions.append(region) regions.sort(key=attrgetter("chrom", "start", "end")) with open(out_file, "w") as out_ha...
13,120
[ 0.01892811432480812, -0.02556246519088745, -0.04575086757540703, -0.03883116692304611, 0.029200658202171326, -0.02596670761704445, 0.03279129043221474, -0.0269654281437397, 0.014635996893048286, 0.004767696838825941, 0.028748854994773865, -0.03892628476023674, 0.022887323051691055, -0.0584...
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": "media_id", "annotation": null, "type_comment": null}}, {"_type": ...
def download_photo(self, media_id, filename, media=False, folder="photos"): if not media: self.media_info(media_id) if not self.last_json.get("items"): return True media = self.last_json["items"][0] if media["media_type"] == 2: return True elif media["media_type"]...
13,121
[ -0.032452378422021866, -0.000800707726739347, 0.014262082986533642, -0.007315176539123058, -0.023502307012677193, -0.03307732194662094, -0.02067890577018261, -0.021861832588911057, -0.010423149913549423, 0.01892683282494545, -0.017877822741866112, -0.08209067583084106, 0.004703809041529894, ...
9
{"_type": "Module", "_fields": {"body": [{"_type": "ClassDef", "_fields": {"body": [{"_type": "Assign", "_fields": {"value": {"_type": "List", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "elts": [{"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"kind": null, "value": "^inner/$"}}, {"_ty...
class URLObject: urlpatterns = [ url(r'^inner/$', views.empty_view, name='urlobject-view'), url(r'^inner/(?P<arg1>[0-9]+)/(?P<arg2>[0-9]+)/$', views.empty_view, name='urlobject-view'), url(r'^inner/\+\\\$\*/$', views.empty_view, name='urlobject-special-view'), ] def __init__(self, a...
13,122
[ 0.0071063111536204815, 0.038087744265794754, 0.020230861380696297, -0.03042438253760338, 0.009376165457069874, -0.01817966252565384, -0.008121498860418797, -0.05801665410399437, -0.03600531071424484, -0.00983430165797472, 0.041836127638816833, -0.023302452638745308, -0.024197900667786598, ...
15
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "fname", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": [...
def get_image_size(fname): with open(fname, "rb") as fhandle: head = fhandle.read(24) if len(head) != 24: raise RuntimeError("Invalid Header") if imghdr.what(fname) == "png": check = struct.unpack(">i", head[4:8])[0] if check != 0x0D0A1A0A: ...
13,123
[ -0.004616132006049156, -0.023285821080207825, -0.013027749955654144, -0.0308152437210083, -0.0033441309351474047, -0.046366479247808456, 0.04146312177181244, -0.022875497117638588, -0.010555555112659931, -0.028025049716234207, 0.0006988310487940907, 0.0055855195969343185, 0.02137781865894794...
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": "upload_id", "annotation": null, "type_comment": null}}, {"_type":...
def configure_photo(self, upload_id, photo, caption="", user_tags=None, is_sidecar=False): width, height = get_image_size(photo) data = { "media_folder": "Instagram", "source_type": 4, "caption": caption, "upload_id": upload_id, "device": self.device_s...
13,124
[ -0.016790371388196945, 0.01634603925049305, 0.06059075519442558, -0.021462591364979744, -0.024411341175436974, -0.005813346244394779, 0.008731801062822342, -0.0316687673330307, -0.009324243292212486, 0.05159639194607735, 0.050519224256277084, -0.029433641582727432, 0.010199443437159061, -0...
14
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "folder", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": ...
def main(folder): out = open(os.path.join(folder, "overview.html"), "wb") def w(x): out.write(x.encode("utf8") + "\n") path = "" title = "Wesnoth Unit Database Overview" generation_note = "generated on " + time.ctime() w(html_output.html_header % locals()) w(html_output.top_bar % loca...
13,125
[ 0.020737523213028908, -0.029022671282291412, 0.014807233586907387, -0.02126767486333847, -0.02471981942653656, -0.02998434007167816, 0.0219457745552063, -0.01717441715300083, -0.002918911399319768, 0.023227998986840248, 0.005942619871348143, -0.03728315979242325, -0.0001999623782467097, -0...
12
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "folder", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "addon", "annotation": null, "type_comment": null}}], "kwarg": n...
def write_addon_overview(folder, addon): out = open(os.path.join(folder, "index.html"), "wb") def w(x): out.write(x.encode("utf8") + "\n") name = addon["name"] path = "../" title = name + " Overview" generation_note = "generated on " + time.ctime() w(html_output.html_header % loca...
13,126
[ -0.008419222198426723, 0.029861027374863625, 0.03677567467093468, -0.017965275794267654, -0.02427809126675129, -0.020244548097252846, 0.022831138223409653, -0.05961961671710014, -0.006850621663033962, 0.052397653460502625, 0.0392342135310173, -0.009866176173090935, -0.017593933269381523, 0...
10
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "line", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []...
def postprocess(line): if line == "WMLError:": return "" if line == "?": return "" if line == "Preprocessor error:": return "" if line.startswith("Automatically found a possible data directory"): return "" if line.startswith("Overriding dat...
13,127
[ 0.0023861366789788008, -0.02513088472187519, 0.04299679398536682, -0.04524547606706619, 0.019126160070300102, -0.0033328693825751543, 0.015839623287320137, 0.021177157759666443, 0.01905202865600586, 0.019212648272514343, 0.017124585807323456, -0.056192364543676376, -0.03180280327796936, 0....
12
{"_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 ManyToOneNullTests(TestCase): def setUp(self): # Create a Reporter. self.r = Reporter(name='John Smith') self.r.save() # Create an Article. self.a = Article(headline="First", reporter=self.r) self.a.save() # Create an Article via the Reporter object. ...
13,128
[ 0.04469679668545723, -0.01959012821316719, 0.033304501324892044, -0.04346519708633423, -0.03422820195555687, -0.019987832754850388, 0.055473290383815765, 0.03209856152534485, 0.004958470817655325, -0.028480736538767815, 0.019487494602799416, -0.03291962668299675, -0.020744752138853073, -0....
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 setUp(self): # Create a Reporter. self.r = Reporter(name='John Smith') self.r.save() # Create an Article. self.a = Article(headline="First", reporter=self.r) self.a.save() # Create an Article via the Reporter object. self.a2 = self.r.article_set.create...
13,129
[ 0.03542967140674591, -0.020771710202097893, 0.017376575618982315, -0.05316956341266632, 0.0017758684698492289, 0.018729617819190025, 0.01726382225751877, 0.018792258575558662, 0.009897256270051003, -0.01495863776654005, -0.024517633020877838, -0.03698316588997841, -0.01242168340831995, 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_created_without_related(self): self.assertIsNone(self.a3.reporter) # Need to reget a3 to refresh the cache a3 = Article.objects.get(pk=self.a3.pk) with self.assertRaises(AttributeError): getattr(a3.reporter, 'id') # Accessing an article's 'reporter' attribute...
13,130
[ 0.025475800037384033, -0.01984599232673645, 0.024169979616999626, -0.04777328297495842, 0.004927620757371187, -0.001969508361071348, 0.01546041015535593, 0.029787467792630196, 0.018195239827036858, 0.012263616546988487, 0.03873109817504883, -0.07287950813770294, -0.02375113219022751, -0.00...
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_set(self): # Use manager.set() to allocate ForeignKey. Null is legal, so existing # members of the set that are not in the assignment set are set to null. self.r2.article_set.set([self.a2, self.a3]) self.assertQuerysetEqual(self.r2.article_set.all(), ['<Article: Second>', '<Arti...
13,131
[ 0.010151057504117489, -0.024005239829421043, 0.010068240575492382, -0.027590055018663406, 0.014540384523570538, -0.009387954138219357, 0.03471235930919647, 0.04292312264442444, 0.01711955852806568, 0.01727336086332798, 0.0347360223531723, -0.06630131602287292, -0.034830670803785324, 0.0087...
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_assign_clear_related_set(self): # Use descriptor assignment to allocate ForeignKey. Null is legal, so # existing members of the set that are not in the assignment set are # set to null. self.r2.article_set.set([self.a2, self.a3]) self.assertQuerysetEqual(self.r2.article_...
13,132
[ 0.040902722626924515, -0.016323905438184738, 0.04058045893907547, -0.045488785952329636, 0.002705157268792391, 0.0043691545724868774, 0.03021843545138836, 0.03882040083408356, 0.030044909566640854, -0.01075245812535286, 0.016323905438184738, -0.05005005747079849, -0.01976964995265007, -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_add_efficiency(self): r = Reporter.objects.create() articles = [] for _ in range(3): articles.append(Article.objects.create()) with self.assertNumQueries(1): r.article_set.add(*articles) self.assertEqual(r.article_set.count(), 3)
13,133
[ -0.001229317975230515, 0.013620905578136444, 0.028616398572921753, -0.032890114933252335, 0.012664943002164364, 0.02535487897694111, -0.007472753990441561, 0.017719672992825508, 0.004939140286296606, 0.006879182066768408, 0.013483447022736073, -0.07257818430662155, -0.042187318205833435, 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_assign_with_queryset(self): # Querysets used in reverse FK assignments are pre-evaluated # so their value isn't affected by the clearing operation in # RelatedManager.set() (#19816). self.r2.article_set.set([self.a2, self.a3]) qs = self.r2.article_set.filter(headline="S...
13,134
[ -0.009144246578216553, 0.03453727439045906, 0.0763513520359993, -0.07039760053157806, 0.007690262980759144, -0.012403649277985096, -0.025937410071492195, -0.012658613733947277, -0.06014391779899597, -0.00499936006963253, -0.019776931032538414, -0.05738755315542221, 0.012341631576418877, 0....
11
{"_type": "Module", "_fields": {"body": [{"_type": "ClassDef", "_fields": {"body": [{"_type": "Assign", "_fields": {"value": {"_type": "List", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "elts": [{"_type": "Tuple", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "elts": [{"_type": "Constant", "_fields": {...
class Migration(migrations.Migration): dependencies = [ ('attribution', '0004_auto_20210617_1727'), ] operations = [ migrations.AlterField( model_name='tutorapplication', name='uuid', field=models.UUIDField(db_index=True, default=uuid.uuid4, editable=Fal...
13,135
[ -0.0023734814021736383, -0.032631292939186096, -0.00414951890707016, -0.03463001549243927, 0.021203823387622833, 0.011085297912359238, -0.006756546441465616, 0.027221713215112686, -0.031088802963495255, 0.02765621617436409, -0.003329391358420253, -0.015859417617321014, -0.011427470482885838,...
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": {"_type": "arg", "_fields": {"arg": "layers", "annotation": null, "type_comm...
def stack(self, *layers): for layer in layers: if not self.layers: layer.connect(self.input_dim) else: layer.connect(self.layers[-1].output_dim) self.layers.append(layer) self.output_dim = layer.output_dim self.register_inne...
13,136
[ 0.00966098252683878, -0.009475861676037312, 0.025477224960923195, -0.03202586621046066, 0.014647669158875942, -0.01998145692050457, 0.0011027692817151546, -0.0008229190134443343, 0.04665039852261543, 0.014774939976632595, -0.013259264640510082, -0.034154754132032394, 0.0453776940703392, -0...
8
{"_type": "Module", "_fields": {"body": [{"_type": "ClassDef", "_fields": {"body": [{"_type": "Assign", "_fields": {"value": {"_type": "Constant", "_fields": {"kind": null, "value": "iscsiname"}}, "targets": [{"_type": "Name", "_fields": {"id": "command", "ctx": {"_type": "Store", "_fields": {}}}}], "type_comment": nul...
class FC6_TestCase(CommandTest): command = "iscsiname" def runTest(self): #pass self.assert_parse("iscsiname foo", "iscsiname foo\n") #fail self.assert_parse_error("iscsiname", KickstartValueError) self.assert_parse_error("iscsiname --whatever") self.assert_pars...
13,137
[ 0.004530789330601692, 0.0017841935623437166, -0.001053017913363874, -0.051494766026735306, 0.020585406571626663, -0.03874606266617775, 0.01783568598330021, -0.015698404982686043, 0.05504440516233444, 0.011792550794780254, 0.00974275916814804, -0.038921043276786804, 0.01779819093644619, 0.0...
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 runTest(self): #pass self.assert_parse("iscsiname foo", "iscsiname foo\n") #fail self.assert_parse_error("iscsiname", KickstartValueError) self.assert_parse_error("iscsiname --whatever") self.assert_parse_error("iscsiname foo bar", KickstartValueError)
13,138
[ 0.003755922196432948, 0.006604586262255907, 0.016927028074860573, -0.0364425964653492, 0.009808540344238281, 0.027331946417689323, 0.003227745648473501, 0.005497477483004332, 0.06801264733076096, -0.02117781713604927, 0.05567900836467743, -0.02740808017551899, 0.012339980341494083, -0.0018...
7
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "session", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs":...
def test_payload(session): assert not document_hidden(session) response = minimize(session) value = assert_success(response) assert isinstance(value, dict) value = response.body["value"] assert "width" in value assert "height" in value assert "x" in value assert "y" in value as...
13,139
[ -0.016781551763415337, 0.022775821387767792, 0.02513028495013714, 0.006943262182176113, 0.012937531806528568, 0.012961557134985924, 0.021982992067933083, 0.025778962299227715, 0.05655515193939209, 0.03017556108534336, 0.05218258127570152, -0.02265569567680359, 0.0020376313477754593, 0.0079...
8
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "session", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs":...
def test_fully_exit_fullscreen(session): session.window.fullscreen() assert is_fullscreen(session) response = minimize(session) assert_success(response) assert not is_fullscreen(session) assert document_hidden(session)
13,140
[ -0.03397322818636894, -0.019604898989200592, 0.019011592492461205, -0.009821796789765358, 0.027704818174242973, 0.03170318529009819, 0.026698777452111244, 0.03884865716099739, 0.051204901188611984, -0.01533567439764738, 0.07986416667699814, -0.0287624504417181, 0.00746147008612752, 0.00071...
7
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "session", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs":...
def test_minimize_twice_is_idempotent(session): assert not document_hidden(session) first_response = minimize(session) assert_success(first_response) assert document_hidden(session) second_response = minimize(session) assert_success(second_response) assert document_hidden(session)
13,141
[ 0.0009276540949940681, -0.034253522753715515, 0.022307416424155235, 0.05840805172920227, 0.028897995129227638, -0.05215629190206528, 0.06321709603071213, -0.0007616599905304611, -0.029007291421294212, -0.014208545908331871, 0.005667023826390505, -0.022427642717957497, 0.023236436769366264, ...
13
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "rgb", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}...
def _rgb_to_6cube(rgb): # Converts an 888 RGB color to a 3-tuple (nice in that it's hashable) # representing the closest xterm 256-color 6x6x6 color cube color. # # The xterm 256-color extension uses a RGB color palette with components in # the range 0-5 (a 6x6x6 cube). The catch is that the mapping...
13,142
[ 0.0044625322334468365, -0.03929103910923004, 0.00330538721755147, 0.04416868835687637, 0.02646385319530964, -0.0282488651573658, 0.03181889280676842, 0.002254616469144821, -0.020288953557610512, -0.014498040080070496, 0.014892403036355972, 0.014695221558213234, 0.007627816405147314, -0.005...
9
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "rgb", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}...
def _rgb_to_gray(rgb): # Converts an 888 RGB color to the index of an xterm 256-color grayscale # color with approx. the same perceived brightness # Calculate the luminance (gray intensity) of the color. See # https://stackoverflow.com/questions/596216/formula-to-determine-brightness-of-rgb-color ...
13,143
[ 0.02093346230685711, 0.013121813535690308, 0.04476337879896164, 0.026901911944150925, 0.01617186702787876, -0.008552218787372112, 0.04902028664946556, 0.017027636989951134, -0.029074251651763916, 0.012617128901183605, 0.024005457758903503, 0.004111538175493479, 0.042218007147312164, -0.003...
12
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "rgb", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "rgb2index", "annotation": null, "type_comment": null}}], "kwarg": ...
def _alloc_rgb(rgb, rgb2index={}): # Initialize a new entry in the xterm palette to the given RGB color, # returning its index. If the color has already been initialized, the index # of the existing entry is returned. # # ncurses is palette-based, so we need to overwrite palette entries to make ...
13,144
[ -0.005850734189152718, -0.036011163145303726, -0.019506046548485756, -0.008193186484277248, 0.022971147671341896, -0.005413548555225134, 0.04250957816839218, -0.0014869716251268983, 0.0015584866050630808, 0.0154796177521348, 0.012208820320665836, 0.03169327601790428, 0.025389164686203003, ...
11
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "num", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}...
def _color_from_num(num): # Returns the index of a color that looks like color 'num' in the xterm # 256-color palette (but that might not be 'num', if we're redefining # colors) # - _alloc_rgb() won't touch the first 16 colors or any (hypothetical) # colors above 255, so we can always return them...
13,145
[ 0.014547241851687431, -0.03436288610100746, 0.03769595921039581, 0.03225552663207054, 0.02627750113606453, -0.007811212912201881, 0.04081398993730545, -0.00792948342859745, -0.0602533221244812, 0.03883565217256546, 0.014805286191403866, 0.0005332241416908801, 0.01136469654738903, 0.0054216...
13
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "rgb", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}...
def _color_from_rgb(rgb): # Returns the index of a color matching the 888 RGB color 'rgb'. The # returned color might be an ~exact match or an approximation, depending on # terminal capabilities. # Calculates the Euclidean distance between two RGB colors def dist(r1, r2): return sum((x - y)**2 for ...
13,146
[ -0.00533174118027091, 0.009460637345910072, 0.01598214916884899, -0.028366222977638245, 0.00649536307901144, -0.023513006046414375, 0.024768147617578506, -0.04673314467072487, 0.00711770448833704, 0.03870023041963577, -0.0029966530855745077, 0.03897218033671379, 0.006772540509700775, -0.00...
13
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "style_def", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs...
def _style_to_curses(style_def): # Parses a style definition string (<element>=<style>), returning # a (fg_color, bg_color, attributes) tuple. def parse_color(color_def): color_def = color_def.split(":", 1)[1] # HTML format, #RRGGBB if re.match("#[A-Fa-f0-9]{6}", color_def): ...
13,147
[ 0.012323321774601936, 0.05597640201449394, -0.011322982609272003, -0.054145991802215576, -0.0031686259899288416, 0.025540562346577644, 0.019432110711932182, -0.05125139653682709, -0.031010499224066734, 0.03284090757369995, -0.036054760217666626, 0.016505587846040726, 0.005677454173564911, ...
10
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "style_str", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "parsing_default", "annotation": null, "type_comment": null}}...
def _parse_style(style_str, parsing_default): # Parses a string with '<element>=<style>' assignments. Anything not # containing '=' is assumed to be a reference to a built-in style, which is # treated as if all the assignments from the style were inserted at that # point in the string. # # The p...
13,148
[ -0.009921401739120483, 0.03662155196070671, 0.026301825419068336, -0.003692182945087552, -0.010307472199201584, 0.00337352161295712, 0.06745817512273788, 0.0004163281118962914, -0.008487424813210964, 0.04468613862991333, 0.0005335281020961702, 0.01938932202756405, -0.008089098148047924, 0....
10
{"_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": "Try", "_fields": {"body":...
def _init_styles(): if curses.has_colors(): try: curses.use_default_colors() except curses.error: # Ignore errors on funky terminals that support colors but not # using default colors. Worst it can do is break transparency and # the like. Ran across th...
13,149
[ 0.002197826746851206, -0.04653108865022659, 0.019706761464476585, 0.008707897737622261, 0.04014752432703972, -0.04237176105380058, 0.020040398463606834, -0.04074806720018387, 0.02686881273984909, 0.013890375383198261, 0.005371538456529379, 0.027180206030607224, 0.0030611096881330013, 0.006...
10
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "color_def", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs...
def parse_color(color_def): color_def = color_def.split(":", 1)[1] # HTML format, #RRGGBB if re.match("#[A-Fa-f0-9]{6}", color_def): return _color_from_rgb(( int(color_def[1:3], 16), int(color_def[3:5], 16), int(color_def[5:7], 16))) ...
13,150
[ 0.04043830558657646, 0.04848317429423332, 0.03382696211338043, -0.056784793734550476, 0.0480552576482296, 0.041486706584692, -0.010938668623566628, -0.025225799530744553, 0.0027600747998803854, 0.043497923761606216, -0.011853344738483429, -0.01675301231443882, 0.058111343532800674, 0.03864...
9
{"_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 _load_config(): # Loads any existing .config file. See the Kconfig.load_config() docstring. # # Returns True if .config is missing or outdated. We always prompt for # saving the configuration in that case. print(_kconf.load_config()) if not os.path.exists(_conf_filename): # No .conf...
13,151
[ 0.011023302562534809, -0.003006120678037405, 0.024007679894566536, -0.011043945327401161, -0.004654971417039633, -0.020064888522028923, 0.07105282694101334, -0.02510175295174122, 0.010847837664186954, 0.011178124696016312, 0.008148780092597008, -0.015575059689581394, 0.023863179609179497, ...
9
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "fg_color", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "bg_color", "annotation": null, "type_comment": null}}, {"_typ...
def _style_attr(fg_color, bg_color, attribs, color_attribs={}): # Returns an attribute with the specified foreground and background color # and the attributes in 'attribs'. Reuses color pairs already created if # possible, and creates a new color pair otherwise. # # Returns 'attribs' if colors aren'...
13,152
[ 0.0025210243184119463, 0.05724494531750679, 0.03158341720700264, -0.03153147175908089, -0.01919419877231121, 0.025492701679468155, 0.008149093948304653, -0.0001408234820701182, -0.049634795635938644, 0.04527129977941513, 0.0055290465243160725, -0.030284758657217026, 0.006590701173990965, 0...
29
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "stdscr", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": ...
def _menuconfig(stdscr): # Logic for the main display, with the list of symbols, etc. global _stdscr global _conf_filename global _conf_changed global _minconf_filename global _show_help global _show_name _stdscr = stdscr _init() while True: _draw_main() curse...
13,153
[ 0.045374128967523575, 0.036578528583049774, 0.0205230675637722, -0.046025656163692474, 0.04076690971851349, 0.0364854522049427, -0.0052994657307863235, -0.024944135919213295, 0.010645468719303608, 0.054821256548166275, -0.012960712425410748, -0.03413530811667442, 0.007254043594002724, 0.05...
10
{"_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": "Return", "_fields": {"val...
def _needs_save(): # Returns True if a just-loaded .config file is outdated (would get # modified when saving) if _kconf.missing_syms: # Assignments to undefined symbols in the .config return True for sym in _kconf.unique_defined_syms: if sym.user_value is None: if ...
13,154
[ 0.01637505181133747, 0.039593782275915146, 0.037204716354608536, 0.012915884144604206, -0.023840881884098053, 0.006408170331269503, 0.04900072515010834, 0.016487039625644684, -0.02635437808930874, 0.05753665789961815, 0.02670278213918209, 0.0070116580463945866, -0.04248056933283806, 0.0135...
8
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}}, "body": [{"_type": "Global", "_fields": {"names": ["_ERASE_CHAR"]}}, {"_type": "Gl...
def _init(): # Initializes the main display with the list of symbols, etc. Also does # misc. global initialization that needs to happen after initializing # curses. global _ERASE_CHAR global _path_win global _top_sep_win global _menu_win global _bot_sep_win global _help_win gl...
13,155
[ 0.034209638833999634, 0.04091956466436386, 0.0038114595226943493, -0.023935746401548386, -0.02417774312198162, 0.05565940961241722, 0.025233732536435127, 0.04133756086230278, 0.01143987849354744, 0.01519083883613348, -0.008876905776560307, -0.05051146447658539, 0.00851390976458788, 0.03546...
9
{"_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": "Return", "_fields": {"val...
def _quit_dialog(): if not _conf_changed: return "No changes to save (for '{}')".format(_conf_filename) while True: c = _key_dialog( "Quit", " Save configuration?\n" "\n" "(Y)es (N)o (C)ancel", "ync") if c is None or c == "c...
13,156
[ 0.002253658836707473, 0.04898519068956375, 0.019634472206234932, -0.0008790066931396723, 0.062337055802345276, 0.013288082554936409, -0.0002626057539600879, 0.011438381858170033, 0.004177773371338844, 0.03826967999339104, 0.008350231684744358, -0.023195678368210793, 0.015977591276168823, 0...
7
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "menu", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []...
def _enter_menu(menu): # Makes 'menu' the currently displayed menu. In addition to actual 'menu's, # "menu" here includes choices and symbols defined with the 'menuconfig' # keyword. # # Returns False if 'menu' can't be entered. global _cur_menu global _shown global _sel_node_i glob...
13,157
[ 0.015208780765533447, 0.05348881334066391, 0.06981394439935684, 0.00029765604995191097, -0.04172511398792267, -0.015688931569457054, 0.04033267870545387, 0.001800565980374813, -0.0706782117486, 0.034402813762426376, -0.00024326395941898227, -0.0005112857325002551, -0.05368087440729141, 0.0...
9
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}}, "body": [{"_type": "Global", "_fields": {"names": ["_menu_scroll"]}}, {"_type": "A...
def _resize_main(): # Resizes the main display, with the list of symbols, etc., to fill the # terminal global _menu_scroll screen_height, screen_width = _stdscr.getmaxyx() _path_win.resize(1, screen_width) _top_sep_win.resize(1, screen_width) _bot_sep_win.resize(1, screen_width) help...
13,158
[ -0.025806786492466927, 0.049221184104681015, 0.02915170043706894, -0.040050361305475235, 0.024012494832277298, -0.024610592052340508, 0.017267286777496338, 0.009885217994451523, -0.019593222066760063, 0.03313901647925377, 0.012681875377893448, 0.00017496419604867697, -0.0001001155178528279, ...
9
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "node", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []...
def _jump_to(node): # Jumps directly to the menu node 'node' global _cur_menu global _shown global _sel_node_i global _menu_scroll global _show_all global _parent_screen_rows # Clear remembered menu locations. We might not even have been in the # parent menus before. _parent_sc...
13,159
[ 0.01328294724225998, 0.027813009917736053, 0.012129954993724823, 0.015177150256931782, 0.011912297457456589, 0.008247427642345428, 0.034848619252443314, 0.0015735998749732971, -0.026354121044278145, -0.019118502736091614, 0.0013044701190665364, -0.019565582275390625, -0.0030824909918010235, ...
10
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}}, "body": [{"_type": "Global", "_fields": {"names": ["_sel_node_i"]}}, {"_type": "As...
def _select_selected_choice_sym(): # Puts the cursor on the currently selected (y-valued) choice symbol, if # any. Does nothing if if the choice has no selection (is not visible/in y # mode). global _sel_node_i choice = _cur_menu.item if choice.selection: # Search through all menu node...
13,160
[ 0.020170819014310837, 0.02876424230635166, 0.04190216213464737, -0.03146352618932724, -0.0034848174545913935, 0.02669760212302208, 0.033087313175201416, 0.023239145055413246, -0.041332781314849854, -0.006115564610809088, 0.012315481901168823, -0.0325179323554039, -0.08907636255025864, 0.01...
11
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}}, "body": [{"_type": "Global", "_fields": {"names": ["_sel_node_i"]}}, {"_type": "Gl...
def _select_next_menu_entry(): # Selects the menu entry after the current one, adjusting the scroll if # necessary. Does nothing if we're already at the last menu entry. global _sel_node_i global _menu_scroll if _sel_node_i < len(_shown) - 1: # Jump to the next node _sel_node_i += ...
13,161
[ -0.006606965325772762, 0.0671205073595047, 0.047444939613342285, -0.03241996467113495, 0.017160221934318542, 0.006942343898117542, 0.003141382709145546, 0.016489464789628983, -0.016489464789628983, 0.011240784078836441, 0.004211800638586283, -0.011095453053712845, -0.003812140552327037, 0....
9
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}}, "body": [{"_type": "Global", "_fields": {"names": ["_cur_menu"]}}, {"_type": "Glob...
def _leave_menu(): # Jumps to the parent menu of the current menu. Does nothing if we're in # the top menu. global _cur_menu global _shown global _sel_node_i global _menu_scroll if _cur_menu is _kconf.top_node: return # Jump to parent menu parent = _parent_menu(_cur_menu) ...
13,162
[ 0.027721211314201355, 0.03373559191823006, 0.03811931237578392, -0.0250316821038723, 0.016010111197829247, 0.011033423244953156, -0.014898297376930714, 0.02363397367298603, -0.06814885884523392, -0.009429235011339188, 0.03388383239507675, -0.030897820368409157, -0.07369733601808548, 0.0127...
7
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}}, "body": [{"_type": "Global", "_fields": {"names": ["_sel_node_i"]}}, {"_type": "Gl...
def _select_last_menu_entry(): # Selects the last menu entry in the current menu global _sel_node_i global _menu_scroll _sel_node_i = len(_shown) - 1 _menu_scroll = _max_scroll(_shown, _menu_win)
13,163
[ 0.018822524696588516, 0.027908191084861755, 0.029872100800275803, -0.02937595546245575, -0.004243078641593456, 0.024827953428030014, 0.03650804981589317, 0.012465658597648144, -0.0383685939013958, -0.028528373688459396, 0.01568026840686798, -0.04725787043571472, -0.047671325504779816, 0.03...
9
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}}, "body": [{"_type": "Global", "_fields": {"names": ["_sel_node_i"]}}, {"_type": "Gl...
def _select_prev_menu_entry(): # Selects the menu entry before the current one, adjusting the scroll if # necessary. Does nothing if we're already at the first menu entry. global _sel_node_i global _menu_scroll if _sel_node_i > 0: # Jump to the previous node _sel_node_i -= 1 ...
13,164
[ -0.012612022459506989, 0.05450713261961937, -0.012957710772752762, -0.011898345313966274, -0.013860958628356457, -0.015277163125574589, 0.02682982012629509, -0.004987380467355251, -0.030755048617720604, -0.0004530180594883859, 0.03900694474577904, -0.0010537897469475865, -0.00003391101563465...
10
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}}, "body": [{"_type": "Global", "_fields": {"names": ["_show_all"]}}, {"_type": "Glob...
def _toggle_show_all(): # Toggles show-all mode on/off. If turning it off would give no visible # items in the current menu, it is left on. global _show_all global _shown global _sel_node_i global _menu_scroll # Row on the screen the cursor is on. Preferably we want the same row to # s...
13,165
[ -0.01047658734023571, 0.043005019426345825, 0.010140260681509972, -0.02374468930065632, 0.01533651351928711, -0.01586342602968216, 0.011726602911949158, -0.016939671710133553, -0.017219945788383484, 0.05340873450040817, 0.020740168169140816, -0.0011764439987018704, 0.026412883773446083, -0...
12
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "menu", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []...
def _shown_nodes(menu): # Returns the list of menu nodes from 'menu' (see _parent_menu()) that # would be shown when entering it def rec(node): res = [] while node: if _visible(node) or _show_all: res.append(node) if node.list and not node.is_men...
13,166
[ 0.019216524437069893, 0.033012017607688904, 0.02566038817167282, -0.027079572901129723, 0.0085087139159441, 0.009787257760763168, -0.0009676983463577926, 0.008943418972194195, -0.008745244704186916, 0.04559289664030075, 0.03618280962109566, -0.012689554132521152, 0.025174541398882866, -0.0...
11
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "node", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []...
def rec(node): res = [] while node: if _visible(node) or _show_all: res.append(node) if node.list and not node.is_menuconfig: # Nodes from implicit menu created from dependencies. Will # be shown indented. Note that is_...
13,167
[ 0.03054315596818924, 0.036368172615766525, -0.04494207352399826, -0.018205903470516205, 0.031110387295484543, 0.005121432710438967, 0.029823211953043938, -0.02423817664384842, 0.0056177591904997826, 0.034164704382419586, 0.04607653245329857, 0.0126535939052701, -0.016176965087652206, 0.023...
10
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "node", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []...
def _changeable(node): # Returns True if the value if 'node' can be changed sc = node.item if not isinstance(sc, (Symbol, Choice)): return False # This will hit for invisible symbols, which appear in show-all mode and # when an invisible symbol has visible children (which can happen e.g. ...
13,168
[ -0.00935456994920969, 0.04512466490268707, -0.04554784670472145, -0.03637146204710007, 0.009632980450987816, -0.0022829605732113123, 0.032919179648160934, -0.01096377894282341, 0.009237637743353844, 0.029578261077404022, 0.04024692624807358, 0.016225725412368774, 0.015145494602620602, 0.02...
12
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "node", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []...
def _change_node(node): # Changes the value of the menu node 'node' if it is a symbol. Bools and # tristates are toggled, while other symbol types pop up a text entry # dialog. # # Returns False if the value of 'node' can't be changed. if not _changeable(node): return False # sc = ...
13,169
[ 0.004778428003191948, 0.05845213681459427, 0.003191287163645029, -0.028568537905812263, 0.0007588518201373518, 0.015395267866551876, 0.03990526124835014, 0.007504909764975309, -0.0030410755425691605, 0.021902546286582947, 0.0406988300383091, -0.01034475862979889, -0.03577869385480881, 0.00...
7
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}}, "body": [{"_type": "Global", "_fields": {"names": ["_shown"]}}, {"_type": "Global"...
def _update_menu(): # Updates the current menu after the value of a symbol or choice has been # changed. Changing a value might change which items in the menu are # visible. # # If possible, preserves the location of the cursor on the screen when # items are added/removed above the selected item...
13,170
[ 0.002749765757471323, 0.008236346766352654, -0.034856267273426056, -0.013709977269172668, 0.025670235976576805, 0.016564784571528435, 0.027627158910036087, -0.022113237529993057, 0.04203932732343674, 0.0008683849009685218, 0.029192697256803513, -0.014343099668622017, 0.01015298068523407, 0...
8
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "sc", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "val", "annotation": null, "type_comment": null}}], "kwarg": null, "...
def _set_val(sc, val): # Wrapper around Symbol/Choice.set_value() for updating the menu state and # _conf_changed global _conf_changed # Use the string representation of tristate values. This makes the format # consistent for all symbol types. if val in TRI_TO_STR: val = TRI_TO_STR[val...
13,171
[ 0.017805326730012894, 0.04031984508037567, 0.01814914122223854, 0.017086446285247803, -0.023337585851550102, -0.01992029696702957, 0.02111843042075634, 0.049425672739744186, -0.0624697171151638, 0.02952621318399906, -0.03498554229736328, 0.0030838951934129, -0.016628030687570572, 0.0622613...
10
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "win", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "title", "annotation": null, "type_comment": null}}, {"_type": "arg...
def _resize_input_dialog(win, title, info_lines): # Resizes the input dialog to a size appropriate for the terminal size screen_height, screen_width = _stdscr.getmaxyx() win_height = 5 if info_lines: win_height += len(info_lines) + 1 win_height = min(win_height, screen_height) win_wid...
13,172
[ 0.04419980198144913, 0.04542500525712967, -0.0014794912422075868, 0.014008932746946812, -0.01599700003862381, -0.007553496398031712, 0.025590574368834496, 0.035114798694849014, -0.04484707862138748, 0.06398800015449524, 0.022562241181731224, -0.01010793074965477, -0.004918152466416359, 0.0...
10
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "win", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "title", "annotation": null, "type_comment": null}}, {"_type": "arg...
def _draw_input_dialog(win, title, info_lines, s, i, hscroll): edit_width = _width(win) - 4 win.erase() # Note: Perhaps having a separate window for the input field would be nicer visible_s = s[hscroll:hscroll + edit_width] _safe_addstr(win, 2, 2, visible_s + " "*(edit_width - len(visible_s)), ...
13,173
[ 0.05416585132479668, 0.044666945934295654, -0.024564610794186592, -0.03998376429080963, -0.020687730982899666, 0.017650291323661804, 0.03598538786172867, 0.014502397738397121, 0.00857110507786274, 0.05191262066364288, -0.003070576349273324, -0.009752945974469185, 0.010470885783433914, 0.02...
9
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}}, "body": [{"_type": "Global", "_fields": {"names": ["_conf_changed"]}}, {"_type": "...
def _load_dialog(): # Dialog for loading a new configuration global _conf_changed global _conf_filename global _show_all if _conf_changed: c = _key_dialog( "Load", "You have unsaved changes. Load new\n" "configuration anyway?\n" "\n" ...
13,174
[ -0.0015789764001965523, 0.04814013093709946, 0.002789487363770604, -0.034052543342113495, 0.01627577655017376, 0.013328053057193756, 0.04246169328689575, 0.032533470541238785, 0.01868097484111786, 0.004577562212944031, -0.05219099298119545, -0.028410272672772408, 0.03412488102912903, -0.00...
9
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "save_fn", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "default_filename", "annotation": null, "type_comment": null}},...
def _save_dialog(save_fn, default_filename, description): # Dialog for saving the current configuration # # save_fn: # Function to call with 'filename' to save the file # # default_filename: # Prefilled filename in the input field # # description: # String describing the th...
13,175
[ 0.027382221072912216, 0.04712379723787308, 0.03341329097747803, -0.030814696103334427, 0.03219156339764595, 0.015814591199159622, 0.007068569306284189, -0.01914040558040142, 0.030038995668292046, 0.047511644661426544, 0.004149996675550938, -0.033646002411842346, 0.043322864919900894, 0.041...
11
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "filename", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs"...
def _try_load(filename): # Tries to load a configuration file. Pops up an error and returns False on # failure. # # filename: # Configuration file to load try: _kconf.load_config(filename) return True except EnvironmentError as e: _error("Error loading '{}'\n\n{} (...
13,176
[ 0.026280850172042847, 0.0688830316066742, -0.009899193421006203, 0.024986550211906433, -0.005742080509662628, 0.01839440129697323, 0.02974693849682808, 0.07875479757785797, 0.020621033385396004, 0.0114293172955513, -0.017516911029815674, -0.017462067306041718, -0.001425922499038279, 0.0576...
11
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "title", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "text", "annotation": null, "type_comment": null}}, {"_type": "ar...
def _key_dialog(title, text, keys): # Pops up a dialog that can be closed by pressing a key # # title: # Title to display at the top of the dialog window's border # # text: # Text to show in the dialog # # keys: # List of keys that will close the dialog. Other keys (besides...
13,177
[ 0.02994518168270588, 0.023511717095971107, 0.040607888251543045, -0.0605713427066803, 0.017786111682653427, 0.008583927527070045, 0.007333971094340086, 0.01835060864686966, 0.03960433974862099, 0.01888822391629219, -0.021361254155635834, -0.04437119886279106, 0.0064065842889249325, -0.0253...
11
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "save_fn", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "filename", "annotation": null, "type_comment": null}}, {"_type...
def _try_save(save_fn, filename, description): # Tries to save a configuration file. Returns a message to print on # success. # # save_fn: # Function to call with 'filename' to save the file # # description: # String describing the thing being saved # # Return value: # ...
13,178
[ 0.009857693687081337, 0.054107554256916046, 0.03784183785319328, 0.013934576883912086, -0.01547124795615673, -0.013683691620826721, 0.03152789548039436, 0.05398211255669594, -0.06794805079698563, 0.028872692957520485, -0.030461633577942848, 0.00624076696112752, -0.042734093964099884, 0.073...
10
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "win", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "text", "annotation": null, "type_comment": null}}], "kwarg": null,...
def _resize_key_dialog(win, text): # Resizes the key dialog to a size appropriate for the terminal size screen_height, screen_width = _stdscr.getmaxyx() lines = text.split("\n") win_height = min(len(lines) + 4, screen_height) win_width = min(max(len(line) for line in lines) + 4, screen_width) ...
13,179
[ 0.045423854142427444, 0.06327980756759644, 0.006833469960838556, -0.003036447800695896, -0.03068040870130062, 0.016089078038930893, 0.028035949915647507, 0.048817187547683716, -0.03299723565578461, 0.05101700499653816, 0.01818358339369297, 0.0019160629017278552, -0.0043294248171150684, 0.0...
8
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "win", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "title", "annotation": null, "type_comment": null}}, {"_type": "arg...
def _draw_key_dialog(win, title, text): win.erase() for i, line in enumerate(text.split("\n")): _safe_addstr(win, 2 + i, 2, line) # Draw the frame last so that it overwrites the body text for small windows _draw_frame(win, title) win.noutrefresh()
13,180
[ 0.025770483538508415, 0.015794117003679276, 0.03182525560259819, -0.006410300265997648, -0.021859662607312202, 0.030273854732513428, 0.03354903310537338, -0.03471258282661438, -0.05645373463630676, 0.023055532947182655, 0.010111036710441113, -0.054169729351997375, -0.04089663550257683, 0.0...
9
{"_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": "Return", "_fields": {"val...
def select_prev_match(): if sel_node_i == 0: return sel_node_i, scroll if sel_node_i - 1 < scroll + _SCROLL_OFFSET: return sel_node_i - 1, max(scroll - 1, 0) return sel_node_i - 1, scroll
13,181
[ 0.01580425351858139, 0.019588526338338852, 0.069735586643219, -0.008602107875049114, -0.02716800570487976, 0.014808968640863895, 0.027299251407384872, -0.04000827670097351, -0.056129712611436844, 0.02323061227798462, -0.01008409820497036, -0.07047931849956512, -0.04593624174594879, 0.01796...
10
{"_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": "Return", "_fields": {"val...
def select_next_match(): if sel_node_i == len(matches) - 1: return sel_node_i, scroll if sel_node_i + 1 >= scroll + _height(matches_win) - _SCROLL_OFFSET \ and scroll < _max_scroll(matches, matches_win): return sel_node_i + 1, scroll + 1 return sel_node_i + ...
13,182
[ 0.007643607910722494, 0.0403968021273613, -0.03840772062540054, -0.04970651865005493, 0.013000797480344772, 0.032768573611974716, -0.0013316076947376132, 0.03568042442202568, 0.02671930566430092, 0.011954992078244686, -0.01376977190375328, -0.013164845295250416, 0.027108918875455856, 0.013...
9
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "cached_nodes", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [{"_type": "List", "_fields": {"ctx": {"_type": "L...
def _sorted_menu_comment_nodes(cached_nodes=[]): # Returns a list of menu and comment nodes to search, sorted by prompt, # with the menus first if not cached_nodes: def prompt_text(mc): return mc.prompt[0] cached_nodes += sorted(_kconf.menus, key=prompt_text) cached_nod...
13,183
[ 0.03434797376394272, 0.021514302119612694, -0.012624368071556091, -0.020710133016109467, 0.018110349774360657, 0.0021371094044297934, -0.0028669212479144335, -0.0030872419010847807, -0.007931539788842201, 0.04203716292977333, -0.02555718459188938, -0.05054153501987457, 0.006730793043971062, ...
12
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "cached_nodes", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [{"_type": "List", "_fields": {"ctx": {"_type": "L...
def _sorted_sc_nodes(cached_nodes=[]): # Returns a sorted list of symbol and choice nodes to search. The symbol # nodes appear first, sorted by name, and then the choice nodes, sorted by # prompt and (secondarily) name. if not cached_nodes: # Add symbol nodes for sym in sorted(_kconf.un...
13,184
[ -0.011837315745651722, 0.03797619789838791, 0.05343666300177574, -0.021535128355026245, -0.04487864673137665, 0.007596513256430626, -0.011588980443775654, -0.011569878086447716, -0.053793247789144516, 0.05323290079832077, 0.013461046852171421, -0.015333113260567188, -0.005928209517151117, ...
12
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "edit_box", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "matches_win", "annotation": null, "type_comment": null}}, {"_...
def _draw_jump_to_dialog(edit_box, matches_win, bot_sep_win, help_win, s, s_i, hscroll, bad_re, matches, sel_node_i, scroll): edit_width = _width(edit_box) - 2 # # Update list of matches # matches_win.erase() if matches: for i in rang...
13,185
[ 0.011857970617711544, 0.04582635313272476, 0.0475236251950264, -0.012075863778591156, -0.023555388674139977, -0.0029186203610152006, -0.007953097112476826, 0.03245459869503975, -0.08266174793243408, 0.01353230606764555, -0.009828124195337296, 0.009845326654613018, -0.031995877623558044, 0....
9
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "edit_box", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "matches_win", "annotation": null, "type_comment": null}}, {"_...
def _resize_jump_to_dialog(edit_box, matches_win, bot_sep_win, help_win, sel_node_i, scroll): # Resizes the jump-to dialog to fill the terminal. # # Returns the new scroll index. We adjust the scroll if needed so that the # selected node stays visible. screen_height, scre...
13,186
[ 0.013052545487880707, 0.0597214438021183, 0.05142679810523987, 0.012522609904408455, -0.030551942065358162, -0.02907733805477619, 0.02173888124525547, 0.03308641538023949, -0.0947432741522789, 0.04377729445695877, -0.016393443569540977, 0.02527562715113163, -0.02380102314054966, 0.05769386...
9
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "top_line_win", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "text_win", "annotation": null, "type_comment": null}}, {"...
def _resize_info_dialog(top_line_win, text_win, bot_sep_win, help_win): # Resizes the info dialog to fill the terminal screen_height, screen_width = _stdscr.getmaxyx() top_line_win.resize(1, screen_width) bot_sep_win.resize(1, screen_width) help_win_height = len(_INFO_HELP_LINES) text_win_hei...
13,187
[ 0.0031881234608590603, 0.04898277670145035, -0.004708522465080023, -0.008485947735607624, -0.000015192940736596938, -0.01256391778588295, 0.0446455143392086, 0.019175885245203972, -0.04389121010899544, 0.06831187754869461, -0.003995466977357864, 0.016653673723340034, -0.014685404486954212, ...
17
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "node", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "from_jump_to_dialog", "annotation": null, "type_comment": null}}]...
def _info_dialog(node, from_jump_to_dialog): # Shows a fullscreen window with information about 'node'. # # If 'from_jump_to_dialog' is True, the information dialog was opened from # within the jump-to-dialog. In this case, we make '/' from within the # information dialog just return, to avoid a con...
13,188
[ -0.015589164569973946, 0.030027523636817932, -0.021716143935918808, -0.062228791415691376, 0.005530264228582382, -0.02821606770157814, 0.015535886399447918, -0.013884265907108784, 0.010852743871510029, 0.06687463819980621, -0.007549503352493048, 0.0032206596806645393, 0.016697349026799202, ...
16
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "node", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []...
def _info_str(node): # Returns information about the menu node 'node' as a string. # # The helper functions are responsible for adding newlines. This allows # them to return "" if they don't want to add any output. if isinstance(node.item, Symbol): sym = node.item return ( ...
13,189
[ -0.0002650967799127102, 0.044444307684898376, 0.044776514172554016, -0.016645852476358414, -0.04669855907559395, 0.012789899483323097, 0.03860699012875557, -0.010879719629883766, -0.059654559940099716, 0.05229858681559563, -0.010678024031221867, 0.008910217322409153, -0.005172909237444401, ...
11
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "node", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "lines", "annotation": null, "type_comment": null}}, {"_type": "ar...
def _draw_info_dialog(node, lines, scroll, top_line_win, text_win, bot_sep_win, help_win): text_win_height, text_win_width = text_win.getmaxyx() # Note: The top row is deliberately updated last. See _draw_main(). # # Update text display # text_win.erase() for i, li...
13,190
[ 0.03953397274017334, -0.02058887667953968, -0.02127552032470703, 0.00004234621883369982, 0.0023863434325903654, -0.011007091030478477, 0.005789646413177252, -0.03697466850280762, 0.0238244216889143, 0.034373749047517776, -0.010923861525952816, -0.033915989100933075, -0.011818577535450459, ...
8
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "choice", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": ...
def _choice_syms_info(choice): # Returns a string listing the choice symbols in 'choice'. Adds # "(selected)" next to the selected one. s = "Choice symbols:\n" for sym in choice.syms: s += " - " + sym.name if sym is choice.selection: s += " (selected)" s += "\n" ...
13,191
[ 0.027695249766111374, 0.01907181926071644, 0.020385388284921646, -0.022781899198889732, -0.00750539219006896, 0.01781841367483139, 0.01891138218343258, -0.0011919887037947774, 0.032047074288129807, 0.0380634181201458, -0.013386371545493603, -0.020435523241758347, -0.0066480631940066814, -0...
10
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "sc", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}}...
def _prompt_info(sc): # Returns a string listing the prompts of 'sc' (Symbol or Choice) s = "" for node in sc.nodes: if node.prompt: s += "Prompt: {}\n".format(node.prompt[0]) return s
13,192
[ 0.0323474258184433, 0.01771942898631096, 0.05499062314629555, 0.014433503150939941, 0.000610352901276201, -0.01771942898631096, -0.015620940364897251, -0.051837772130966187, -0.02087227813899517, 0.036462508141994476, -0.010159753262996674, 0.000533898884896189, -0.06305700540542603, -0.03...
10
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "sc", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}}...
def _help_info(sc): # Returns a string with the help text(s) of 'sc' (Symbol or Choice). # Symbols and choices defined in multiple locations can have multiple help # texts. s = "\n" for node in sc.nodes: if node.help is not None: s += "Help:\n\n{}\n\n".format(_indent(node.help,...
13,193
[ -0.006077065132558346, 0.027729423716664314, 0.06761297583580017, -0.02644648775458336, 0.02307034097611904, 0.01784856617450714, 0.03508942574262619, -0.02511853724718094, -0.04375487193465233, 0.03970349207520485, -0.013684650883078575, -0.017792297527194023, 0.01888391748070717, -0.0482...
10
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "sc", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}}...
def _direct_dep_info(sc): # Returns a string describing the direct dependencies of 'sc' (Symbol or # Choice). The direct dependencies are the OR of the dependencies from each # definition location. The dependencies at each definition location come # from 'depends on' and dependencies inherited from pare...
13,194
[ 0.02549237757921219, 0.027675548568367958, 0.040223266929388046, -0.030189502984285355, 0.030013086274266243, 0.016296599060297012, 0.025338012725114822, -0.026374468579888344, 0.014653706923127174, 0.01904210075736046, -0.052131474018096924, -0.05032318830490112, 0.004630968440324068, 0.0...
11
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "sc", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}}...
def _defaults_info(sc): # Returns a string describing the defaults of 'sc' (Symbol or Choice) if not sc.defaults: return "" s = "Default" if len(sc.defaults) > 1: s += "s" s += ":\n" for val, cond in sc.orig_defaults: s += " - " if isinstance(sc, Symbol): ...
13,195
[ 0.01932828314602375, 0.05672871693968773, -0.045423492789268494, -0.046274423599243164, 0.0021159304305911064, 0.0032036530319601297, 0.021090926602482796, 0.0015220517525449395, -0.004596545360982418, 0.0668993666768074, 0.003033973276615143, 0.006295874249190092, 0.040743373334407806, -0...
10
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "expr", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "indent", "annotation": null, "type_comment": null}}], "kwarg": nu...
def _split_expr_info(expr, indent): # Returns a string with 'expr' split into its top-level && or || operands, # with one operand per line, together with the operand's value. This is # usually enough to get something readable for long expressions. A fancier # recursive thingy would be possible too. ...
13,196
[ 0.05872170627117157, 0.020891375839710236, -0.005066342651844025, -0.05214251950383186, -0.02203291468322277, 0.01746676117181778, 0.019442971795797348, -0.02747056446969509, -0.005345589946955442, 0.036259181797504425, 0.0006731853354722261, -0.0325031504034996, 0.011765208095312119, 0.00...
11
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "sym", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}...
def _select_imply_info(sym): # Returns a string with information about which symbols 'select' or 'imply' # 'sym'. The selecting/implying symbols are grouped according to which # value they select/imply 'sym' to (n/m/y). def sis(expr, val, title): # sis = selects/implies sis = [si for si...
13,197
[ 0.043436694890260696, 0.011699502356350422, -0.02684316784143448, -0.056574225425720215, -0.037708260118961334, -0.006373477168381214, 0.010220050811767578, -0.0027059167623519897, 0.012462899088859558, 0.03406289219856262, 0.022298293188214302, 0.004095121752470732, 0.02906826324760914, 0...
10
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "expr", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "val", "annotation": null, "type_comment": null}}, {"_type": "arg"...
def sis(expr, val, title): # sis = selects/implies sis = [si for si in split_expr(expr, OR) if expr_value(si) == val] if not sis: return "" res = title for si in sis: res += " - {}\n".format(split_expr(si, AND)[0].name) return res + "\n"
13,198
[ 0.004272574558854103, 0.016687175258994102, 0.02333870716392994, -0.0400577075779438, 0.00020222458988428116, -0.012730203568935394, -0.005638419184833765, -0.036747854202985764, 0.006699269637465477, 0.06594245135784149, 0.004832173231989145, 0.007038741838186979, 0.04103368893265724, -0....
10
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "item", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []...
def _kconfig_def_info(item): # Returns a string with the definition of 'item' in Kconfig syntax, # together with the definition location(s) and their include and menu paths nodes = [item] if isinstance(item, MenuNode) else item.nodes s = "Kconfig definition{}, with parent deps. propagated to 'depends ...
13,199
[ 0.018023598939180374, 0.009821539744734764, 0.0467555969953537, -0.07068423926830292, 0.01121517363935709, 0.007590623572468758, 0.026418454945087433, -0.02544897049665451, -0.033579420298337936, 0.07711809128522873, -0.0020615318790078163, 0.045301370322704315, 0.018023598939180374, 0.010...
10
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "node", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []...
def _include_path_info(node): if not node.include_path: # In the top-level Kconfig file return "" return "Included via {}\n".format( " -> ".join("{}:{}".format(filename, linenr) for filename, linenr in node.include_path))
13,200
[ -0.007485424168407917, 0.040896475315093994, 0.004675196949392557, -0.06993889808654785, 0.007485424168407917, -0.013805882073938847, 0.03033001907169819, 0.017597133293747902, 0.005426294170320034, 0.08167032152414322, 0.006049653515219688, 0.01681027002632618, -0.0055131553672254086, -0....
11
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "node", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []...
def _menu_path_info(node): # Returns a string describing the menu path leading up to 'node' path = "" while node.parent is not _kconf.top_node: node = node.parent # Promptless choices might appear among the parents. Use # standard_sc_expr_str() for them, so that they show up as ...