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 |
|---|---|---|---|---|---|
14,401 | [
0.02234813943505287,
0.00944200437515974,
-0.013226679526269436,
-0.04361655190587044,
-0.006821412593126297,
-0.005089347250759602,
0.0006983793573454022,
0.023484105244278908,
-0.02697072923183441,
0.044786255806684494,
-0.008171074092388153,
0.009273297153413296,
0.030884746462106705,
-... | 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": "config", "annotation": null, "type_comment": null}}, {"_type": "a... | def create_and_check_for_token_classification(
self,
config,
input_ids,
input_shape_ids,
input_pronunciation_ids,
token_type_ids,
input_mask,
sequence_labels,
token_labels,
choice_labels,
):
config.num_labels = self.num_labels
... | |
14,402 | [
0.016186196357011795,
-0.005488060414791107,
-0.006516892462968826,
-0.011251240037381649,
0.015945466235280037,
-0.009554670192301273,
0.01526913046836853,
0.026388542726635933,
-0.022009557113051414,
0.06171846762299538,
-0.006694573909044266,
-0.018570564687252045,
0.04204742610454559,
... | 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": "config", "annotation": null, "type_comment": null}}, {"_type": "a... | def create_and_check_for_multiple_choice(
self,
config,
input_ids,
input_shape_ids,
input_pronunciation_ids,
token_type_ids,
input_mask,
sequence_labels,
token_labels,
choice_labels,
):
config.num_choices = self.num_choices
... | |
14,403 | [
0.015310327522456646,
0.021713633090257645,
-0.0072618811391294,
-0.026521652936935425,
-0.015066603198647499,
-0.0075166840106248856,
0.014612389728426933,
0.050428807735443115,
-0.03540651872754097,
0.05326487496495247,
-0.005877083167433739,
0.003780498867854476,
0.019409330561757088,
-... | 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": "config", "annotation": null, "type_comment": null}}, {"_type": "a... | def create_and_check_for_pretraining(
self,
config,
input_ids,
input_shape_ids,
input_pronunciation_ids,
token_type_ids,
input_mask,
sequence_labels,
token_labels,
choice_labels,
):
model = RoCBertForPreTraining(config=config)
... | |
14,404 | [
-0.002111666603013873,
-0.0024131264071911573,
-0.002443562261760235,
-0.045497212558984756,
-0.0003440335567574948,
0.033160559833049774,
0.007855341769754887,
0.03663893789052963,
0.007455328479409218,
0.052593108266592026,
0.0018000617856159806,
-0.014933845959603786,
0.028290826827287674... | 12 | {"_type": "Module", "_fields": {"body": [{"_type": "ClassDef", "_fields": {"body": [{"_type": "Assign", "_fields": {"value": {"_type": "IfExp", "_fields": {"body": {"_type": "Tuple", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "elts": [{"_type": "Name", "_fields": {"id": "RoCBertModel", "ctx": {"_type": "Load"... | class RoCBertModelTest(ModelTesterMixin, unittest.TestCase):
all_model_classes = (
(
RoCBertModel,
RoCBertForMaskedLM,
RoCBertForCausalLM,
RoCBertForMultipleChoice,
RoCBertForQuestionAnswering,
RoCBertForSequenceClassification,
... | |
14,405 | [
0.018078744411468506,
0.033660124987363815,
-0.0005839624791406095,
-0.07565927505493164,
-0.009522558189928532,
0.004006640519946814,
0.04117393493652344,
0.012519394978880882,
-0.04128251597285271,
0.026537207886576653,
-0.01770957000553608,
-0.0158311165869236,
0.007817835547029972,
-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": "inputs_dict", "annotation": null, "type_comment": null}}, {"_type... | def _prepare_for_class(self, inputs_dict, model_class, return_labels=False):
inputs_dict = super()._prepare_for_class(inputs_dict, model_class, return_labels=return_labels)
if return_labels:
if model_class in get_values(MODEL_FOR_PRETRAINING_MAPPING):
inputs_dict["labels_inp... | |
14,406 | [
0.009350803680717945,
-0.0058825272135436535,
0.01632268726825714,
-0.004389813635498285,
0.002911821473389864,
0.02715737372636795,
0.012330342084169388,
0.053702350705862045,
0.0009657001355662942,
0.03130281716585159,
-0.022199327126145363,
-0.01118210144340992,
0.035401154309511185,
0.... | 8 | {"_type": "Module", "_fields": {"body": [{"_type": "ClassDef", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs... | class RoCBertModelIntegrationTest(unittest.TestCase):
@slow
def test_inference_masked_lm(self):
model = RoCBertForMaskedLM.from_pretrained("weiweishi/roc-bert-base-zh")
# input_text: ['[CLS]', 'b', 'a', '里', '系', '[MASK]', '国', '的', '首', '都', '[SEP]'] is the adversarial text
# of ['[CLS... | |
14,407 | [
0.01260901428759098,
-0.016286643221974373,
-0.023032942786812782,
-0.006758240517228842,
0.008728398941457272,
0.022997122257947922,
-0.008835862390697002,
0.03553449362516403,
0.01819710060954094,
0.029922528192400932,
-0.015725446864962578,
-0.013803048990666866,
0.03961809352040291,
0.... | 7 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []... | def test_inference_masked_lm(self):
model = RoCBertForMaskedLM.from_pretrained("weiweishi/roc-bert-base-zh")
# input_text: ['[CLS]', 'b', 'a', '里', '系', '[MASK]', '国', '的', '首', '都', '[SEP]'] is the adversarial text
# of ['[CLS]', '巴', '黎', '是', '[MASK]', '国', '的', '首', '都', '[SEP]'], means
... | |
14,408 | [
0.06294901669025421,
0.06272032111883163,
0.004134424030780792,
-0.0458252839744091,
-0.05820354446768761,
0.027458008378744125,
0.06723710149526596,
-0.027858229354023933,
-0.021097354590892792,
-0.011770780198276043,
0.015222685411572456,
-0.006921676453202963,
-0.011191889643669128,
-0.... | 11 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "replay", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "log", "annotation": null, "type_comment": null}}], "kwarg": nul... | def run(replay, log=None):
if not replay:
log = StringIO()
else:
log = StringIO(log)
record = Record(replay=replay, file_object=log)
disturb_mem.disturb_mem()
mode = RecordMode(record=record)
b = sharedX(np.zeros((2,)), name='b')
channe... | |
14,409 | [
-0.010341956280171871,
-0.002737282309681177,
0.024340294301509857,
-0.04091411083936691,
0.012443708255887032,
0.017988331615924835,
0.020150134339928627,
-0.03827190771698952,
0.023299425840377808,
0.005808176007121801,
0.022538792341947556,
-0.040673911571502686,
0.0006943289190530777,
... | 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": "method", "annotation":... | class TestMonitor(object):
def teardown_method(self, method):
MockMonitor.static_stop()
def testBadId(self):
with pytest.raises(omero.ApiUsageException):
MockMonitor().fsEventHappened('foo', [])
def testBadFileId(self):
# Could cause infinite loop
with pytest.r... | |
14,410 | [
0.0030340931843966246,
-0.025190917775034904,
0.04383690655231476,
-0.07637321203947067,
0.01677432656288147,
-0.040493812412023544,
0.0052853841334581375,
0.014996835961937904,
-0.006603787653148174,
0.04148261621594429,
0.0011101955315098166,
0.006756816525012255,
-0.01591501012444496,
-... | 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 testWithMultiImport(self):
f1 = str(self.dir / "root" / "file1")
f2 = str(self.dir / "root" / "file2")
f3 = str(self.dir / "root" / "file3")
f4 = str(self.dir / "root" / "file4")
self.client.files = {f1: [f1, f2, f3, f4]}
self.client.setDirImportWait(1)
self.d... | |
14,411 | [
-0.017283275723457336,
-0.0030693532899022102,
0.03027242235839367,
-0.019133783876895905,
-0.0061861551366746426,
-0.009222887456417084,
0.03361757472157478,
0.044269859790802,
-0.0013804675545543432,
0.08080554008483887,
-0.01013627927750349,
-0.04472062364220619,
0.05176679044961929,
0.... | 13 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "module", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "candidate", "annotation": null, "type_comment": null}}, {"_type... | def state_present(module, candidate, prefix):
commands = list()
invoke('set_route', module, commands, prefix)
if commands:
if module.params['vrf'] == 'default':
candidate.add(commands, parents=[])
else:
candidate.add(commands, parents=['vrf context {0}'.format(module.... | |
14,412 | [
-0.029374094679951668,
0.025416718795895576,
0.019492432475090027,
-0.02473360113799572,
-0.05662816762924194,
-0.007708638906478882,
0.011807349510490894,
0.028455419465899467,
0.004083988722413778,
0.06840607523918152,
-0.009775660932064056,
-0.0060126204043626785,
0.04426136612892151,
0... | 10 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "module", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "prefix", "annotation": null, "type_comment": null}}, {"_type": ... | def get_existing(module, prefix, warnings):
key_map = ['tag', 'pref', 'route_name', 'next_hop']
netcfg = get_config(module)
parents = 'vrf context {0}'.format(module.params['vrf'])
prefix_to_regex = fix_prefix_to_regex(prefix)
route_regex = ('.*ip\sroute\s{0}\s(?P<next_hop>\S+)(\sname\s(?P<route_na... | |
14,413 | [
-0.004497994668781757,
0.01688535511493683,
0.04078347608447075,
-0.03954007849097252,
0.001141595421358943,
-0.007025202736258507,
-0.0025551842991262674,
0.03697867691516876,
-0.0039850929751992226,
0.11210482567548752,
0.01668640971183777,
-0.04687613248825073,
0.05779317021369934,
0.04... | 10 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "module", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "candidate", "annotation": null, "type_comment": null}}, {"_type... | def state_absent(module, candidate, prefix):
netcfg = get_config(module)
commands = list()
parents = 'vrf context {0}'.format(module.params['vrf'])
invoke('set_route', module, commands, prefix)
if module.params['vrf'] == 'default':
config = netcfg.get_section(commands[0])
if config:
... | |
14,414 | [
-0.006252343766391277,
-0.019958507269620895,
-0.0002907091984525323,
0.011583167128264904,
-0.009920929558575153,
-0.019141970202326775,
-0.004776744171977043,
0.05197843909263611,
0.01414942741394043,
0.03228822350502014,
0.0156541895121336,
-0.04292653873562813,
0.05048534274101257,
0.0... | 10 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "address", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "mask", "annotation": null, "type_comment": null}}, {"_type": "... | def network_from_string(address, mask, module):
octects = address.split('.')
if len(octects) > 4:
module.fail_json(msg='Incorrect address format.', address=address)
for octect in octects:
try:
if int(octect) < 0 or int(octect) > 255:
module.fail_json(msg='Addres... | |
14,415 | [
-0.020362965762615204,
-0.03609974682331085,
0.008255518041551113,
-0.0037599869538098574,
-0.030467024073004723,
-0.012252621352672577,
0.008913637138903141,
0.03933227062225342,
0.021195292472839355,
0.02889915369451046,
-0.025260142982006073,
-0.05408187210559845,
0.014604427851736546,
... | 9 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "module", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "commands", "annotation": null, "type_comment": null}}, {"_type"... | def set_route(module, commands, prefix):
route_cmd = 'ip route {0} {1}'.format(prefix, module.params['next_hop'])
if module.params['route_name']:
route_cmd += ' name {0}'.format(module.params['route_name'])
if module.params['tag']:
route_cmd += ' tag {0}'.format(module.params['tag'])
if... | |
14,416 | [
0.03248724341392517,
-0.011553781107068062,
0.005807948764413595,
0.024432726204395294,
0.005321364849805832,
0.017682667821645737,
0.013230942189693451,
0.035572394728660583,
0.02627553418278694,
0.06555424630641937,
-0.019887825474143028,
-0.03511686623096466,
0.00940556451678276,
-0.031... | 10 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "module", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "prefix", "annotation": null, "type_comment": null}}], "kwarg": ... | def normalize_prefix(module, prefix):
splitted_prefix = prefix.split('/')
address = splitted_prefix[0]
if len(splitted_prefix) > 2:
module.fail_json(msg='Incorrect address format.', address=address)
elif len(splitted_prefix) == 2:
mask = splitted_prefix[1]
network = network_from... | |
14,417 | [
-0.0006018015556037426,
0.002843463560566306,
-0.0033311371225863695,
-0.037941932678222656,
-0.023707475513219833,
0.017238400876522064,
-0.006487771403044462,
0.012495659291744232,
0.013661090284585953,
0.09792109578847885,
-0.0008880954701453447,
-0.051553163677453995,
0.02333354018628597... | 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 main():
argument_spec = dict(
prefix=dict(required=True, type='str'),
next_hop=dict(required=True, type='str'),
vrf=dict(type='str', default='default'),
tag=dict(type='str'),
route_name=dict(type='str'),
pref=dict(type='str'),
state=dict(choices=['absent',... | |
14,418 | [
0.004288012161850929,
0.027015693485736847,
0.024367570877075195,
-0.04533388838171959,
-0.005317499861121178,
0.009165170602500439,
-0.028181837871670723,
-0.018318194895982742,
-0.004959153011441231,
0.027137165889143944,
0.0035956138744950294,
-0.004257644060999155,
-0.008375593461096287,... | 11 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "argv", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []... | def main(argv):
try:
argv = FLAGS(argv)
except gflags.FlagsError as e:
logging.error('%s\\nUsage: %s ARGS\\n%s', e, argv[0], FLAGS)
sys.exit(1)
numeric_level = getattr(logging, FLAGS.logging_level.upper())
if not isinstance(numeric_level, int):
logging.error('Invalid log... | |
14,419 | [
-0.014798929914832115,
-0.009809311479330063,
-0.028794577345252037,
0.020236531272530556,
0.027414578944444656,
-0.014417885802686214,
-0.034396953880786896,
-0.0015718069626018405,
0.008933939971029758,
0.0759204626083374,
-0.01899041421711445,
-0.07620882242918015,
0.04803215712308884,
... | 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": "request", "annotation"... | class RouteState(object):
def __init__(self, request):
self._prefixes = ()
# matched subdomain with aliases replaced by their main value
self.primary_subdomains = () # tuple to be sure it's readonly
self.primary_domain = ''
# remaining subdomain part for match
self._d... | |
14,420 | [
0.006236783694475889,
-0.057028163224458694,
0.00965331681072712,
-0.030039703473448753,
0.03367111086845398,
-0.01084050815552473,
0.017104150727391243,
0.032360367476940155,
0.015986794605851173,
-0.003478309605270624,
0.03263970464468002,
-0.006999594625085592,
0.002753102220594883,
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": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"a... | def streaming():
consumer = oauth.Consumer(key=CONSUMER_KEY, secret=CONSUMER_SECRET)
token = oauth.Token(key=ACCESS_TOKEN_KEY, secret=ACCESS_TOKEN_SECRET)
request = oauth.Request.from_consumer_and_token(consumer, token, http_url=TWITTER_URL)
request.sign_request(oauth.SignatureMethod_HMAC_SHA1(), consu... | |
14,421 | [
-0.00025681228726170957,
0.0015112932305783033,
0.02639653906226158,
-0.011272849515080452,
0.026202920824289322,
0.010783427394926548,
-0.0007475792081095278,
-0.024180691689252853,
0.012423798441886902,
0.04844743758440018,
0.005996768828481436,
-0.054126888513565063,
0.026719234883785248,... | 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": "subdomain", "annotation": null, "type_comment": null}}, {"_type":... | def add_subdomain(self, subdomain, alias_matched):
self = self.__copy__()
if subdomain:
self.primary_subdomains = (subdomain, ) + self.primary_subdomains
self.primary_domain = '.'.join(self.primary_subdomains)
if alias_matched:
self.subdomain = self.subdomain[... | |
14,422 | [
-0.003719030413776636,
-0.04100140556693077,
0.02823450043797493,
-0.04428241029381752,
0.021315373480319977,
0.013023581355810165,
0.038211435079574585,
0.00048440860700793564,
-0.04794285073876381,
-0.007800756953656673,
0.01094784401357174,
-0.03970685601234436,
-0.025846285745501518,
-... | 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}}, {"_type": "arg", "_fields": {"arg": "which_set", "annotatio... | class MNIST(DataSet):
def __init__(self, which_set='train', n_datapoints=None, fname="mnist.pkl.gz", preproc=[]):
super(MNIST, self).__init__(preproc)
_logger.info("Loading MNIST data")
fname = datapath(fname)
if fname[-3:] == ".gz":
open_func = gzip.open
else:
... | |
14,423 | [
0.005900433752685785,
-0.03255411982536316,
0.03695332258939743,
-0.04018674045801163,
0.008704926818609238,
0.015958117321133614,
0.044497959315776825,
0.019796423614025116,
-0.049271099269390106,
0.010239150375127792,
0.0182786975055933,
-0.008418979123234749,
-0.018091730773448944,
-0.0... | 13 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "which_set", "annotation": null, "type_comment": null}}, {"_type":... | def __init__(self, which_set='train', n_datapoints=None, fname="mnist.pkl.gz", preproc=[]):
super(MNIST, self).__init__(preproc)
_logger.info("Loading MNIST data")
fname = datapath(fname)
if fname[-3:] == ".gz":
open_func = gzip.open
else:
open_func = op... | |
14,424 | [
0.005775899160653353,
0.020008139312267303,
0.027309922501444817,
0.005267270375043154,
-0.019409017637372017,
-0.010734247975051403,
-0.011158624663949013,
-0.02068214863538742,
-0.06829977035522461,
0.019783468917012215,
-0.00045870186295360327,
-0.03152873367071152,
0.005339039955288172,
... | 17 | {"_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": "meta", "annotation": null, "type_comment": null}}, {"_type": "arg... | def basic_info(data,meta,rescale=True,rotate=False,user_peak=0,nonlinear=None):
print('in basic_info')
#from . import read_grid,parse_inp,read_inp,show
dims = data.shape
ndims = len(dims)
mxg = meta['MXG']['v']
if ndims ==4:
nt,nx,ny,nz = data.shape
print(nt,nx,... | |
14,425 | [
0.010654892772436142,
-0.01351489033550024,
0.023732371628284454,
-0.02801676094532013,
0.025953076779842377,
-0.015163594856858253,
0.01384014543145895,
-0.005725603085011244,
-0.006650896277278662,
0.008630462922155857,
-0.013885008171200752,
0.01975080743432045,
-0.0025305370800197124,
... | 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": "x", "annotation": null, "type_comment": null}}, {"_type": "arg", ... | def prepare(self, x, y, n_datapoints):
N = x.shape[0]
assert N == y.shape[0]
if n_datapoints is not None:
N = n_datapoints
x = x[:N]
y = y[:N]
one_hot = np.zeros((N, 10), dtype=floatX)
for n in xrange(N):
one_hot[n, y[n]] = 1.
r... | |
14,426 | [
-0.025614870712161064,
-0.017867308109998703,
0.0707680955529213,
-0.040642574429512024,
-0.043634090572595596,
-0.03304692357778549,
0.04052571579813957,
0.01586906611919403,
-0.009687376208603382,
0.04828496649861336,
0.005261448677629232,
-0.05730626359581947,
-0.008115660399198532,
0.0... | 11 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}}, "body": [{"_type": "Assign", "_fields": {"value": {"_type": "List", "_fields": {"c... | def test_matches_basic():
instances = [Basic(b1, b1, b2), Basic(b1, b2, b1), Basic(b2, b1, b1),
Basic(b1, b2), Basic(b2, b1), b2, b1]
for i, b_i in enumerate(instances):
for j, b_j in enumerate(instances):
if i == j:
assert b_i.matches(b_j) == {}
... | |
14,427 | [
0.013266141526401043,
-0.0469709150493145,
0.04412563145160675,
-0.027599265798926353,
-0.01815054751932621,
-0.006034375634044409,
0.027101341634988785,
0.029448701068758965,
-0.005628329701721668,
0.01374035608023405,
0.02286897972226143,
-0.04746884107589722,
-0.02170715481042862,
0.018... | 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_equality():
instances = [b1, b2, b3, b21, Basic(b1, b1, b1), Basic]
for i, b_i in enumerate(instances):
for j, b_j in enumerate(instances):
assert (b_i == b_j) == (i == j)
assert (b_i != b_j) == (i != j)
assert Basic() != []
assert not(Basic() == [])
assert ... | |
14,428 | [
0.00013797708379570395,
-0.007074355613440275,
0.05917636305093765,
-0.02307232841849327,
-0.040857505053281784,
-0.002626509638503194,
0.020801087841391563,
0.020453575998544693,
0.026857728138566017,
0.01730114221572876,
-0.0004440864722710103,
-0.048602063208818436,
0.012932417914271355,
... | 9 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}}, "body": [{"_type": "Assert", "_fields": {"msg": null, "test": {"_type": "Compare",... | def test_subs():
assert b21.subs(b2, b1) == Basic(b1, b1)
assert b21.subs(b2, b21) == Basic(b21, b1)
assert b3.subs(b2, b1) == b2
assert b21.subs([(b2, b1), (b1, b2)]) == Basic(b2, b2)
assert b21.subs({b1: b2, b2: b1}) == Basic(b2, b2)
raises(ValueError, lambda: b21.subs('bad arg'))
raise... | |
14,429 | [
0.011759401299059391,
-0.018046729266643524,
0.007781956810504198,
-0.025519877672195435,
-0.03834157809615135,
-0.0066640726290643215,
-0.0014452205505222082,
0.006941999774426222,
0.020665418356657028,
0.01593448407948017,
0.012969927862286568,
-0.03569818288087845,
-0.002198711736127734,
... | 9 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}}, "body": [{"_type": "Assert", "_fields": {"msg": null, "test": {"_type": "Compare",... | def test_xreplace():
assert b21.xreplace({b2: b1}) == Basic(b1, b1)
assert b21.xreplace({b2: b21}) == Basic(b21, b1)
assert b3.xreplace({b2: b1}) == b2
assert Basic(b1, b2).xreplace({b1: b2, b2: b1}) == Basic(b2, b1)
assert Atom(b1).xreplace({b1: b2}) == Atom(b1)
assert Atom(b1).xreplace({Atom(b... | |
14,430 | [
0.02998366579413414,
-0.006049228832125664,
0.02405041642487049,
-0.006952645722776651,
0.04390116408467293,
0.03242533281445503,
0.03152191638946533,
-0.0026049530133605003,
0.018935123458504677,
-0.012342624366283417,
0.02046116627752781,
-0.04407208040356636,
0.011634541675448418,
0.010... | 9 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}}, "body": [{"_type": "Global", "_fields": {"names": ["instantiated"]}}, {"_type": "A... | def test_Singleton():
global instantiated
instantiated = 0
class MySingleton(with_metaclass(Singleton, Basic)):
def __new__(cls):
global instantiated
instantiated += 1
return Basic.__new__(cls)
assert instantiated == 1
assert MySingleton() is not Basic()... | |
14,431 | [
0.048912353813648224,
0.012876177206635475,
0.028711551800370216,
-0.037417951971292496,
-0.025996915996074677,
0.017914149910211563,
0.008327328599989414,
0.019222555682063103,
-0.05395032837986946,
0.03494787588715553,
0.003998585045337677,
-0.015101689845323563,
0.003631742438301444,
-0... | 11 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}}, "body": [{"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"a... | def test_preorder_traversal():
expr = Basic(b21, b3)
assert list(
preorder_traversal(expr)) == [expr, b21, b2, b1, b1, b3, b2, b1]
assert list(preorder_traversal(('abc', ('d', 'ef')))) == [
('abc', ('d', 'ef')), 'abc', ('d', 'ef'), 'd', 'ef']
result = []
pt = preorder_traversal(expr... | |
14,432 | [
0.0401628315448761,
-0.0141183752566576,
-0.0026526760775595903,
0.0044534895569086075,
0.0394863523542881,
0.014907601289451122,
-0.03437517583370209,
-0.04041337966918945,
0.03570307791233063,
0.000743422657251358,
-0.007804567925632,
-0.07295955717563629,
0.015045402571558952,
0.0014954... | 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 test_call():
x, y = symbols('x y')
# See the long history of this in issues 5026 and 5105.
raises(TypeError, lambda: sin(x)({ x : 1, sin(x) : 2}))
raises(TypeError, lambda: sin(x)(1))
# No effect as there are no callables
assert sin(x).rcall(1) == sin(x)
assert (1 + sin(x)).rcall(1) ==... | |
14,433 | [
0.07399525493383408,
-0.0012415357632562518,
0.05920508876442909,
-0.037575021386146545,
0.03344443440437317,
-0.017166366800665855,
0.025338711217045784,
-0.001319955918006599,
0.019031792879104614,
0.01443484891206026,
-0.012158583849668503,
0.018254531547427177,
0.012158583849668503,
-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_write_entries_single(self):
TEXT = 'TEXT'
ENTRY = {
'textPayload': TEXT,
'resource': {
'type': 'global',
},
'logName': 'projects/%s/logs/%s' % (
self.PROJECT, self.LOGGER_NAME),
}
SENT = {
... | |
14,434 | [
0.04888523742556572,
-0.0027449082117527723,
0.06065816059708595,
-0.04520619660615921,
0.023189445957541466,
-0.008841191418468952,
0.02837459184229374,
-0.015900349244475365,
0.0126581946387887,
0.024097707122564316,
-0.007059156894683838,
0.00877795834094286,
-0.013198553584516048,
-0.0... | 8 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []... | def test_write_entries_multiple(self):
TEXT = 'TEXT'
LOG_NAME = 'projects/%s/logs/%s' % (self.PROJECT, self.LOGGER_NAME)
RESOURCE = {
'type': 'global',
}
LABELS = {
'baz': 'qux',
'spam': 'eggs',
}
ENTRY1 = {
'textPay... | |
14,435 | [
0.04221932217478752,
0.011905848979949951,
0.02786475233733654,
-0.07688138633966446,
0.009926818311214447,
0.03696301579475403,
0.016486644744873047,
0.016877174377441406,
0.04627237468957901,
0.019526436924934387,
0.009214366786181927,
-0.02645040489733219,
-0.01471343357115984,
-0.04335... | 8 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []... | def test_logger_delete(self):
path = '/projects/%s/logs/%s' % (self.PROJECT, self.LOGGER_NAME)
conn = _Connection({})
client = _Client(conn)
api = self._make_one(client)
api.logger_delete(self.PROJECT, self.LOGGER_NAME)
self.assertEqual(conn._called_with['method'], 'DEL... | |
14,436 | [
-0.0480707585811615,
-0.0057499464601278305,
0.033668797463178635,
-0.017713448032736778,
0.024541134014725685,
-0.010903825052082539,
-0.028948422521352768,
0.031212275847792625,
0.0017972346395254135,
-0.015473677776753902,
0.0076585677452385426,
-0.02192806825041771,
-0.027069905772805214... | 8 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []... | def test_sink_get_hit(self):
RESPONSE = {
'name': self.SINK_PATH,
'filter': self.FILTER,
'destination': self.DESTINATION_URI,
}
conn = _Connection(RESPONSE)
client = _Client(conn)
api = self._make_one(client)
response = api.sink_get(se... | |
14,437 | [
-0.005656594876199961,
0.0074325366877019405,
-0.0043561942875385284,
0.0004792107501998544,
0.009845469146966934,
-0.04847000166773796,
0.025479627773165703,
0.005260310135781765,
-0.010814164765179157,
-0.020947307348251343,
0.015710480511188507,
0.005213343072682619,
-0.03393369913101196,... | 8 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []... | def test_sink_create_ok(self):
sent = {
'name': self.SINK_NAME,
'filter': self.FILTER,
'destination': self.DESTINATION_URI,
}
after_create = sent.copy()
after_create['writerIdentity'] = self.WRITER_IDENTITY
conn = _Connection(after_create)
... | |
14,438 | [
0.011534676887094975,
0.011254164390265942,
0.04981903359293938,
-0.027961494401097298,
0.011147569864988327,
0.01524866372346878,
-0.015136458911001682,
0.03889026492834091,
0.004639678169041872,
-0.03538946807384491,
0.02661503292620182,
-0.03671348839998245,
-0.03639931231737137,
0.0230... | 8 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []... | def test_sink_delete_hit(self):
conn = _Connection({})
client = _Client(conn)
api = self._make_one(client)
api.sink_delete(self.PROJECT, self.SINK_NAME)
self.assertEqual(conn._called_with['method'], 'DELETE')
path = '/projects/%s/sinks/%s' % (self.PROJECT, self.SINK_NAM... | |
14,439 | [
-0.0029958500526845455,
-0.003953317645937204,
0.00868947058916092,
-0.012862584553658962,
0.0006447099731303751,
0.005311235785484314,
0.018739869818091393,
0.011826833710074425,
-0.021064288914203644,
-0.015524224378168583,
0.019546793773770332,
0.008846038021147251,
-0.07033473253250122,
... | 8 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []... | def test_sink_update_hit(self):
sent = {
'name': self.SINK_NAME,
'filter': self.FILTER,
'destination': self.DESTINATION_URI,
}
after_update = sent.copy()
after_update['writerIdentity'] = self.WRITER_IDENTITY
conn = _Connection(after_update)
... | |
14,440 | [
0.029968611896038055,
-0.030201107263565063,
-0.01320571918040514,
-0.013961328193545341,
0.004484248347580433,
-0.018088115379214287,
-0.005969310645014048,
-0.021145425736904144,
0.029596619307994843,
0.0007912097498774529,
0.013659084215760231,
-0.02187778428196907,
-0.007753709796816111,... | 8 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []... | def test_metric_create_ok(self):
SENT = {
'name': self.METRIC_NAME,
'filter': self.FILTER,
'description': self.DESCRIPTION,
}
conn = _Connection({})
client = _Client(conn)
api = self._make_one(client)
api.metric_create(
sel... | |
14,441 | [
-0.01571342535316944,
-0.03863077983260155,
0.013451997190713882,
-0.026157956570386887,
0.008661034516990185,
0.005254322197288275,
-0.04581139609217644,
0.005767223425209522,
0.03643929213285446,
0.0136851342394948,
0.00580802233889699,
-0.02585487999022007,
-0.0077401441521942616,
-0.00... | 8 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []... | def test_metric_get_hit(self):
RESPONSE = {
'name': self.METRIC_NAME,
'filter': self.FILTER,
'description': self.DESCRIPTION,
}
conn = _Connection(RESPONSE)
client = _Client(conn)
api = self._make_one(client)
response = api.metric_get(... | |
14,442 | [
0.020825300365686417,
-0.04344227537512779,
-0.008039264008402824,
-0.017253587022423744,
0.000195418979274109,
0.03371604532003403,
-0.008347571827471256,
-0.0014361023204401135,
0.0207205917686224,
-0.001858570845797658,
0.00984257273375988,
-0.015299033373594284,
-0.03857916221022606,
0... | 8 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []... | def test_metric_update_hit(self):
SENT = {
'name': self.METRIC_NAME,
'filter': self.FILTER,
'description': self.DESCRIPTION,
}
conn = _Connection({})
client = _Client(conn)
api = self._make_one(client)
api.metric_update(
se... | |
14,443 | [
0.030488893389701843,
-0.018244976177811623,
0.02705971710383892,
-0.039171744138002396,
0.004627189598977566,
0.03710544481873512,
-0.03824850171804428,
0.010155636817216873,
0.042578935623168945,
-0.004269983619451523,
0.028246739879250526,
-0.04712919145822525,
-0.027455391362309456,
0.... | 8 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []... | def test_metric_delete_hit(self):
conn = _Connection({})
client = _Client(conn)
api = self._make_one(client)
api.metric_delete(self.PROJECT, self.METRIC_NAME)
self.assertEqual(conn._called_with['method'], 'DELETE')
path = '/projects/%s/metrics/%s' % (self.PROJECT, self.... | |
14,444 | [
0.0017681671306490898,
0.03608119860291481,
0.04356575384736061,
-0.060441307723522186,
0.023854074999690056,
0.03255074843764305,
-0.00953221507370472,
-0.0002712194691412151,
-0.006943218410015106,
0.03109149821102619,
0.01828773133456707,
0.012027067132294178,
0.009720506146550179,
-0.0... | 14 | {"_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": "conn", "annotation": null, "type_comment": null}}, {"_type": "arg... | def run(self, conn, tmp, module_name, module_args, inject, complex_args=None, **kwargs):
if self.runner.noop_on_check(inject):
return ReturnData(conn=conn, comm_ok=True, result=dict(skipped=True, msg='check mode not supported for this module'))
args = {}
if complex_args:
... | |
14,445 | [
0.01909196563065052,
-0.015601223334670067,
0.06411875784397125,
-0.01645815744996071,
0.03687332943081856,
0.02070501632988453,
-0.011612704023718834,
-0.028732463717460632,
-0.05786819010972977,
0.002994540147483349,
0.05088670551776886,
-0.10746949911117554,
0.00460916617885232,
-0.0325... | 9 | {"_type": "Module", "_fields": {"body": [{"_type": "ClassDef", "_fields": {"body": [{"_type": "Assign", "_fields": {"value": {"_type": "BinOp", "_fields": {"op": {"_type": "Add", "_fields": {}}, "left": {"_type": "ListComp", "_fields": {"elt": {"_type": "Call", "_fields": {"args": [{"_type": "Name", "_fields": {"id": "... | class FrenchDeck(abc.MutableSequence):
ranks = [str(n) for n in range(2, 11)] + list('JQKA')
suits = 'spades diamonds clubs hearts'.split()
def __init__(self):
self._cards = [Card(rank, suit) for suit in self.suits
for rank in self.ranks]
def __len__(sel... | |
14,446 | [
0.02736978977918625,
0.0052377511747181416,
0.07150038331747055,
-0.02102064900100231,
-0.025953710079193115,
0.02681264467537403,
0.0033835002686828375,
0.01756170205771923,
-0.0012064238544553518,
0.01508936658501625,
0.000883598520886153,
-0.07985757291316986,
0.02864658273756504,
-0.01... | 10 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "abbr", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []... | def scan_speeches(abbr):
sessions = defaultdict(_speech_report_dict)
for speech in db.speeches.find({settings.LEVEL_FIELD: abbr}):
session = speech['session']
obj = sessions[session]
if "speaker_id" in speech and speech['speaker_id']:
obj['_speakers_with_id_count'] += 1
... | |
14,447 | [
0.03030761331319809,
0.03504948318004608,
0.046530865132808685,
-0.021025655791163445,
0.0021376251243054867,
-0.013277237303555012,
0.009206291288137436,
0.021166902035474777,
-0.015123539604246616,
0.0264737606048584,
0.02958120033144951,
0.03849995136260986,
0.03950886055827141,
-0.0092... | 9 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "cmd", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "basename", "annotation": null, "type_comment": null}}, {"_type": "... | def write_pbr_json(cmd, basename, filename):
if not hasattr(cmd.distribution, 'pbr') or not cmd.distribution.pbr:
return
git_dir = git._run_git_functions()
if not git_dir:
return
values = dict()
git_version = git.get_git_short_sha(git_dir)
is_release = git.get_is_release(git_dir)... | |
14,448 | [
0.031626056879758835,
-0.0044372184202075005,
-0.007471492979675531,
0.004355652257800102,
0.055813249200582504,
-0.018531912937760353,
0.025296496227383614,
0.06781984120607376,
0.01777062565088272,
-0.003855377435684204,
0.0029146436136215925,
-0.015356256626546383,
0.05668329447507858,
... | 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": "userid", "annotation": null, "type_comment": null}}, {"_type": "a... | def authenticate_credentials(self, userid, password):
if password:
return
try:
key = ApiKey.objects.get_from_cache(key=userid)
except ApiKey.DoesNotExist:
return None
if not key.is_active:
raise AuthenticationFailed('Key is disabled')
... | |
14,449 | [
0.04064595326781273,
0.021910207346081734,
-0.007346300408244133,
-0.0018553431145846844,
0.024258878082036972,
-0.012665665708482265,
-0.007233693264424801,
0.05435189977288246,
-0.0070192026905715466,
-0.004826036747545004,
-0.015121581964194775,
-0.024838002398610115,
0.013545076362788677... | 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": "userid", "annotation":... | class ApiKeyAuthentication(QuietBasicAuthentication):
def authenticate_credentials(self, userid, password):
if password:
return
try:
key = ApiKey.objects.get_from_cache(key=userid)
except ApiKey.DoesNotExist:
return None
if not key.is_active:
... | |
14,450 | [
0.025910217314958572,
0.012449805624783039,
0.013127126730978489,
0.0029646235052496195,
0.029716117307543755,
0.017406076192855835,
-0.010288828983902931,
0.03373703733086586,
-0.013116375543177128,
-0.0043595824390649796,
-0.003499492071568966,
-0.019857332110404968,
-0.0039080348797142506... | 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": "userid", "annotation":... | class ProjectKeyAuthentication(QuietBasicAuthentication):
def authenticate_credentials(self, userid, password):
try:
pk = ProjectKey.objects.get_from_cache(public_key=userid)
except ProjectKey.DoesNotExist:
return None
if not constant_time_compare(pk.secret_key, pass... | |
14,451 | [
0.021600300446152687,
-0.011019687168300152,
0.012336909770965576,
0.003341246396303177,
0.0598854161798954,
0.007699859328567982,
0.019544148817658424,
0.04930480197072029,
0.019394222646951675,
-0.0006341809057630599,
0.015870919451117516,
-0.00791939627379179,
0.02829350344836712,
-0.04... | 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": "userid", "annotation": null, "type_comment": null}}, {"_type": "a... | def authenticate_credentials(self, userid, password):
try:
pk = ProjectKey.objects.get_from_cache(public_key=userid)
except ProjectKey.DoesNotExist:
return None
if not constant_time_compare(pk.secret_key, password):
return None
if not pk.is_active:
... | |
14,452 | [
-0.00043507482041604817,
-0.0351751409471035,
0.041582606732845306,
-0.0050000641494989395,
-0.012894035317003727,
0.02394229918718338,
-0.002564304508268833,
-0.003556407056748867,
0.022439314052462578,
0.035623397678136826,
0.04121344909071922,
0.0056724525056779385,
-0.04308559000492096,
... | 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 StudentTTest(tf.test.TestCase):
def testStudentPDFAndLogPDF(self):
with self.test_session():
batch_size = 6
df = tf.constant([3.0] * batch_size)
mu = tf.constant([7.0] * batch_size)
sigma = tf.constant([8.0] * batch_size)
df_v = 3.0
mu_v = 7.0
sigma_v = 8.0
t... | |
14,453 | [
-0.0035808244720101357,
-0.03040873073041439,
0.012120629660785198,
-0.045648813247680664,
-0.012477818876504898,
0.012132535688579082,
0.04657750576734543,
0.026432020589709282,
0.03028966672718525,
0.022669624537229538,
0.024229351431131363,
0.01379941962659359,
-0.02845609374344349,
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 testStudentPDFAndLogPDF(self):
with self.test_session():
batch_size = 6
df = tf.constant([3.0] * batch_size)
mu = tf.constant([7.0] * batch_size)
sigma = tf.constant([8.0] * batch_size)
df_v = 3.0
mu_v = 7.0
sigma_v = 8.0
t = np.array([-2.5, 2.5, 8.0, 0.0, -1.0, 2... | |
14,454 | [
-0.00838255975395441,
-0.022751782089471817,
0.025375567376613617,
-0.024316199123859406,
-0.010667592287063599,
0.011572983115911484,
0.03219987079501152,
0.030105769634246826,
0.02007872425019741,
0.03651125356554985,
0.027543576434254646,
0.0067442343570292,
-0.017257848754525185,
0.029... | 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 testStudentLogPDFMultidimensional(self):
with self.test_session():
batch_size = 6
df = tf.constant([[1.5, 7.2]] * batch_size)
mu = tf.constant([[3.0, -3.0]] * batch_size)
sigma = tf.constant([[math.sqrt(10.0), math.sqrt(15.0)]] * batch_size)
df_v = np.array([1.5, 7.2])
mu_v =... | |
14,455 | [
-0.0007111552404239774,
-0.03678622469305992,
0.06688841432332993,
-0.017190948128700256,
0.0005605090409517288,
-0.016637952998280525,
0.01707073114812374,
0.04318173974752426,
0.03967141732573509,
0.03616109862923622,
0.00884792860597372,
0.015231420285999775,
-0.02103787288069725,
0.051... | 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 testStudentEntropy(self):
df_v = np.array([[2., 3., 7.]]) # 1x3
mu_v = np.array([[1., -1, 0]]) # 1x3
sigma_v = np.array([[1., 2., 3.]]).T # transposed => 3x1
with self.test_session():
student = tf.contrib.distributions.StudentT(df=df_v,
mu=m... | |
14,456 | [
0.008447534404695034,
-0.054924603551626205,
0.06933105736970901,
-0.02162218652665615,
-0.007284513209015131,
0.008491303771734238,
0.03729170560836792,
0.005746324080973864,
0.02606167457997799,
0.029863378033041954,
0.01795804500579834,
0.00004259720662957989,
-0.023222902789711952,
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 testStudentSampleMultipleTimes(self):
with self.test_session():
df = tf.constant(4.0)
mu = tf.constant(3.0)
sigma = tf.constant(math.sqrt(10.0))
df_v = 4.0
mu_v = 3.0
sigma_v = np.sqrt(10.0)
n = tf.constant(100)
tf.set_random_seed(654321)
student = tf.contr... | |
14,457 | [
-0.01146302092820406,
-0.03663182631134987,
0.011930263601243496,
0.0004991709138266742,
0.0036320332437753677,
-0.010640673339366913,
0.004582093097269535,
0.0182411540299654,
0.019848469644784927,
0.04353455826640129,
0.02414710260927677,
-0.00024121403112076223,
-0.032868966460227966,
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 testStudentSample(self):
with self.test_session():
df = tf.constant(4.0)
mu = tf.constant(3.0)
sigma = tf.constant(math.sqrt(10.0))
df_v = 4.0
mu_v = 3.0
sigma_v = np.sqrt(10.0)
n = tf.constant(200000)
student = tf.contrib.distributions.StudentT(df=df, mu=mu, sigm... | |
14,458 | [
0.019418301060795784,
-0.04844890162348747,
0.007045792415738106,
-0.023619141429662704,
0.01541115716099739,
-0.02359492890536785,
0.012699374929070473,
0.008692231960594654,
0.014236859045922756,
0.034236256033182144,
0.023994432762265205,
-0.007699525449424982,
-0.046100303530693054,
0.... | 11 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []... | def testStudentSampleSmallDfNoNan(self):
with self.test_session():
df_v = [1e-1, 1e-5, 1e-10, 1e-20]
df = tf.constant(df_v)
n = tf.constant(200000)
student = tf.contrib.distributions.StudentT(df=df, mu=1.0, sigma=1.0)
samples = student.sample(n)
sample_values = samples.eval()
... | |
14,459 | [
-0.0016809722874313593,
-0.04944664239883423,
0.04208865761756897,
-0.01290785800665617,
-0.0005520840641111135,
-0.003562845289707184,
0.014791300520300865,
0.014150930568575859,
-0.01393747329711914,
0.04583043232560158,
0.005986207630485296,
-0.006516710855066776,
-0.017842477187514305,
... | 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 testStudentSampleMultiDimensional(self):
with self.test_session():
batch_size = 7
df = tf.constant([[3.0, 7.0]] * batch_size)
mu = tf.constant([[3.0, -3.0]] * batch_size)
sigma = tf.constant([[math.sqrt(10.0), math.sqrt(15.0)]] * batch_size)
df_v = [3.0, 7.0]
mu_v = [3.0, -3.... | |
14,460 | [
-0.03280474990606308,
-0.02285083569586277,
0.019855506718158722,
0.01641545444726944,
-0.021163510158658028,
-0.03453131392598152,
-0.0036133620887994766,
-0.018861422315239906,
-0.017370298504829407,
0.06540022045373917,
-0.0009720107773318887,
-0.03201994672417641,
-0.03581316024065018,
... | 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": "df", "annotation": null, "type_comment": null}}, {"_type": "arg",... | def _checkKLApprox(self, df, mu, sigma, samples):
n = samples.size
np.random.seed(137)
sample_scipy = stats.t.rvs(df, loc=mu, scale=sigma, size=n)
covg = 0.99
r = stats.t.interval(covg, df, loc=mu, scale=sigma)
bins = 100
hist, _ = np.histogram(samples, bins=bins, range=r)
hist_scipy, _ ... | |
14,461 | [
0.005416949279606342,
-0.03468829765915871,
0.029559385031461716,
-0.015448681078851223,
-0.005500572733581066,
0.015523012727499008,
0.02355087548494339,
0.0026960859540849924,
0.02166779711842537,
0.029931044206023216,
-0.002208281774073839,
0.007947336882352829,
-0.019202450290322304,
0... | 11 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []... | def testBroadcastingParams(self):
def _check(student):
self.assertEqual(student.mean().get_shape(), (3,))
self.assertEqual(student.variance().get_shape(), (3,))
self.assertEqual(student.entropy().get_shape(), (3,))
self.assertEqual(student.log_pdf(2.).get_shape(), (3,))
self.assertEqu... | |
14,462 | [
-0.015769001096487045,
-0.03633834421634674,
0.0407407321035862,
-0.0066781966015696526,
-0.02223578281700611,
-0.02666304260492325,
0.0003983444767072797,
-0.005627344362437725,
0.027682803571224213,
0.041586387902498245,
0.020768320187926292,
0.034597285091876984,
-0.023802734911441803,
... | 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 testMeanAllowNanStatsIsFalseWorksWhenAllBatchMembersAreDefined(self):
with self.test_session():
mu = [1., 3.3, 4.4]
student = tf.contrib.distributions.StudentT(
df=[3., 5., 7.],
mu=mu,
sigma=[3., 2., 1.])
mean = student.mean().eval()
self.assertAllClose([1.,... | |
14,463 | [
-0.0026265406049788,
-0.03845280036330223,
0.03832963481545448,
-0.0059766885824501514,
0.006786512676626444,
0.025446344166994095,
0.023771269246935844,
-0.015161882154643536,
-0.009028156287968159,
0.03308270871639252,
0.0061768353916704655,
-0.002337097655981779,
0.018253378570079803,
0... | 11 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []... | def testBroadcastingPdfArgs(self):
def _assert_shape(student, arg, shape):
self.assertEqual(student.log_pdf(arg).get_shape(), shape)
self.assertEqual(student.pdf(arg).get_shape(), shape)
def _check(student):
_assert_shape(student, 2., (3,))
xs = np.array([2., 3., 4.], dtype=np.float32)... | |
14,464 | [
-0.01796661876142025,
-0.03261745721101761,
0.022694677114486694,
-0.002675650641322136,
-0.000430207175668329,
-0.019035037606954575,
-0.0004812487168237567,
0.006100422237068415,
0.029719218611717224,
0.03016132302582264,
0.012268388643860817,
0.014957854524254799,
-0.028736764565110207,
... | 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 testMeanAllowNanStatsIsFalseRaisesWhenBatchMemberIsUndefined(self):
with self.test_session():
mu = [1., 3.3, 4.4]
student = tf.contrib.distributions.StudentT(
df=[0.5, 5., 7.],
mu=mu,
sigma=[3., 2., 1.],
allow_nan_stats=False)
with self.assertRaisesOpErr... | |
14,465 | [
-0.012088065035641193,
-0.027073467150330544,
0.02619476616382599,
-0.0017247460782527924,
-0.03628794476389885,
-0.035219255834817886,
-0.010817511938512325,
0.007296774070709944,
0.04025397077202797,
0.04229635372757912,
0.02392677031457424,
0.022240614518523216,
-0.03569422662258148,
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 testMeanAllowNanStatsIsTrueReturnsNaNForUndefinedBatchMembers(self):
with self.test_session():
mu = [-2, 0., 1., 3.3, 4.4]
student = tf.contrib.distributions.StudentT(
df=[0.5, 1., 3., 5., 7.],
mu=mu,
sigma=[5., 4., 3., 2., 1.],
allow_nan_stats=True)
mea... | |
14,466 | [
-0.030371902510523796,
-0.01858164556324482,
0.006128661334514618,
0.0017136266687884927,
-0.03860235959291458,
-0.029765980318188667,
-0.022759992629289627,
-0.03327528387308121,
0.04504029452800751,
0.056098394095897675,
0.05619938299059868,
0.006936558987945318,
-0.03840038552880287,
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 testVarianceAllowNanStatsTrueReturnsNaNforUndefinedBatchMembers(self):
with self.test_session():
# df = 0.5 ==> undefined mean ==> undefined variance.
# df = 1.5 ==> infinite variance.
df = [0.5, 1.5, 3., 5., 7.]
mu = [-2, 0., 1., 3.3, 4.4]
sigma = [5., 4., 3., 2., 1.]
studen... | |
14,467 | [
-0.026561200618743896,
-0.024296589195728302,
0.02485954388976097,
-0.00008321365748997778,
-0.03956032544374466,
-0.03838323801755905,
-0.037206150591373444,
-0.02633090130984783,
0.03751321882009506,
0.04424307867884636,
0.052303560078144073,
0.02735445462167263,
-0.02613898552954197,
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 testVarianceAllowNanStatsFalseGivesCorrectValueForDefinedBatchMembers(
self):
with self.test_session():
# df = 1.5 ==> infinite variance.
df = [1.5, 3., 5., 7.]
mu = [0., 1., 3.3, 4.4]
sigma = [4., 3., 2., 1.]
student = tf.contrib.distributions.StudentT(
df=df, mu=m... | |
14,468 | [
0.005684670526534319,
-0.036041583865880966,
0.026257764548063278,
-0.009113519452512264,
-0.03127213194966316,
0.006896369159221649,
0.013264231383800507,
0.01423101220279932,
0.022455092519521713,
0.03271586075425148,
0.008050060831010342,
0.014759519137442112,
-0.025252312421798706,
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 testStd(self):
with self.test_session():
# Defined for all batch members.
df = [3.5, 5., 3., 5., 7.]
mu = [-2.2]
sigma = [5., 4., 3., 2., 1.]
student = tf.contrib.distributions.StudentT(df=df, mu=mu, sigma=sigma)
# Test broadcast of mu across shape of df/sigma
std = stu... | |
14,469 | [
-0.03183525428175926,
-0.014722179621458054,
0.02118018828332424,
-0.0017249509692192078,
-0.010629076510667801,
-0.011642606928944588,
-0.01192847453057766,
-0.022206712514162064,
0.03859212249517441,
0.03895595297217369,
0.04017738997936249,
-0.0062338621355593204,
-0.011785540729761124,
... | 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 testVarianceAllowNanStatsFalseRaisesForUndefinedBatchMembers(self):
with self.test_session():
# df <= 1 ==> variance not defined
student = tf.contrib.distributions.StudentT(
df=1.0, mu=0.0, sigma=1.0, allow_nan_stats=False)
with self.assertRaisesOpError("x < y"):
student.vari... | |
14,470 | [
0.009038346819579601,
-0.04930880293250084,
0.035409193485975266,
-0.022757908329367638,
0.0001144984780694358,
-0.02385019324719906,
0.010442711412906647,
0.02998378500342369,
0.03401683270931244,
0.014283709228038788,
0.02791924960911274,
-0.005029305815696716,
-0.02585471421480179,
0.03... | 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 testPdfOfSample(self):
with self.test_session() as sess:
student = tf.contrib.distributions.StudentT(df=3., mu=np.pi, sigma=1.)
num = 20000
samples = student.sample(num)
pdfs = student.pdf(samples)
mean = student.mean()
mean_pdf = student.pdf(student.mean())
sample_vals... | |
14,471 | [
0.006335299927741289,
-0.014092424884438515,
0.013438133522868156,
-0.019100269302725792,
-0.0025888539385050535,
0.02271145209670067,
0.046605661511421204,
0.024951141327619553,
0.046152692288160324,
0.04637917876243591,
0.011110367253422737,
0.033444344997406006,
-0.005353863351047039,
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 testMode(self):
with self.test_session():
student = tf.contrib.distributions.StudentT(
df=[0.5, 1., 3],
mu=[-1, 0., 1],
sigma=[5., 4., 3.])
# Test broadcast of mu across shape of df/sigma
mode = student.mode().eval()
self.assertAllClose([-1., 0, 1], mode) | |
14,472 | [
0.019007565453648567,
-0.03940996527671814,
0.022317340597510338,
0.0016120378859341145,
-0.050308581441640854,
-0.013203638605773449,
0.015035836026072502,
-0.012222526594996452,
0.016466131433844566,
0.04527299478650093,
0.025934452190995216,
-0.012127961963415146,
0.0015573673881590366,
... | 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": "sample_vals", "annotation": null, "type_comment": null}}, {"_type... | def _assertIntegral(self, sample_vals, pdf_vals, err=1e-3):
s_p = zip(sample_vals, pdf_vals)
prev = (sample_vals.min() - 1000, 0)
total = 0
for k in sorted(s_p, key=lambda x: x[0]):
pair_pdf = (k[1] + prev[1]) / 2
total += (k[0] - prev[0]) * pair_pdf
prev = k
self.assertNear(1., to... | |
14,473 | [
0.014200108125805855,
-0.040882471948862076,
0.06555037200450897,
-0.028523802757263184,
-0.00905272364616394,
-0.012630557641386986,
0.005579938180744648,
0.008230872452259064,
-0.00019165589765179902,
0.012309232726693153,
0.014447282068431377,
-0.013470946811139584,
-0.00407836027443409,
... | 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 testPdfOfSampleMultiDims(self):
with self.test_session() as sess:
student = tf.contrib.distributions.StudentT(df=[7., 11.],
mu=[[5.], [6.]],
sigma=3.)
num = 50000
samples = student.sample(num)
... | |
14,474 | [
0.014307864010334015,
-0.004905919544398785,
0.030229687690734863,
-0.0186245609074831,
0.007448543794453144,
0.04503710940480232,
0.008691035211086273,
0.010676459409296513,
0.02666873298585415,
0.0071411230601370335,
0.017471734434366226,
-0.0212120171636343,
-0.05233834683895111,
0.0104... | 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 testNegativeDofFails(self):
with self.test_session():
student = tf.contrib.distributions.StudentT(df=[2, -5.],
mu=0.,
sigma=1.,
validate_args=True,
... | |
14,475 | [
0.017313439399003983,
0.007568264380097389,
0.023576829582452774,
-0.032819151878356934,
0.0007582586258649826,
0.025410018861293793,
0.026224767789244652,
-0.006931740790605545,
0.0330992229282856,
0.024824416264891624,
0.007625551428645849,
-0.024493424221873283,
-0.057338036596775055,
0... | 11 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []... | def testNegativeScaleFails(self):
with self.test_session():
student = tf.contrib.distributions.StudentT(df=[5.],
mu=0.,
sigma=[[3.], [-2.]],
validate_args=True,... | |
14,476 | [
0.0035982185509055853,
-0.01498156413435936,
0.042553890496492386,
-0.0038595248479396105,
0.00017335949814878404,
0.0037183593958616257,
0.03882952407002449,
0.03133273497223854,
0.035081129521131516,
0.028881860896945,
0.011329282075166702,
-0.0030290512368083,
-0.05425560846924782,
0.02... | 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 testStudentTWithAbsDfSoftplusSigma(self):
with self.test_session():
df = tf.constant([-3.2, -4.6])
mu = tf.constant([-4.2, 3.4])
sigma = tf.constant([-6.4, -8.8])
student = tf.contrib.distributions.StudentTWithAbsDfSoftplusSigma(
df=df,
mu=mu,
sigma=sigma)
... | |
14,477 | [
-0.013782980851829052,
-0.0021976004354655743,
0.03883245214819908,
0.005517809651792049,
0.022232847288250923,
0.017996370792388916,
0.024726251140236855,
-0.018758244812488556,
0.0030676943715661764,
0.05633245036005974,
0.019046831876039505,
-0.010539247654378414,
0.0033129944931715727,
... | 8 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "student", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs":... | def _check(student):
_assert_shape(student, 2., (3,))
xs = np.array([2., 3., 4.], dtype=np.float32)
_assert_shape(student, xs, (3,))
xs = np.array([xs])
_assert_shape(student, xs, (1, 3))
xs = xs.T
_assert_shape(student, xs, (3, 3)) | |
14,478 | [
-0.016445467248558998,
-0.008881678804755211,
0.04350164160132408,
0.009028111584484577,
0.01278466172516346,
0.0241725854575634,
0.02538909949362278,
-0.02055683545768261,
-0.006893579848110676,
0.06510603427886963,
0.023789608851075172,
-0.012390420772135258,
0.010914834216237068,
0.0714... | 8 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "student", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs":... | def _check2d(student):
_assert_shape(student, 2., (1, 3))
xs = np.array([2., 3., 4.], dtype=np.float32)
_assert_shape(student, xs, (1, 3))
xs = np.array([xs])
_assert_shape(student, xs, (1, 3))
xs = xs.T
_assert_shape(student, xs, (3, 3)) | |
14,479 | [
-0.0233459435403347,
-0.004134058021008968,
0.04003146290779114,
-0.0005242932820692658,
0.020854026079177856,
0.009290146641433239,
0.029122142121195793,
-0.03321026638150215,
-0.02298995479941368,
0.060265377163887024,
0.0038182619027793407,
-0.009204020723700523,
0.01361942384392023,
0.... | 8 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "student", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs":... | def _check2d_rows(student):
_assert_shape(student, 2., (3, 1))
xs = np.array([2., 3., 4.], dtype=np.float32) # (3,)
_assert_shape(student, xs, (3, 3))
xs = np.array([xs]) # (1,3)
_assert_shape(student, xs, (3, 3))
xs = xs.T # (3,1)
_assert_shape(student, xs, (3, 1)) | |
14,480 | [
0.00044380276813171804,
-0.016512010246515274,
0.00013820173626299948,
0.009790558367967606,
0.0017355731688439846,
-0.04502863809466362,
0.05200490728020668,
-0.007485898211598396,
0.004578175954520702,
0.04856207221746445,
0.009009125642478466,
0.019377263262867928,
-0.009077075868844986,
... | 11 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "color", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "text", "annotation": null, "type_comment": null}}], "kwarg": nul... | def ircformat(color, text):
if len(color) < 1:
return text
add = sub = ''
if '_' in color: # italic
add += '\x1D'
sub = '\x1D' + sub
color = color.strip('_')
if '*' in color: # bold
add += '\x02'
sub = '\x02' + sub
color = color.strip('*')
# un... | |
14,481 | [
-0.029202822595834732,
-0.00577325327321887,
0.02092869020998478,
-0.02483275532722473,
0.009806763380765915,
-0.005322784185409546,
0.02344510331749916,
0.05219227820634842,
0.06105668097734451,
0.032827287912368774,
0.021249713376164436,
-0.01294451393187046,
0.03904065117239952,
-0.0276... | 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": "service_plugin", "annotation": null, "type_comment": null}}], "kw... | def __init__(self, service_plugin):
super(IPsecVPNDriver, self).__init__(service_plugin)
self.callbacks = IPsecVpnDriverCallBack(self)
self.conn = rpc.create_connection(new=True)
self.conn.create_consumer(
topics.IPSEC_DRIVER_TOPIC,
self.callbacks.create_rpc_dispa... | |
14,482 | [
0.010570394806563854,
-0.007771166041493416,
-0.017289694398641586,
-0.06295104324817657,
0.009932377375662327,
-0.06658371537923813,
0.04589126259088516,
-0.01831282116472721,
-0.0018924972973763943,
0.0187496617436409,
0.02202596701681614,
0.01262239646166563,
-0.009892142377793789,
0.00... | 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": "tokensource", "annotation": null, "type_comment": null}}, {"_type... | def format_unencoded(self, tokensource, outfile):
if self.linenos:
self._format_unencoded_with_lineno(tokensource, outfile)
return
for ttype, value in tokensource:
color = self.colorscheme.get(ttype)
while color is None:
ttype = ttype[:-1]... | |
14,483 | [
0.031607434153556824,
0.006154275964945555,
-0.006386512890458107,
-0.07111091911792755,
0.01733648031949997,
-0.052485525608062744,
0.038226183503866196,
-0.015118617564439774,
-0.01812608540058136,
0.026776906102895737,
0.0034603287931531668,
0.031932562589645386,
-0.013202663511037827,
... | 13 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "tokensource", "annotation": null, "type_comment": null}}, {"_type... | def _format_unencoded_with_lineno(self, tokensource, outfile):
self._write_lineno(outfile)
for ttype, value in tokensource:
if value.endswith("\n"):
self._write_lineno(outfile)
value = value[:-1]
color = self.colorscheme.get(ttype)
whi... | |
14,484 | [
0.03788122534751892,
0.02976207248866558,
-0.018586011603474617,
0.0049185678362846375,
0.04240545257925987,
0.0426255501806736,
-0.02753664366900921,
0.004799348302185535,
0.010540224611759186,
-0.03423738852143288,
-0.010093916207551956,
-0.023342562839388847,
-0.041280508041381836,
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 read_msg(self):
# Because the Tornado Websocket client has no way to cancel
# a pending read, we have to keep track of them...
if self.pending_read is None:
self.pending_read = self.ws.read_message()
response = yield self.pending_read
self.pending_read =... | |
14,485 | [
-0.03547659143805504,
0.0046364073641598225,
0.048440076410770416,
0.018568696454167366,
0.014508957043290138,
-0.0038550228346139193,
0.005155408289283514,
0.018810896202921867,
0.052176885306835175,
0.022501569241285324,
-0.011527584865689278,
-0.011890885420143604,
-0.0009262723033316433,... | 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": "path", "annotation": null, "type_comment": null}}], "kwarg": null... | def get_term_client(self, path):
port = self.get_http_port()
url = 'ws://127.0.0.1:%d%s' % (port, path)
request = tornado.httpclient.HTTPRequest(url,
headers={'Origin' : 'http://127.0.0.1:%d' % port})
ws = yield tornado.websocket.websocket_connect(request)
... | |
14,486 | [
-0.02239413373172283,
-0.002209202153608203,
0.07955645024776459,
0.006073732394725084,
0.014035671949386597,
-0.005403419025242329,
0.019448531791567802,
0.01986393705010414,
0.040961503982543945,
0.03174705430865288,
-0.038897063583135605,
-0.050553593784570694,
-0.012084524147212505,
-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}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs... | class CommonTests(TermTestCase):
@tornado.testing.gen_test
def test_basic(self):
for url in self.test_urls:
tm = yield self.get_term_client(url)
response = yield tm.read_msg()
self.assertEqual(response, ['setup', {}])
# Check f... | |
14,487 | [
-0.0276679378002882,
-0.014870519749820232,
0.011574819684028625,
-0.006837249733507633,
0.013807390816509724,
-0.033116474747657776,
0.010106371715664864,
0.05209333077073097,
0.04927603900432587,
0.04233912006020546,
-0.010013348422944546,
-0.05586744099855423,
-0.01677086390554905,
-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}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []... | def test_basic(self):
for url in self.test_urls:
tm = yield self.get_term_client(url)
response = yield tm.read_msg()
self.assertEqual(response, ['setup', {}])
# Check for initial shell prompt
response = yield tm.read_msg()
... | |
14,488 | [
-0.03488307446241379,
0.014740414917469025,
0.08504679054021835,
-0.023229658603668213,
0.002218779642134905,
0.02284378372132778,
-0.008482812903821468,
0.011788473464548588,
0.04329514503479004,
0.03722405061125755,
-0.008437794633209705,
-0.03557765111327171,
-0.03629795089364052,
-0.00... | 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 NamedTermTests(TermTestCase):
def test_new(self):
response = self.fetch("/new", follow_redirects=False)
self.assertEqual(response.code, 302)
url = response.headers["Location"]
# Check that the new terminal was created
name = url.split('/')[2]
self.asser... | |
14,489 | [
-0.007546776439994574,
-0.009766781702637672,
0.04494579881429672,
-0.0029346852097660303,
0.004743865225464106,
-0.032245881855487823,
-0.026491232216358185,
0.042887020856142044,
0.021431108936667442,
0.0364130400121212,
-0.01085197925567627,
-0.03618980199098587,
-0.007354541216045618,
... | 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_basic_command(self):
for url in self.test_urls:
tm = yield self.get_term_client(url)
yield tm.read_all_msg()
tm.write_stdin("whoami\r")
(stdout, other) = yield tm.read_stdout()
self.assertEqual(stdout[:6], "whoami")
self.ass... | |
14,490 | [
-0.014790820889174938,
-0.0038890838623046875,
0.09579858928918839,
-0.029144207015633583,
-0.009842321276664734,
0.005095451604574919,
-0.02368992008268833,
-0.01593909226357937,
0.013997967354953289,
0.024373413994908333,
0.0008026788709685206,
-0.01757947914302349,
0.024428093805909157,
... | 8 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []... | def test_namespace(self):
names = ["/named/1"]*2 + ["/named/2"]*2
tms = yield self.get_term_clients(names)
pids = yield self.get_pids(tms)
self.assertEqual(pids[0], pids[1])
self.assertEqual(pids[2], pids[3])
self.assertNotEqual(pids[0], pids[3]) | |
14,491 | [
-0.03954240679740906,
0.007742749992758036,
0.02005605399608612,
-0.02926189824938774,
0.03244704380631447,
0.03226577490568161,
-0.0009427575278095901,
0.04057822749018669,
0.05401798337697983,
0.028614511713385582,
0.0025393760297447443,
-0.02368142083287239,
-0.01887780986726284,
-0.013... | 8 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []... | def test_new(self):
response = self.fetch("/new", follow_redirects=False)
self.assertEqual(response.code, 302)
url = response.headers["Location"]
# Check that the new terminal was created
name = url.split('/')[2]
self.assertIn(name, self.named_tm.terminals) | |
14,492 | [
-0.0033966905903071165,
0.013440382666885853,
0.10986514389514923,
0.008563253097236156,
0.005735450424253941,
0.008257185108959675,
0.022156670689582825,
0.022010289132595062,
0.03473207727074623,
0.01900283806025982,
0.019295597448945045,
-0.042955994606018066,
-0.04074697941541672,
0.00... | 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 UniqueTermTests(TermTestCase):
@tornado.testing.gen_test
def test_unique_processes(self):
tms = yield self.get_term_clients(["/unique", "/unique"])
pids = yield self.get_pids(tms)
self.assertNotEqual(pids[0], pids[1])
@tornado.testing.gen_test
def test_max_terminal... | |
14,493 | [
-0.008081458508968353,
0.040139324963092804,
0.10386014729738235,
-0.0034289786126464605,
-0.018913153558969498,
0.0027872570790350437,
-0.001297546667046845,
0.048319507390260696,
0.01637447439134121,
0.04747328162193298,
0.018377209082245827,
-0.048911865800619125,
-0.0268112625926733,
-... | 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_max_terminals(self):
urls = ["/named/%d" % i for i in range(MAX_TERMS+1)]
tms = yield self.get_term_clients(urls[:MAX_TERMS])
pids = yield self.get_pids(tms)
# MAX_TERMS+1 should fail
tm = yield self.get_term_client(urls[MAX_TERMS])
msg = yield tm.read_ms... | |
14,494 | [
-0.04795168340206146,
0.02967262826859951,
0.014679315499961376,
-0.03705153614282608,
0.027115803211927414,
-0.03220702335238457,
-0.02219279296696186,
0.029381059110164642,
0.01648479327559471,
0.04656112939119339,
0.007849901914596558,
-0.038464516401290894,
0.06611859798431396,
-0.0381... | 9 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "request", "annotation": null, "type_comment": null}}], "kwarg": n... | def on_run_start(self, request):
debug_urls = self._bad_debug_urls or []
if self._bad_run_start_action:
return framework.OnRunStartResponse(
self._bad_run_start_action, debug_urls)
else:
return framework.OnRunStartResponse(
framework.OnRunStartAction.DEBUG_RUN, debug_urls) | |
14,495 | [
0.015630457550287247,
0.03903999552130699,
0.09068846702575684,
0.012926576659083366,
0.001619436894543469,
-0.0009380443370901048,
0.02955472283065319,
0.046211786568164825,
0.028889596462249756,
0.016367878764867783,
0.03979187831282616,
-0.04334885627031326,
-0.026041122153401375,
0.017... | 9 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []... | def test_max_terminals(self):
tms = yield self.get_term_clients(['/unique'] * MAX_TERMS)
pids = yield self.get_pids(tms)
self.assertEqual(len(set(pids)), MAX_TERMS) # All PIDs unique
# MAX_TERMS+1 should fail
tm = yield self.get_term_client("/unique")
msg =... | |
14,496 | [
0.018486090004444122,
-0.007734938524663448,
0.02434178628027439,
-0.035181302577257156,
0.026038406416773796,
0.014209194108843803,
0.04083670303225517,
0.03082193247973919,
0.08355854451656342,
0.0031428709626197815,
0.046916261315345764,
-0.017107587307691574,
-0.00029823402292095125,
0... | 8 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []... | def testSessionInit(self):
self.assertEqual(0, self._observer["sess_init_count"])
wrapper_sess = TestDebugWrapperSession(self._sess, self._dump_root,
self._observer)
# Assert that on-session-init callback is invoked.
self.assertEqual(1, self._observer["sess_i... | |
14,497 | [
0.04064019396901131,
-0.011755592189729214,
0.010760026052594185,
-0.031277917325496674,
-0.016891658306121826,
0.012355568818747997,
0.04794541001319885,
0.04570373520255089,
0.03565577045083046,
-0.018474014475941658,
0.008511760272085667,
-0.03220095857977867,
-0.010918261483311653,
-0.... | 8 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []... | def setUp(self):
self._observer = {
"sess_init_count": 0,
"request_sess": None,
"on_run_start_count": 0,
"run_fetches": None,
"run_feed_dict": None,
"on_run_end_count": 0,
"performed_action": None,
"tf_error": None,
}
self._dump_root = tempfil... | |
14,498 | [
-0.05016573145985603,
0.026096802204847336,
0.013350168243050575,
-0.02513114921748638,
0.02194448933005333,
-0.013470875099301338,
-0.012613857164978981,
0.025831246748566628,
0.018045661970973015,
0.044685643166303635,
0.0012870358768850565,
-0.048596542328596115,
0.06923740357160568,
-0... | 8 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []... | def testRunStartBadURLs(self):
# debug_urls ought to be a list of str, not a str. So an exception should
# be raised during a run() call.
wrapper = TestDebugWrapperSessionBadAction(
self._sess, bad_debug_urls="file://foo")
with self.assertRaisesRegexp(TypeError, "Expected type .*; got type .*")... | |
14,499 | [
0.012905276380479336,
0.0042012413032352924,
0.004388613626360893,
-0.06604878604412079,
0.03133803978562355,
0.014732157811522484,
0.019662395119667053,
0.043891992419958115,
0.06473717838525772,
0.01962726190686226,
0.0389266237616539,
-0.015762705355882645,
0.03576471284031868,
-0.01229... | 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 testSessionRun(self):
wrapper = TestDebugWrapperSession(
self._sess, self._dump_root, self._observer)
# Check initial state of the observer.
self.assertEqual(0, self._observer["on_run_start_count"])
self.assertEqual(0, self._observer["on_run_end_count"])
s = wrapper.run(self._s)
#... | |
14,500 | [
0.012987631373107433,
-0.01018661167472601,
0.042494092136621475,
-0.025448575615882874,
0.06947484612464905,
0.04979589581489563,
0.005745680071413517,
0.02535281330347061,
0.08264203369617462,
-0.03145759925246239,
0.01885301247239113,
-0.010102820582687855,
0.030212702229619026,
0.03002... | 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 testUsingWrappedSessionShouldSupportEvalWithAsDefault(self):
wrapper = TestDebugWrapperSession(self._sess, self._dump_root,
self._observer)
with wrapper.as_default():
foo = constant_op.constant(42, name="foo")
self.assertEqual(42, foo.eval())
self.ass... |