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 |
|---|---|---|---|---|---|
15,501 | [
-0.02106502093374729,
-0.018999138846993446,
0.005971324164420366,
0.010120494291186333,
0.01390407420694828,
-0.019916018471121788,
-0.07256115972995758,
-0.013915680348873138,
0.027343904599547386,
0.049163319170475006,
-0.0023966538719832897,
-0.004166579805314541,
0.043174587190151215,
... | 12 | {"_type": "Module", "_fields": {"body": [{"_type": "ClassDef", "_fields": {"body": [{"_type": "Assign", "_fields": {"value": {"_type": "Constant", "_fields": {"kind": null, "value": "Find out if a user is blocked in Auth0 on the command line"}}, "targets": [{"_type": "Name", "_fields": {"id": "help", "ctx": {"_type": "... | class Command(BaseCommand):
help = "Find out if a user is blocked in Auth0 on the command line"
def add_arguments(self, parser):
parser.add_argument("email")
def handle(self, *args, **options):
email = options["email"]
if " " in email or email.count("@") != 1:
raise Com... | |
15,502 | [
0.030089816078543663,
-0.025090793147683144,
0.030424680560827255,
0.015319974161684513,
0.024899443611502647,
-0.0437474362552166,
-0.017951039597392082,
0.01255735568702221,
0.036380454897880554,
0.05381723865866661,
0.027315238490700722,
-0.0013790667289867997,
0.03348628431558609,
0.01... | 11 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": {"_type": "arg", "_fields": {"arg": "options", "annotation": null, "type_comment": null}}, "... | def handle(self, *args, **options):
email = options["email"]
if " " in email or email.count("@") != 1:
raise CommandError(f"Invalid email {email!r}")
session = session_with_retries()
users = find_users(
settings.OIDC_RP_CLIENT_ID,
settings.OIDC_RP_CLIE... | |
15,503 | [
0.01992819830775261,
0.058956071734428406,
0.028060823678970337,
0.021868690848350525,
-0.016592297703027725,
0.013245493173599243,
0.033860497176647186,
0.014324755407869816,
0.01437926385551691,
-0.0010772183304652572,
0.005625246558338404,
-0.03340262547135353,
0.03833016753196716,
0.02... | 9 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "exc", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "mapping", "annotation": null, "type_comment": null}}, {"_type": "a... | def _wrap_error(exc, mapping, key):
if key not in mapping:
return
new_err_cls = mapping[key]
new_err = new_err_cls(*exc.args)
# raise a new exception with the original traceback
if hasattr(exc, '__traceback__'):
traceback = exc.__traceback__
else:
traceback = sys.exc_inf... | |
15,504 | [
0.08278033882379532,
0.0552016980946064,
0.034439995884895325,
-0.049206338822841644,
-0.018951989710330963,
0.015299263410270214,
0.027201157063245773,
-0.01828583888709545,
0.03694916516542435,
-0.0077773104421794415,
0.07225515693426132,
0.02086162194609642,
-0.005101604852825403,
0.024... | 11 | {"_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": "contents", "annotation": null, "type_comment": null}}, {"_type"... | def write_changes(module, contents, dest):
tmpfd, tmpfile = tempfile.mkstemp()
f = os.fdopen(tmpfd, 'wb')
f.write(contents)
f.close()
validate = module.params.get('validate', None)
valid = not validate
if validate:
if "%s" not in validate:
module.fail_json(msg="validate... | |
15,505 | [
0.011702721007168293,
0.0487295500934124,
0.007339484058320522,
-0.009258151985704899,
0.015002598986029625,
0.043158479034900665,
0.0090616624802351,
-0.02988961525261402,
0.018204232677817345,
0.02512761950492859,
0.032316844910383224,
-0.014806108549237251,
0.0457012914121151,
0.0326173... | 7 | {"_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": "changed", "annotation": null, "type_comment": null}}, {"_type":... | def check_file_attrs(module, changed, message):
file_args = module.load_file_common_arguments(module.params)
if module.set_file_attributes_if_different(file_args, False):
if changed:
message += " and "
changed = True
message += "ownership, perms or SE linux context changed"... | |
15,506 | [
0.014792806468904018,
0.030893657356500626,
0.016303004696965218,
-0.06292888522148132,
-0.019228270277380943,
0.03581666573882103,
0.017860768362879753,
-0.020191466435790062,
0.0006588536198250949,
0.045210812240839005,
0.022962145507335663,
-0.018300747498869896,
-0.004254120867699385,
... | 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():
module = AnsibleModule(
argument_spec=dict(
dest=dict(required=True, aliases=['name', 'destfile'], type='path'),
state=dict(default='present', choices=['absent', 'present']),
marker=dict(default='# {mark} ANSIBLE MANAGED BLOCK', type='str'),
block=... | |
15,507 | [
-0.013046277686953545,
0.033900801092386246,
-0.001632140250876546,
-0.015638181939721107,
0.03307659551501274,
-0.028087995946407318,
0.005194652359932661,
-0.04819422960281372,
0.012677554972469807,
-0.0009394295630045235,
0.029107404872775078,
-0.005991744343191385,
0.07187923789024353,
... | 8 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "path", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "name", "annotation": null, "type_comment": null}}, {"_type": "arg... | def js_to_native_code(path, name, build_type):
with open(path, 'r') as js_source:
code = js_source.read()
if build_type != 'debug':
code = reduce_code(code)
data = format_code(code, 1, 2)
native_code = """const static char {0}_n[] = "{0}";
const static char {0}_s[] =
{{
{1}
}};
const ... | |
15,508 | [
0.014568653889000416,
0.034424684941768646,
0.03163349628448486,
-0.07279788702726364,
-0.041981324553489685,
-0.03900859132409096,
-0.010325136594474316,
-0.014909042976796627,
0.012401510030031204,
0.018993712961673737,
0.0282296035438776,
-0.012639782391488552,
0.009808879345655441,
-0.... | 10 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}}, "body": [{"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"a... | def main():
parser = argparse.ArgumentParser(description="js2c")
parser.add_argument('--build-type', help='build type', default='release', choices=['release', 'debug'])
parser.add_argument('--ignore', help='files to ignore', dest='ignore_files', default=[], action='append')
parser.add_argument('--no-mai... | |
15,509 | [
0.029338600113987923,
0.029075000435113907,
0.04051521047949791,
-0.06157679110765457,
-0.005842018872499466,
0.00422088336199522,
-0.019796306267380714,
-0.015684157609939575,
0.0027018925175070763,
0.02634674683213234,
0.023750293999910355,
0.011492928490042686,
0.052561696618795395,
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 testIndexFromName(self):
l, m = create_model()
i = m.indexFromName('fldtxt')
self.assertTrue(i.isValid())
self.assertEqual(i.row(), 0)
i = m.indexFromName('fldint')
self.assertTrue(i.isValid())
self.assertEqual(i.row(), 1)
i = m.indexFromName('not a fi... | |
15,510 | [
-0.005891246721148491,
0.00024070785730145872,
0.044900551438331604,
-0.03176925703883171,
-0.0341770313680172,
-0.027444180101156235,
0.010874004103243351,
-0.038301464170217514,
-0.021123768761754036,
0.023408927023410797,
-0.020655591040849686,
-0.013699796050786972,
0.027667121961712837,... | 12 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "config", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "no_ros_allowed", "annotation": null, "type_comment": null}}], "... | def generate_setup(config, no_ros_allowed=False):
ros_root = get_ros_stack_path(config)
if ros_root is None:
if not no_ros_allowed:
candidates = []
for t in config.get_config_elements():
if os.path.basename(t.get_local_name()) == 'ros':
candida... | |
15,511 | [
0.04143070802092552,
0.0647241398692131,
-0.011763314716517925,
-0.01927732676267624,
-0.01929028145968914,
-0.0036760359071195126,
0.01918664015829563,
-0.031921595335006714,
-0.017554286867380142,
0.02578083425760269,
0.027387278154492378,
0.010383587330579758,
0.049929313361644745,
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 testFieldNameRole(self):
l, m = create_model()
self.assertEqual(m.data(m.indexFromName('fldtxt'), QgsFieldModel.FieldNameRole), 'fldtxt')
self.assertEqual(m.data(m.indexFromName('fldint'), QgsFieldModel.FieldNameRole), 'fldint')
self.assertFalse(m.data(m.indexFromName('an expression'... | |
15,512 | [
0.049990370869636536,
0.03702332451939583,
0.038926512002944946,
-0.044585321098566055,
-0.013195428065955639,
-0.008088543079793453,
0.014933671802282333,
-0.006699217017740011,
0.0007156775100156665,
0.05516703799366951,
-0.001947594340890646,
-0.023409195244312286,
0.043621037155389786,
... | 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 testRowCount(self):
l, m = create_model()
self.assertEqual(m.rowCount(), 2)
m.setAllowEmptyFieldName(True)
self.assertEqual(m.rowCount(), 3)
m.setAllowExpression(True)
m.setExpression('not a field')
self.assertEqual(m.rowCount(), 4)
m.setExpression('no... | |
15,513 | [
0.040852826088666916,
0.05409048870205879,
0.012052490375936031,
-0.038055043667554855,
-0.006586449686437845,
0.005232891999185085,
0.014014825224876404,
-0.0033774173352867365,
-0.021138811483979225,
0.02639761008322239,
0.027692880481481552,
0.0007302086451090872,
0.05372781306505203,
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 testFieldIndexRole(self):
l, m = create_model()
self.assertEqual(m.data(m.indexFromName('fldtxt'), QgsFieldModel.FieldIndexRole), 0)
self.assertEqual(m.data(m.indexFromName('fldint'), QgsFieldModel.FieldIndexRole), 1)
self.assertFalse(m.data(m.indexFromName('an expression'), QgsField... | |
15,514 | [
0.04222835227847099,
0.0537223145365715,
-0.02245974913239479,
-0.013418002985417843,
-0.013933596201241016,
0.004637196194380522,
0.02531437575817108,
-0.007457240484654903,
-0.001147509552538395,
0.038053303956985474,
0.023679567500948906,
-0.01763077825307846,
0.06478870660066605,
0.006... | 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 testExpressionRole(self):
l, m = create_model()
self.assertEqual(m.data(m.indexFromName('fldtxt'), QgsFieldModel.ExpressionRole), 'fldtxt')
self.assertEqual(m.data(m.indexFromName('fldint'), QgsFieldModel.ExpressionRole), 'fldint')
self.assertFalse(m.data(m.indexFromName('an expressi... | |
15,515 | [
0.0442243255674839,
0.05810268595814705,
-0.014823434874415398,
-0.010279308073222637,
-0.0030504558235406876,
0.011075501330196857,
0.02666923776268959,
-0.00974851194769144,
0.0013609726447612047,
0.03459233045578003,
0.02173672243952751,
-0.01159335020929575,
0.07032392919063568,
0.0219... | 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 testIsExpressionRole(self):
l, m = create_model()
self.assertFalse(m.data(m.indexFromName('fldtxt'), QgsFieldModel.IsExpressionRole))
self.assertFalse(m.data(m.indexFromName('fldint'), QgsFieldModel.IsExpressionRole))
self.assertFalse(m.data(m.indexFromName('an expression'), QgsField... | |
15,516 | [
0.0385415181517601,
0.05429280921816826,
0.006285242736339569,
-0.008871721103787422,
-0.029032310470938683,
-0.0003305728896521032,
0.014024756848812103,
-0.009236949495971203,
0.0008732270798645914,
0.053336575627326965,
0.03059946931898594,
-0.021541815251111984,
0.03548688441514969,
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 testExpressionValidityRole(self):
l, m = create_model()
self.assertTrue(m.data(m.indexFromName('fldtxt'), QgsFieldModel.ExpressionValidityRole))
self.assertTrue(m.data(m.indexFromName('fldint'), QgsFieldModel.ExpressionValidityRole))
self.assertFalse(m.data(m.indexFromName('an expres... | |
15,517 | [
0.00859976839274168,
0.06834319978952408,
-0.013345121406018734,
-0.026664968580007553,
-0.005740550812333822,
-0.004622138570994139,
0.0148868877440691,
-0.007778335828334093,
-0.0016681401757523417,
0.046733200550079346,
0.021685821935534477,
-0.008113227784633636,
0.05080245062708855,
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 testFieldTypeRole(self):
l, m = create_model()
self.assertEqual(m.data(m.indexFromName('fldtxt'), QgsFieldModel.FieldTypeRole), QVariant.String)
self.assertEqual(m.data(m.indexFromName('fldint'), QgsFieldModel.FieldTypeRole), QVariant.Int)
self.assertFalse(m.data(m.indexFromName('an ... | |
15,518 | [
0.025567814707756042,
0.06335854530334473,
0.02954092249274254,
0.012348316609859467,
-0.024907829239964485,
-0.008553404361009598,
0.015866035595536232,
-0.03746074065566063,
-0.024010250344872475,
0.029382526874542236,
-0.004979585763067007,
-0.002362745814025402,
0.049393266439437866,
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 testFieldOriginRole(self):
l, m = create_model()
self.assertEqual(m.data(m.indexFromName('fldtxt'), QgsFieldModel.FieldOriginRole), QgsFields.OriginProvider)
self.assertEqual(m.data(m.indexFromName('fldint'), QgsFieldModel.FieldOriginRole), QgsFields.OriginProvider)
self.assertFalse(... | |
15,519 | [
0.04108612984418869,
0.03788289427757263,
-0.011621656827628613,
-0.0021873335354030132,
0.005870392546057701,
0.02301829308271408,
0.01732659339904785,
-0.0016338818240910769,
-0.009940619580447674,
0.03748580068349838,
0.022409413009881973,
-0.00810074433684349,
0.04616894945502281,
0.03... | 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 testDisplayRole(self):
l, m = create_model()
self.assertEqual(m.data(m.indexFromName('fldtxt'), Qt.DisplayRole), 'fldtxt')
self.assertEqual(m.data(m.indexFromName('fldint'), Qt.DisplayRole), 'fldint')
self.assertFalse(m.data(m.indexFromName('an expression'), Qt.DisplayRole))
... | |
15,520 | [
0.030300820246338844,
0.06694117188453674,
-0.006279092747718096,
-0.010335319675505161,
-0.013122296892106533,
0.0026677749119699,
0.029441222548484802,
-0.007165553048253059,
-0.00684320367872715,
0.03870876133441925,
0.015848834067583084,
-0.009341409429907799,
0.051119204610586166,
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 testIsEmptyRole(self):
l, m = create_model()
self.assertFalse(m.data(m.indexFromName('fldtxt'), QgsFieldModel.IsEmptyRole), QgsFields.OriginProvider)
self.assertFalse(m.data(m.indexFromName('fldint'), QgsFieldModel.IsEmptyRole), QgsFields.OriginProvider)
self.assertFalse(m.data(m.ind... | |
15,521 | [
0.016049740836024284,
0.055927932262420654,
-0.019988328218460083,
-0.03928740322589874,
-0.029268624261021614,
-0.003698579268530011,
0.007212537340819836,
0.013661973178386688,
0.0162959024310112,
0.040493596345186234,
0.006750984117388725,
-0.01757594384253025,
0.057847995311021805,
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 testEditorWidgetTypeRole(self):
l, m = create_model()
self.assertEqual(m.data(m.indexFromName('fldtxt'), QgsFieldModel.EditorWidgetType), 'Hidden')
self.assertEqual(m.data(m.indexFromName('fldint'), QgsFieldModel.EditorWidgetType), 'ValueMap')
self.assertIsNone(m.data(m.indexFromName... | |
15,522 | [
0.007029527332633734,
0.03387494757771492,
0.047101400792598724,
-0.0685587078332901,
-0.03456481546163559,
-0.0368485227227211,
-0.011228213086724281,
-0.03432692959904671,
-0.015260378830134869,
0.03725292906165123,
0.0012444404419511557,
0.006619174499064684,
0.045602720230817795,
0.015... | 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 testManualFields(self):
_, m = create_model()
fields = QgsFields()
fields.append(QgsField('f1', QVariant.String))
fields.append(QgsField('f2', QVariant.String))
m.setFields(fields)
self.assertEqual(m.rowCount(), 2)
self.assertEqual(m.data(m.index(0, 0, QModelI... | |
15,523 | [
0.01232657115906477,
0.02663373202085495,
0.05347594991326332,
-0.04083665460348129,
-0.023089518770575523,
0.032132476568222046,
0.02659464254975319,
0.007479336112737656,
-0.03374822437763214,
0.051834143698215485,
0.010893248952925205,
-0.022946186363697052,
0.03218459710478783,
0.05681... | 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 testJoinedFieldIsEditableRole(self):
layer = QgsVectorLayer("Point?field=id_a:integer",
"addfeat", "memory")
layer2 = QgsVectorLayer("Point?field=id_b:integer&field=value_b",
"addfeat", "memory")
QgsProject.instance().addMapLayer... | |
15,524 | [
0.043681804090738297,
0.06332427263259888,
-0.014743803068995476,
-0.01990532875061035,
-0.028603456914424896,
0.01770690083503723,
0.020192081108689308,
0.02673957124352455,
-0.008751892484724522,
0.04138779267668724,
0.01995312049984932,
0.005167500115931034,
0.04533062502741814,
0.04941... | 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 testFieldIsWidgetEditableRole(self):
l, m = create_model()
self.assertTrue(m.data(m.indexFromName('fldtxt'), QgsFieldModel.FieldIsWidgetEditable))
self.assertTrue(m.data(m.indexFromName('fldint'), QgsFieldModel.FieldIsWidgetEditable))
self.assertFalse(m.data(m.indexFromName('an expre... | |
15,525 | [
-0.005567094311118126,
0.007545328699052334,
0.03229973837733269,
-0.041670650243759155,
-0.04628133773803711,
-0.004448690917342901,
-0.0018956781132146716,
0.0020607905462384224,
-0.029009949415922165,
0.01830567792057991,
0.027539514005184174,
0.015003427863121033,
-0.002193192020058632,
... | 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 testFieldTooltipExtended(self):
layer = QgsVectorLayer("Point?", "tooltip", "memory")
f = QgsField('my_real', QVariant.Double, 'real', 8, 3, 'Comment text')
layer.addExpressionField('1+1', f)
layer.updateFields()
self.assertEqual(QgsFieldModel.fieldToolTipExtended(QgsField('m... | |
15,526 | [
-0.004078000783920288,
-0.005503027234226465,
-0.007531415671110153,
-0.04237482696771622,
-0.031192917376756668,
-0.030004383996129036,
0.0009338470408692956,
-0.005045199766755104,
-0.021211668848991394,
0.02141784317791462,
0.02689964510500431,
-0.009902416728436947,
-0.010878711938858032... | 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 testFieldTooltip(self):
f = QgsField('my_string', QVariant.String, 'string')
self.assertEqual(QgsFieldModel.fieldToolTip(f), "<b>my_string</b><br><font style='font-family:monospace; white-space: nowrap;'>string NULL</font>")
f.setAlias('my alias')
self.assertEqual(QgsFieldModel.field... | |
15,527 | [
0.02596217766404152,
-0.0447329543530941,
-0.0148703558370471,
-0.019014554098248482,
-0.025084583088755608,
0.01710090972483158,
0.04295338690280914,
0.012140060774981976,
0.00872109830379486,
-0.013968382962048054,
0.03978429734706879,
-0.044026002287864685,
-0.0072828177362680435,
-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}}, {"_type": "arg", "_fields": {"arg": "dictionary", "annotation": null, "type_comment": null}}], "kwarg"... | def from_dictionary(self, dictionary):
super(CaptureOutput, self).from_dictionary(dictionary)
if 'amountPaid' in dictionary:
self.amount_paid = dictionary['amountPaid']
if 'amountReversed' in dictionary:
self.amount_reversed = dictionary['amountReversed']
if 'bank... | |
15,528 | [
0.03625447303056717,
-0.052276141941547394,
-0.01315374206751585,
-0.01881699077785015,
-0.045838434249162674,
0.006964101921766996,
0.03305982053279877,
0.009462949819862843,
0.011036074720323086,
-0.028945494443178177,
0.03886828199028969,
-0.047435760498046875,
-0.01240348257124424,
-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 to_dictionary(self):
dictionary = super(CaptureOutput, self).to_dictionary()
if self.amount_paid is not None:
dictionary['amountPaid'] = self.amount_paid
if self.amount_reversed is not None:
dictionary['amountReversed'] = self.amount_reversed
if self.bank_tran... | |
15,529 | [
-0.004179390147328377,
0.008257461711764336,
-0.004263822454959154,
-0.001661905669607222,
0.011921815574169159,
-0.015479222871363163,
-0.010492098517715931,
0.037172649055719376,
0.005431800149381161,
0.01520903967320919,
-0.008268719539046288,
-0.034515853971242905,
-0.001958825159817934,... | 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": "key", "annotation": null, "type_comment": null}}, {"_type": "arg"... | def get_network(self, key=None, network=None):
if not network:
network = self.module.params.get('network')
if not network:
return None
args = {}
args['account'] = self.get_account('name')
args['domainid'] = self.get_domain('id')
... | |
15,530 | [
-0.008213977329432964,
-0.02959313429892063,
0.004360822960734367,
0.0021932460367679596,
-0.012092798948287964,
0.012435048818588257,
0.0033426322042942047,
-0.04337436333298683,
-0.0037618873175233603,
0.016005847603082657,
0.000936906726565212,
-0.06945373862981796,
-0.003431046614423394,... | 12 | {"_type": "Module", "_fields": {"body": [{"_type": "ClassDef", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "module", "annotation":... | class AnsibleCloudStackIPAddress(AnsibleCloudStack):
def __init__(self, module):
super(AnsibleCloudStackIPAddress, self).__init__(module)
self.returns = {
'ipaddress': 'ip_address',
}
#TODO: Add to parent class, duplicated in cs_network
def get_network(self, key=None, ... | |
15,531 | [
0.007003713399171829,
0.0028034187853336334,
0.026023458689451218,
0.02670014649629593,
0.020474623888731003,
-0.04168393462896347,
-0.007095549255609512,
0.01698485016822815,
0.03188163787126541,
-0.006201355718076229,
-0.009579958394169807,
-0.045009370893239975,
-0.0026100794784724712,
... | 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": "key", "annotation": null, "type_comment": null}}], "kwarg": null,... | def get_ip_address(self, key=None):
if self.ip_address:
return self._get_by_key(key, self.ip_address)
ip_address = self.module.params.get('ip_address')
if not ip_address:
self.module.fail_json(msg="IP address param 'ip_address' is required")
args = {}
ar... | |
15,532 | [
0.000008300059562316164,
-0.0064856624230742455,
0.021938864141702652,
0.03198344632983208,
-0.0006325423019006848,
0.0011494782520458102,
0.040763676166534424,
-0.007486608345061541,
0.04162999242544174,
0.03081274963915348,
0.018485307693481445,
-0.01767752692103386,
0.02068621851503849,
... | 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 associate_ip_address(self):
self.result['changed'] = True
args = {}
args['account'] = self.get_account(key='name')
args['domainid'] = self.get_domain(key='id')
args['projectid'] = self.get_project(key='id')
args['networkid'] = self.get_network(key='id')
args['... | |
15,533 | [
0.017047885805368423,
0.004203473683446646,
0.008958496153354645,
0.006947291549295187,
-0.018852954730391502,
0.03476431593298912,
-0.02069145254790783,
-0.03104275092482567,
0.04595129191875458,
0.06337802112102509,
0.031934142112731934,
-0.08294408768415451,
0.021237431094050407,
0.0104... | 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 = cs_argument_spec()
argument_spec.update(dict(
ip_address = dict(required=False),
state = dict(choices=['present', 'absent'], default='present'),
vpc = dict(default=None),
network = dict(default=None),
zone = dict(default=None),
domain =... | |
15,534 | [
-0.001050634658895433,
0.0148844625800848,
0.017138654366135597,
0.04352062940597534,
0.012641598470509052,
0.02120526134967804,
-0.019064346328377724,
-0.010902811773121357,
0.032125066965818405,
0.02768464758992195,
0.01268690824508667,
-0.009282966144382954,
0.029134579002857208,
-0.017... | 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 disassociate_ip_address(self):
ip_address = self.get_ip_address()
if ip_address is None:
return ip_address
if ip_address['isstaticnat']:
self.module.fail_json(msg="IP address is allocated via static nat")
self.result['changed'] = True
if not self.modu... | |
15,535 | [
-0.011383064091205597,
0.04355046525597572,
0.03207565099000931,
-0.0468289814889431,
-0.0322224497795105,
0.03405744209885597,
-0.006104405038058758,
-0.0008158066193573177,
0.04041874408721924,
0.011817345395684242,
-0.0030155025888234377,
-0.029482195153832436,
0.01010468602180481,
-0.0... | 10 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "updates", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "module", "annotation": null, "type_comment": null}}], "kwarg":... | def map_obj_to_commands(updates, module):
want, have = updates
commands = list()
if want['state'] == 'absent':
if have['state'] == 'present':
commands.append('delete system services netconf')
else:
if have['state'] == 'absent' or want['netconf_port'] != have.get('netconf_por... | |
15,536 | [
0.04622912406921387,
0.02068931609392166,
0.013114727102220058,
-0.04558545723557472,
-0.009769954718649387,
0.012517035938799381,
-0.012700940482318401,
-0.04094185680150986,
0.04328664392232895,
0.012689447030425072,
0.01752844825387001,
-0.05016009509563446,
0.0494704507291317,
0.021574... | 9 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "module", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": ... | def map_config_to_obj(module):
conn = get_connection(module)
out = conn.get(command='show configuration system services netconf')
if out is None:
module.fail_json(msg='unable to retrieve current config')
config = str(out).strip()
obj = {'state': 'absent'}
if 'ssh' in config:
obj... | |
15,537 | [
0.08215602487325668,
0.049627743661403656,
0.02953096479177475,
-0.06549879163503647,
-0.01249906700104475,
0.05454138293862343,
0.006829957012087107,
-0.016129016876220703,
0.018364721909165382,
0.03346187621355057,
0.0501682423055172,
-0.013512504287064075,
-0.003924768418073654,
0.03473... | 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": "config", "annotation": null, "type_comment": null}}, {"_type": ... | def load_config(module, config, commit=False):
conn = get_connection(module)
try:
resp = conn.edit_config(to_list(config) + ['top'])
except ConnectionError as exc:
module.fail_json(msg=to_text(exc, errors='surrogate_then_replace'))
diff = resp.get('diff', '')
if diff:
if com... | |
15,538 | [
0.040782008320093155,
0.03795468434691429,
-0.013601142913103104,
-0.037504881620407104,
-0.04142458364367485,
-0.02488902024924755,
-0.02718086540699005,
-0.036883726716041565,
0.07436719536781311,
0.032235778868198395,
0.016299951821565628,
-0.03506310284137726,
0.02422502636909485,
0.02... | 9 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "module", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": ... | def map_params_to_obj(module):
obj = {
'netconf_port': module.params['netconf_port'],
'state': module.params['state']
}
for key, value in iteritems(obj):
# validate the param value (if validator func exists)
validator = globals().get('validate_%s' % key)
if callable(... | |
15,539 | [
0.012254040688276291,
-0.0362597294151783,
0.06518013775348663,
-0.036325257271528244,
-0.006432825233787298,
-0.0013092274311929941,
0.020794736221432686,
0.02220362238585949,
0.014569421298801899,
-0.025927890092134476,
0.006694944109767675,
-0.040257036685943604,
0.03759216517210007,
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 CursorFactoryTests(unittest.TestCase):
def setUp(self):
self.con = sqlite.connect(":memory:")
def tearDown(self):
self.con.close()
def CheckIsInstance(self):
cur = self.con.cursor(factory=MyCursor)
self.assertTrue(isinstance(cur,
MyC... | |
15,540 | [
0.003238229313865304,
-0.050341833382844925,
0.050913434475660324,
-0.04834122583270073,
0.0011004620464518666,
0.016025278717279434,
0.02780437096953392,
0.020689962431788445,
-0.00472592655569315,
-0.014749381691217422,
0.0014621791196987033,
-0.04389089345932007,
0.031274814158678055,
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 ConnectionFactoryTests(unittest.TestCase):
def setUp(self):
self.con = sqlite.connect(":memory:", factory=MyConnection)
def tearDown(self):
self.con.close()
def CheckIsInstance(self):
self.assertTrue(isinstance(self.con,
MyConnection),
... | |
15,541 | [
0.020120996981859207,
-0.006810183636844158,
0.01356083806604147,
-0.02053770422935486,
0.039884816855192184,
0.00032555239158682525,
-0.004670095629990101,
0.03697977587580681,
0.012084504589438438,
-0.027431229129433632,
0.022145003080368042,
-0.041837386786937714,
0.042670801281929016,
... | 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 CheckIsProducedByFactory(self):
cur = self.con.cursor(factory=MyCursor)
cur.execute("select 4+5 as foo")
row = cur.fetchone()
self.assertTrue(isinstance(row,
dict),
"row is not instance of dict")
cur.close() | |
15,542 | [
0.04966166615486145,
-0.026371264830231667,
0.07150360196828842,
-0.028900330886244774,
0.01603657938539982,
-0.003267668653279543,
0.018117310479283333,
0.013507513329386711,
0.007897584699094296,
-0.03531496226787567,
0.005566819570958614,
-0.027015026658773422,
0.017726454883813858,
-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 RowFactoryTestsBackwardsCompat(unittest.TestCase):
def setUp(self):
self.con = sqlite.connect(":memory:")
def CheckIsProducedByFactory(self):
cur = self.con.cursor(factory=MyCursor)
cur.execute("select 4+5 as foo")
row = cur.fetchone()
self.assertTrue(isinstance(ro... | |
15,543 | [
0.03459419682621956,
-0.02514765039086342,
0.02013321779668331,
-0.04345841705799103,
0.02009008266031742,
-0.009780840016901493,
-0.012864986434578896,
-0.036815643310546875,
0.0041975658386945724,
-0.0049362508580088615,
-0.024931976571679115,
-0.06556505709886551,
0.06207112967967987,
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 CheckSqliteRowIndex(self):
self.con.row_factory = sqlite.Row
row = self.con.execute("select 1 as a, 2 as b").fetchone()
self.assertTrue(isinstance(row,
sqlite.Row),
"row is not instance of sqlite.Row")
col1, col2 = row["a"],... | |
15,544 | [
-0.001970785204321146,
-0.02664889022707939,
0.06517826020717621,
-0.06095200031995773,
-0.010653686709702015,
-0.015648886561393738,
0.026461057364940643,
0.009732128120958805,
0.008575777523219585,
-0.012690506875514984,
0.002218784298747778,
-0.03824761509895325,
-0.005224121734499931,
... | 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 TextFactoryTests(unittest.TestCase):
def setUp(self):
self.con = sqlite.connect(":memory:")
def CheckUnicode(self):
austria = "Österreich"
row = self.con.execute("select ?", (austria,)).fetchone()
self.assertTrue(type(row[0]) == str, "type of row[0] must be unicode")
... | |
15,545 | [
0.01294924970716238,
-0.009507263079285622,
0.007166481576859951,
0.003312263637781143,
0.03380872681736946,
-0.01584351621568203,
0.01307609025388956,
-0.004548957105726004,
-0.021297652274370193,
0.023845991119742393,
0.007506644353270531,
0.016719868406653404,
-0.031179672107100487,
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}}, {"_type": "arg", "_fields": {"arg": "op", "annotation": null, "type_comment": null}}, {"_type": "arg",... | def __init__(self, op, chaddr, options, htype=_HARDWARE_TYPE_ETHERNET,
hlen=0, hops=0, xid=None, secs=0, flags=0,
ciaddr='0.0.0.0', yiaddr='0.0.0.0', siaddr='0.0.0.0',
giaddr='0.0.0.0', sname='', boot_file=''):
super(dhcp, self).__init__()
self.op = op
... | |
15,546 | [
-0.0019621425308287144,
-0.009372182190418243,
0.018935518339276314,
-0.020689640194177628,
-0.013965507037937641,
0.008017235435545444,
0.0225337166339159,
0.02476010099053383,
0.014077950268983841,
0.006977131124585867,
-0.0058808051981031895,
-0.04758617281913757,
-0.008174656890332699,
... | 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 CheckOptimizedUnicode(self):
self.con.text_factory = sqlite.OptimizedUnicode
austria = "Österreich"
germany = "Deutchland"
a_row = self.con.execute("select ?", (austria,)).fetchone()
d_row = self.con.execute("select ?", (germany,)).fetchone()
self.assertTrue(type(a_ro... | |
15,547 | [
-0.03141513094305992,
0.04221481457352638,
-0.009253524243831635,
-0.009218384511768818,
0.01313063409179449,
0.008603435009717941,
-0.006524320691823959,
-0.03242247551679611,
0.009107108227908611,
0.03844312205910683,
0.033500101417303085,
0.004705827217549086,
0.015086758881807327,
0.04... | 10 | {"_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": "buf", "annotation": null, "type_comment": null}}], "kwarg": null, ... | def parser(cls, buf):
(op, htype, hlen) = struct.unpack_from(cls._HLEN_UNPACK_STR, buf)
buf = buf[cls._HLEN_UNPACK_LEN:]
unpack_str = cls._DHCP_UNPACK_STR % (hlen,
(cls._DHCP_CHADDR_LEN - hlen))
min_len = struct.calcsize(unpack_str)
(h... | |
15,548 | [
0.05785873904824257,
-0.02435920387506485,
-0.0036808964796364307,
-0.020025428384542465,
-0.004854393191635609,
-0.00740119069814682,
-0.01434086263179779,
-0.04088383913040161,
0.044756099581718445,
-0.0030533429235219955,
0.008115982636809349,
0.014611019752919674,
0.01749270036816597,
... | 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": "payload", "annotation": null, "type_comment": null}}, {"_type": "... | def serialize(self, payload, prev):
seri_opt = self.options.serialize()
pack_str = '%s%ds' % (self._DHCP_PACK_STR,
self.options.options_len)
return struct.pack(pack_str, self.op, self.htype, self.hlen,
self.hops, self.xid, self.secs, self.... | |
15,549 | [
0.025221973657608032,
-0.04530613496899605,
0.021085035055875778,
-0.027757514268159866,
0.009702897630631924,
-0.010347903706133366,
0.018538372591137886,
-0.02495507337152958,
-0.021096156910061836,
0.06276579201221466,
0.020317699760198593,
-0.031716518104076385,
0.007211838383227587,
0... | 8 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "option_list", "annotation": null, "type_comment": null}}, {"_type... | def __init__(self, option_list=None, options_len=0,
magic_cookie=_MAGIC_COOKIE):
super(options, self).__init__()
if option_list is None:
self.option_list = []
else:
self.option_list = option_list
self.options_len = options_len
self.magic_c... | |
15,550 | [
-0.0072801848873496056,
0.0233155470341444,
0.0005153589299879968,
-0.010419728234410286,
-0.01146229263395071,
0.006758902687579393,
0.0030595732387155294,
-0.025969350710511208,
-0.004176184069365263,
0.03480745851993561,
0.0375797338783741,
-0.0024064891040325165,
0.016906142234802246,
... | 9 | {"_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": "buf", "annotation": null, "type_comment": null}}], "kwarg": null, ... | def parser(cls, buf):
opt_parse_list = []
offset = struct.calcsize(cls._MAGIC_COOKIE_UNPACK_STR)
magic_cookie = struct.unpack_from(cls._MAGIC_COOKIE_UNPACK_STR, buf)[0]
while len(buf) > offset:
opt_buf = buf[offset:]
opt = option.parser(opt_buf)
if opt... | |
15,551 | [
-0.010167006403207779,
0.03335912525653839,
-0.027861088514328003,
-0.015250509604811668,
0.0007199810934253037,
0.042587973177433014,
-0.03030465915799141,
-0.013897817581892014,
0.03205006942152977,
0.030915552750229836,
0.03139553964138031,
-0.0072707184590399265,
0.006954363081604242,
... | 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": "buf", "annotation": null, "type_comment": null}}], "kwarg": null, ... | def parser(cls, buf):
tag = struct.unpack_from(cls._UNPACK_STR, buf)[0]
if tag == DHCP_END_OPT or tag == DHCP_PAD_OPT:
return None
buf = buf[cls._MIN_LEN:]
length = struct.unpack_from(cls._UNPACK_STR, buf)[0]
buf = buf[cls._MIN_LEN:]
value_unpack_str = '%ds' %... | |
15,552 | [
0.05302847549319267,
-0.05298146605491638,
-0.02365831658244133,
0.00605855043977499,
-0.001661547226831317,
-0.01990918442606926,
-0.0286062303930521,
-0.019215771928429604,
0.03633955121040344,
-0.00829745177179575,
0.031849995255470276,
-0.005888135172426701,
-0.0024269460700452328,
-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 serialize(self):
seri_opt = addrconv.ipv4.text_to_bin(self.magic_cookie)
for opt in self.option_list:
seri_opt += opt.serialize()
seri_opt += binascii.a2b_hex('%x' % DHCP_END_OPT)
if self.options_len == 0:
self.options_len = len(seri_opt)
return seri_o... | |
15,553 | [
0.034107308834791183,
0.037029486149549484,
0.037029486149549484,
-0.03040892444550991,
0.01279594749212265,
0.021939171478152275,
0.0020218396093696356,
0.05387767404317856,
0.022224541753530502,
0.01888001523911953,
0.022532738745212555,
-0.046389590948820114,
0.002711005974560976,
-0.02... | 10 | {"_type": "Module", "_fields": {"body": [{"_type": "AsyncFunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "resource_group_name", "annotation": {"_type": "Name", "_fiel... | async def _delete_initial( # pylint: disable=inconsistent-return-statements
self,
resource_group_name: str,
service_name: str,
gateway_name: str,
domain_name: str,
**kwargs: Any
) -> None:
cls = kwargs.pop('cls', None) # type: ClsType[None]
error_map... | |
15,554 | [
0.026594949886202812,
0.018478019163012505,
0.033606547862291336,
-0.010227109305560589,
0.039099711924791336,
-0.00888173095881939,
0.024294966831803322,
-0.0019133961759507656,
-0.0017291741678491235,
0.013476114720106125,
-0.027175528928637505,
-0.024116327986121178,
0.01122079137712717,
... | 10 | {"_type": "Module", "_fields": {"body": [{"_type": "AsyncFunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "resource_group_name", "annotation": {"_type": "Name", "_fiel... | async def _create_or_update_initial(
self,
resource_group_name: str,
service_name: str,
gateway_name: str,
domain_name: str,
gateway_custom_domain_resource: "_models.GatewayCustomDomainResource",
**kwargs: Any
) -> "_models.GatewayCustomDomainResource":
... | |
15,555 | [
0.01560282800346613,
-0.004870247095823288,
0.01285204105079174,
-0.018173236399888992,
-0.004904068075120449,
-0.025568796321749687,
0.008049435913562775,
0.028432320803403854,
0.025794271379709244,
0.0237199068069458,
0.009639030322432518,
-0.030664518475532532,
0.02538841776549816,
-0.0... | 11 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "next_link", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [{"_type": "Constant", "_fields": {"kind": null, "val... | def prepare_request(next_link=None):
if not next_link:
request = build_list_request(
subscription_id=self._config.subscription_id,
resource_group_name=resource_group_name,
service_name=service_name,
... | |
15,556 | [
0.008217054419219494,
0.0016443021595478058,
-0.03170368820428848,
-0.00765855610370636,
0.01065305806696415,
0.005106694530695677,
0.02115163765847683,
0.060317814350128174,
0.005932558793574572,
-0.007842741906642914,
0.008448772132396698,
-0.013855510391294956,
0.011063018813729286,
-0.... | 10 | {"_type": "Module", "_fields": {"body": [{"_type": "AsyncFunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "next_link", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [{"_type": "Constant", "_fields": {"kind": null,... | async def get_next(next_link=None):
request = prepare_request(next_link)
pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access
request,
stream=False,
**kwargs
)
response = pipeline_respon... | |
15,557 | [
0.00844041258096695,
0.002928526373580098,
-0.0044035762548446655,
0.007604460697621107,
0.007016598246991634,
0.02044035866856575,
-0.012792752124369144,
-0.002383809769526124,
0.008213896304368973,
-0.006693004164844751,
0.03464613854885101,
-0.06389904767274857,
-0.0056952559389173985,
... | 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": "request", "annotation": null, "type_comment": null}}, {"_type": "... | def process_view(self, request, view_func, view_args, view_kwargs):
has_site_permission = False
if request.user.is_superuser:
has_site_permission = True
elif request.user.is_staff:
lookup = {"user": request.user, "sites": current_site_id()}
try:
... | |
15,558 | [
-0.028155336156487465,
0.03007446601986885,
-0.01340961642563343,
-0.010421603918075562,
0.01796451397240162,
-0.006747320760041475,
0.038674112409353256,
0.0130695179104805,
0.01661626435816288,
0.03903850167989731,
0.014162693172693253,
-0.014089814387261868,
0.055096033960580826,
0.0266... | 17 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "request", "annotation": null, "type_comment": null}}, {"_type": "... | def process_view(self, request, view_func, view_args, view_kwargs):
login_type = request.POST.get("mezzanine_login_interface")
if login_type and not request.user.is_authenticated():
response = view_func(request, *view_args, **view_kwargs)
if request.user.is_authenticated():
... | |
15,559 | [
-0.03344304487109184,
-0.054413385689258575,
0.006474383175373077,
-0.012984471395611763,
0.02327921614050865,
0.0035674567334353924,
-0.03637080267071724,
0.00850357860326767,
-0.0032371915876865387,
0.03370487689971924,
0.004007809795439243,
0.003734076861292124,
0.012829752638936043,
-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": "request", "annotation": null, "type_comment": null}}], "kwarg": n... | def process_request(self, request):
force_host = settings.SSL_FORCE_HOST
response = None
if force_host and request.get_host().split(":")[0] != force_host:
url = "http://%s%s" % (force_host, request.get_full_path())
response = HttpResponsePermanentRedirect(url)
eli... | |
15,560 | [
0.014528993517160416,
-0.017306432127952576,
-0.034148115664720535,
-0.02930142730474472,
0.014407273381948471,
-0.00233620242215693,
0.035896461457014084,
0.049706198275089264,
0.018069950863718987,
-0.007258963771164417,
0.000459217990282923,
-0.02458752691745758,
0.0004678629047702998,
... | 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": "request", "annotation": null, "type_comment": null}}], "kwarg": n... | def process_request(self, request):
if (cache_installed() and request.method == "GET" and
not request.user.is_authenticated()):
cache_key = cache_key_prefix(request) + request.get_full_path()
response = cache_get(cache_key)
# We need to force a csrf token here... | |
15,561 | [
-0.019882677122950554,
-0.024436810985207558,
0.005326113663613796,
0.009946892037987709,
0.015239682979881763,
-0.0022506858222186565,
-0.03583325073122978,
0.028857650235295296,
0.010929918847978115,
0.008258530870079994,
0.010296783410012722,
-0.08703947067260742,
0.011663023382425308,
... | 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": "request", "annotation": null, "type_comment": null}}, {"_type": "... | def process_response(self, request, response):
if response.status_code == 404:
lookup = {
"site_id": current_site_id(),
"old_path": request.get_full_path(),
}
try:
redirect = Redirect.objects.get(**lookup)
except Red... | |
15,562 | [
-0.02783101238310337,
0.016949109733104706,
0.04513633996248245,
-0.03302491083741188,
0.013995942659676075,
0.02629122883081436,
-0.01886809431016445,
0.011169176548719406,
0.0004409641260281205,
0.03196774423122406,
0.010508447885513306,
-0.02436075545847416,
-0.0003574753936845809,
0.04... | 8 | {"_type": "Module", "_fields": {"body": [{"_type": "ClassDef", "_fields": {"body": [{"_type": "Assign", "_fields": {"value": {"_type": "Name", "_fields": {"id": "fmgr_provisioning", "ctx": {"_type": "Load", "_fields": {}}}}, "targets": [{"_type": "Name", "_fields": {"id": "module", "ctx": {"_type": "Store", "_fields": ... | class TestFmgrProvisioningModule(TestFortimanagerModule):
module = fmgr_provisioning
def test_fmg_script_fail_connect(self):
set_module_args(dict(host='1.1.1.1', username='admin', password='admin', adom='root',
vdom='root', policy_package='root', name='FGT1', serial='FGVM0... | |
15,563 | [
-0.00673760985955596,
0.020181838423013687,
0.05060335621237755,
-0.028983499854803085,
-0.015557866543531418,
0.04584302008152008,
0.010797531343996525,
0.04554549977183342,
0.05295873060822487,
0.007469015661627054,
0.024421511217951775,
-0.038082681596279144,
-0.0003585359954740852,
-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_join_leave(self):
self.servicegroup_api = servicegroup.API()
service_id = {'topic': 'unittest', 'host': 'serviceA'}
self.servicegroup_api.join(service_id['host'], service_id['topic'])
self.assertTrue(self.servicegroup_api.service_is_up(service_id))
self.servicegroup_api.... | |
15,564 | [
0.0045249806717038155,
-0.008846108801662922,
0.0002807995770126581,
-0.06278645247220993,
-0.00999948289245367,
-0.03212280198931694,
0.007435237988829613,
0.05295863375067711,
0.021189890801906586,
0.01841106452047825,
-0.030556360259652138,
-0.03598526492714882,
0.014634435996413231,
-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": "Constant", "_fields":... | def runserver():
script_name = "rungunicornserver"
if conf.USE_CHERRYPY_SERVER.get():
script_name = "runcherrypyserver"
cmdv = supervisor.DjangoCommandSupervisee(script_name).cmdv
os.execv(cmdv[0], cmdv)
LOG.error("Failed to exec '%s' with argument '%s'" % (cmdv[0], cmdv[1],))
sys.exit(-1) | |
15,565 | [
0.016140641644597054,
-0.007916487753391266,
0.040233273059129715,
-0.035334277898073196,
-0.028234289959073067,
-0.03204461932182312,
0.01866113767027855,
-0.0027527250349521637,
-0.019004303961992264,
-0.015134810470044613,
0.01654297485947609,
-0.0027763915713876486,
0.008525903336703777,... | 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_create_string_table():
wb = Workbook()
ws = wb.create_sheet()
ws.cell('B12').value = 'hello'
ws.cell('B13').value = 'world'
ws.cell('D28').value = 'hello'
table = create_string_table(wb)
eq_({'hello': 0, 'world': 1}, table) | |
15,566 | [
-0.006318611092865467,
-0.026244718581438065,
-0.007466373965144157,
-0.03010214865207672,
-0.03528482839465141,
0.058121755719184875,
-0.022588443011045456,
0.06517399102449417,
0.08495810627937317,
-0.016920626163482666,
0.02277776598930359,
-0.01896766573190689,
0.014980078674852848,
-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_stop(self):
self.servicegroup_api = servicegroup.API()
service_id = {'topic': 'unittest', 'host': 'serviceA'}
pulse = self.servicegroup_api.join(service_id['host'],
service_id['topic'], None)
self.assertTrue(self.servicegroup_api.service_... | |
15,567 | [
0.05813293904066086,
0.004430635366588831,
0.02121201902627945,
-0.04500049725174904,
0.014945968054234982,
-0.02874128520488739,
0.031167659908533096,
-0.01937347650527954,
0.03471967205405235,
-0.0020449087023735046,
0.035194940865039825,
-0.06483673304319382,
0.020774271339178085,
0.027... | 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_empty_string():
handle = open(os.path.join(DATADIR, 'reader', 'sharedStrings-emptystring.xml'))
try:
content = handle.read()
string_table = read_string_table(content)
eq_({0: 'Testing empty cell', 1:''}, string_table)
finally:
handle.close() | |
15,568 | [
0.042614150792360306,
0.005888600368052721,
0.002856229431927204,
-0.0442662388086319,
0.018926125019788742,
-0.01575557515025139,
0.011321661993861198,
-0.026506293565034866,
0.0070578171871602535,
-0.04392610490322113,
0.03841104730963707,
-0.04256556183099747,
0.03748781979084015,
0.030... | 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_read_string_table():
handle = open(os.path.join(DATADIR, 'reader', 'sharedStrings.xml'))
try:
content = handle.read()
string_table = read_string_table(content)
eq_({0: 'This is cell A1 in Sheet 1', 1: 'This is cell G5'}, string_table)
finally:
handle.close() | |
15,569 | [
0.00039928697515279055,
-0.030067866668105125,
0.0007923513185232878,
0.028142990544438362,
0.04170561209321022,
0.029581116512417793,
0.025200366973876953,
0.00038718737778253853,
0.03997986391186714,
-0.003949311096221209,
0.0053819045424461365,
0.006117560435086489,
0.01895005628466606,
... | 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": "box_with_array", "anno... | class TestTimedelta64ArrayLikeComparisons:
# Comparison tests for timedelta64[ns] vectors fully parametrized over
# DataFrame/Series/TimedeltaIndex/TimedeltaArray. Ideally all comparison
# tests will eventually end up here.
def test_compare_timedelta64_zerodim(self, box_with_array):
# GH#266... | |
15,570 | [
0.046659987419843674,
0.015684600919485092,
0.001975852297618985,
-0.0393812470138073,
0.01621421054005623,
-0.02476944588124752,
0.012941492721438408,
-0.013674798421561718,
0.00568991107866168,
-0.015480903908610344,
0.053449857980012894,
-0.04416131600737572,
0.019432608038187027,
0.007... | 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_formatted_string_table():
handle = open(os.path.join(DATADIR, 'reader', 'shared-strings-rich.xml'))
try:
content = handle.read()
string_table = read_string_table(content)
eq_({0: 'Welcome', 1: 'to the best shop in town',
2: " let's play "}, string_table)
fin... | |
15,571 | [
-0.008273554034531116,
-0.023294473066926003,
-0.004538405686616898,
0.038630515336990356,
0.026618722826242447,
0.0024144072085618973,
0.03131468966603279,
0.01891980692744255,
0.054769814014434814,
0.0038525473792105913,
0.029386872425675392,
-0.0002678169112186879,
0.013482371345162392,
... | 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": "box_with_array", "annotation": null, "type_comment": null}}], "kw... | def test_compare_timedelta64_zerodim(self, box_with_array):
# GH#26689 should unbox when comparing with zerodim array
box = box_with_array
xbox = box_with_array if box_with_array is not pd.Index else np.ndarray
tdi = pd.timedelta_range('2H', periods=4)
other = np.array(tdi.to_nu... | |
15,572 | [
-0.020177651196718216,
-0.02544884942471981,
0.028538016602396965,
-0.007802597712725401,
0.04204699024558067,
0.03628544881939888,
0.0216609425842762,
-0.013447681441903114,
0.06629449874162674,
0.009242982603609562,
0.027974119409918785,
-0.011185970157384872,
0.016475554555654526,
-0.01... | 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 TestTimedelta64ArrayComparisons:
# TODO: All of these need to be parametrized over box
def test_compare_timedelta_series(self):
# regression test for GH#5963
s = pd.Series([timedelta(days=1), timedelta(days=2)])
actual = s > timedelta(days=1)
expected = pd.Series([False, T... | |
15,573 | [
-0.0009912257082760334,
-0.027232700958848,
0.05321110412478447,
-0.026533188298344612,
0.04894167184829712,
0.03799070417881012,
0.0051468354649841785,
-0.005394076928496361,
0.05871071293950081,
0.027859847992658615,
0.02875232882797718,
-0.04221189022064209,
-0.015268644317984581,
-0.00... | 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": "dtype", "annotation": null, "type_comment": null}}], "kwarg": nul... | def test_comp_nat(self, dtype):
left = pd.TimedeltaIndex([pd.Timedelta('1 days'), pd.NaT,
pd.Timedelta('3 days')])
right = pd.TimedeltaIndex([pd.NaT, pd.NaT, pd.Timedelta('3 days')])
lhs, rhs = left, right
if dtype is object:
lhs, rhs = left... | |
15,574 | [
0.002005902351811528,
-0.008362245745956898,
0.024437109008431435,
0.006755450740456581,
0.03784434497356415,
0.017733490094542503,
0.032370876520872116,
-0.0273811724036932,
0.02955120988190174,
0.016296012327075005,
0.02844545803964138,
-0.032232657074928284,
0.004651067312806845,
0.0320... | 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": "box_with_array", "annotation": null, "type_comment": null}}], "kw... | def test_tdi_cmp_str_invalid(self, box_with_array):
# GH#13624
xbox = box_with_array if box_with_array is not pd.Index else np.ndarray
tdi = TimedeltaIndex(['1 day', '2 days'])
tdarr = tm.box_expected(tdi, box_with_array)
for left, right in [(tdarr, 'a'), ('a', tdarr)]:
... | |
15,575 | [
-0.0204421766102314,
-0.03398052975535393,
0.052390728145837784,
-0.03236474096775055,
0.040468163788318634,
0.03694280982017517,
0.0195118747651577,
-0.007699478417634964,
0.06756935268640518,
0.03843618929386139,
0.0328298918902874,
-0.01736973039805889,
-0.01356283389031887,
-0.00351005... | 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_comparisons_nat(self):
tdidx1 = pd.TimedeltaIndex(['1 day', pd.NaT, '1 day 00:00:01', pd.NaT,
'1 day 00:00:01', '5 day 00:00:03'])
tdidx2 = pd.TimedeltaIndex(['2 day', '2 day', pd.NaT, pd.NaT,
'1 day 00:00:02', '5 days 00:0... | |
15,576 | [
-0.01963413879275322,
-0.003920258954167366,
0.07762889564037323,
-0.027612000703811646,
0.019598308950662613,
0.016660355031490326,
0.01320885494351387,
-0.0025901179760694504,
0.04992134869098663,
0.032651904970407486,
0.013101368211209774,
-0.001077847322449088,
-0.01227730792015791,
-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_comparisons_coverage(self):
rng = timedelta_range('1 days', periods=10)
result = rng < rng[3]
expected = np.array([True, True, True] + [False] * 7)
tm.assert_numpy_array_equal(result, expected)
# raise TypeError for now
with pytest.raises(TypeError):
... | |
15,577 | [
-0.014392701908946037,
0.009567403234541416,
0.03319472819566727,
-0.021311737596988678,
0.028951793909072876,
0.06095406413078308,
-0.016528036445379257,
0.021408798173069954,
0.06173054873943329,
0.024597931653261185,
0.031142590567469597,
-0.0011326626408845186,
0.017054935917258263,
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_ufunc_coercions(self):
# normal ops are also tested in tseries/test_timedeltas.py
idx = TimedeltaIndex(['2H', '4H', '6H', '8H', '10H'],
freq='2H', name='x')
for result in [idx * 2, np.multiply(idx, 2)]:
assert isinstance(result, TimedeltaIndex)
... | |
15,578 | [
-0.017916977405548096,
-0.00524244224652648,
0.02926803007721901,
-0.021369539201259613,
0.023986216634511948,
0.06614381074905396,
-0.0003982560010626912,
0.022871706634759903,
0.02648175321519375,
-0.000390684581361711,
0.017141664400696754,
0.0055059269070625305,
0.01213242206722498,
-0... | 12 | {"_type": "Module", "_fields": {"body": [{"_type": "ClassDef", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs... | class TestTimedelta64ArithmeticUnsorted:
# Tests moved from type-specific test files but not
# yet sorted/parametrized/de-duplicated
def test_ufunc_coercions(self):
# normal ops are also tested in tseries/test_timedeltas.py
idx = TimedeltaIndex(['2H', '4H', '6H', '8H', '10H'],
... | |
15,579 | [
-0.007268193643540144,
-0.025008589029312134,
0.023472974076867104,
-0.02574753202497959,
0.04061875119805336,
0.06899876892566681,
0.02346142753958702,
0.03641601651906967,
0.013635801151394844,
0.0007800751482136548,
-0.003535955911502242,
-0.03022737242281437,
0.01383208204060793,
-0.02... | 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_subtraction_ops(self):
# with datetimes/timedelta and tdi/dti
tdi = TimedeltaIndex(['1 days', pd.NaT, '2 days'], name='foo')
dti = pd.date_range('20130101', periods=3, name='bar')
td = Timedelta('1 days')
dt = Timestamp('20130101')
msg = "cannot subtract a datel... | |
15,580 | [
0.0010361375752836466,
-0.00447456818073988,
0.01692308485507965,
-0.028066392987966537,
0.03417915850877762,
0.06826318055391312,
0.0178031325340271,
0.037509068846702576,
0.0018255048198625445,
-0.0105130048468709,
0.01615006849169731,
0.0006812195642851293,
-0.029969200491905212,
-0.002... | 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_subtraction_ops_with_tz(self):
# check that dt/dti subtraction ops with tz are validated
dti = pd.date_range('20130101', periods=3)
ts = Timestamp('20130101')
dt = ts.to_pydatetime()
dti_tz = pd.date_range('20130101', periods=3).tz_localize('US/Eastern')
ts_tz =... | |
15,581 | [
-0.005924363154917955,
-0.01643235981464386,
0.03536823019385338,
-0.024581043049693108,
0.039638929069042206,
0.04840121790766716,
0.03050847537815571,
0.022801587358117104,
0.006399907171726227,
-0.00465726712718606,
0.014984250999987125,
0.011308752931654453,
0.016088740900158882,
-0.01... | 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_dti_tdi_numeric_ops(self):
# These are normally union/diff set-like ops
tdi = TimedeltaIndex(['1 days', pd.NaT, '2 days'], name='foo')
dti = pd.date_range('20130101', periods=3, name='bar')
# TODO(wesm): unused?
# td = Timedelta('1 days')
# dt = Timestamp('20130... | |
15,582 | [
0.0025095983874052763,
-0.04835198447108269,
0.036170825362205505,
-0.04322797805070877,
0.02383827418088913,
0.05193878710269928,
0.028624560683965683,
0.01876084879040718,
0.005581090692430735,
-0.0026187747716903687,
-0.005755772814154625,
0.0015648597618564963,
0.0006692504975944757,
-... | 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_addition_ops(self):
# with datetimes/timedelta and tdi/dti
tdi = TimedeltaIndex(['1 days', pd.NaT, '2 days'], name='foo')
dti = pd.date_range('20130101', periods=3, name='bar')
td = Timedelta('1 days')
dt = Timestamp('20130101')
result = tdi + dt
expecte... | |
15,583 | [
-0.02676888182759285,
-0.005656213033944368,
0.03536580875515938,
-0.016292981803417206,
0.004349943250417709,
0.028441935777664185,
0.04857007414102554,
0.02015387825667858,
-0.004211594350636005,
0.004198724869638681,
0.024735474959015846,
0.0006454936228692532,
-0.007477269042283297,
0.... | 11 | {"_type": "Module", "_fields": {"body": [{"_type": "ClassDef", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs... | class TestAddSubNaTMasking:
# TODO: parametrize over boxes
def test_tdi_add_timestamp_nat_masking(self):
# GH#17991 checking for overflow-masking with NaT
tdinat = pd.to_timedelta(['24658 days 11:15:00', 'NaT'])
tsneg = Timestamp('1950-01-01')
ts_neg_variants = [tsneg,
... | |
15,584 | [
0.0010456545278429985,
-0.020972350612282753,
0.047059912234544754,
-0.018352366983890533,
0.020036643370985985,
0.051950547844171524,
0.010916601866483688,
0.030691245570778847,
0.04221917688846588,
0.029568396508693695,
0.05229987949132919,
-0.008546140044927597,
-0.020710352808237076,
-... | 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": "freq", "annotation": null, "type_comment": null}}], "kwarg": null... | def test_timedelta(self, freq):
index = pd.date_range('1/1/2000', periods=50, freq=freq)
shifted = index + timedelta(1)
back = shifted + timedelta(-1)
tm.assert_index_equal(index, back)
if freq == 'D':
expected = pd.tseries.offsets.Day(1)
assert index.fr... | |
15,585 | [
0.0054281181655824184,
-0.020160656422376633,
0.03975231572985649,
-0.017031164839863777,
-0.004503495059907436,
0.023445330560207367,
0.019643384963274002,
0.009168637916445732,
0.00979582965373993,
0.007403448689728975,
0.008793615736067295,
0.017884662374854088,
-0.03026038408279419,
-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_tdi_add_overflow(self):
# See GH#14068
# preliminary test scalar analogue of vectorized tests below
with pytest.raises(OutOfBoundsDatetime):
pd.to_timedelta(106580, 'D') + Timestamp('2000')
with pytest.raises(OutOfBoundsDatetime):
Timestamp('2000') + pd.t... | |
15,586 | [
-0.004720004741102457,
-0.011005733162164688,
0.042326729744672775,
-0.002405669307336211,
0.018853923305869102,
0.013197746127843857,
0.050755541771650314,
0.009792297147214413,
-0.015383235178887844,
0.0016766291810199618,
0.02907026931643486,
0.013073792681097984,
0.001302323304116726,
... | 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_tdi_add_timestamp_nat_masking(self):
# GH#17991 checking for overflow-masking with NaT
tdinat = pd.to_timedelta(['24658 days 11:15:00', 'NaT'])
tsneg = Timestamp('1950-01-01')
ts_neg_variants = [tsneg,
tsneg.to_pydatetime(),
... | |
15,587 | [
0.009003214538097382,
-0.028707321733236313,
0.029785990715026855,
-0.045206062495708466,
0.012086003087460995,
0.009364813566207886,
0.005540439393371344,
0.04503445699810982,
0.021291468292474747,
0.0036650251131504774,
0.025740979239344597,
-0.012662110850214958,
-0.004293227568268776,
... | 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_td64_df_add_int_frame(self):
# GH#22696 Check that we don't dispatch to numpy implementation,
# which treats int64 as m8[ns]
tdi = pd.timedelta_range('1', periods=3)
df = tdi.to_frame()
other = pd.DataFrame([1, 2, 3], index=tdi) # indexed like `df`
with pytest.... | |
15,588 | [
0.0029009042773395777,
-0.02021082676947117,
0.0561080239713192,
-0.0601191520690918,
0.04450440779328346,
0.03017895482480526,
0.02171499840915203,
0.005924171768128872,
0.02309979312121868,
0.02626333013176918,
0.02881803549826145,
-0.0062435101717710495,
-0.01738154888153076,
-0.0266214... | 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 test_timedelta_ops_with_missing_values(self):
# setup
s1 = pd.to_timedelta(Series(['00:00:01']))
s2 = pd.to_timedelta(Series(['00:00:02']))
with tm.assert_produces_warning(FutureWarning, check_stacklevel=False):
# Passing datetime64-dtype data to TimedeltaIndex is depreca... | |
15,589 | [
0.011321497149765491,
-0.037029288709163666,
0.026507029309868813,
-0.03549374267458916,
0.03539305180311203,
0.06101902946829796,
0.021120036020874977,
0.009527930058538914,
0.035367876291275024,
0.02117038145661354,
0.02045295387506485,
-0.004307706840336323,
0.010434153489768505,
-0.010... | 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 test_operators_timedelta64(self):
# series ops
v1 = pd.date_range('2012-1-1', periods=3, freq='D')
v2 = pd.date_range('2012-1-2', periods=3, freq='D')
rs = Series(v2) - Series(v1)
xp = Series(1e9 * 3600 * 24,
rs.index).astype('int64').astype('timedelta64[n... | |
15,590 | [
0.010864579118788242,
-0.020984157919883728,
0.030197320505976677,
0.011032204143702984,
0.007319622207432985,
0.005590601824223995,
0.020475074648857117,
-0.013136828318238258,
0.02488299086689949,
0.009300079196691513,
-0.012596703134477139,
-0.0014962077839300036,
0.0059413728304207325,
... | 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": "box_with_array", "annotation": null, "type_comment": null}}], "kw... | def test_td64arr_add_str_invalid(self, box_with_array):
# GH#13624
tdi = TimedeltaIndex(['1 day', '2 days'])
tdi = tm.box_expected(tdi, box_with_array)
with pytest.raises(TypeError):
tdi + 'a'
with pytest.raises(TypeError):
'a' + tdi | |
15,591 | [
-0.003971382509917021,
-0.006433084607124329,
0.05338720977306366,
-0.03517245873808861,
0.03556682541966438,
0.04106329381465912,
0.04027456045150757,
0.012866169214248657,
0.05033087730407715,
0.01629221811890602,
0.021061575040221214,
-0.007985898293554783,
-0.0030378454830497503,
-0.00... | 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_timedelta64_ops_nat(self):
# GH 11349
timedelta_series = Series([NaT, Timedelta('1s')])
nat_series_dtype_timedelta = Series([NaT, NaT],
dtype='timedelta64[ns]')
single_nat_dtype_timedelta = Series([NaT], dtype='timedelta64[ns]')
... | |
15,592 | [
-0.028083886951208115,
-0.01718427799642086,
0.05848683789372444,
-0.002042227191850543,
0.00936322845518589,
0.03921540081501007,
0.010870620608329773,
0.004626536276191473,
0.042462095618247986,
0.007113734260201454,
0.030217427760362625,
-0.004788870923221111,
0.005391827784478664,
0.01... | 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": "box_with_array", "annotation": null, "type_comment": null}}, {"_t... | def test_td64arr_sub_period(self, box_with_array, freq):
# GH#13078
# not supported, check TypeError
p = pd.Period('2011-01-01', freq='D')
idx = TimedeltaIndex(['1 hours', '2 hours'], freq=freq)
idx = tm.box_expected(idx, box_with_array)
with pytest.raises(TypeError):
... | |
15,593 | [
-0.02761460654437542,
-0.029691072180867195,
0.023652615025639534,
0.017208410426974297,
0.021003330126404762,
0.007655475288629532,
0.03336665406823158,
-0.01001834962517023,
0.03527604788541794,
0.012220119126141071,
0.0021823772694915533,
-0.015418353490531445,
0.01957128569483757,
-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}}, {"_type": "arg", "_fields": {"arg": "box_with_array", "annotation": null, "type_comment": null}}, {"_t... | def test_td64arr_add_sub_float(self, box_with_array, other):
tdi = TimedeltaIndex(['-1 days', '-1 days'])
tdarr = tm.box_expected(tdi, box_with_array)
with pytest.raises(TypeError):
tdarr + other
with pytest.raises(TypeError):
other + tdarr
with pytest.ra... | |
15,594 | [
-0.010952702723443508,
-0.02317025512456894,
0.028901254758238792,
-0.0011983891017735004,
0.022823261097073555,
0.011629900895059109,
0.029460923746228218,
0.015368483029305935,
0.02641632966697216,
-0.014696881175041199,
0.02141289785504341,
0.011517967097461224,
-0.004046399611979723,
-... | 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": "box_with_array", "annotation": null, "type_comment": null}}], "kw... | def test_td64arr_sub_timestamp_raises(self, box_with_array):
idx = TimedeltaIndex(['1 day', '2 day'])
idx = tm.box_expected(idx, box_with_array)
msg = ("cannot subtract a datelike from|"
"Could not operate|"
"cannot perform operation")
with pytest.raises(Ty... | |
15,595 | [
-0.04006509855389595,
-0.026679610833525658,
0.028895298019051552,
-0.014607544057071209,
0.00782914087176323,
0.012814436107873917,
-0.006418639328330755,
0.026999400928616524,
0.035747937858104706,
-0.023573080077767372,
0.019929761067032814,
-0.00118779088370502,
0.01179796177893877,
0.... | 8 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "box_with_array", "annotation": null, "type_comment": null}}, {"_t... | def test_td64arr_sub_pi(self, box_with_array, tdi_freq, pi_freq):
# GH#20049 subtracting PeriodIndex should raise TypeError
tdi = TimedeltaIndex(['1 hours', '2 hours'], freq=tdi_freq)
dti = Timestamp('2018-03-07 17:16:40') + tdi
pi = dti.to_period(pi_freq)
# TODO: parametrize ov... | |
15,596 | [
-0.018114745616912842,
-0.02101891301572323,
0.019796742126345634,
-0.01740080490708351,
0.01962733268737793,
0.007151512429118156,
0.037003934383392334,
-0.02195066586136818,
-0.019119102507829666,
-0.023076031357049942,
0.0034426485653966665,
0.0338093526661396,
0.013927903957664967,
-0.... | 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": "box_with_array", "annotation": null, "type_comment": null}}, {"_t... | def test_td64arr_add_timestamp(self, box_with_array, tz_naive_fixture):
# GH#23215
# TODO: parametrize over scalar datetime types?
tz = tz_naive_fixture
other = Timestamp('2011-01-01', tz=tz)
idx = TimedeltaIndex(['1 day', '2 day'])
expected = DatetimeIndex(['2011-01-02... | |
15,597 | [
-0.016217786818742752,
-0.04408032074570656,
0.03790436312556267,
-0.005716298241168261,
0.015204174444079399,
0.015015595592558384,
0.03151625022292137,
-0.014414500445127487,
0.015616691671311855,
0.0006637093611061573,
0.00843301322311163,
0.007708163000643253,
0.012823366560041904,
-0.... | 8 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "box_with_array", "annotation": null, "type_comment": null}}], "kw... | def test_td64arr_add_sub_timestamp(self, box_with_array):
# GH#11925
ts = Timestamp('2012-01-01')
# TODO: parametrize over types of datetime scalar?
tdi = timedelta_range('1 day', periods=3)
expected = pd.date_range('2012-01-02', periods=3)
tdarr = tm.box_expected(tdi, ... | |
15,598 | [
-0.012858697213232517,
-0.0464303232729435,
0.03398866578936577,
0.006417763885110617,
0.01326415129005909,
0.0022343434393405914,
0.024929653853178024,
0.008555088192224503,
0.00523905036970973,
0.016206592321395874,
0.0059051536954939365,
0.003420297522097826,
0.0027817068621516228,
-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}}, {"_type": "arg", "_fields": {"arg": "box_with_array", "annotation": null, "type_comment": null}}], "kw... | def test_tdi_add_dt64_array(self, box_with_array):
dti = pd.date_range('2016-01-01', periods=3)
tdi = dti - dti.shift(1)
dtarr = dti.values
expected = pd.DatetimeIndex(dtarr) + tdi
tdi = tm.box_expected(tdi, box_with_array)
expected = tm.box_expected(expected, box_with_a... | |
15,599 | [
-0.011083563789725304,
-0.027312656864523888,
0.025934390723705292,
0.012358460575342178,
0.018755916506052017,
0.013851583003997803,
0.02621004357933998,
0.020984115079045296,
0.008309801109135151,
0.01077345386147499,
0.009567470289766788,
-0.004499467555433512,
0.008464856073260307,
-0.... | 8 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "box_with_array", "annotation": null, "type_comment": null}}], "kw... | def test_tdi_sub_dt64_array(self, box_with_array):
dti = pd.date_range('2016-01-01', periods=3)
tdi = dti - dti.shift(1)
dtarr = dti.values
expected = pd.DatetimeIndex(dtarr) - tdi
tdi = tm.box_expected(tdi, box_with_array)
expected = tm.box_expected(expected, box_with_a... | |
15,600 | [
-0.00015855101810302585,
-0.0555972121655941,
0.041981570422649384,
-0.030686773359775543,
0.01029554195702076,
0.009283393621444702,
0.015601258724927902,
0.008832117542624474,
0.05343108996748924,
0.03318813070654869,
0.014286111108958721,
-0.016813257709145546,
-0.010269754566252232,
-0... | 8 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "box", "annotation": null, "type_comment": null}}], "kwarg": null,... | def test_td64arr_add_int_series_invalid(self, box):
tdser = pd.Series(['59 Days', '59 Days', 'NaT'], dtype='m8[ns]')
tdser = tm.box_expected(tdser, box)
err = TypeError if box is not pd.Index else NullFrequencyError
int_ser = Series([2, 3, 4])
with pytest.raises(err):
... |