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 |
|---|---|---|---|---|---|
1 | [
-0.0035781562328338623,
0.011347530409693718,
-0.030228640884160995,
-0.03506239503622055,
-0.022754007950425148,
0.012485230341553688,
-0.002542141592130065,
0.024192344397306442,
0.02605510875582695,
0.01118247490376234,
0.00028037242009304464,
-0.043786730617284775,
0.019393960013985634,
... | 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": "parser", "annotation": null, "type_comment": null}}], "kwarg": nu... | def add_arguments(self, parser):
parser.add_argument(
"-D", "--debug", action="store_true",
help="print detailed information about exceptions"
)
parser.add_argument(
"-u", "--username", metavar="USER",
default=os.getenv("INSTAPAPER_USERNAME"),
... | |
2 | [
0.028776070103049278,
-0.0032603151630610228,
0.05966208502650261,
-0.04884300008416176,
0.001533358241431415,
0.015465454198420048,
0.006038036663085222,
-0.03479165956377983,
-0.01439925841987133,
0.03678937628865242,
-0.009371302090585232,
-0.008546402677893639,
0.045835208147764206,
-0... | 9 | {"_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": "Call", "_fields": {"arg... | class PerfTestFactory(object):
_pattern_map = [
(re.compile(r'^Dromaeo/'), SingleProcessPerfTest),
(re.compile(r'(.+)\.replay$'), ReplayPerfTest),
]
@classmethod
def create_perf_test(cls, port, test_name, path, test_runner_count=DEFAULT_TEST_RUNNER_COUNT):
for (pattern, test_cl... | |
3 | [
0.007252497132867575,
-0.012211017310619354,
-0.05698474869132042,
0.009605294093489647,
0.04599718376994133,
-0.03058636374771595,
0.018681209534406662,
0.05034985765814781,
-0.005743766203522682,
-0.03766828402876854,
-0.010993444360792637,
-0.022728020325303078,
0.0003904172917827964,
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": "username", "annotation": null, "type_comment": null}}], "kwarg": ... | def get_user(self, username):
try:
self.user = User.objects.get(username=username)
except User.DoesNotExist:
raise CommandError(f"{username} is not a valid memoro user")
# Ensure the user has an associated instapaper account
if not hasattr(self.user, "instapaper_... | |
4 | [
-0.0021477025002241135,
-0.033104341477155685,
-0.013533147983253002,
-0.028838077560067177,
0.05357308313250542,
-0.03760373592376709,
0.006282831076532602,
0.02191414125263691,
-0.0005398397333920002,
-0.03664790466427803,
0.021925797685980797,
-0.030353417620062828,
-0.020025795325636864,... | 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):
# Get the user associated with the account
self.get_user(options["user"])
if options["associate"]:
self.associate()
return
if options["article_count"]:
self.article_count()
return
with http_err... | |
5 | [
0.02496105246245861,
-0.0019249198958277702,
-0.005350145045667887,
-0.01911080628633499,
-0.0017975354567170143,
0.03983200341463089,
0.0500982403755188,
0.030320633202791214,
0.016682639718055725,
0.011190955527126789,
-0.002031859941780567,
-0.057017888873815536,
0.011247570626437664,
-... | 13 | {"_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 associate(self):
# Go through all articles in any folder that don't have a memo to associate.
query = Article.objects.filter(account=self.user.instapaper_account)
query = query.order_by('-progress_timestamp')
count = 0
for article in query:
if not article.read():... | |
6 | [
0.006481069140136242,
-0.020582862198352814,
-0.007804911118000746,
-0.012743416242301464,
0.029538940638303757,
-0.029538940638303757,
0.002531128004193306,
0.00851287879049778,
0.0022591648157685995,
-0.047013651579618454,
0.03075917810201645,
-0.03280825540423393,
0.00663647660985589,
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": {"_type": "arg", "_fields": {"arg": "options", "annotation": null, "type_comment": null}}, "... | def make_instapaper_client(self, **options):
# Get cached access credentials if they exist
account = self.user.instapaper_account
if account.oauth_token and account.oauth_token_secret:
self.client = Instapaper.cached_access_token(
account.oauth_token, account.oauth_to... | |
7 | [
0.010137351229786873,
-0.027261752635240555,
-0.04714420065283775,
-0.01630311645567417,
0.06310409307479858,
0.0013767246855422854,
-0.008795102126896381,
0.031748175621032715,
0.024650802835822105,
-0.0066560846753418446,
0.028781743720173836,
-0.06658536195755005,
0.0002127909247064963,
... | 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": "etype", "annotation": null, "type_comment": null}}, {"_type": "ar... | def __exit__(self, etype, value, traceback):
if value is None:
return True
if etype == HTTPException:
if self.debug:
print(e.response)
print(e.body)
return False
raise CommandError(str(value)) from value
if ety... | |
8 | [
-0.009408784098923206,
-0.018505191430449486,
-0.03905957564711571,
0.011895302683115005,
0.04925554618239403,
0.012051491066813469,
-0.010876954533159733,
0.01856766641139984,
0.025814805179834366,
-0.006653622258454561,
0.019454816356301308,
-0.08516636490821838,
0.03885965421795845,
0.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": "debug", "annotation": ... | class http_error(object):
def __init__(self, debug):
self.debug = debug
def __enter__(self):
return self
def __exit__(self, etype, value, traceback):
if value is None:
return True
if etype == HTTPException:
if self.debug:
print(e.re... | |
9 | [
0.033640071749687195,
-0.032957714051008224,
0.027385154739022255,
-0.01714983955025673,
-0.014283951371908188,
-0.02317730337381363,
0.008114330470561981,
-0.035368699580430984,
-0.04953892529010773,
0.007204524707049131,
-0.020880043506622314,
-0.02777182310819626,
0.005069324281066656,
... | 8 | {"_type": "Module", "_fields": {"body": [{"_type": "ClassDef", "_fields": {"body": [{"_type": "Assign", "_fields": {"value": {"_type": "BinOp", "_fields": {"op": {"_type": "Mult", "_fields": {}}, "left": {"_type": "Constant", "_fields": {"kind": null, "value": 8}}, "right": {"_type": "Constant", "_fields": {"kind": nul... | class Note(FieldSet):
static_size = 8*4
def createFields(self):
yield Bits(self, 4, "note_hi_nibble")
yield Bits(self, 12, "period")
yield Bits(self, 4, "note_low_nibble")
yield Bits(self, 4, "effect")
yield UInt8(self, "parameter") | |
10 | [
0.05360013246536255,
-0.011898213997483253,
-0.007302859332412481,
-0.006557237822562456,
0.009254165925085545,
-0.022231152281165123,
-0.0034901427570730448,
-0.06557238101959229,
-0.04215669259428978,
0.013495218008756638,
0.0031437724828720093,
-0.011295370757579803,
0.01236356608569622,
... | 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": "parent", "annotation":... | class Row(FieldSet):
def __init__(self, parent, name, channels, desc=None):
FieldSet.__init__(self, parent, name, description=desc)
self.channels = channels
self._size = 8*self.channels*4
def createFields(self):
for index in xrange(self.channels):
yield Note(self, "n... | |
11 | [
0.0027579981833696365,
0.05179707333445549,
0.009721139445900917,
-0.040379174053668976,
0.01835194230079651,
0.024893958121538162,
-0.010976863093674183,
-0.018976742401719093,
0.016734816133975983,
0.012097826227545738,
0.021818965673446655,
-0.05512933433055878,
-0.0018238621996715665,
... | 11 | {"_type": "Module", "_fields": {"body": [{"_type": "ClassDef", "_fields": {"body": [{"_type": "Assign", "_fields": {"value": {"_type": "Dict", "_fields": {"keys": [{"_type": "Constant", "_fields": {"kind": null, "value": "id"}}, {"_type": "Constant", "_fields": {"kind": null, "value": "category"}}, {"_type": "Constant"... | class AmigaModule(Parser):
PARSER_TAGS = {
"id": "mod",
"category": "audio",
"file_ext": ("mod", "nst", "wow", "oct", "sd0" ),
"mime": (u'audio/mod', u'audio/x-mod', u'audio/mod', u'audio/x-mod'),
"min_size": 1084*8,
"description": "Uncompressed amiga module"
}
... | |
12 | [
0.041442543268203735,
-0.00004111994712729938,
0.004593715071678162,
0.006862448062747717,
0.0391925610601902,
-0.009910639375448227,
0.01091777440160513,
-0.05849955603480339,
-0.021460551768541336,
0.03702829033136368,
0.012857045978307724,
-0.010462420992553234,
0.052285317331552505,
-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": "parent", "annotation":... | class Pattern(FieldSet):
def __init__(self, parent, name, channels, desc=None):
FieldSet.__init__(self, parent, name, description=desc)
self.channels = channels
self._size = 64*8*self.channels*4
def createFields(self):
for index in xrange(64):
yield Row(self, "row[]"... | |
13 | [
0.030638890340924263,
-0.0015605689259245992,
0.04271320998668671,
-0.042884647846221924,
0.007133154664188623,
-0.01502554677426815,
-0.016556266695261,
0.00048523821169510484,
0.02214033342897892,
0.014217326417565346,
-0.008284255862236023,
-0.01819719932973385,
0.010408895090222359,
-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": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"arg... | def test_create_lambda_if_not_exist():
set_module_args(base_module_args)
(boto3_conn_double, lambda_client_double) = make_mock_no_connection_connection(code_change_lambda_config)
with patch.object(lda, 'boto3_conn', boto3_conn_double):
try:
lda.main()
except SystemExit:
... | |
14 | [
0.07401425391435623,
0.0036110267974436283,
0.028723005205392838,
-0.010945187881588936,
0.025017572566866875,
-0.04349753260612488,
-0.0020651298109441996,
-0.003091794205829501,
-0.022079186514019966,
0.002867580158635974,
0.03304207697510719,
0.0019013944547623396,
0.0029693616088479757,
... | 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 createFields(self):
header = Header(self, "header")
yield header
channels = header.getNumChannels()
# Number of patterns
patterns = 0
for index in xrange(128):
patterns = max(patterns,
header["patterns/position[%u]" % index].val... | |
15 | [
0.026167605072259903,
-0.013821731321513653,
0.042633045464754105,
-0.06160103157162666,
0.0033206806983798742,
0.03311055526137352,
0.0003292607143521309,
-0.010144920088350773,
0.00938774086534977,
0.01568259671330452,
-0.0014205133775249124,
-0.03796163573861122,
-0.021367857232689857,
... | 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 test_update_lambda_if_config_changed():
set_module_args(base_module_args)
(boto3_conn_double, lambda_client_double) = make_mock_connection(two_change_lambda_config)
with patch.object(lda, 'boto3_conn', boto3_conn_double):
try:
lda.main()
except SystemExit:
pass
... | |
16 | [
0.013425212353467941,
-0.009930272586643696,
0.019628409296274185,
-0.05339133366942406,
-0.000774190470110625,
0.025792915374040604,
-0.002037640428170562,
-0.03182845935225487,
0.002366499975323677,
0.011368227191269398,
-0.0010341346496716142,
-0.02971343882381916,
-0.03157052770256996,
... | 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 test_update_lambda_if_code_changed():
set_module_args(base_module_args)
(boto3_conn_double, lambda_client_double) = make_mock_connection(code_change_lambda_config)
with patch.object(lda, 'boto3_conn', boto3_conn_double):
try:
lda.main()
except SystemExit:
pass
... | |
17 | [
0.024577999487519264,
-0.015057668089866638,
0.0396842397749424,
-0.04211289808154106,
0.0005707342061214149,
0.033491168171167374,
0.0034213692415505648,
-0.014608366414904594,
0.0023770472034811974,
0.02036428079009056,
-0.014268354512751102,
-0.03854277357459068,
-0.04495442286133766,
-... | 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 test_update_lambda_if_added_environment_variable():
set_module_args(module_args_with_environment)
(boto3_conn_double, lambda_client_double) = make_mock_connection(base_lambda_config)
with patch.object(lda, 'boto3_conn', boto3_conn_double):
try:
lda.main()
except SystemExit:... | |
18 | [
0.04203584045171738,
-0.013285493478178978,
0.03036332316696644,
-0.05314197391271591,
0.005851650144904852,
0.01841992326080799,
-0.004420289304107428,
-0.013445558957755566,
0.01240512914955616,
0.015649547800421715,
-0.0005771617288701236,
-0.040459804236888885,
-0.010041074827313423,
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": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"arg... | def test_update_lambda_if_only_one_config_item_changed():
set_module_args(base_module_args)
(boto3_conn_double, lambda_client_double) = make_mock_connection(one_change_lambda_config)
with patch.object(lda, 'boto3_conn', boto3_conn_double):
try:
lda.main()
except SystemExit:
... | |
19 | [
0.03518648445606232,
0.0210861898958683,
0.07929809391498566,
-0.018527811393141747,
0.04331722855567932,
0.04460225999355316,
-0.010981174185872078,
0.03567713499069214,
0.04331722855567932,
0.004079973325133324,
0.04962556064128876,
-0.016787176951766014,
-0.012780217453837395,
-0.010420... | 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 TestPrivileges(base.BaseTestCase):
def test_setuid_with_name(self):
with mock.patch('pwd.getpwnam', return_value=FakeEntry('pw_uid', 123)):
with mock.patch('os.setuid') as setuid_mock:
daemon.setuid('user')
setuid_mock.assert_called_once_with(123)
def t... | |
20 | [
0.022414011880755424,
-0.017571402713656425,
0.020282277837395668,
-0.044951245188713074,
0.008884278126060963,
0.029523897916078568,
0.0022811400704085827,
-0.0225865226238966,
0.026615869253873825,
0.009993272833526134,
-0.015033036470413208,
-0.037065062671899796,
-0.007639740128070116,
... | 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 test_dont_update_lambda_if_nothing_changed():
set_module_args(base_module_args)
(boto3_conn_double, lambda_client_double) = make_mock_connection(base_lambda_config)
with patch.object(lda, 'boto3_conn', boto3_conn_double):
try:
lda.main()
except SystemExit:
pass
... | |
21 | [
0.025581683963537216,
0.023216038942337036,
0.04444392770528793,
-0.04265711084008217,
0.029771896079182625,
0.011941474862396717,
0.01131860539317131,
0.01521311141550541,
0.030854051932692528,
-0.012004390358924866,
0.03354686126112938,
-0.011972933076322079,
0.009626162238419056,
0.0028... | 14 | {"_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 TestPidfile(base.BaseTestCase):
def setUp(self):
super(TestPidfile, self).setUp()
self.os_p = mock.patch.object(daemon, 'os')
self.os = self.os_p.start()
self.os.open.return_value = FAKE_FD
self.fcntl_p = mock.patch.object(daemon, 'fcntl')
self.fcntl = self.fcn... | |
22 | [
0.02675115130841732,
0.031246770173311234,
0.05871009826660156,
-0.02639506384730339,
0.046603087335824966,
0.07179635018110275,
0.014788802713155746,
0.06899215281009674,
0.026795662939548492,
-0.003246526001021266,
0.05928874388337135,
-0.004275844432413578,
-0.002865399932488799,
-0.004... | 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": "setuid", "annotation": null, "type_comment": null}}, {"_type": "a... | def _test_drop_privileges(self, setuid, setgid, setgroups,
geteuid, user=None, group=None):
daemon.drop_privileges(user=user, group=group)
if user:
setuid.assert_called_once_with(user)
else:
self.assertFalse(setuid.called)
if group:
... | |
23 | [
0.0513906367123127,
0.03871363028883934,
0.019064268097281456,
-0.01967374049127102,
0.031375594437122345,
0.0036141660530120134,
0.034496087580919266,
0.019795633852481842,
0.034983664751052856,
-0.015151461586356163,
0.04063956066966057,
0.0036141660530120134,
0.015236787497997284,
-0.01... | 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_init(self):
self.os.O_CREAT = os.O_CREAT
self.os.O_RDWR = os.O_RDWR
daemon.Pidfile('thefile', 'python')
self.os.open.assert_called_once_with('thefile', os.O_CREAT | os.O_RDWR)
self.fcntl.flock.assert_called_once_with(FAKE_FD, self.fcntl.LOCK_EX |
... | |
24 | [
0.0238910224288702,
-0.004673941992223263,
0.02248496748507023,
-0.023986348882317543,
0.03243459761142731,
0.0005324838566593826,
0.0282402615994215,
0.0025872013065963984,
0.01283323299139738,
-0.027668306604027748,
0.04072793945670128,
-0.015478523448109627,
0.015788331627845764,
-0.046... | 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 setUp(self):
super(TestPidfile, self).setUp()
self.os_p = mock.patch.object(daemon, 'os')
self.os = self.os_p.start()
self.os.open.return_value = FAKE_FD
self.fcntl_p = mock.patch.object(daemon, 'fcntl')
self.fcntl = self.fcntl_p.start()
self.fcntl.flock.retu... | |
25 | [
0.048950642347335815,
-0.0024271949660032988,
0.03294029086828232,
-0.04918643459677696,
0.07069076597690582,
-0.011424174532294273,
0.005505768116563559,
0.028978969901800156,
-0.0021132954861968756,
-0.002431616187095642,
0.054939787834882736,
0.011294487863779068,
-0.013864632695913315,
... | 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_write(self):
p = daemon.Pidfile('thefile', 'python')
p.write(34)
self.os.assert_has_calls([
mock.call.ftruncate(FAKE_FD, 0),
mock.call.write(FAKE_FD, '34'),
mock.call.fsync(FAKE_FD)]
) | |
26 | [
0.02678939886391163,
0.04057737812399864,
0.005945488344877958,
-0.018380118533968925,
0.008767860010266304,
0.0035771250259131193,
0.025794627144932747,
-0.003296622773632407,
0.0279692430049181,
-0.01074583362787962,
0.04180349037051201,
-0.045250486582517624,
-0.01625177264213562,
0.008... | 13 | {"_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_init_open_fail(self):
self.os.open.side_effect = IOError
with mock.patch.object(daemon.sys, 'stderr'):
with testtools.ExpectedException(SystemExit):
daemon.Pidfile('thefile', 'python')
sys.assert_has_calls([
mock.call.stderr.write... | |
27 | [
0.0063134972006082535,
0.032141439616680145,
0.04008496552705765,
-0.03413879871368408,
0.04821215942502022,
0.005653449799865484,
0.020880457013845444,
0.027825303375720978,
0.006204445846378803,
-0.012041560374200344,
0.037352945655584335,
-0.014544001780450344,
0.015565640293061733,
-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_is_running_uuid_true(self):
with mock.patch('six.moves.builtins.open') as mock_open:
p = daemon.Pidfile('thefile', 'python', uuid='1234')
mock_open.return_value.__enter__ = lambda s: s
mock_open.return_value.__exit__ = mock.Mock()
mock_open.return_value.r... | |
28 | [
0.008211164735257626,
0.057747844606637955,
0.02294076606631279,
-0.04445849359035492,
0.06743369251489639,
0.01765027455985546,
0.016651852056384087,
0.02960839308798313,
0.014471389353275299,
-0.010414579883217812,
0.033647987991571426,
-0.03036581724882126,
0.016514139249920845,
-0.0308... | 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_is_running(self):
with mock.patch('six.moves.builtins.open') as mock_open:
p = daemon.Pidfile('thefile', 'python')
mock_open.return_value.__enter__ = lambda s: s
mock_open.return_value.__exit__ = mock.Mock()
mock_open.return_value.readline.return_value = ... | |
29 | [
0.026558609679341316,
0.0036736014299094677,
0.019675560295581818,
-0.04904172942042351,
0.03704167529940605,
0.02135103940963745,
0.0019146312261000276,
0.007262296508997679,
0.016584979370236397,
0.013720816001296043,
0.01989065483212471,
-0.03430204093456268,
0.0003902140015270561,
-0.0... | 13 | {"_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 TestDaemon(base.BaseTestCase):
def setUp(self):
super(TestDaemon, self).setUp()
self.os_p = mock.patch.object(daemon, 'os')
self.os = self.os_p.start()
self.pidfile_p = mock.patch.object(daemon, 'Pidfile')
self.pidfile = self.pidfile_p.start()
def test_init(self):... | |
30 | [
0.007296205498278141,
0.031109094619750977,
0.04276927933096886,
-0.03422458842396736,
0.046182576566934586,
0.009569826535880566,
0.02303401753306389,
0.021189920604228973,
0.01644796133041382,
-0.011831994168460369,
0.029230637475848198,
-0.020823393017053604,
0.013905170373618603,
-0.04... | 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_is_running_uuid_false(self):
with mock.patch('six.moves.builtins.open') as mock_open:
p = daemon.Pidfile('thefile', 'python', uuid='6789')
mock_open.return_value.__enter__ = lambda s: s
mock_open.return_value.__exit__ = mock.Mock()
mock_open.return_value.... | |
31 | [
0.039840217679739,
0.02448955737054348,
0.026902761310338974,
-0.04808533564209938,
0.020579272881150246,
0.016780709847807884,
0.03820907324552536,
0.0408010333776474,
0.029204243794083595,
0.008049601688981056,
0.02104850672185421,
0.008295390754938126,
0.029450032860040665,
-0.019618459... | 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_start(self):
self.pidfile.return_value.is_running.return_value = False
d = daemon.Daemon('pidfile')
with mock.patch.object(d, 'daemonize') as daemonize:
with mock.patch.object(d, 'run') as run:
d.start()
run.assert_called_once_with()
... | |
32 | [
0.03445154055953026,
0.013382108882069588,
0.009904817678034306,
-0.008863558061420918,
0.021030863747000694,
0.03355168551206589,
0.005325205158442259,
0.029952270910143852,
0.04185604676604271,
0.004354648757725954,
0.02820398285984993,
-0.022226383909583092,
-0.001944326562806964,
-0.01... | 12 | {"_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_daemonize(self):
self.os.devnull = '/dev/null'
d = daemon.Daemon('pidfile')
with mock.patch.object(d, '_fork') as fork:
with mock.patch.object(daemon, 'atexit') as atexit:
with mock.patch.object(daemon, 'signal') as signal:
signal.SIGTERM... | |
33 | [
0.04016946256160736,
0.027427293360233307,
0.026500999927520752,
-0.0336628220975399,
0.02722395956516266,
0.02571026235818863,
0.03246542066335678,
0.034792445600032806,
0.034476153552532196,
0.014888456091284752,
0.025574708357453346,
0.016198821365833282,
0.018559737130999565,
-0.023744... | 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_start_running(self):
self.pidfile.return_value.is_running.return_value = True
d = daemon.Daemon('pidfile')
with mock.patch.object(daemon.sys, 'stderr'):
with mock.patch.object(d, 'daemonize') as daemonize:
with testtools.ExpectedException(SystemExit):
... | |
34 | [
-0.012735323049128056,
-0.010958455502986908,
0.020186280831694603,
-0.030992809683084488,
0.030464373528957367,
0.01931435987353325,
-0.005819408688694239,
-0.001302926568314433,
0.021599847823381424,
0.032948024570941925,
0.03392563387751579,
-0.0409802608191967,
0.013045779429376125,
-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_set_uservars(self):
self.new("""
+ who am i
- You are <get name>, seeker!
+ how old am i
- You are <get age> years old.
""")
# Test the base case, with no vars set.
self.reply("Who am I?", "You are undefined, seeker!")
se... | |
35 | [
0.005498331505805254,
-0.0054894727654755116,
0.0709645003080368,
-0.030355986207723618,
-0.043230704963207245,
0.011953407898545265,
-0.0007943346863612533,
-0.04649072512984276,
0.027001474052667618,
0.018485261127352715,
0.009549733251333237,
-0.05178235471248627,
0.028277132660150528,
... | 10 | {"_type": "Module", "_fields": {"body": [{"_type": "ClassDef", "_fields": {"body": [{"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"kind": null, "value": "{% load oa_extras %}{{ text|link_and_linebreak }}"}}], "func": {"_type": "Name", "_fields": {"id":... | class OAExtrasTests(unittest.TestCase):
template = Template(
"{% load oa_extras %}"
"{{ text|link_and_linebreak }}"
)
@ddt.data(
("", ""),
('check this https://dummy-url.com', 'https://dummy-url.com'),
('Visit this URL http://dummy-url.com', 'http://dummy-url.com'),... | |
36 | [
-0.023478534072637558,
0.023149924352765083,
0.0011812919983640313,
0.002675612224265933,
-0.02846432290971279,
-0.004033956676721573,
0.03714412823319435,
0.0010091973235830665,
0.013767575845122337,
0.03514981269836426,
0.016362452879548073,
0.03131981939077377,
0.03675886243581772,
-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": "text", "annotation": null, "type_comment": null}}, {"_type": "arg... | def test_link_and_linebreak(self, text, link_text):
rendered_template = self.template.render(Context({'text': text}))
self.assertIn(link_text, rendered_template)
if text:
self.assertRegexpMatches(
rendered_template,
r'<a.*target="_blank".*>{link_text}<... | |
37 | [
0.0034355344250798225,
0.0356733575463295,
0.05424598604440689,
-0.035191647708415985,
0.00949371699243784,
-0.024821486324071884,
-0.020900895819067955,
-0.03661001846194267,
0.011373726651072502,
0.026253236457705498,
0.005285437684506178,
-0.059303950518369675,
0.028902646154165268,
-0.... | 15 | {"_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 defineCharacteristicsFromFile(self):
lines = open(self.descriptionFile)
line = lines.readline().strip('\n').strip()
self.name = line
if '|' in self.name:
tokens = self.name.split('|')
self.name = tokens[0]
#cmdname is the name of the algorithm in S... | |
38 | [
0.016100317239761353,
0.022376494482159615,
0.1025194376707077,
-0.04134592041373253,
-0.008421605452895164,
0.005526878871023655,
0.0235676858574152,
0.00857530813664198,
-0.006545156240463257,
0.00885709561407566,
0.02264547348022461,
-0.026385562494397163,
-0.014204654842615128,
-0.0448... | 17 | {"_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": "progress", "annotation": null, "type_comment": null}}], "kwarg": ... | def processAlgorithm(self, progress):
commands = list()
self.exportedLayers = {}
self.preProcessInputs()
# 1: Export rasters to sgrd and vectors to shp
# Tables must be in dbf format. We check that.
for param in self.parameters:
if isinstance(param, Paramete... | |
39 | [
0.014362983405590057,
0.04919707030057907,
0.022084124386310577,
-0.05650309845805168,
-0.02254668064415455,
0.032663628458976746,
-0.03655385226011276,
0.052612874656915665,
-0.0037894081324338913,
-0.010775202885270119,
0.06959701329469681,
-0.05493752285838127,
0.0363166444003582,
0.011... | 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": "commands", "annotation": null, "type_comment": null}}], "kwarg": ... | def editCommands(self, commands):
name = self.commandLineName()[len('saga:'):]
try:
module = importlib.import_module('processing.algs.saga.ext.' + name)
except ImportError:
return commands
if hasattr(module, 'editCommands'):
func = getattr(module, 'edi... | |
40 | [
0.02835705131292343,
0.04183342680335045,
0.03399889916181564,
-0.052624382078647614,
-0.0044592758640646935,
-0.0033875713124871254,
-0.01560746505856514,
0.02751939743757248,
0.006085310131311417,
-0.02333112806081772,
0.031141020357608795,
-0.03907409682869911,
-0.016482073813676834,
-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 preProcessInputs(self):
name = self.commandLineName().replace('.', '_')[len('saga:'):]
try:
module = importlib.import_module('processing.algs.saga.ext.' + name)
except ImportError:
return
if hasattr(module, 'preProcessInputs'):
func = getattr(modul... | |
41 | [
-0.0025443900376558304,
0.005967437289655209,
0.017647475004196167,
-0.08396884799003601,
0.0014347863616421819,
-0.01650070771574974,
-0.002565626287832856,
0.005792236886918545,
-0.016118451952934265,
-0.002180716022849083,
0.01848631352186203,
-0.018337657675147057,
0.011892401613295078,
... | 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": "source", "annotation": null, "type_comment": null}}], "kwarg": nu... | def exportRasterLayer(self, source):
global sessionExportedLayers
if source in sessionExportedLayers:
exportedLayer = sessionExportedLayers[source]
if os.path.exists(exportedLayer):
self.exportedLayers[source] = exportedLayer
return None
... | |
42 | [
0.014934368431568146,
0.01159888319671154,
-0.02199268713593483,
-0.027350984513759613,
-0.006907683331519365,
-0.010641275905072689,
-0.02163761854171753,
-0.020443299785256386,
-0.022272437810897827,
0.041725851595401764,
0.01584893837571144,
-0.029459871351718903,
-0.04286637157201767,
... | 8 | {"_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": "fitter_kwargs", "annotation": null, "type_comment": nul... | def __init__(self, *, fitter=LevMarLSQFitter(), fit_boxsize=5,
**fitter_kwargs):
self.fitter = fitter
self.fitter_has_fit_info = hasattr(self.fitter, 'fit_info')
self.fit_boxsize = as_pair('fit_boxsize', fit_boxsize,
lower_bound=(3, 0), check_... | |
43 | [
0.019380569458007812,
-0.020966356620192528,
0.014611884951591492,
0.007311605848371983,
-0.03959934040904045,
0.021226877346634865,
0.011938703246414661,
-0.015563356690108776,
-0.04089062288403511,
0.018202558159828186,
0.014362690038979053,
-0.017885399982333183,
-0.013603778555989265,
... | 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": [{"_type": "arg", "_fields": {"arg": "ov... | def __init__(self, *, oversampling=4, shape=None,
smoothing_kernel='quartic', recentering_func=centroid_com,
recentering_maxiters=20, fitter=EPSFFitter(), maxiters=10,
progress_bar=True, norm_radius=5.5,
recentering_boxsize=(5, 5), center_accuracy=1.0e... | |
44 | [
0.0077465311624109745,
0.007317449897527695,
-0.028014851734042168,
0.013721372000873089,
0.01118379458785057,
0.02650153450667858,
0.022755147889256477,
-0.002846700372174382,
0.04414461553096771,
0.016231266781687737,
-0.019728509709239006,
-0.01646195538341999,
0.02002379111945629,
-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 get_success_url(self):
if self.success_url:
url = self.success_url % self.object.__dict__
else:
try:
url = self.object.get_absolute_url()
except AttributeError:
raise ImproperlyConfigured(
"No URL to redirect to.... | |
45 | [
0.029099110513925552,
0.0009348727180622518,
-0.06346669048070908,
0.01847027614712715,
0.01129249669611454,
-0.002736337250098586,
0.0034280794207006693,
0.03841082379221916,
-0.03914596140384674,
-0.00697357626631856,
-0.027771782130002975,
-0.013661266304552555,
0.020277485251426697,
-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": {"_type": "arg", "_fields": {"arg": "kwargs", "annotation": null, "type_comment": null}}, "v... | def get_context_data(self, **kwargs):
context = kwargs
if self.object:
context['object'] = self.object
context_object_name = self.get_context_object_name(self.object)
if context_object_name:
context[context_object_name] = self.object
return con... | |
46 | [
-0.005821270868182182,
0.02062966302037239,
0.02971710078418255,
-0.042722757905721664,
0.023001838475465775,
-0.0174549613147974,
0.02537401393055916,
-0.02905619516968727,
0.020783087238669395,
-0.05112568661570549,
0.032289907336235046,
-0.0019060014747083187,
0.001255423529073596,
-0.0... | 9 | {"_type": "Module", "_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": [], "kw_defaults": [], "posonlyargs": []}... | def resource_setup(cls):
super(SwiftResourcesTestJSON, cls).resource_setup()
cls.stack_name = data_utils.rand_name('heat')
template = cls.read_template('swift_basic')
# create the stack
cls.stack_identifier = cls.create_stack(
cls.stack_name,
template)
... | |
47 | [
0.02468828484416008,
0.027897294610738754,
0.03775855526328087,
-0.024079276248812675,
0.005589413922280073,
-0.010171620175242424,
-0.014862160198390484,
-0.0215144120156765,
-0.0034198195207864046,
-0.002469706814736128,
0.011049998924136162,
-0.001600112416781485,
-0.01222702581435442,
... | 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_metadata(self):
swift_basic_template = self.load_template('swift_basic')
metadatas = swift_basic_template['resources']['SwiftContainerWebsite'][
'properties']['X-Container-Meta']
swcont_website = self.test_resources.get(
'SwiftContainerWebsite')['physical_resourc... | |
48 | [
0.01985112391412258,
0.037343937903642654,
0.07240250706672668,
0.012545229867100716,
0.03503425419330597,
0.0006154091679491103,
-0.02171102724969387,
-0.026476269587874413,
0.016192099079489708,
0.02420305460691452,
0.015377631410956383,
-0.03518012911081314,
0.018769219517707825,
0.0330... | 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_acl(self):
acl_headers = ('x-container-meta-web-index', 'x-container-read')
swcont = self.test_resources.get(
'SwiftContainer')['physical_resource_id']
swcont_website = self.test_resources.get(
'SwiftContainerWebsite')['physical_resource_id']
headers, _... | |
49 | [
0.04428638145327568,
-0.05571894347667694,
0.05377801135182381,
-0.0020222971215844154,
0.001073281979188323,
0.009154333733022213,
-0.03997845947742462,
0.027906810864806175,
0.0005891586188226938,
0.0563817024230957,
-0.020261434838175774,
-0.04374197497963905,
-0.03363492712378502,
0.01... | 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": "s", "annotation": {"_type": "Name", "_fields": {"id": "str", "ctx... | def freqAlphabets(self, s: str) -> str:
dict_numbers = {
1: "a",
2: "b",
3: "c",
4: "d",
5: "e",
6: "f",
7: "g",
8: "h",
9: "i",
10: "j",
11: "k",
12: "l",
... | |
50 | [
0.025338955223560333,
-0.03917253017425537,
0.047332532703876495,
-0.012714684940874577,
0.003791801631450653,
0.01424044743180275,
-0.037997130304574966,
0.025926655158400536,
-0.0026785603258758783,
0.06559647619724274,
-0.01769884116947651,
-0.049321677535772324,
-0.045094750821590424,
... | 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": "s", "annotation": {"_t... | class Solution:
def freqAlphabets(self, s: str) -> str:
dict_numbers = {
1: "a",
2: "b",
3: "c",
4: "d",
5: "e",
6: "f",
7: "g",
8: "h",
9: "i",
10: "j",
11: "k",
1... | |
51 | [
0.014677409082651138,
0.04756910353899002,
-0.022416630759835243,
-0.035146910697221756,
-0.03990382328629494,
0.05698433518409729,
0.010203941725194454,
-0.004667564295232296,
-0.0026742215268313885,
0.01587279886007309,
0.018929051235318184,
-0.021849745884537697,
0.021393772214651108,
-... | 8 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "sub_mthd_fn", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "lst_mthd_fn", "annotation": null, "type_comment": null}}, ... | def make_observer_with (sub_mthd_fn, lst_mthd_fn,
signals, cls_lexeme = '_Some',
sub_doc = '', lst_doc = '',
defret = None, names = Naming):
sub_dir = sub_mthd_fn (signals, names)
sub_dir ['__doc__'] = sub_doc
sub_cls = type (cls_lexeme... | |
52 | [
0.0266572292894125,
-0.009583964012563229,
-0.01688603311777115,
-0.026516804471611977,
-0.015048813074827194,
0.051769789308309555,
-0.05509316921234131,
0.011924371123313904,
-0.011187142692506313,
0.03367844969034195,
0.041284769773483276,
-0.0011906818253919482,
0.024714691564440727,
0... | 12 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "signals", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "defret", "annotation": null, "type_comment": null}}, {"_type":... | def make_clever_listener_methods (signals, defret = None, names = Naming):
def init (self):
for sig in signals:
setattr (self, names.SLOT_PREFIX + sig, CleverSlot (
getattr (self, names.HANDLER_PREFIX + sig)))
def disconnect (self):
for sig in signals:
g... | |
53 | [
0.0338326022028923,
-0.019331295043230057,
-0.02449008636176586,
-0.034104712307453156,
-0.02868514694273472,
0.029002612456679344,
-0.04059005156159401,
0.010130506008863449,
0.0021513861138373613,
0.003682016395032406,
0.023242905735969543,
-0.010153181850910187,
0.024240650236606598,
0.... | 12 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "signals", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "names", "annotation": null, "type_comment": null}}], "kwarg": ... | def make_clever_subject_methods (signals, names = Naming):
def add_listener (self, listener):
for sig in signals:
getattr (self, names.SIGNAL_PREFIX + sig).connect (
getattr (listener, names.SLOT_PREFIX + sig))
methods = make_subject_methods (signals, names)
methods [na... | |
54 | [
0.04260149970650673,
0.006313866004347801,
-0.021836401894688606,
-0.035261914134025574,
-0.02514149434864521,
0.013721831142902374,
-0.033848702907562256,
-0.009145988151431084,
0.027466455474495888,
0.014895709231495857,
0.017266258597373962,
0.015556727536022663,
0.0005331598222255707,
... | 10 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "signals", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "names", "annotation": null, "type_comment": null}}], "kwarg": ... | def make_light_subject_methods (signals, names = Naming):
def init (self):
self._listeners = []
def add_listener (self, listener):
self._listeners.append (listener)
return listener
def del_listener (self, listener):
self._listeners.remove (listener)
return listener... | |
55 | [
0.047229375690221786,
0.016454549506306648,
-0.006276595871895552,
-0.024326112121343613,
-0.037659578025341034,
0.025519469752907753,
-0.030843675136566162,
-0.0016810261877253652,
0.007337994873523712,
0.013264616020023823,
0.032427165657281876,
-0.0025918211322277784,
0.01336788758635521,... | 12 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "signals", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "names", "annotation": null, "type_comment": null}}], "kwarg": ... | def make_subject_methods (signals, names = Naming):
def init (self):
for sig in signals:
setattr (self, names.SIGNAL_PREFIX + sig, Signal ())
def add_listener (self, listener):
for sig in signals:
getattr (self, names.SIGNAL_PREFIX + sig).connect (
getat... | |
56 | [
0.018772901967167854,
-0.00806491356343031,
0.036082673817873,
-0.01825372688472271,
0.02548678033053875,
-0.024755215272307396,
-0.012991177849471569,
-0.007002964615821838,
0.002084075240418315,
-0.023587070405483246,
0.05578772723674774,
-0.01605903171002865,
0.003914462402462959,
-0.00... | 16 | {"_type": "Module", "_fields": {"body": [{"_type": "ClassDef", "_fields": {"body": [{"_type": "Assign", "_fields": {"value": {"_type": "Constant", "_fields": {"kind": null, "value": "inode_hash_block"}}, "targets": [{"_type": "Name", "_fields": {"id": "_table_name", "ctx": {"_type": "Store", "_fields": {}}}}], "type_co... | class TableInodeHashBlock(Table):
_table_name = "inode_hash_block"
_selected_subvol = None
def create(self):
cur = self.getCursor()
# Create table
cur.execute(
"CREATE TABLE IF NOT EXISTS `%s` (" % self.getName() +
"`inode_id` BIGINT UNSIGNED NOT NULL, " +... | |
57 | [
0.03047209046781063,
0.002880997722968459,
0.05615729093551636,
0.005304913967847824,
-0.021928824484348297,
-0.025552233681082726,
0.00006449348438763991,
0.00783963780850172,
-0.011446425691246986,
-0.026704631745815277,
0.03053857572376728,
0.008604209870100021,
0.016565736383199692,
-0... | 15 | {"_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 create(self):
cur = self.getCursor()
# Create table
cur.execute(
"CREATE TABLE IF NOT EXISTS `%s` (" % self.getName() +
"`inode_id` BIGINT UNSIGNED NOT NULL, " +
"`block_number` BIGINT UNSIGNED NOT NULL, " +
"`hash_id` BIGINT UNSIGNED NOT NULL... | |
58 | [
0.032889895141124725,
0.02658282406628132,
0.024254709482192993,
-0.013989846222102642,
-0.0035768290981650352,
-0.038181062787771225,
0.035514313727617264,
0.032233789563179016,
-0.016995228826999664,
-0.009571721777319908,
0.05016026273369789,
0.034350257366895676,
0.004092718008905649,
... | 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": "inode", "annotation": null, "type_comment": null}}, {"_type": "ar... | def insert(self, inode, block_number, hash_id, real_size=0):
self.startTimer()
cur = self.getCursor()
cur.execute(
"INSERT INTO `%s` " % self.getName() +
" (`inode_id`,`block_number`,`hash_id`,`real_size`) " +
" VALUES (%(inode)s, %(block)s, %(hash)s, %(size)s... | |
59 | [
0.0018636920722201467,
0.01003145333379507,
0.005781024228781462,
-0.0026757882442325354,
-0.0038374988362193108,
-0.016186866909265518,
0.04431017488241196,
0.03065594471991062,
-0.011925427243113518,
0.012288805097341537,
0.056598979979753494,
0.032549917697906494,
-0.00668947072699666,
... | 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": "inode", "annotation": null, "type_comment": null}}, {"_type": "ar... | def update_hash(self, inode, block_number, new_hash_id):
self.startTimer()
cur = self.getCursor()
cur.execute(
"UPDATE `%s` " % self.getName() +
" SET `hash_id`=%(hash)s " +
" WHERE `inode_id`=%(inode)s AND `block_number`=%(block)s",
{
... | |
60 | [
0.011668562889099121,
0.01113768108189106,
0.00921458937227726,
-0.003854309441521764,
-0.003965361509472132,
-0.013976273126900196,
0.04353230074048042,
0.02793087810277939,
-0.013716249726712704,
0.014517989940941334,
0.05607844144105911,
0.02725915051996708,
-0.023835504427552223,
-0.02... | 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": "inode", "annotation": null, "type_comment": null}}, {"_type": "ar... | def update(self, inode, block_number, new_hash_id, new_size):
self.startTimer()
cur = self.getCursor()
cur.execute(
"UPDATE `%s` " % self.getName() +
" SET `hash_id`=%(hash)s, `real_size`=%(size)s " +
" WHERE `inode_id`=%(inode)s AND `block_number`=%(block)s",... | |
61 | [
0.04049181938171387,
0.048145633190870285,
0.011512174271047115,
-0.025016438215970993,
-0.01982652209699154,
0.018851447850465775,
0.019805554300546646,
0.057791534811258316,
0.012843728065490723,
0.023234043270349503,
0.08656148612499237,
-0.00016841011529322714,
0.009562024846673012,
-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": "inode", "annotation": null, "type_comment": null}}], "kwarg": nul... | def delete(self, inode):
self.startTimer()
cur = self.getCursor()
cur.execute(
"DELETE FROM `%s` " % self.getName() +
" WHERE `inode_id`=%(inode)s",
{
"inode": inode
}
)
count = cur.rowcount
self.stopTimer('d... | |
62 | [
0.026705680415034294,
0.015746857970952988,
0.011278713122010231,
-0.006681579630821943,
-0.027985243126749992,
0.008807302452623844,
0.04577527195215225,
0.004426869098097086,
-0.026519939303398132,
0.013022631406784058,
0.031122231855988503,
0.030482450500130653,
-0.04837566986680031,
-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": "inode", "annotation": null, "type_comment": null}}, {"_type": "ar... | def update_size(self, inode, block_number, new_size):
self.startTimer()
cur = self.getCursor()
cur.execute(
"UPDATE `%s` " % self.getName() +
" SET `real_size`=%(size)s " +
" WHERE `inode_id`=%(inode)s AND `block_number`=%(block)s",
{
... | |
63 | [
0.00604902021586895,
0.01845741830766201,
0.022134847939014435,
-0.007190897595137358,
0.0000069480197453231085,
-0.025695161893963814,
0.004388906992971897,
0.021080806851387024,
0.011530030518770218,
-0.0018050441285595298,
0.05246778577566147,
0.04593273624777794,
-0.007378282491117716,
... | 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": "inode", "annotation": null, "type_comment": null}}, {"_type": "ar... | def get(self, inode, block_number):
self.startTimer()
cur = self.getCursor()
cur.execute(
"SELECT `hash_id`,`real_size` FROM `%s` " % self.getName() +
" WHERE `inode_id`=%(inode)s AND `block_number`=%(block)s",
{
"inode": inode,
... | |
64 | [
0.0007490868447348475,
0.006031215190887451,
0.02854922041296959,
-0.012227518483996391,
0.013933428563177586,
-0.04851386323571205,
0.026986386626958847,
0.03422824665904045,
0.024961307644844055,
0.01244763657450676,
0.03277547284960747,
0.024278944358229637,
0.008380968123674393,
-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}}, {"_type": "arg", "_fields": {"arg": "inode", "annotation": null, "type_comment": null}}, {"_type": "ar... | def hash_by_inode_number(self, inode, block_number):
self.startTimer()
cur = self.getCursor()
cur.execute(
"SELECT `hash_id` FROM `%s` " % self.getName() +
" WHERE `inode_id`=%(inode)s AND `block_number`=%(block)s",
{
"inode": inode,
... | |
65 | [
0.018641851842403412,
0.026744287461042404,
0.014361515641212463,
-0.024994660168886185,
-0.014767678454518318,
-0.007675443775951862,
0.03361781686544418,
0.057571034878492355,
0.04038720577955246,
0.02384907193481922,
0.05732108652591705,
0.004801057744771242,
-0.0034575946629047394,
-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": "inode", "annotation": null, "type_comment": null}}, {"_type": "ar... | def delete_by_inode_number(self, inode, block_number):
self.startTimer()
cur = self.getCursor()
cur.execute(
"DELETE FROM `%s` " % self.getName() +
" WHERE `inode_id`=%(inode)s AND `block_number`=%(block)s",
{
"inode": inode,
"b... | |
66 | [
0.025033485144376755,
0.016507588326931,
0.004900690168142319,
-0.027550440281629562,
-0.01649625040590763,
-0.005572444759309292,
0.03868399187922478,
0.04346847161650658,
0.031223831698298454,
0.022119715809822083,
0.05124608427286148,
0.008338826708495617,
-0.012255977839231491,
-0.0244... | 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": "inode", "annotation": null, "type_comment": null}}, {"_type": "ar... | def delete_by_inode_number_more(self, inode, block_number):
self.startTimer()
cur = self.getCursor()
cur.execute(
"SELECT block_number FROM `%s` " % self.getName() +
" WHERE `inode_id`=%(inode)s AND `block_number`>%(block)s",
{
"inode": inode,
... | |
67 | [
0.006413276307284832,
0.015330365858972073,
0.06694406270980835,
0.010976146906614304,
0.007429077755659819,
-0.02169971540570259,
0.009164176881313324,
0.05240437388420105,
-0.01271673571318388,
0.04748459905385971,
0.03505338728427887,
-0.012552011758089066,
0.0471331886947155,
-0.038150... | 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": "hash_ids", "annotation": null, "type_comment": null}}], "kwarg": ... | def count_hashes_by_hashes(self, hash_ids):
self.startTimer()
count = 0
id_str = ",".join(str(hid) for hid in hash_ids)
if id_str:
cur = self.getCursor()
cur.execute("SELECT COUNT(1) as `cnt` FROM `%s` " % self.getName()+
" WHERE `hash_id` ... | |
68 | [
0.047160554677248,
0.02297794260084629,
0.035604655742645264,
0.009129827842116356,
0.024941107258200645,
-0.016887672245502472,
-0.006954731419682503,
0.046758998185396194,
-0.005889492109417915,
0.014333328232169151,
0.03694317862391472,
0.02075822837650776,
0.0018083974719047546,
-0.050... | 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 get_count_uniq_inodes(self):
self.startTimer()
cur = self.getCursor()
cur.execute("SELECT COUNT(DISTINCT `inode_id`) as `cnt` FROM `%s`" % self.getName())
item = cur.fetchone()
if item:
item = item["cnt"]
else:
item = 0
self.stopTimer('... | |
69 | [
0.022809835150837898,
0.01793317310512066,
0.0764196440577507,
0.009965353645384312,
-0.007236877456307411,
-0.024059688672423363,
-0.01237578596919775,
0.05003879591822624,
-0.014920131303369999,
0.034571852535009384,
0.03254083916544914,
-0.0008432329632341862,
0.03432634472846985,
-0.02... | 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": "hash_ids", "annotation": null, "type_comment": null}}], "kwarg": ... | def count_realsize_by_hashes(self, hash_ids):
self.startTimer()
count = 0
id_str = ",".join(str(hid) for hid in hash_ids)
if id_str:
cur = self.getCursor()
cur.execute("SELECT SUM(`real_size`) as `srs` FROM `%s` " % self.getName()+
" WHERE ... | |
70 | [
0.03543858602643013,
-0.0030676962342113256,
0.025146959349513054,
-0.035345446318387985,
-0.027545234188437462,
-0.028406750410795212,
0.010780594311654568,
0.02933811955153942,
-0.008056340739130974,
0.004499675706028938,
0.0284300334751606,
0.0025132405571639538,
0.03299374133348465,
-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": "start_id", "annotation": null, "type_comment": null}}, {"_type": ... | def get_inode_ids(self, start_id, end_id):
self.startTimer()
cur = self.getCursor()
cur.execute("SELECT DISTINCT `inode_id` FROM `%s` " % self.getName() +
" WHERE `inode_id`>=%s AND `inode_id`<%s", (start_id, end_id,))
nameIds = set(str(item["inode_id"]) for item in c... | |
71 | [
0.034125566482543945,
0.0352371484041214,
0.022298334166407585,
-0.020886626094579697,
0.0032763879280537367,
-0.004865949973464012,
0.0022843009792268276,
0.02278743125498295,
0.011693842709064484,
0.06331571191549301,
0.07514294236898422,
-0.01740737445652485,
0.004815929103642702,
-0.04... | 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": "inode_ids", "annotation": null, "type_comment": null}}], "kwarg":... | def remove_by_inodes(self, inode_ids):
self.startTimer()
count = 0
id_str = ",".join(inode_ids)
if id_str:
cur = self.getCursor()
cur.execute("DELETE FROM `%s` " % self.getName() +
" WHERE `inode_id` IN (%s)" % (id_str,))
count ... | |
72 | [
0.02401144802570343,
0.04677455499768257,
0.007063314784318209,
0.00007458795153070241,
0.02311977744102478,
0.001355022774077952,
-0.04257095977663994,
-0.0222026277333498,
0.013604364357888699,
0.06353798508644104,
0.01913272961974144,
-0.05665937438607216,
-0.008528203703463078,
0.04476... | 13 | {"_type": "Module", "_fields": {"body": [{"_type": "ClassDef", "_fields": {"body": [{"_type": "Assign", "_fields": {"value": {"_type": "Set", "_fields": {"elts": [{"_type": "Constant", "_fields": {"kind": null, "value": "invalid_params"}}, {"_type": "Constant", "_fields": {"kind": null, "value": "invalid_body"}}, {"_ty... | class PollParser(object):
fields = {'invalid_params', 'invalid_body', 'name', 'title',
'min', 'max', 'close', 'choices', 'mode'}
def __init__(self, polls, data):
assert set(data.keys()) == self.fields
self.data = data
self.polls = polls
self.close_max_len = 5 # ... | |
73 | [
0.05199790373444557,
0.0421522855758667,
0.05064791440963745,
-0.002659248188138008,
0.0005906207952648401,
-0.009158986620604992,
-0.05199790373444557,
0.013243870809674263,
-0.0158391110599041,
0.0388936884701252,
0.00044914818136021495,
-0.05967888608574867,
-0.03617043048143387,
0.0399... | 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 _pre_validation(self):
if self.data['invalid_params'] is not None:
raise ParserError('Invalid parameters')
if self.data['invalid_body'] is not None:
raise ParserError('Invalid body')
# Avoid further processing if the choice max is reached
if len(self.polls['... | |
74 | [
0.04573307931423187,
0.021788137033581734,
0.011818413622677326,
0.018024731427431107,
0.034266795963048935,
-0.003232457209378481,
-0.01050342246890068,
-0.023768875747919083,
-0.0034112739376723766,
0.025199411436915398,
0.044280536472797394,
-0.039042580872774124,
0.018563933670520782,
... | 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": "polls", "annotation": null, "type_comment": null}}, {"_type": "ar... | def __init__(self, polls, data):
assert set(data.keys()) == self.fields
self.data = data
self.polls = polls
self.close_max_len = 5 # Fixed length
self.choices_limit = 20 # make a setting
self.cleaned_data = {}
self._field_name = CommentPoll._meta.get_field('na... | |
75 | [
0.03506610915064812,
-0.0017982620047405362,
0.053648147732019424,
-0.017682909965515137,
0.02187885344028473,
-0.01855706423521042,
-0.014423559419810772,
0.011938461102545261,
-0.0016031380509957671,
0.05879317596554756,
0.026399483904242516,
-0.03716408088803291,
-0.01592211052775383,
0... | 12 | {"_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 _clean_choices(self):
choices_raw = self.data['choices']
choices = []
for choice in choices_raw.splitlines()[:self.choices_limit + 1]:
number, description = choice.split('.', 1)
description = mistune.escape(description.strip(), quote=True)
choices.append(... | |
76 | [
0.0422687754034996,
0.035457078367471695,
0.006805220618844032,
-0.01493134070187807,
0.01004271861165762,
-0.01574718952178955,
-0.027117284014821053,
-0.021587636321783066,
-0.0018583238124847412,
0.01996888779103756,
0.04770777001976967,
-0.023413585498929024,
-0.023581935092806816,
-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 _clean_poll(self):
name_raw = self.data['name']
title_raw = self.data['title']
min_raw = self.data['min']
max_raw = self.data['max']
close_at_raw = self.data['close']
mode_raw = self.data['mode']
poll = {
'name': name_raw[:self._field_name.max_len... | |
77 | [
0.017638079822063446,
0.029749136418104172,
0.06983914971351624,
-0.009653187356889248,
-0.0067241196520626545,
-0.0025947715621441603,
-0.03081888146698475,
-0.023661769926548004,
0.0104045569896698,
0.07172394543886185,
0.03216880187392235,
-0.060466136783361435,
-0.057511601597070694,
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 _post_validation(self):
poll = self.cleaned_data['poll']
choices = self.cleaned_data['choices']
# _post_validate_choices_limit()
choices_count = len(choices) + len(self.polls['choices'])
if choices_count > self.choices_limit:
raise ParserError('Choices limit has... | |
78 | [
0.04935294762253761,
0.012072248384356499,
0.05619610473513603,
0.005041690077632666,
0.008082421496510506,
-0.0069519709795713425,
-0.02998415194451809,
-0.004754543304443359,
0.006861292757093906,
0.053536221385002136,
0.02669556811451912,
-0.04587091505527496,
-0.04134911298751831,
0.02... | 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 _clean(self):
poll = self.cleaned_data['poll']
choices = self.cleaned_data['choices']
# Allow to use min without max (default max=choices_length)
if 'choice_min' in poll and 'choice_max' not in poll:
poll['choice_max'] = len(choices)
name = poll['name']
... | |
79 | [
0.02928231656551361,
0.02292860485613346,
0.0281510129570961,
0.052697643637657166,
0.05877510458230972,
0.012411439791321754,
-0.03762238100171089,
0.025046508759260178,
0.01856125146150589,
0.06745719164609909,
0.054039422422647476,
-0.016535431146621704,
-0.03359705209732056,
0.02851934... | 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 is_valid(self):
# In the spirit of markdown
# errors shouldn't and won't be displayed to the user
try:
self._pre_validation()
self._clean_poll()
self._clean_choices()
self._clean()
self._post_validation()
except ParserError ... | |
80 | [
0.04111860319972038,
0.0379440076649189,
0.043486956506967545,
-0.02695888839662075,
-0.015646234154701233,
-0.009076579473912716,
0.002933668904006481,
0.015558050945401192,
-0.06041814759373665,
0.013630615547299385,
-0.010500109754502773,
-0.028319431468844414,
0.021100999787449837,
0.0... | 11 | {"_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": "Author"}}, {"_type... | class Migration(migrations.Migration):
operations = [
migrations.CreateModel(
"Author",
[
("id", models.AutoField(primary_key=True)),
("name", models.CharField(max_length=255)),
("slug", models.SlugField(null=True)),
("... | |
81 | [
0.004326137714087963,
-0.014898630790412426,
-0.03994052857160568,
0.03277924656867981,
0.0108322873711586,
-0.005636403802782297,
-0.015915216878056526,
0.032011158764362335,
0.0048852600157260895,
0.03377324342727661,
0.017959684133529663,
-0.05399200692772865,
-0.012436234392225742,
0.0... | 11 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "id", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}}... | def get_post_comments(id):
post = Post.query.get_or_404(id)
page = request.args.get('page', 1, type=int)
pagination = post.comments.order_by(Comment.timestamp.asc()).paginate(
page, per_page=current_app.config['FLASKY_COMMENTS_PER_PAGE'],
error_out=False)
comments = pagination.items
... | |
82 | [
0.012009561993181705,
0.001120824832469225,
-0.03881082311272621,
0.004231167957186699,
0.017075370997190475,
0.013806359842419624,
-0.022419394925236702,
0.02879512868821621,
0.023903202265501022,
0.03009345941245556,
0.003350157756358385,
-0.04905836656689644,
-0.02770545706152916,
-0.00... | 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": "Call", "_fields": {"a... | def get_comments():
page = request.args.get('page', 1, type=int)
pagination = Comment.query.order_by(Comment.timestamp.desc()).paginate(
page, per_page=current_app.config['FLASKY_COMMENTS_PER_PAGE'],
error_out=False)
comments = pagination.items
prev = None
if pagination.has_prev:
... | |
83 | [
0.009468456730246544,
-0.032286666333675385,
0.02051796205341816,
-0.042581308633089066,
0.0032126184087246656,
0.00013364240294322371,
0.02296680398285389,
0.053874511271715164,
0.0061755976639688015,
-0.0000927324072108604,
-0.007061222102493048,
0.033237673342227936,
0.00937930028885603,
... | 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 WalletEncryptionTest(BitcoinTestFramework):
def set_test_params(self):
self.setup_clean_chain = True
self.num_nodes = 1
def run_test(self):
passphrase = "WalletPassphrase"
passphrase2 = "SecondWalletPassphrase"
# Make sure the wallet isn't encrypted first
... | |
84 | [
0.001396460342220962,
-0.00902219396084547,
-0.05380508303642273,
0.050139643251895905,
0.01931145414710045,
0.0047543286345899105,
-0.0039143310859799385,
0.04065926745533943,
0.033464137464761734,
0.01521611399948597,
0.023893259465694427,
-0.013021373189985752,
0.009519970044493675,
0.0... | 10 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "id", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}}... | def new_post_comment(id):
post = Post.query.get_or_404(id)
comment = Comment.from_json(request.json)
comment.author = g.current_user
comment.post = post
db.session.add(comment)
db.session.commit()
return jsonify(comment.to_json()), 201, \
{'Location': url_for('api.get_comment', id=co... | |
85 | [
0.04223428666591644,
-0.008199485018849373,
0.008175351656973362,
-0.03127750754356384,
0.006311009172350168,
0.008736464194953442,
0.025630179792642593,
0.04850909486413002,
0.048702169209718704,
0.003324441844597459,
0.0036140484735369682,
0.024290749803185463,
-0.010365501046180725,
-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_test(self):
passphrase = "WalletPassphrase"
passphrase2 = "SecondWalletPassphrase"
# Make sure the wallet isn't encrypted first
address = self.nodes[0].getnewaddress()
privkey = self.nodes[0].dumpprivkey(address)
assert_equal(privkey[:1], "c")
assert_equa... | |
86 | [
0.02960381843149662,
-0.01858625002205372,
-0.057572297751903534,
-0.015996964648365974,
-0.022391555830836296,
0.004041172564029694,
0.03218261897563934,
0.04478311166167259,
0.0022826597560197115,
-0.013606853783130646,
0.008653665892779827,
-0.018324175849556923,
-0.0026731493417173624,
... | 10 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "next", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "token", "annotation": null, "type_comment": null}}], "kwarg": nul... | def prepare_tag(next, token):
tag = token[1]
def select(context, result):
for elem in result:
for e in elem:
if e.tag == tag:
yield e
return select | |
87 | [
0.025360027328133583,
-0.01801304519176483,
-0.05499548092484474,
-0.007864533923566341,
-0.017349228262901306,
0.00025315023958683014,
0.03343833237886429,
0.05643562227487564,
0.006610033567994833,
0.01024414598941803,
-0.007830779999494553,
-0.037713758647441864,
0.024932485073804855,
0... | 10 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "next", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "token", "annotation": null, "type_comment": null}}], "kwarg": nul... | def prepare_iter(next, token):
token = next()
if token[0] == "*":
tag = "*"
elif not token[0]:
tag = token[1]
else:
raise SyntaxError
def select(context, result):
for elem in result:
for e in elem.iter(tag):
if e is not elem:
... | |
88 | [
0.055952753871679306,
-0.007559216581285,
-0.018856078386306763,
-0.009629468433558941,
-0.0016156357014551759,
0.00011610196088440716,
0.05326702073216438,
0.06991855800151825,
-0.027551135048270226,
-0.003164128167554736,
0.003902704454958439,
0.0022059371694922447,
0.01492819469422102,
... | 10 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "next", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "token", "annotation": null, "type_comment": null}}], "kwarg": nul... | def prepare_dot_dot(next, token):
def select(context, result):
parent_map = context.parent_map
if parent_map is None:
context.parent_map = parent_map = {}
for p in context.root.iter():
for e in p:
parent_map[e] = p
for elem in resul... | |
89 | [
0.06060241907835007,
-0.004019103478640318,
0.008974908851087093,
0.006894560065120459,
-0.03603033721446991,
0.0014853801112622023,
0.033394504338502884,
0.009748232550919056,
-0.057944800704717636,
0.004136191215366125,
0.0101839080452919,
-0.007085167802870274,
0.03929790109395981,
-0.0... | 9 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "context", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "result", "annotation": null, "type_comment": null}}], "kwarg":... | def select(context, result):
parent_map = context.parent_map
if parent_map is None:
context.parent_map = parent_map = {}
for p in context.root.iter():
for e in p:
parent_map[e] = p
for elem in result:
if elem in parent_map:
... | |
90 | [
0.019877033308148384,
0.01960129663348198,
-0.04699515551328659,
-0.024037063121795654,
0.04586823284626007,
0.032992519438266754,
0.028245048597455025,
0.05298943817615509,
0.028700612485408783,
0.01616057939827442,
0.013151451013982296,
-0.04397403821349144,
0.03639727085828781,
-0.00061... | 13 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "next", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "token", "annotation": null, "type_comment": null}}], "kwarg": nul... | def prepare_predicate(next, token):
# this one should probably be refactored...
token = next()
if token[0] == "@":
# attribute
token = next()
if token[0]:
raise SyntaxError("invalid attribute predicate")
key = token[1]
token = next()
if token[0] ==... | |
91 | [
0.016731416806578636,
-0.029675934463739395,
0.03374863415956497,
-0.02736569009721279,
0.03432024270296097,
0.028389818966388702,
-0.0011722410563379526,
0.04529986158013344,
0.01633843593299389,
0.0017311954870820045,
0.013408949598670006,
-0.05058722943067551,
-0.006555618718266487,
0.0... | 10 | {"_type": "Module", "_fields": {"body": [{"_type": "ClassDef", "_fields": {"body": [{"_type": "Assign", "_fields": {"value": {"_type": "Constant", "_fields": {"kind": null, "value": true}}, "targets": [{"_type": "Name", "_fields": {"id": "ses", "ctx": {"_type": "Store", "_fields": {}}}}], "type_comment": null}}, {"_typ... | class SESConnectionTest(unittest.TestCase):
ses = True
def setUp(self):
self.ses = SESConnection()
def test_get_dkim_attributes(self):
response = self.ses.get_identity_dkim_attributes(['example.com'])
# Verify we get the structure we expect, we don't care about the
# values... | |
92 | [
0.05693933367729187,
0.04264114052057266,
0.01754010282456875,
-0.007856613956391811,
0.007196616381406784,
0.03043382056057453,
0.02927222289144993,
-0.028469666838645935,
0.02658999338746071,
0.02996918186545372,
0.019683774560689926,
-0.031827736645936966,
0.0634865090250969,
-0.0609943... | 13 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "elem", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "path", "annotation": null, "type_comment": null}}], "kwarg": null... | def findall(elem, path):
# compile selector pattern
try:
selector = _cache[path]
except KeyError:
if len(_cache) > 100:
_cache.clear()
if path[:1] == "/":
raise SyntaxError("cannot use absolute path on element")
stream = iter(xpath_tokenizer(path))
... | |
93 | [
0.01589423231780529,
-0.0024380043614655733,
0.010596155188977718,
-0.04718288034200668,
0.005031507462263107,
-0.044295039027929306,
-0.005803450010716915,
0.009046717546880245,
0.012417716905474663,
0.02401350811123848,
0.033410098403692245,
-0.05011514946818352,
0.009874194860458374,
-0... | 11 | {"_type": "Module", "_fields": {"body": [{"_type": "ClassDef", "_fields": {"body": [{"_type": "Assign", "_fields": {"value": {"_type": "Constant", "_fields": {"kind": null, "value": "aiDaemonService"}}, "targets": [{"_type": "Name", "_fields": {"id": "_svc_name_", "ctx": {"_type": "Store", "_fields": {}}}}], "type_comm... | class aservice(win32serviceutil.ServiceFramework):
_svc_name_ = "aiDaemonService"
_svc_display_name_ = "AI connection daemon service"
_svc_description_ = "AI Daemon to handle USB and Emulator connections for App Inventor"
def __init__(self, args):
win32serviceutil.ServiceFramework.__init__(sel... | |
94 | [
0.011600063182413578,
0.004493169020861387,
-0.011048689484596252,
-0.0041273534297943115,
0.03950807824730873,
0.016117090359330177,
-0.023030472919344902,
0.014261503703892231,
0.023709088563919067,
0.01181213092058897,
0.023284953087568283,
-0.05598568171262741,
0.00000814925351733109,
... | 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_get_dkim_attributes(self):
response = self.ses.get_identity_dkim_attributes(['example.com'])
# Verify we get the structure we expect, we don't care about the
# values.
self.assertTrue('GetIdentityDkimAttributesResponse' in response)
self.assertTrue('GetIdentityDkimAttrib... | |
95 | [
0.016634605824947357,
0.030631884932518005,
-0.02011501044034958,
-0.0617825873196125,
0.03402581810951233,
0.024622241035103798,
0.03406905382871628,
-0.012938026338815689,
0.010349339805543423,
0.0025238338857889175,
0.01060334499925375,
-0.017304744571447372,
0.006387947592884302,
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}}, {"_type": "arg", "_fields": {"arg": "path", "annotation": n... | class ConfigReader(object):
def __init__(self, path = None):
self.path = os.path.abspath(path) if path is not None else None;
if os.path.exists(path):
x = codecs.open(path, encoding='utf-8')
self.data = json.loads(json_minify(x.read()))
x.close()
else:
... | |
96 | [
0.013490010984241962,
0.06423814594745636,
0.03702453151345253,
-0.03786546736955643,
-0.022588469088077545,
-0.011778940446674824,
0.023990027606487274,
0.004213438369333744,
0.01904953084886074,
0.033380478620529175,
0.007545062340795994,
-0.03204899653792381,
0.017063988372683525,
-0.04... | 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 SvcDoRun(self):
PLATDIR = os.environ["ProgramFiles"]
PLATDIR = '"' + PLATDIR + '"'
servicemanager.LogMsg(servicemanager.EVENTLOG_INFORMATION_TYPE,servicemanager.PYS_SERVICE_STARTED,(self._svc_name_, ''))
self.timeout = 1000 #1 seconds
# This is how long the service wil... | |
97 | [
0.055711522698402405,
0.027983736246824265,
0.026106778532266617,
-0.03519296273589134,
0.033657267689704895,
0.028900885954499245,
-0.0004885689704678953,
0.008281010203063488,
0.012413517571985722,
-0.03775244951248169,
0.027685130015015602,
0.003071385668590665,
-0.0026608011685311794,
... | 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 save(self):
if not os.path.exists(os.path.dirname(self.path)):
dir_path = os.path.dirname(self.path)
os.makedirs(dir_path)
x = codecs.open(self.path, 'w+', encoding='utf-8')
json.dump(self.data, x)
x.close() | |
98 | [
0.019919084385037422,
0.04561747610569,
-0.017944656312465668,
-0.0253796074539423,
0.026346253231167793,
0.0219449270516634,
0.031056081876158714,
-0.026942694559693336,
0.04356078431010246,
0.012957173399627209,
0.04298491030931473,
0.013461063615977764,
-0.012895472347736359,
-0.0321666... | 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": "path", "annotation": null, "type_comment": null}}], "kwarg": null... | def __init__(self, path = None):
self.path = os.path.abspath(path) if path is not None else None;
if os.path.exists(path):
x = codecs.open(path, encoding='utf-8')
self.data = json.loads(json_minify(x.read()))
x.close()
else:
self.data = {} | |
99 | [
0.02598099410533905,
0.025451170280575752,
-0.01146970596164465,
-0.01502148900181055,
-0.021958258002996445,
0.01771966554224491,
-0.002460247138515115,
0.012235007248818874,
0.001939008361659944,
0.006166561506688595,
0.016561903059482574,
0.023508483543992043,
-0.016032079234719276,
-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": "Assign", "_fields": {"value": {"_type": "List", "_fields": {"c... | def get_current_git_branch():
command = ["git", "symbolic-ref", "--short", "-q", "HEAD"]
try:
proc = subprocess.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
out, _ = proc.communicate()
return out.strip().decode("utf-8")
except subprocess.CalledProcessError:
... | |
100 | [
-0.004301528912037611,
0.004132439848035574,
0.03578544408082962,
0.01847684755921364,
0.013342682272195816,
-0.015894394367933273,
-0.0056260619312524796,
-0.017687764018774033,
-0.038839299231767654,
0.04125778749585152,
0.009381894022226334,
0.00847495999187231,
-0.01095493696630001,
-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": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fie... | def find_hg_root():
def get_parent_dir(directory):
return os.path.abspath(os.path.join(directory, os.pardir))
cwd = os.getcwd()
while True:
pardir = get_parent_dir(cwd)
hgroot = os.path.join(cwd, ".hg")
if os.path.isdir(hgroot):
return hgroot
if cwd == ... |