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 |
|---|---|---|---|---|---|
17,801 | [
0.06562476605176926,
0.019458772614598274,
0.005379172973334789,
-0.022465622052550316,
-0.02629563771188259,
-0.007174136117100716,
0.013628000393509865,
0.015788815915584564,
-0.03896327689290047,
-0.018121125176548958,
-0.0248322281986475,
-0.026135578751564026,
0.0021236585453152657,
-... | 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 insert_cover(self):
if not isinstance(self.cover_data, bytes):
return
item_path = os.path.join(self.tmp_path, 'cover.pdf')
printer = get_pdf_printer(self.opts, output_file_name=item_path,
for_comic=True)
self.combine_queue.insert(0, item_path)
p = ... | |
17,802 | [
0.009845401160418987,
-0.024354413151741028,
0.024342361837625504,
-0.051962509751319885,
0.014460809528827667,
0.006802605930715799,
-0.01788320019841194,
-0.004256900865584612,
0.010839581489562988,
0.00040445078047923744,
0.05287836119532585,
-0.04150252416729927,
0.04123741015791893,
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 FunctionSourceTest(unittest.TestCase):
def testDefaultArgs(self):
fs = FunctionSource(dataFunction, state=None, resetFieldName=None,
sequenceIdFieldName=None)
self.assertIsNotNone(fs)
r = fs.getNextRecordDict()
self.assertIsNotNone(r)
def testResetField(self):
f... | |
17,803 | [
0.07394549250602722,
0.037225984036922455,
-0.017553996294736862,
-0.0218935739248991,
-0.05539005249738693,
-0.05654113367199898,
-0.002408638596534729,
-0.006210085935890675,
-0.010371246375143528,
0.0016158309299498796,
0.005870516877621412,
0.00296403537504375,
-0.010411534458398819,
-... | 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": "outpath", "annotation": null, "type_comment": null}}, {"_type": "... | def render_images(self, outpath, mi, items):
printer = get_pdf_printer(self.opts, for_comic=True,
output_file_name=outpath)
printer.setDocName(mi.title)
painter = QPainter(printer)
painter.setRenderHints(QPainter.Antialiasing|QPainter.SmoothPixmapTransform)
for ... | |
17,804 | [
0.027949340641498566,
-0.0054435464553534985,
0.009784847497940063,
-0.0022189945448189974,
0.005810962058603764,
-0.00003499912054394372,
-0.019518127664923668,
-0.0173136368393898,
0.008102472871541977,
-0.0017339420737698674,
0.05185066908597946,
-0.03354436531662941,
0.002762060146778822... | 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 testState(self):
state = dict(val=100)
fs = FunctionSource(dataFunction, state=state, resetFieldName="reset",
sequenceIdFieldName="sequence")
self.assertIsNotNone(fs)
r = fs.getNextRecordDict()
self.assertIsNotNone(r)
r = fs.getNextRecordDict()
r = fs.getNextRecor... | |
17,805 | [
0.021733786910772324,
-0.033467989414930344,
-0.007231840863823891,
-0.017971187829971313,
0.0028219486121088266,
0.04680927097797394,
-0.026248903945088387,
-0.011472735553979874,
-0.014667754992842674,
-0.020598629489541054,
0.07203780859708786,
-0.03545770421624184,
0.029641618952155113,
... | 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 testPickle(self):
state = dict(val=100)
fs = FunctionSource(dataFunction, state=state, resetFieldName="reset",
sequenceIdFieldName="sequence")
self.assertIsNotNone(fs)
r = fs.getNextRecordDict()
self.assertIsNotNone(r)
pkl = pickle.dumps(fs)
self.assertIsNotNone(... | |
17,806 | [
-0.005721790716052055,
-0.009645930491387844,
-0.003159981919452548,
0.05767514929175377,
-0.0029501516837626696,
-0.06549211591482162,
-0.02673300914466381,
-0.018890991806983948,
0.03863383084535599,
0.03171882778406143,
0.008549802005290985,
-0.011944669298827648,
0.029238445684313774,
... | 12 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "state", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": [... | def translate_persona_state(state):
if state is 0:
return "oflain"
elif state is 1:
return "omlain"
elif state is 2:
return "o cu paod"
elif state is 3:
return "auei"
elif state is 4:
return "durmino MAS Q DORMINHIOC"
elif state is 5:
r... | |
17,807 | [
0.009403803385794163,
-0.01311509683728218,
-0.030270760878920555,
-0.04399975761771202,
0.03431132808327675,
-0.015269321389496326,
-0.030427025631070137,
-0.006769622676074505,
-0.02837325632572174,
0.019042005762457848,
0.047995675355196,
-0.02379692532122135,
0.046388376504182816,
-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": "Assign", "_fields": {"val... | def get_ids():
if os.path.isfile("data/steam.json"):
id_str = ""
with open("data/steam.json") as fp:
steamDict = json.load(fp)
for tg_id, steam_id in steamDict.items():
id_str += str(steam_id) + ","
return id_str
else:
raise FileNotF... | |
17,808 | [
0.027881283313035965,
0.019798146560788155,
-0.024692319333553314,
0.01396278664469719,
-0.00958903506398201,
0.004739153664559126,
-0.0399063304066658,
-0.03496786579489708,
0.022012704983353615,
-0.0026090259198099375,
0.018104009330272675,
-0.021547647193074226,
0.017528224736452103,
0.... | 9 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "name", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []... | def __getattr__(name):
if name not in __all__:
raise AttributeError(
"scipy.special.sf_error is deprecated and has no attribute "
f"{name}. Try looking in scipy.special instead.")
warnings.warn(f"Please use `{name}` from the `scipy.special` namespace, "
"the `s... | |
17,809 | [
-0.011361305601894855,
-0.030807077884674072,
-0.04044624790549278,
-0.046760741621255875,
0.025497162714600563,
-0.03135720267891884,
-0.023308616131544113,
0.0035369538236409426,
0.027314970269799232,
-0.001473979908041656,
0.030352625995874405,
-0.06367114931344986,
-0.016336362808942795,... | 9 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}}, "body": [{"_type": "Assign", "_fields": {"value": {"_type": "Constant", "_fields":... | def query_steam():
url = "http://api.steampowered.com/ISteamUser/GetPlayerSummaries/v0002/"
params = {
"key": os.environ["STEAMKEY"],
"steamids": get_ids()
}
response = requests.get(url, params)
response = json.loads(response.content)
message = ""
for player ... | |
17,810 | [
0.03787052258849144,
-0.02262864075601101,
0.0513058602809906,
-0.0017663990147411823,
0.013361738063395023,
-0.02780740149319172,
-0.02079533413052559,
0.019524062052369118,
0.0006084541673772037,
-0.03152754530310631,
0.02185249701142311,
-0.01546937320381403,
-0.013100792653858662,
-0.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 _initial_instance_usage(self):
self.allocations = collections.defaultdict(list)
self.claims = collections.defaultdict(list)
for dev in self.pci_devs:
uuid = dev['instance_uuid']
if dev['status'] == 'claimed':
self.claims[uuid].append(dev)
e... | |
17,811 | [
0.025163106620311737,
-0.00604952871799469,
-0.007933707907795906,
-0.015818554908037186,
-0.0021758147049695253,
0.016673613339662552,
-0.013595406897366047,
0.04270399361848831,
0.006895424332469702,
-0.0011848647845909,
0.0320524238049984,
0.0011131010251119733,
-0.003936316352337599,
-... | 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": "context", "annotation": null, "type_comment": null}}], "kwarg": n... | def save(self, context):
for dev in self.pci_devs:
if dev.obj_what_changed():
with dev.obj_alternate_context(context):
dev.save()
self.pci_devs = [dev for dev in self.pci_devs
if dev['status'] != 'deleted'] | |
17,812 | [
0.017000604420900345,
0.0015981132164597511,
0.022826163098216057,
-0.004459996707737446,
0.029115259647369385,
-0.032798513770103455,
-0.029165372252464294,
0.02723604626953602,
0.009565189480781555,
-0.03046829253435135,
0.025056160986423492,
0.030092449858784676,
-0.01899256929755211,
-... | 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": "context", "annotation": null, "type_comment": null}}, {"_type": "... | def _claim_instance(self, context, instance, prefix=''):
pci_requests = objects.InstancePCIRequests.get_by_instance(
context, instance)
if not pci_requests.requests:
return None
instance_numa_topology = hardware.instance_topology_from_instance(
instance)
... | |
17,813 | [
0.030565397813916206,
0.006070975214242935,
0.016625482589006424,
-0.006520466413348913,
0.036050327122211456,
-0.03231784328818321,
-0.03828071430325508,
0.057580385357141495,
-0.01639789156615734,
-0.026491528376936913,
0.030565397813916206,
0.03379718214273453,
-0.06568260490894318,
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": "instance", "annotation": null, "type_comment": null}}], "kwarg": ... | def _free_instance(self, instance):
# Note(yjiang5): When a instance is resized, the devices in the
# destination node are claimed to the instance in prep_resize stage.
# However, the instance contains only allocated devices
# information, not the claimed one. So we can't use
# i... | |
17,814 | [
0.014999412931501865,
-0.011016517877578735,
-0.002468123799189925,
-0.045591436326503754,
0.03946879506111145,
0.04175683856010437,
-0.011133038438856602,
-0.012001648545265198,
-0.0029898195061832666,
0.018770452588796616,
0.031672488898038864,
0.0038319474551826715,
0.03328259661793709,
... | 9 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}}, "body": [{"_type": "Assign", "_fields": {"value": {"_type": "List", "_fields": {"c... | def test_Chart_load_dict():
data = [
{
"date": "2017-10-01",
"close": 10,
},
{
"date": "2017-10-02",
"close": 20,
},
]
chart = Chart()
chart.load_dict(data)
assert len(chart.bars) == 2
assert chart.bars.close[0] == 1... | |
17,815 | [
0.01573483645915985,
-0.005377298220992088,
-0.010550394654273987,
-0.0679309293627739,
0.029745306819677353,
0.05781162530183792,
-0.005587171297520399,
-0.036279745399951935,
0.020102472975850105,
0.031220093369483948,
0.011820980347692966,
-0.016982732340693474,
0.007413637824356556,
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": "Assign", "_fields": {"value": {"_type": "List", "_fields": {"c... | def test_Chart_load_dict_sets_log_return():
data = [
{
"date": "2017-01-01",
"close": 10,
},
{
"date": "2017-01-02",
"close": 20,
},
{
"date": "2017-01-03",
"close": 15,
},
]
chart = Chart... | |
17,816 | [
0.014006514102220535,
0.011940584518015385,
0.031013546511530876,
-0.026832496747374535,
0.013440842740237713,
0.03922807797789574,
-0.014609077014029026,
-0.0005376183544285595,
0.05140230804681778,
0.04360588267445564,
0.02272523194551468,
0.030620034784078598,
-0.02396724931895733,
0.02... | 13 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}}, "body": [{"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"a... | def test_Chart_get_volatilities():
chart = Chart()
chart.load_dict([
{
"date": "2017-01-04",
"close": 100,
},
{
"date": "2017-01-02",
"close": 110,
},
{
"date": "2017-01-03",
"close": 90,
},
... | |
17,817 | [
0.02237260341644287,
-0.024352770298719406,
0.014867661520838737,
-0.06555336713790894,
0.043038543313741684,
0.0451609343290329,
-0.03903444856405258,
-0.03240472078323364,
-0.0043596490286290646,
0.015294327400624752,
0.030369851738214493,
0.009922714903950691,
0.014812961220741272,
0.01... | 9 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}}, "body": [{"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"a... | def test_Chart_bars_ordered_by_date_descending():
chart = Chart()
chart.load_dict([
{
"date": "2017-01-01",
"close": 10,
},
{
"date": "2017-01-02",
"close": 11,
},
{
"date": "2017-01-03",
"close": 12,... | |
17,818 | [
0.0031067878007888794,
0.017870448529720306,
0.007936716079711914,
-0.019696293398737907,
-0.05897476524114609,
0.04669596254825592,
0.014264406636357307,
-0.006367631256580353,
0.019479474052786827,
0.000753873900976032,
0.005922581534832716,
0.040396798402071,
0.030742648988962173,
0.000... | 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": "Dict", "_fields": {"k... | def GetUnsavedAndCurrentBufferData():
buffers_data = {}
for buffer_object in vim.buffers:
if not ( BufferModified( buffer_object ) or
buffer_object == vim.current.buffer ):
continue
buffers_data[ GetBufferFilepath( buffer_object ) ] = {
'contents': '\n'.join( buffer_object ),
... | |
17,819 | [
-0.015690894797444344,
0.009268546476960182,
-0.004069940652698278,
-0.03336922079324722,
-0.0185493603348732,
0.048287224024534225,
0.007397661916911602,
-0.047624748200178146,
0.009538444690406322,
0.04961217939853668,
0.0058641498908400536,
0.011323452927172184,
-0.027652287855744362,
0... | 9 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "version_string", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonl... | def VimVersionAtLeast( version_string ):
major, minor, patch = [ int( x ) for x in version_string.split( '.' ) ]
# For Vim 7.4.301, v:version is '704'
actual_major_and_minor = GetIntValue( 'v:version' )
if actual_major_and_minor != major * 100 + minor:
return False
return GetBoolValue( 'has("patch{0}")'... | |
17,820 | [
0.01796623133122921,
-0.03331706300377846,
-0.0016882987692952156,
-0.004293939098715782,
-0.03474187105894089,
0.026134474202990532,
0.018717670813202858,
-0.01286229956895113,
0.01989850401878357,
0.03076021745800972,
0.03154093399643898,
0.024865809828042984,
0.054884348064661026,
-0.04... | 9 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "buffer_object", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonly... | def GetBufferFilepath( buffer_object ):
if buffer_object.name:
return buffer_object.name
# Buffers that have just been created by a command like :enew don't have any
# buffer name so we use the buffer number for that. Also, os.getcwd() throws
# an exception when the CWD has been deleted so we handle that.
... | |
17,821 | [
0.014170102775096893,
0.05110440030694008,
0.0020081079564988613,
0.005731651093810797,
-0.026851465925574303,
0.02702740766108036,
-0.006997080519795418,
-0.10210052877664566,
-0.02798832207918167,
0.020043861120939255,
0.007348964456468821,
0.02103184349834919,
0.017228787764906883,
0.03... | 7 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "sign_id", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "line_num", "annotation": null, "type_comment": null}}, {"_type... | def PlaceSign( sign_id, line_num, buffer_num, is_error = True ):
# libclang can give us diagnostics that point "outside" the file; Vim borks
# on these.
if line_num < 1:
line_num = 1
sign_name = 'YcmError' if is_error else 'YcmWarning'
vim.command( 'sign place {0} line={1} name={2} buffer={3}'.format(
... | |
17,822 | [
0.033158715814352036,
0.01706249825656414,
-0.008194321766495705,
0.003002147888764739,
-0.04404209554195404,
0.025097891688346863,
-0.003973197191953659,
-0.05680718272924423,
0.011188522912561893,
0.0033915210515260696,
0.0028813625685870647,
0.011309308931231499,
0.01553679071366787,
0.... | 7 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "sign_id", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "buffer_num", "annotation": null, "type_comment": null}}, {"_ty... | def PlaceDummySign( sign_id, buffer_num, line_num ):
if buffer_num < 0 or line_num < 0:
return
vim.command( 'sign define ycm_dummy_sign' )
vim.command(
'sign place {0} name=ycm_dummy_sign line={1} buffer={2}'.format(
sign_id,
line_num,
buffer_num,
)
) | |
17,823 | [
-0.010849774815142155,
0.005956449545919895,
0.015486178919672966,
-0.016950927674770355,
-0.03631160408258438,
0.0533452183008194,
-0.010205994360148907,
-0.05381771922111511,
0.007707651704549789,
0.021675925701856613,
-0.011983774602413177,
-0.04531272500753403,
0.050888221710920334,
0.... | 8 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "line_num", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "column_num", "annotation": null, "type_comment": null}}, {"_t... | def AddDiagnosticSyntaxMatch( line_num,
column_num,
line_end_num = None,
column_end_num = None,
is_error = True ):
group = 'YcmErrorSection' if is_error else 'YcmWarningSection'
if not line_end_n... | |
17,824 | [
-0.0068816072307527065,
0.050814662128686905,
0.04989711195230484,
-0.017739253118634224,
-0.011665962636470795,
0.0467512346804142,
0.036374207586050034,
-0.03954193368554115,
-0.02191191166639328,
0.038515154272317886,
-0.02363777346909046,
0.021573292091488838,
0.0007379977614618838,
0.... | 9 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "line_num", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "column_num", "annotation": null, "type_comment": null}}], "kw... | def LineAndColumnNumbersClamped( line_num, column_num ):
new_line_num = line_num
new_column_num = column_num
max_line = len( vim.current.buffer )
if line_num and line_num > max_line:
new_line_num = max_line
max_column = len( vim.current.buffer[ new_line_num - 1 ] )
if column_num and column_num > max_c... | |
17,825 | [
-0.03382187336683273,
0.0013514647725969553,
0.0038428606931120157,
-0.0038105431012809277,
-0.021059345453977585,
0.0010062536457553506,
-0.0991857573390007,
-0.03196508064866066,
-0.00726852985098958,
0.02698228694498539,
-0.0075094434432685375,
0.00018389835895504802,
0.006821958813816309... | 9 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "diagnostics", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyar... | def ConvertDiagnosticsToQfList( diagnostics ):
def ConvertDiagnosticToQfFormat( diagnostic ):
# see :h getqflist for a description of the dictionary fields
# Note that, as usual, Vim is completely inconsistent about whether
# line/column numbers are 1 or 0 based in its various APIs. Here, it wants
# t... | |
17,826 | [
-0.02801704965531826,
0.07715319097042084,
0.001017271657474339,
-0.020540324971079826,
-0.011604869738221169,
-0.007175530306994915,
-0.031088057905435562,
-0.011374544352293015,
0.036686744540929794,
-0.016902359202504158,
0.014339248649775982,
-0.0004170961328782141,
-0.007512160111218691... | 9 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "force_python_objects", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [{"_type": "Constant", "_fields": {"kind":... | def GetReadOnlyVimGlobals( force_python_objects = False ):
if force_python_objects:
return vim.eval( 'g:' )
try:
# vim.vars is fairly new so it might not exist
return vim.vars
except:
return vim.eval( 'g:' ) | |
17,827 | [
-0.027972495183348656,
0.02500114217400551,
-0.006621704436838627,
0.004137840121984482,
-0.0015567679656669497,
0.003670664504170418,
-0.0685732364654541,
-0.038116876035928726,
-0.022470850497484207,
0.020161088556051254,
0.0027130998205393553,
0.015704059973359108,
0.01945307105779648,
... | 8 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "diagnostic", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyarg... | def ConvertDiagnosticToQfFormat( diagnostic ):
# see :h getqflist for a description of the dictionary fields
# Note that, as usual, Vim is completely inconsistent about whether
# line/column numbers are 1 or 0 based in its various APIs. Here, it wants
# them to be 1-based.
location = diagnostic[ 'lo... | |
17,828 | [
-0.00630051689222455,
0.040666550397872925,
-0.004225217271596193,
-0.01770300790667534,
-0.032384004443883896,
-0.0199601873755455,
-0.0034976964816451073,
0.01932593807578087,
0.03740203380584717,
0.012190638110041618,
-0.0022641755640506744,
-0.019456518813967705,
0.027067506685853004,
... | 7 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "vim_expression", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonl... | def VimExpressionToPythonType( vim_expression ):
result = vim.eval( vim_expression )
if not isinstance( result, basestring ):
return result
try:
return int( result )
except ValueError:
return result | |
17,829 | [
-0.021919092163443565,
0.0700356587767601,
0.0156941507011652,
-0.014092293567955494,
-0.002765232464298606,
-0.0055000497959554195,
0.018573440611362457,
-0.032909054309129715,
-0.015481246635317802,
-0.008252609521150589,
-0.024413125589489937,
0.03090166300535202,
0.051340557634830475,
... | 11 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "filename", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "line", "annotation": null, "type_comment": null}}, {"_type": ... | def TryJumpLocationInOpenedTab( filename, line, column ):
filepath = os.path.realpath( filename )
for tab in vim.tabpages:
for win in tab.windows:
if win.buffer.name == filepath:
vim.current.tabpage = tab
vim.current.window = win
vim.current.window.cursor = ( line, column - 1 )
... | |
17,830 | [
-0.004760921001434326,
0.03830268606543541,
0.028565524145960808,
-0.01370858121663332,
-0.04777667671442032,
-0.002365507883951068,
-0.02336200512945652,
-0.02113705314695835,
0.0018167458474636078,
0.0386136993765831,
-0.03715432062745094,
0.03605380654335022,
0.0021576660219579935,
0.04... | 9 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "text", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []... | def EchoTextVimWidth( text ):
vim_width = GetIntValue( '&columns' )
truncated_text = ToUtf8IfNeeded( text )[ : int( vim_width * 0.9 ) ]
truncated_text.replace( '\n', ' ' )
old_ruler = GetIntValue( '&ruler' )
old_showcmd = GetIntValue( '&showcmd' )
vim.command( 'set noruler noshowcmd' )
EchoText( truncat... | |
17,831 | [
-0.02270358055830002,
0.06646719574928284,
0.05885022133588791,
-0.03724611550569534,
-0.02020992711186409,
-0.0013006669469177723,
-0.006727196741849184,
-0.011799514293670654,
-0.015256624668836594,
0.0014848572900518775,
-0.01057535782456398,
0.02813294343650341,
0.03588594123721123,
0.... | 11 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "filename", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "line", "annotation": null, "type_comment": null}}, {"_type": ... | def JumpToLocation( filename, line, column ):
# Add an entry to the jumplist
vim.command( "normal! m'" )
if filename != GetCurrentBufferFilepath():
# We prefix the command with 'keepjumps' so that opening the file is not
# recorded in the jumplist. So when we open the file and move the cursor to
# a ... | |
17,832 | [
0.018745459616184235,
-0.02788030169904232,
0.07050956785678864,
-0.037538494914770126,
0.021421682089567184,
0.002468072809278965,
0.0017975301016122103,
-0.01388067938387394,
0.010383747518062592,
-0.0002629761293064803,
-0.014653810299932957,
-0.010556215420365334,
-0.023681605234742165,
... | 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 Concat(unittest.TestCase):
def setUp(self):
self.y0 = numpy.arange(42, dtype=numpy.float32).reshape(2, 7, 3)
self.xs0 = [self.y0[:, :2], self.y0[:, 2:5], self.y0[:, 5:]]
self.y1 = numpy.arange(21, dtype=numpy.float32).reshape(7, 3)
self.xs1 = [self.y1[:2], self.y1[2:5], self.... | |
17,833 | [
0.05343938246369362,
0.014498602598905563,
0.044188451021909714,
-0.013031132519245148,
0.04064304381608963,
0.04670076072216034,
0.011880636215209961,
-0.027024924755096436,
0.00442295428365469,
0.0016127494163811207,
0.011992163956165314,
-0.034280095249414444,
-0.048414766788482666,
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": "xs_data", "annotation": null, "type_comment": null}}, {"_type": "... | def check_backward(self, xs_data, axis):
xs = tuple(chainer.Variable(x_data) for x_data in xs_data)
y = functions.concat(xs, axis=axis)
y.grad = y.data
y.backward()
for x in xs:
gradient_check.assert_allclose(x.data, x.grad, atol=0, rtol=0) | |
17,834 | [
-0.011406061239540577,
-0.024268215522170067,
-0.06577841937541962,
-0.06642557680606842,
0.025839870795607567,
-0.0281511303037405,
0.024915367364883423,
0.003709570039063692,
0.02102089673280716,
0.01770424097776413,
0.0512637160718441,
-0.03076285310089588,
-0.009100580587983131,
-0.043... | 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": "url", "annotation": null, "type_comment": null}}], "kwarg": null,... | def _real_extract(self, url):
video_id = self._match_id(url)
webpage = self._download_webpage(url, video_id)
m_id = re.search(r'var rmcPlayer = new nhn.rmcnmv.RMCVideoPlayer\("(.+?)", "(.+?)"',
webpage)
if m_id is None:
m_error = re.search(
... | |
17,835 | [
-0.019620750099420547,
-0.004905187524855137,
-0.0724819153547287,
-0.06685589253902435,
0.023699617013335228,
-0.025762490928173065,
-0.0031382653396576643,
0.000859286927152425,
0.0020057354122400284,
0.03190423175692558,
0.04205451160669327,
-0.016702251508831978,
-0.024473194032907486,
... | 12 | {"_type": "Module", "_fields": {"body": [{"_type": "ClassDef", "_fields": {"body": [{"_type": "Assign", "_fields": {"value": {"_type": "Constant", "_fields": {"kind": null, "value": "https?://(?:m\\.)?tvcast\\.naver\\.com/v/(?P<id>\\d+)"}}, "targets": [{"_type": "Name", "_fields": {"id": "_VALID_URL", "ctx": {"_type": ... | class NaverIE(InfoExtractor):
_VALID_URL = r'https?://(?:m\.)?tvcast\.naver\.com/v/(?P<id>\d+)'
_TEST = {
'url': 'http://tvcast.naver.com/v/81652',
'info_dict': {
'id': '81652',
'ext': 'mp4',
'title': '[9월 모의고사 해설강의][수학_김상희] 수학 A형 16~20번',
'descri... | |
17,836 | [
0.01563701406121254,
0.04738984629511833,
0.07740263640880585,
0.00023538728419225663,
-0.013067826628684998,
-0.001164163462817669,
0.04853430390357971,
-0.016723081469535828,
-0.025341540575027466,
-0.03213820978999138,
0.0007860840414650738,
-0.07459988445043564,
0.047436557710170746,
-... | 10 | {"_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 setup_mappers(cls):
addresses_table, User, users_table, Address = (cls.tables.addresses_table,
cls.classes.User,
cls.tables.users_table,
cls.classes.Address)
mapper(User, users_table, properties=dict(
... | |
17,837 | [
0.006322314031422138,
0.05817652866244316,
0.09225521236658096,
-0.016567273065447807,
0.04237355664372444,
0.02517686039209366,
0.03751801699399948,
-0.03623669594526291,
-0.04309289529919624,
-0.003821487771347165,
0.009542479179799557,
-0.04068760573863983,
0.05615339055657387,
-0.03272... | 8 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "cls", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "metadata", "annotation": null, "type_comment": null}}], "kwarg": n... | def define_tables(cls, metadata):
Table('users_table', metadata,
Column('id', Integer, primary_key=True),
Column('name', String(64)))
Table('addresses_table', metadata,
Column('id', Integer, primary_key=True),
Column('user_id', Integer, ForeignKey... | |
17,838 | [
0.013269470073282719,
0.004843730479478836,
0.0369962640106678,
-0.03552069142460823,
0.00675769941881299,
-0.04465214163064957,
0.010034970007836819,
0.03321109712123871,
0.01046267244964838,
0.05025504156947136,
-0.010692561976611614,
0.0071426318027079105,
0.02480674535036087,
-0.022304... | 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": "Call", "_fields": {"a... | def _iris_data_input_fn():
# Converts iris data to a logistic regression problem.
iris = base.load_iris()
ids = np.where((iris.target == 0) | (iris.target == 1))
features = constant_op.constant(iris.data[ids], dtype=dtypes.float32)
labels = constant_op.constant(iris.target[ids], dtype=dtypes.float32)
labels... | |
17,839 | [
0.018873155117034912,
-0.0283152274787426,
-0.01918092928826809,
-0.018433477729558945,
0.005083770491182804,
0.02539137378334999,
-0.0326460525393486,
0.02616080828011036,
-0.04174737259745598,
-0.034998323768377304,
0.00401480495929718,
-0.032074470072984695,
0.02532542124390602,
0.00713... | 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": "ident", "annotation": ... | class MyQuery(Query):
def get(self, ident, **kwargs):
if ident in cache:
return cache[ident]
else:
x = super(MyQuery, self).get(ident)
cache[ident] = x
return x | |
17,840 | [
-0.028827279806137085,
-0.08619561046361923,
0.04354759305715561,
-0.004104309249669313,
-0.0034321839921176434,
-0.004400760401040316,
0.0219986904412508,
-0.05593718960881233,
0.004582208581268787,
0.028438827022910118,
-0.05867680162191391,
-0.04240267723798752,
0.006240799091756344,
-0... | 12 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "A", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "B", "annotation": null, "type_comment": null}}], "kwarg": null, "var... | def distance(A, B):
lat1, lon1 = A
lat2, lon2 = B
R = 6371000
Haversine = (math.sin(math.radians((lat2 - lat1) / 2)))**2 + \
math.cos(math.radians(lat1)) * \
math.cos(math.radians(lat2)) * \
(math.sin(math.radians((lon2 - lon1) / 2)))**2
d = R * 2 * math.atan2(math.sqrt(Haver... | |
17,841 | [
0.01249493658542633,
0.030784936621785164,
0.014660007320344448,
-0.04726532846689224,
0.0022243140265345573,
0.00004302287197788246,
0.05101380869746208,
0.0022593215107917786,
0.019324064254760742,
0.04455091059207916,
-0.03963910788297653,
0.0033122352324426174,
-0.022577056661248207,
0... | 9 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "features", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "labels", "annotation": null, "type_comment": null}}, {"_type"... | def _logistic_regression_model_fn(features, labels, mode):
_ = mode
logits = layers.linear(
features,
1,
weights_initializer=init_ops.zeros_initializer(),
# Intentionally uses really awful initial values so that
# AUC/precision/recall/etc will change meaningfully even on a toy dataset.... | |
17,842 | [
-0.025562794879078865,
0.0046158297918736935,
0.0806950181722641,
0.01840474270284176,
0.006988178938627243,
-0.01856875792145729,
-0.013894351199269295,
-0.03631744533777237,
0.009055930189788342,
0.008774762973189354,
-0.021567875519394875,
0.005002434831112623,
0.025445641949772835,
-0.... | 7 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "P", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}},... | def CalLatLon(P):
x, y, z = P
curr_R = VectorLen((x, y, z))
lat_rad = math.asin(z / curr_R)
lon_rad = math.atan2(y, x)
lat = math.degrees(lat_rad)
lon = math.degrees(lon_rad)
return (lat, lon) | |
17,843 | [
0.029604632407426834,
-0.027180315926671028,
0.05785724148154259,
0.014266169629991055,
-0.00864828284829855,
0.035292450338602066,
0.0019202217226848006,
-0.019942333921790123,
0.002890530973672867,
0.06513018906116486,
0.02194705605506897,
-0.035292450338602066,
-0.0070456694811582565,
0... | 11 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "d_ABC", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": [... | def FindDiaEdge(d_ABC):
# if it is an obtuse triangle or a right triangle
# edge AB would be the diameter
if d_ABC[0]**2 >= d_ABC[1]**2 + d_ABC[2]**2:
return 0
# edge BC would be the diameter
elif d_ABC[1]**2 >= d_ABC[0]**2 + d_ABC[2]**2:
return 1
# edge CA would be the diameter
... | |
17,844 | [
0.015822747722268105,
0.006639163009822369,
0.032994627952575684,
-0.006887687835842371,
0.01008300669491291,
0.012017950415611267,
-0.01112444419413805,
-0.014793144538998604,
-0.028355499729514122,
0.05727905407547951,
0.012662931345403194,
0.003011884167790413,
-0.056805673986673355,
0.... | 10 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "data", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "mincircle", "annotation": null, "type_comment": null}}], "kwarg":... | def Print_outlier(data, mincircle):
NoError = True
for i in data:
if not InCircle(i, mincircle):
print(distance(i, mincircle[0]))
NoError = False
if not NoError:
print('\n%.2f\n' % mincircle[1]) | |
17,845 | [
-0.005087133962661028,
-0.044006701558828354,
0.0546431764960289,
0.008770526386797428,
-0.04517078027129173,
-0.01787201687693596,
0.01757529191672802,
-0.009752004407346249,
0.017187265679240227,
0.007777636870741844,
-0.01194891519844532,
-0.02506190910935402,
0.022471265867352486,
0.02... | 10 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "A_s", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "B_s", "annotation": null, "type_comment": null}}, {"_type": "arg",... | def MinCirTri(A_s, B_s, C_s):
A, B, C = convToCart(A_s), convToCart(B_s), convToCart(C_s)
a = VectorMinus(A, C)
b = VectorMinus(B, C)
P1_denom = 2 * (VectorLen(VectorCross(a, b))**2)
if P1_denom:
P1_part1_1 = VectorTimesScaler(b, VectorLen(a)**2 / P1_denom)
P1_part1_2 = VectorTimesSc... | |
17,846 | [
-0.026622600853443146,
-0.04413199424743652,
0.0026079046074301004,
-0.02454090304672718,
-0.017000531777739525,
0.014352149330079556,
0.005707321222871542,
0.016572628170251846,
-0.006019575987011194,
0.048202868551015854,
0.03950599953532219,
-0.02974514849483967,
0.0023953979834914207,
... | 9 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "data_piece2", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyar... | def MinCir_2PtsKnown(data_piece2):
minimum_circle2 = Cir2Pts(data_piece2[-2], data_piece2[-1])
all_in_circle = True
for i in range(0, len(data_piece2) - 2):
if not InCircle(data_piece2[i], minimum_circle2):
all_in_circle = False
break
if all_in_circle:
return mini... | |
17,847 | [
-0.023364383727312088,
-0.006319974083453417,
0.008595408871769905,
-0.0058593968860805035,
0.0231325700879097,
0.012139718979597092,
0.017715448513627052,
0.01543391402810812,
-0.018630502745509148,
0.03460124880075455,
0.007228928152471781,
-0.020497214049100876,
-0.007723057176917791,
0... | 11 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "data", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []... | def MinCir(data):
data = reduce(lambda x, y: x if y in x else x + [y], [[], ] + data)
data_num = len(data)
if not data_num:
return ((0.0, 0.0), 0.0)
elif data_num == 1:
return ((data[0][0], data[0][1]), 0.0)
elif data_num == 2:
return Cir2Pts(data[0], data[1])
random.shuf... | |
17,848 | [
0.018084872514009476,
-0.017102831974625587,
0.033210866153240204,
-0.017549213021993637,
0.007900972850620747,
-0.02393886260688305,
-0.05144878476858139,
0.014615842141211033,
0.03469030559062958,
0.04425564780831337,
0.026553388684988022,
-0.02810935117304325,
-0.04111821576952934,
-0.0... | 9 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "f", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "x", "annotation": null, "type_comment": null}}, {"_type": "arg", "_f... | def estimateAtInfExponent(f, x, pos = True, fromTo = None, N = 10, deriv = False, debug_plot = False):
if fromTo is None:
fromTo = (1,10)
ex = logspace(fromTo[0], fromTo[1], N)
if pos:
lx = ex
else:
lx = -ex
y = abs(f(lx))
#if deriv:
# y -= min(y[isfinite(y)])
... | |
17,849 | [
-0.01105413120239973,
-0.009376107715070248,
-0.004191996064037085,
-0.004590067081153393,
0.021214133128523827,
0.01586160622537136,
-0.05374573543667793,
-0.025990987196564674,
0.04823397845029831,
0.024729406461119652,
0.05864507332444191,
-0.012309585697948933,
-0.03534872084856033,
-0... | 9 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "f", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "x", "annotation": null, "type_comment": null}}, {"_type": "arg", "_f... | def estimateDegreeOfPole(f, x, pos = True, fromTo = None, N = 10, deriv = False, debug_plot = False):
if fromTo is None:
if x == 0:
fromTo = (-1,-10)
else:
# testing around nonzero singularities is less accurate
fromTo = (-1,-7)
ex = logspace(fromTo[0], fromTo... | |
17,850 | [
0.016977766528725624,
0.018480438739061356,
-0.026951143518090248,
-0.026199808344244957,
0.013814885169267654,
0.07319465279579163,
-0.0603492334485054,
-0.0211949422955513,
0.047721944749355316,
0.0348522886633873,
0.046388931572437286,
-0.03991774842143059,
0.01572958007454872,
-0.02054... | 11 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "f", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "x", "annotation": null, "type_comment": null}}, {"_type": "arg", "_f... | def testPole(f, x, pos = True, pole_eps = None, deriv = None, debug_info = None, **kwargs):
if pole_eps is None:
pole_eps = params.pole_detection.max_pole_exponent
if deriv is None:
deriv = params.pole_detection.derivative
if debug_info is None:
debug_info = params.segments.debug_inf... | |
17,851 | [
0.009325130842626095,
-0.005549720022827387,
0.004275685641914606,
-0.006983842700719833,
-0.006943820510059595,
0.06494239717721939,
-0.0019610789604485035,
0.030843637883663177,
0.02126503363251686,
0.05656445398926735,
0.03778078779578209,
-0.03882135823369026,
-0.04341055080294609,
-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_convergence(self):
yest = abs(self.y_list[-1])
ae = self.ae_list[-1]
step = len(self.ae_list)
tol = max(self.abstol, yest * self.reltol)
if ae <= tol:
self.converged = True
return True, "converged"
if len(self.ae_list) > 0:
if ... | |
17,852 | [
0.007686452940106392,
-0.016609806567430496,
-0.026198729872703552,
0.021934369578957558,
0.03317249193787575,
-0.0197904072701931,
0.010472424328327179,
-0.012239424511790276,
-0.010225044563412666,
0.033690813928842545,
0.03524577245116234,
-0.0056985775008797646,
-0.004237856715917587,
... | 8 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "x", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "shift", "annotation": null, "type_comment": null}}], "kwarg": null, ... | def stepfun(x, shift = 0.0):
if isscalar(x):
if x < shift:
return 0.0
else:
return 1.0
else:
mask = (x >= 0.0)
y = zeros_like(asfarray(x))
y[mask] = 1.0
return y | |
17,853 | [
0.001307290280237794,
-0.015651555731892586,
0.0498289093375206,
-0.030571484938263893,
-0.049384705722332,
-0.010079444386065006,
-0.03799225762486458,
-0.02960469387471676,
0.04935857653617859,
0.03412509337067604,
0.03548382595181465,
-0.06333784759044647,
-0.03501349687576294,
-0.03054... | 9 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "f", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "xa", "annotation": null, "type_comment": null}}, {"_type": "arg", "_... | def bisect(f, xa, xb, xtol = 10*finfo(double).eps, rtol = 2*finfo(double).eps, maxiter = 1000, args = ()):
tol = min(xtol, rtol*(abs(xa) + abs(xb))) # fix for long intervals
fa = f(xa, *args)
fb = f(xb, *args)
if fa*fb > 0: raise RuntimeError("Interval does not contain zero")
if fa == 0: return xa
... | |
17,854 | [
0.04092703014612198,
-0.026521122083067894,
0.031815167516469955,
-0.0034869422670453787,
-0.007724722381681204,
0.005265410058200359,
-0.05238049104809761,
-0.006191231310367584,
0.046679213643074036,
0.05431485176086426,
0.024421321228146553,
-0.03573479503393173,
-0.03917083144187927,
-... | 9 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "f", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "fromTo", "annotation": null, "type_comment": null}}, {"_type": "arg"... | def estimateTailExponent(f, fromTo = None, N =300, deriv = False, debug_plot = False, pos = True):
if fromTo is None:
fromTo = (1,100)
ex = logspace(fromTo[0], fromTo[1], N)
if pos:
lx = ex
xi = log(ex)
else:
lx = -ex
xi = -log(ex)
y = abs(f(lx))
ind = (y ... | |
17,855 | [
0.0016319080023095012,
-0.03191035985946655,
0.012096147052943707,
0.002734891604632139,
-0.031820088624954224,
-0.011644798330962658,
0.017038416117429733,
0.03394142910838127,
0.028683215379714966,
0.01887766271829605,
0.018821245059370995,
-0.019441848620772362,
-0.051363490521907806,
0... | 13 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "pdf", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "x0", "annotation": null, "type_comment": null}}, {"_type": "arg", ... | def maxprob(pdf, x0, lub=None):
def fun(x):
#print x, lub
if lub is not None:
for i in range(len(x)):
if x[i]<lub[i][0]:
x[i]=lub[i][0]
if x[i]>lub[i][1]:
x[i]=lub[i][1]
f = -pdf(*[x[i] for i in range(len(x)... | |
17,856 | [
-0.006080212537199259,
-0.014552537351846695,
0.01777533069252968,
-0.017700383439660072,
-0.008656574413180351,
-0.03625018522143364,
-0.03907325118780136,
0.007057668641209602,
0.03482615947723389,
0.020785771310329437,
0.018524818122386932,
-0.027631085366010666,
-0.07384944707155228,
-... | 7 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "fc", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "L", "annotation": null, "type_comment": null}}, {"_type": "arg", "_... | def fmin2(fc, L, U, **kwargs):
xx = linspace(L,U,20)
y = [fc(x) for x in xx]
ind = argmin(y)
#xopt = fmin_cg(fc, xx[ind], maxiter=20, disp=0)
xopt = fmin(fc, xx[ind], maxiter=20, disp=0)
if xopt>U:
return U
if xopt<L:
return L
return xopt | |
17,857 | [
0.016178077086806297,
-0.05668675899505615,
-0.01565743237733841,
-0.013003414496779442,
0.032356154173612595,
0.011212904937565327,
-0.012089111842215061,
0.02184167318046093,
0.02460997737944126,
0.04431827738881111,
0.01612728089094162,
-0.02986721694469452,
-0.041956331580877304,
0.000... | 12 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "x", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}},... | def fun(x):
#print x, lub
if lub is not None:
for i in range(len(x)):
if x[i]<lub[i][0]:
x[i]=lub[i][0]
if x[i]>lub[i][1]:
x[i]=lub[i][1]
f = -pdf(*[x[i] for i in range(len(x))])
#print x, f
retu... | |
17,858 | [
0.022069966420531273,
-0.038095973432064056,
0.034836042672395706,
-0.024794507771730423,
0.03010081686079502,
0.0017638127319514751,
0.04935106262564659,
0.01652570627629757,
-0.0226291511207819,
0.03359869867563248,
0.007471665274351835,
-0.00502671767026186,
0.000521633483003825,
0.0112... | 9 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "n", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "ki", "annotation": null, "type_comment": null}}], "kwarg": null, "va... | def multinomial_coeff(n, ki=[]):
assert sum(ki)==n, "incorrect values n, k ({0}, {1})".format(n, ki)
c = 1
j=0
for k in ki:
for i in range(k):
c = c * (n - j)
c = c / (i + 1)
j += 1
return c | |
17,859 | [
0.03209824115037918,
-0.02913079783320427,
0.03280046209692955,
-0.018133128061890602,
0.033819813281297684,
0.007169438060373068,
0.02614070102572441,
0.020251113921403885,
-0.04100057855248451,
0.022674905136227608,
0.013534720987081528,
-0.023807518184185028,
0.016456861048936844,
0.000... | 8 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "n", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "k", "annotation": null, "type_comment": null}}], "kwarg": null, "var... | def binomial_coeff(n, k):
if k > n - k: # take advantage of symmetry
k = n - k
c = 1
for i in range(k):
c = c * (n - i)
c = c / (i + 1)
return c | |
17,860 | [
0.03181377798318863,
0.06978044658899307,
0.07827048003673553,
-0.03143220394849777,
-0.018387123942375183,
0.011733418330550194,
0.011304146610200405,
-0.028832728043198586,
-0.006993546616286039,
-0.006898152641952038,
-0.016360009089112282,
0.000713216548319906,
-0.00890141911804676,
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 = [
('goals', '0003_remove_name_and_slug_on_indicator'),
]
operations = [
migrations.AddField(
model_name='progress',
name='value_unit',
field=models.CharField(blank=True, max_length=50, verbose_name='V... | |
17,861 | [
-0.021343592554330826,
0.023209374397993088,
0.009025868028402328,
-0.014522199518978596,
-0.02259140834212303,
0.006037051789462566,
-0.02410067245364189,
-0.033655375242233276,
0.07562952488660812,
0.0312785841524601,
0.03489130735397339,
-0.026596304029226303,
0.02970990166068077,
0.027... | 11 | {"_type": "Module", "_fields": {"body": [{"_type": "ClassDef", "_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, ... | class AssertionIsFunction(Vows.Context):
class WhenItIsAFunction(Vows.Context):
def topic(self):
def my_func():
pass
return my_func
def we_assert_it_is_a_function(self, topic):
expect(topic).to_be_a_function()
class WhenWeGetAnError(Vows... | |
17,862 | [
-0.024770762771368027,
0.022056978195905685,
-0.013150501064956188,
-0.02242758311331272,
-0.013879756443202496,
-0.013712386600673199,
-0.0057413894683122635,
-0.007908233441412449,
0.06785658746957779,
0.01983334682881832,
0.028357263654470444,
-0.0023730676621198654,
-0.000435610360000282... | 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}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs... | class WhenItIsAFunction(Vows.Context):
def topic(self):
def my_func():
pass
return my_func
def we_assert_it_is_a_function(self, topic):
expect(topic).to_be_a_function()
class WhenWeGetAnError(Vows.Context):
@Vows.capture_error
... | |
17,863 | [
-0.014533786103129387,
0.021640561521053314,
-0.006130671128630638,
-0.031801894307136536,
-0.02960950881242752,
-0.009730246849358082,
-0.012575419619679451,
-0.009446960873901844,
0.06872756034135818,
0.024535000324249268,
0.017391275614500046,
-0.013289792463183403,
-0.006435511168092489,... | 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}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs... | class WhenItNotAFunction(Vows.Context):
def topic(self):
return 42
def we_assert_it_is_not_a_function(self, topic):
expect(topic).Not.to_be_a_function()
class WhenWeGetAnError(Vows.Context):
@Vows.capture_error
def topic(self):
e... | |
17,864 | [
-0.001069889753125608,
0.03361615911126137,
-0.014911354519426823,
-0.0001353205443592742,
-0.05110419541597366,
-0.016784220933914185,
-0.009471692144870758,
0.0021919691935181618,
0.04194265976548195,
0.017380675300955772,
-0.0035489024594426155,
-0.030944043770432472,
-0.01294305641204118... | 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 WhenWeGetAnError(Vows.Context):
@Vows.capture_error
def topic(self):
expect(a_function).not_to_be_a_function()
def we_get_an_understandable_message(self, topic):
msg = 'Expected topic({0!s}) not to be a function or a method'.format(a_function)
... | |
17,865 | [
-0.010277454741299152,
0.029681047424674034,
-0.0050452956929802895,
0.011386576108634472,
-0.04682420194149017,
-0.016455983743071556,
-0.010928460396826267,
0.006787339691072702,
0.03267085179686546,
0.009337112307548523,
0.008227991871535778,
-0.020012404769659042,
-0.010789819993078709,
... | 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 WhenWeGetAnError(Vows.Context):
@Vows.capture_error
def topic(self):
expect(4).to_be_a_function()
def we_get_an_understandable_message(self, topic):
msg = 'Expected topic(4) to be a function or a method, but it was a {0!s}'.format(int)
... | |
17,866 | [
-0.0035267213825136423,
0.0014694671845063567,
0.017128219828009605,
-0.02559894323348999,
-0.06227245181798935,
0.02493974193930626,
0.030191371217370033,
-0.004716028459370136,
-0.006828215904533863,
0.03302593156695366,
-0.005081335082650185,
-0.03164161369204521,
-0.024126728996634483,
... | 11 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "is_third_parties", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [{"_type": "Constant", "_fields": {"kind": nul... | def build_multiple_python_version(is_third_parties=False) -> Dict[str, Dict[str, ModuleSymbol]]:
model_by_version: Dict[str, Dict[str, ModuleSymbol]] = {}
for major, minor in SUPPORTED_PYTHON_VERSIONS:
opt = ts.get_options((major, minor))
build_result, source_paths = ts.walk_typeshed_third_parti... | |
17,867 | [
0.07023466378450394,
0.051168542355298996,
0.014331438578665257,
-0.034883782267570496,
-0.002523925621062517,
0.03617892041802406,
0.05707097426056862,
-0.018875034525990486,
0.03811100870370865,
0.038960281759500504,
0.03838702291250229,
0.02205980010330677,
0.017250806093215942,
-0.0038... | 10 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "name", "annotation": null, "type_comment": null}}, {"_type": "arg... | def __init__(self, name, save_handler, changed=None, config_opt=None,
filename=None):
self._name = name
self._dirty = False
self._save_handler = save_handler
self._config_opt = config_opt
if changed is not None:
changed.connect(self.mark_dirty)
... | |
17,868 | [
0.028745077550411224,
0.021053481847047806,
-0.04421337693929672,
-0.026085466146469116,
-0.005281987600028515,
0.011946973390877247,
0.011904419399797916,
-0.01145760528743267,
0.0001766979112289846,
0.06102211773395538,
0.005585183389484882,
-0.07468187808990479,
-0.030723828822374344,
-... | 10 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "all_python_modules", "annotation": {"_type": "Subscript", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "slice": {"_type": "Name", "_fields": {"id... | def merge_modules(all_python_modules: Set[str], model_by_version: Dict[str, Dict[str, ModuleSymbol]]):
merged_modules: Dict[str, MergedModuleSymbol] = {}
for python_mod in all_python_modules:
handled_classes: Dict[str, List[MergedClassSymbol]] = {}
handled_funcs: Dict[str, List[MergedFunctionSym... | |
17,869 | [
-0.0021535868290811777,
0.004219047259539366,
0.016545714810490608,
-0.019035283476114273,
-0.020478352904319763,
0.011390325613319874,
-0.0037123209331184626,
-0.0005669688689522445,
0.009875655174255371,
0.041309207677841187,
-0.00021979941811878234,
-0.049526989459991455,
-0.0352505259215... | 9 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "is_third_parties", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [{"_type": "Constant", "_fields": {"kind": nul... | def merge_multiple_python_versions(is_third_parties=False):
model_by_version = build_multiple_python_version(is_third_parties)
all_python_modules: Set[str] = set()
for version in model_by_version:
model = model_by_version[version]
for module_fqn in model:
mod: ModuleSymbol = mode... | |
17,870 | [
0.02213198132812977,
0.021062450483441353,
-0.04110398516058922,
-0.05828939005732536,
0.00047969334991648793,
0.01046437956392765,
0.009249004535377026,
-0.06509549170732498,
-0.0029670344665646553,
0.04769131913781166,
0.011576447635889053,
-0.03206159546971321,
-0.004758193623274565,
-0... | 12 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "module_or_class", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "handled_vars", "annotation": null, "type_comment": nul... | def merge_vars(module_or_class, handled_vars, version):
for var in module_or_class.vars:
if var.fullname not in handled_vars:
# doesn't exist: we add it
handled_vars[var.fullname] = [MergedVarSymbol(var, [version])]
else:
compared = handled_vars[var.fullname]
... | |
17,871 | [
0.0429023802280426,
0.015190656296908855,
-0.02096688561141491,
-0.06293608993291855,
0.01598208211362362,
0.044626981019973755,
0.024664144963026047,
-0.031893290579319,
-0.009378990158438683,
0.06893675774335861,
0.027758974581956863,
-0.0597231388092041,
-0.023104917258024216,
0.0208605... | 12 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "current_module", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "handled_classes", "annotation": null, "type_comment": n... | def merge_classes(current_module, handled_classes, version):
for mod_class in current_module.classes:
if mod_class.fullname not in handled_classes:
functions = {}
overloaded_functions = {}
variables = {}
merge_functions(mod_class, functions, version)
... | |
17,872 | [
0.033119797706604004,
0.010257340036332607,
-0.016547949984669685,
-0.05629887804389,
0.00812462531030178,
0.01856715977191925,
0.012437845580279827,
-0.031709935516119,
0.013513163663446903,
0.06623959541320801,
0.016165615990757942,
-0.03634575009346008,
-0.03182941675186157,
0.003590367... | 12 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "module_or_class", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "handled_funcs", "annotation": null, "type_comment": nu... | def merge_functions(module_or_class, handled_funcs, version):
functions = module_or_class.functions if isinstance(module_or_class, ModuleSymbol) else module_or_class.methods
for func in functions:
if func.fullname not in handled_funcs:
# doesn't exist: we add it
handled_funcs[fun... | |
17,873 | [
0.05565282702445984,
0.0038540170062333345,
-0.032663747668266296,
-0.05255317687988281,
0.004843204747885466,
0.02416319027543068,
0.020229920744895935,
-0.029775436967611313,
0.004027198068797588,
0.054149966686964035,
0.01782299391925335,
-0.005356878042221069,
-0.03362651914358139,
0.0... | 12 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "module_or_class", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "handled_overloaded_funcs", "annotation": null, "type_c... | def merge_overloaded_functions(module_or_class, handled_overloaded_funcs, version):
functions = (module_or_class.overloaded_functions
if isinstance(module_or_class, ModuleSymbol) else module_or_class.overloaded_methods)
for func in functions:
if func.fullname not in handled_overloaded_f... | |
17,874 | [
-0.0024224587250500917,
-0.03974379226565361,
0.04646620154380798,
-0.027874095365405083,
0.004250729456543922,
0.030011765658855438,
0.006806792225688696,
0.0024945347104221582,
0.028605403378605843,
0.06328628957271576,
0.013754220679402351,
-0.024273809045553207,
0.012136904522776604,
0... | 8 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}}, "body": [{"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"a... | def test_SymRD():
rd = SymRD(2, [[0]], [[1]], k=[5.0])
fout = rd.alloc_fout()
rd.f(0, [7, 3], fout)
assert np.allclose(fout, [-5*7, 5*7])
jout = rd.alloc_jout(banded=False)
rd.dense_jac_rmaj(0, [7, 3], jout)
assert np.allclose(jout, [[-5.0, 0.0], [5.0, 0.0]]) | |
17,875 | [
0.003965212032198906,
0.06653695553541183,
0.022960828617215157,
0.052590567618608475,
-0.04904057830572128,
-0.015239600092172623,
0.0034770884085446596,
0.013870318420231342,
0.04181380942463875,
0.02256779372692108,
0.06288553774356842,
-0.020982977002859116,
-0.004821013193577528,
0.00... | 11 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "state", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "call", "annotation": null, "type_comment": null}}, {"_type": "ar... | def _abort(state, call, code, details):
if state.client is not _CANCELLED:
effective_code = _abortion_code(state, code)
effective_details = details if state.details is None else state.details
if state.initial_metadata_allowed:
operations = (cygrpc.operation_send_initial_metadata(... | |
17,876 | [
0.035977426916360855,
0.030341334640979767,
-0.03853928670287132,
0.021708980202674866,
-0.015638485550880432,
0.0021177115850150585,
0.03143291175365448,
0.02012730948626995,
0.028291847556829453,
-0.002376682125031948,
0.019603800028562546,
-0.04994513466954231,
0.012787023559212685,
0.0... | 9 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "receive_close_on_server_event", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_default... | def receive_close_on_server(receive_close_on_server_event):
with state.condition:
if receive_close_on_server_event.batch_operations[
0].received_cancelled:
state.client = _CANCELLED
elif state.client is _OPEN:
state.client = _CLOSED
... | |
17,877 | [
0.03243786096572876,
0.035939302295446396,
-0.03155699744820595,
0.02975122258067131,
-0.01567940041422844,
0.0058412374928593636,
0.024730291217565536,
0.014038789086043835,
0.027549060061573982,
0.009419752284884453,
0.017220914363861084,
-0.05307212844491005,
0.01856423355638981,
0.0415... | 10 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "state", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": [... | def _receive_close_on_server(state):
def receive_close_on_server(receive_close_on_server_event):
with state.condition:
if receive_close_on_server_event.batch_operations[
0].received_cancelled:
state.client = _CANCELLED
elif state.client is _OPEN:
... | |
17,878 | [
0.0002965505118481815,
0.02431366965174675,
0.029561668634414673,
0.02975924126803875,
0.016102096065878868,
0.008260967209935188,
-0.025202741846442223,
0.01444743201136589,
0.021066084504127502,
0.019510207697749138,
0.01901627890765667,
-0.03753862529993057,
0.028870167210698128,
-0.033... | 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}}, {"_type": "arg", "_fields": {"arg": "rpc_event", "annotatio... | class _Context(grpc.ServicerContext):
def __init__(self, rpc_event, state, request_deserializer):
self._rpc_event = rpc_event
self._state = state
self._request_deserializer = request_deserializer
def is_active(self):
with self._state.condition:
return self._state.cl... | |
17,879 | [
0.016872642561793327,
0.014802234247326851,
-0.05311669781804085,
0.03710077702999115,
0.005592484027147293,
-0.015123504213988781,
-0.0077283368445932865,
0.01283891499042511,
0.0551157146692276,
0.01575414650142193,
-0.008507714606821537,
-0.03738635033369064,
0.004060500301420689,
-0.00... | 10 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "state", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "token", "annotation": null, "type_comment": null}}], "kwarg": nu... | def _send_message(state, token):
def send_message(unused_send_message_event):
with state.condition:
state.condition.notify_all()
return _possibly_finish_call(state, token)
return send_message | |
17,880 | [
0.010158276185393333,
-0.007703311275690794,
-0.055202286690473557,
0.0077434624545276165,
0.030813245102763176,
-0.020672177895903587,
-0.051072437316179276,
0.030606752261519432,
0.005018910858780146,
0.00398644944652915,
0.004697700496762991,
-0.08608435839414597,
0.008575167506933212,
... | 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}}, {"_type": "arg", "_fields": {"arg": "state", "annotation": ... | class _RequestIterator(object):
def __init__(self, state, call, request_deserializer):
self._state = state
self._call = call
self._request_deserializer = request_deserializer
def _raise_or_start_receive_message(self):
if self._state.client is _CANCELLED:
_raise_rpc_... | |
17,881 | [
0.05297005549073219,
0.04151451215147972,
0.030200978741049767,
0.036118097603321075,
0.0033993853721767664,
-0.004405295941978693,
0.0041863624937832355,
0.0190057884901762,
-0.014674456790089607,
0.010236617177724838,
0.014508778229355812,
-0.01031945738941431,
-0.018686264753341675,
-0.... | 12 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "initial_metadata", "annotation": null, "type_comment": null}}], "... | def send_initial_metadata(self, initial_metadata):
with self._state.condition:
if self._state.client is _CANCELLED:
_raise_rpc_error(self._state)
else:
if self._state.initial_metadata_allowed:
operation = cygrpc.operation_send_initial_m... | |
17,882 | [
0.023280244320631027,
0.008531163446605206,
-0.027599820867180824,
0.02878202125430107,
0.010980818420648575,
-0.0250990130007267,
-0.04965239390730858,
0.04499179869890213,
0.021541045978665352,
0.0031373766250908375,
0.003913195338100195,
-0.037875864654779434,
0.0160279031842947,
0.0155... | 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 _look_for_request(self):
if self._state.client is _CANCELLED:
_raise_rpc_error(self._state)
elif (self._state.request is None and
_RECEIVE_MESSAGE_TOKEN not in self._state.due):
raise StopIteration()
else:
request = self._state.request
... | |
17,883 | [
0.04032011702656746,
-0.011628605425357819,
0.0033742955420166254,
0.054217301309108734,
0.000683573423884809,
-0.019200056791305542,
-0.008908597752451897,
0.05280015617609024,
0.020114345476031303,
0.002621436258777976,
0.0000786163000157103,
-0.02731436677277088,
0.007502879481762648,
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 _raise_or_start_receive_message(self):
if self._state.client is _CANCELLED:
_raise_rpc_error(self._state)
elif self._state.client is _CLOSED or self._state.statused:
raise StopIteration()
else:
self._call.start_server_batch(
cygrpc.Operatio... | |
17,884 | [
-0.011838187463581562,
0.04288778826594353,
0.00029546444420702755,
0.01836668886244297,
0.03489912301301956,
-0.021383555606007576,
-0.049235276877880096,
0.02368844300508499,
0.041077665984630585,
0.026162274181842804,
0.00333062163554132,
-0.06110966578125954,
0.03586452081799507,
-0.00... | 14 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "rpc_event", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "state", "annotation": null, "type_comment": null}}, {"_type"... | def _unary_request(rpc_event, state, request_deserializer):
def unary_request():
with state.condition:
if state.client is _CANCELLED or state.statused:
return None
else:
rpc_event.operation_call.start_server_batch(
cygrpc.Operation... | |
17,885 | [
0.054772503674030304,
-0.011883767321705818,
-0.025570588186383247,
0.03989415243268013,
0.039238497614860535,
0.009500709362328053,
0.023237966001033783,
0.023540576919913292,
0.011360502801835537,
-0.009790711104869843,
0.00007126911077648401,
-0.030689749866724014,
-0.02047664485871792,
... | 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 _next(self):
with self._state.condition:
self._raise_or_start_receive_message()
while True:
self._state.condition.wait()
request = self._look_for_request()
if request is not None:
return request | |
17,886 | [
-0.009826204739511013,
0.016108915209770203,
0.014185636304318905,
0.06490190327167511,
0.015934070572257042,
-0.030749144032597542,
-0.054830919951200485,
0.019687378779053688,
0.04886293038725853,
0.07124289870262146,
0.001876653521321714,
-0.034152764827013016,
0.06606753170490265,
0.01... | 12 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "rpc_event", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "state", "annotation": null, "type_comment": null}}, {"_type"... | def _call_behavior(rpc_event, state, behavior, argument, request_deserializer):
context = _Context(rpc_event, state, request_deserializer)
try:
return behavior(argument, context), True
except Exception as e: # pylint: disable=broad-except
with state.condition:
if e not in state.... | |
17,887 | [
-0.006328716408461332,
0.022310996428132057,
-0.009980597533285618,
0.02332843467593193,
0.020736386999487877,
-0.01962204836308956,
-0.028439857065677643,
0.03376930207014084,
0.03202512115240097,
0.024285312741994858,
0.017344921827316284,
-0.06366264820098877,
0.011179722845554352,
-0.0... | 13 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}}, "body": [{"_type": "With", "_fields": {"body": [{"_type": "If", "_fields": {"body"... | def unary_request():
with state.condition:
if state.client is _CANCELLED or state.statused:
return None
else:
rpc_event.operation_call.start_server_batch(
cygrpc.Operations(
(cygrpc.operation_receive_message(_EMP... | |
17,888 | [
-0.0005780233768746257,
0.03521880879998207,
-0.012997714802622795,
0.050366148352622986,
-0.0010365365305915475,
0.024020778015255928,
-0.02124626561999321,
0.017684390768408775,
0.030169697478413582,
0.0037399674765765667,
0.022970961406826973,
-0.03314417228102684,
0.020071471109986305,
... | 12 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "rpc_event", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "state", "annotation": null, "type_comment": null}}, {"_type"... | def _send_response(rpc_event, state, serialized_response):
with state.condition:
if state.client is _CANCELLED or state.statused:
return False
else:
if state.initial_metadata_allowed:
operations = (cygrpc.operation_send_initial_metadata(
_c... | |
17,889 | [
-0.01420657616108656,
0.010856285691261292,
-0.003920791205018759,
0.021119697019457817,
0.0337601937353611,
-0.004687051754444838,
-0.042015671730041504,
0.033111389726400375,
0.05964524671435356,
0.03355884179472923,
0.03742929548025131,
-0.05879509076476097,
0.03275343030691147,
-0.0130... | 12 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "rpc_event", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "state", "annotation": null, "type_comment": null}}, {"_type"... | def _take_response_from_response_iterator(rpc_event, state, response_iterator):
try:
return next(response_iterator), True
except StopIteration:
return None, True
except Exception as e: # pylint: disable=broad-except
with state.condition:
if e not in state.rpc_errors:
... | |
17,890 | [
0.004744178615510464,
0.009265652857720852,
-0.004539056681096554,
0.03671097382903099,
0.055043019354343414,
-0.042196523398160934,
-0.0389380156993866,
0.03647654876112938,
0.06906164437532425,
0.04418913647532463,
0.02651348151266575,
-0.050729598850011826,
0.03732047975063324,
0.010918... | 9 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "rpc_event", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "state", "annotation": null, "type_comment": null}}, {"_type"... | def _unary_response_in_pool(rpc_event, state, behavior, argument_thunk,
request_deserializer, response_serializer):
argument = argument_thunk()
if argument is not None:
response, proceed = _call_behavior(rpc_event, state, behavior, argument,
... | |
17,891 | [
0.014001225121319294,
0.0540047250688076,
-0.005900516174733639,
0.038203343749046326,
0.021651893854141235,
0.029377570375800133,
-0.00040550422272644937,
-0.0020720562897622585,
0.05365469306707382,
0.02762741781771183,
0.03172777593135834,
-0.013251159340143204,
0.020751815289258957,
-0... | 11 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "rpc_event", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "state", "annotation": null, "type_comment": null}}, {"_type"... | def _status(rpc_event, state, serialized_response):
with state.condition:
if state.client is not _CANCELLED:
trailing_metadata = _common.to_cygrpc_metadata(
state.trailing_metadata)
code = _completion_code(state)
details = _details(state)
opera... | |
17,892 | [
0.019211549311876297,
0.0478692352771759,
0.038445115089416504,
0.009253471158444881,
-0.013420560397207737,
-0.01986110769212246,
-0.045315034687519073,
-0.002639523707330227,
0.05742546543478966,
-0.003041369840502739,
0.03478996828198433,
-0.049806904047727585,
0.04681232571601868,
0.00... | 11 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "rpc_event", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "generic_handlers", "annotation": null, "type_comment": null}... | def _find_method_handler(rpc_event, generic_handlers):
for generic_handler in generic_handlers:
method_handler = generic_handler.service(
_HandlerCallDetails(
_common.decode(rpc_event.request_call_details.method),
rpc_event.request_metadata))
if method_han... | |
17,893 | [
0.01757497526705265,
0.00657447287812829,
-0.021824901923537254,
0.021601838991045952,
0.047524046152830124,
-0.022705411538481712,
-0.03115830570459366,
0.023186758160591125,
0.06194092705845833,
0.031698353588581085,
0.043720245361328125,
-0.055366456508636475,
0.03214447572827339,
-0.00... | 12 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "rpc_event", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "state", "annotation": null, "type_comment": null}}, {"_type"... | def _stream_response_in_pool(rpc_event, state, behavior, argument_thunk,
request_deserializer, response_serializer):
argument = argument_thunk()
if argument is not None:
response_iterator, proceed = _call_behavior(
rpc_event, state, behavior, argument, request_de... | |
17,894 | [
0.03897060081362724,
0.02821764536201954,
0.009187277406454086,
0.04372080788016319,
0.008773702196776867,
-0.01067024003714323,
-0.013458918780088425,
0.021564992144703865,
0.058467715978622437,
0.035165708512067795,
0.06499038636684418,
-0.024554550647735596,
0.01705111376941204,
0.03119... | 11 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "rpc_event", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "method_handler", "annotation": null, "type_comment": null}},... | def _handle_with_method_handler(rpc_event, method_handler, thread_pool):
state = _RPCState()
with state.condition:
rpc_event.operation_call.start_server_batch(
cygrpc.Operations(
(cygrpc.operation_receive_close_on_server(_EMPTY_FLAGS),)),
_receive_close_on_server(... | |
17,895 | [
-0.0004366594657767564,
0.03745109960436821,
0.030038191005587578,
0.0374283604323864,
0.012153984047472477,
-0.01659945584833622,
-0.033903818577528,
0.0141095370054245,
0.04004334285855293,
0.04045264422893524,
0.025353962555527687,
-0.025467656552791595,
0.01039739791303873,
-0.00433746... | 8 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "rpc_event", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "status", "annotation": null, "type_comment": null}}, {"_type... | def _reject_rpc(rpc_event, status, details):
operations = (cygrpc.operation_send_initial_metadata(_common.EMPTY_METADATA,
_EMPTY_FLAGS),
cygrpc.operation_receive_close_on_server(_EMPTY_FLAGS),
cygrpc.operation_send_status_f... | |
17,896 | [
0.029800396412611008,
0.04991361126303673,
0.016152143478393555,
0.011575360782444477,
0.014941245317459106,
-0.024566855281591415,
-0.008101725950837135,
-0.00663941353559494,
0.013206994161009789,
0.00972822867333889,
0.03681949898600578,
-0.032550569623708725,
0.00030384681303985417,
-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}}, {"_type": "arg", "_fields": {"arg": "completion_queue", "an... | class _ServerState(object):
def __init__(self, completion_queue, server, generic_handlers, thread_pool,
maximum_concurrent_rpcs):
self.lock = threading.Lock()
self.completion_queue = completion_queue
self.server = server
self.generic_handlers = list(generic_handlers... | |
17,897 | [
0.04949430376291275,
0.038897499442100525,
0.04740898683667183,
0.00530106108635664,
-0.006351697724312544,
-0.02798151597380638,
-0.003351398278027773,
0.01829969882965088,
0.016267580911517143,
0.008474250324070454,
0.04072747007012367,
-0.009096652269363403,
-0.011884164996445179,
-0.03... | 7 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "completion_queue", "annotation": null, "type_comment": null}}, {"... | def __init__(self, completion_queue, server, generic_handlers, thread_pool,
maximum_concurrent_rpcs):
self.lock = threading.Lock()
self.completion_queue = completion_queue
self.server = server
self.generic_handlers = list(generic_handlers)
self.thread_pool = thre... | |
17,898 | [
0.02200481668114662,
0.0017217857530340552,
-0.017105402424931526,
0.02694070339202881,
-0.030442021787166595,
0.013287991285324097,
-0.015062965452671051,
0.024497075006365776,
0.052908819168806076,
0.02414451166987419,
0.06550384312868118,
-0.05767450109124184,
-0.0016473218565806746,
0.... | 13 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "state", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": [... | def _serve(state):
while True:
event = state.completion_queue.poll()
if event.tag is _SHUTDOWN_TAG:
with state.lock:
state.due.remove(_SHUTDOWN_TAG)
if _stop_serving(state):
return
elif event.tag is _REQUEST_CALL_TAG:
... | |
17,899 | [
0.0014137767720967531,
0.002917409176006913,
-0.02444072999060154,
0.0085449805483222,
-0.030817581340670586,
0.014887047931551933,
-0.03285817429423332,
0.022458110004663467,
0.0393509678542614,
0.021739264950156212,
0.06177429482340813,
-0.04273649677634239,
0.0067826504819095135,
0.0064... | 9 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "state", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": [... | def _stop_serving(state):
if not state.rpc_states and not state.due:
for shutdown_event in state.shutdown_events:
shutdown_event.set()
state.stage = _ServerStage.STOPPED
return True
else:
return False | |
17,900 | [
0.03337763622403145,
0.03873893618583679,
0.0005400588270276785,
0.01533663272857666,
-0.0392133854329586,
0.019832057878375053,
-0.017009073868393898,
0.025881309062242508,
0.02597619965672493,
-0.007620871067047119,
0.04644876718521118,
0.001823671511374414,
-0.009186560288071632,
-0.011... | 15 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "state", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "grace", "annotation": null, "type_comment": null}}], "kwarg": nu... | def _stop(state, grace):
with state.lock:
if state.stage is _ServerStage.STOPPED:
shutdown_event = threading.Event()
shutdown_event.set()
return shutdown_event
else:
if state.stage is _ServerStage.STARTED:
state.server.shutdown(state.co... |