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,101
[ 0.023471638560295105, 0.04769286885857582, 0.060623351484537125, -0.024221230298280716, -0.012649385258555412, 0.02157423086464405, 0.043851204216480255, -0.01772085204720497, -0.025415895506739616, -0.04073570668697357, 0.008760870434343815, -0.04966055229306221, 0.03574622794985771, -0.0...
9
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "cls", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}}, "body": [{"_type": "Assign", "_fields": {"value": {"_type": "Tuple", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "elts": [{"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "p", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "tables", "value": {"_type": "Name", "_fields": {"id": "cls", "ctx": {"_type": "Load", "_fields": {}}}}}}}}, {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "c", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "tables", "value": {"_type": "Name", "_fields": {"id": "cls", "ctx": {"_type": "Load", "_fields": {}}}}}}}}, {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "C", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "classes", "value": {"_type": "Name", "_fields": {"id": "cls", "ctx": {"_type": "Load", "_fields": {}}}}}}}}, {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "P", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "classes", "value": {"_type": "Name", "_fields": {"id": "cls", "ctx": {"_type": "Load", "_fields": {}}}}}}}}]}}, "targets": [{"_type": "Tuple", "_fields": {"ctx": {"_type": "Store", "_fields": {}}, "elts": [{"_type": "Name", "_fields": {"id": "p", "ctx": {"_type": "Store", "_fields": {}}}}, {"_type": "Name", "_fields": {"id": "c", "ctx": {"_type": "Store", "_fields": {}}}}, {"_type": "Name", "_fields": {"id": "C", "ctx": {"_type": "Store", "_fields": {}}}}, {"_type": "Name", "_fields": {"id": "P", "ctx": {"_type": "Store", "_fields": {}}}}]}}], "type_comment": null}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Name", "_fields": {"id": "P", "ctx": {"_type": "Load", "_fields": {}}}}, {"_type": "Name", "_fields": {"id": "p", "ctx": {"_type": "Load", "_fields": {}}}}], "func": {"_type": "Name", "_fields": {"id": "mapper", "ctx": {"_type": "Load", "_fields": {}}}}, "keywords": [{"_type": "keyword", "_fields": {"arg": "version_id_col", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "version_id", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "c", "value": {"_type": "Name", "_fields": {"id": "p", "ctx": {"_type": "Load", "_fields": {}}}}}}}}}}, {"_type": "keyword", "_fields": {"arg": "properties", "value": {"_type": "Dict", "_fields": {"keys": [{"_type": "Constant", "_fields": {"kind": null, "value": "c"}}], "values": [{"_type": "Call", "_fields": {"args": [{"_type": "Name", "_fields": {"id": "C", "ctx": {"_type": "Load", "_fields": {}}}}], "func": {"_type": "Name", "_fields": {"id": "relationship", "ctx": {"_type": "Load", "_fields": {}}}}, "keywords": [{"_type": "keyword", "_fields": {"arg": "uselist", "value": {"_type": "Constant", "_fields": {"kind": null, "value": false}}}}, {"_type": "keyword", "_fields": {"arg": "cascade", "value": {"_type": "Constant", "_fields": {"kind": null, "value": "all, delete-orphan"}}}}]}}]}}}}]}}}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Name", "_fields": {"id": "C", "ctx": {"_type": "Load", "_fields": {}}}}, {"_type": "Name", "_fields": {"id": "c", "ctx": {"_type": "Load", "_fields": {}}}}], "func": {"_type": "Name", "_fields": {"id": "mapper", "ctx": {"_type": "Load", "_fields": {}}}}, "keywords": [{"_type": "keyword", "_fields": {"arg": "version_id_col", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "version_id", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "c", "value": {"_type": "Name", "_fields": {"id": "c", "ctx": {"_type": "Load", "_fields": {}}}}}}}}}}]}}}}], "name": "setup_mappers", "returns": null, "type_params": [], "type_comment": null, "decorator_list": []}}], "type_ignores": []}}
def setup_mappers(cls): p, c, C, P = cls.tables.p, cls.tables.c, cls.classes.C, cls.classes.P mapper( P, p, version_id_col=p.c.version_id, properties={ 'c': relationship( C, uselist=False, cascade='all, delete-orphan')}) mapper(C, c, version_id_col=c.c.version_id)
14,102
[ -0.004197240807116032, 0.003855524817481637, 0.09394088387489319, -0.034958600997924805, -0.006313120014965534, 0.04556215554475784, 0.024189362302422523, -0.004804736468940973, -0.007559175603091717, -0.01810060255229473, 0.030291929841041565, -0.0439329631626606, -0.009084817953407764, 0...
10
{"_type": "Module", "_fields": {"body": [{"_type": "ClassDef", "_fields": {"body": [{"_type": "Assign", "_fields": {"value": {"_type": "Constant", "_fields": {"kind": null, "value": true}}, "targets": [{"_type": "Name", "_fields": {"id": "__backend__", "ctx": {"_type": "Store", "_fields": {}}}}], "type_comment": null}}, {"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "cls", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "metadata", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}}, "body": [{"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"kind": null, "value": "p"}}, {"_type": "Name", "_fields": {"id": "metadata", "ctx": {"_type": "Load", "_fields": {}}}}, {"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"kind": null, "value": "id"}}, {"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"kind": null, "value": 10}}], "func": {"_type": "Name", "_fields": {"id": "String", "ctx": {"_type": "Load", "_fields": {}}}}, "keywords": []}}], "func": {"_type": "Name", "_fields": {"id": "Column", "ctx": {"_type": "Load", "_fields": {}}}}, "keywords": [{"_type": "keyword", "_fields": {"arg": "primary_key", "value": {"_type": "Constant", "_fields": {"kind": null, "value": true}}}}]}}, {"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"kind": null, "value": "version_id"}}, {"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"kind": null, "value": 32}}], "func": {"_type": "Name", "_fields": {"id": "String", "ctx": {"_type": "Load", "_fields": {}}}}, "keywords": []}}], "func": {"_type": "Name", "_fields": {"id": "Column", "ctx": {"_type": "Load", "_fields": {}}}}, "keywords": [{"_type": "keyword", "_fields": {"arg": "nullable", "value": {"_type": "Constant", "_fields": {"kind": null, "value": false}}}}]}}, {"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"kind": null, "value": "data"}}, {"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"kind": null, "value": 50}}], "func": {"_type": "Name", "_fields": {"id": "String", "ctx": {"_type": "Load", "_fields": {}}}}, "keywords": []}}], "func": {"_type": "Name", "_fields": {"id": "Column", "ctx": {"_type": "Load", "_fields": {}}}}, "keywords": []}}], "func": {"_type": "Name", "_fields": {"id": "Table", "ctx": {"_type": "Load", "_fields": {}}}}, "keywords": []}}}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"kind": null, "value": "c"}}, {"_type": "Name", "_fields": {"id": "metadata", "ctx": {"_type": "Load", "_fields": {}}}}, {"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"kind": null, "value": "id"}}, {"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"kind": null, "value": 10}}], "func": {"_type": "Name", "_fields": {"id": "String", "ctx": {"_type": "Load", "_fields": {}}}}, "keywords": []}}, {"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"kind": null, "value": "p.id"}}], "func": {"_type": "Name", "_fields": {"id": "ForeignKey", "ctx": {"_type": "Load", "_fields": {}}}}, "keywords": []}}], "func": {"_type": "Name", "_fields": {"id": "Column", "ctx": {"_type": "Load", "_fields": {}}}}, "keywords": [{"_type": "keyword", "_fields": {"arg": "primary_key", "value": {"_type": "Constant", "_fields": {"kind": null, "value": true}}}}]}}, {"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"kind": null, "value": "version_id"}}, {"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"kind": null, "value": 32}}], "func": {"_type": "Name", "_fields": {"id": "String", "ctx": {"_type": "Load", "_fields": {}}}}, "keywords": []}}], "func": {"_type": "Name", "_fields": {"id": "Column", "ctx": {"_type": "Load", "_fields": {}}}}, "keywords": [{"_type": "keyword", "_fields": {"arg": "nullable", "value": {"_type": "Constant", "_fields": {"kind": null, "value": false}}}}]}}, {"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"kind": null, "value": "data"}}, {"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"kind": null, "value": 50}}], "func": {"_type": "Name", "_fields": {"id": "String", "ctx": {"_type": "Load", "_fields": {}}}}, "keywords": []}}], "func": {"_type": "Name", "_fields": {"id": "Column", "ctx": {"_type": "Load", "_fields": {}}}}, "keywords": []}}], "func": {"_type": "Name", "_fields": {"id": "Table", "ctx": {"_type": "Load", "_fields": {}}}}, "keywords": []}}}}], "name": "define_tables", "returns": null, "type_params": [], "type_comment": null, "decorator_list": [{"_type": "Name", "_fields": {"id": "classmethod", "ctx": {"_type": "Load", "_fields": {}}}}]}}, {"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "cls", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}}, "body": [{"_type": "ClassDef", "_fields": {"body": [{"_type": "Pass", "_fields": {}}], "name": "P", "bases": [{"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "Basic", "value": {"_type": "Name", "_fields": {"id": "cls", "ctx": {"_type": "Load", "_fields": {}}}}}}], "keywords": [], "type_params": [], "decorator_list": []}}, {"_type": "ClassDef", "_fields": {"body": [{"_type": "Pass", "_fields": {}}], "name": "C", "bases": [{"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "Basic", "value": {"_type": "Name", "_fields": {"id": "cls", "ctx": {"_type": "Load", "_fields": {}}}}}}], "keywords": [], "type_params": [], "decorator_list": []}}], "name": "setup_classes", "returns": null, "type_params": [], "type_comment": null, "decorator_list": [{"_type": "Name", "_fields": {"id": "classmethod", "ctx": {"_type": "Load", "_fields": {}}}}]}}, {"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "cls", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}}, "body": [{"_type": "Assign", "_fields": {"value": {"_type": "Tuple", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "elts": [{"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "p", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "tables", "value": {"_type": "Name", "_fields": {"id": "cls", "ctx": {"_type": "Load", "_fields": {}}}}}}}}, {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "c", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "tables", "value": {"_type": "Name", "_fields": {"id": "cls", "ctx": {"_type": "Load", "_fields": {}}}}}}}}, {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "C", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "classes", "value": {"_type": "Name", "_fields": {"id": "cls", "ctx": {"_type": "Load", "_fields": {}}}}}}}}, {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "P", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "classes", "value": {"_type": "Name", "_fields": {"id": "cls", "ctx": {"_type": "Load", "_fields": {}}}}}}}}]}}, "targets": [{"_type": "Tuple", "_fields": {"ctx": {"_type": "Store", "_fields": {}}, "elts": [{"_type": "Name", "_fields": {"id": "p", "ctx": {"_type": "Store", "_fields": {}}}}, {"_type": "Name", "_fields": {"id": "c", "ctx": {"_type": "Store", "_fields": {}}}}, {"_type": "Name", "_fields": {"id": "C", "ctx": {"_type": "Store", "_fields": {}}}}, {"_type": "Name", "_fields": {"id": "P", "ctx": {"_type": "Store", "_fields": {}}}}]}}], "type_comment": null}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Name", "_fields": {"id": "P", "ctx": {"_type": "Load", "_fields": {}}}}, {"_type": "Name", "_fields": {"id": "p", "ctx": {"_type": "Load", "_fields": {}}}}], "func": {"_type": "Name", "_fields": {"id": "mapper", "ctx": {"_type": "Load", "_fields": {}}}}, "keywords": [{"_type": "keyword", "_fields": {"arg": "version_id_col", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "version_id", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "c", "value": {"_type": "Name", "_fields": {"id": "p", "ctx": {"_type": "Load", "_fields": {}}}}}}}}}}, {"_type": "keyword", "_fields": {"arg": "version_id_generator", "value": {"_type": "Lambda", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "x", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}}, "body": {"_type": "Call", "_fields": {"args": [], "func": {"_type": "Name", "_fields": {"id": "make_uuid", "ctx": {"_type": "Load", "_fields": {}}}}, "keywords": []}}}}}}, {"_type": "keyword", "_fields": {"arg": "properties", "value": {"_type": "Dict", "_fields": {"keys": [{"_type": "Constant", "_fields": {"kind": null, "value": "c"}}], "values": [{"_type": "Call", "_fields": {"args": [{"_type": "Name", "_fields": {"id": "C", "ctx": {"_type": "Load", "_fields": {}}}}], "func": {"_type": "Name", "_fields": {"id": "relationship", "ctx": {"_type": "Load", "_fields": {}}}}, "keywords": [{"_type": "keyword", "_fields": {"arg": "uselist", "value": {"_type": "Constant", "_fields": {"kind": null, "value": false}}}}, {"_type": "keyword", "_fields": {"arg": "cascade", "value": {"_type": "Constant", "_fields": {"kind": null, "value": "all, delete-orphan"}}}}]}}]}}}}]}}}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Name", "_fields": {"id": "C", "ctx": {"_type": "Load", "_fields": {}}}}, {"_type": "Name", "_fields": {"id": "c", "ctx": {"_type": "Load", "_fields": {}}}}], "func": {"_type": "Name", "_fields": {"id": "mapper", "ctx": {"_type": "Load", "_fields": {}}}}, "keywords": [{"_type": "keyword", "_fields": {"arg": "version_id_col", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "version_id", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "c", "value": {"_type": "Name", "_fields": {"id": "c", "ctx": {"_type": "Load", "_fields": {}}}}}}}}}}, {"_type": "keyword", "_fields": {"arg": "version_id_generator", "value": {"_type": "Lambda", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "x", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}}, "body": {"_type": "Call", "_fields": {"args": [], "func": {"_type": "Name", "_fields": {"id": "make_uuid", "ctx": {"_type": "Load", "_fields": {}}}}, "keywords": []}}}}}}]}}}}], "name": "setup_mappers", "returns": null, "type_params": [], "type_comment": null, "decorator_list": [{"_type": "Name", "_fields": {"id": "classmethod", "ctx": {"_type": "Load", "_fields": {}}}}]}}, {"_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": []}}, "body": [{"_type": "Assign", "_fields": {"value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "P", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "classes", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}}}, "targets": [{"_type": "Name", "_fields": {"id": "P", "ctx": {"_type": "Store", "_fields": {}}}}], "type_comment": null}}, {"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"args": [], "func": {"_type": "Call", "_fields": {"args": [], "func": {"_type": "Name", "_fields": {"id": "sessionmaker", "ctx": {"_type": "Load", "_fields": {}}}}, "keywords": []}}, "keywords": []}}, "targets": [{"_type": "Name", "_fields": {"id": "session", "ctx": {"_type": "Store", "_fields": {}}}}], "type_comment": null}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Call", "_fields": {"args": [], "func": {"_type": "Name", "_fields": {"id": "P", "ctx": {"_type": "Load", "_fields": {}}}}, "keywords": [{"_type": "keyword", "_fields": {"arg": "id", "value": {"_type": "Constant", "_fields": {"kind": null, "value": "P1"}}}}, {"_type": "keyword", "_fields": {"arg": "data", "value": {"_type": "Constant", "_fields": {"kind": null, "value": "P version 1"}}}}]}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "add", "value": {"_type": "Name", "_fields": {"id": "session", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "commit", "value": {"_type": "Name", "_fields": {"id": "session", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "close", "value": {"_type": "Name", "_fields": {"id": "session", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"args": [], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "first", "value": {"_type": "Call", "_fields": {"args": [{"_type": "Name", "_fields": {"id": "P", "ctx": {"_type": "Load", "_fields": {}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "query", "value": {"_type": "Name", "_fields": {"id": "session", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, "keywords": []}}, "targets": [{"_type": "Name", "_fields": {"id": "p", "ctx": {"_type": "Store", "_fields": {}}}}], "type_comment": null}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Name", "_fields": {"id": "p", "ctx": {"_type": "Load", "_fields": {}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "delete", "value": {"_type": "Name", "_fields": {"id": "session", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Call", "_fields": {"args": [], "func": {"_type": "Name", "_fields": {"id": "P", "ctx": {"_type": "Load", "_fields": {}}}}, "keywords": [{"_type": "keyword", "_fields": {"arg": "id", "value": {"_type": "Constant", "_fields": {"kind": null, "value": "P1"}}}}, {"_type": "keyword", "_fields": {"arg": "data", "value": {"_type": "Constant", "_fields": {"kind": null, "value": "really a row-switch"}}}}]}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "add", "value": {"_type": "Name", "_fields": {"id": "session", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "commit", "value": {"_type": "Name", "_fields": {"id": "session", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}], "name": "test_row_switch", "returns": null, "type_params": [], "type_comment": null, "decorator_list": [{"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"kind": null, "value": "+zxjdbc"}}, {"_type": "Constant", "_fields": {"kind": null, "value": ".*does not support updated rowcount"}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "emits_warning_on", "value": {"_type": "Name", "_fields": {"id": "testing", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}]}}, {"_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": []}}, "body": [{"_type": "Assign", "_fields": {"value": {"_type": "Tuple", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "elts": [{"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "P", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "classes", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}}}, {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "C", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "classes", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}}}]}}, "targets": [{"_type": "Tuple", "_fields": {"ctx": {"_type": "Store", "_fields": {}}, "elts": [{"_type": "Name", "_fields": {"id": "P", "ctx": {"_type": "Store", "_fields": {}}}}, {"_type": "Name", "_fields": {"id": "C", "ctx": {"_type": "Store", "_fields": {}}}}]}}], "type_comment": null}}, {"_type": "Assert", "_fields": {"msg": null, "test": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "use_get", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "strategy", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "property", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "c", "value": {"_type": "Name", "_fields": {"id": "P", "ctx": {"_type": "Load", "_fields": {}}}}}}}}}}}}}}, {"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"args": [], "func": {"_type": "Call", "_fields": {"args": [], "func": {"_type": "Name", "_fields": {"id": "sessionmaker", "ctx": {"_type": "Load", "_fields": {}}}}, "keywords": []}}, "keywords": []}}, "targets": [{"_type": "Name", "_fields": {"id": "session", "ctx": {"_type": "Store", "_fields": {}}}}], "type_comment": null}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Call", "_fields": {"args": [], "func": {"_type": "Name", "_fields": {"id": "P", "ctx": {"_type": "Load", "_fields": {}}}}, "keywords": [{"_type": "keyword", "_fields": {"arg": "id", "value": {"_type": "Constant", "_fields": {"kind": null, "value": "P1"}}}}, {"_type": "keyword", "_fields": {"arg": "data", "value": {"_type": "Constant", "_fields": {"kind": null, "value": "P version 1"}}}}]}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "add", "value": {"_type": "Name", "_fields": {"id": "session", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "commit", "value": {"_type": "Name", "_fields": {"id": "session", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "close", "value": {"_type": "Name", "_fields": {"id": "session", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"args": [], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "first", "value": {"_type": "Call", "_fields": {"args": [{"_type": "Name", "_fields": {"id": "P", "ctx": {"_type": "Load", "_fields": {}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "query", "value": {"_type": "Name", "_fields": {"id": "session", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, "keywords": []}}, "targets": [{"_type": "Name", "_fields": {"id": "p", "ctx": {"_type": "Store", "_fields": {}}}}], "type_comment": null}}, {"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"args": [], "func": {"_type": "Name", "_fields": {"id": "C", "ctx": {"_type": "Load", "_fields": {}}}}, "keywords": [{"_type": "keyword", "_fields": {"arg": "data", "value": {"_type": "Constant", "_fields": {"kind": null, "value": "child version 1"}}}}]}}, "targets": [{"_type": "Attribute", "_fields": {"ctx": {"_type": "Store", "_fields": {}}, "attr": "c", "value": {"_type": "Name", "_fields": {"id": "p", "ctx": {"_type": "Load", "_fields": {}}}}}}], "type_comment": null}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "commit", "value": {"_type": "Name", "_fields": {"id": "session", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"args": [], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "first", "value": {"_type": "Call", "_fields": {"args": [{"_type": "Name", "_fields": {"id": "P", "ctx": {"_type": "Load", "_fields": {}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "query", "value": {"_type": "Name", "_fields": {"id": "session", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, "keywords": []}}, "targets": [{"_type": "Name", "_fields": {"id": "p", "ctx": {"_type": "Store", "_fields": {}}}}], "type_comment": null}}, {"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"args": [], "func": {"_type": "Name", "_fields": {"id": "C", "ctx": {"_type": "Load", "_fields": {}}}}, "keywords": [{"_type": "keyword", "_fields": {"arg": "data", "value": {"_type": "Constant", "_fields": {"kind": null, "value": "child row-switch"}}}}]}}, "targets": [{"_type": "Attribute", "_fields": {"ctx": {"_type": "Store", "_fields": {}}, "attr": "c", "value": {"_type": "Name", "_fields": {"id": "p", "ctx": {"_type": "Load", "_fields": {}}}}}}], "type_comment": null}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "commit", "value": {"_type": "Name", "_fields": {"id": "session", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}], "name": "test_child_row_switch_one", "returns": null, "type_params": [], "type_comment": null, "decorator_list": [{"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"kind": null, "value": "+zxjdbc"}}, {"_type": "Constant", "_fields": {"kind": null, "value": ".*does not support (update|delete)d rowcount"}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "emits_warning_on", "value": {"_type": "Name", "_fields": {"id": "testing", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}]}}, {"_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": []}}, "body": [{"_type": "Assign", "_fields": {"value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "P", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "classes", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}}}, "targets": [{"_type": "Name", "_fields": {"id": "P", "ctx": {"_type": "Store", "_fields": {}}}}], "type_comment": null}}, {"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"args": [], "func": {"_type": "Name", "_fields": {"id": "sessionmaker", "ctx": {"_type": "Load", "_fields": {}}}}, "keywords": []}}, "targets": [{"_type": "Name", "_fields": {"id": "Session", "ctx": {"_type": "Store", "_fields": {}}}}], "type_comment": null}}, {"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"args": [], "func": {"_type": "Name", "_fields": {"id": "Session", "ctx": {"_type": "Load", "_fields": {}}}}, "keywords": []}}, "targets": [{"_type": "Name", "_fields": {"id": "sess1", "ctx": {"_type": "Store", "_fields": {}}}}], "type_comment": null}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Call", "_fields": {"args": [], "func": {"_type": "Name", "_fields": {"id": "P", "ctx": {"_type": "Load", "_fields": {}}}}, "keywords": [{"_type": "keyword", "_fields": {"arg": "id", "value": {"_type": "Constant", "_fields": {"kind": null, "value": "P1"}}}}, {"_type": "keyword", "_fields": {"arg": "data", "value": {"_type": "Constant", "_fields": {"kind": null, "value": "P version 1"}}}}]}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "add", "value": {"_type": "Name", "_fields": {"id": "sess1", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "commit", "value": {"_type": "Name", "_fields": {"id": "sess1", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "close", "value": {"_type": "Name", "_fields": {"id": "sess1", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"args": [], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "first", "value": {"_type": "Call", "_fields": {"args": [{"_type": "Name", "_fields": {"id": "P", "ctx": {"_type": "Load", "_fields": {}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "query", "value": {"_type": "Name", "_fields": {"id": "sess1", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, "keywords": []}}, "targets": [{"_type": "Name", "_fields": {"id": "p1", "ctx": {"_type": "Store", "_fields": {}}}}], "type_comment": null}}, {"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"args": [], "func": {"_type": "Name", "_fields": {"id": "Session", "ctx": {"_type": "Load", "_fields": {}}}}, "keywords": []}}, "targets": [{"_type": "Name", "_fields": {"id": "sess2", "ctx": {"_type": "Store", "_fields": {}}}}], "type_comment": null}}, {"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"args": [], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "first", "value": {"_type": "Call", "_fields": {"args": [{"_type": "Name", "_fields": {"id": "P", "ctx": {"_type": "Load", "_fields": {}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "query", "value": {"_type": "Name", "_fields": {"id": "sess2", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, "keywords": []}}, "targets": [{"_type": "Name", "_fields": {"id": "p2", "ctx": {"_type": "Store", "_fields": {}}}}], "type_comment": null}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Name", "_fields": {"id": "p1", "ctx": {"_type": "Load", "_fields": {}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "delete", "value": {"_type": "Name", "_fields": {"id": "sess1", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "commit", "value": {"_type": "Name", "_fields": {"id": "sess1", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Call", "_fields": {"args": [], "func": {"_type": "Name", "_fields": {"id": "P", "ctx": {"_type": "Load", "_fields": {}}}}, "keywords": [{"_type": "keyword", "_fields": {"arg": "id", "value": {"_type": "Constant", "_fields": {"kind": null, "value": "P1"}}}}, {"_type": "keyword", "_fields": {"arg": "data", "value": {"_type": "Constant", "_fields": {"kind": null, "value": "P version 2"}}}}]}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "add", "value": {"_type": "Name", "_fields": {"id": "sess1", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "commit", "value": {"_type": "Name", "_fields": {"id": "sess1", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Assign", "_fields": {"value": {"_type": "Constant", "_fields": {"kind": null, "value": "P overwritten by concurrent tx"}}, "targets": [{"_type": "Attribute", "_fields": {"ctx": {"_type": "Store", "_fields": {}}, "attr": "data", "value": {"_type": "Name", "_fields": {"id": "p2", "ctx": {"_type": "Load", "_fields": {}}}}}}], "type_comment": null}}, {"_type": "If", "_fields": {"body": [{"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "StaleDataError", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "exc", "value": {"_type": "Name", "_fields": {"id": "orm", "ctx": {"_type": "Load", "_fields": {}}}}}}}}, {"_type": "Constant", "_fields": {"kind": null, "value": "UPDATE statement on table 'p' expected to update 1 row\\(s\\); 0 were matched."}}, {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "commit", "value": {"_type": "Name", "_fields": {"id": "sess2", "ctx": {"_type": "Load", "_fields": {}}}}}}], "func": {"_type": "Name", "_fields": {"id": "assert_raises_message", "ctx": {"_type": "Load", "_fields": {}}}}, "keywords": []}}}}], "test": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "supports_sane_rowcount", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "dialect", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "db", "value": {"_type": "Name", "_fields": {"id": "testing", "ctx": {"_type": "Load", "_fields": {}}}}}}}}}}, "orelse": [{"_type": "Expr", "_fields": {"value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "commit", "value": {"_type": "Name", "_fields": {"id": "sess2", "ctx": {"_type": "Load", "_fields": {}}}}}}}}]}}], "name": "test_child_row_switch_two", "returns": null, "type_params": [], "type_comment": null, "decorator_list": [{"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"kind": null, "value": "+zxjdbc"}}, {"_type": "Constant", "_fields": {"kind": null, "value": ".*does not support (update|delete)d rowcount"}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "emits_warning_on", "value": {"_type": "Name", "_fields": {"id": "testing", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}]}}], "name": "AlternateGeneratorTest", "bases": [{"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "MappedTest", "value": {"_type": "Name", "_fields": {"id": "fixtures", "ctx": {"_type": "Load", "_fields": {}}}}}}], "keywords": [], "type_params": [], "decorator_list": []}}], "type_ignores": []}}
class AlternateGeneratorTest(fixtures.MappedTest): __backend__ = True @classmethod def define_tables(cls, metadata): Table( 'p', metadata, Column('id', String(10), primary_key=True), Column('version_id', String(32), nullable=False), Column('data', String(50)) ) Table( 'c', metadata, Column('id', String(10), ForeignKey('p.id'), primary_key=True), Column('version_id', String(32), nullable=False), Column('data', String(50)) ) @classmethod def setup_classes(cls): class P(cls.Basic): pass class C(cls.Basic): pass @classmethod def setup_mappers(cls): p, c, C, P = cls.tables.p, cls.tables.c, cls.classes.C, cls.classes.P mapper( P, p, version_id_col=p.c.version_id, version_id_generator=lambda x: make_uuid(), properties={ 'c': relationship( C, uselist=False, cascade='all, delete-orphan') }) mapper( C, c, version_id_col=c.c.version_id, version_id_generator=lambda x: make_uuid(), ) @testing.emits_warning_on( '+zxjdbc', r'.*does not support updated rowcount') def test_row_switch(self): P = self.classes.P session = sessionmaker()() session.add(P(id='P1', data='P version 1')) session.commit() session.close() p = session.query(P).first() session.delete(p) session.add(P(id='P1', data="really a row-switch")) session.commit() @testing.emits_warning_on( '+zxjdbc', r'.*does not support (update|delete)d rowcount') def test_child_row_switch_one(self): P, C = self.classes.P, self.classes.C assert P.c.property.strategy.use_get session = sessionmaker()() session.add(P(id='P1', data='P version 1')) session.commit() session.close() p = session.query(P).first() p.c = C(data='child version 1') session.commit() p = session.query(P).first() p.c = C(data='child row-switch') session.commit() @testing.emits_warning_on( '+zxjdbc', r'.*does not support (update|delete)d rowcount') def test_child_row_switch_two(self): P = self.classes.P Session = sessionmaker() # TODO: not sure this test is # testing exactly what its looking for sess1 = Session() sess1.add(P(id='P1', data='P version 1')) sess1.commit() sess1.close() p1 = sess1.query(P).first() sess2 = Session() p2 = sess2.query(P).first() sess1.delete(p1) sess1.commit() # this can be removed and it still passes sess1.add(P(id='P1', data='P version 2')) sess1.commit() p2.data = 'P overwritten by concurrent tx' if testing.db.dialect.supports_sane_rowcount: assert_raises_message( orm.exc.StaleDataError, r"UPDATE statement on table 'p' expected to update " r"1 row\(s\); 0 were matched.", sess2.commit ) else: sess2.commit
14,103
[ 0.02349860407412052, 0.0032735157292336226, 0.033991530537605286, -0.02229905128479004, -0.007702390197664499, 0.02279149927198887, -0.012607929296791553, -0.0005808359710499644, -0.0063386885449290276, -0.07323583960533142, 0.03121362067759037, -0.03282985836267471, 0.025102216750383377, ...
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": []}}, "body": [{"_type": "Assign", "_fields": {"value": {"_type": "Tuple", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "elts": [{"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "P", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "classes", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}}}, {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "C", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "classes", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}}}]}}, "targets": [{"_type": "Tuple", "_fields": {"ctx": {"_type": "Store", "_fields": {}}, "elts": [{"_type": "Name", "_fields": {"id": "P", "ctx": {"_type": "Store", "_fields": {}}}}, {"_type": "Name", "_fields": {"id": "C", "ctx": {"_type": "Store", "_fields": {}}}}]}}], "type_comment": null}}, {"_type": "Assert", "_fields": {"msg": null, "test": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "use_get", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "strategy", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "property", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "c", "value": {"_type": "Name", "_fields": {"id": "P", "ctx": {"_type": "Load", "_fields": {}}}}}}}}}}}}}}, {"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"args": [], "func": {"_type": "Call", "_fields": {"args": [], "func": {"_type": "Name", "_fields": {"id": "sessionmaker", "ctx": {"_type": "Load", "_fields": {}}}}, "keywords": []}}, "keywords": []}}, "targets": [{"_type": "Name", "_fields": {"id": "session", "ctx": {"_type": "Store", "_fields": {}}}}], "type_comment": null}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Call", "_fields": {"args": [], "func": {"_type": "Name", "_fields": {"id": "P", "ctx": {"_type": "Load", "_fields": {}}}}, "keywords": [{"_type": "keyword", "_fields": {"arg": "id", "value": {"_type": "Constant", "_fields": {"kind": null, "value": "P1"}}}}, {"_type": "keyword", "_fields": {"arg": "data", "value": {"_type": "Constant", "_fields": {"kind": null, "value": "P version 1"}}}}]}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "add", "value": {"_type": "Name", "_fields": {"id": "session", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "commit", "value": {"_type": "Name", "_fields": {"id": "session", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "close", "value": {"_type": "Name", "_fields": {"id": "session", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"args": [], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "first", "value": {"_type": "Call", "_fields": {"args": [{"_type": "Name", "_fields": {"id": "P", "ctx": {"_type": "Load", "_fields": {}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "query", "value": {"_type": "Name", "_fields": {"id": "session", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, "keywords": []}}, "targets": [{"_type": "Name", "_fields": {"id": "p", "ctx": {"_type": "Store", "_fields": {}}}}], "type_comment": null}}, {"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"args": [], "func": {"_type": "Name", "_fields": {"id": "C", "ctx": {"_type": "Load", "_fields": {}}}}, "keywords": [{"_type": "keyword", "_fields": {"arg": "data", "value": {"_type": "Constant", "_fields": {"kind": null, "value": "child version 1"}}}}]}}, "targets": [{"_type": "Attribute", "_fields": {"ctx": {"_type": "Store", "_fields": {}}, "attr": "c", "value": {"_type": "Name", "_fields": {"id": "p", "ctx": {"_type": "Load", "_fields": {}}}}}}], "type_comment": null}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "commit", "value": {"_type": "Name", "_fields": {"id": "session", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"args": [], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "first", "value": {"_type": "Call", "_fields": {"args": [{"_type": "Name", "_fields": {"id": "P", "ctx": {"_type": "Load", "_fields": {}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "query", "value": {"_type": "Name", "_fields": {"id": "session", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, "keywords": []}}, "targets": [{"_type": "Name", "_fields": {"id": "p", "ctx": {"_type": "Store", "_fields": {}}}}], "type_comment": null}}, {"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"args": [], "func": {"_type": "Name", "_fields": {"id": "C", "ctx": {"_type": "Load", "_fields": {}}}}, "keywords": [{"_type": "keyword", "_fields": {"arg": "data", "value": {"_type": "Constant", "_fields": {"kind": null, "value": "child row-switch"}}}}]}}, "targets": [{"_type": "Attribute", "_fields": {"ctx": {"_type": "Store", "_fields": {}}, "attr": "c", "value": {"_type": "Name", "_fields": {"id": "p", "ctx": {"_type": "Load", "_fields": {}}}}}}], "type_comment": null}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "commit", "value": {"_type": "Name", "_fields": {"id": "session", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}], "name": "test_child_row_switch", "returns": null, "type_params": [], "type_comment": null, "decorator_list": []}}], "type_ignores": []}}
def test_child_row_switch(self): P, C = self.classes.P, self.classes.C assert P.c.property.strategy.use_get session = sessionmaker()() session.add(P(id='P1', data='P version 1')) session.commit() session.close() p = session.query(P).first() p.c = C(data='child version 1') session.commit() p = session.query(P).first() p.c = C(data='child row-switch') session.commit()
14,104
[ 0.02629229985177517, -0.0005979103152640164, 0.03730834275484085, -0.02079688012599945, -0.005243334919214249, 0.01784750446677208, -0.011948753148317337, 0.0033211989793926477, -0.006465939339250326, -0.07517126947641373, 0.03324980288743973, -0.03080459125339985, 0.023040423169732094, 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": []}}, "body": [{"_type": "Assign", "_fields": {"value": {"_type": "Tuple", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "elts": [{"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "P", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "classes", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}}}, {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "C", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "classes", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}}}]}}, "targets": [{"_type": "Tuple", "_fields": {"ctx": {"_type": "Store", "_fields": {}}, "elts": [{"_type": "Name", "_fields": {"id": "P", "ctx": {"_type": "Store", "_fields": {}}}}, {"_type": "Name", "_fields": {"id": "C", "ctx": {"_type": "Store", "_fields": {}}}}]}}], "type_comment": null}}, {"_type": "Assert", "_fields": {"msg": null, "test": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "use_get", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "strategy", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "property", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "c", "value": {"_type": "Name", "_fields": {"id": "P", "ctx": {"_type": "Load", "_fields": {}}}}}}}}}}}}}}, {"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"args": [], "func": {"_type": "Call", "_fields": {"args": [], "func": {"_type": "Name", "_fields": {"id": "sessionmaker", "ctx": {"_type": "Load", "_fields": {}}}}, "keywords": []}}, "keywords": []}}, "targets": [{"_type": "Name", "_fields": {"id": "session", "ctx": {"_type": "Store", "_fields": {}}}}], "type_comment": null}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Call", "_fields": {"args": [], "func": {"_type": "Name", "_fields": {"id": "P", "ctx": {"_type": "Load", "_fields": {}}}}, "keywords": [{"_type": "keyword", "_fields": {"arg": "id", "value": {"_type": "Constant", "_fields": {"kind": null, "value": "P1"}}}}, {"_type": "keyword", "_fields": {"arg": "data", "value": {"_type": "Constant", "_fields": {"kind": null, "value": "P version 1"}}}}]}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "add", "value": {"_type": "Name", "_fields": {"id": "session", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "commit", "value": {"_type": "Name", "_fields": {"id": "session", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "close", "value": {"_type": "Name", "_fields": {"id": "session", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"args": [], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "first", "value": {"_type": "Call", "_fields": {"args": [{"_type": "Name", "_fields": {"id": "P", "ctx": {"_type": "Load", "_fields": {}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "query", "value": {"_type": "Name", "_fields": {"id": "session", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, "keywords": []}}, "targets": [{"_type": "Name", "_fields": {"id": "p", "ctx": {"_type": "Store", "_fields": {}}}}], "type_comment": null}}, {"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"args": [], "func": {"_type": "Name", "_fields": {"id": "C", "ctx": {"_type": "Load", "_fields": {}}}}, "keywords": [{"_type": "keyword", "_fields": {"arg": "data", "value": {"_type": "Constant", "_fields": {"kind": null, "value": "child version 1"}}}}]}}, "targets": [{"_type": "Attribute", "_fields": {"ctx": {"_type": "Store", "_fields": {}}, "attr": "c", "value": {"_type": "Name", "_fields": {"id": "p", "ctx": {"_type": "Load", "_fields": {}}}}}}], "type_comment": null}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "commit", "value": {"_type": "Name", "_fields": {"id": "session", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"args": [], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "first", "value": {"_type": "Call", "_fields": {"args": [{"_type": "Name", "_fields": {"id": "P", "ctx": {"_type": "Load", "_fields": {}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "query", "value": {"_type": "Name", "_fields": {"id": "session", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, "keywords": []}}, "targets": [{"_type": "Name", "_fields": {"id": "p", "ctx": {"_type": "Store", "_fields": {}}}}], "type_comment": null}}, {"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"args": [], "func": {"_type": "Name", "_fields": {"id": "C", "ctx": {"_type": "Load", "_fields": {}}}}, "keywords": [{"_type": "keyword", "_fields": {"arg": "data", "value": {"_type": "Constant", "_fields": {"kind": null, "value": "child row-switch"}}}}]}}, "targets": [{"_type": "Attribute", "_fields": {"ctx": {"_type": "Store", "_fields": {}}, "attr": "c", "value": {"_type": "Name", "_fields": {"id": "p", "ctx": {"_type": "Load", "_fields": {}}}}}}], "type_comment": null}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "commit", "value": {"_type": "Name", "_fields": {"id": "session", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}], "name": "test_child_row_switch_one", "returns": null, "type_params": [], "type_comment": null, "decorator_list": []}}], "type_ignores": []}}
def test_child_row_switch_one(self): P, C = self.classes.P, self.classes.C assert P.c.property.strategy.use_get session = sessionmaker()() session.add(P(id='P1', data='P version 1')) session.commit() session.close() p = session.query(P).first() p.c = C(data='child version 1') session.commit() p = session.query(P).first() p.c = C(data='child row-switch') session.commit()
14,105
[ -0.004413651302456856, -0.00892509426921606, 0.03854284808039665, -0.027459822595119476, 0.004781999159604311, -0.00023490306921303272, -0.026964345946907997, 0.02361336164176464, 0.004602714907377958, -0.07849389314651489, 0.030041515827178955, -0.017263440415263176, 0.007112693972885609, ...
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": []}}, "body": [{"_type": "Assign", "_fields": {"value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "P", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "classes", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}}}, "targets": [{"_type": "Name", "_fields": {"id": "P", "ctx": {"_type": "Store", "_fields": {}}}}], "type_comment": null}}, {"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"args": [], "func": {"_type": "Call", "_fields": {"args": [], "func": {"_type": "Name", "_fields": {"id": "sessionmaker", "ctx": {"_type": "Load", "_fields": {}}}}, "keywords": []}}, "keywords": []}}, "targets": [{"_type": "Name", "_fields": {"id": "session", "ctx": {"_type": "Store", "_fields": {}}}}], "type_comment": null}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Call", "_fields": {"args": [], "func": {"_type": "Name", "_fields": {"id": "P", "ctx": {"_type": "Load", "_fields": {}}}}, "keywords": [{"_type": "keyword", "_fields": {"arg": "id", "value": {"_type": "Constant", "_fields": {"kind": null, "value": "P1"}}}}, {"_type": "keyword", "_fields": {"arg": "data", "value": {"_type": "Constant", "_fields": {"kind": null, "value": "P version 1"}}}}]}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "add", "value": {"_type": "Name", "_fields": {"id": "session", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "commit", "value": {"_type": "Name", "_fields": {"id": "session", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "close", "value": {"_type": "Name", "_fields": {"id": "session", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"args": [], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "first", "value": {"_type": "Call", "_fields": {"args": [{"_type": "Name", "_fields": {"id": "P", "ctx": {"_type": "Load", "_fields": {}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "query", "value": {"_type": "Name", "_fields": {"id": "session", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, "keywords": []}}, "targets": [{"_type": "Name", "_fields": {"id": "p", "ctx": {"_type": "Store", "_fields": {}}}}], "type_comment": null}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Name", "_fields": {"id": "p", "ctx": {"_type": "Load", "_fields": {}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "delete", "value": {"_type": "Name", "_fields": {"id": "session", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Call", "_fields": {"args": [], "func": {"_type": "Name", "_fields": {"id": "P", "ctx": {"_type": "Load", "_fields": {}}}}, "keywords": [{"_type": "keyword", "_fields": {"arg": "id", "value": {"_type": "Constant", "_fields": {"kind": null, "value": "P1"}}}}, {"_type": "keyword", "_fields": {"arg": "data", "value": {"_type": "Constant", "_fields": {"kind": null, "value": "really a row-switch"}}}}]}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "add", "value": {"_type": "Name", "_fields": {"id": "session", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "commit", "value": {"_type": "Name", "_fields": {"id": "session", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}], "name": "test_row_switch", "returns": null, "type_params": [], "type_comment": null, "decorator_list": []}}], "type_ignores": []}}
def test_row_switch(self): P = self.classes.P session = sessionmaker()() session.add(P(id='P1', data='P version 1')) session.commit() session.close() p = session.query(P).first() session.delete(p) session.add(P(id='P1', data="really a row-switch")) session.commit()
14,106
[ 0.01559325773268938, -0.016307948157191277, 0.04415490850806236, -0.032148100435733795, -0.0069909775629639626, 0.019738465547561646, 0.023298926651477814, 0.02325994335114956, 0.013299749232828617, -0.07287248969078064, 0.03425319120287895, -0.00477868365123868, 0.0025517717003822327, 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": []}}, "body": [{"_type": "Assign", "_fields": {"value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "P", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "classes", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}}}, "targets": [{"_type": "Name", "_fields": {"id": "P", "ctx": {"_type": "Store", "_fields": {}}}}], "type_comment": null}}, {"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"args": [], "func": {"_type": "Name", "_fields": {"id": "sessionmaker", "ctx": {"_type": "Load", "_fields": {}}}}, "keywords": []}}, "targets": [{"_type": "Name", "_fields": {"id": "Session", "ctx": {"_type": "Store", "_fields": {}}}}], "type_comment": null}}, {"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"args": [], "func": {"_type": "Name", "_fields": {"id": "Session", "ctx": {"_type": "Load", "_fields": {}}}}, "keywords": []}}, "targets": [{"_type": "Name", "_fields": {"id": "sess1", "ctx": {"_type": "Store", "_fields": {}}}}], "type_comment": null}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Call", "_fields": {"args": [], "func": {"_type": "Name", "_fields": {"id": "P", "ctx": {"_type": "Load", "_fields": {}}}}, "keywords": [{"_type": "keyword", "_fields": {"arg": "id", "value": {"_type": "Constant", "_fields": {"kind": null, "value": "P1"}}}}, {"_type": "keyword", "_fields": {"arg": "data", "value": {"_type": "Constant", "_fields": {"kind": null, "value": "P version 1"}}}}]}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "add", "value": {"_type": "Name", "_fields": {"id": "sess1", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "commit", "value": {"_type": "Name", "_fields": {"id": "sess1", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "close", "value": {"_type": "Name", "_fields": {"id": "sess1", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"args": [], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "first", "value": {"_type": "Call", "_fields": {"args": [{"_type": "Name", "_fields": {"id": "P", "ctx": {"_type": "Load", "_fields": {}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "query", "value": {"_type": "Name", "_fields": {"id": "sess1", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, "keywords": []}}, "targets": [{"_type": "Name", "_fields": {"id": "p1", "ctx": {"_type": "Store", "_fields": {}}}}], "type_comment": null}}, {"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"args": [], "func": {"_type": "Name", "_fields": {"id": "Session", "ctx": {"_type": "Load", "_fields": {}}}}, "keywords": []}}, "targets": [{"_type": "Name", "_fields": {"id": "sess2", "ctx": {"_type": "Store", "_fields": {}}}}], "type_comment": null}}, {"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"args": [], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "first", "value": {"_type": "Call", "_fields": {"args": [{"_type": "Name", "_fields": {"id": "P", "ctx": {"_type": "Load", "_fields": {}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "query", "value": {"_type": "Name", "_fields": {"id": "sess2", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, "keywords": []}}, "targets": [{"_type": "Name", "_fields": {"id": "p2", "ctx": {"_type": "Store", "_fields": {}}}}], "type_comment": null}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Name", "_fields": {"id": "p1", "ctx": {"_type": "Load", "_fields": {}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "delete", "value": {"_type": "Name", "_fields": {"id": "sess1", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "commit", "value": {"_type": "Name", "_fields": {"id": "sess1", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Call", "_fields": {"args": [], "func": {"_type": "Name", "_fields": {"id": "P", "ctx": {"_type": "Load", "_fields": {}}}}, "keywords": [{"_type": "keyword", "_fields": {"arg": "id", "value": {"_type": "Constant", "_fields": {"kind": null, "value": "P1"}}}}, {"_type": "keyword", "_fields": {"arg": "data", "value": {"_type": "Constant", "_fields": {"kind": null, "value": "P version 2"}}}}]}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "add", "value": {"_type": "Name", "_fields": {"id": "sess1", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "commit", "value": {"_type": "Name", "_fields": {"id": "sess1", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Assign", "_fields": {"value": {"_type": "Constant", "_fields": {"kind": null, "value": "P overwritten by concurrent tx"}}, "targets": [{"_type": "Attribute", "_fields": {"ctx": {"_type": "Store", "_fields": {}}, "attr": "data", "value": {"_type": "Name", "_fields": {"id": "p2", "ctx": {"_type": "Load", "_fields": {}}}}}}], "type_comment": null}}, {"_type": "If", "_fields": {"body": [{"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "StaleDataError", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "exc", "value": {"_type": "Name", "_fields": {"id": "orm", "ctx": {"_type": "Load", "_fields": {}}}}}}}}, {"_type": "Constant", "_fields": {"kind": null, "value": "UPDATE statement on table 'p' expected to update 1 row\\(s\\); 0 were matched."}}, {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "commit", "value": {"_type": "Name", "_fields": {"id": "sess2", "ctx": {"_type": "Load", "_fields": {}}}}}}], "func": {"_type": "Name", "_fields": {"id": "assert_raises_message", "ctx": {"_type": "Load", "_fields": {}}}}, "keywords": []}}}}], "test": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "supports_sane_rowcount", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "dialect", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "db", "value": {"_type": "Name", "_fields": {"id": "testing", "ctx": {"_type": "Load", "_fields": {}}}}}}}}}}, "orelse": [{"_type": "Expr", "_fields": {"value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "commit", "value": {"_type": "Name", "_fields": {"id": "sess2", "ctx": {"_type": "Load", "_fields": {}}}}}}}}]}}], "name": "test_child_row_switch_two", "returns": null, "type_params": [], "type_comment": null, "decorator_list": []}}], "type_ignores": []}}
def test_child_row_switch_two(self): P = self.classes.P Session = sessionmaker() # TODO: not sure this test is # testing exactly what its looking for sess1 = Session() sess1.add(P(id='P1', data='P version 1')) sess1.commit() sess1.close() p1 = sess1.query(P).first() sess2 = Session() p2 = sess2.query(P).first() sess1.delete(p1) sess1.commit() # this can be removed and it still passes sess1.add(P(id='P1', data='P version 2')) sess1.commit() p2.data = 'P overwritten by concurrent tx' if testing.db.dialect.supports_sane_rowcount: assert_raises_message( orm.exc.StaleDataError, r"UPDATE statement on table 'p' expected to update " r"1 row\(s\); 0 were matched.", sess2.commit ) else: sess2.commit
14,107
[ 0.013220845721662045, 0.03161810711026192, 0.08967790752649307, -0.04267045482993126, 0.026301788166165352, 0.01867706887423992, 0.02830706723034382, -0.02847028709948063, -0.03677120804786682, 0.00015821076522115618, 0.02381850779056549, -0.026161886751651764, 0.012871088460087776, 0.0121...
10
{"_type": "Module", "_fields": {"body": [{"_type": "ClassDef", "_fields": {"body": [{"_type": "Assign", "_fields": {"value": {"_type": "Constant", "_fields": {"kind": null, "value": true}}, "targets": [{"_type": "Name", "_fields": {"id": "__backend__", "ctx": {"_type": "Store", "_fields": {}}}}], "type_comment": null}}, {"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "cls", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "metadata", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}}, "body": [{"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"kind": null, "value": "base"}}, {"_type": "Name", "_fields": {"id": "metadata", "ctx": {"_type": "Load", "_fields": {}}}}, {"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"kind": null, "value": "id"}}, {"_type": "Name", "_fields": {"id": "Integer", "ctx": {"_type": "Load", "_fields": {}}}}], "func": {"_type": "Name", "_fields": {"id": "Column", "ctx": {"_type": "Load", "_fields": {}}}}, "keywords": [{"_type": "keyword", "_fields": {"arg": "primary_key", "value": {"_type": "Constant", "_fields": {"kind": null, "value": true}}}}, {"_type": "keyword", "_fields": {"arg": "test_needs_autoincrement", "value": {"_type": "Constant", "_fields": {"kind": null, "value": true}}}}]}}, {"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"kind": null, "value": "version_id"}}, {"_type": "Name", "_fields": {"id": "Integer", "ctx": {"_type": "Load", "_fields": {}}}}], "func": {"_type": "Name", "_fields": {"id": "Column", "ctx": {"_type": "Load", "_fields": {}}}}, "keywords": [{"_type": "keyword", "_fields": {"arg": "nullable", "value": {"_type": "Constant", "_fields": {"kind": null, "value": true}}}}]}}, {"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"kind": null, "value": "data"}}, {"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"kind": null, "value": 50}}], "func": {"_type": "Name", "_fields": {"id": "String", "ctx": {"_type": "Load", "_fields": {}}}}, "keywords": []}}], "func": {"_type": "Name", "_fields": {"id": "Column", "ctx": {"_type": "Load", "_fields": {}}}}, "keywords": []}}], "func": {"_type": "Name", "_fields": {"id": "Table", "ctx": {"_type": "Load", "_fields": {}}}}, "keywords": []}}}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"kind": null, "value": "sub"}}, {"_type": "Name", "_fields": {"id": "metadata", "ctx": {"_type": "Load", "_fields": {}}}}, {"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"kind": null, "value": "id"}}, {"_type": "Name", "_fields": {"id": "Integer", "ctx": {"_type": "Load", "_fields": {}}}}, {"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"kind": null, "value": "base.id"}}], "func": {"_type": "Name", "_fields": {"id": "ForeignKey", "ctx": {"_type": "Load", "_fields": {}}}}, "keywords": []}}], "func": {"_type": "Name", "_fields": {"id": "Column", "ctx": {"_type": "Load", "_fields": {}}}}, "keywords": [{"_type": "keyword", "_fields": {"arg": "primary_key", "value": {"_type": "Constant", "_fields": {"kind": null, "value": true}}}}]}}, {"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"kind": null, "value": "sub_data"}}, {"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"kind": null, "value": 50}}], "func": {"_type": "Name", "_fields": {"id": "String", "ctx": {"_type": "Load", "_fields": {}}}}, "keywords": []}}], "func": {"_type": "Name", "_fields": {"id": "Column", "ctx": {"_type": "Load", "_fields": {}}}}, "keywords": []}}], "func": {"_type": "Name", "_fields": {"id": "Table", "ctx": {"_type": "Load", "_fields": {}}}}, "keywords": []}}}}], "name": "define_tables", "returns": null, "type_params": [], "type_comment": null, "decorator_list": [{"_type": "Name", "_fields": {"id": "classmethod", "ctx": {"_type": "Load", "_fields": {}}}}]}}, {"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "cls", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}}, "body": [{"_type": "ClassDef", "_fields": {"body": [{"_type": "Pass", "_fields": {}}], "name": "Base", "bases": [{"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "Basic", "value": {"_type": "Name", "_fields": {"id": "cls", "ctx": {"_type": "Load", "_fields": {}}}}}}], "keywords": [], "type_params": [], "decorator_list": []}}, {"_type": "ClassDef", "_fields": {"body": [{"_type": "Pass", "_fields": {}}], "name": "Sub", "bases": [{"_type": "Name", "_fields": {"id": "Base", "ctx": {"_type": "Load", "_fields": {}}}}], "keywords": [], "type_params": [], "decorator_list": []}}], "name": "setup_classes", "returns": null, "type_params": [], "type_comment": null, "decorator_list": [{"_type": "Name", "_fields": {"id": "classmethod", "ctx": {"_type": "Load", "_fields": {}}}}]}}, {"_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": []}}, "body": [{"_type": "Assign", "_fields": {"value": {"_type": "Tuple", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "elts": [{"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "Base", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "classes", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}}}, {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "sub", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "tables", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}}}, {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "base", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "tables", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}}}, {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "Sub", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "classes", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}}}]}}, "targets": [{"_type": "Tuple", "_fields": {"ctx": {"_type": "Store", "_fields": {}}, "elts": [{"_type": "Name", "_fields": {"id": "Base", "ctx": {"_type": "Store", "_fields": {}}}}, {"_type": "Name", "_fields": {"id": "sub", "ctx": {"_type": "Store", "_fields": {}}}}, {"_type": "Name", "_fields": {"id": "base", "ctx": {"_type": "Store", "_fields": {}}}}, {"_type": "Name", "_fields": {"id": "Sub", "ctx": {"_type": "Store", "_fields": {}}}}]}}], "type_comment": null}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Name", "_fields": {"id": "Base", "ctx": {"_type": "Load", "_fields": {}}}}, {"_type": "Name", "_fields": {"id": "base", "ctx": {"_type": "Load", "_fields": {}}}}], "func": {"_type": "Name", "_fields": {"id": "mapper", "ctx": {"_type": "Load", "_fields": {}}}}, "keywords": [{"_type": "keyword", "_fields": {"arg": "version_id_col", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "version_id", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "c", "value": {"_type": "Name", "_fields": {"id": "base", "ctx": {"_type": "Load", "_fields": {}}}}}}}}}}]}}}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Name", "_fields": {"id": "Sub", "ctx": {"_type": "Load", "_fields": {}}}}, {"_type": "Name", "_fields": {"id": "sub", "ctx": {"_type": "Load", "_fields": {}}}}], "func": {"_type": "Name", "_fields": {"id": "mapper", "ctx": {"_type": "Load", "_fields": {}}}}, "keywords": [{"_type": "keyword", "_fields": {"arg": "inherits", "value": {"_type": "Name", "_fields": {"id": "Base", "ctx": {"_type": "Load", "_fields": {}}}}}}]}}}}, {"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"args": [], "func": {"_type": "Name", "_fields": {"id": "Session", "ctx": {"_type": "Load", "_fields": {}}}}, "keywords": []}}, "targets": [{"_type": "Name", "_fields": {"id": "s", "ctx": {"_type": "Store", "_fields": {}}}}], "type_comment": null}}, {"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"args": [], "func": {"_type": "Name", "_fields": {"id": "Sub", "ctx": {"_type": "Load", "_fields": {}}}}, "keywords": [{"_type": "keyword", "_fields": {"arg": "data", "value": {"_type": "Constant", "_fields": {"kind": null, "value": "b"}}}}, {"_type": "keyword", "_fields": {"arg": "sub_data", "value": {"_type": "Constant", "_fields": {"kind": null, "value": "s"}}}}]}}, "targets": [{"_type": "Name", "_fields": {"id": "s1", "ctx": {"_type": "Store", "_fields": {}}}}], "type_comment": null}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Name", "_fields": {"id": "s1", "ctx": {"_type": "Load", "_fields": {}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "add", "value": {"_type": "Name", "_fields": {"id": "s", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "commit", "value": {"_type": "Name", "_fields": {"id": "s", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Assign", "_fields": {"value": {"_type": "Constant", "_fields": {"kind": null, "value": "s2"}}, "targets": [{"_type": "Attribute", "_fields": {"ctx": {"_type": "Store", "_fields": {}}, "attr": "sub_data", "value": {"_type": "Name", "_fields": {"id": "s1", "ctx": {"_type": "Load", "_fields": {}}}}}}], "type_comment": null}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "commit", "value": {"_type": "Name", "_fields": {"id": "s", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "version_id", "value": {"_type": "Name", "_fields": {"id": "s1", "ctx": {"_type": "Load", "_fields": {}}}}}}, {"_type": "Constant", "_fields": {"kind": null, "value": 2}}], "func": {"_type": "Name", "_fields": {"id": "eq_", "ctx": {"_type": "Load", "_fields": {}}}}, "keywords": []}}}}], "name": "test_update_child_table_only", "returns": null, "type_params": [], "type_comment": null, "decorator_list": []}}], "name": "PlainInheritanceTest", "bases": [{"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "MappedTest", "value": {"_type": "Name", "_fields": {"id": "fixtures", "ctx": {"_type": "Load", "_fields": {}}}}}}], "keywords": [], "type_params": [], "decorator_list": []}}], "type_ignores": []}}
class PlainInheritanceTest(fixtures.MappedTest): __backend__ = True @classmethod def define_tables(cls, metadata): Table( 'base', metadata, Column( 'id', Integer, primary_key=True, test_needs_autoincrement=True), Column('version_id', Integer, nullable=True), Column('data', String(50)) ) Table( 'sub', metadata, Column('id', Integer, ForeignKey('base.id'), primary_key=True), Column('sub_data', String(50)) ) @classmethod def setup_classes(cls): class Base(cls.Basic): pass class Sub(Base): pass def test_update_child_table_only(self): Base, sub, base, Sub = ( self.classes.Base, self.tables.sub, self.tables.base, self.classes.Sub) mapper(Base, base, version_id_col=base.c.version_id) mapper(Sub, sub, inherits=Base) s = Session() s1 = Sub(data='b', sub_data='s') s.add(s1) s.commit() s1.sub_data = 's2' s.commit() eq_(s1.version_id, 2)
14,108
[ 0.004630676005035639, 0.04995383322238922, 0.09619428217411041, -0.04148820415139198, 0.017273858189582825, 0.035962339490652084, 0.04358803480863571, -0.036404408514499664, -0.05459555983543396, -0.0012716400669887662, 0.008846912533044815, -0.03023754060268402, 0.03748747706413269, -0.02...
8
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "cls", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "metadata", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}}, "body": [{"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"kind": null, "value": "base"}}, {"_type": "Name", "_fields": {"id": "metadata", "ctx": {"_type": "Load", "_fields": {}}}}, {"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"kind": null, "value": "id"}}, {"_type": "Name", "_fields": {"id": "Integer", "ctx": {"_type": "Load", "_fields": {}}}}], "func": {"_type": "Name", "_fields": {"id": "Column", "ctx": {"_type": "Load", "_fields": {}}}}, "keywords": [{"_type": "keyword", "_fields": {"arg": "primary_key", "value": {"_type": "Constant", "_fields": {"kind": null, "value": true}}}}, {"_type": "keyword", "_fields": {"arg": "test_needs_autoincrement", "value": {"_type": "Constant", "_fields": {"kind": null, "value": true}}}}]}}, {"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"kind": null, "value": "version_id"}}, {"_type": "Name", "_fields": {"id": "Integer", "ctx": {"_type": "Load", "_fields": {}}}}], "func": {"_type": "Name", "_fields": {"id": "Column", "ctx": {"_type": "Load", "_fields": {}}}}, "keywords": [{"_type": "keyword", "_fields": {"arg": "nullable", "value": {"_type": "Constant", "_fields": {"kind": null, "value": true}}}}]}}, {"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"kind": null, "value": "data"}}, {"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"kind": null, "value": 50}}], "func": {"_type": "Name", "_fields": {"id": "String", "ctx": {"_type": "Load", "_fields": {}}}}, "keywords": []}}], "func": {"_type": "Name", "_fields": {"id": "Column", "ctx": {"_type": "Load", "_fields": {}}}}, "keywords": []}}], "func": {"_type": "Name", "_fields": {"id": "Table", "ctx": {"_type": "Load", "_fields": {}}}}, "keywords": []}}}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"kind": null, "value": "sub"}}, {"_type": "Name", "_fields": {"id": "metadata", "ctx": {"_type": "Load", "_fields": {}}}}, {"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"kind": null, "value": "id"}}, {"_type": "Name", "_fields": {"id": "Integer", "ctx": {"_type": "Load", "_fields": {}}}}, {"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"kind": null, "value": "base.id"}}], "func": {"_type": "Name", "_fields": {"id": "ForeignKey", "ctx": {"_type": "Load", "_fields": {}}}}, "keywords": []}}], "func": {"_type": "Name", "_fields": {"id": "Column", "ctx": {"_type": "Load", "_fields": {}}}}, "keywords": [{"_type": "keyword", "_fields": {"arg": "primary_key", "value": {"_type": "Constant", "_fields": {"kind": null, "value": true}}}}]}}, {"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"kind": null, "value": "sub_data"}}, {"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"kind": null, "value": 50}}], "func": {"_type": "Name", "_fields": {"id": "String", "ctx": {"_type": "Load", "_fields": {}}}}, "keywords": []}}], "func": {"_type": "Name", "_fields": {"id": "Column", "ctx": {"_type": "Load", "_fields": {}}}}, "keywords": []}}], "func": {"_type": "Name", "_fields": {"id": "Table", "ctx": {"_type": "Load", "_fields": {}}}}, "keywords": []}}}}], "name": "define_tables", "returns": null, "type_params": [], "type_comment": null, "decorator_list": []}}], "type_ignores": []}}
def define_tables(cls, metadata): Table( 'base', metadata, Column( 'id', Integer, primary_key=True, test_needs_autoincrement=True), Column('version_id', Integer, nullable=True), Column('data', String(50)) ) Table( 'sub', metadata, Column('id', Integer, ForeignKey('base.id'), primary_key=True), Column('sub_data', String(50)) )
14,109
[ 0.03152679651975632, 0.020780615508556366, 0.060066595673561096, -0.027933066710829735, -0.008570107631385326, 0.030593357980251312, 0.06011326611042023, 0.009328524582087994, -0.01854036934673786, -0.025179430842399597, 0.0076891775242984295, -0.03647400438785553, 0.011685449630022049, 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": []}}, "body": [{"_type": "Assign", "_fields": {"value": {"_type": "Tuple", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "elts": [{"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "Base", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "classes", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}}}, {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "sub", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "tables", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}}}, {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "base", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "tables", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}}}, {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "Sub", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "classes", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}}}]}}, "targets": [{"_type": "Tuple", "_fields": {"ctx": {"_type": "Store", "_fields": {}}, "elts": [{"_type": "Name", "_fields": {"id": "Base", "ctx": {"_type": "Store", "_fields": {}}}}, {"_type": "Name", "_fields": {"id": "sub", "ctx": {"_type": "Store", "_fields": {}}}}, {"_type": "Name", "_fields": {"id": "base", "ctx": {"_type": "Store", "_fields": {}}}}, {"_type": "Name", "_fields": {"id": "Sub", "ctx": {"_type": "Store", "_fields": {}}}}]}}], "type_comment": null}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Name", "_fields": {"id": "Base", "ctx": {"_type": "Load", "_fields": {}}}}, {"_type": "Name", "_fields": {"id": "base", "ctx": {"_type": "Load", "_fields": {}}}}], "func": {"_type": "Name", "_fields": {"id": "mapper", "ctx": {"_type": "Load", "_fields": {}}}}, "keywords": [{"_type": "keyword", "_fields": {"arg": "version_id_col", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "version_id", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "c", "value": {"_type": "Name", "_fields": {"id": "base", "ctx": {"_type": "Load", "_fields": {}}}}}}}}}}]}}}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Name", "_fields": {"id": "Sub", "ctx": {"_type": "Load", "_fields": {}}}}, {"_type": "Name", "_fields": {"id": "sub", "ctx": {"_type": "Load", "_fields": {}}}}], "func": {"_type": "Name", "_fields": {"id": "mapper", "ctx": {"_type": "Load", "_fields": {}}}}, "keywords": [{"_type": "keyword", "_fields": {"arg": "inherits", "value": {"_type": "Name", "_fields": {"id": "Base", "ctx": {"_type": "Load", "_fields": {}}}}}}]}}}}, {"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"args": [], "func": {"_type": "Name", "_fields": {"id": "Session", "ctx": {"_type": "Load", "_fields": {}}}}, "keywords": []}}, "targets": [{"_type": "Name", "_fields": {"id": "s", "ctx": {"_type": "Store", "_fields": {}}}}], "type_comment": null}}, {"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"args": [], "func": {"_type": "Name", "_fields": {"id": "Sub", "ctx": {"_type": "Load", "_fields": {}}}}, "keywords": [{"_type": "keyword", "_fields": {"arg": "data", "value": {"_type": "Constant", "_fields": {"kind": null, "value": "b"}}}}, {"_type": "keyword", "_fields": {"arg": "sub_data", "value": {"_type": "Constant", "_fields": {"kind": null, "value": "s"}}}}]}}, "targets": [{"_type": "Name", "_fields": {"id": "s1", "ctx": {"_type": "Store", "_fields": {}}}}], "type_comment": null}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Name", "_fields": {"id": "s1", "ctx": {"_type": "Load", "_fields": {}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "add", "value": {"_type": "Name", "_fields": {"id": "s", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "commit", "value": {"_type": "Name", "_fields": {"id": "s", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Assign", "_fields": {"value": {"_type": "Constant", "_fields": {"kind": null, "value": "s2"}}, "targets": [{"_type": "Attribute", "_fields": {"ctx": {"_type": "Store", "_fields": {}}, "attr": "sub_data", "value": {"_type": "Name", "_fields": {"id": "s1", "ctx": {"_type": "Load", "_fields": {}}}}}}], "type_comment": null}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "commit", "value": {"_type": "Name", "_fields": {"id": "s", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "version_id", "value": {"_type": "Name", "_fields": {"id": "s1", "ctx": {"_type": "Load", "_fields": {}}}}}}, {"_type": "Constant", "_fields": {"kind": null, "value": 2}}], "func": {"_type": "Name", "_fields": {"id": "eq_", "ctx": {"_type": "Load", "_fields": {}}}}, "keywords": []}}}}], "name": "test_update_child_table_only", "returns": null, "type_params": [], "type_comment": null, "decorator_list": []}}], "type_ignores": []}}
def test_update_child_table_only(self): Base, sub, base, Sub = ( self.classes.Base, self.tables.sub, self.tables.base, self.classes.Sub) mapper(Base, base, version_id_col=base.c.version_id) mapper(Sub, sub, inherits=Base) s = Session() s1 = Sub(data='b', sub_data='s') s.add(s1) s.commit() s1.sub_data = 's2' s.commit() eq_(s1.version_id, 2)
14,110
[ 0.0017866621492430568, 0.026234863325953484, 0.10378971695899963, -0.04598940163850784, 0.006290879566222429, 0.01269934605807066, 0.03788899630308151, 0.013692298904061317, -0.00921094510704279, -0.0323493629693985, 0.009406923316419125, -0.0564415380358696, 0.020982664078474045, -0.00036...
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": []}}, "body": [{"_type": "Assign", "_fields": {"value": {"_type": "Tuple", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "elts": [{"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "Base", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "classes", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}}}, {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "sub", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "tables", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}}}, {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "base", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "tables", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}}}, {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "Sub", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "classes", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}}}]}}, "targets": [{"_type": "Tuple", "_fields": {"ctx": {"_type": "Store", "_fields": {}}, "elts": [{"_type": "Name", "_fields": {"id": "Base", "ctx": {"_type": "Store", "_fields": {}}}}, {"_type": "Name", "_fields": {"id": "sub", "ctx": {"_type": "Store", "_fields": {}}}}, {"_type": "Name", "_fields": {"id": "base", "ctx": {"_type": "Store", "_fields": {}}}}, {"_type": "Name", "_fields": {"id": "Sub", "ctx": {"_type": "Store", "_fields": {}}}}]}}], "type_comment": null}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Name", "_fields": {"id": "Base", "ctx": {"_type": "Load", "_fields": {}}}}, {"_type": "Name", "_fields": {"id": "base", "ctx": {"_type": "Load", "_fields": {}}}}], "func": {"_type": "Name", "_fields": {"id": "mapper", "ctx": {"_type": "Load", "_fields": {}}}}, "keywords": [{"_type": "keyword", "_fields": {"arg": "version_id_col", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "version_id", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "c", "value": {"_type": "Name", "_fields": {"id": "base", "ctx": {"_type": "Load", "_fields": {}}}}}}}}}}]}}}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Name", "_fields": {"id": "Sub", "ctx": {"_type": "Load", "_fields": {}}}}, {"_type": "Name", "_fields": {"id": "sub", "ctx": {"_type": "Load", "_fields": {}}}}], "func": {"_type": "Name", "_fields": {"id": "mapper", "ctx": {"_type": "Load", "_fields": {}}}}, "keywords": [{"_type": "keyword", "_fields": {"arg": "inherits", "value": {"_type": "Name", "_fields": {"id": "Base", "ctx": {"_type": "Load", "_fields": {}}}}}}]}}}}, {"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"args": [], "func": {"_type": "Name", "_fields": {"id": "Session", "ctx": {"_type": "Load", "_fields": {}}}}, "keywords": []}}, "targets": [{"_type": "Name", "_fields": {"id": "session", "ctx": {"_type": "Store", "_fields": {}}}}], "type_comment": null}}, {"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"args": [], "func": {"_type": "Name", "_fields": {"id": "Base", "ctx": {"_type": "Load", "_fields": {}}}}, "keywords": [{"_type": "keyword", "_fields": {"arg": "data", "value": {"_type": "Constant", "_fields": {"kind": null, "value": "b1"}}}}]}}, "targets": [{"_type": "Name", "_fields": {"id": "b1", "ctx": {"_type": "Store", "_fields": {}}}}], "type_comment": null}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Name", "_fields": {"id": "b1", "ctx": {"_type": "Load", "_fields": {}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "add", "value": {"_type": "Name", "_fields": {"id": "session", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "commit", "value": {"_type": "Name", "_fields": {"id": "session", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "version_id", "value": {"_type": "Name", "_fields": {"id": "b1", "ctx": {"_type": "Load", "_fields": {}}}}}}, {"_type": "Constant", "_fields": {"kind": null, "value": 1}}], "func": {"_type": "Name", "_fields": {"id": "eq_", "ctx": {"_type": "Load", "_fields": {}}}}, "keywords": []}}}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Call", "_fields": {"args": [], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "scalar", "value": {"_type": "Call", "_fields": {"args": [{"_type": "List", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "elts": [{"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "version_id", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "c", "value": {"_type": "Name", "_fields": {"id": "base", "ctx": {"_type": "Load", "_fields": {}}}}}}}}]}}], "func": {"_type": "Name", "_fields": {"id": "select", "ctx": {"_type": "Load", "_fields": {}}}}, "keywords": []}}}}, "keywords": []}}, {"_type": "Constant", "_fields": {"kind": null, "value": 1}}], "func": {"_type": "Name", "_fields": {"id": "eq_", "ctx": {"_type": "Load", "_fields": {}}}}, "keywords": []}}}}], "name": "test_base_both", "returns": null, "type_params": [], "type_comment": null, "decorator_list": []}}], "type_ignores": []}}
def test_base_both(self): Base, sub, base, Sub = ( self.classes.Base, self.tables.sub, self.tables.base, self.classes.Sub) mapper(Base, base, version_id_col=base.c.version_id) mapper(Sub, sub, inherits=Base) session = Session() b1 = Base(data='b1') session.add(b1) session.commit() eq_(b1.version_id, 1) # base is populated eq_(select([base.c.version_id]).scalar(), 1)
14,111
[ 0.0035928688012063503, 0.050088491290807724, 0.09616633504629135, -0.04384971037507057, 0.01712322235107422, 0.035449638962745667, 0.04387199133634567, -0.037789180874824524, -0.05534689128398895, -0.0004271754005458206, 0.00942501425743103, -0.030079832300543785, 0.03729899227619171, -0.0...
8
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "cls", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "metadata", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}}, "body": [{"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"kind": null, "value": "base"}}, {"_type": "Name", "_fields": {"id": "metadata", "ctx": {"_type": "Load", "_fields": {}}}}, {"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"kind": null, "value": "id"}}, {"_type": "Name", "_fields": {"id": "Integer", "ctx": {"_type": "Load", "_fields": {}}}}], "func": {"_type": "Name", "_fields": {"id": "Column", "ctx": {"_type": "Load", "_fields": {}}}}, "keywords": [{"_type": "keyword", "_fields": {"arg": "primary_key", "value": {"_type": "Constant", "_fields": {"kind": null, "value": true}}}}, {"_type": "keyword", "_fields": {"arg": "test_needs_autoincrement", "value": {"_type": "Constant", "_fields": {"kind": null, "value": true}}}}]}}, {"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"kind": null, "value": "version_id"}}, {"_type": "Name", "_fields": {"id": "Integer", "ctx": {"_type": "Load", "_fields": {}}}}], "func": {"_type": "Name", "_fields": {"id": "Column", "ctx": {"_type": "Load", "_fields": {}}}}, "keywords": [{"_type": "keyword", "_fields": {"arg": "nullable", "value": {"_type": "Constant", "_fields": {"kind": null, "value": true}}}}]}}, {"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"kind": null, "value": "data"}}, {"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"kind": null, "value": 50}}], "func": {"_type": "Name", "_fields": {"id": "String", "ctx": {"_type": "Load", "_fields": {}}}}, "keywords": []}}], "func": {"_type": "Name", "_fields": {"id": "Column", "ctx": {"_type": "Load", "_fields": {}}}}, "keywords": []}}], "func": {"_type": "Name", "_fields": {"id": "Table", "ctx": {"_type": "Load", "_fields": {}}}}, "keywords": []}}}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"kind": null, "value": "sub"}}, {"_type": "Name", "_fields": {"id": "metadata", "ctx": {"_type": "Load", "_fields": {}}}}, {"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"kind": null, "value": "id"}}, {"_type": "Name", "_fields": {"id": "Integer", "ctx": {"_type": "Load", "_fields": {}}}}, {"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"kind": null, "value": "base.id"}}], "func": {"_type": "Name", "_fields": {"id": "ForeignKey", "ctx": {"_type": "Load", "_fields": {}}}}, "keywords": []}}], "func": {"_type": "Name", "_fields": {"id": "Column", "ctx": {"_type": "Load", "_fields": {}}}}, "keywords": [{"_type": "keyword", "_fields": {"arg": "primary_key", "value": {"_type": "Constant", "_fields": {"kind": null, "value": true}}}}]}}, {"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"kind": null, "value": "version_id"}}, {"_type": "Name", "_fields": {"id": "Integer", "ctx": {"_type": "Load", "_fields": {}}}}], "func": {"_type": "Name", "_fields": {"id": "Column", "ctx": {"_type": "Load", "_fields": {}}}}, "keywords": [{"_type": "keyword", "_fields": {"arg": "nullable", "value": {"_type": "Constant", "_fields": {"kind": null, "value": false}}}}]}}, {"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"kind": null, "value": "sub_data"}}, {"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"kind": null, "value": 50}}], "func": {"_type": "Name", "_fields": {"id": "String", "ctx": {"_type": "Load", "_fields": {}}}}, "keywords": []}}], "func": {"_type": "Name", "_fields": {"id": "Column", "ctx": {"_type": "Load", "_fields": {}}}}, "keywords": []}}], "func": {"_type": "Name", "_fields": {"id": "Table", "ctx": {"_type": "Load", "_fields": {}}}}, "keywords": []}}}}], "name": "define_tables", "returns": null, "type_params": [], "type_comment": null, "decorator_list": []}}], "type_ignores": []}}
def define_tables(cls, metadata): Table( 'base', metadata, Column( 'id', Integer, primary_key=True, test_needs_autoincrement=True), Column('version_id', Integer, nullable=True), Column('data', String(50)) ) Table( 'sub', metadata, Column('id', Integer, ForeignKey('base.id'), primary_key=True), Column('version_id', Integer, nullable=False), Column('sub_data', String(50)) )
14,112
[ 0.008135034702718258, 0.02833973988890648, 0.08675642311573029, -0.04368935152888298, 0.014130976982414722, 0.02888423576951027, 0.03406991437077522, 0.01144090574234724, 0.00018828474276233464, -0.023944877088069916, 0.018240628764033318, -0.05387921258807182, 0.031684502959251404, 0.0247...
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": []}}, "body": [{"_type": "Assign", "_fields": {"value": {"_type": "Tuple", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "elts": [{"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "Base", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "classes", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}}}, {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "sub", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "tables", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}}}, {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "base", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "tables", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}}}, {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "Sub", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "classes", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}}}]}}, "targets": [{"_type": "Tuple", "_fields": {"ctx": {"_type": "Store", "_fields": {}}, "elts": [{"_type": "Name", "_fields": {"id": "Base", "ctx": {"_type": "Store", "_fields": {}}}}, {"_type": "Name", "_fields": {"id": "sub", "ctx": {"_type": "Store", "_fields": {}}}}, {"_type": "Name", "_fields": {"id": "base", "ctx": {"_type": "Store", "_fields": {}}}}, {"_type": "Name", "_fields": {"id": "Sub", "ctx": {"_type": "Store", "_fields": {}}}}]}}], "type_comment": null}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Name", "_fields": {"id": "Base", "ctx": {"_type": "Load", "_fields": {}}}}, {"_type": "Name", "_fields": {"id": "base", "ctx": {"_type": "Load", "_fields": {}}}}], "func": {"_type": "Name", "_fields": {"id": "mapper", "ctx": {"_type": "Load", "_fields": {}}}}, "keywords": []}}}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Name", "_fields": {"id": "Sub", "ctx": {"_type": "Load", "_fields": {}}}}, {"_type": "Name", "_fields": {"id": "sub", "ctx": {"_type": "Load", "_fields": {}}}}], "func": {"_type": "Name", "_fields": {"id": "mapper", "ctx": {"_type": "Load", "_fields": {}}}}, "keywords": [{"_type": "keyword", "_fields": {"arg": "inherits", "value": {"_type": "Name", "_fields": {"id": "Base", "ctx": {"_type": "Load", "_fields": {}}}}}}, {"_type": "keyword", "_fields": {"arg": "version_id_col", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "version_id", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "c", "value": {"_type": "Name", "_fields": {"id": "sub", "ctx": {"_type": "Load", "_fields": {}}}}}}}}}}]}}}}, {"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"args": [], "func": {"_type": "Name", "_fields": {"id": "Session", "ctx": {"_type": "Load", "_fields": {}}}}, "keywords": []}}, "targets": [{"_type": "Name", "_fields": {"id": "session", "ctx": {"_type": "Store", "_fields": {}}}}], "type_comment": null}}, {"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"args": [], "func": {"_type": "Name", "_fields": {"id": "Sub", "ctx": {"_type": "Load", "_fields": {}}}}, "keywords": [{"_type": "keyword", "_fields": {"arg": "data", "value": {"_type": "Constant", "_fields": {"kind": null, "value": "s1"}}}}, {"_type": "keyword", "_fields": {"arg": "sub_data", "value": {"_type": "Constant", "_fields": {"kind": null, "value": "s1"}}}}]}}, "targets": [{"_type": "Name", "_fields": {"id": "s1", "ctx": {"_type": "Store", "_fields": {}}}}], "type_comment": null}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Name", "_fields": {"id": "s1", "ctx": {"_type": "Load", "_fields": {}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "add", "value": {"_type": "Name", "_fields": {"id": "session", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "commit", "value": {"_type": "Name", "_fields": {"id": "session", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Call", "_fields": {"args": [], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "scalar", "value": {"_type": "Call", "_fields": {"args": [{"_type": "List", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "elts": [{"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "version_id", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "c", "value": {"_type": "Name", "_fields": {"id": "sub", "ctx": {"_type": "Load", "_fields": {}}}}}}}}]}}], "func": {"_type": "Name", "_fields": {"id": "select", "ctx": {"_type": "Load", "_fields": {}}}}, "keywords": []}}}}, "keywords": []}}, {"_type": "Constant", "_fields": {"kind": null, "value": 1}}], "func": {"_type": "Name", "_fields": {"id": "eq_", "ctx": {"_type": "Load", "_fields": {}}}}, "keywords": []}}}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Call", "_fields": {"args": [], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "scalar", "value": {"_type": "Call", "_fields": {"args": [{"_type": "List", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "elts": [{"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "version_id", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "c", "value": {"_type": "Name", "_fields": {"id": "base", "ctx": {"_type": "Load", "_fields": {}}}}}}}}]}}], "func": {"_type": "Name", "_fields": {"id": "select", "ctx": {"_type": "Load", "_fields": {}}}}, "keywords": []}}}}, "keywords": []}}, {"_type": "Constant", "_fields": {"kind": null, "value": null}}], "func": {"_type": "Name", "_fields": {"id": "eq_", "ctx": {"_type": "Load", "_fields": {}}}}, "keywords": []}}}}], "name": "test_sub_only", "returns": null, "type_params": [], "type_comment": null, "decorator_list": []}}], "type_ignores": []}}
def test_sub_only(self): Base, sub, base, Sub = ( self.classes.Base, self.tables.sub, self.tables.base, self.classes.Sub) mapper(Base, base) mapper(Sub, sub, inherits=Base, version_id_col=sub.c.version_id) session = Session() s1 = Sub(data='s1', sub_data='s1') session.add(s1) session.commit() # table is populated eq_(select([sub.c.version_id]).scalar(), 1) # base is not eq_(select([base.c.version_id]).scalar(), None)
14,113
[ -0.002771718893200159, 0.025960132479667664, 0.09811663627624512, -0.04710813984274864, 0.010181437246501446, 0.017336303368210793, 0.04612039029598236, 0.017197003588080406, -0.0007245884044095874, -0.024351870641112328, 0.020806096494197845, -0.05343988165259361, 0.020476846024394035, 0....
12
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}}, "body": [{"_type": "Assign", "_fields": {"value": {"_type": "Tuple", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "elts": [{"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "Base", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "classes", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}}}, {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "sub", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "tables", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}}}, {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "base", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "tables", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}}}, {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "Sub", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "classes", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}}}]}}, "targets": [{"_type": "Tuple", "_fields": {"ctx": {"_type": "Store", "_fields": {}}, "elts": [{"_type": "Name", "_fields": {"id": "Base", "ctx": {"_type": "Store", "_fields": {}}}}, {"_type": "Name", "_fields": {"id": "sub", "ctx": {"_type": "Store", "_fields": {}}}}, {"_type": "Name", "_fields": {"id": "base", "ctx": {"_type": "Store", "_fields": {}}}}, {"_type": "Name", "_fields": {"id": "Sub", "ctx": {"_type": "Store", "_fields": {}}}}]}}], "type_comment": null}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Name", "_fields": {"id": "Base", "ctx": {"_type": "Load", "_fields": {}}}}, {"_type": "Name", "_fields": {"id": "base", "ctx": {"_type": "Load", "_fields": {}}}}], "func": {"_type": "Name", "_fields": {"id": "mapper", "ctx": {"_type": "Load", "_fields": {}}}}, "keywords": [{"_type": "keyword", "_fields": {"arg": "version_id_col", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "version_id", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "c", "value": {"_type": "Name", "_fields": {"id": "base", "ctx": {"_type": "Load", "_fields": {}}}}}}}}}}]}}}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Name", "_fields": {"id": "Sub", "ctx": {"_type": "Load", "_fields": {}}}}, {"_type": "Name", "_fields": {"id": "sub", "ctx": {"_type": "Load", "_fields": {}}}}], "func": {"_type": "Name", "_fields": {"id": "mapper", "ctx": {"_type": "Load", "_fields": {}}}}, "keywords": [{"_type": "keyword", "_fields": {"arg": "inherits", "value": {"_type": "Name", "_fields": {"id": "Base", "ctx": {"_type": "Load", "_fields": {}}}}}}]}}}}, {"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"args": [], "func": {"_type": "Name", "_fields": {"id": "Session", "ctx": {"_type": "Load", "_fields": {}}}}, "keywords": []}}, "targets": [{"_type": "Name", "_fields": {"id": "session", "ctx": {"_type": "Store", "_fields": {}}}}], "type_comment": null}}, {"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"args": [], "func": {"_type": "Name", "_fields": {"id": "Sub", "ctx": {"_type": "Load", "_fields": {}}}}, "keywords": [{"_type": "keyword", "_fields": {"arg": "data", "value": {"_type": "Constant", "_fields": {"kind": null, "value": "s1"}}}}, {"_type": "keyword", "_fields": {"arg": "sub_data", "value": {"_type": "Constant", "_fields": {"kind": null, "value": "s1"}}}}]}}, "targets": [{"_type": "Name", "_fields": {"id": "s1", "ctx": {"_type": "Store", "_fields": {}}}}], "type_comment": null}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Name", "_fields": {"id": "s1", "ctx": {"_type": "Load", "_fields": {}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "add", "value": {"_type": "Name", "_fields": {"id": "session", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "commit", "value": {"_type": "Name", "_fields": {"id": "session", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Call", "_fields": {"args": [], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "scalar", "value": {"_type": "Call", "_fields": {"args": [{"_type": "List", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "elts": [{"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "version_id", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "c", "value": {"_type": "Name", "_fields": {"id": "sub", "ctx": {"_type": "Load", "_fields": {}}}}}}}}]}}], "func": {"_type": "Name", "_fields": {"id": "select", "ctx": {"_type": "Load", "_fields": {}}}}, "keywords": []}}}}, "keywords": []}}, {"_type": "Constant", "_fields": {"kind": null, "value": 1}}], "func": {"_type": "Name", "_fields": {"id": "eq_", "ctx": {"_type": "Load", "_fields": {}}}}, "keywords": []}}}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Call", "_fields": {"args": [], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "scalar", "value": {"_type": "Call", "_fields": {"args": [{"_type": "List", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "elts": [{"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "version_id", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "c", "value": {"_type": "Name", "_fields": {"id": "base", "ctx": {"_type": "Load", "_fields": {}}}}}}}}]}}], "func": {"_type": "Name", "_fields": {"id": "select", "ctx": {"_type": "Load", "_fields": {}}}}, "keywords": []}}}}, "keywords": []}}, {"_type": "Constant", "_fields": {"kind": null, "value": 1}}], "func": {"_type": "Name", "_fields": {"id": "eq_", "ctx": {"_type": "Load", "_fields": {}}}}, "keywords": []}}}}], "name": "test_sub_both", "returns": null, "type_params": [], "type_comment": null, "decorator_list": []}}], "type_ignores": []}}
def test_sub_both(self): Base, sub, base, Sub = ( self.classes.Base, self.tables.sub, self.tables.base, self.classes.Sub) mapper(Base, base, version_id_col=base.c.version_id) mapper(Sub, sub, inherits=Base) session = Session() s1 = Sub(data='s1', sub_data='s1') session.add(s1) session.commit() # table is populated eq_(select([sub.c.version_id]).scalar(), 1) # base is populated eq_(select([base.c.version_id]).scalar(), 1)
14,114
[ 0.04635795205831528, -0.01939326710999012, 0.04184683784842491, -0.05685366690158844, 0.02060605399310589, -0.004785976838320494, 0.02545720338821411, -0.021184111014008522, -0.012751271016895771, -0.03502349182963371, 0.05005298927426338, -0.02280494011938572, 0.01054105069488287, 0.01591...
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": []}}, "body": [{"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"args": [], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "_fixture", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}, "targets": [{"_type": "Name", "_fields": {"id": "sess", "ctx": {"_type": "Store", "_fields": {}}}}], "type_comment": null}}, {"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"args": [], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "Foo", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "classes", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}}}, "keywords": [{"_type": "keyword", "_fields": {"arg": "value", "value": {"_type": "Constant", "_fields": {"kind": null, "value": "f1"}}}}]}}, "targets": [{"_type": "Name", "_fields": {"id": "f1", "ctx": {"_type": "Store", "_fields": {}}}}], "type_comment": null}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Name", "_fields": {"id": "f1", "ctx": {"_type": "Load", "_fields": {}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "add", "value": {"_type": "Name", "_fields": {"id": "sess", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Assign", "_fields": {"value": {"_type": "List", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "elts": [{"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"kind": null, "value": "INSERT INTO version_table (version_id, value) VALUES (1, :value)"}}, {"_type": "Lambda", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "ctx", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}}, "body": {"_type": "List", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "elts": [{"_type": "Dict", "_fields": {"keys": [{"_type": "Constant", "_fields": {"kind": null, "value": "value"}}], "values": [{"_type": "Constant", "_fields": {"kind": null, "value": "f1"}}]}}]}}}}], "func": {"_type": "Name", "_fields": {"id": "CompiledSQL", "ctx": {"_type": "Load", "_fields": {}}}}, "keywords": []}}]}}, "targets": [{"_type": "Name", "_fields": {"id": "statements", "ctx": {"_type": "Store", "_fields": {}}}}], "type_comment": null}}, {"_type": "If", "_fields": {"body": [{"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"kind": null, "value": "SELECT version_table.version_id AS version_table_version_id FROM version_table WHERE version_table.id = :param_1"}}, {"_type": "Lambda", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "ctx", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}}, "body": {"_type": "List", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "elts": [{"_type": "Dict", "_fields": {"keys": [{"_type": "Constant", "_fields": {"kind": null, "value": "param_1"}}], "values": [{"_type": "Constant", "_fields": {"kind": null, "value": 1}}]}}]}}}}], "func": {"_type": "Name", "_fields": {"id": "CompiledSQL", "ctx": {"_type": "Load", "_fields": {}}}}, "keywords": []}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "append", "value": {"_type": "Name", "_fields": {"id": "statements", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}], "test": {"_type": "UnaryOp", "_fields": {"op": {"_type": "Not", "_fields": {}}, "operand": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "implicit_returning", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "dialect", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "db", "value": {"_type": "Name", "_fields": {"id": "testing", "ctx": {"_type": "Load", "_fields": {}}}}}}}}}}}}, "orelse": []}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "db", "value": {"_type": "Name", "_fields": {"id": "testing", "ctx": {"_type": "Load", "_fields": {}}}}}}, {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "flush", "value": {"_type": "Name", "_fields": {"id": "sess", "ctx": {"_type": "Load", "_fields": {}}}}}}, {"_type": "Starred", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "value": {"_type": "Name", "_fields": {"id": "statements", "ctx": {"_type": "Load", "_fields": {}}}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "assert_sql_execution", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}], "name": "test_insert_col", "returns": null, "type_params": [], "type_comment": null, "decorator_list": []}}], "type_ignores": []}}
def test_insert_col(self): sess = self._fixture() f1 = self.classes.Foo(value='f1') sess.add(f1) statements = [ # note that the assertsql tests the rule against # "default" - on a "returning" backend, the statement # includes "RETURNING" CompiledSQL( "INSERT INTO version_table (version_id, value) " "VALUES (1, :value)", lambda ctx: [{'value': 'f1'}] ) ] if not testing.db.dialect.implicit_returning: # DBs without implicit returning, we must immediately # SELECT for the new version id statements.append( CompiledSQL( "SELECT version_table.version_id " "AS version_table_version_id " "FROM version_table WHERE version_table.id = :param_1", lambda ctx: [{"param_1": 1}] ) ) self.assert_sql_execution(testing.db, sess.flush, *statements)
14,115
[ 0.02796260640025139, -0.03811128810048103, 0.0424811914563179, -0.049382295459508896, 0.0045101940631866455, 0.01948547177016735, 0.04147826507687569, -0.019963055849075317, 0.001970038516446948, 0.009509912692010403, 0.04458256810903549, -0.03273845836520195, -0.03737103193998337, 0.02815...
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": []}}, "body": [{"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"args": [], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "_fixture", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}, "targets": [{"_type": "Name", "_fields": {"id": "sess", "ctx": {"_type": "Store", "_fields": {}}}}], "type_comment": null}}, {"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"args": [], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "Foo", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "classes", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}}}, "keywords": [{"_type": "keyword", "_fields": {"arg": "value", "value": {"_type": "Constant", "_fields": {"kind": null, "value": "f1"}}}}]}}, "targets": [{"_type": "Name", "_fields": {"id": "f1", "ctx": {"_type": "Store", "_fields": {}}}}], "type_comment": null}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Name", "_fields": {"id": "f1", "ctx": {"_type": "Load", "_fields": {}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "add", "value": {"_type": "Name", "_fields": {"id": "sess", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "flush", "value": {"_type": "Name", "_fields": {"id": "sess", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Assign", "_fields": {"value": {"_type": "Constant", "_fields": {"kind": null, "value": "f2"}}, "targets": [{"_type": "Attribute", "_fields": {"ctx": {"_type": "Store", "_fields": {}}, "attr": "value", "value": {"_type": "Name", "_fields": {"id": "f1", "ctx": {"_type": "Load", "_fields": {}}}}}}], "type_comment": null}}, {"_type": "Assign", "_fields": {"value": {"_type": "List", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "elts": [{"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"kind": null, "value": "UPDATE version_table SET version_id=2, value=:value WHERE version_table.id = :version_table_id AND version_table.version_id = :version_table_version_id"}}, {"_type": "Lambda", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "ctx", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}}, "body": {"_type": "List", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "elts": [{"_type": "Dict", "_fields": {"keys": [{"_type": "Constant", "_fields": {"kind": null, "value": "version_table_id"}}, {"_type": "Constant", "_fields": {"kind": null, "value": "version_table_version_id"}}, {"_type": "Constant", "_fields": {"kind": null, "value": "value"}}], "values": [{"_type": "Constant", "_fields": {"kind": null, "value": 1}}, {"_type": "Constant", "_fields": {"kind": null, "value": 1}}, {"_type": "Constant", "_fields": {"kind": null, "value": "f2"}}]}}]}}}}], "func": {"_type": "Name", "_fields": {"id": "CompiledSQL", "ctx": {"_type": "Load", "_fields": {}}}}, "keywords": []}}]}}, "targets": [{"_type": "Name", "_fields": {"id": "statements", "ctx": {"_type": "Store", "_fields": {}}}}], "type_comment": null}}, {"_type": "If", "_fields": {"body": [{"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"kind": null, "value": "SELECT version_table.version_id AS version_table_version_id FROM version_table WHERE version_table.id = :param_1"}}, {"_type": "Lambda", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "ctx", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}}, "body": {"_type": "List", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "elts": [{"_type": "Dict", "_fields": {"keys": [{"_type": "Constant", "_fields": {"kind": null, "value": "param_1"}}], "values": [{"_type": "Constant", "_fields": {"kind": null, "value": 1}}]}}]}}}}], "func": {"_type": "Name", "_fields": {"id": "CompiledSQL", "ctx": {"_type": "Load", "_fields": {}}}}, "keywords": []}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "append", "value": {"_type": "Name", "_fields": {"id": "statements", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}], "test": {"_type": "UnaryOp", "_fields": {"op": {"_type": "Not", "_fields": {}}, "operand": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "implicit_returning", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "dialect", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "db", "value": {"_type": "Name", "_fields": {"id": "testing", "ctx": {"_type": "Load", "_fields": {}}}}}}}}}}}}, "orelse": []}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "db", "value": {"_type": "Name", "_fields": {"id": "testing", "ctx": {"_type": "Load", "_fields": {}}}}}}, {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "flush", "value": {"_type": "Name", "_fields": {"id": "sess", "ctx": {"_type": "Load", "_fields": {}}}}}}, {"_type": "Starred", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "value": {"_type": "Name", "_fields": {"id": "statements", "ctx": {"_type": "Load", "_fields": {}}}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "assert_sql_execution", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}], "name": "test_update_col", "returns": null, "type_params": [], "type_comment": null, "decorator_list": []}}], "type_ignores": []}}
def test_update_col(self): sess = self._fixture() f1 = self.classes.Foo(value='f1') sess.add(f1) sess.flush() f1.value = 'f2' statements = [ # note that the assertsql tests the rule against # "default" - on a "returning" backend, the statement # includes "RETURNING" CompiledSQL( "UPDATE version_table SET version_id=2, value=:value " "WHERE version_table.id = :version_table_id AND " "version_table.version_id = :version_table_version_id", lambda ctx: [ { "version_table_id": 1, "version_table_version_id": 1, "value": "f2"}] ) ] if not testing.db.dialect.implicit_returning: # DBs without implicit returning, we must immediately # SELECT for the new version id statements.append( CompiledSQL( "SELECT version_table.version_id " "AS version_table_version_id " "FROM version_table WHERE version_table.id = :param_1", lambda ctx: [{"param_1": 1}] ) ) self.assert_sql_execution(testing.db, sess.flush, *statements)
14,116
[ 0.041695185005664825, -0.0012571453116834164, 0.04571552202105522, -0.039571236819028854, -0.012377073056995869, 0.0568915531039238, 0.04485582932829857, 0.021934853866696358, 0.044552408158779144, -0.02852163091301918, 0.044527120888233185, -0.007497042417526245, -0.030822578817605972, -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": []}}, "body": [{"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"args": [], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "_fixture", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}, "targets": [{"_type": "Name", "_fields": {"id": "sess", "ctx": {"_type": "Store", "_fields": {}}}}], "type_comment": null}}, {"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"args": [], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "Foo", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "classes", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}}}, "keywords": [{"_type": "keyword", "_fields": {"arg": "value", "value": {"_type": "Constant", "_fields": {"kind": null, "value": "f1"}}}}]}}, "targets": [{"_type": "Name", "_fields": {"id": "f1", "ctx": {"_type": "Store", "_fields": {}}}}], "type_comment": null}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Name", "_fields": {"id": "f1", "ctx": {"_type": "Load", "_fields": {}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "add", "value": {"_type": "Name", "_fields": {"id": "sess", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "commit", "value": {"_type": "Name", "_fields": {"id": "sess", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Expr", "_fields": {"value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "value", "value": {"_type": "Name", "_fields": {"id": "f1", "ctx": {"_type": "Load", "_fields": {}}}}}}}}, {"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"args": [], "func": {"_type": "Name", "_fields": {"id": "Session", "ctx": {"_type": "Load", "_fields": {}}}}, "keywords": []}}, "targets": [{"_type": "Name", "_fields": {"id": "s2", "ctx": {"_type": "Store", "_fields": {}}}}], "type_comment": null}}, {"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"args": [], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "first", "value": {"_type": "Call", "_fields": {"args": [{"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "Foo", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "classes", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "query", "value": {"_type": "Name", "_fields": {"id": "s2", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, "keywords": []}}, "targets": [{"_type": "Name", "_fields": {"id": "f2", "ctx": {"_type": "Store", "_fields": {}}}}], "type_comment": null}}, {"_type": "Assign", "_fields": {"value": {"_type": "Constant", "_fields": {"kind": null, "value": "f2"}}, "targets": [{"_type": "Attribute", "_fields": {"ctx": {"_type": "Store", "_fields": {}}, "attr": "value", "value": {"_type": "Name", "_fields": {"id": "f2", "ctx": {"_type": "Load", "_fields": {}}}}}}], "type_comment": null}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "commit", "value": {"_type": "Name", "_fields": {"id": "s2", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Assign", "_fields": {"value": {"_type": "Constant", "_fields": {"kind": null, "value": "f3"}}, "targets": [{"_type": "Attribute", "_fields": {"ctx": {"_type": "Store", "_fields": {}}, "attr": "value", "value": {"_type": "Name", "_fields": {"id": "f1", "ctx": {"_type": "Load", "_fields": {}}}}}}], "type_comment": null}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "StaleDataError", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "exc", "value": {"_type": "Name", "_fields": {"id": "orm", "ctx": {"_type": "Load", "_fields": {}}}}}}}}, {"_type": "Constant", "_fields": {"kind": null, "value": "UPDATE statement on table 'version_table' expected to update 1 row\\(s\\); 0 were matched."}}, {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "commit", "value": {"_type": "Name", "_fields": {"id": "sess", "ctx": {"_type": "Load", "_fields": {}}}}}}], "func": {"_type": "Name", "_fields": {"id": "assert_raises_message", "ctx": {"_type": "Load", "_fields": {}}}}, "keywords": []}}}}], "name": "test_concurrent_mod_err_expire_on_commit", "returns": null, "type_params": [], "type_comment": null, "decorator_list": []}}], "type_ignores": []}}
def test_concurrent_mod_err_expire_on_commit(self): sess = self._fixture() f1 = self.classes.Foo(value='f1') sess.add(f1) sess.commit() f1.value s2 = Session() f2 = s2.query(self.classes.Foo).first() f2.value = 'f2' s2.commit() f1.value = 'f3' assert_raises_message( orm.exc.StaleDataError, r"UPDATE statement on table 'version_table' expected to " r"update 1 row\(s\); 0 were matched.", sess.commit )
14,117
[ 0.053926486521959305, 0.004167893435806036, 0.05155148729681969, -0.06854903697967529, 0.0014894688501954079, 0.02301655150949955, 0.0011402040254324675, 0.005559131503105164, 0.026287999004125595, -0.012585175223648548, 0.07157599925994873, -0.05201717093586922, -0.009639708325266838, 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": []}}, "body": [{"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"args": [], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "_fixture", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}, "targets": [{"_type": "Name", "_fields": {"id": "sess", "ctx": {"_type": "Store", "_fields": {}}}}], "type_comment": null}}, {"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"args": [], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "Foo", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "classes", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}}}, "keywords": [{"_type": "keyword", "_fields": {"arg": "value", "value": {"_type": "Constant", "_fields": {"kind": null, "value": "f1"}}}}]}}, "targets": [{"_type": "Name", "_fields": {"id": "f1", "ctx": {"_type": "Store", "_fields": {}}}}], "type_comment": null}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Name", "_fields": {"id": "f1", "ctx": {"_type": "Load", "_fields": {}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "add", "value": {"_type": "Name", "_fields": {"id": "sess", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "flush", "value": {"_type": "Name", "_fields": {"id": "sess", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Name", "_fields": {"id": "f1", "ctx": {"_type": "Load", "_fields": {}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "delete", "value": {"_type": "Name", "_fields": {"id": "sess", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Assign", "_fields": {"value": {"_type": "List", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "elts": [{"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"kind": null, "value": "DELETE FROM version_table WHERE version_table.id = :id AND version_table.version_id = :version_id"}}, {"_type": "Lambda", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "ctx", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}}, "body": {"_type": "List", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "elts": [{"_type": "Dict", "_fields": {"keys": [{"_type": "Constant", "_fields": {"kind": null, "value": "id"}}, {"_type": "Constant", "_fields": {"kind": null, "value": "version_id"}}], "values": [{"_type": "Constant", "_fields": {"kind": null, "value": 1}}, {"_type": "Constant", "_fields": {"kind": null, "value": 1}}]}}]}}}}], "func": {"_type": "Name", "_fields": {"id": "CompiledSQL", "ctx": {"_type": "Load", "_fields": {}}}}, "keywords": []}}]}}, "targets": [{"_type": "Name", "_fields": {"id": "statements", "ctx": {"_type": "Store", "_fields": {}}}}], "type_comment": null}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "db", "value": {"_type": "Name", "_fields": {"id": "testing", "ctx": {"_type": "Load", "_fields": {}}}}}}, {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "flush", "value": {"_type": "Name", "_fields": {"id": "sess", "ctx": {"_type": "Load", "_fields": {}}}}}}, {"_type": "Starred", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "value": {"_type": "Name", "_fields": {"id": "statements", "ctx": {"_type": "Load", "_fields": {}}}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "assert_sql_execution", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}], "name": "test_delete_col", "returns": null, "type_params": [], "type_comment": null, "decorator_list": []}}], "type_ignores": []}}
def test_delete_col(self): sess = self._fixture() f1 = self.classes.Foo(value='f1') sess.add(f1) sess.flush() sess.delete(f1) statements = [ # note that the assertsql tests the rule against # "default" - on a "returning" backend, the statement # includes "RETURNING" CompiledSQL( "DELETE FROM version_table " "WHERE version_table.id = :id AND " "version_table.version_id = :version_id", lambda ctx: [{"id": 1, "version_id": 1}] ) ] self.assert_sql_execution(testing.db, sess.flush, *statements)
14,118
[ 0.02797921933233738, -0.03401888906955719, -0.0031971349380910397, 0.005390517879277468, -0.01797029934823513, 0.015911322087049484, 0.014675935730338097, -0.054951827973127365, -0.015796935185790062, -0.018233392387628555, 0.015305067412555218, -0.03795382380485535, 0.02797921933233738, 0...
8
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "element", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "compiler", "annotation": null, "type_comment": null}}], "kwarg": {"_type": "arg", "_fields": {"arg": "kw", "annotation": null, "type_comment": null}}, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}}, "body": [{"_type": "Assign", "_fields": {"value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "statement", "value": {"_type": "Name", "_fields": {"id": "compiler", "ctx": {"_type": "Load", "_fields": {}}}}}}, "targets": [{"_type": "Name", "_fields": {"id": "stmt", "ctx": {"_type": "Store", "_fields": {}}}}], "type_comment": null}}, {"_type": "If", "_fields": {"body": [{"_type": "Return", "_fields": {"value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "_counter", "value": {"_type": "Name", "_fields": {"id": "stmt", "ctx": {"_type": "Load", "_fields": {}}}}}}}}], "test": {"_type": "Call", "_fields": {"args": [{"_type": "Name", "_fields": {"id": "stmt", "ctx": {"_type": "Load", "_fields": {}}}}, {"_type": "Constant", "_fields": {"kind": null, "value": "_counter"}}], "func": {"_type": "Name", "_fields": {"id": "hasattr", "ctx": {"_type": "Load", "_fields": {}}}}, "keywords": []}}, "orelse": [{"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Call", "_fields": {"args": [{"_type": "Name", "_fields": {"id": "counter", "ctx": {"_type": "Load", "_fields": {}}}}], "func": {"_type": "Name", "_fields": {"id": "next", "ctx": {"_type": "Load", "_fields": {}}}}, "keywords": []}}], "func": {"_type": "Name", "_fields": {"id": "str", "ctx": {"_type": "Load", "_fields": {}}}}, "keywords": []}}, "targets": [{"_type": "Attribute", "_fields": {"ctx": {"_type": "Store", "_fields": {}}, "attr": "_counter", "value": {"_type": "Name", "_fields": {"id": "stmt", "ctx": {"_type": "Load", "_fields": {}}}}}}], "type_comment": null}}, {"_type": "Return", "_fields": {"value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "_counter", "value": {"_type": "Name", "_fields": {"id": "stmt", "ctx": {"_type": "Load", "_fields": {}}}}}}}}]}}], "name": "compile", "returns": null, "type_params": [], "type_comment": null, "decorator_list": []}}], "type_ignores": []}}
def compile(element, compiler, **kw): # cache the counter value on the statement # itself so the assertsql system gets the same # value when it compiles the statement a second time stmt = compiler.statement if hasattr(stmt, "_counter"): return stmt._counter else: stmt._counter = str(next(counter)) return stmt._counter
14,119
[ 0.04081365093588829, 0.003741462482139468, 0.012473655864596367, -0.05443510785698891, 0.006300242617726326, 0.055551208555698395, 0.03614633157849312, 0.01883414201438427, 0.04502438008785248, -0.01738828793168068, 0.047941453754901886, 0.016031214967370033, -0.017781458795070648, 0.00854...
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": []}}, "body": [{"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"args": [], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "_fixture", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": [{"_type": "keyword", "_fields": {"arg": "expire_on_commit", "value": {"_type": "Constant", "_fields": {"kind": null, "value": false}}}}]}}, "targets": [{"_type": "Name", "_fields": {"id": "sess", "ctx": {"_type": "Store", "_fields": {}}}}], "type_comment": null}}, {"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"args": [], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "Foo", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "classes", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}}}, "keywords": [{"_type": "keyword", "_fields": {"arg": "value", "value": {"_type": "Constant", "_fields": {"kind": null, "value": "f1"}}}}]}}, "targets": [{"_type": "Name", "_fields": {"id": "f1", "ctx": {"_type": "Store", "_fields": {}}}}], "type_comment": null}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Name", "_fields": {"id": "f1", "ctx": {"_type": "Load", "_fields": {}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "add", "value": {"_type": "Name", "_fields": {"id": "sess", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "commit", "value": {"_type": "Name", "_fields": {"id": "sess", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Expr", "_fields": {"value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "value", "value": {"_type": "Name", "_fields": {"id": "f1", "ctx": {"_type": "Load", "_fields": {}}}}}}}}, {"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"args": [], "func": {"_type": "Name", "_fields": {"id": "Session", "ctx": {"_type": "Load", "_fields": {}}}}, "keywords": [{"_type": "keyword", "_fields": {"arg": "expire_on_commit", "value": {"_type": "Constant", "_fields": {"kind": null, "value": false}}}}]}}, "targets": [{"_type": "Name", "_fields": {"id": "s2", "ctx": {"_type": "Store", "_fields": {}}}}], "type_comment": null}}, {"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"args": [], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "first", "value": {"_type": "Call", "_fields": {"args": [{"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "Foo", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "classes", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "query", "value": {"_type": "Name", "_fields": {"id": "s2", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, "keywords": []}}, "targets": [{"_type": "Name", "_fields": {"id": "f2", "ctx": {"_type": "Store", "_fields": {}}}}], "type_comment": null}}, {"_type": "Assign", "_fields": {"value": {"_type": "Constant", "_fields": {"kind": null, "value": "f2"}}, "targets": [{"_type": "Attribute", "_fields": {"ctx": {"_type": "Store", "_fields": {}}, "attr": "value", "value": {"_type": "Name", "_fields": {"id": "f2", "ctx": {"_type": "Load", "_fields": {}}}}}}], "type_comment": null}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "commit", "value": {"_type": "Name", "_fields": {"id": "s2", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Assign", "_fields": {"value": {"_type": "Constant", "_fields": {"kind": null, "value": "f3"}}, "targets": [{"_type": "Attribute", "_fields": {"ctx": {"_type": "Store", "_fields": {}}, "attr": "value", "value": {"_type": "Name", "_fields": {"id": "f1", "ctx": {"_type": "Load", "_fields": {}}}}}}], "type_comment": null}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "StaleDataError", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "exc", "value": {"_type": "Name", "_fields": {"id": "orm", "ctx": {"_type": "Load", "_fields": {}}}}}}}}, {"_type": "Constant", "_fields": {"kind": null, "value": "UPDATE statement on table 'version_table' expected to update 1 row\\(s\\); 0 were matched."}}, {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "commit", "value": {"_type": "Name", "_fields": {"id": "sess", "ctx": {"_type": "Load", "_fields": {}}}}}}], "func": {"_type": "Name", "_fields": {"id": "assert_raises_message", "ctx": {"_type": "Load", "_fields": {}}}}, "keywords": []}}}}], "name": "test_concurrent_mod_err_noexpire_on_commit", "returns": null, "type_params": [], "type_comment": null, "decorator_list": []}}], "type_ignores": []}}
def test_concurrent_mod_err_noexpire_on_commit(self): sess = self._fixture(expire_on_commit=False) f1 = self.classes.Foo(value='f1') sess.add(f1) sess.commit() # here, we're not expired overall, so no load occurs and we # stay without a version id, unless we've emitted # a SELECT for it within the flush. f1.value s2 = Session(expire_on_commit=False) f2 = s2.query(self.classes.Foo).first() f2.value = 'f2' s2.commit() f1.value = 'f3' assert_raises_message( orm.exc.StaleDataError, r"UPDATE statement on table 'version_table' expected to " r"update 1 row\(s\); 0 were matched.", sess.commit )
14,120
[ 0.006848876364529133, 0.0420788899064064, 0.06323205679655075, -0.11028965562582016, 0.019080817699432373, 0.03927363082766533, 0.026738416403532028, -0.03118639625608921, -0.03022603690624237, 0.003604505443945527, 0.019687360152602196, -0.02313707023859024, 0.002751555060967803, 0.027142...
13
{"_type": "Module", "_fields": {"body": [{"_type": "ClassDef", "_fields": {"body": [{"_type": "Assign", "_fields": {"value": {"_type": "Constant", "_fields": {"kind": null, "value": "each"}}, "targets": [{"_type": "Name", "_fields": {"id": "run_define_tables", "ctx": {"_type": "Store", "_fields": {}}}}], "type_comment": null}}, {"_type": "Assign", "_fields": {"value": {"_type": "Constant", "_fields": {"kind": null, "value": true}}, "targets": [{"_type": "Name", "_fields": {"id": "__backend__", "ctx": {"_type": "Store", "_fields": {}}}}], "type_comment": null}}, {"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "cls", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "metadata", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}}, "body": [{"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"kind": null, "value": "a"}}, {"_type": "Name", "_fields": {"id": "metadata", "ctx": {"_type": "Load", "_fields": {}}}}, {"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"kind": null, "value": "id"}}, {"_type": "Name", "_fields": {"id": "Integer", "ctx": {"_type": "Load", "_fields": {}}}}], "func": {"_type": "Name", "_fields": {"id": "Column", "ctx": {"_type": "Load", "_fields": {}}}}, "keywords": [{"_type": "keyword", "_fields": {"arg": "primary_key", "value": {"_type": "Constant", "_fields": {"kind": null, "value": true}}}}, {"_type": "keyword", "_fields": {"arg": "test_needs_autoincrement", "value": {"_type": "Constant", "_fields": {"kind": null, "value": true}}}}]}}, {"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"kind": null, "value": "data"}}, {"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"kind": null, "value": 30}}], "func": {"_type": "Name", "_fields": {"id": "String", "ctx": {"_type": "Load", "_fields": {}}}}, "keywords": []}}], "func": {"_type": "Name", "_fields": {"id": "Column", "ctx": {"_type": "Load", "_fields": {}}}}, "keywords": []}}, {"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"kind": null, "value": "vid"}}, {"_type": "Name", "_fields": {"id": "Integer", "ctx": {"_type": "Load", "_fields": {}}}}], "func": {"_type": "Name", "_fields": {"id": "Column", "ctx": {"_type": "Load", "_fields": {}}}}, "keywords": []}}], "func": {"_type": "Name", "_fields": {"id": "Table", "ctx": {"_type": "Load", "_fields": {}}}}, "keywords": []}}}}], "name": "define_tables", "returns": null, "type_params": [], "type_comment": null, "decorator_list": [{"_type": "Name", "_fields": {"id": "classmethod", "ctx": {"_type": "Load", "_fields": {}}}}]}}, {"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "cls", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}}, "body": [{"_type": "ClassDef", "_fields": {"body": [{"_type": "Pass", "_fields": {}}], "name": "A", "bases": [{"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "Basic", "value": {"_type": "Name", "_fields": {"id": "cls", "ctx": {"_type": "Load", "_fields": {}}}}}}], "keywords": [], "type_params": [], "decorator_list": []}}], "name": "setup_classes", "returns": null, "type_params": [], "type_comment": null, "decorator_list": [{"_type": "Name", "_fields": {"id": "classmethod", "ctx": {"_type": "Load", "_fields": {}}}}]}}, {"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "cls", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}}, "body": [{"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "A", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "classes", "value": {"_type": "Name", "_fields": {"id": "cls", "ctx": {"_type": "Load", "_fields": {}}}}}}}}, {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "a", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "tables", "value": {"_type": "Name", "_fields": {"id": "cls", "ctx": {"_type": "Load", "_fields": {}}}}}}}}], "func": {"_type": "Name", "_fields": {"id": "mapper", "ctx": {"_type": "Load", "_fields": {}}}}, "keywords": [{"_type": "keyword", "_fields": {"arg": "version_id_col", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "vid", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "c", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "a", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "tables", "value": {"_type": "Name", "_fields": {"id": "cls", "ctx": {"_type": "Load", "_fields": {}}}}}}}}}}}}}}, {"_type": "keyword", "_fields": {"arg": "version_id_generator", "value": {"_type": "Constant", "_fields": {"kind": null, "value": false}}}}]}}}}], "name": "setup_mappers", "returns": null, "type_params": [], "type_comment": null, "decorator_list": [{"_type": "Name", "_fields": {"id": "classmethod", "ctx": {"_type": "Load", "_fields": {}}}}]}}, {"_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": []}}, "body": [{"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"args": [], "func": {"_type": "Name", "_fields": {"id": "Session", "ctx": {"_type": "Load", "_fields": {}}}}, "keywords": []}}, "targets": [{"_type": "Name", "_fields": {"id": "sess", "ctx": {"_type": "Store", "_fields": {}}}}], "type_comment": null}}, {"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"args": [], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "A", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "classes", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}}}, "keywords": []}}, "targets": [{"_type": "Name", "_fields": {"id": "a1", "ctx": {"_type": "Store", "_fields": {}}}}], "type_comment": null}}, {"_type": "Assign", "_fields": {"value": {"_type": "Constant", "_fields": {"kind": null, "value": 1}}, "targets": [{"_type": "Attribute", "_fields": {"ctx": {"_type": "Store", "_fields": {}}, "attr": "vid", "value": {"_type": "Name", "_fields": {"id": "a1", "ctx": {"_type": "Load", "_fields": {}}}}}}], "type_comment": null}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Name", "_fields": {"id": "a1", "ctx": {"_type": "Load", "_fields": {}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "add", "value": {"_type": "Name", "_fields": {"id": "sess", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "commit", "value": {"_type": "Name", "_fields": {"id": "sess", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "vid", "value": {"_type": "Name", "_fields": {"id": "a1", "ctx": {"_type": "Load", "_fields": {}}}}}}, {"_type": "Constant", "_fields": {"kind": null, "value": 1}}], "func": {"_type": "Name", "_fields": {"id": "eq_", "ctx": {"_type": "Load", "_fields": {}}}}, "keywords": []}}}}], "name": "test_insert", "returns": null, "type_params": [], "type_comment": null, "decorator_list": []}}, {"_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": []}}, "body": [{"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"args": [], "func": {"_type": "Name", "_fields": {"id": "Session", "ctx": {"_type": "Load", "_fields": {}}}}, "keywords": []}}, "targets": [{"_type": "Name", "_fields": {"id": "sess", "ctx": {"_type": "Store", "_fields": {}}}}], "type_comment": null}}, {"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"args": [], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "A", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "classes", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}}}, "keywords": []}}, "targets": [{"_type": "Name", "_fields": {"id": "a1", "ctx": {"_type": "Store", "_fields": {}}}}], "type_comment": null}}, {"_type": "Assign", "_fields": {"value": {"_type": "Constant", "_fields": {"kind": null, "value": 1}}, "targets": [{"_type": "Attribute", "_fields": {"ctx": {"_type": "Store", "_fields": {}}, "attr": "vid", "value": {"_type": "Name", "_fields": {"id": "a1", "ctx": {"_type": "Load", "_fields": {}}}}}}], "type_comment": null}}, {"_type": "Assign", "_fields": {"value": {"_type": "Constant", "_fields": {"kind": null, "value": "d1"}}, "targets": [{"_type": "Attribute", "_fields": {"ctx": {"_type": "Store", "_fields": {}}, "attr": "data", "value": {"_type": "Name", "_fields": {"id": "a1", "ctx": {"_type": "Load", "_fields": {}}}}}}], "type_comment": null}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Name", "_fields": {"id": "a1", "ctx": {"_type": "Load", "_fields": {}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "add", "value": {"_type": "Name", "_fields": {"id": "sess", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "commit", "value": {"_type": "Name", "_fields": {"id": "sess", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Assign", "_fields": {"value": {"_type": "Constant", "_fields": {"kind": null, "value": 2}}, "targets": [{"_type": "Attribute", "_fields": {"ctx": {"_type": "Store", "_fields": {}}, "attr": "vid", "value": {"_type": "Name", "_fields": {"id": "a1", "ctx": {"_type": "Load", "_fields": {}}}}}}], "type_comment": null}}, {"_type": "Assign", "_fields": {"value": {"_type": "Constant", "_fields": {"kind": null, "value": "d2"}}, "targets": [{"_type": "Attribute", "_fields": {"ctx": {"_type": "Store", "_fields": {}}, "attr": "data", "value": {"_type": "Name", "_fields": {"id": "a1", "ctx": {"_type": "Load", "_fields": {}}}}}}], "type_comment": null}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "commit", "value": {"_type": "Name", "_fields": {"id": "sess", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "vid", "value": {"_type": "Name", "_fields": {"id": "a1", "ctx": {"_type": "Load", "_fields": {}}}}}}, {"_type": "Constant", "_fields": {"kind": null, "value": 2}}], "func": {"_type": "Name", "_fields": {"id": "eq_", "ctx": {"_type": "Load", "_fields": {}}}}, "keywords": []}}}}], "name": "test_update", "returns": null, "type_params": [], "type_comment": null, "decorator_list": []}}, {"_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": []}}, "body": [{"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"args": [], "func": {"_type": "Name", "_fields": {"id": "Session", "ctx": {"_type": "Load", "_fields": {}}}}, "keywords": []}}, "targets": [{"_type": "Name", "_fields": {"id": "sess", "ctx": {"_type": "Store", "_fields": {}}}}], "type_comment": null}}, {"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"args": [], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "A", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "classes", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}}}, "keywords": []}}, "targets": [{"_type": "Name", "_fields": {"id": "a1", "ctx": {"_type": "Store", "_fields": {}}}}], "type_comment": null}}, {"_type": "Assign", "_fields": {"value": {"_type": "Constant", "_fields": {"kind": null, "value": 1}}, "targets": [{"_type": "Attribute", "_fields": {"ctx": {"_type": "Store", "_fields": {}}, "attr": "vid", "value": {"_type": "Name", "_fields": {"id": "a1", "ctx": {"_type": "Load", "_fields": {}}}}}}], "type_comment": null}}, {"_type": "Assign", "_fields": {"value": {"_type": "Constant", "_fields": {"kind": null, "value": "d1"}}, "targets": [{"_type": "Attribute", "_fields": {"ctx": {"_type": "Store", "_fields": {}}, "attr": "data", "value": {"_type": "Name", "_fields": {"id": "a1", "ctx": {"_type": "Load", "_fields": {}}}}}}], "type_comment": null}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Name", "_fields": {"id": "a1", "ctx": {"_type": "Load", "_fields": {}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "add", "value": {"_type": "Name", "_fields": {"id": "sess", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "commit", "value": {"_type": "Name", "_fields": {"id": "sess", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Assign", "_fields": {"value": {"_type": "Constant", "_fields": {"kind": null, "value": 2}}, "targets": [{"_type": "Attribute", "_fields": {"ctx": {"_type": "Store", "_fields": {}}, "attr": "vid", "value": {"_type": "Name", "_fields": {"id": "a1", "ctx": {"_type": "Load", "_fields": {}}}}}}], "type_comment": null}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Call", "_fields": {"args": [], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "values", "value": {"_type": "Call", "_fields": {"args": [], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "update", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "a", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "tables", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}}}}}, "keywords": []}}}}, "keywords": [{"_type": "keyword", "_fields": {"arg": "vid", "value": {"_type": "Constant", "_fields": {"kind": null, "value": 3}}}}]}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "execute", "value": {"_type": "Name", "_fields": {"id": "sess", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Assign", "_fields": {"value": {"_type": "Constant", "_fields": {"kind": null, "value": "d2"}}, "targets": [{"_type": "Attribute", "_fields": {"ctx": {"_type": "Store", "_fields": {}}, "attr": "data", "value": {"_type": "Name", "_fields": {"id": "a1", "ctx": {"_type": "Load", "_fields": {}}}}}}], "type_comment": null}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "StaleDataError", "value": {"_type": "Name", "_fields": {"id": "orm_exc", "ctx": {"_type": "Load", "_fields": {}}}}}}, {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "commit", "value": {"_type": "Name", "_fields": {"id": "sess", "ctx": {"_type": "Load", "_fields": {}}}}}}], "func": {"_type": "Name", "_fields": {"id": "assert_raises", "ctx": {"_type": "Load", "_fields": {}}}}, "keywords": []}}}}], "name": "test_update_concurrent_check", "returns": null, "type_params": [], "type_comment": null, "decorator_list": []}}, {"_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": []}}, "body": [{"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"args": [], "func": {"_type": "Name", "_fields": {"id": "Session", "ctx": {"_type": "Load", "_fields": {}}}}, "keywords": []}}, "targets": [{"_type": "Name", "_fields": {"id": "sess", "ctx": {"_type": "Store", "_fields": {}}}}], "type_comment": null}}, {"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"args": [], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "A", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "classes", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}}}, "keywords": []}}, "targets": [{"_type": "Name", "_fields": {"id": "a1", "ctx": {"_type": "Store", "_fields": {}}}}], "type_comment": null}}, {"_type": "Assign", "_fields": {"value": {"_type": "Constant", "_fields": {"kind": null, "value": 1}}, "targets": [{"_type": "Attribute", "_fields": {"ctx": {"_type": "Store", "_fields": {}}, "attr": "vid", "value": {"_type": "Name", "_fields": {"id": "a1", "ctx": {"_type": "Load", "_fields": {}}}}}}], "type_comment": null}}, {"_type": "Assign", "_fields": {"value": {"_type": "Constant", "_fields": {"kind": null, "value": "d1"}}, "targets": [{"_type": "Attribute", "_fields": {"ctx": {"_type": "Store", "_fields": {}}, "attr": "data", "value": {"_type": "Name", "_fields": {"id": "a1", "ctx": {"_type": "Load", "_fields": {}}}}}}], "type_comment": null}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Name", "_fields": {"id": "a1", "ctx": {"_type": "Load", "_fields": {}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "add", "value": {"_type": "Name", "_fields": {"id": "sess", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "commit", "value": {"_type": "Name", "_fields": {"id": "sess", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Assign", "_fields": {"value": {"_type": "Constant", "_fields": {"kind": null, "value": "d2"}}, "targets": [{"_type": "Attribute", "_fields": {"ctx": {"_type": "Store", "_fields": {}}, "attr": "data", "value": {"_type": "Name", "_fields": {"id": "a1", "ctx": {"_type": "Load", "_fields": {}}}}}}], "type_comment": null}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "commit", "value": {"_type": "Name", "_fields": {"id": "sess", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "vid", "value": {"_type": "Name", "_fields": {"id": "a1", "ctx": {"_type": "Load", "_fields": {}}}}}}, {"_type": "Constant", "_fields": {"kind": null, "value": 1}}], "func": {"_type": "Name", "_fields": {"id": "eq_", "ctx": {"_type": "Load", "_fields": {}}}}, "keywords": []}}}}, {"_type": "Assign", "_fields": {"value": {"_type": "Constant", "_fields": {"kind": null, "value": "d3"}}, "targets": [{"_type": "Attribute", "_fields": {"ctx": {"_type": "Store", "_fields": {}}, "attr": "data", "value": {"_type": "Name", "_fields": {"id": "a1", "ctx": {"_type": "Load", "_fields": {}}}}}}], "type_comment": null}}, {"_type": "Assign", "_fields": {"value": {"_type": "Constant", "_fields": {"kind": null, "value": 2}}, "targets": [{"_type": "Attribute", "_fields": {"ctx": {"_type": "Store", "_fields": {}}, "attr": "vid", "value": {"_type": "Name", "_fields": {"id": "a1", "ctx": {"_type": "Load", "_fields": {}}}}}}], "type_comment": null}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "commit", "value": {"_type": "Name", "_fields": {"id": "sess", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "vid", "value": {"_type": "Name", "_fields": {"id": "a1", "ctx": {"_type": "Load", "_fields": {}}}}}}, {"_type": "Constant", "_fields": {"kind": null, "value": 2}}], "func": {"_type": "Name", "_fields": {"id": "eq_", "ctx": {"_type": "Load", "_fields": {}}}}, "keywords": []}}}}], "name": "test_update_version_conditional", "returns": null, "type_params": [], "type_comment": null, "decorator_list": []}}], "name": "ManualVersionTest", "bases": [{"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "MappedTest", "value": {"_type": "Name", "_fields": {"id": "fixtures", "ctx": {"_type": "Load", "_fields": {}}}}}}], "keywords": [], "type_params": [], "decorator_list": []}}], "type_ignores": []}}
class ManualVersionTest(fixtures.MappedTest): run_define_tables = 'each' __backend__ = True @classmethod def define_tables(cls, metadata): Table( "a", metadata, Column( 'id', Integer, primary_key=True, test_needs_autoincrement=True), Column('data', String(30)), Column('vid', Integer) ) @classmethod def setup_classes(cls): class A(cls.Basic): pass @classmethod def setup_mappers(cls): mapper( cls.classes.A, cls.tables.a, version_id_col=cls.tables.a.c.vid, version_id_generator=False) def test_insert(self): sess = Session() a1 = self.classes.A() a1.vid = 1 sess.add(a1) sess.commit() eq_(a1.vid, 1) def test_update(self): sess = Session() a1 = self.classes.A() a1.vid = 1 a1.data = 'd1' sess.add(a1) sess.commit() a1.vid = 2 a1.data = 'd2' sess.commit() eq_(a1.vid, 2) def test_update_concurrent_check(self): sess = Session() a1 = self.classes.A() a1.vid = 1 a1.data = 'd1' sess.add(a1) sess.commit() a1.vid = 2 sess.execute(self.tables.a.update().values(vid=3)) a1.data = 'd2' assert_raises( orm_exc.StaleDataError, sess.commit ) def test_update_version_conditional(self): sess = Session() a1 = self.classes.A() a1.vid = 1 a1.data = 'd1' sess.add(a1) sess.commit() # change the data and UPDATE without # incrementing version id a1.data = 'd2' sess.commit() eq_(a1.vid, 1) a1.data = 'd3' a1.vid = 2 sess.commit() eq_(a1.vid, 2)
14,121
[ 0.01413219328969717, 0.05170208588242531, 0.07244379818439484, -0.03893962875008583, 0.028960123658180237, 0.036069706082344055, 0.045223016291856766, -0.04487514868378639, -0.04583178833127022, 0.002274739556014538, 0.015838926658034325, -0.030286377295851707, 0.04135297238826752, -0.0220...
8
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "cls", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "metadata", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}}, "body": [{"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"kind": null, "value": "a"}}, {"_type": "Name", "_fields": {"id": "metadata", "ctx": {"_type": "Load", "_fields": {}}}}, {"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"kind": null, "value": "id"}}, {"_type": "Name", "_fields": {"id": "Integer", "ctx": {"_type": "Load", "_fields": {}}}}], "func": {"_type": "Name", "_fields": {"id": "Column", "ctx": {"_type": "Load", "_fields": {}}}}, "keywords": [{"_type": "keyword", "_fields": {"arg": "primary_key", "value": {"_type": "Constant", "_fields": {"kind": null, "value": true}}}}, {"_type": "keyword", "_fields": {"arg": "test_needs_autoincrement", "value": {"_type": "Constant", "_fields": {"kind": null, "value": true}}}}]}}, {"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"kind": null, "value": "data"}}, {"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"kind": null, "value": 30}}], "func": {"_type": "Name", "_fields": {"id": "String", "ctx": {"_type": "Load", "_fields": {}}}}, "keywords": []}}], "func": {"_type": "Name", "_fields": {"id": "Column", "ctx": {"_type": "Load", "_fields": {}}}}, "keywords": []}}, {"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"kind": null, "value": "vid"}}, {"_type": "Name", "_fields": {"id": "Integer", "ctx": {"_type": "Load", "_fields": {}}}}], "func": {"_type": "Name", "_fields": {"id": "Column", "ctx": {"_type": "Load", "_fields": {}}}}, "keywords": []}}], "func": {"_type": "Name", "_fields": {"id": "Table", "ctx": {"_type": "Load", "_fields": {}}}}, "keywords": []}}}}], "name": "define_tables", "returns": null, "type_params": [], "type_comment": null, "decorator_list": []}}], "type_ignores": []}}
def define_tables(cls, metadata): Table( "a", metadata, Column( 'id', Integer, primary_key=True, test_needs_autoincrement=True), Column('data', String(30)), Column('vid', Integer) )
14,122
[ 0.017532363533973694, -0.02720220759510994, 0.04875817522406578, -0.05582916736602783, 0.021278932690620422, 0.05340181291103363, 0.05419334024190903, 0.01202464196830988, 0.01800728030502796, -0.021529583260416985, 0.04129141941666603, -0.04633082076907158, -0.02873249724507332, 0.0154611...
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": []}}, "body": [{"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"args": [], "func": {"_type": "Name", "_fields": {"id": "Session", "ctx": {"_type": "Load", "_fields": {}}}}, "keywords": []}}, "targets": [{"_type": "Name", "_fields": {"id": "sess", "ctx": {"_type": "Store", "_fields": {}}}}], "type_comment": null}}, {"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"args": [], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "A", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "classes", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}}}, "keywords": []}}, "targets": [{"_type": "Name", "_fields": {"id": "a1", "ctx": {"_type": "Store", "_fields": {}}}}], "type_comment": null}}, {"_type": "Assign", "_fields": {"value": {"_type": "Constant", "_fields": {"kind": null, "value": 1}}, "targets": [{"_type": "Attribute", "_fields": {"ctx": {"_type": "Store", "_fields": {}}, "attr": "vid", "value": {"_type": "Name", "_fields": {"id": "a1", "ctx": {"_type": "Load", "_fields": {}}}}}}], "type_comment": null}}, {"_type": "Assign", "_fields": {"value": {"_type": "Constant", "_fields": {"kind": null, "value": "d1"}}, "targets": [{"_type": "Attribute", "_fields": {"ctx": {"_type": "Store", "_fields": {}}, "attr": "data", "value": {"_type": "Name", "_fields": {"id": "a1", "ctx": {"_type": "Load", "_fields": {}}}}}}], "type_comment": null}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Name", "_fields": {"id": "a1", "ctx": {"_type": "Load", "_fields": {}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "add", "value": {"_type": "Name", "_fields": {"id": "sess", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "commit", "value": {"_type": "Name", "_fields": {"id": "sess", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Assign", "_fields": {"value": {"_type": "Constant", "_fields": {"kind": null, "value": 2}}, "targets": [{"_type": "Attribute", "_fields": {"ctx": {"_type": "Store", "_fields": {}}, "attr": "vid", "value": {"_type": "Name", "_fields": {"id": "a1", "ctx": {"_type": "Load", "_fields": {}}}}}}], "type_comment": null}}, {"_type": "Assign", "_fields": {"value": {"_type": "Constant", "_fields": {"kind": null, "value": "d2"}}, "targets": [{"_type": "Attribute", "_fields": {"ctx": {"_type": "Store", "_fields": {}}, "attr": "data", "value": {"_type": "Name", "_fields": {"id": "a1", "ctx": {"_type": "Load", "_fields": {}}}}}}], "type_comment": null}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "commit", "value": {"_type": "Name", "_fields": {"id": "sess", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "vid", "value": {"_type": "Name", "_fields": {"id": "a1", "ctx": {"_type": "Load", "_fields": {}}}}}}, {"_type": "Constant", "_fields": {"kind": null, "value": 2}}], "func": {"_type": "Name", "_fields": {"id": "eq_", "ctx": {"_type": "Load", "_fields": {}}}}, "keywords": []}}}}], "name": "test_update", "returns": null, "type_params": [], "type_comment": null, "decorator_list": []}}], "type_ignores": []}}
def test_update(self): sess = Session() a1 = self.classes.A() a1.vid = 1 a1.data = 'd1' sess.add(a1) sess.commit() a1.vid = 2 a1.data = 'd2' sess.commit() eq_(a1.vid, 2)
14,123
[ 0.04105837270617485, -0.004575857426971197, 0.03168283775448799, -0.050036005675792694, 0.04093402996659279, 0.023973513394594193, 0.03578618913888931, 0.029867418110370636, 0.004945780616253614, -0.06764311343431473, 0.06147564947605133, -0.048742830753326416, 0.008063705638051033, -0.005...
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": []}}, "body": [{"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"args": [], "func": {"_type": "Name", "_fields": {"id": "Session", "ctx": {"_type": "Load", "_fields": {}}}}, "keywords": []}}, "targets": [{"_type": "Name", "_fields": {"id": "sess", "ctx": {"_type": "Store", "_fields": {}}}}], "type_comment": null}}, {"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"args": [], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "A", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "classes", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}}}, "keywords": []}}, "targets": [{"_type": "Name", "_fields": {"id": "a1", "ctx": {"_type": "Store", "_fields": {}}}}], "type_comment": null}}, {"_type": "Assign", "_fields": {"value": {"_type": "Constant", "_fields": {"kind": null, "value": 1}}, "targets": [{"_type": "Attribute", "_fields": {"ctx": {"_type": "Store", "_fields": {}}, "attr": "vid", "value": {"_type": "Name", "_fields": {"id": "a1", "ctx": {"_type": "Load", "_fields": {}}}}}}], "type_comment": null}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Name", "_fields": {"id": "a1", "ctx": {"_type": "Load", "_fields": {}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "add", "value": {"_type": "Name", "_fields": {"id": "sess", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "commit", "value": {"_type": "Name", "_fields": {"id": "sess", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "vid", "value": {"_type": "Name", "_fields": {"id": "a1", "ctx": {"_type": "Load", "_fields": {}}}}}}, {"_type": "Constant", "_fields": {"kind": null, "value": 1}}], "func": {"_type": "Name", "_fields": {"id": "eq_", "ctx": {"_type": "Load", "_fields": {}}}}, "keywords": []}}}}], "name": "test_insert", "returns": null, "type_params": [], "type_comment": null, "decorator_list": []}}], "type_ignores": []}}
def test_insert(self): sess = Session() a1 = self.classes.A() a1.vid = 1 sess.add(a1) sess.commit() eq_(a1.vid, 1)
14,124
[ 0.039775360375642776, -0.011955252848565578, 0.007526148110628128, -0.042679253965616226, 0.02284485660493374, 0.06004934012889862, 0.0642586499452591, 0.019234970211982727, 0.02813314087688923, -0.0033368144650012255, 0.05695895478129387, -0.027946652844548225, -0.047288186848163605, 0.03...
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": []}}, "body": [{"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"args": [], "func": {"_type": "Name", "_fields": {"id": "Session", "ctx": {"_type": "Load", "_fields": {}}}}, "keywords": []}}, "targets": [{"_type": "Name", "_fields": {"id": "sess", "ctx": {"_type": "Store", "_fields": {}}}}], "type_comment": null}}, {"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"args": [], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "A", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "classes", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}}}, "keywords": []}}, "targets": [{"_type": "Name", "_fields": {"id": "a1", "ctx": {"_type": "Store", "_fields": {}}}}], "type_comment": null}}, {"_type": "Assign", "_fields": {"value": {"_type": "Constant", "_fields": {"kind": null, "value": 1}}, "targets": [{"_type": "Attribute", "_fields": {"ctx": {"_type": "Store", "_fields": {}}, "attr": "vid", "value": {"_type": "Name", "_fields": {"id": "a1", "ctx": {"_type": "Load", "_fields": {}}}}}}], "type_comment": null}}, {"_type": "Assign", "_fields": {"value": {"_type": "Constant", "_fields": {"kind": null, "value": "d1"}}, "targets": [{"_type": "Attribute", "_fields": {"ctx": {"_type": "Store", "_fields": {}}, "attr": "data", "value": {"_type": "Name", "_fields": {"id": "a1", "ctx": {"_type": "Load", "_fields": {}}}}}}], "type_comment": null}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Name", "_fields": {"id": "a1", "ctx": {"_type": "Load", "_fields": {}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "add", "value": {"_type": "Name", "_fields": {"id": "sess", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "commit", "value": {"_type": "Name", "_fields": {"id": "sess", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Assign", "_fields": {"value": {"_type": "Constant", "_fields": {"kind": null, "value": "d2"}}, "targets": [{"_type": "Attribute", "_fields": {"ctx": {"_type": "Store", "_fields": {}}, "attr": "data", "value": {"_type": "Name", "_fields": {"id": "a1", "ctx": {"_type": "Load", "_fields": {}}}}}}], "type_comment": null}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "commit", "value": {"_type": "Name", "_fields": {"id": "sess", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "vid", "value": {"_type": "Name", "_fields": {"id": "a1", "ctx": {"_type": "Load", "_fields": {}}}}}}, {"_type": "Constant", "_fields": {"kind": null, "value": 1}}], "func": {"_type": "Name", "_fields": {"id": "eq_", "ctx": {"_type": "Load", "_fields": {}}}}, "keywords": []}}}}, {"_type": "Assign", "_fields": {"value": {"_type": "Constant", "_fields": {"kind": null, "value": "d3"}}, "targets": [{"_type": "Attribute", "_fields": {"ctx": {"_type": "Store", "_fields": {}}, "attr": "data", "value": {"_type": "Name", "_fields": {"id": "a1", "ctx": {"_type": "Load", "_fields": {}}}}}}], "type_comment": null}}, {"_type": "Assign", "_fields": {"value": {"_type": "Constant", "_fields": {"kind": null, "value": 2}}, "targets": [{"_type": "Attribute", "_fields": {"ctx": {"_type": "Store", "_fields": {}}, "attr": "vid", "value": {"_type": "Name", "_fields": {"id": "a1", "ctx": {"_type": "Load", "_fields": {}}}}}}], "type_comment": null}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "commit", "value": {"_type": "Name", "_fields": {"id": "sess", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "vid", "value": {"_type": "Name", "_fields": {"id": "a1", "ctx": {"_type": "Load", "_fields": {}}}}}}, {"_type": "Constant", "_fields": {"kind": null, "value": 2}}], "func": {"_type": "Name", "_fields": {"id": "eq_", "ctx": {"_type": "Load", "_fields": {}}}}, "keywords": []}}}}], "name": "test_update_version_conditional", "returns": null, "type_params": [], "type_comment": null, "decorator_list": []}}], "type_ignores": []}}
def test_update_version_conditional(self): sess = Session() a1 = self.classes.A() a1.vid = 1 a1.data = 'd1' sess.add(a1) sess.commit() # change the data and UPDATE without # incrementing version id a1.data = 'd2' sess.commit() eq_(a1.vid, 1) a1.data = 'd3' a1.vid = 2 sess.commit() eq_(a1.vid, 2)
14,125
[ 0.02877279929816723, -0.01742682419717312, 0.05794110149145126, -0.04061315208673477, 0.027981795370578766, 0.06560395658016205, 0.04938836023211479, 0.023309921845793724, 0.011778555810451508, -0.030676154419779778, 0.024397553876042366, -0.032505352050065994, -0.011284178122878075, 0.028...
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": []}}, "body": [{"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"args": [], "func": {"_type": "Name", "_fields": {"id": "Session", "ctx": {"_type": "Load", "_fields": {}}}}, "keywords": []}}, "targets": [{"_type": "Name", "_fields": {"id": "sess", "ctx": {"_type": "Store", "_fields": {}}}}], "type_comment": null}}, {"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"args": [], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "A", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "classes", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}}}, "keywords": []}}, "targets": [{"_type": "Name", "_fields": {"id": "a1", "ctx": {"_type": "Store", "_fields": {}}}}], "type_comment": null}}, {"_type": "Assign", "_fields": {"value": {"_type": "Constant", "_fields": {"kind": null, "value": 1}}, "targets": [{"_type": "Attribute", "_fields": {"ctx": {"_type": "Store", "_fields": {}}, "attr": "vid", "value": {"_type": "Name", "_fields": {"id": "a1", "ctx": {"_type": "Load", "_fields": {}}}}}}], "type_comment": null}}, {"_type": "Assign", "_fields": {"value": {"_type": "Constant", "_fields": {"kind": null, "value": "d1"}}, "targets": [{"_type": "Attribute", "_fields": {"ctx": {"_type": "Store", "_fields": {}}, "attr": "data", "value": {"_type": "Name", "_fields": {"id": "a1", "ctx": {"_type": "Load", "_fields": {}}}}}}], "type_comment": null}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Name", "_fields": {"id": "a1", "ctx": {"_type": "Load", "_fields": {}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "add", "value": {"_type": "Name", "_fields": {"id": "sess", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "commit", "value": {"_type": "Name", "_fields": {"id": "sess", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Assign", "_fields": {"value": {"_type": "Constant", "_fields": {"kind": null, "value": 2}}, "targets": [{"_type": "Attribute", "_fields": {"ctx": {"_type": "Store", "_fields": {}}, "attr": "vid", "value": {"_type": "Name", "_fields": {"id": "a1", "ctx": {"_type": "Load", "_fields": {}}}}}}], "type_comment": null}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Call", "_fields": {"args": [], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "values", "value": {"_type": "Call", "_fields": {"args": [], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "update", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "a", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "tables", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}}}}}, "keywords": []}}}}, "keywords": [{"_type": "keyword", "_fields": {"arg": "vid", "value": {"_type": "Constant", "_fields": {"kind": null, "value": 3}}}}]}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "execute", "value": {"_type": "Name", "_fields": {"id": "sess", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Assign", "_fields": {"value": {"_type": "Constant", "_fields": {"kind": null, "value": "d2"}}, "targets": [{"_type": "Attribute", "_fields": {"ctx": {"_type": "Store", "_fields": {}}, "attr": "data", "value": {"_type": "Name", "_fields": {"id": "a1", "ctx": {"_type": "Load", "_fields": {}}}}}}], "type_comment": null}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "StaleDataError", "value": {"_type": "Name", "_fields": {"id": "orm_exc", "ctx": {"_type": "Load", "_fields": {}}}}}}, {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "commit", "value": {"_type": "Name", "_fields": {"id": "sess", "ctx": {"_type": "Load", "_fields": {}}}}}}], "func": {"_type": "Name", "_fields": {"id": "assert_raises", "ctx": {"_type": "Load", "_fields": {}}}}, "keywords": []}}}}], "name": "test_update_concurrent_check", "returns": null, "type_params": [], "type_comment": null, "decorator_list": []}}], "type_ignores": []}}
def test_update_concurrent_check(self): sess = Session() a1 = self.classes.A() a1.vid = 1 a1.data = 'd1' sess.add(a1) sess.commit() a1.vid = 2 sess.execute(self.tables.a.update().values(vid=3)) a1.data = 'd2' assert_raises( orm_exc.StaleDataError, sess.commit )
14,126
[ 0.005729478783905506, -0.019510891288518906, 0.03570561110973358, -0.012038151733577251, 0.031912460923194885, -0.01426407415419817, -0.005479630548506975, 0.025302832946181297, 0.007353493943810463, -0.0024956450797617435, 0.019726669415831566, -0.028028452768921852, -0.032003313302993774, ...
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": "verb", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "path", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "headers", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "body", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [{"_type": "Constant", "_fields": {"kind": null, "value": ""}}, {"_type": "Constant", "_fields": {"kind": null, "value": ""}}, {"_type": "Constant", "_fields": {"kind": null, "value": ""}}], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}}, "body": [{"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "closeConnection", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Assign", "_fields": {"value": {"_type": "Name", "_fields": {"id": "body", "ctx": {"_type": "Load", "_fields": {}}}}, "targets": [{"_type": "Attribute", "_fields": {"ctx": {"_type": "Store", "_fields": {}}, "attr": "lastrequestbody", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}], "type_comment": null}}, {"_type": "If", "_fields": {"body": [{"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "host", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "HTTPSConnection", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "client", "value": {"_type": "Name", "_fields": {"id": "http", "ctx": {"_type": "Load", "_fields": {}}}}}}}}, "keywords": []}}, "targets": [{"_type": "Name", "_fields": {"id": "c", "ctx": {"_type": "Store", "_fields": {}}}}], "type_comment": null}}], "test": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "secure", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}, "orelse": [{"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "host", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "HTTPConnection", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "client", "value": {"_type": "Name", "_fields": {"id": "http", "ctx": {"_type": "Load", "_fields": {}}}}}}}}, "keywords": []}}, "targets": [{"_type": "Name", "_fields": {"id": "c", "ctx": {"_type": "Store", "_fields": {}}}}], "type_comment": null}}]}}, {"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"args": [], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "now", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "datetime", "value": {"_type": "Name", "_fields": {"id": "datetime", "ctx": {"_type": "Load", "_fields": {}}}}}}}}, "keywords": []}}, "targets": [{"_type": "Name", "_fields": {"id": "ts", "ctx": {"_type": "Store", "_fields": {}}}}], "type_comment": null}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Name", "_fields": {"id": "verb", "ctx": {"_type": "Load", "_fields": {}}}}, {"_type": "Name", "_fields": {"id": "path", "ctx": {"_type": "Load", "_fields": {}}}}, {"_type": "Name", "_fields": {"id": "body", "ctx": {"_type": "Load", "_fields": {}}}}, {"_type": "Name", "_fields": {"id": "headers", "ctx": {"_type": "Load", "_fields": {}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "request", "value": {"_type": "Name", "_fields": {"id": "c", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Call", "_fields": {"args": [{"_type": "Name", "_fields": {"id": "path", "ctx": {"_type": "Load", "_fields": {}}}}, {"_type": "BinOp", "_fields": {"op": {"_type": "Div", "_fields": {}}, "left": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "microseconds", "value": {"_type": "BinOp", "_fields": {"op": {"_type": "Sub", "_fields": {}}, "left": {"_type": "Call", "_fields": {"args": [], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "now", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "datetime", "value": {"_type": "Name", "_fields": {"id": "datetime", "ctx": {"_type": "Load", "_fields": {}}}}}}}}, "keywords": []}}, "right": {"_type": "Name", "_fields": {"id": "ts", "ctx": {"_type": "Load", "_fields": {}}}}}}}}, "right": {"_type": "Constant", "_fields": {"kind": null, "value": 1000}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "format", "value": {"_type": "Constant", "_fields": {"kind": null, "value": "datasource request ({0}) {1}ms"}}}}, "keywords": []}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "debug", "value": {"_type": "Name", "_fields": {"id": "log", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"args": [], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "getresponse", "value": {"_type": "Name", "_fields": {"id": "c", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}, "targets": [{"_type": "Name", "_fields": {"id": "r", "ctx": {"_type": "Store", "_fields": {}}}}], "type_comment": null}}, {"_type": "Return", "_fields": {"value": {"_type": "Name", "_fields": {"id": "r", "ctx": {"_type": "Load", "_fields": {}}}}}}], "name": "sendRequest", "returns": null, "type_params": [], "type_comment": null, "decorator_list": []}}], "type_ignores": []}}
def sendRequest(self, verb, path='', headers='', body=''): self.closeConnection() self.lastrequestbody = body if(self.secure): c = http.client.HTTPSConnection(self.host) else: c = http.client.HTTPConnection(self.host) ts = datetime.datetime.now() c.request(verb, path, body, headers) log.debug( "datasource request ({0}) {1}ms".format( path, (datetime.datetime.now() - ts).microseconds/1000) ) r = c.getresponse() return r
14,127
[ -0.030952662229537964, 0.0002633285184856504, -0.007290740497410297, -0.022933421656489372, 0.048689067363739014, -0.005027799867093563, -0.012011652812361717, 0.050295207649469376, 0.02627190388739109, -0.012034596875309944, 0.03418789431452751, -0.05387461185455322, -0.006114814430475235, ...
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": "response", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "path", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [{"_type": "Constant", "_fields": {"kind": null, "value": ""}}], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}}, "body": [{"_type": "Assign", "_fields": {"value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "status", "value": {"_type": "Name", "_fields": {"id": "response", "ctx": {"_type": "Load", "_fields": {}}}}}}, "targets": [{"_type": "Name", "_fields": {"id": "status", "ctx": {"_type": "Store", "_fields": {}}}}], "type_comment": null}}, {"_type": "If", "_fields": {"body": [{"_type": "Return", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Name", "_fields": {"id": "response", "ctx": {"_type": "Load", "_fields": {}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "readAndClose", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}], "test": {"_type": "Compare", "_fields": {"ops": [{"_type": "Eq", "_fields": {}}], "left": {"_type": "Name", "_fields": {"id": "status", "ctx": {"_type": "Load", "_fields": {}}}}, "comparators": [{"_type": "Constant", "_fields": {"kind": null, "value": 200}}]}}, "orelse": [{"_type": "If", "_fields": {"body": [{"_type": "Return", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Name", "_fields": {"id": "response", "ctx": {"_type": "Load", "_fields": {}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "readAndClose", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}], "test": {"_type": "Compare", "_fields": {"ops": [{"_type": "Eq", "_fields": {}}], "left": {"_type": "Name", "_fields": {"id": "status", "ctx": {"_type": "Load", "_fields": {}}}}, "comparators": [{"_type": "Constant", "_fields": {"kind": null, "value": 201}}]}}, "orelse": [{"_type": "If", "_fields": {"body": [{"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Call", "_fields": {"args": [], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "read", "value": {"_type": "Name", "_fields": {"id": "response", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "format", "value": {"_type": "Constant", "_fields": {"kind": null, "value": "Bad Request: {}"}}}}, "keywords": []}}, "targets": [{"_type": "Name", "_fields": {"id": "msg", "ctx": {"_type": "Store", "_fields": {}}}}], "type_comment": null}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "closeConnection", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Raise", "_fields": {"exc": {"_type": "Call", "_fields": {"args": [{"_type": "Name", "_fields": {"id": "msg", "ctx": {"_type": "Load", "_fields": {}}}}], "func": {"_type": "Name", "_fields": {"id": "Exception", "ctx": {"_type": "Load", "_fields": {}}}}, "keywords": []}}, "cause": null}}], "test": {"_type": "Compare", "_fields": {"ops": [{"_type": "Eq", "_fields": {}}], "left": {"_type": "Name", "_fields": {"id": "status", "ctx": {"_type": "Load", "_fields": {}}}}, "comparators": [{"_type": "Constant", "_fields": {"kind": null, "value": 400}}]}}, "orelse": [{"_type": "If", "_fields": {"body": [{"_type": "Assign", "_fields": {"value": {"_type": "Constant", "_fields": {"kind": null, "value": "The data being imported was formatted incorrectly"}}, "targets": [{"_type": "Name", "_fields": {"id": "msg", "ctx": {"_type": "Store", "_fields": {}}}}], "type_comment": null}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "closeConnection", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Raise", "_fields": {"exc": {"_type": "Call", "_fields": {"args": [{"_type": "Name", "_fields": {"id": "msg", "ctx": {"_type": "Load", "_fields": {}}}}], "func": {"_type": "Name", "_fields": {"id": "Exception", "ctx": {"_type": "Load", "_fields": {}}}}, "keywords": []}}, "cause": null}}], "test": {"_type": "Compare", "_fields": {"ops": [{"_type": "Eq", "_fields": {}}], "left": {"_type": "Name", "_fields": {"id": "status", "ctx": {"_type": "Load", "_fields": {}}}}, "comparators": [{"_type": "Constant", "_fields": {"kind": null, "value": 406}}]}}, "orelse": [{"_type": "If", "_fields": {"body": [{"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "closeConnection", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Raise", "_fields": {"exc": {"_type": "Call", "_fields": {"args": [], "func": {"_type": "Name", "_fields": {"id": "PageNotFound", "ctx": {"_type": "Load", "_fields": {}}}}, "keywords": [{"_type": "keyword", "_fields": {"arg": "path", "value": {"_type": "Name", "_fields": {"id": "path", "ctx": {"_type": "Load", "_fields": {}}}}}}]}}, "cause": null}}], "test": {"_type": "Compare", "_fields": {"ops": [{"_type": "Eq", "_fields": {}}], "left": {"_type": "Name", "_fields": {"id": "status", "ctx": {"_type": "Load", "_fields": {}}}}, "comparators": [{"_type": "Constant", "_fields": {"kind": null, "value": 404}}]}}, "orelse": [{"_type": "If", "_fields": {"body": [{"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "closeConnection", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Raise", "_fields": {"exc": {"_type": "Name", "_fields": {"id": "ServerError", "ctx": {"_type": "Load", "_fields": {}}}}, "cause": null}}], "test": {"_type": "Compare", "_fields": {"ops": [{"_type": "Eq", "_fields": {}}], "left": {"_type": "Name", "_fields": {"id": "status", "ctx": {"_type": "Load", "_fields": {}}}}, "comparators": [{"_type": "Constant", "_fields": {"kind": null, "value": 500}}]}}, "orelse": [{"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "closeConnection", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Name", "_fields": {"id": "status", "ctx": {"_type": "Load", "_fields": {}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "format", "value": {"_type": "Constant", "_fields": {"kind": null, "value": "Unknown response code from server: {}"}}}}, "keywords": []}}, "targets": [{"_type": "Name", "_fields": {"id": "msg", "ctx": {"_type": "Store", "_fields": {}}}}], "type_comment": null}}, {"_type": "Raise", "_fields": {"exc": {"_type": "Call", "_fields": {"args": [{"_type": "Name", "_fields": {"id": "msg", "ctx": {"_type": "Load", "_fields": {}}}}], "func": {"_type": "Name", "_fields": {"id": "Exception", "ctx": {"_type": "Load", "_fields": {}}}}, "keywords": []}}, "cause": null}}]}}]}}]}}]}}]}}]}}], "name": "processResponse", "returns": null, "type_params": [], "type_comment": null, "decorator_list": []}}], "type_ignores": []}}
def processResponse(self, response, path=''): status = response.status if status == 200: return self.readAndClose(response) elif status == 201: return self.readAndClose(response) elif status == 400: msg = 'Bad Request: {}'.format(response.read()) self.closeConnection() raise Exception(msg) elif status == 406: msg = "The data being imported was formatted incorrectly" self.closeConnection() raise Exception(msg) elif status == 404: self.closeConnection() raise PageNotFound(path=path) elif status == 500: self.closeConnection() raise ServerError else: self.closeConnection() msg = 'Unknown response code from server: {}'.format(status) raise Exception(msg)
14,128
[ 0.05198192223906517, 0.03639199957251549, -0.004647891037166119, -0.009144536219537258, -0.0010158172808587551, 0.015333968214690685, 0.016799885779619217, -0.03571721166372299, 0.035182032734155655, -0.005535004194825888, 0.006701339967548847, -0.05379686877131462, 0.042651236057281494, 0...
10
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "raw_string", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}}, "body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "matchobj", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}}, "body": [{"_type": "If", "_fields": {"body": [{"_type": "Return", "_fields": {"value": {"_type": "Constant", "_fields": {"kind": null, "value": "\n"}}}}], "test": {"_type": "Compare", "_fields": {"ops": [{"_type": "Eq", "_fields": {}}], "left": {"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"kind": null, "value": 1}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "group", "value": {"_type": "Name", "_fields": {"id": "matchobj", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}, "comparators": [{"_type": "Constant", "_fields": {"kind": null, "value": "\r"}}]}}, "orelse": [{"_type": "Return", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"kind": null, "value": 1}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "group", "value": {"_type": "Name", "_fields": {"id": "matchobj", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}]}}], "name": "controls_repl", "returns": null, "type_params": [], "type_comment": null, "decorator_list": []}}, {"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "matchobj", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}}, "body": [{"_type": "Return", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"kind": null, "value": 1}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "group", "value": {"_type": "Name", "_fields": {"id": "matchobj", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}], "name": "non_controls_repl", "returns": null, "type_params": [], "type_comment": null, "decorator_list": []}}, {"_type": "Try", "_fields": {"body": [{"_type": "Return", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"kind": null, "value": "utf-8"}}, {"_type": "Constant", "_fields": {"kind": null, "value": "backslashreplace"}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "decode", "value": {"_type": "Name", "_fields": {"id": "raw_string", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "loads", "value": {"_type": "Name", "_fields": {"id": "json", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}], "orelse": [{"_type": "Raise", "_fields": {"exc": null, "cause": null}}], "handlers": [{"_type": "ExceptHandler", "_fields": {"body": [{"_type": "Raise", "_fields": {"exc": null, "cause": null}}, {"_type": "Return", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"kind": null, "value": "unicode-escape"}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "decode", "value": {"_type": "Name", "_fields": {"id": "raw_string", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "loads", "value": {"_type": "Name", "_fields": {"id": "json", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}], "name": null, "type": null}}], "finalbody": []}}], "name": "raw_to_json", "returns": null, "type_params": [], "type_comment": null, "decorator_list": []}}], "type_ignores": []}}
def raw_to_json(self, raw_string): def controls_repl(matchobj): if matchobj.group(1) == '\r': return '\n' else: return matchobj.group(1) def non_controls_repl(matchobj): return matchobj.group(1) try: return json.loads(raw_string.decode('utf-8', 'backslashreplace')) except: raise return json.loads(raw_string.decode('unicode-escape')) else: raise
14,129
[ -0.009283545427024364, 0.01388838142156601, -0.038907166570425034, -0.00027364297420717776, 0.05740530788898468, -0.06193627044558525, -0.034041307866573334, -0.009012673050165176, 0.04073925316333771, 0.0019712143111974, 0.011278153397142887, -0.029234550893306732, 0.004794446285814047, 0...
9
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "_format", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "responseString", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}}, "body": [{"_type": "Try", "_fields": {"body": [{"_type": "If", "_fields": {"body": [{"_type": "Return", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Name", "_fields": {"id": "responseString", "ctx": {"_type": "Load", "_fields": {}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "raw_to_json", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}], "test": {"_type": "Compare", "_fields": {"ops": [{"_type": "Eq", "_fields": {}}], "left": {"_type": "Name", "_fields": {"id": "_format", "ctx": {"_type": "Load", "_fields": {}}}}, "comparators": [{"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "FORMAT_JSON", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}]}}, "orelse": []}}, {"_type": "If", "_fields": {"body": [{"_type": "Return", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Name", "_fields": {"id": "responseString", "ctx": {"_type": "Load", "_fields": {}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "parseString", "value": {"_type": "Name", "_fields": {"id": "xml", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}], "test": {"_type": "Compare", "_fields": {"ops": [{"_type": "Eq", "_fields": {}}], "left": {"_type": "Name", "_fields": {"id": "_format", "ctx": {"_type": "Load", "_fields": {}}}}, "comparators": [{"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "FORMAT_XML", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}]}}, "orelse": []}}, {"_type": "Return", "_fields": {"value": {"_type": "Name", "_fields": {"id": "responseString", "ctx": {"_type": "Load", "_fields": {}}}}}}], "orelse": [], "handlers": [{"_type": "ExceptHandler", "_fields": {"body": [{"_type": "Raise", "_fields": {"exc": null, "cause": null}}, {"_type": "Pass", "_fields": {}}], "name": null, "type": {"_type": "Name", "_fields": {"id": "Exception", "ctx": {"_type": "Load", "_fields": {}}}}}}], "finalbody": []}}], "name": "transformResponse", "returns": null, "type_params": [], "type_comment": null, "decorator_list": []}}], "type_ignores": []}}
def transformResponse(self, _format, responseString): try: if _format == self.FORMAT_JSON: return self.raw_to_json(responseString) if _format == self.FORMAT_XML: return xml.parseString(responseString) return responseString except Exception: # TODO: Pass up some informative error raise pass
14,130
[ 0.031107796356081963, 0.005118948873132467, 0.037063118070364, -0.005000718403607607, 0.042422905564308167, -0.0019453320419415832, 0.043789129704236984, -0.030477233231067657, -0.03608224168419838, -0.03035462275147438, -0.012733878567814827, -0.044384658336639404, 0.020633436739444733, -...
10
{"_type": "Module", "_fields": {"body": [{"_type": "ClassDef", "_fields": {"body": [{"_type": "Assign", "_fields": {"value": {"_type": "Constant", "_fields": {"kind": null, "value": "datetime"}}, "targets": [{"_type": "Name", "_fields": {"id": "name", "ctx": {"_type": "Store", "_fields": {}}}}], "type_comment": null}}, {"_type": "Assign", "_fields": {"value": {"_type": "Constant", "_fields": {"kind": null, "value": true}}, "targets": [{"_type": "Name", "_fields": {"id": "_coerce", "ctx": {"_type": "Store", "_fields": {}}}}], "type_comment": null}}, {"_type": "Assign", "_fields": {"value": {"_type": "Dict", "_fields": {"keys": [{"_type": "Constant", "_fields": {"kind": null, "value": "type"}}, {"_type": "Constant", "_fields": {"kind": null, "value": "format"}}], "values": [{"_type": "Constant", "_fields": {"kind": null, "value": "date"}}, {"_type": "Constant", "_fields": {"kind": null, "value": "dateOptionalTime"}}]}}, "targets": [{"_type": "Name", "_fields": {"id": "_custom_mapping", "ctx": {"_type": "Store", "_fields": {}}}}], "type_comment": null}}, {"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "data", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}}, "body": [{"_type": "If", "_fields": {"body": [{"_type": "Return", "_fields": {"value": {"_type": "Constant", "_fields": {"kind": null, "value": null}}}}], "test": {"_type": "UnaryOp", "_fields": {"op": {"_type": "Not", "_fields": {}}, "operand": {"_type": "Name", "_fields": {"id": "data", "ctx": {"_type": "Load", "_fields": {}}}}}}, "orelse": []}}, {"_type": "If", "_fields": {"body": [{"_type": "Return", "_fields": {"value": {"_type": "Name", "_fields": {"id": "data", "ctx": {"_type": "Load", "_fields": {}}}}}}], "test": {"_type": "Call", "_fields": {"args": [{"_type": "Name", "_fields": {"id": "data", "ctx": {"_type": "Load", "_fields": {}}}}, {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "datetime", "value": {"_type": "Name", "_fields": {"id": "datetime", "ctx": {"_type": "Load", "_fields": {}}}}}}], "func": {"_type": "Name", "_fields": {"id": "isinstance", "ctx": {"_type": "Load", "_fields": {}}}}, "keywords": []}}, "orelse": []}}, {"_type": "Try", "_fields": {"body": [{"_type": "Return", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Name", "_fields": {"id": "data", "ctx": {"_type": "Load", "_fields": {}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "parse", "value": {"_type": "Name", "_fields": {"id": "parser", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}], "orelse": [], "handlers": [{"_type": "ExceptHandler", "_fields": {"body": [{"_type": "Raise", "_fields": {"exc": {"_type": "Call", "_fields": {"args": [{"_type": "BinOp", "_fields": {"op": {"_type": "Mod", "_fields": {}}, "left": {"_type": "Constant", "_fields": {"kind": null, "value": "Could not parse datetime from the value (%r)"}}, "right": {"_type": "Name", "_fields": {"id": "data", "ctx": {"_type": "Load", "_fields": {}}}}}}, {"_type": "Name", "_fields": {"id": "e", "ctx": {"_type": "Load", "_fields": {}}}}], "func": {"_type": "Name", "_fields": {"id": "ValidationException", "ctx": {"_type": "Load", "_fields": {}}}}, "keywords": []}}, "cause": null}}], "name": "e", "type": {"_type": "Name", "_fields": {"id": "Exception", "ctx": {"_type": "Load", "_fields": {}}}}}}], "finalbody": []}}], "name": "_to_python", "returns": null, "type_params": [], "type_comment": null, "decorator_list": []}}], "name": "DateTimeField", "bases": [{"_type": "Name", "_fields": {"id": "CustomMappingMixin", "ctx": {"_type": "Load", "_fields": {}}}}, {"_type": "Name", "_fields": {"id": "BaseFieldMixin", "ctx": {"_type": "Load", "_fields": {}}}}, {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "Field", "value": {"_type": "Name", "_fields": {"id": "field", "ctx": {"_type": "Load", "_fields": {}}}}}}], "keywords": [], "type_params": [], "decorator_list": []}}], "type_ignores": []}}
class DateTimeField(CustomMappingMixin, BaseFieldMixin, field.Field): name = 'datetime' _coerce = True _custom_mapping = {'type': 'date', 'format': 'dateOptionalTime'} def _to_python(self, data): if not data: return None if isinstance(data, datetime.datetime): return data try: return parser.parse(data) except Exception as e: raise ValidationException( 'Could not parse datetime from the value (%r)' % data, e)
14,131
[ 0.037267692387104034, 0.049717288464307785, 0.038828957825899124, -0.03325299918651581, 0.02423008158802986, -0.007233540993183851, -0.006534011568874121, 0.01873522624373436, -0.04517541453242302, 0.015693793073296547, -0.00965654943138361, -0.01437583938241005, -0.014244044199585915, 0.0...
10
{"_type": "Module", "_fields": {"body": [{"_type": "ClassDef", "_fields": {"body": [{"_type": "Assign", "_fields": {"value": {"_type": "Tuple", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "elts": [{"_type": "Constant", "_fields": {"kind": null, "value": "primary_key"}}, {"_type": "Constant", "_fields": {"kind": null, "value": "required"}}, {"_type": "Constant", "_fields": {"kind": null, "value": "multi"}}]}}, "targets": [{"_type": "Name", "_fields": {"id": "_valid_kwargs", "ctx": {"_type": "Store", "_fields": {}}}}], "type_comment": null}}, {"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": {"_type": "arg", "_fields": {"arg": "kwargs", "annotation": null, "type_comment": null}}, "vararg": {"_type": "arg", "_fields": {"arg": "args", "annotation": null, "type_comment": null}}, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}}, "body": [{"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"args": [], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "copy", "value": {"_type": "Name", "_fields": {"id": "kwargs", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}, "targets": [{"_type": "Attribute", "_fields": {"ctx": {"_type": "Store", "_fields": {}}, "attr": "_init_kwargs", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}], "type_comment": null}}, {"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Name", "_fields": {"id": "kwargs", "ctx": {"_type": "Load", "_fields": {}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "drop_invalid_kwargs", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}, "targets": [{"_type": "Name", "_fields": {"id": "kwargs", "ctx": {"_type": "Store", "_fields": {}}}}], "type_comment": null}}, {"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"kind": null, "value": "primary_key"}}, {"_type": "Constant", "_fields": {"kind": null, "value": false}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "pop", "value": {"_type": "Name", "_fields": {"id": "kwargs", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}, "targets": [{"_type": "Attribute", "_fields": {"ctx": {"_type": "Store", "_fields": {}}, "attr": "_primary_key", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}], "type_comment": null}}, {"_type": "If", "_fields": {"body": [{"_type": "Assign", "_fields": {"value": {"_type": "Constant", "_fields": {"kind": null, "value": true}}, "targets": [{"_type": "Subscript", "_fields": {"ctx": {"_type": "Store", "_fields": {}}, "slice": {"_type": "Constant", "_fields": {"kind": null, "value": "required"}}, "value": {"_type": "Name", "_fields": {"id": "kwargs", "ctx": {"_type": "Load", "_fields": {}}}}}}], "type_comment": null}}], "test": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "_primary_key", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}, "orelse": []}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Starred", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "value": {"_type": "Name", "_fields": {"id": "args", "ctx": {"_type": "Load", "_fields": {}}}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "__init__", "value": {"_type": "Call", "_fields": {"args": [{"_type": "Name", "_fields": {"id": "BaseFieldMixin", "ctx": {"_type": "Load", "_fields": {}}}}, {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}], "func": {"_type": "Name", "_fields": {"id": "super", "ctx": {"_type": "Load", "_fields": {}}}}, "keywords": []}}}}, "keywords": [{"_type": "keyword", "_fields": {"arg": null, "value": {"_type": "Name", "_fields": {"id": "kwargs", "ctx": {"_type": "Load", "_fields": {}}}}}}]}}}}], "name": "__init__", "returns": null, "type_params": [], "type_comment": null, "decorator_list": []}}, {"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "kwargs", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}}, "body": [{"_type": "Return", "_fields": {"value": {"_type": "DictComp", "_fields": {"key": {"_type": "Name", "_fields": {"id": "key", "ctx": {"_type": "Load", "_fields": {}}}}, "value": {"_type": "Name", "_fields": {"id": "val", "ctx": {"_type": "Load", "_fields": {}}}}, "generators": [{"_type": "comprehension", "_fields": {"ifs": [{"_type": "Compare", "_fields": {"ops": [{"_type": "In", "_fields": {}}], "left": {"_type": "Name", "_fields": {"id": "key", "ctx": {"_type": "Load", "_fields": {}}}}, "comparators": [{"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "_valid_kwargs", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}]}}], "iter": {"_type": "Call", "_fields": {"args": [], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "items", "value": {"_type": "Name", "_fields": {"id": "kwargs", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}, "target": {"_type": "Tuple", "_fields": {"ctx": {"_type": "Store", "_fields": {}}, "elts": [{"_type": "Name", "_fields": {"id": "key", "ctx": {"_type": "Store", "_fields": {}}}}, {"_type": "Name", "_fields": {"id": "val", "ctx": {"_type": "Store", "_fields": {}}}}]}}, "is_async": 0}}]}}}}], "name": "drop_invalid_kwargs", "returns": null, "type_params": [], "type_comment": null, "decorator_list": []}}], "name": "BaseFieldMixin", "bases": [{"_type": "Name", "_fields": {"id": "object", "ctx": {"_type": "Load", "_fields": {}}}}], "keywords": [], "type_params": [], "decorator_list": []}}], "type_ignores": []}}
class BaseFieldMixin(object): _valid_kwargs = ('primary_key', 'required', 'multi') def __init__(self, *args, **kwargs): self._init_kwargs = kwargs.copy() kwargs = self.drop_invalid_kwargs(kwargs) self._primary_key = kwargs.pop('primary_key', False) if self._primary_key: kwargs['required'] = True super(BaseFieldMixin, self).__init__(*args, **kwargs) def drop_invalid_kwargs(self, kwargs): return {key: val for key, val in kwargs.items() if key in self._valid_kwargs}
14,132
[ 0.03245697170495987, 0.02172018215060234, 0.014084921218454838, -0.009181282483041286, 0.022327208891510963, -0.03317781537771225, 0.010803181678056717, -0.009461083449423313, -0.03418320417404175, -0.049093302339315414, -0.001975208753719926, -0.02784735895693302, 0.010480699129402637, -0...
11
{"_type": "Module", "_fields": {"body": [{"_type": "ClassDef", "_fields": {"body": [{"_type": "Assign", "_fields": {"value": {"_type": "Constant", "_fields": {"kind": null, "value": "time"}}, "targets": [{"_type": "Name", "_fields": {"id": "name", "ctx": {"_type": "Store", "_fields": {}}}}], "type_comment": null}}, {"_type": "Assign", "_fields": {"value": {"_type": "Constant", "_fields": {"kind": null, "value": true}}, "targets": [{"_type": "Name", "_fields": {"id": "_coerce", "ctx": {"_type": "Store", "_fields": {}}}}], "type_comment": null}}, {"_type": "Assign", "_fields": {"value": {"_type": "Dict", "_fields": {"keys": [{"_type": "Constant", "_fields": {"kind": null, "value": "type"}}, {"_type": "Constant", "_fields": {"kind": null, "value": "format"}}], "values": [{"_type": "Constant", "_fields": {"kind": null, "value": "date"}}, {"_type": "Constant", "_fields": {"kind": null, "value": "HH:mm:ss"}}]}}, "targets": [{"_type": "Name", "_fields": {"id": "_custom_mapping", "ctx": {"_type": "Store", "_fields": {}}}}], "type_comment": null}}, {"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "data", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}}, "body": [{"_type": "If", "_fields": {"body": [{"_type": "Return", "_fields": {"value": {"_type": "Constant", "_fields": {"kind": null, "value": null}}}}], "test": {"_type": "UnaryOp", "_fields": {"op": {"_type": "Not", "_fields": {}}, "operand": {"_type": "Name", "_fields": {"id": "data", "ctx": {"_type": "Load", "_fields": {}}}}}}, "orelse": []}}, {"_type": "If", "_fields": {"body": [{"_type": "Return", "_fields": {"value": {"_type": "Name", "_fields": {"id": "data", "ctx": {"_type": "Load", "_fields": {}}}}}}], "test": {"_type": "Call", "_fields": {"args": [{"_type": "Name", "_fields": {"id": "data", "ctx": {"_type": "Load", "_fields": {}}}}, {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "time", "value": {"_type": "Name", "_fields": {"id": "datetime", "ctx": {"_type": "Load", "_fields": {}}}}}}], "func": {"_type": "Name", "_fields": {"id": "isinstance", "ctx": {"_type": "Load", "_fields": {}}}}, "keywords": []}}, "orelse": []}}, {"_type": "If", "_fields": {"body": [{"_type": "Return", "_fields": {"value": {"_type": "Call", "_fields": {"args": [], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "time", "value": {"_type": "Name", "_fields": {"id": "data", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}], "test": {"_type": "Call", "_fields": {"args": [{"_type": "Name", "_fields": {"id": "data", "ctx": {"_type": "Load", "_fields": {}}}}, {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "datetime", "value": {"_type": "Name", "_fields": {"id": "datetime", "ctx": {"_type": "Load", "_fields": {}}}}}}], "func": {"_type": "Name", "_fields": {"id": "isinstance", "ctx": {"_type": "Load", "_fields": {}}}}, "keywords": []}}, "orelse": []}}, {"_type": "Try", "_fields": {"body": [{"_type": "Return", "_fields": {"value": {"_type": "Call", "_fields": {"args": [], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "time", "value": {"_type": "Call", "_fields": {"args": [{"_type": "Name", "_fields": {"id": "data", "ctx": {"_type": "Load", "_fields": {}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "parse", "value": {"_type": "Name", "_fields": {"id": "parser", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, "keywords": []}}}}], "orelse": [], "handlers": [{"_type": "ExceptHandler", "_fields": {"body": [{"_type": "Raise", "_fields": {"exc": {"_type": "Call", "_fields": {"args": [{"_type": "BinOp", "_fields": {"op": {"_type": "Mod", "_fields": {}}, "left": {"_type": "Constant", "_fields": {"kind": null, "value": "Could not parse time from the value (%r)"}}, "right": {"_type": "Name", "_fields": {"id": "data", "ctx": {"_type": "Load", "_fields": {}}}}}}, {"_type": "Name", "_fields": {"id": "e", "ctx": {"_type": "Load", "_fields": {}}}}], "func": {"_type": "Name", "_fields": {"id": "ValidationException", "ctx": {"_type": "Load", "_fields": {}}}}, "keywords": []}}, "cause": null}}], "name": "e", "type": {"_type": "Name", "_fields": {"id": "Exception", "ctx": {"_type": "Load", "_fields": {}}}}}}], "finalbody": []}}], "name": "_to_python", "returns": null, "type_params": [], "type_comment": null, "decorator_list": []}}], "name": "TimeField", "bases": [{"_type": "Name", "_fields": {"id": "CustomMappingMixin", "ctx": {"_type": "Load", "_fields": {}}}}, {"_type": "Name", "_fields": {"id": "BaseFieldMixin", "ctx": {"_type": "Load", "_fields": {}}}}, {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "Field", "value": {"_type": "Name", "_fields": {"id": "field", "ctx": {"_type": "Load", "_fields": {}}}}}}], "keywords": [], "type_params": [], "decorator_list": []}}], "type_ignores": []}}
class TimeField(CustomMappingMixin, BaseFieldMixin, field.Field): name = 'time' _coerce = True _custom_mapping = {'type': 'date', 'format': 'HH:mm:ss'} def _to_python(self, data): if not data: return None if isinstance(data, datetime.time): return data if isinstance(data, datetime.datetime): return data.time() try: return parser.parse(data).time() except Exception as e: raise ValidationException( 'Could not parse time from the value (%r)' % data, e)
14,133
[ -0.02878907136619091, -0.012951474636793137, 0.04109117016196251, -0.02245764061808586, 0.04192093014717102, -0.0038511697202920914, -0.024117160588502884, 0.0011657228460535407, 0.02579472027719021, -0.002570452867075801, 0.02543395385146141, -0.01746104098856449, 0.007751944474875927, -0...
9
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "data", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}}, "body": [{"_type": "If", "_fields": {"body": [{"_type": "Return", "_fields": {"value": {"_type": "Constant", "_fields": {"kind": null, "value": null}}}}], "test": {"_type": "UnaryOp", "_fields": {"op": {"_type": "Not", "_fields": {}}, "operand": {"_type": "Name", "_fields": {"id": "data", "ctx": {"_type": "Load", "_fields": {}}}}}}, "orelse": []}}, {"_type": "If", "_fields": {"body": [{"_type": "Return", "_fields": {"value": {"_type": "Name", "_fields": {"id": "data", "ctx": {"_type": "Load", "_fields": {}}}}}}], "test": {"_type": "Call", "_fields": {"args": [{"_type": "Name", "_fields": {"id": "data", "ctx": {"_type": "Load", "_fields": {}}}}, {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "datetime", "value": {"_type": "Name", "_fields": {"id": "datetime", "ctx": {"_type": "Load", "_fields": {}}}}}}], "func": {"_type": "Name", "_fields": {"id": "isinstance", "ctx": {"_type": "Load", "_fields": {}}}}, "keywords": []}}, "orelse": []}}, {"_type": "Try", "_fields": {"body": [{"_type": "Return", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Name", "_fields": {"id": "data", "ctx": {"_type": "Load", "_fields": {}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "parse", "value": {"_type": "Name", "_fields": {"id": "parser", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}], "orelse": [], "handlers": [{"_type": "ExceptHandler", "_fields": {"body": [{"_type": "Raise", "_fields": {"exc": {"_type": "Call", "_fields": {"args": [{"_type": "BinOp", "_fields": {"op": {"_type": "Mod", "_fields": {}}, "left": {"_type": "Constant", "_fields": {"kind": null, "value": "Could not parse datetime from the value (%r)"}}, "right": {"_type": "Name", "_fields": {"id": "data", "ctx": {"_type": "Load", "_fields": {}}}}}}, {"_type": "Name", "_fields": {"id": "e", "ctx": {"_type": "Load", "_fields": {}}}}], "func": {"_type": "Name", "_fields": {"id": "ValidationException", "ctx": {"_type": "Load", "_fields": {}}}}, "keywords": []}}, "cause": null}}], "name": "e", "type": {"_type": "Name", "_fields": {"id": "Exception", "ctx": {"_type": "Load", "_fields": {}}}}}}], "finalbody": []}}], "name": "_to_python", "returns": null, "type_params": [], "type_comment": null, "decorator_list": []}}], "type_ignores": []}}
def _to_python(self, data): if not data: return None if isinstance(data, datetime.datetime): return data try: return parser.parse(data) except Exception as e: raise ValidationException( 'Could not parse datetime from the value (%r)' % data, e)
14,134
[ -0.02406262420117855, -0.007474271580576897, 0.026073884218931198, -0.023011697456240654, 0.02668994478881359, -0.009802620857954025, -0.0316365547478199, -0.0015061789890751243, 0.038485705852508545, -0.021761454641819, 0.023029815405607224, -0.0022366191260516644, 0.006033775862306356, -...
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": "data", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}}, "body": [{"_type": "If", "_fields": {"body": [{"_type": "Return", "_fields": {"value": {"_type": "Constant", "_fields": {"kind": null, "value": null}}}}], "test": {"_type": "UnaryOp", "_fields": {"op": {"_type": "Not", "_fields": {}}, "operand": {"_type": "Name", "_fields": {"id": "data", "ctx": {"_type": "Load", "_fields": {}}}}}}, "orelse": []}}, {"_type": "If", "_fields": {"body": [{"_type": "Return", "_fields": {"value": {"_type": "Name", "_fields": {"id": "data", "ctx": {"_type": "Load", "_fields": {}}}}}}], "test": {"_type": "Call", "_fields": {"args": [{"_type": "Name", "_fields": {"id": "data", "ctx": {"_type": "Load", "_fields": {}}}}, {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "time", "value": {"_type": "Name", "_fields": {"id": "datetime", "ctx": {"_type": "Load", "_fields": {}}}}}}], "func": {"_type": "Name", "_fields": {"id": "isinstance", "ctx": {"_type": "Load", "_fields": {}}}}, "keywords": []}}, "orelse": []}}, {"_type": "If", "_fields": {"body": [{"_type": "Return", "_fields": {"value": {"_type": "Call", "_fields": {"args": [], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "time", "value": {"_type": "Name", "_fields": {"id": "data", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}], "test": {"_type": "Call", "_fields": {"args": [{"_type": "Name", "_fields": {"id": "data", "ctx": {"_type": "Load", "_fields": {}}}}, {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "datetime", "value": {"_type": "Name", "_fields": {"id": "datetime", "ctx": {"_type": "Load", "_fields": {}}}}}}], "func": {"_type": "Name", "_fields": {"id": "isinstance", "ctx": {"_type": "Load", "_fields": {}}}}, "keywords": []}}, "orelse": []}}, {"_type": "Try", "_fields": {"body": [{"_type": "Return", "_fields": {"value": {"_type": "Call", "_fields": {"args": [], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "time", "value": {"_type": "Call", "_fields": {"args": [{"_type": "Name", "_fields": {"id": "data", "ctx": {"_type": "Load", "_fields": {}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "parse", "value": {"_type": "Name", "_fields": {"id": "parser", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, "keywords": []}}}}], "orelse": [], "handlers": [{"_type": "ExceptHandler", "_fields": {"body": [{"_type": "Raise", "_fields": {"exc": {"_type": "Call", "_fields": {"args": [{"_type": "BinOp", "_fields": {"op": {"_type": "Mod", "_fields": {}}, "left": {"_type": "Constant", "_fields": {"kind": null, "value": "Could not parse time from the value (%r)"}}, "right": {"_type": "Name", "_fields": {"id": "data", "ctx": {"_type": "Load", "_fields": {}}}}}}, {"_type": "Name", "_fields": {"id": "e", "ctx": {"_type": "Load", "_fields": {}}}}], "func": {"_type": "Name", "_fields": {"id": "ValidationException", "ctx": {"_type": "Load", "_fields": {}}}}, "keywords": []}}, "cause": null}}], "name": "e", "type": {"_type": "Name", "_fields": {"id": "Exception", "ctx": {"_type": "Load", "_fields": {}}}}}}], "finalbody": []}}], "name": "_to_python", "returns": null, "type_params": [], "type_comment": null, "decorator_list": []}}], "type_ignores": []}}
def _to_python(self, data): if not data: return None if isinstance(data, datetime.time): return data if isinstance(data, datetime.datetime): return data.time() try: return parser.parse(data).time() except Exception as e: raise ValidationException( 'Could not parse time from the value (%r)' % data, e)
14,135
[ 0.032799169421195984, 0.022465184330940247, -0.00038516303175128996, 0.0015010826755315065, 0.0029894011095166206, 0.035944294184446335, 0.0053507983684539795, 0.010272716172039509, -0.06996883451938629, 0.026896951720118523, -0.0005089768092148006, 0.009644711390137672, -0.00915966834872961...
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": "doc_class", "annotation": null, "type_comment": null}}], "kwarg": {"_type": "arg", "_fields": {"arg": "kwargs", "annotation": null, "type_comment": null}}, "vararg": {"_type": "arg", "_fields": {"arg": "args", "annotation": null, "type_comment": null}}, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}}, "body": [{"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "_backref_prefix", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}], "func": {"_type": "Name", "_fields": {"id": "len", "ctx": {"_type": "Load", "_fields": {}}}}, "keywords": []}}, "targets": [{"_type": "Name", "_fields": {"id": "prefix_len", "ctx": {"_type": "Store", "_fields": {}}}}], "type_comment": null}}, {"_type": "Assign", "_fields": {"value": {"_type": "DictComp", "_fields": {"key": {"_type": "Subscript", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "slice": {"_type": "Slice", "_fields": {"step": null, "lower": {"_type": "Name", "_fields": {"id": "prefix_len", "ctx": {"_type": "Load", "_fields": {}}}}, "upper": null}}, "value": {"_type": "Name", "_fields": {"id": "key", "ctx": {"_type": "Load", "_fields": {}}}}}}, "value": {"_type": "Name", "_fields": {"id": "val", "ctx": {"_type": "Load", "_fields": {}}}}, "generators": [{"_type": "comprehension", "_fields": {"ifs": [{"_type": "Call", "_fields": {"args": [{"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "_backref_prefix", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "startswith", "value": {"_type": "Name", "_fields": {"id": "key", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}], "iter": {"_type": "Call", "_fields": {"args": [], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "items", "value": {"_type": "Name", "_fields": {"id": "kwargs", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}, "target": {"_type": "Tuple", "_fields": {"ctx": {"_type": "Store", "_fields": {}}, "elts": [{"_type": "Name", "_fields": {"id": "key", "ctx": {"_type": "Store", "_fields": {}}}}, {"_type": "Name", "_fields": {"id": "val", "ctx": {"_type": "Store", "_fields": {}}}}]}}, "is_async": 0}}]}}, "targets": [{"_type": "Attribute", "_fields": {"ctx": {"_type": "Store", "_fields": {}}, "attr": "_backref_kwargs", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}], "type_comment": null}}, {"_type": "For", "_fields": {"body": [{"_type": "Delete", "_fields": {"targets": [{"_type": "Subscript", "_fields": {"ctx": {"_type": "Del", "_fields": {}}, "slice": {"_type": "BinOp", "_fields": {"op": {"_type": "Add", "_fields": {}}, "left": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "_backref_prefix", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}, "right": {"_type": "Name", "_fields": {"id": "key", "ctx": {"_type": "Load", "_fields": {}}}}}}, "value": {"_type": "Name", "_fields": {"id": "kwargs", "ctx": {"_type": "Load", "_fields": {}}}}}}]}}], "iter": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "_backref_kwargs", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}, "orelse": [], "target": {"_type": "Name", "_fields": {"id": "key", "ctx": {"_type": "Store", "_fields": {}}}}, "type_comment": null}}, {"_type": "Assign", "_fields": {"value": {"_type": "Name", "_fields": {"id": "doc_class", "ctx": {"_type": "Load", "_fields": {}}}}, "targets": [{"_type": "Attribute", "_fields": {"ctx": {"_type": "Store", "_fields": {}}, "attr": "_doc_class", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}], "type_comment": null}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Starred", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "value": {"_type": "Name", "_fields": {"id": "args", "ctx": {"_type": "Load", "_fields": {}}}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "__init__", "value": {"_type": "Call", "_fields": {"args": [{"_type": "Name", "_fields": {"id": "ReferenceField", "ctx": {"_type": "Load", "_fields": {}}}}, {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}], "func": {"_type": "Name", "_fields": {"id": "super", "ctx": {"_type": "Load", "_fields": {}}}}, "keywords": []}}}}, "keywords": [{"_type": "keyword", "_fields": {"arg": null, "value": {"_type": "Name", "_fields": {"id": "kwargs", "ctx": {"_type": "Load", "_fields": {}}}}}}]}}}}], "name": "__init__", "returns": null, "type_params": [], "type_comment": null, "decorator_list": []}}], "type_ignores": []}}
def __init__(self, doc_class, *args, **kwargs): prefix_len = len(self._backref_prefix) self._backref_kwargs = { key[prefix_len:]: val for key, val in kwargs.items() if key.startswith(self._backref_prefix)} for key in self._backref_kwargs: del kwargs[self._backref_prefix + key] self._doc_class = doc_class super(ReferenceField, self).__init__(*args, **kwargs)
14,136
[ -0.009394603781402111, 0.06289180368185043, 0.006104534026235342, 0.010239502415060997, -0.028379647061228752, 0.028066307306289673, 0.026051979511976242, -0.0005343565135262907, -0.06374230235815048, 0.01912492886185646, 0.000593457487411797, -0.038697484880685806, 0.003715316765010357, 0...
7
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "document", "annotation": null, "type_comment": null}}], "kwarg": {"_type": "arg", "_fields": {"arg": "kwargs", "annotation": null, "type_comment": null}}, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}}, "body": [{"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"args": [], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "copy", "value": {"_type": "Name", "_fields": {"id": "kwargs", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}, "targets": [{"_type": "Name", "_fields": {"id": "_init_kwargs", "ctx": {"_type": "Store", "_fields": {}}}}], "type_comment": null}}, {"_type": "Assign", "_fields": {"value": {"_type": "Name", "_fields": {"id": "document", "ctx": {"_type": "Load", "_fields": {}}}}, "targets": [{"_type": "Subscript", "_fields": {"ctx": {"_type": "Store", "_fields": {}}, "slice": {"_type": "Constant", "_fields": {"kind": null, "value": "document"}}, "value": {"_type": "Name", "_fields": {"id": "_init_kwargs", "ctx": {"_type": "Load", "_fields": {}}}}}}], "type_comment": null}}, {"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"kind": null, "value": "uselist"}}, {"_type": "Constant", "_fields": {"kind": null, "value": true}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "pop", "value": {"_type": "Name", "_fields": {"id": "kwargs", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}, "targets": [{"_type": "Subscript", "_fields": {"ctx": {"_type": "Store", "_fields": {}}, "slice": {"_type": "Constant", "_fields": {"kind": null, "value": "multi"}}, "value": {"_type": "Name", "_fields": {"id": "kwargs", "ctx": {"_type": "Load", "_fields": {}}}}}}], "type_comment": null}}, {"_type": "Assign", "_fields": {"value": {"_type": "Name", "_fields": {"id": "document", "ctx": {"_type": "Load", "_fields": {}}}}, "targets": [{"_type": "Subscript", "_fields": {"ctx": {"_type": "Store", "_fields": {}}, "slice": {"_type": "Constant", "_fields": {"kind": null, "value": "doc_class"}}, "value": {"_type": "Name", "_fields": {"id": "kwargs", "ctx": {"_type": "Load", "_fields": {}}}}}}], "type_comment": null}}, {"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"args": [], "func": {"_type": "Name", "_fields": {"id": "ReferenceField", "ctx": {"_type": "Load", "_fields": {}}}}, "keywords": [{"_type": "keyword", "_fields": {"arg": null, "value": {"_type": "Name", "_fields": {"id": "kwargs", "ctx": {"_type": "Load", "_fields": {}}}}}}]}}, "targets": [{"_type": "Name", "_fields": {"id": "field", "ctx": {"_type": "Store", "_fields": {}}}}], "type_comment": null}}, {"_type": "Assign", "_fields": {"value": {"_type": "Name", "_fields": {"id": "_init_kwargs", "ctx": {"_type": "Load", "_fields": {}}}}, "targets": [{"_type": "Attribute", "_fields": {"ctx": {"_type": "Store", "_fields": {}}, "attr": "_init_kwargs", "value": {"_type": "Name", "_fields": {"id": "field", "ctx": {"_type": "Load", "_fields": {}}}}}}], "type_comment": null}}, {"_type": "Return", "_fields": {"value": {"_type": "Name", "_fields": {"id": "field", "ctx": {"_type": "Load", "_fields": {}}}}}}], "name": "Relationship", "returns": null, "type_params": [], "type_comment": null, "decorator_list": []}}], "type_ignores": []}}
def Relationship(document, **kwargs): # XXX deal with updating, deleting rules _init_kwargs = kwargs.copy() _init_kwargs['document'] = document kwargs['multi'] = kwargs.pop('uselist', True) kwargs['doc_class'] = document field = ReferenceField(**kwargs) field._init_kwargs = _init_kwargs return field
14,137
[ 0.016989652067422867, -0.015167845413088799, 0.02450590766966343, -0.00014078339154366404, 0.021861685439944267, -0.02227809838950634, -0.007271612994372845, 0.01683349721133709, 0.02084147371351719, 0.05446682870388031, 0.011586693115532398, 0.0085885189473629, 0.04747108742594719, -0.052...
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": "_all", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [{"_type": "Constant", "_fields": {"kind": null, "value": true}}], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}}, "body": [{"_type": "Assign", "_fields": {"value": {"_type": "List", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "elts": []}}, "targets": [{"_type": "Name", "_fields": {"id": "containers", "ctx": {"_type": "Store", "_fields": {}}}}], "type_comment": null}}, {"_type": "For", "_fields": {"body": [{"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Dict", "_fields": {"keys": [{"_type": "Constant", "_fields": {"kind": null, "value": "Status"}}, {"_type": "Constant", "_fields": {"kind": null, "value": "Created"}}, {"_type": "Constant", "_fields": {"kind": null, "value": "Image"}}, {"_type": "Constant", "_fields": {"kind": null, "value": "Ports"}}, {"_type": "Constant", "_fields": {"kind": null, "value": "Command"}}, {"_type": "Constant", "_fields": {"kind": null, "value": "Id"}}], "values": [{"_type": "Constant", "_fields": {"kind": null, "value": "Exit 0"}}, {"_type": "Call", "_fields": {"args": [{"_type": "Call", "_fields": {"args": [], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "time", "value": {"_type": "Name", "_fields": {"id": "time", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}], "func": {"_type": "Name", "_fields": {"id": "int", "ctx": {"_type": "Load", "_fields": {}}}}, "keywords": []}}, {"_type": "Constant", "_fields": {"kind": null, "value": "ubuntu:12.04"}}, {"_type": "Constant", "_fields": {"kind": null, "value": ""}}, {"_type": "Constant", "_fields": {"kind": null, "value": "bash "}}, {"_type": "Name", "_fields": {"id": "container_id", "ctx": {"_type": "Load", "_fields": {}}}}]}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "append", "value": {"_type": "Name", "_fields": {"id": "containers", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}], "iter": {"_type": "Call", "_fields": {"args": [], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "iterkeys", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "_containers", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}}}, "keywords": []}}, "orelse": [], "target": {"_type": "Name", "_fields": {"id": "container_id", "ctx": {"_type": "Store", "_fields": {}}}}, "type_comment": null}}, {"_type": "Return", "_fields": {"value": {"_type": "Name", "_fields": {"id": "containers", "ctx": {"_type": "Load", "_fields": {}}}}}}], "name": "list_containers", "returns": null, "type_params": [], "type_comment": null, "decorator_list": []}}], "type_ignores": []}}
def list_containers(self, _all=True): containers = [] for container_id in self._containers.iterkeys(): containers.append({ 'Status': 'Exit 0', 'Created': int(time.time()), 'Image': 'ubuntu:12.04', 'Ports': '', 'Command': 'bash ', 'Id': container_id }) return containers
14,138
[ 0.033433638513088226, -0.0011415553744882345, -0.03368779644370079, -0.002417411422356963, 0.00012545556819532067, -0.008000274188816547, 0.01401347666978836, 0.012950624339282513, -0.004528675228357315, -0.014591114595532417, 0.000037749490729765967, -0.012245907448232174, 0.043877318501472...
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": "image_name", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}}, "body": [{"_type": "If", "_fields": {"body": [{"_type": "Return", "_fields": {"value": {"_type": "Constant", "_fields": {"kind": null, "value": null}}}}], "test": {"_type": "UnaryOp", "_fields": {"op": {"_type": "Not", "_fields": {}}, "operand": {"_type": "Call", "_fields": {"args": [{"_type": "Name", "_fields": {"id": "image_name", "ctx": {"_type": "Load", "_fields": {}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "_is_image_exists", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, "orelse": []}}, {"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Name", "_fields": {"id": "image_name", "ctx": {"_type": "Load", "_fields": {}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "_image_name", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}, "targets": [{"_type": "Name", "_fields": {"id": "image_name", "ctx": {"_type": "Store", "_fields": {}}}}], "type_comment": null}}, {"_type": "If", "_fields": {"body": [{"_type": "Return", "_fields": {"value": {"_type": "Subscript", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "slice": {"_type": "Name", "_fields": {"id": "image_name", "ctx": {"_type": "Load", "_fields": {}}}}, "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "_pulled_images", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}}}}}], "test": {"_type": "Compare", "_fields": {"ops": [{"_type": "In", "_fields": {}}], "left": {"_type": "Name", "_fields": {"id": "image_name", "ctx": {"_type": "Load", "_fields": {}}}}, "comparators": [{"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "_pulled_images", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}]}}, "orelse": []}}, {"_type": "Return", "_fields": {"value": {"_type": "Dict", "_fields": {"keys": [{"_type": "Constant", "_fields": {"kind": null, "value": "container_config"}}], "values": [{"_type": "Dict", "_fields": {"keys": [{"_type": "Constant", "_fields": {"kind": null, "value": "Cmd"}}], "values": [{"_type": "Constant", "_fields": {"kind": null, "value": null}}]}}]}}}}], "name": "inspect_image", "returns": null, "type_params": [], "type_comment": null, "decorator_list": []}}], "type_ignores": []}}
def inspect_image(self, image_name): if not self._is_image_exists(image_name): return None image_name = self._image_name(image_name) if image_name in self._pulled_images: return self._pulled_images[image_name] return {'container_config': {'Cmd': None}}
14,139
[ 0.03424029052257538, 0.01075771264731884, 0.005949706304818392, 0.027336489409208298, -0.017945600673556328, -0.04095113277435303, 0.0022713406942784786, 0.003599304473027587, -0.02043268457055092, 0.012574784457683563, 0.02703632414340973, 0.03672737628221512, 0.06693688035011292, -0.0418...
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": "args", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "name", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}}, "body": [{"_type": "Assign", "_fields": {"value": {"_type": "Name", "_fields": {"id": "name", "ctx": {"_type": "Load", "_fields": {}}}}, "targets": [{"_type": "Attribute", "_fields": {"ctx": {"_type": "Store", "_fields": {}}, "attr": "name", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}], "type_comment": null}}, {"_type": "Assign", "_fields": {"value": {"_type": "Dict", "_fields": {"keys": [{"_type": "Constant", "_fields": {"kind": null, "value": "Hostname"}}, {"_type": "Constant", "_fields": {"kind": null, "value": "User"}}, {"_type": "Constant", "_fields": {"kind": null, "value": "Memory"}}, {"_type": "Constant", "_fields": {"kind": null, "value": "MemorySwap"}}, {"_type": "Constant", "_fields": {"kind": null, "value": "AttachStdin"}}, {"_type": "Constant", "_fields": {"kind": null, "value": "AttachStdout"}}, {"_type": "Constant", "_fields": {"kind": null, "value": "AttachStderr"}}, {"_type": "Constant", "_fields": {"kind": null, "value": "PortSpecs"}}, {"_type": "Constant", "_fields": {"kind": null, "value": "Tty"}}, {"_type": "Constant", "_fields": {"kind": null, "value": "OpenStdin"}}, {"_type": "Constant", "_fields": {"kind": null, "value": "StdinOnce"}}, {"_type": "Constant", "_fields": {"kind": null, "value": "Env"}}, {"_type": "Constant", "_fields": {"kind": null, "value": "Cmd"}}, {"_type": "Constant", "_fields": {"kind": null, "value": "Dns"}}, {"_type": "Constant", "_fields": {"kind": null, "value": "Image"}}, {"_type": "Constant", "_fields": {"kind": null, "value": "Volumes"}}, {"_type": "Constant", "_fields": {"kind": null, "value": "VolumesFrom"}}], "values": [{"_type": "Constant", "_fields": {"kind": null, "value": ""}}, {"_type": "Constant", "_fields": {"kind": null, "value": ""}}, {"_type": "Constant", "_fields": {"kind": null, "value": 0}}, {"_type": "Constant", "_fields": {"kind": null, "value": 0}}, {"_type": "Constant", "_fields": {"kind": null, "value": false}}, {"_type": "Constant", "_fields": {"kind": null, "value": false}}, {"_type": "Constant", "_fields": {"kind": null, "value": false}}, {"_type": "Constant", "_fields": {"kind": null, "value": null}}, {"_type": "Constant", "_fields": {"kind": null, "value": true}}, {"_type": "Constant", "_fields": {"kind": null, "value": true}}, {"_type": "Constant", "_fields": {"kind": null, "value": false}}, {"_type": "Constant", "_fields": {"kind": null, "value": null}}, {"_type": "List", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "elts": []}}, {"_type": "Constant", "_fields": {"kind": null, "value": null}}, {"_type": "Constant", "_fields": {"kind": null, "value": null}}, {"_type": "Dict", "_fields": {"keys": [], "values": []}}, {"_type": "Constant", "_fields": {"kind": null, "value": ""}}]}}, "targets": [{"_type": "Name", "_fields": {"id": "data", "ctx": {"_type": "Store", "_fields": {}}}}], "type_comment": null}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Name", "_fields": {"id": "args", "ctx": {"_type": "Load", "_fields": {}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "update", "value": {"_type": "Name", "_fields": {"id": "data", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "If", "_fields": {"body": [{"_type": "Return", "_fields": {"value": {"_type": "Constant", "_fields": {"kind": null, "value": null}}}}], "test": {"_type": "UnaryOp", "_fields": {"op": {"_type": "Not", "_fields": {}}, "operand": {"_type": "Call", "_fields": {"args": [{"_type": "Subscript", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "slice": {"_type": "Constant", "_fields": {"kind": null, "value": "Image"}}, "value": {"_type": "Name", "_fields": {"id": "args", "ctx": {"_type": "Load", "_fields": {}}}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "_is_image_exists", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, "orelse": []}}, {"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"args": [], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "_fake_id", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}, "targets": [{"_type": "Name", "_fields": {"id": "container_id", "ctx": {"_type": "Store", "_fields": {}}}}], "type_comment": null}}, {"_type": "Assign", "_fields": {"value": {"_type": "Dict", "_fields": {"keys": [{"_type": "Constant", "_fields": {"kind": null, "value": "id"}}, {"_type": "Constant", "_fields": {"kind": null, "value": "running"}}, {"_type": "Constant", "_fields": {"kind": null, "value": "config"}}], "values": [{"_type": "Name", "_fields": {"id": "container_id", "ctx": {"_type": "Load", "_fields": {}}}}, {"_type": "Constant", "_fields": {"kind": null, "value": false}}, {"_type": "Name", "_fields": {"id": "data", "ctx": {"_type": "Load", "_fields": {}}}}]}}, "targets": [{"_type": "Subscript", "_fields": {"ctx": {"_type": "Store", "_fields": {}}, "slice": {"_type": "Name", "_fields": {"id": "container_id", "ctx": {"_type": "Load", "_fields": {}}}}, "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "_containers", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}}}], "type_comment": null}}, {"_type": "Return", "_fields": {"value": {"_type": "Name", "_fields": {"id": "container_id", "ctx": {"_type": "Load", "_fields": {}}}}}}], "name": "create_container", "returns": null, "type_params": [], "type_comment": null, "decorator_list": []}}], "type_ignores": []}}
def create_container(self, args, name): self.name = name data = { 'Hostname': '', 'User': '', 'Memory': 0, 'MemorySwap': 0, 'AttachStdin': False, 'AttachStdout': False, 'AttachStderr': False, 'PortSpecs': None, 'Tty': True, 'OpenStdin': True, 'StdinOnce': False, 'Env': None, 'Cmd': [], 'Dns': None, 'Image': None, 'Volumes': {}, 'VolumesFrom': '' } data.update(args) if not self._is_image_exists(args['Image']): return None container_id = self._fake_id() self._containers[container_id] = { 'id': container_id, 'running': False, 'config': data } return container_id
14,140
[ 0.009390640072524548, 0.0364997573196888, 0.06109609827399254, -0.043028414249420166, -0.031094634905457497, 0.025112561881542206, 0.005055914632976055, -0.08314170688390732, 0.0013683612924069166, 0.031975243240594864, 0.009322317317128181, -0.08636049181222916, 0.033615000545978546, -0.0...
16
{"_type": "Module", "_fields": {"body": [{"_type": "ClassDef", "_fields": {"body": [{"_type": "Assign", "_fields": {"value": {"_type": "List", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "elts": [{"_type": "Constant", "_fields": {"kind": null, "value": "highways"}}]}}, "targets": [{"_type": "Name", "_fields": {"id": "requires_tables_common", "ctx": {"_type": "Store", "_fields": {}}}}], "type_comment": null}}, {"_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": "arg", "_fields": {"arg": "logger", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [{"_type": "Constant", "_fields": {"kind": null, "value": null}}], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}}, "body": [{"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}, {"_type": "Name", "_fields": {"id": "config", "ctx": {"_type": "Load", "_fields": {}}}}, {"_type": "Name", "_fields": {"id": "logger", "ctx": {"_type": "Load", "_fields": {}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "__init__", "value": {"_type": "Name", "_fields": {"id": "Analyser_Osmosis", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"args": [], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "def_class", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": [{"_type": "keyword", "_fields": {"arg": "item", "value": {"_type": "Constant", "_fields": {"kind": null, "value": 2060}}}}, {"_type": "keyword", "_fields": {"arg": "level", "value": {"_type": "Constant", "_fields": {"kind": null, "value": 3}}}}, {"_type": "keyword", "_fields": {"arg": "tags", "value": {"_type": "List", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "elts": [{"_type": "Constant", "_fields": {"kind": null, "value": "addr"}}, {"_type": "Constant", "_fields": {"kind": null, "value": "relation"}}, {"_type": "Constant", "_fields": {"kind": null, "value": "fix:chair"}}]}}}}, {"_type": "keyword", "_fields": {"arg": "title", "value": {"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"kind": null, "value": "addr:housenumber or addr:housename without addr:street, addr:district, addr:neighbourhood, addr:quarter, addr:suburb, addr:place or addr:hamlet must be in a associatedStreet relation"}}], "func": {"_type": "Name", "_fields": {"id": "T_", "ctx": {"_type": "Load", "_fields": {}}}}, "keywords": []}}}}, {"_type": "keyword", "_fields": {"arg": "detail", "value": {"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"kind": null, "value": "There is only a part of the required tag `addr:*=*`. They do not\nprovide a consistent address."}}], "func": {"_type": "Name", "_fields": {"id": "T_", "ctx": {"_type": "Load", "_fields": {}}}}, "keywords": []}}}}]}}, "targets": [{"_type": "Subscript", "_fields": {"ctx": {"_type": "Store", "_fields": {}}, "slice": {"_type": "Constant", "_fields": {"kind": null, "value": 1}}, "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "classs", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}}}], "type_comment": null}}, {"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"args": [], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "def_class", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": [{"_type": "keyword", "_fields": {"arg": "item", "value": {"_type": "Constant", "_fields": {"kind": null, "value": 2060}}}}, {"_type": "keyword", "_fields": {"arg": "level", "value": {"_type": "Constant", "_fields": {"kind": null, "value": 2}}}}, {"_type": "keyword", "_fields": {"arg": "tags", "value": {"_type": "List", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "elts": [{"_type": "Constant", "_fields": {"kind": null, "value": "addr"}}, {"_type": "Constant", "_fields": {"kind": null, "value": "relation"}}, {"_type": "Constant", "_fields": {"kind": null, "value": "fix:chair"}}]}}}}, {"_type": "keyword", "_fields": {"arg": "title", "value": {"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"kind": null, "value": "No street role"}}], "func": {"_type": "Name", "_fields": {"id": "T_", "ctx": {"_type": "Load", "_fields": {}}}}, "keywords": []}}}}, {"_type": "keyword", "_fields": {"arg": "detail", "value": {"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"kind": null, "value": "The street is not present in relation with the role `street`."}}], "func": {"_type": "Name", "_fields": {"id": "T_", "ctx": {"_type": "Load", "_fields": {}}}}, "keywords": []}}}}]}}, "targets": [{"_type": "Subscript", "_fields": {"ctx": {"_type": "Store", "_fields": {}}, "slice": {"_type": "Constant", "_fields": {"kind": null, "value": 2}}, "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "classs_change", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}}}], "type_comment": null}}, {"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"args": [], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "def_class", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": [{"_type": "keyword", "_fields": {"arg": "item", "value": {"_type": "Constant", "_fields": {"kind": null, "value": 2060}}}}, {"_type": "keyword", "_fields": {"arg": "level", "value": {"_type": "Constant", "_fields": {"kind": null, "value": 2}}}}, {"_type": "keyword", "_fields": {"arg": "tags", "value": {"_type": "List", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "elts": [{"_type": "Constant", "_fields": {"kind": null, "value": "addr"}}, {"_type": "Constant", "_fields": {"kind": null, "value": "fix:chair"}}]}}}}, {"_type": "keyword", "_fields": {"arg": "title", "value": {"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"kind": null, "value": "street role is not an highway"}}], "func": {"_type": "Name", "_fields": {"id": "T_", "ctx": {"_type": "Load", "_fields": {}}}}, "keywords": []}}}}, {"_type": "keyword", "_fields": {"arg": "detail", "value": {"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"kind": null, "value": "The street must be a highway."}}], "func": {"_type": "Name", "_fields": {"id": "T_", "ctx": {"_type": "Load", "_fields": {}}}}, "keywords": []}}}}]}}, "targets": [{"_type": "Subscript", "_fields": {"ctx": {"_type": "Store", "_fields": {}}, "slice": {"_type": "Constant", "_fields": {"kind": null, "value": 3}}, "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "classs_change", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}}}], "type_comment": null}}, {"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"args": [], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "def_class", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": [{"_type": "keyword", "_fields": {"arg": "item", "value": {"_type": "Constant", "_fields": {"kind": null, "value": 2060}}}}, {"_type": "keyword", "_fields": {"arg": "level", "value": {"_type": "Constant", "_fields": {"kind": null, "value": 3}}}}, {"_type": "keyword", "_fields": {"arg": "tags", "value": {"_type": "List", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "elts": [{"_type": "Constant", "_fields": {"kind": null, "value": "addr"}}, {"_type": "Constant", "_fields": {"kind": null, "value": "relation"}}, {"_type": "Constant", "_fields": {"kind": null, "value": "fix:chair"}}]}}}}, {"_type": "keyword", "_fields": {"arg": "title", "value": {"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"kind": null, "value": "Roleless member"}}], "func": {"_type": "Name", "_fields": {"id": "T_", "ctx": {"_type": "Load", "_fields": {}}}}, "keywords": []}}}}, {"_type": "keyword", "_fields": {"arg": "detail", "value": {"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"kind": null, "value": "A member without role is present in the relation."}}], "func": {"_type": "Name", "_fields": {"id": "T_", "ctx": {"_type": "Load", "_fields": {}}}}, "keywords": []}}}}]}}, "targets": [{"_type": "Subscript", "_fields": {"ctx": {"_type": "Store", "_fields": {}}, "slice": {"_type": "Constant", "_fields": {"kind": null, "value": 4}}, "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "classs_change", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}}}], "type_comment": null}}, {"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"args": [], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "def_class", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": [{"_type": "keyword", "_fields": {"arg": "item", "value": {"_type": "Constant", "_fields": {"kind": null, "value": 2060}}}}, {"_type": "keyword", "_fields": {"arg": "level", "value": {"_type": "Constant", "_fields": {"kind": null, "value": 3}}}}, {"_type": "keyword", "_fields": {"arg": "tags", "value": {"_type": "List", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "elts": [{"_type": "Constant", "_fields": {"kind": null, "value": "addr"}}, {"_type": "Constant", "_fields": {"kind": null, "value": "fix:chair"}}]}}}}, {"_type": "keyword", "_fields": {"arg": "title", "value": {"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"kind": null, "value": "Member without addr:housenumber nor addr:housename"}}], "func": {"_type": "Name", "_fields": {"id": "T_", "ctx": {"_type": "Load", "_fields": {}}}}, "keywords": []}}}}, {"_type": "keyword", "_fields": {"arg": "detail", "value": {"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"kind": null, "value": "Address without number is present."}}], "func": {"_type": "Name", "_fields": {"id": "T_", "ctx": {"_type": "Load", "_fields": {}}}}, "keywords": []}}}}]}}, "targets": [{"_type": "Subscript", "_fields": {"ctx": {"_type": "Store", "_fields": {}}, "slice": {"_type": "Constant", "_fields": {"kind": null, "value": 5}}, "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "classs_change", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}}}], "type_comment": null}}, {"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"args": [], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "def_class", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": [{"_type": "keyword", "_fields": {"arg": "item", "value": {"_type": "Constant", "_fields": {"kind": null, "value": 2060}}}}, {"_type": "keyword", "_fields": {"arg": "level", "value": {"_type": "Constant", "_fields": {"kind": null, "value": 3}}}}, {"_type": "keyword", "_fields": {"arg": "tags", "value": {"_type": "List", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "elts": [{"_type": "Constant", "_fields": {"kind": null, "value": "addr"}}, {"_type": "Constant", "_fields": {"kind": null, "value": "fix:survey"}}]}}}}, {"_type": "keyword", "_fields": {"arg": "title", "value": {"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"kind": null, "value": "Number twice in the street"}}], "func": {"_type": "Name", "_fields": {"id": "T_", "ctx": {"_type": "Load", "_fields": {}}}}, "keywords": []}}}}]}}, "targets": [{"_type": "Subscript", "_fields": {"ctx": {"_type": "Store", "_fields": {}}, "slice": {"_type": "Constant", "_fields": {"kind": null, "value": 6}}, "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "classs", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}}}], "type_comment": null}}, {"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"args": [], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "def_class", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": [{"_type": "keyword", "_fields": {"arg": "item", "value": {"_type": "Constant", "_fields": {"kind": null, "value": 2060}}}}, {"_type": "keyword", "_fields": {"arg": "level", "value": {"_type": "Constant", "_fields": {"kind": null, "value": 2}}}}, {"_type": "keyword", "_fields": {"arg": "tags", "value": {"_type": "List", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "elts": [{"_type": "Constant", "_fields": {"kind": null, "value": "addr"}}, {"_type": "Constant", "_fields": {"kind": null, "value": "fix:chair"}}]}}}}, {"_type": "keyword", "_fields": {"arg": "title", "value": {"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"kind": null, "value": "Many street names"}}], "func": {"_type": "Name", "_fields": {"id": "T_", "ctx": {"_type": "Load", "_fields": {}}}}, "keywords": []}}}}]}}, "targets": [{"_type": "Subscript", "_fields": {"ctx": {"_type": "Store", "_fields": {}}, "slice": {"_type": "Constant", "_fields": {"kind": null, "value": 7}}, "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "classs", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}}}], "type_comment": null}}, {"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"args": [], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "def_class", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": [{"_type": "keyword", "_fields": {"arg": "item", "value": {"_type": "Constant", "_fields": {"kind": null, "value": 2060}}}}, {"_type": "keyword", "_fields": {"arg": "level", "value": {"_type": "Constant", "_fields": {"kind": null, "value": 2}}}}, {"_type": "keyword", "_fields": {"arg": "tags", "value": {"_type": "List", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "elts": [{"_type": "Constant", "_fields": {"kind": null, "value": "addr"}}, {"_type": "Constant", "_fields": {"kind": null, "value": "relation"}}, {"_type": "Constant", "_fields": {"kind": null, "value": "fix:chair"}}]}}}}, {"_type": "keyword", "_fields": {"arg": "title", "value": {"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"kind": null, "value": "Many relations on one street"}}], "func": {"_type": "Name", "_fields": {"id": "T_", "ctx": {"_type": "Load", "_fields": {}}}}, "keywords": []}}}}]}}, "targets": [{"_type": "Subscript", "_fields": {"ctx": {"_type": "Store", "_fields": {}}, "slice": {"_type": "Constant", "_fields": {"kind": null, "value": 8}}, "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "classs", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}}}], "type_comment": null}}, {"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"args": [], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "def_class", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": [{"_type": "keyword", "_fields": {"arg": "item", "value": {"_type": "Constant", "_fields": {"kind": null, "value": 2060}}}}, {"_type": "keyword", "_fields": {"arg": "level", "value": {"_type": "Constant", "_fields": {"kind": null, "value": 2}}}}, {"_type": "keyword", "_fields": {"arg": "tags", "value": {"_type": "List", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "elts": [{"_type": "Constant", "_fields": {"kind": null, "value": "addr"}}, {"_type": "Constant", "_fields": {"kind": null, "value": "geom"}}, {"_type": "Constant", "_fields": {"kind": null, "value": "fix:chair"}}]}}}}, {"_type": "keyword", "_fields": {"arg": "title", "value": {"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"kind": null, "value": "House too far away from street"}}], "func": {"_type": "Name", "_fields": {"id": "T_", "ctx": {"_type": "Load", "_fields": {}}}}, "keywords": []}}}}]}}, "targets": [{"_type": "Subscript", "_fields": {"ctx": {"_type": "Store", "_fields": {}}, "slice": {"_type": "Constant", "_fields": {"kind": null, "value": 9}}, "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "classs", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}}}], "type_comment": null}}, {"_type": "If", "_fields": {"body": [{"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"args": [], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "def_class", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": [{"_type": "keyword", "_fields": {"arg": "item", "value": {"_type": "Constant", "_fields": {"kind": null, "value": 2060}}}}, {"_type": "keyword", "_fields": {"arg": "level", "value": {"_type": "Constant", "_fields": {"kind": null, "value": 2}}}}, {"_type": "keyword", "_fields": {"arg": "tags", "value": {"_type": "List", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "elts": [{"_type": "Constant", "_fields": {"kind": null, "value": "addr"}}, {"_type": "Constant", "_fields": {"kind": null, "value": "fix:chair"}}]}}}}, {"_type": "keyword", "_fields": {"arg": "title", "value": {"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"kind": null, "value": "Tag \"addr:city\" not matching a city"}}], "func": {"_type": "Name", "_fields": {"id": "T_", "ctx": {"_type": "Load", "_fields": {}}}}, "keywords": []}}}}]}}, "targets": [{"_type": "Subscript", "_fields": {"ctx": {"_type": "Store", "_fields": {}}, "slice": {"_type": "Constant", "_fields": {"kind": null, "value": 12}}, "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "classs", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}}}], "type_comment": null}}], "test": {"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"kind": null, "value": "addr:city-admin_level"}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "get", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "options", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "config", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}}}}}, "keywords": []}}, "orelse": []}}, {"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"args": [], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "def_class", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": [{"_type": "keyword", "_fields": {"arg": "item", "value": {"_type": "Constant", "_fields": {"kind": null, "value": "2060"}}}}, {"_type": "keyword", "_fields": {"arg": "level", "value": {"_type": "Constant", "_fields": {"kind": null, "value": 2}}}}, {"_type": "keyword", "_fields": {"arg": "tags", "value": {"_type": "List", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "elts": [{"_type": "Constant", "_fields": {"kind": null, "value": "addr"}}, {"_type": "Constant", "_fields": {"kind": null, "value": "fix:chair"}}]}}}}, {"_type": "keyword", "_fields": {"arg": "title", "value": {"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"kind": null, "value": "Missing highway in associatedStreet relation"}}], "func": {"_type": "Name", "_fields": {"id": "T_", "ctx": {"_type": "Load", "_fields": {}}}}, "keywords": []}}}}, {"_type": "keyword", "_fields": {"arg": "fix", "value": {"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"kind": null, "value": "Extend the relation to include the way with the same name."}}], "func": {"_type": "Name", "_fields": {"id": "T_", "ctx": {"_type": "Load", "_fields": {}}}}, "keywords": []}}}}]}}, "targets": [{"_type": "Subscript", "_fields": {"ctx": {"_type": "Store", "_fields": {}}, "slice": {"_type": "Constant", "_fields": {"kind": null, "value": 18}}, "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "classs", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}}}], "type_comment": null}}, {"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"args": [], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "def_class", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": [{"_type": "keyword", "_fields": {"arg": "item", "value": {"_type": "Constant", "_fields": {"kind": null, "value": "2060"}}}}, {"_type": "keyword", "_fields": {"arg": "level", "value": {"_type": "Constant", "_fields": {"kind": null, "value": 2}}}}, {"_type": "keyword", "_fields": {"arg": "tags", "value": {"_type": "List", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "elts": [{"_type": "Constant", "_fields": {"kind": null, "value": "addr"}}, {"_type": "Constant", "_fields": {"kind": null, "value": "fix:chair"}}]}}}}, {"_type": "keyword", "_fields": {"arg": "title", "value": {"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"kind": null, "value": "Tag \"addr:street\" not matching a street name around"}}], "func": {"_type": "Name", "_fields": {"id": "T_", "ctx": {"_type": "Load", "_fields": {}}}}, "keywords": []}}}}]}}, "targets": [{"_type": "Subscript", "_fields": {"ctx": {"_type": "Store", "_fields": {}}, "slice": {"_type": "Constant", "_fields": {"kind": null, "value": 19}}, "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "classs", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}}}], "type_comment": null}}, {"_type": "Assign", "_fields": {"value": {"_type": "Lambda", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "res", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}}, "body": {"_type": "BoolOp", "_fields": {"op": {"_type": "And", "_fields": {}}, "values": [{"_type": "Subscript", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "slice": {"_type": "Constant", "_fields": {"kind": null, "value": 1}}, "value": {"_type": "Name", "_fields": {"id": "res", "ctx": {"_type": "Load", "_fields": {}}}}}}, {"_type": "Dict", "_fields": {"keys": [{"_type": "Constant", "_fields": {"kind": null, "value": "class"}}, {"_type": "Constant", "_fields": {"kind": null, "value": "subclass"}}, {"_type": "Constant", "_fields": {"kind": null, "value": "data"}}], "values": [{"_type": "Constant", "_fields": {"kind": null, "value": 2}}, {"_type": "Constant", "_fields": {"kind": null, "value": 1}}, {"_type": "List", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "elts": [{"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "relation_full", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}, {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "positionAsText", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}]}}]}}]}}}}, "targets": [{"_type": "Attribute", "_fields": {"ctx": {"_type": "Store", "_fields": {}}, "attr": "callback20", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}], "type_comment": null}}, {"_type": "Assign", "_fields": {"value": {"_type": "Lambda", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "res", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}}, "body": {"_type": "Dict", "_fields": {"keys": [{"_type": "Constant", "_fields": {"kind": null, "value": "class"}}, {"_type": "Constant", "_fields": {"kind": null, "value": "subclass"}}, {"_type": "Constant", "_fields": {"kind": null, "value": "data"}}], "values": [{"_type": "Constant", "_fields": {"kind": null, "value": 3}}, {"_type": "Constant", "_fields": {"kind": null, "value": 1}}, {"_type": "List", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "elts": [{"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "way_full", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}, {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "relation", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}, {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "positionAsText", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}]}}]}}}}, "targets": [{"_type": "Attribute", "_fields": {"ctx": {"_type": "Store", "_fields": {}}, "attr": "callback30", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}], "type_comment": null}}, {"_type": "Assign", "_fields": {"value": {"_type": "Lambda", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "res", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}}, "body": {"_type": "Dict", "_fields": {"keys": [{"_type": "Constant", "_fields": {"kind": null, "value": "class"}}, {"_type": "Constant", "_fields": {"kind": null, "value": "subclass"}}, {"_type": "Constant", "_fields": {"kind": null, "value": "data"}}], "values": [{"_type": "Constant", "_fields": {"kind": null, "value": 4}}, {"_type": "Constant", "_fields": {"kind": null, "value": 1}}, {"_type": "List", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "elts": [{"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "node_full", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}, {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "relation", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}, {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "positionAsText", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}]}}]}}}}, "targets": [{"_type": "Attribute", "_fields": {"ctx": {"_type": "Store", "_fields": {}}, "attr": "callback40", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}], "type_comment": null}}, {"_type": "Assign", "_fields": {"value": {"_type": "Lambda", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "res", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}}, "body": {"_type": "Dict", "_fields": {"keys": [{"_type": "Constant", "_fields": {"kind": null, "value": "class"}}, {"_type": "Constant", "_fields": {"kind": null, "value": "subclass"}}, {"_type": "Constant", "_fields": {"kind": null, "value": "data"}}], "values": [{"_type": "Constant", "_fields": {"kind": null, "value": 4}}, {"_type": "Constant", "_fields": {"kind": null, "value": 2}}, {"_type": "List", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "elts": [{"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "way_full", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}, {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "relation", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}, {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "positionAsText", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}]}}]}}}}, "targets": [{"_type": "Attribute", "_fields": {"ctx": {"_type": "Store", "_fields": {}}, "attr": "callback41", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}], "type_comment": null}}, {"_type": "Assign", "_fields": {"value": {"_type": "Lambda", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "res", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}}, "body": {"_type": "Dict", "_fields": {"keys": [{"_type": "Constant", "_fields": {"kind": null, "value": "class"}}, {"_type": "Constant", "_fields": {"kind": null, "value": "subclass"}}, {"_type": "Constant", "_fields": {"kind": null, "value": "data"}}], "values": [{"_type": "Constant", "_fields": {"kind": null, "value": 5}}, {"_type": "Constant", "_fields": {"kind": null, "value": 1}}, {"_type": "List", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "elts": [{"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "node_full", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}, {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "relation", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}, {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "positionAsText", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}]}}]}}}}, "targets": [{"_type": "Attribute", "_fields": {"ctx": {"_type": "Store", "_fields": {}}, "attr": "callback50", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}], "type_comment": null}}, {"_type": "Assign", "_fields": {"value": {"_type": "Lambda", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "res", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}}, "body": {"_type": "Dict", "_fields": {"keys": [{"_type": "Constant", "_fields": {"kind": null, "value": "class"}}, {"_type": "Constant", "_fields": {"kind": null, "value": "subclass"}}, {"_type": "Constant", "_fields": {"kind": null, "value": "data"}}], "values": [{"_type": "Constant", "_fields": {"kind": null, "value": 5}}, {"_type": "Constant", "_fields": {"kind": null, "value": 1}}, {"_type": "List", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "elts": [{"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "way_full", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}, {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "relation", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}, {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "positionAsText", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}]}}]}}}}, "targets": [{"_type": "Attribute", "_fields": {"ctx": {"_type": "Store", "_fields": {}}, "attr": "callback51", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}], "type_comment": null}}, {"_type": "Assign", "_fields": {"value": {"_type": "Lambda", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "res", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}}, "body": {"_type": "Dict", "_fields": {"keys": [{"_type": "Constant", "_fields": {"kind": null, "value": "class"}}, {"_type": "Constant", "_fields": {"kind": null, "value": "subclass"}}, {"_type": "Constant", "_fields": {"kind": null, "value": "data"}}], "values": [{"_type": "Constant", "_fields": {"kind": null, "value": 12}}, {"_type": "Constant", "_fields": {"kind": null, "value": 1}}, {"_type": "List", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "elts": [{"_type": "Lambda", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "t", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}}, "body": {"_type": "Call", "_fields": {"args": [{"_type": "Name", "_fields": {"id": "t", "ctx": {"_type": "Load", "_fields": {}}}}], "func": {"_type": "Subscript", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "slice": {"_type": "Subscript", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "slice": {"_type": "Constant", "_fields": {"kind": null, "value": 1}}, "value": {"_type": "Name", "_fields": {"id": "res", "ctx": {"_type": "Load", "_fields": {}}}}}}, "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "typeMapping", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}}}, "keywords": []}}}}, {"_type": "Constant", "_fields": {"kind": null, "value": null}}, {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "positionAsText", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}]}}]}}}}, "targets": [{"_type": "Attribute", "_fields": {"ctx": {"_type": "Store", "_fields": {}}, "attr": "callbackC2", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}], "type_comment": null}}, {"_type": "Assign", "_fields": {"value": {"_type": "Lambda", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "res", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}}, "body": {"_type": "Dict", "_fields": {"keys": [{"_type": "Constant", "_fields": {"kind": null, "value": "class"}}, {"_type": "Constant", "_fields": {"kind": null, "value": "subclass"}}, {"_type": "Constant", "_fields": {"kind": null, "value": "data"}}, {"_type": "Constant", "_fields": {"kind": null, "value": "text"}}], "values": [{"_type": "Constant", "_fields": {"kind": null, "value": 19}}, {"_type": "Constant", "_fields": {"kind": null, "value": 1}}, {"_type": "List", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "elts": [{"_type": "Lambda", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "t", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}}, "body": {"_type": "Call", "_fields": {"args": [{"_type": "Name", "_fields": {"id": "t", "ctx": {"_type": "Load", "_fields": {}}}}], "func": {"_type": "Subscript", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "slice": {"_type": "Subscript", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "slice": {"_type": "Constant", "_fields": {"kind": null, "value": 1}}, "value": {"_type": "Name", "_fields": {"id": "res", "ctx": {"_type": "Load", "_fields": {}}}}}}, "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "typeMapping", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}}}, "keywords": []}}}}, {"_type": "Constant", "_fields": {"kind": null, "value": null}}, {"_type": "Constant", "_fields": {"kind": null, "value": null}}, {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "positionAsText", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}]}}, {"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"kind": null, "value": "No street with name \"{0}\" found around"}}, {"_type": "Subscript", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "slice": {"_type": "Constant", "_fields": {"kind": null, "value": 2}}, "value": {"_type": "Name", "_fields": {"id": "res", "ctx": {"_type": "Load", "_fields": {}}}}}}], "func": {"_type": "Name", "_fields": {"id": "T_", "ctx": {"_type": "Load", "_fields": {}}}}, "keywords": []}}]}}}}, "targets": [{"_type": "Attribute", "_fields": {"ctx": {"_type": "Store", "_fields": {}}, "attr": "callbackD1", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}], "type_comment": null}}, {"_type": "Assign", "_fields": {"value": {"_type": "Lambda", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "res", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}}, "body": {"_type": "Dict", "_fields": {"keys": [{"_type": "Constant", "_fields": {"kind": null, "value": "class"}}, {"_type": "Constant", "_fields": {"kind": null, "value": "subclass"}}, {"_type": "Constant", "_fields": {"kind": null, "value": "data"}}], "values": [{"_type": "Constant", "_fields": {"kind": null, "value": 18}}, {"_type": "Constant", "_fields": {"kind": null, "value": 1}}, {"_type": "List", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "elts": [{"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "way_full", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}, {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "relation", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}, {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "positionAsText", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}]}}]}}}}, "targets": [{"_type": "Attribute", "_fields": {"ctx": {"_type": "Store", "_fields": {}}, "attr": "callbackF0", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}], "type_comment": null}}], "name": "__init__", "returns": null, "type_params": [], "type_comment": null, "decorator_list": []}}, {"_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": []}}, "body": [{"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Call", "_fields": {"args": [{"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"kind": null, "value": "proj"}}, {"_type": "Constant", "_fields": {"kind": null, "value": 4326}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "get", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "options", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "config", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}}}}}, "keywords": []}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "format", "value": {"_type": "Name", "_fields": {"id": "sql00", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "run", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Call", "_fields": {"args": [{"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"kind": null, "value": "proj"}}, {"_type": "Constant", "_fields": {"kind": null, "value": 4326}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "get", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "options", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "config", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}}}}}, "keywords": []}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "format", "value": {"_type": "Name", "_fields": {"id": "sql01", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "run", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Name", "_fields": {"id": "sql10", "ctx": {"_type": "Load", "_fields": {}}}}, {"_type": "Lambda", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "res", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}}, "body": {"_type": "Dict", "_fields": {"keys": [{"_type": "Constant", "_fields": {"kind": null, "value": "class"}}, {"_type": "Constant", "_fields": {"kind": null, "value": "subclass"}}, {"_type": "Constant", "_fields": {"kind": null, "value": "data"}}], "values": [{"_type": "Constant", "_fields": {"kind": null, "value": 1}}, {"_type": "Constant", "_fields": {"kind": null, "value": 1}}, {"_type": "List", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "elts": [{"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "way_full", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}, {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "positionAsText", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}]}}]}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "run", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Name", "_fields": {"id": "sql11", "ctx": {"_type": "Load", "_fields": {}}}}, {"_type": "Lambda", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "res", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}}, "body": {"_type": "Dict", "_fields": {"keys": [{"_type": "Constant", "_fields": {"kind": null, "value": "class"}}, {"_type": "Constant", "_fields": {"kind": null, "value": "subclass"}}, {"_type": "Constant", "_fields": {"kind": null, "value": "data"}}], "values": [{"_type": "Constant", "_fields": {"kind": null, "value": 1}}, {"_type": "Constant", "_fields": {"kind": null, "value": 2}}, {"_type": "List", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "elts": [{"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "node_full", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}, {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "positionAsText", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}]}}]}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "run", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "If", "_fields": {"body": [{"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Call", "_fields": {"args": [{"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"kind": null, "value": "proj"}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "get", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "options", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "config", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}}}}}, "keywords": []}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "format", "value": {"_type": "Name", "_fields": {"id": "sql60", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "run", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Name", "_fields": {"id": "sql61", "ctx": {"_type": "Load", "_fields": {}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "run", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Name", "_fields": {"id": "sql62", "ctx": {"_type": "Load", "_fields": {}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "run", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Name", "_fields": {"id": "sql63", "ctx": {"_type": "Load", "_fields": {}}}}, {"_type": "Lambda", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "res", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}}, "body": {"_type": "Dict", "_fields": {"keys": [{"_type": "Constant", "_fields": {"kind": null, "value": "class"}}, {"_type": "Constant", "_fields": {"kind": null, "value": "subclass"}}, {"_type": "Constant", "_fields": {"kind": null, "value": "data"}}, {"_type": "Constant", "_fields": {"kind": null, "value": "text"}}], "values": [{"_type": "Constant", "_fields": {"kind": null, "value": 6}}, {"_type": "Constant", "_fields": {"kind": null, "value": 1}}, {"_type": "List", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "elts": [{"_type": "Lambda", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "t", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}}, "body": {"_type": "Call", "_fields": {"args": [{"_type": "Name", "_fields": {"id": "t", "ctx": {"_type": "Load", "_fields": {}}}}], "func": {"_type": "Subscript", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "slice": {"_type": "Subscript", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "slice": {"_type": "Constant", "_fields": {"kind": null, "value": 1}}, "value": {"_type": "Name", "_fields": {"id": "res", "ctx": {"_type": "Load", "_fields": {}}}}}}, "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "typeMapping", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}}}, "keywords": []}}}}, {"_type": "Constant", "_fields": {"kind": null, "value": null}}, {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "positionAsText", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}]}}, {"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"kind": null, "value": "Multiple numbers \"{numbers}\" in way \"{way}\""}}], "func": {"_type": "Name", "_fields": {"id": "T_", "ctx": {"_type": "Load", "_fields": {}}}}, "keywords": [{"_type": "keyword", "_fields": {"arg": "numbers", "value": {"_type": "Call", "_fields": {"args": [{"_type": "Call", "_fields": {"args": [{"_type": "Lambda", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "z", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}}, "body": {"_type": "Name", "_fields": {"id": "z", "ctx": {"_type": "Load", "_fields": {}}}}}}, {"_type": "Subscript", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "slice": {"_type": "Slice", "_fields": {"step": null, "lower": {"_type": "Constant", "_fields": {"kind": null, "value": 4}}, "upper": null}}, "value": {"_type": "Name", "_fields": {"id": "res", "ctx": {"_type": "Load", "_fields": {}}}}}}], "func": {"_type": "Name", "_fields": {"id": "filter", "ctx": {"_type": "Load", "_fields": {}}}}, "keywords": []}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "join", "value": {"_type": "Constant", "_fields": {"kind": null, "value": ", "}}}}, "keywords": []}}}}, {"_type": "keyword", "_fields": {"arg": "way", "value": {"_type": "Subscript", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "slice": {"_type": "Constant", "_fields": {"kind": null, "value": 3}}, "value": {"_type": "Name", "_fields": {"id": "res", "ctx": {"_type": "Load", "_fields": {}}}}}}}}]}}]}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "run", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}], "test": {"_type": "Compare", "_fields": {"ops": [{"_type": "In", "_fields": {}}], "left": {"_type": "Constant", "_fields": {"kind": null, "value": "proj"}}, "comparators": [{"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "options", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "config", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}}}]}}, "orelse": []}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Name", "_fields": {"id": "sql70", "ctx": {"_type": "Load", "_fields": {}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "run", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Name", "_fields": {"id": "sql80", "ctx": {"_type": "Load", "_fields": {}}}}, {"_type": "Lambda", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "res", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}}, "body": {"_type": "Dict", "_fields": {"keys": [{"_type": "Constant", "_fields": {"kind": null, "value": "class"}}, {"_type": "Constant", "_fields": {"kind": null, "value": "subclass"}}, {"_type": "Constant", "_fields": {"kind": null, "value": "data"}}, {"_type": "Constant", "_fields": {"kind": null, "value": "text"}}], "values": [{"_type": "Constant", "_fields": {"kind": null, "value": 7}}, {"_type": "Constant", "_fields": {"kind": null, "value": 1}}, {"_type": "List", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "elts": [{"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "relation_full", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}, {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "positionAsText", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}]}}, {"_type": "Dict", "_fields": {"keys": [{"_type": "Constant", "_fields": {"kind": null, "value": "en"}}], "values": [{"_type": "Subscript", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "slice": {"_type": "Constant", "_fields": {"kind": null, "value": 2}}, "value": {"_type": "Name", "_fields": {"id": "res", "ctx": {"_type": "Load", "_fields": {}}}}}}]}}]}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "run", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Name", "_fields": {"id": "sql90", "ctx": {"_type": "Load", "_fields": {}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "run", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Name", "_fields": {"id": "sql91", "ctx": {"_type": "Load", "_fields": {}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "run", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Name", "_fields": {"id": "sqlA0", "ctx": {"_type": "Load", "_fields": {}}}}, {"_type": "Lambda", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "res", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}}, "body": {"_type": "Dict", "_fields": {"keys": [{"_type": "Constant", "_fields": {"kind": null, "value": "class"}}, {"_type": "Constant", "_fields": {"kind": null, "value": "subclass"}}, {"_type": "Constant", "_fields": {"kind": null, "value": "data"}}], "values": [{"_type": "Constant", "_fields": {"kind": null, "value": 8}}, {"_type": "Constant", "_fields": {"kind": null, "value": 1}}, {"_type": "List", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "elts": [{"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "relation_full", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}, {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "relation_full", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}, {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "positionAsText", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}]}}]}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "run", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Name", "_fields": {"id": "sqlB0", "ctx": {"_type": "Load", "_fields": {}}}}, {"_type": "Lambda", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "res", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}}, "body": {"_type": "Dict", "_fields": {"keys": [{"_type": "Constant", "_fields": {"kind": null, "value": "class"}}, {"_type": "Constant", "_fields": {"kind": null, "value": "subclass"}}, {"_type": "Constant", "_fields": {"kind": null, "value": "data"}}], "values": [{"_type": "Constant", "_fields": {"kind": null, "value": 9}}, {"_type": "Constant", "_fields": {"kind": null, "value": 1}}, {"_type": "List", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "elts": [{"_type": "Lambda", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "t", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}}, "body": {"_type": "Call", "_fields": {"args": [{"_type": "Name", "_fields": {"id": "t", "ctx": {"_type": "Load", "_fields": {}}}}], "func": {"_type": "Subscript", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "slice": {"_type": "Subscript", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "slice": {"_type": "Constant", "_fields": {"kind": null, "value": 1}}, "value": {"_type": "Name", "_fields": {"id": "res", "ctx": {"_type": "Load", "_fields": {}}}}}}, "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "typeMapping", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}}}, "keywords": []}}}}, {"_type": "Constant", "_fields": {"kind": null, "value": null}}, {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "positionAsText", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}, {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "relation_full", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}]}}]}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "run", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "If", "_fields": {"body": [{"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Name", "_fields": {"id": "sqlC0", "ctx": {"_type": "Load", "_fields": {}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "run", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Call", "_fields": {"args": [{"_type": "Call", "_fields": {"args": [{"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"kind": null, "value": ","}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "split", "value": {"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"kind": null, "value": "addr:city-admin_level"}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "get", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "options", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "config", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}}}}}, "keywords": []}}}}, "keywords": []}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "join", "value": {"_type": "Constant", "_fields": {"kind": null, "value": "','"}}}}, "keywords": []}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "format", "value": {"_type": "Name", "_fields": {"id": "sqlC1", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "run", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Name", "_fields": {"id": "sqlC2", "ctx": {"_type": "Load", "_fields": {}}}}, {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "callbackC2", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "run", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}], "test": {"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"kind": null, "value": "addr:city-admin_level"}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "get", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "options", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "config", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}}}}}, "keywords": []}}, "orelse": []}}, {"_type": "If", "_fields": {"body": [{"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Name", "_fields": {"id": "sqlD0", "ctx": {"_type": "Load", "_fields": {}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "run", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Call", "_fields": {"args": [{"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"kind": null, "value": "addr:street_distance"}}, {"_type": "Constant", "_fields": {"kind": null, "value": 500}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "get", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "options", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "config", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}}}}}, "keywords": []}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "format", "value": {"_type": "Name", "_fields": {"id": "sqlD1", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}, {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "callbackD1", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "run", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}], "test": {"_type": "Compare", "_fields": {"ops": [{"_type": "In", "_fields": {}}], "left": {"_type": "Constant", "_fields": {"kind": null, "value": "proj"}}, "comparators": [{"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "options", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "config", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}}}]}}, "orelse": []}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Call", "_fields": {"args": [{"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"kind": null, "value": "proj"}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "get", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "options", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "config", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}}}}}, "keywords": []}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "format", "value": {"_type": "Name", "_fields": {"id": "sqlF0", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}, {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "callbackF0", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "run", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}], "name": "analyser_osmosis_common", "returns": null, "type_params": [], "type_comment": null, "decorator_list": []}}, {"_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": []}}, "body": [{"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"kind": null, "value": ""}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "format", "value": {"_type": "Name", "_fields": {"id": "sql20", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}, {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "callback20", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "run", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"kind": null, "value": ""}}, {"_type": "Constant", "_fields": {"kind": null, "value": ""}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "format", "value": {"_type": "Name", "_fields": {"id": "sql30", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}, {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "callback30", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "run", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"kind": null, "value": ""}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "format", "value": {"_type": "Name", "_fields": {"id": "sql40", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}, {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "callback40", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "run", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"kind": null, "value": ""}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "format", "value": {"_type": "Name", "_fields": {"id": "sql41", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}, {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "callback41", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "run", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"kind": null, "value": ""}}, {"_type": "Constant", "_fields": {"kind": null, "value": ""}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "format", "value": {"_type": "Name", "_fields": {"id": "sql50", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}, {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "callback50", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "run", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"kind": null, "value": ""}}, {"_type": "Constant", "_fields": {"kind": null, "value": ""}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "format", "value": {"_type": "Name", "_fields": {"id": "sql51", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}, {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "callback51", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "run", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}], "name": "analyser_osmosis_full", "returns": null, "type_params": [], "type_comment": null, "decorator_list": []}}, {"_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": []}}, "body": [{"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"kind": null, "value": "touched_"}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "format", "value": {"_type": "Name", "_fields": {"id": "sql20", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}, {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "callback20", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "run", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"kind": null, "value": "touched_"}}, {"_type": "Constant", "_fields": {"kind": null, "value": ""}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "format", "value": {"_type": "Name", "_fields": {"id": "sql30", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}, {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "callback30", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "run", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"kind": null, "value": "not_touched_"}}, {"_type": "Constant", "_fields": {"kind": null, "value": "touched_"}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "format", "value": {"_type": "Name", "_fields": {"id": "sql30", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}, {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "callback30", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "run", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"kind": null, "value": "touched_"}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "format", "value": {"_type": "Name", "_fields": {"id": "sql40", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}, {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "callback40", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "run", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"kind": null, "value": "touched_"}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "format", "value": {"_type": "Name", "_fields": {"id": "sql41", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}, {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "callback41", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "run", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"kind": null, "value": "touched_"}}, {"_type": "Constant", "_fields": {"kind": null, "value": ""}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "format", "value": {"_type": "Name", "_fields": {"id": "sql50", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}, {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "callback50", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "run", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"kind": null, "value": "not_touched_"}}, {"_type": "Constant", "_fields": {"kind": null, "value": "touched_"}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "format", "value": {"_type": "Name", "_fields": {"id": "sql50", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}, {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "callback50", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "run", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"kind": null, "value": "touched_"}}, {"_type": "Constant", "_fields": {"kind": null, "value": ""}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "format", "value": {"_type": "Name", "_fields": {"id": "sql51", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}, {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "callback51", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "run", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"kind": null, "value": "not_touched_"}}, {"_type": "Constant", "_fields": {"kind": null, "value": "touched_"}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "format", "value": {"_type": "Name", "_fields": {"id": "sql51", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}, {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "callback51", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "run", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}], "name": "analyser_osmosis_diff", "returns": null, "type_params": [], "type_comment": null, "decorator_list": []}}], "name": "Analyser_Osmosis_Relation_AssociatedStreet", "bases": [{"_type": "Name", "_fields": {"id": "Analyser_Osmosis", "ctx": {"_type": "Load", "_fields": {}}}}], "keywords": [], "type_params": [], "decorator_list": []}}], "type_ignores": []}}
class Analyser_Osmosis_Relation_AssociatedStreet(Analyser_Osmosis): requires_tables_common = ['highways'] def __init__(self, config, logger = None): Analyser_Osmosis.__init__(self, config, logger) self.classs[1] = self.def_class(item = 2060, level = 3, tags = ['addr', 'relation', 'fix:chair'], title = T_('addr:housenumber or addr:housename without addr:street, addr:district, addr:neighbourhood, addr:quarter, addr:suburb, addr:place or addr:hamlet must be in a associatedStreet relation'), detail = T_( '''There is only a part of the required tag `addr:*=*`. They do not provide a consistent address.''')) self.classs_change[2] = self.def_class(item = 2060, level = 2, tags = ['addr', 'relation', 'fix:chair'], title = T_('No street role'), detail = T_( '''The street is not present in relation with the role `street`.''')) self.classs_change[3] = self.def_class(item = 2060, level = 2, tags = ['addr', 'fix:chair'], title = T_('street role is not an highway'), detail = T_( '''The street must be a highway.''')) self.classs_change[4] = self.def_class(item = 2060, level = 3, tags = ['addr', 'relation', 'fix:chair'], title = T_('Roleless member'), detail = T_( '''A member without role is present in the relation.''')) self.classs_change[5] = self.def_class(item = 2060, level = 3, tags = ['addr', 'fix:chair'], title = T_('Member without addr:housenumber nor addr:housename'), detail = T_( '''Address without number is present.''')) self.classs[6] = self.def_class(item = 2060, level = 3, tags = ['addr', 'fix:survey'], title = T_('Number twice in the street')) self.classs[7] = self.def_class(item = 2060, level = 2, tags = ['addr', 'fix:chair'], title = T_('Many street names')) self.classs[8] = self.def_class(item = 2060, level = 2, tags = ['addr', 'relation', 'fix:chair'], title = T_('Many relations on one street')) self.classs[9] = self.def_class(item = 2060, level = 2, tags = ['addr', 'geom', 'fix:chair'], title = T_('House too far away from street')) if self.config.options.get("addr:city-admin_level"): self.classs[12] = self.def_class(item = 2060, level = 2, tags = ['addr', 'fix:chair'], title = T_('Tag "addr:city" not matching a city')) self.classs[18] = self.def_class(item ="2060", level = 2, tags = ['addr', 'fix:chair'], title = T_('Missing highway in associatedStreet relation'), fix = T_( '''Extend the relation to include the way with the same name.''')) self.classs[19] = self.def_class(item ="2060", level = 2, tags = ['addr', 'fix:chair'], title = T_('Tag "addr:street" not matching a street name around')) self.callback20 = lambda res: res[1] and {"class":2, "subclass":1, "data":[self.relation_full, self.positionAsText]} self.callback30 = lambda res: {"class":3, "subclass":1, "data":[self.way_full, self.relation, self.positionAsText]} self.callback40 = lambda res: {"class":4, "subclass":1, "data":[self.node_full, self.relation, self.positionAsText]} self.callback41 = lambda res: {"class":4, "subclass":2, "data":[self.way_full, self.relation, self.positionAsText]} self.callback50 = lambda res: {"class":5, "subclass":1, "data":[self.node_full, self.relation, self.positionAsText]} self.callback51 = lambda res: {"class":5, "subclass":1, "data":[self.way_full, self.relation, self.positionAsText]} self.callbackC2 = lambda res: {"class":12, "subclass":1, "data":[lambda t: self.typeMapping[res[1]](t), None, self.positionAsText]} self.callbackD1 = lambda res: {"class":19, "subclass":1, "data":[lambda t: self.typeMapping[res[1]](t), None, None, self.positionAsText], "text": T_("No street with name \"{0}\" found around", res[2])} self.callbackF0 = lambda res: {"class":18, "subclass":1, "data":[self.way_full, self.relation, self.positionAsText]} def analyser_osmosis_common(self): self.run(sql00.format(self.config.options.get("proj", 4326))) self.run(sql01.format(self.config.options.get("proj", 4326))) self.run(sql10, lambda res: {"class":1, "subclass":1, "data":[self.way_full, self.positionAsText]} ) self.run(sql11, lambda res: {"class":1, "subclass":2, "data":[self.node_full, self.positionAsText]} ) if "proj" in self.config.options: self.run(sql60.format(self.config.options.get("proj"))) self.run(sql61) self.run(sql62) self.run(sql63, lambda res: {"class":6, "subclass":1, "data":[lambda t: self.typeMapping[res[1]](t), None, self.positionAsText], "text": T_("Multiple numbers \"{numbers}\" in way \"{way}\"", numbers = ", ".join(filter(lambda z: z, res[4:])), way = res[3]), }) self.run(sql70) self.run(sql80, lambda res: {"class":7, "subclass":1, "data":[self.relation_full, self.positionAsText], "text":{"en": res[2]}} ) self.run(sql90) self.run(sql91) self.run(sqlA0, lambda res: {"class":8, "subclass":1, "data":[self.relation_full, self.relation_full, self.positionAsText]} ) self.run(sqlB0, lambda res: {"class":9, "subclass":1, "data":[lambda t: self.typeMapping[res[1]](t), None, self.positionAsText, self.relation_full]} ) if self.config.options.get("addr:city-admin_level"): self.run(sqlC0) self.run(sqlC1.format( "','".join(self.config.options.get("addr:city-admin_level").split(',')))) self.run(sqlC2, self.callbackC2) if "proj" in self.config.options: self.run(sqlD0) self.run(sqlD1.format(self.config.options.get("addr:street_distance", 500)), self.callbackD1) self.run(sqlF0.format(self.config.options.get("proj")), self.callbackF0) def analyser_osmosis_full(self): self.run(sql20.format(""), self.callback20) self.run(sql30.format("", ""), self.callback30) self.run(sql40.format(""), self.callback40) self.run(sql41.format(""), self.callback41) self.run(sql50.format("", ""), self.callback50) self.run(sql51.format("", ""), self.callback51) def analyser_osmosis_diff(self): self.run(sql20.format("touched_"), self.callback20) self.run(sql30.format("touched_", ""), self.callback30) self.run(sql30.format("not_touched_", "touched_"), self.callback30) self.run(sql40.format("touched_"), self.callback40) self.run(sql41.format("touched_"), self.callback41) self.run(sql50.format("touched_", ""), self.callback50) self.run(sql50.format("not_touched_", "touched_"), self.callback50) self.run(sql51.format("touched_", ""), self.callback51) self.run(sql51.format("not_touched_", "touched_"), self.callback51)
14,141
[ 0.010029339231550694, -0.004537210799753666, -0.017123788595199585, 0.021612444892525673, 0.003814278170466423, -0.027903037145733833, -0.016562707722187042, 0.016595076769590378, -0.002704253187403083, 0.05731667950749397, 0.010358436033129692, 0.023910721763968468, 0.08347173035144806, -...
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": "container_id", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}}, "body": [{"_type": "If", "_fields": {"body": [{"_type": "Return", "_fields": {"value": null}}], "test": {"_type": "Compare", "_fields": {"ops": [{"_type": "NotIn", "_fields": {}}], "left": {"_type": "Name", "_fields": {"id": "container_id", "ctx": {"_type": "Load", "_fields": {}}}}, "comparators": [{"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "_containers", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}]}}, "orelse": []}}, {"_type": "Assign", "_fields": {"value": {"_type": "Subscript", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "slice": {"_type": "Name", "_fields": {"id": "container_id", "ctx": {"_type": "Load", "_fields": {}}}}, "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "_containers", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}}}, "targets": [{"_type": "Name", "_fields": {"id": "container", "ctx": {"_type": "Store", "_fields": {}}}}], "type_comment": null}}, {"_type": "Assign", "_fields": {"value": {"_type": "Dict", "_fields": {"keys": [{"_type": "Constant", "_fields": {"kind": null, "value": "Args"}}, {"_type": "Constant", "_fields": {"kind": null, "value": "Config"}}, {"_type": "Constant", "_fields": {"kind": null, "value": "Created"}}, {"_type": "Constant", "_fields": {"kind": null, "value": "ID"}}, {"_type": "Constant", "_fields": {"kind": null, "value": "Image"}}, {"_type": "Constant", "_fields": {"kind": null, "value": "NetworkSettings"}}, {"_type": "Constant", "_fields": {"kind": null, "value": "Path"}}, {"_type": "Constant", "_fields": {"kind": null, "value": "ResolvConfPath"}}, {"_type": "Constant", "_fields": {"kind": null, "value": "State"}}, {"_type": "Constant", "_fields": {"kind": null, "value": "SysInitPath"}}, {"_type": "Constant", "_fields": {"kind": null, "value": "Volumes"}}], "values": [{"_type": "List", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "elts": []}}, {"_type": "Subscript", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "slice": {"_type": "Constant", "_fields": {"kind": null, "value": "config"}}, "value": {"_type": "Name", "_fields": {"id": "container", "ctx": {"_type": "Load", "_fields": {}}}}}}, {"_type": "Call", "_fields": {"args": [{"_type": "Call", "_fields": {"args": [], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "utcnow", "value": {"_type": "Name", "_fields": {"id": "timeutils", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}], "func": {"_type": "Name", "_fields": {"id": "str", "ctx": {"_type": "Load", "_fields": {}}}}, "keywords": []}}, {"_type": "Name", "_fields": {"id": "container_id", "ctx": {"_type": "Load", "_fields": {}}}}, {"_type": "Call", "_fields": {"args": [], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "_fake_id", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}, {"_type": "Dict", "_fields": {"keys": [{"_type": "Constant", "_fields": {"kind": null, "value": "Bridge"}}, {"_type": "Constant", "_fields": {"kind": null, "value": "Gateway"}}, {"_type": "Constant", "_fields": {"kind": null, "value": "IPAddress"}}, {"_type": "Constant", "_fields": {"kind": null, "value": "IPPrefixLen"}}, {"_type": "Constant", "_fields": {"kind": null, "value": "PortMapping"}}], "values": [{"_type": "Constant", "_fields": {"kind": null, "value": ""}}, {"_type": "Constant", "_fields": {"kind": null, "value": ""}}, {"_type": "Constant", "_fields": {"kind": null, "value": ""}}, {"_type": "Constant", "_fields": {"kind": null, "value": 0}}, {"_type": "Constant", "_fields": {"kind": null, "value": null}}]}}, {"_type": "Constant", "_fields": {"kind": null, "value": "bash"}}, {"_type": "Constant", "_fields": {"kind": null, "value": "/etc/resolv.conf"}}, {"_type": "Dict", "_fields": {"keys": [{"_type": "Constant", "_fields": {"kind": null, "value": "ExitCode"}}, {"_type": "Constant", "_fields": {"kind": null, "value": "Ghost"}}, {"_type": "Constant", "_fields": {"kind": null, "value": "Pid"}}, {"_type": "Constant", "_fields": {"kind": null, "value": "Running"}}, {"_type": "Constant", "_fields": {"kind": null, "value": "StartedAt"}}], "values": [{"_type": "Constant", "_fields": {"kind": null, "value": 0}}, {"_type": "Constant", "_fields": {"kind": null, "value": false}}, {"_type": "Constant", "_fields": {"kind": null, "value": 0}}, {"_type": "Subscript", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "slice": {"_type": "Constant", "_fields": {"kind": null, "value": "running"}}, "value": {"_type": "Name", "_fields": {"id": "container", "ctx": {"_type": "Load", "_fields": {}}}}}}, {"_type": "Call", "_fields": {"args": [{"_type": "Call", "_fields": {"args": [], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "utcnow", "value": {"_type": "Name", "_fields": {"id": "timeutils", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}], "func": {"_type": "Name", "_fields": {"id": "str", "ctx": {"_type": "Load", "_fields": {}}}}, "keywords": []}}]}}, {"_type": "Constant", "_fields": {"kind": null, "value": "/tmp/docker"}}, {"_type": "Dict", "_fields": {"keys": [], "values": []}}]}}, "targets": [{"_type": "Name", "_fields": {"id": "info", "ctx": {"_type": "Store", "_fields": {}}}}], "type_comment": null}}, {"_type": "Return", "_fields": {"value": {"_type": "Name", "_fields": {"id": "info", "ctx": {"_type": "Load", "_fields": {}}}}}}], "name": "inspect_container", "returns": null, "type_params": [], "type_comment": null, "decorator_list": []}}], "type_ignores": []}}
def inspect_container(self, container_id): if container_id not in self._containers: return container = self._containers[container_id] info = { 'Args': [], 'Config': container['config'], 'Created': str(timeutils.utcnow()), 'ID': container_id, 'Image': self._fake_id(), 'NetworkSettings': { 'Bridge': '', 'Gateway': '', 'IPAddress': '', 'IPPrefixLen': 0, 'PortMapping': None }, 'Path': 'bash', 'ResolvConfPath': '/etc/resolv.conf', 'State': { 'ExitCode': 0, 'Ghost': False, 'Pid': 0, 'Running': container['running'], 'StartedAt': str(timeutils.utcnow()) }, 'SysInitPath': '/tmp/docker', 'Volumes': {}, } return info
14,142
[ 0.00985247828066349, 0.025742603465914726, 0.05424870550632477, -0.027755150571465492, -0.035775307565927505, 0.019239366054534912, -0.011549627408385277, -0.06770575046539307, -0.002921199658885598, 0.046108394861221313, 0.019014080986380577, -0.07347305119037628, 0.04544755816459656, -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": "config", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "logger", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [{"_type": "Constant", "_fields": {"kind": null, "value": null}}], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}}, "body": [{"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}, {"_type": "Name", "_fields": {"id": "config", "ctx": {"_type": "Load", "_fields": {}}}}, {"_type": "Name", "_fields": {"id": "logger", "ctx": {"_type": "Load", "_fields": {}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "__init__", "value": {"_type": "Name", "_fields": {"id": "Analyser_Osmosis", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"args": [], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "def_class", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": [{"_type": "keyword", "_fields": {"arg": "item", "value": {"_type": "Constant", "_fields": {"kind": null, "value": 2060}}}}, {"_type": "keyword", "_fields": {"arg": "level", "value": {"_type": "Constant", "_fields": {"kind": null, "value": 3}}}}, {"_type": "keyword", "_fields": {"arg": "tags", "value": {"_type": "List", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "elts": [{"_type": "Constant", "_fields": {"kind": null, "value": "addr"}}, {"_type": "Constant", "_fields": {"kind": null, "value": "relation"}}, {"_type": "Constant", "_fields": {"kind": null, "value": "fix:chair"}}]}}}}, {"_type": "keyword", "_fields": {"arg": "title", "value": {"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"kind": null, "value": "addr:housenumber or addr:housename without addr:street, addr:district, addr:neighbourhood, addr:quarter, addr:suburb, addr:place or addr:hamlet must be in a associatedStreet relation"}}], "func": {"_type": "Name", "_fields": {"id": "T_", "ctx": {"_type": "Load", "_fields": {}}}}, "keywords": []}}}}, {"_type": "keyword", "_fields": {"arg": "detail", "value": {"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"kind": null, "value": "There is only a part of the required tag `addr:*=*`. They do not\nprovide a consistent address."}}], "func": {"_type": "Name", "_fields": {"id": "T_", "ctx": {"_type": "Load", "_fields": {}}}}, "keywords": []}}}}]}}, "targets": [{"_type": "Subscript", "_fields": {"ctx": {"_type": "Store", "_fields": {}}, "slice": {"_type": "Constant", "_fields": {"kind": null, "value": 1}}, "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "classs", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}}}], "type_comment": null}}, {"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"args": [], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "def_class", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": [{"_type": "keyword", "_fields": {"arg": "item", "value": {"_type": "Constant", "_fields": {"kind": null, "value": 2060}}}}, {"_type": "keyword", "_fields": {"arg": "level", "value": {"_type": "Constant", "_fields": {"kind": null, "value": 2}}}}, {"_type": "keyword", "_fields": {"arg": "tags", "value": {"_type": "List", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "elts": [{"_type": "Constant", "_fields": {"kind": null, "value": "addr"}}, {"_type": "Constant", "_fields": {"kind": null, "value": "relation"}}, {"_type": "Constant", "_fields": {"kind": null, "value": "fix:chair"}}]}}}}, {"_type": "keyword", "_fields": {"arg": "title", "value": {"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"kind": null, "value": "No street role"}}], "func": {"_type": "Name", "_fields": {"id": "T_", "ctx": {"_type": "Load", "_fields": {}}}}, "keywords": []}}}}, {"_type": "keyword", "_fields": {"arg": "detail", "value": {"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"kind": null, "value": "The street is not present in relation with the role `street`."}}], "func": {"_type": "Name", "_fields": {"id": "T_", "ctx": {"_type": "Load", "_fields": {}}}}, "keywords": []}}}}]}}, "targets": [{"_type": "Subscript", "_fields": {"ctx": {"_type": "Store", "_fields": {}}, "slice": {"_type": "Constant", "_fields": {"kind": null, "value": 2}}, "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "classs_change", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}}}], "type_comment": null}}, {"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"args": [], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "def_class", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": [{"_type": "keyword", "_fields": {"arg": "item", "value": {"_type": "Constant", "_fields": {"kind": null, "value": 2060}}}}, {"_type": "keyword", "_fields": {"arg": "level", "value": {"_type": "Constant", "_fields": {"kind": null, "value": 2}}}}, {"_type": "keyword", "_fields": {"arg": "tags", "value": {"_type": "List", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "elts": [{"_type": "Constant", "_fields": {"kind": null, "value": "addr"}}, {"_type": "Constant", "_fields": {"kind": null, "value": "fix:chair"}}]}}}}, {"_type": "keyword", "_fields": {"arg": "title", "value": {"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"kind": null, "value": "street role is not an highway"}}], "func": {"_type": "Name", "_fields": {"id": "T_", "ctx": {"_type": "Load", "_fields": {}}}}, "keywords": []}}}}, {"_type": "keyword", "_fields": {"arg": "detail", "value": {"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"kind": null, "value": "The street must be a highway."}}], "func": {"_type": "Name", "_fields": {"id": "T_", "ctx": {"_type": "Load", "_fields": {}}}}, "keywords": []}}}}]}}, "targets": [{"_type": "Subscript", "_fields": {"ctx": {"_type": "Store", "_fields": {}}, "slice": {"_type": "Constant", "_fields": {"kind": null, "value": 3}}, "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "classs_change", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}}}], "type_comment": null}}, {"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"args": [], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "def_class", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": [{"_type": "keyword", "_fields": {"arg": "item", "value": {"_type": "Constant", "_fields": {"kind": null, "value": 2060}}}}, {"_type": "keyword", "_fields": {"arg": "level", "value": {"_type": "Constant", "_fields": {"kind": null, "value": 3}}}}, {"_type": "keyword", "_fields": {"arg": "tags", "value": {"_type": "List", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "elts": [{"_type": "Constant", "_fields": {"kind": null, "value": "addr"}}, {"_type": "Constant", "_fields": {"kind": null, "value": "relation"}}, {"_type": "Constant", "_fields": {"kind": null, "value": "fix:chair"}}]}}}}, {"_type": "keyword", "_fields": {"arg": "title", "value": {"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"kind": null, "value": "Roleless member"}}], "func": {"_type": "Name", "_fields": {"id": "T_", "ctx": {"_type": "Load", "_fields": {}}}}, "keywords": []}}}}, {"_type": "keyword", "_fields": {"arg": "detail", "value": {"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"kind": null, "value": "A member without role is present in the relation."}}], "func": {"_type": "Name", "_fields": {"id": "T_", "ctx": {"_type": "Load", "_fields": {}}}}, "keywords": []}}}}]}}, "targets": [{"_type": "Subscript", "_fields": {"ctx": {"_type": "Store", "_fields": {}}, "slice": {"_type": "Constant", "_fields": {"kind": null, "value": 4}}, "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "classs_change", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}}}], "type_comment": null}}, {"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"args": [], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "def_class", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": [{"_type": "keyword", "_fields": {"arg": "item", "value": {"_type": "Constant", "_fields": {"kind": null, "value": 2060}}}}, {"_type": "keyword", "_fields": {"arg": "level", "value": {"_type": "Constant", "_fields": {"kind": null, "value": 3}}}}, {"_type": "keyword", "_fields": {"arg": "tags", "value": {"_type": "List", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "elts": [{"_type": "Constant", "_fields": {"kind": null, "value": "addr"}}, {"_type": "Constant", "_fields": {"kind": null, "value": "fix:chair"}}]}}}}, {"_type": "keyword", "_fields": {"arg": "title", "value": {"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"kind": null, "value": "Member without addr:housenumber nor addr:housename"}}], "func": {"_type": "Name", "_fields": {"id": "T_", "ctx": {"_type": "Load", "_fields": {}}}}, "keywords": []}}}}, {"_type": "keyword", "_fields": {"arg": "detail", "value": {"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"kind": null, "value": "Address without number is present."}}], "func": {"_type": "Name", "_fields": {"id": "T_", "ctx": {"_type": "Load", "_fields": {}}}}, "keywords": []}}}}]}}, "targets": [{"_type": "Subscript", "_fields": {"ctx": {"_type": "Store", "_fields": {}}, "slice": {"_type": "Constant", "_fields": {"kind": null, "value": 5}}, "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "classs_change", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}}}], "type_comment": null}}, {"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"args": [], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "def_class", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": [{"_type": "keyword", "_fields": {"arg": "item", "value": {"_type": "Constant", "_fields": {"kind": null, "value": 2060}}}}, {"_type": "keyword", "_fields": {"arg": "level", "value": {"_type": "Constant", "_fields": {"kind": null, "value": 3}}}}, {"_type": "keyword", "_fields": {"arg": "tags", "value": {"_type": "List", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "elts": [{"_type": "Constant", "_fields": {"kind": null, "value": "addr"}}, {"_type": "Constant", "_fields": {"kind": null, "value": "fix:survey"}}]}}}}, {"_type": "keyword", "_fields": {"arg": "title", "value": {"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"kind": null, "value": "Number twice in the street"}}], "func": {"_type": "Name", "_fields": {"id": "T_", "ctx": {"_type": "Load", "_fields": {}}}}, "keywords": []}}}}]}}, "targets": [{"_type": "Subscript", "_fields": {"ctx": {"_type": "Store", "_fields": {}}, "slice": {"_type": "Constant", "_fields": {"kind": null, "value": 6}}, "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "classs", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}}}], "type_comment": null}}, {"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"args": [], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "def_class", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": [{"_type": "keyword", "_fields": {"arg": "item", "value": {"_type": "Constant", "_fields": {"kind": null, "value": 2060}}}}, {"_type": "keyword", "_fields": {"arg": "level", "value": {"_type": "Constant", "_fields": {"kind": null, "value": 2}}}}, {"_type": "keyword", "_fields": {"arg": "tags", "value": {"_type": "List", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "elts": [{"_type": "Constant", "_fields": {"kind": null, "value": "addr"}}, {"_type": "Constant", "_fields": {"kind": null, "value": "fix:chair"}}]}}}}, {"_type": "keyword", "_fields": {"arg": "title", "value": {"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"kind": null, "value": "Many street names"}}], "func": {"_type": "Name", "_fields": {"id": "T_", "ctx": {"_type": "Load", "_fields": {}}}}, "keywords": []}}}}]}}, "targets": [{"_type": "Subscript", "_fields": {"ctx": {"_type": "Store", "_fields": {}}, "slice": {"_type": "Constant", "_fields": {"kind": null, "value": 7}}, "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "classs", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}}}], "type_comment": null}}, {"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"args": [], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "def_class", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": [{"_type": "keyword", "_fields": {"arg": "item", "value": {"_type": "Constant", "_fields": {"kind": null, "value": 2060}}}}, {"_type": "keyword", "_fields": {"arg": "level", "value": {"_type": "Constant", "_fields": {"kind": null, "value": 2}}}}, {"_type": "keyword", "_fields": {"arg": "tags", "value": {"_type": "List", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "elts": [{"_type": "Constant", "_fields": {"kind": null, "value": "addr"}}, {"_type": "Constant", "_fields": {"kind": null, "value": "relation"}}, {"_type": "Constant", "_fields": {"kind": null, "value": "fix:chair"}}]}}}}, {"_type": "keyword", "_fields": {"arg": "title", "value": {"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"kind": null, "value": "Many relations on one street"}}], "func": {"_type": "Name", "_fields": {"id": "T_", "ctx": {"_type": "Load", "_fields": {}}}}, "keywords": []}}}}]}}, "targets": [{"_type": "Subscript", "_fields": {"ctx": {"_type": "Store", "_fields": {}}, "slice": {"_type": "Constant", "_fields": {"kind": null, "value": 8}}, "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "classs", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}}}], "type_comment": null}}, {"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"args": [], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "def_class", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": [{"_type": "keyword", "_fields": {"arg": "item", "value": {"_type": "Constant", "_fields": {"kind": null, "value": 2060}}}}, {"_type": "keyword", "_fields": {"arg": "level", "value": {"_type": "Constant", "_fields": {"kind": null, "value": 2}}}}, {"_type": "keyword", "_fields": {"arg": "tags", "value": {"_type": "List", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "elts": [{"_type": "Constant", "_fields": {"kind": null, "value": "addr"}}, {"_type": "Constant", "_fields": {"kind": null, "value": "geom"}}, {"_type": "Constant", "_fields": {"kind": null, "value": "fix:chair"}}]}}}}, {"_type": "keyword", "_fields": {"arg": "title", "value": {"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"kind": null, "value": "House too far away from street"}}], "func": {"_type": "Name", "_fields": {"id": "T_", "ctx": {"_type": "Load", "_fields": {}}}}, "keywords": []}}}}]}}, "targets": [{"_type": "Subscript", "_fields": {"ctx": {"_type": "Store", "_fields": {}}, "slice": {"_type": "Constant", "_fields": {"kind": null, "value": 9}}, "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "classs", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}}}], "type_comment": null}}, {"_type": "If", "_fields": {"body": [{"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"args": [], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "def_class", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": [{"_type": "keyword", "_fields": {"arg": "item", "value": {"_type": "Constant", "_fields": {"kind": null, "value": 2060}}}}, {"_type": "keyword", "_fields": {"arg": "level", "value": {"_type": "Constant", "_fields": {"kind": null, "value": 2}}}}, {"_type": "keyword", "_fields": {"arg": "tags", "value": {"_type": "List", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "elts": [{"_type": "Constant", "_fields": {"kind": null, "value": "addr"}}, {"_type": "Constant", "_fields": {"kind": null, "value": "fix:chair"}}]}}}}, {"_type": "keyword", "_fields": {"arg": "title", "value": {"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"kind": null, "value": "Tag \"addr:city\" not matching a city"}}], "func": {"_type": "Name", "_fields": {"id": "T_", "ctx": {"_type": "Load", "_fields": {}}}}, "keywords": []}}}}]}}, "targets": [{"_type": "Subscript", "_fields": {"ctx": {"_type": "Store", "_fields": {}}, "slice": {"_type": "Constant", "_fields": {"kind": null, "value": 12}}, "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "classs", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}}}], "type_comment": null}}], "test": {"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"kind": null, "value": "addr:city-admin_level"}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "get", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "options", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "config", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}}}}}, "keywords": []}}, "orelse": []}}, {"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"args": [], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "def_class", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": [{"_type": "keyword", "_fields": {"arg": "item", "value": {"_type": "Constant", "_fields": {"kind": null, "value": "2060"}}}}, {"_type": "keyword", "_fields": {"arg": "level", "value": {"_type": "Constant", "_fields": {"kind": null, "value": 2}}}}, {"_type": "keyword", "_fields": {"arg": "tags", "value": {"_type": "List", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "elts": [{"_type": "Constant", "_fields": {"kind": null, "value": "addr"}}, {"_type": "Constant", "_fields": {"kind": null, "value": "fix:chair"}}]}}}}, {"_type": "keyword", "_fields": {"arg": "title", "value": {"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"kind": null, "value": "Missing highway in associatedStreet relation"}}], "func": {"_type": "Name", "_fields": {"id": "T_", "ctx": {"_type": "Load", "_fields": {}}}}, "keywords": []}}}}, {"_type": "keyword", "_fields": {"arg": "fix", "value": {"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"kind": null, "value": "Extend the relation to include the way with the same name."}}], "func": {"_type": "Name", "_fields": {"id": "T_", "ctx": {"_type": "Load", "_fields": {}}}}, "keywords": []}}}}]}}, "targets": [{"_type": "Subscript", "_fields": {"ctx": {"_type": "Store", "_fields": {}}, "slice": {"_type": "Constant", "_fields": {"kind": null, "value": 18}}, "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "classs", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}}}], "type_comment": null}}, {"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"args": [], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "def_class", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": [{"_type": "keyword", "_fields": {"arg": "item", "value": {"_type": "Constant", "_fields": {"kind": null, "value": "2060"}}}}, {"_type": "keyword", "_fields": {"arg": "level", "value": {"_type": "Constant", "_fields": {"kind": null, "value": 2}}}}, {"_type": "keyword", "_fields": {"arg": "tags", "value": {"_type": "List", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "elts": [{"_type": "Constant", "_fields": {"kind": null, "value": "addr"}}, {"_type": "Constant", "_fields": {"kind": null, "value": "fix:chair"}}]}}}}, {"_type": "keyword", "_fields": {"arg": "title", "value": {"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"kind": null, "value": "Tag \"addr:street\" not matching a street name around"}}], "func": {"_type": "Name", "_fields": {"id": "T_", "ctx": {"_type": "Load", "_fields": {}}}}, "keywords": []}}}}]}}, "targets": [{"_type": "Subscript", "_fields": {"ctx": {"_type": "Store", "_fields": {}}, "slice": {"_type": "Constant", "_fields": {"kind": null, "value": 19}}, "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "classs", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}}}], "type_comment": null}}, {"_type": "Assign", "_fields": {"value": {"_type": "Lambda", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "res", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}}, "body": {"_type": "BoolOp", "_fields": {"op": {"_type": "And", "_fields": {}}, "values": [{"_type": "Subscript", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "slice": {"_type": "Constant", "_fields": {"kind": null, "value": 1}}, "value": {"_type": "Name", "_fields": {"id": "res", "ctx": {"_type": "Load", "_fields": {}}}}}}, {"_type": "Dict", "_fields": {"keys": [{"_type": "Constant", "_fields": {"kind": null, "value": "class"}}, {"_type": "Constant", "_fields": {"kind": null, "value": "subclass"}}, {"_type": "Constant", "_fields": {"kind": null, "value": "data"}}], "values": [{"_type": "Constant", "_fields": {"kind": null, "value": 2}}, {"_type": "Constant", "_fields": {"kind": null, "value": 1}}, {"_type": "List", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "elts": [{"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "relation_full", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}, {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "positionAsText", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}]}}]}}]}}}}, "targets": [{"_type": "Attribute", "_fields": {"ctx": {"_type": "Store", "_fields": {}}, "attr": "callback20", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}], "type_comment": null}}, {"_type": "Assign", "_fields": {"value": {"_type": "Lambda", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "res", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}}, "body": {"_type": "Dict", "_fields": {"keys": [{"_type": "Constant", "_fields": {"kind": null, "value": "class"}}, {"_type": "Constant", "_fields": {"kind": null, "value": "subclass"}}, {"_type": "Constant", "_fields": {"kind": null, "value": "data"}}], "values": [{"_type": "Constant", "_fields": {"kind": null, "value": 3}}, {"_type": "Constant", "_fields": {"kind": null, "value": 1}}, {"_type": "List", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "elts": [{"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "way_full", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}, {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "relation", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}, {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "positionAsText", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}]}}]}}}}, "targets": [{"_type": "Attribute", "_fields": {"ctx": {"_type": "Store", "_fields": {}}, "attr": "callback30", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}], "type_comment": null}}, {"_type": "Assign", "_fields": {"value": {"_type": "Lambda", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "res", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}}, "body": {"_type": "Dict", "_fields": {"keys": [{"_type": "Constant", "_fields": {"kind": null, "value": "class"}}, {"_type": "Constant", "_fields": {"kind": null, "value": "subclass"}}, {"_type": "Constant", "_fields": {"kind": null, "value": "data"}}], "values": [{"_type": "Constant", "_fields": {"kind": null, "value": 4}}, {"_type": "Constant", "_fields": {"kind": null, "value": 1}}, {"_type": "List", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "elts": [{"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "node_full", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}, {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "relation", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}, {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "positionAsText", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}]}}]}}}}, "targets": [{"_type": "Attribute", "_fields": {"ctx": {"_type": "Store", "_fields": {}}, "attr": "callback40", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}], "type_comment": null}}, {"_type": "Assign", "_fields": {"value": {"_type": "Lambda", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "res", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}}, "body": {"_type": "Dict", "_fields": {"keys": [{"_type": "Constant", "_fields": {"kind": null, "value": "class"}}, {"_type": "Constant", "_fields": {"kind": null, "value": "subclass"}}, {"_type": "Constant", "_fields": {"kind": null, "value": "data"}}], "values": [{"_type": "Constant", "_fields": {"kind": null, "value": 4}}, {"_type": "Constant", "_fields": {"kind": null, "value": 2}}, {"_type": "List", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "elts": [{"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "way_full", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}, {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "relation", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}, {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "positionAsText", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}]}}]}}}}, "targets": [{"_type": "Attribute", "_fields": {"ctx": {"_type": "Store", "_fields": {}}, "attr": "callback41", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}], "type_comment": null}}, {"_type": "Assign", "_fields": {"value": {"_type": "Lambda", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "res", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}}, "body": {"_type": "Dict", "_fields": {"keys": [{"_type": "Constant", "_fields": {"kind": null, "value": "class"}}, {"_type": "Constant", "_fields": {"kind": null, "value": "subclass"}}, {"_type": "Constant", "_fields": {"kind": null, "value": "data"}}], "values": [{"_type": "Constant", "_fields": {"kind": null, "value": 5}}, {"_type": "Constant", "_fields": {"kind": null, "value": 1}}, {"_type": "List", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "elts": [{"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "node_full", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}, {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "relation", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}, {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "positionAsText", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}]}}]}}}}, "targets": [{"_type": "Attribute", "_fields": {"ctx": {"_type": "Store", "_fields": {}}, "attr": "callback50", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}], "type_comment": null}}, {"_type": "Assign", "_fields": {"value": {"_type": "Lambda", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "res", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}}, "body": {"_type": "Dict", "_fields": {"keys": [{"_type": "Constant", "_fields": {"kind": null, "value": "class"}}, {"_type": "Constant", "_fields": {"kind": null, "value": "subclass"}}, {"_type": "Constant", "_fields": {"kind": null, "value": "data"}}], "values": [{"_type": "Constant", "_fields": {"kind": null, "value": 5}}, {"_type": "Constant", "_fields": {"kind": null, "value": 1}}, {"_type": "List", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "elts": [{"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "way_full", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}, {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "relation", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}, {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "positionAsText", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}]}}]}}}}, "targets": [{"_type": "Attribute", "_fields": {"ctx": {"_type": "Store", "_fields": {}}, "attr": "callback51", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}], "type_comment": null}}, {"_type": "Assign", "_fields": {"value": {"_type": "Lambda", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "res", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}}, "body": {"_type": "Dict", "_fields": {"keys": [{"_type": "Constant", "_fields": {"kind": null, "value": "class"}}, {"_type": "Constant", "_fields": {"kind": null, "value": "subclass"}}, {"_type": "Constant", "_fields": {"kind": null, "value": "data"}}], "values": [{"_type": "Constant", "_fields": {"kind": null, "value": 12}}, {"_type": "Constant", "_fields": {"kind": null, "value": 1}}, {"_type": "List", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "elts": [{"_type": "Lambda", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "t", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}}, "body": {"_type": "Call", "_fields": {"args": [{"_type": "Name", "_fields": {"id": "t", "ctx": {"_type": "Load", "_fields": {}}}}], "func": {"_type": "Subscript", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "slice": {"_type": "Subscript", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "slice": {"_type": "Constant", "_fields": {"kind": null, "value": 1}}, "value": {"_type": "Name", "_fields": {"id": "res", "ctx": {"_type": "Load", "_fields": {}}}}}}, "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "typeMapping", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}}}, "keywords": []}}}}, {"_type": "Constant", "_fields": {"kind": null, "value": null}}, {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "positionAsText", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}]}}]}}}}, "targets": [{"_type": "Attribute", "_fields": {"ctx": {"_type": "Store", "_fields": {}}, "attr": "callbackC2", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}], "type_comment": null}}, {"_type": "Assign", "_fields": {"value": {"_type": "Lambda", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "res", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}}, "body": {"_type": "Dict", "_fields": {"keys": [{"_type": "Constant", "_fields": {"kind": null, "value": "class"}}, {"_type": "Constant", "_fields": {"kind": null, "value": "subclass"}}, {"_type": "Constant", "_fields": {"kind": null, "value": "data"}}, {"_type": "Constant", "_fields": {"kind": null, "value": "text"}}], "values": [{"_type": "Constant", "_fields": {"kind": null, "value": 19}}, {"_type": "Constant", "_fields": {"kind": null, "value": 1}}, {"_type": "List", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "elts": [{"_type": "Lambda", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "t", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}}, "body": {"_type": "Call", "_fields": {"args": [{"_type": "Name", "_fields": {"id": "t", "ctx": {"_type": "Load", "_fields": {}}}}], "func": {"_type": "Subscript", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "slice": {"_type": "Subscript", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "slice": {"_type": "Constant", "_fields": {"kind": null, "value": 1}}, "value": {"_type": "Name", "_fields": {"id": "res", "ctx": {"_type": "Load", "_fields": {}}}}}}, "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "typeMapping", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}}}, "keywords": []}}}}, {"_type": "Constant", "_fields": {"kind": null, "value": null}}, {"_type": "Constant", "_fields": {"kind": null, "value": null}}, {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "positionAsText", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}]}}, {"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"kind": null, "value": "No street with name \"{0}\" found around"}}, {"_type": "Subscript", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "slice": {"_type": "Constant", "_fields": {"kind": null, "value": 2}}, "value": {"_type": "Name", "_fields": {"id": "res", "ctx": {"_type": "Load", "_fields": {}}}}}}], "func": {"_type": "Name", "_fields": {"id": "T_", "ctx": {"_type": "Load", "_fields": {}}}}, "keywords": []}}]}}}}, "targets": [{"_type": "Attribute", "_fields": {"ctx": {"_type": "Store", "_fields": {}}, "attr": "callbackD1", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}], "type_comment": null}}, {"_type": "Assign", "_fields": {"value": {"_type": "Lambda", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "res", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}}, "body": {"_type": "Dict", "_fields": {"keys": [{"_type": "Constant", "_fields": {"kind": null, "value": "class"}}, {"_type": "Constant", "_fields": {"kind": null, "value": "subclass"}}, {"_type": "Constant", "_fields": {"kind": null, "value": "data"}}], "values": [{"_type": "Constant", "_fields": {"kind": null, "value": 18}}, {"_type": "Constant", "_fields": {"kind": null, "value": 1}}, {"_type": "List", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "elts": [{"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "way_full", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}, {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "relation", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}, {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "positionAsText", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}]}}]}}}}, "targets": [{"_type": "Attribute", "_fields": {"ctx": {"_type": "Store", "_fields": {}}, "attr": "callbackF0", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}], "type_comment": null}}], "name": "__init__", "returns": null, "type_params": [], "type_comment": null, "decorator_list": []}}], "type_ignores": []}}
def __init__(self, config, logger = None): Analyser_Osmosis.__init__(self, config, logger) self.classs[1] = self.def_class(item = 2060, level = 3, tags = ['addr', 'relation', 'fix:chair'], title = T_('addr:housenumber or addr:housename without addr:street, addr:district, addr:neighbourhood, addr:quarter, addr:suburb, addr:place or addr:hamlet must be in a associatedStreet relation'), detail = T_( '''There is only a part of the required tag `addr:*=*`. They do not provide a consistent address.''')) self.classs_change[2] = self.def_class(item = 2060, level = 2, tags = ['addr', 'relation', 'fix:chair'], title = T_('No street role'), detail = T_( '''The street is not present in relation with the role `street`.''')) self.classs_change[3] = self.def_class(item = 2060, level = 2, tags = ['addr', 'fix:chair'], title = T_('street role is not an highway'), detail = T_( '''The street must be a highway.''')) self.classs_change[4] = self.def_class(item = 2060, level = 3, tags = ['addr', 'relation', 'fix:chair'], title = T_('Roleless member'), detail = T_( '''A member without role is present in the relation.''')) self.classs_change[5] = self.def_class(item = 2060, level = 3, tags = ['addr', 'fix:chair'], title = T_('Member without addr:housenumber nor addr:housename'), detail = T_( '''Address without number is present.''')) self.classs[6] = self.def_class(item = 2060, level = 3, tags = ['addr', 'fix:survey'], title = T_('Number twice in the street')) self.classs[7] = self.def_class(item = 2060, level = 2, tags = ['addr', 'fix:chair'], title = T_('Many street names')) self.classs[8] = self.def_class(item = 2060, level = 2, tags = ['addr', 'relation', 'fix:chair'], title = T_('Many relations on one street')) self.classs[9] = self.def_class(item = 2060, level = 2, tags = ['addr', 'geom', 'fix:chair'], title = T_('House too far away from street')) if self.config.options.get("addr:city-admin_level"): self.classs[12] = self.def_class(item = 2060, level = 2, tags = ['addr', 'fix:chair'], title = T_('Tag "addr:city" not matching a city')) self.classs[18] = self.def_class(item ="2060", level = 2, tags = ['addr', 'fix:chair'], title = T_('Missing highway in associatedStreet relation'), fix = T_( '''Extend the relation to include the way with the same name.''')) self.classs[19] = self.def_class(item ="2060", level = 2, tags = ['addr', 'fix:chair'], title = T_('Tag "addr:street" not matching a street name around')) self.callback20 = lambda res: res[1] and {"class":2, "subclass":1, "data":[self.relation_full, self.positionAsText]} self.callback30 = lambda res: {"class":3, "subclass":1, "data":[self.way_full, self.relation, self.positionAsText]} self.callback40 = lambda res: {"class":4, "subclass":1, "data":[self.node_full, self.relation, self.positionAsText]} self.callback41 = lambda res: {"class":4, "subclass":2, "data":[self.way_full, self.relation, self.positionAsText]} self.callback50 = lambda res: {"class":5, "subclass":1, "data":[self.node_full, self.relation, self.positionAsText]} self.callback51 = lambda res: {"class":5, "subclass":1, "data":[self.way_full, self.relation, self.positionAsText]} self.callbackC2 = lambda res: {"class":12, "subclass":1, "data":[lambda t: self.typeMapping[res[1]](t), None, self.positionAsText]} self.callbackD1 = lambda res: {"class":19, "subclass":1, "data":[lambda t: self.typeMapping[res[1]](t), None, None, self.positionAsText], "text": T_("No street with name \"{0}\" found around", res[2])} self.callbackF0 = lambda res: {"class":18, "subclass":1, "data":[self.way_full, self.relation, self.positionAsText]}
14,143
[ -0.01631956174969673, 0.05184031277894974, 0.10147958248853683, -0.05687953904271126, -0.04378913342952728, -0.004615670070052147, 0.02308197133243084, -0.0457005649805069, -0.0007240267004817724, 0.022401386871933937, 0.0006896354607306421, -0.06429357081651688, 0.027397170662879944, 0.00...
15
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}}, "body": [{"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Call", "_fields": {"args": [{"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"kind": null, "value": "proj"}}, {"_type": "Constant", "_fields": {"kind": null, "value": 4326}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "get", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "options", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "config", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}}}}}, "keywords": []}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "format", "value": {"_type": "Name", "_fields": {"id": "sql00", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "run", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Call", "_fields": {"args": [{"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"kind": null, "value": "proj"}}, {"_type": "Constant", "_fields": {"kind": null, "value": 4326}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "get", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "options", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "config", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}}}}}, "keywords": []}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "format", "value": {"_type": "Name", "_fields": {"id": "sql01", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "run", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Name", "_fields": {"id": "sql10", "ctx": {"_type": "Load", "_fields": {}}}}, {"_type": "Lambda", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "res", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}}, "body": {"_type": "Dict", "_fields": {"keys": [{"_type": "Constant", "_fields": {"kind": null, "value": "class"}}, {"_type": "Constant", "_fields": {"kind": null, "value": "subclass"}}, {"_type": "Constant", "_fields": {"kind": null, "value": "data"}}], "values": [{"_type": "Constant", "_fields": {"kind": null, "value": 1}}, {"_type": "Constant", "_fields": {"kind": null, "value": 1}}, {"_type": "List", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "elts": [{"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "way_full", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}, {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "positionAsText", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}]}}]}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "run", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Name", "_fields": {"id": "sql11", "ctx": {"_type": "Load", "_fields": {}}}}, {"_type": "Lambda", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "res", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}}, "body": {"_type": "Dict", "_fields": {"keys": [{"_type": "Constant", "_fields": {"kind": null, "value": "class"}}, {"_type": "Constant", "_fields": {"kind": null, "value": "subclass"}}, {"_type": "Constant", "_fields": {"kind": null, "value": "data"}}], "values": [{"_type": "Constant", "_fields": {"kind": null, "value": 1}}, {"_type": "Constant", "_fields": {"kind": null, "value": 2}}, {"_type": "List", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "elts": [{"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "node_full", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}, {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "positionAsText", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}]}}]}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "run", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "If", "_fields": {"body": [{"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Call", "_fields": {"args": [{"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"kind": null, "value": "proj"}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "get", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "options", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "config", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}}}}}, "keywords": []}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "format", "value": {"_type": "Name", "_fields": {"id": "sql60", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "run", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Name", "_fields": {"id": "sql61", "ctx": {"_type": "Load", "_fields": {}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "run", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Name", "_fields": {"id": "sql62", "ctx": {"_type": "Load", "_fields": {}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "run", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Name", "_fields": {"id": "sql63", "ctx": {"_type": "Load", "_fields": {}}}}, {"_type": "Lambda", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "res", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}}, "body": {"_type": "Dict", "_fields": {"keys": [{"_type": "Constant", "_fields": {"kind": null, "value": "class"}}, {"_type": "Constant", "_fields": {"kind": null, "value": "subclass"}}, {"_type": "Constant", "_fields": {"kind": null, "value": "data"}}, {"_type": "Constant", "_fields": {"kind": null, "value": "text"}}], "values": [{"_type": "Constant", "_fields": {"kind": null, "value": 6}}, {"_type": "Constant", "_fields": {"kind": null, "value": 1}}, {"_type": "List", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "elts": [{"_type": "Lambda", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "t", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}}, "body": {"_type": "Call", "_fields": {"args": [{"_type": "Name", "_fields": {"id": "t", "ctx": {"_type": "Load", "_fields": {}}}}], "func": {"_type": "Subscript", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "slice": {"_type": "Subscript", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "slice": {"_type": "Constant", "_fields": {"kind": null, "value": 1}}, "value": {"_type": "Name", "_fields": {"id": "res", "ctx": {"_type": "Load", "_fields": {}}}}}}, "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "typeMapping", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}}}, "keywords": []}}}}, {"_type": "Constant", "_fields": {"kind": null, "value": null}}, {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "positionAsText", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}]}}, {"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"kind": null, "value": "Multiple numbers \"{numbers}\" in way \"{way}\""}}], "func": {"_type": "Name", "_fields": {"id": "T_", "ctx": {"_type": "Load", "_fields": {}}}}, "keywords": [{"_type": "keyword", "_fields": {"arg": "numbers", "value": {"_type": "Call", "_fields": {"args": [{"_type": "Call", "_fields": {"args": [{"_type": "Lambda", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "z", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}}, "body": {"_type": "Name", "_fields": {"id": "z", "ctx": {"_type": "Load", "_fields": {}}}}}}, {"_type": "Subscript", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "slice": {"_type": "Slice", "_fields": {"step": null, "lower": {"_type": "Constant", "_fields": {"kind": null, "value": 4}}, "upper": null}}, "value": {"_type": "Name", "_fields": {"id": "res", "ctx": {"_type": "Load", "_fields": {}}}}}}], "func": {"_type": "Name", "_fields": {"id": "filter", "ctx": {"_type": "Load", "_fields": {}}}}, "keywords": []}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "join", "value": {"_type": "Constant", "_fields": {"kind": null, "value": ", "}}}}, "keywords": []}}}}, {"_type": "keyword", "_fields": {"arg": "way", "value": {"_type": "Subscript", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "slice": {"_type": "Constant", "_fields": {"kind": null, "value": 3}}, "value": {"_type": "Name", "_fields": {"id": "res", "ctx": {"_type": "Load", "_fields": {}}}}}}}}]}}]}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "run", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}], "test": {"_type": "Compare", "_fields": {"ops": [{"_type": "In", "_fields": {}}], "left": {"_type": "Constant", "_fields": {"kind": null, "value": "proj"}}, "comparators": [{"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "options", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "config", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}}}]}}, "orelse": []}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Name", "_fields": {"id": "sql70", "ctx": {"_type": "Load", "_fields": {}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "run", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Name", "_fields": {"id": "sql80", "ctx": {"_type": "Load", "_fields": {}}}}, {"_type": "Lambda", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "res", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}}, "body": {"_type": "Dict", "_fields": {"keys": [{"_type": "Constant", "_fields": {"kind": null, "value": "class"}}, {"_type": "Constant", "_fields": {"kind": null, "value": "subclass"}}, {"_type": "Constant", "_fields": {"kind": null, "value": "data"}}, {"_type": "Constant", "_fields": {"kind": null, "value": "text"}}], "values": [{"_type": "Constant", "_fields": {"kind": null, "value": 7}}, {"_type": "Constant", "_fields": {"kind": null, "value": 1}}, {"_type": "List", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "elts": [{"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "relation_full", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}, {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "positionAsText", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}]}}, {"_type": "Dict", "_fields": {"keys": [{"_type": "Constant", "_fields": {"kind": null, "value": "en"}}], "values": [{"_type": "Subscript", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "slice": {"_type": "Constant", "_fields": {"kind": null, "value": 2}}, "value": {"_type": "Name", "_fields": {"id": "res", "ctx": {"_type": "Load", "_fields": {}}}}}}]}}]}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "run", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Name", "_fields": {"id": "sql90", "ctx": {"_type": "Load", "_fields": {}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "run", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Name", "_fields": {"id": "sql91", "ctx": {"_type": "Load", "_fields": {}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "run", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Name", "_fields": {"id": "sqlA0", "ctx": {"_type": "Load", "_fields": {}}}}, {"_type": "Lambda", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "res", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}}, "body": {"_type": "Dict", "_fields": {"keys": [{"_type": "Constant", "_fields": {"kind": null, "value": "class"}}, {"_type": "Constant", "_fields": {"kind": null, "value": "subclass"}}, {"_type": "Constant", "_fields": {"kind": null, "value": "data"}}], "values": [{"_type": "Constant", "_fields": {"kind": null, "value": 8}}, {"_type": "Constant", "_fields": {"kind": null, "value": 1}}, {"_type": "List", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "elts": [{"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "relation_full", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}, {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "relation_full", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}, {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "positionAsText", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}]}}]}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "run", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Name", "_fields": {"id": "sqlB0", "ctx": {"_type": "Load", "_fields": {}}}}, {"_type": "Lambda", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "res", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}}, "body": {"_type": "Dict", "_fields": {"keys": [{"_type": "Constant", "_fields": {"kind": null, "value": "class"}}, {"_type": "Constant", "_fields": {"kind": null, "value": "subclass"}}, {"_type": "Constant", "_fields": {"kind": null, "value": "data"}}], "values": [{"_type": "Constant", "_fields": {"kind": null, "value": 9}}, {"_type": "Constant", "_fields": {"kind": null, "value": 1}}, {"_type": "List", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "elts": [{"_type": "Lambda", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "t", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}}, "body": {"_type": "Call", "_fields": {"args": [{"_type": "Name", "_fields": {"id": "t", "ctx": {"_type": "Load", "_fields": {}}}}], "func": {"_type": "Subscript", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "slice": {"_type": "Subscript", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "slice": {"_type": "Constant", "_fields": {"kind": null, "value": 1}}, "value": {"_type": "Name", "_fields": {"id": "res", "ctx": {"_type": "Load", "_fields": {}}}}}}, "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "typeMapping", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}}}, "keywords": []}}}}, {"_type": "Constant", "_fields": {"kind": null, "value": null}}, {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "positionAsText", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}, {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "relation_full", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}]}}]}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "run", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "If", "_fields": {"body": [{"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Name", "_fields": {"id": "sqlC0", "ctx": {"_type": "Load", "_fields": {}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "run", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Call", "_fields": {"args": [{"_type": "Call", "_fields": {"args": [{"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"kind": null, "value": ","}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "split", "value": {"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"kind": null, "value": "addr:city-admin_level"}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "get", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "options", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "config", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}}}}}, "keywords": []}}}}, "keywords": []}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "join", "value": {"_type": "Constant", "_fields": {"kind": null, "value": "','"}}}}, "keywords": []}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "format", "value": {"_type": "Name", "_fields": {"id": "sqlC1", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "run", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Name", "_fields": {"id": "sqlC2", "ctx": {"_type": "Load", "_fields": {}}}}, {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "callbackC2", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "run", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}], "test": {"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"kind": null, "value": "addr:city-admin_level"}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "get", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "options", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "config", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}}}}}, "keywords": []}}, "orelse": []}}, {"_type": "If", "_fields": {"body": [{"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Name", "_fields": {"id": "sqlD0", "ctx": {"_type": "Load", "_fields": {}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "run", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Call", "_fields": {"args": [{"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"kind": null, "value": "addr:street_distance"}}, {"_type": "Constant", "_fields": {"kind": null, "value": 500}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "get", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "options", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "config", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}}}}}, "keywords": []}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "format", "value": {"_type": "Name", "_fields": {"id": "sqlD1", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}, {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "callbackD1", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "run", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}], "test": {"_type": "Compare", "_fields": {"ops": [{"_type": "In", "_fields": {}}], "left": {"_type": "Constant", "_fields": {"kind": null, "value": "proj"}}, "comparators": [{"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "options", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "config", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}}}]}}, "orelse": []}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Call", "_fields": {"args": [{"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"kind": null, "value": "proj"}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "get", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "options", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "config", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}}}}}, "keywords": []}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "format", "value": {"_type": "Name", "_fields": {"id": "sqlF0", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}, {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "callbackF0", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "run", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}], "name": "analyser_osmosis_common", "returns": null, "type_params": [], "type_comment": null, "decorator_list": []}}], "type_ignores": []}}
def analyser_osmosis_common(self): self.run(sql00.format(self.config.options.get("proj", 4326))) self.run(sql01.format(self.config.options.get("proj", 4326))) self.run(sql10, lambda res: {"class":1, "subclass":1, "data":[self.way_full, self.positionAsText]} ) self.run(sql11, lambda res: {"class":1, "subclass":2, "data":[self.node_full, self.positionAsText]} ) if "proj" in self.config.options: self.run(sql60.format(self.config.options.get("proj"))) self.run(sql61) self.run(sql62) self.run(sql63, lambda res: {"class":6, "subclass":1, "data":[lambda t: self.typeMapping[res[1]](t), None, self.positionAsText], "text": T_("Multiple numbers \"{numbers}\" in way \"{way}\"", numbers = ", ".join(filter(lambda z: z, res[4:])), way = res[3]), }) self.run(sql70) self.run(sql80, lambda res: {"class":7, "subclass":1, "data":[self.relation_full, self.positionAsText], "text":{"en": res[2]}} ) self.run(sql90) self.run(sql91) self.run(sqlA0, lambda res: {"class":8, "subclass":1, "data":[self.relation_full, self.relation_full, self.positionAsText]} ) self.run(sqlB0, lambda res: {"class":9, "subclass":1, "data":[lambda t: self.typeMapping[res[1]](t), None, self.positionAsText, self.relation_full]} ) if self.config.options.get("addr:city-admin_level"): self.run(sqlC0) self.run(sqlC1.format( "','".join(self.config.options.get("addr:city-admin_level").split(',')))) self.run(sqlC2, self.callbackC2) if "proj" in self.config.options: self.run(sqlD0) self.run(sqlD1.format(self.config.options.get("addr:street_distance", 500)), self.callbackD1) self.run(sqlF0.format(self.config.options.get("proj")), self.callbackF0)
14,144
[ 0.044125430285930634, 0.06082075461745262, 0.06099436432123184, -0.04288123548030853, -0.011827061884105206, 0.022120583802461624, 0.03998776525259018, -0.058071959763765335, 0.027357766404747963, 0.008217456750571728, 0.015277525410056114, -0.060589276254177094, 0.006387336645275354, 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": []}}, "body": [{"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"kind": null, "value": "touched_"}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "format", "value": {"_type": "Name", "_fields": {"id": "sql20", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}, {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "callback20", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "run", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"kind": null, "value": "touched_"}}, {"_type": "Constant", "_fields": {"kind": null, "value": ""}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "format", "value": {"_type": "Name", "_fields": {"id": "sql30", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}, {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "callback30", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "run", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"kind": null, "value": "not_touched_"}}, {"_type": "Constant", "_fields": {"kind": null, "value": "touched_"}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "format", "value": {"_type": "Name", "_fields": {"id": "sql30", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}, {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "callback30", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "run", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"kind": null, "value": "touched_"}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "format", "value": {"_type": "Name", "_fields": {"id": "sql40", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}, {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "callback40", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "run", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"kind": null, "value": "touched_"}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "format", "value": {"_type": "Name", "_fields": {"id": "sql41", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}, {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "callback41", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "run", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"kind": null, "value": "touched_"}}, {"_type": "Constant", "_fields": {"kind": null, "value": ""}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "format", "value": {"_type": "Name", "_fields": {"id": "sql50", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}, {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "callback50", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "run", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"kind": null, "value": "not_touched_"}}, {"_type": "Constant", "_fields": {"kind": null, "value": "touched_"}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "format", "value": {"_type": "Name", "_fields": {"id": "sql50", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}, {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "callback50", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "run", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"kind": null, "value": "touched_"}}, {"_type": "Constant", "_fields": {"kind": null, "value": ""}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "format", "value": {"_type": "Name", "_fields": {"id": "sql51", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}, {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "callback51", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "run", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"kind": null, "value": "not_touched_"}}, {"_type": "Constant", "_fields": {"kind": null, "value": "touched_"}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "format", "value": {"_type": "Name", "_fields": {"id": "sql51", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}, {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "callback51", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "run", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}], "name": "analyser_osmosis_diff", "returns": null, "type_params": [], "type_comment": null, "decorator_list": []}}], "type_ignores": []}}
def analyser_osmosis_diff(self): self.run(sql20.format("touched_"), self.callback20) self.run(sql30.format("touched_", ""), self.callback30) self.run(sql30.format("not_touched_", "touched_"), self.callback30) self.run(sql40.format("touched_"), self.callback40) self.run(sql41.format("touched_"), self.callback41) self.run(sql50.format("touched_", ""), self.callback50) self.run(sql50.format("not_touched_", "touched_"), self.callback50) self.run(sql51.format("touched_", ""), self.callback51) self.run(sql51.format("not_touched_", "touched_"), self.callback51)
14,145
[ 0.014240428805351257, -0.02332671731710434, 0.05928470566868782, 0.03070705756545067, 0.0001727876951918006, 0.007725160103291273, 0.040845952928066254, 0.0023487028665840626, -0.0043314131908118725, 0.02528674155473709, 0.0007750870427116752, 0.0044856746681034565, 0.021463483572006226, -...
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": {"args": [], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "Turtle", "value": {"_type": "Name", "_fields": {"id": "turtle", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}, "targets": [{"_type": "Name", "_fields": {"id": "mypen", "ctx": {"_type": "Store", "_fields": {}}}}], "type_comment": null}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"kind": null, "value": "white"}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "color", "value": {"_type": "Name", "_fields": {"id": "mypen", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "penup", "value": {"_type": "Name", "_fields": {"id": "mypen", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "UnaryOp", "_fields": {"op": {"_type": "USub", "_fields": {}}, "operand": {"_type": "Name", "_fields": {"id": "PLAYGROUND_SIDE", "ctx": {"_type": "Load", "_fields": {}}}}}}, {"_type": "UnaryOp", "_fields": {"op": {"_type": "USub", "_fields": {}}, "operand": {"_type": "Name", "_fields": {"id": "PLAYGROUND_SIDE", "ctx": {"_type": "Load", "_fields": {}}}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "setposition", "value": {"_type": "Name", "_fields": {"id": "mypen", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "pendown", "value": {"_type": "Name", "_fields": {"id": "mypen", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"kind": null, "value": 3}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "pensize", "value": {"_type": "Name", "_fields": {"id": "mypen", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "For", "_fields": {"body": [{"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "BinOp", "_fields": {"op": {"_type": "Mult", "_fields": {}}, "left": {"_type": "Constant", "_fields": {"kind": null, "value": 2}}, "right": {"_type": "Name", "_fields": {"id": "PLAYGROUND_SIDE", "ctx": {"_type": "Load", "_fields": {}}}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "forward", "value": {"_type": "Name", "_fields": {"id": "mypen", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"kind": null, "value": 90}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "left", "value": {"_type": "Name", "_fields": {"id": "mypen", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "hideturtle", "value": {"_type": "Name", "_fields": {"id": "mypen", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}], "iter": {"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"kind": null, "value": 4}}], "func": {"_type": "Name", "_fields": {"id": "range", "ctx": {"_type": "Load", "_fields": {}}}}, "keywords": []}}, "orelse": [], "target": {"_type": "Name", "_fields": {"id": "side", "ctx": {"_type": "Store", "_fields": {}}}}, "type_comment": null}}], "name": "drow_border", "returns": null, "type_params": [], "type_comment": null, "decorator_list": []}}], "type_ignores": []}}
def drow_border(): mypen = turtle.Turtle() mypen.color('white') mypen.penup() mypen.setposition(-PLAYGROUND_SIDE, -PLAYGROUND_SIDE) mypen.pendown() mypen.pensize(3) for side in range(4): mypen.forward(2 * PLAYGROUND_SIDE) mypen.left(90) mypen.hideturtle()
14,146
[ 0.015147540718317032, -0.04593697562813759, 0.06931108981370926, -0.0007621304248459637, -0.00598929962143302, 0.030320432037115097, 0.03531468287110329, -0.0014474140480160713, -0.03128379210829735, 0.0494861900806427, -0.010641305707395077, -0.025021962821483612, 0.018468590453267097, -0...
12
{"_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": "BinOp", "_fields": {"op": {"_type": "FloorDiv", "_fields": {}}, "left": {"_type": "Name", "_fields": {"id": "PLAYGROUND_SIDE", "ctx": {"_type": "Load", "_fields": {}}}}, "right": {"_type": "Constant", "_fields": {"kind": null, "value": 5}}}}, "targets": [{"_type": "Name", "_fields": {"id": "square_side", "ctx": {"_type": "Store", "_fields": {}}}}], "type_comment": null}}, {"_type": "Assign", "_fields": {"value": {"_type": "BinOp", "_fields": {"op": {"_type": "FloorDiv", "_fields": {}}, "left": {"_type": "BinOp", "_fields": {"op": {"_type": "Mult", "_fields": {}}, "left": {"_type": "Constant", "_fields": {"kind": null, "value": 2}}, "right": {"_type": "Name", "_fields": {"id": "PLAYGROUND_SIDE", "ctx": {"_type": "Load", "_fields": {}}}}}}, "right": {"_type": "Name", "_fields": {"id": "square_side", "ctx": {"_type": "Load", "_fields": {}}}}}}, "targets": [{"_type": "Name", "_fields": {"id": "squares_per_side", "ctx": {"_type": "Store", "_fields": {}}}}], "type_comment": null}}, {"_type": "Assign", "_fields": {"value": {"_type": "Constant", "_fields": {"kind": null, "value": 0.6}}, "targets": [{"_type": "Name", "_fields": {"id": "density", "ctx": {"_type": "Store", "_fields": {}}}}], "type_comment": null}}, {"_type": "Assign", "_fields": {"value": {"_type": "Tuple", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "elts": [{"_type": "BinOp", "_fields": {"op": {"_type": "Add", "_fields": {}}, "left": {"_type": "BinOp", "_fields": {"op": {"_type": "FloorDiv", "_fields": {}}, "left": {"_type": "UnaryOp", "_fields": {"op": {"_type": "USub", "_fields": {}}, "operand": {"_type": "Name", "_fields": {"id": "squares_per_side", "ctx": {"_type": "Load", "_fields": {}}}}}}, "right": {"_type": "Constant", "_fields": {"kind": null, "value": 2}}}}, "right": {"_type": "Constant", "_fields": {"kind": null, "value": 1}}}}, {"_type": "BinOp", "_fields": {"op": {"_type": "Sub", "_fields": {}}, "left": {"_type": "BinOp", "_fields": {"op": {"_type": "FloorDiv", "_fields": {}}, "left": {"_type": "Name", "_fields": {"id": "squares_per_side", "ctx": {"_type": "Load", "_fields": {}}}}, "right": {"_type": "Constant", "_fields": {"kind": null, "value": 2}}}}, "right": {"_type": "Constant", "_fields": {"kind": null, "value": 2}}}}]}}, "targets": [{"_type": "Name", "_fields": {"id": "enemy_position_range", "ctx": {"_type": "Store", "_fields": {}}}}], "type_comment": null}}, {"_type": "For", "_fields": {"body": [{"_type": "While", "_fields": {"body": [{"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Starred", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "value": {"_type": "Name", "_fields": {"id": "enemy_position_range", "ctx": {"_type": "Load", "_fields": {}}}}}}], "func": {"_type": "Name", "_fields": {"id": "randint", "ctx": {"_type": "Load", "_fields": {}}}}, "keywords": []}}, "targets": [{"_type": "Name", "_fields": {"id": "x", "ctx": {"_type": "Store", "_fields": {}}}}], "type_comment": null}}, {"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Starred", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "value": {"_type": "Name", "_fields": {"id": "enemy_position_range", "ctx": {"_type": "Load", "_fields": {}}}}}}], "func": {"_type": "Name", "_fields": {"id": "randint", "ctx": {"_type": "Load", "_fields": {}}}}, "keywords": []}}, "targets": [{"_type": "Name", "_fields": {"id": "y", "ctx": {"_type": "Store", "_fields": {}}}}], "type_comment": null}}, {"_type": "For", "_fields": {"body": [{"_type": "If", "_fields": {"body": [{"_type": "Continue", "_fields": {}}], "test": {"_type": "BoolOp", "_fields": {"op": {"_type": "Or", "_fields": {}}, "values": [{"_type": "Compare", "_fields": {"ops": [{"_type": "Eq", "_fields": {}}], "left": {"_type": "Call", "_fields": {"args": [], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "xcor", "value": {"_type": "Name", "_fields": {"id": "e", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}, "comparators": [{"_type": "BinOp", "_fields": {"op": {"_type": "Mult", "_fields": {}}, "left": {"_type": "Name", "_fields": {"id": "x", "ctx": {"_type": "Load", "_fields": {}}}}, "right": {"_type": "Name", "_fields": {"id": "square_side", "ctx": {"_type": "Load", "_fields": {}}}}}}]}}, {"_type": "Compare", "_fields": {"ops": [{"_type": "Eq", "_fields": {}}], "left": {"_type": "Call", "_fields": {"args": [], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "ycor", "value": {"_type": "Name", "_fields": {"id": "e", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}, "comparators": [{"_type": "BinOp", "_fields": {"op": {"_type": "Mult", "_fields": {}}, "left": {"_type": "Name", "_fields": {"id": "y", "ctx": {"_type": "Load", "_fields": {}}}}, "right": {"_type": "Name", "_fields": {"id": "square_side", "ctx": {"_type": "Load", "_fields": {}}}}}}]}}]}}, "orelse": []}}], "iter": {"_type": "Name", "_fields": {"id": "enemies", "ctx": {"_type": "Load", "_fields": {}}}}, "orelse": [], "target": {"_type": "Name", "_fields": {"id": "e", "ctx": {"_type": "Store", "_fields": {}}}}, "type_comment": null}}, {"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"args": [], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "Turtle", "value": {"_type": "Name", "_fields": {"id": "turtle", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}, "targets": [{"_type": "Name", "_fields": {"id": "enemy", "ctx": {"_type": "Store", "_fields": {}}}}], "type_comment": null}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "penup", "value": {"_type": "Name", "_fields": {"id": "enemy", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "BinOp", "_fields": {"op": {"_type": "Add", "_fields": {}}, "left": {"_type": "BinOp", "_fields": {"op": {"_type": "Add", "_fields": {}}, "left": {"_type": "BinOp", "_fields": {"op": {"_type": "Mult", "_fields": {}}, "left": {"_type": "Name", "_fields": {"id": "x", "ctx": {"_type": "Load", "_fields": {}}}}, "right": {"_type": "Name", "_fields": {"id": "square_side", "ctx": {"_type": "Load", "_fields": {}}}}}}, "right": {"_type": "BinOp", "_fields": {"op": {"_type": "FloorDiv", "_fields": {}}, "left": {"_type": "Name", "_fields": {"id": "square_side", "ctx": {"_type": "Load", "_fields": {}}}}, "right": {"_type": "Constant", "_fields": {"kind": null, "value": 2}}}}}}, "right": {"_type": "Call", "_fields": {"args": [{"_type": "BinOp", "_fields": {"op": {"_type": "FloorDiv", "_fields": {}}, "left": {"_type": "UnaryOp", "_fields": {"op": {"_type": "USub", "_fields": {}}, "operand": {"_type": "Name", "_fields": {"id": "square_side", "ctx": {"_type": "Load", "_fields": {}}}}}}, "right": {"_type": "Constant", "_fields": {"kind": null, "value": 2}}}}, {"_type": "BinOp", "_fields": {"op": {"_type": "FloorDiv", "_fields": {}}, "left": {"_type": "Name", "_fields": {"id": "square_side", "ctx": {"_type": "Load", "_fields": {}}}}, "right": {"_type": "Constant", "_fields": {"kind": null, "value": 2}}}}], "func": {"_type": "Name", "_fields": {"id": "randint", "ctx": {"_type": "Load", "_fields": {}}}}, "keywords": []}}}}, {"_type": "BinOp", "_fields": {"op": {"_type": "Add", "_fields": {}}, "left": {"_type": "BinOp", "_fields": {"op": {"_type": "Add", "_fields": {}}, "left": {"_type": "BinOp", "_fields": {"op": {"_type": "Mult", "_fields": {}}, "left": {"_type": "Name", "_fields": {"id": "y", "ctx": {"_type": "Load", "_fields": {}}}}, "right": {"_type": "Name", "_fields": {"id": "square_side", "ctx": {"_type": "Load", "_fields": {}}}}}}, "right": {"_type": "BinOp", "_fields": {"op": {"_type": "FloorDiv", "_fields": {}}, "left": {"_type": "Name", "_fields": {"id": "square_side", "ctx": {"_type": "Load", "_fields": {}}}}, "right": {"_type": "Constant", "_fields": {"kind": null, "value": 2}}}}}}, "right": {"_type": "Call", "_fields": {"args": [{"_type": "BinOp", "_fields": {"op": {"_type": "FloorDiv", "_fields": {}}, "left": {"_type": "UnaryOp", "_fields": {"op": {"_type": "USub", "_fields": {}}, "operand": {"_type": "Name", "_fields": {"id": "square_side", "ctx": {"_type": "Load", "_fields": {}}}}}}, "right": {"_type": "Constant", "_fields": {"kind": null, "value": 2}}}}, {"_type": "BinOp", "_fields": {"op": {"_type": "FloorDiv", "_fields": {}}, "left": {"_type": "Name", "_fields": {"id": "square_side", "ctx": {"_type": "Load", "_fields": {}}}}, "right": {"_type": "Constant", "_fields": {"kind": null, "value": 2}}}}], "func": {"_type": "Name", "_fields": {"id": "randint", "ctx": {"_type": "Load", "_fields": {}}}}, "keywords": []}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "setposition", "value": {"_type": "Name", "_fields": {"id": "enemy", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"kind": null, "value": 0}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "speed", "value": {"_type": "Name", "_fields": {"id": "enemy", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"kind": null, "value": "red"}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "color", "value": {"_type": "Name", "_fields": {"id": "enemy", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"kind": null, "value": "circle"}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "shape", "value": {"_type": "Name", "_fields": {"id": "enemy", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Name", "_fields": {"id": "enemy", "ctx": {"_type": "Load", "_fields": {}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "append", "value": {"_type": "Name", "_fields": {"id": "enemies", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Break", "_fields": {}}], "test": {"_type": "Constant", "_fields": {"kind": null, "value": true}}, "orelse": []}}], "iter": {"_type": "Call", "_fields": {"args": [{"_type": "Call", "_fields": {"args": [{"_type": "BinOp", "_fields": {"op": {"_type": "Mult", "_fields": {}}, "left": {"_type": "BinOp", "_fields": {"op": {"_type": "Pow", "_fields": {}}, "left": {"_type": "Name", "_fields": {"id": "squares_per_side", "ctx": {"_type": "Load", "_fields": {}}}}, "right": {"_type": "Constant", "_fields": {"kind": null, "value": 2}}}}, "right": {"_type": "Name", "_fields": {"id": "density", "ctx": {"_type": "Load", "_fields": {}}}}}}], "func": {"_type": "Name", "_fields": {"id": "int", "ctx": {"_type": "Load", "_fields": {}}}}, "keywords": []}}], "func": {"_type": "Name", "_fields": {"id": "range", "ctx": {"_type": "Load", "_fields": {}}}}, "keywords": []}}, "orelse": [], "target": {"_type": "Name", "_fields": {"id": "_", "ctx": {"_type": "Store", "_fields": {}}}}, "type_comment": null}}], "name": "place_enemies", "returns": null, "type_params": [], "type_comment": null, "decorator_list": []}}], "type_ignores": []}}
def place_enemies(): square_side = PLAYGROUND_SIDE // 5 squares_per_side = (2 * PLAYGROUND_SIDE // square_side) density = 0.6 enemy_position_range = (-squares_per_side // 2 + 1, squares_per_side // 2 - 2) for _ in range(int((squares_per_side ** 2) * density)): while True: x = randint(*enemy_position_range) y = randint(*enemy_position_range) for e in enemies: if e.xcor() == x * square_side or e.ycor() == y * square_side: continue enemy = turtle.Turtle() enemy.penup() enemy.setposition( x * square_side + (square_side // 2) + randint(-square_side // 2, square_side // 2), y * square_side + (square_side // 2) + randint(-square_side // 2, square_side // 2) ) enemy.speed(0) enemy.color('red') enemy.shape('circle') enemies.append(enemy) break
14,147
[ 0.010176868177950382, 0.008127235807478428, 0.053706295788288116, 0.0323188342154026, -0.003947769291698933, 0.0391152948141098, 0.017822885885834694, -0.015909897163510323, -0.026710566133260727, 0.05622526630759239, -0.0064340620301663876, -0.027970049530267715, 0.006261773873120546, 0.0...
10
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "x", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "y", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}}, "body": [{"_type": "Assign", "_fields": {"value": {"_type": "BinOp", "_fields": {"op": {"_type": "FloorDiv", "_fields": {}}, "left": {"_type": "BinOp", "_fields": {"op": {"_type": "FloorDiv", "_fields": {}}, "left": {"_type": "Name", "_fields": {"id": "PLAYGROUND_SIDE", "ctx": {"_type": "Load", "_fields": {}}}}, "right": {"_type": "Constant", "_fields": {"kind": null, "value": 5}}}}, "right": {"_type": "Constant", "_fields": {"kind": null, "value": 3}}}}, "targets": [{"_type": "Name", "_fields": {"id": "region", "ctx": {"_type": "Store", "_fields": {}}}}], "type_comment": null}}, {"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "i", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "j", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}}, "body": [{"_type": "Return", "_fields": {"value": {"_type": "BoolOp", "_fields": {"op": {"_type": "And", "_fields": {}}, "values": [{"_type": "Compare", "_fields": {"ops": [{"_type": "LtE", "_fields": {}}], "left": {"_type": "BinOp", "_fields": {"op": {"_type": "Sub", "_fields": {}}, "left": {"_type": "Name", "_fields": {"id": "j", "ctx": {"_type": "Load", "_fields": {}}}}, "right": {"_type": "Name", "_fields": {"id": "region", "ctx": {"_type": "Load", "_fields": {}}}}}}, "comparators": [{"_type": "Name", "_fields": {"id": "i", "ctx": {"_type": "Load", "_fields": {}}}}]}}, {"_type": "Compare", "_fields": {"ops": [{"_type": "LtE", "_fields": {}}], "left": {"_type": "Name", "_fields": {"id": "i", "ctx": {"_type": "Load", "_fields": {}}}}, "comparators": [{"_type": "BinOp", "_fields": {"op": {"_type": "Add", "_fields": {}}, "left": {"_type": "Name", "_fields": {"id": "j", "ctx": {"_type": "Load", "_fields": {}}}}, "right": {"_type": "Name", "_fields": {"id": "region", "ctx": {"_type": "Load", "_fields": {}}}}}}]}}]}}}}], "name": "in_range", "returns": null, "type_params": [], "type_comment": null, "decorator_list": []}}, {"_type": "For", "_fields": {"body": [{"_type": "If", "_fields": {"body": [{"_type": "Return", "_fields": {"value": {"_type": "Constant", "_fields": {"kind": null, "value": false}}}}], "test": {"_type": "BoolOp", "_fields": {"op": {"_type": "And", "_fields": {}}, "values": [{"_type": "Call", "_fields": {"args": [{"_type": "Name", "_fields": {"id": "x", "ctx": {"_type": "Load", "_fields": {}}}}, {"_type": "Call", "_fields": {"args": [], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "xcor", "value": {"_type": "Name", "_fields": {"id": "e", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}], "func": {"_type": "Name", "_fields": {"id": "in_range", "ctx": {"_type": "Load", "_fields": {}}}}, "keywords": []}}, {"_type": "Call", "_fields": {"args": [{"_type": "Name", "_fields": {"id": "y", "ctx": {"_type": "Load", "_fields": {}}}}, {"_type": "Call", "_fields": {"args": [], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "ycor", "value": {"_type": "Name", "_fields": {"id": "e", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}], "func": {"_type": "Name", "_fields": {"id": "in_range", "ctx": {"_type": "Load", "_fields": {}}}}, "keywords": []}}]}}, "orelse": []}}], "iter": {"_type": "Name", "_fields": {"id": "enemies", "ctx": {"_type": "Load", "_fields": {}}}}, "orelse": [], "target": {"_type": "Name", "_fields": {"id": "e", "ctx": {"_type": "Store", "_fields": {}}}}, "type_comment": null}}, {"_type": "Return", "_fields": {"value": {"_type": "Constant", "_fields": {"kind": null, "value": true}}}}], "name": "can_move", "returns": null, "type_params": [], "type_comment": null, "decorator_list": []}}], "type_ignores": []}}
def can_move(x, y): region = (PLAYGROUND_SIDE // 5) // 3 def in_range(i, j): return (j - region) <= i and i <= (j + region) for e in enemies: if in_range(x, e.xcor()) and in_range(y, e.ycor()): return False return True
14,148
[ 0.027233967557549477, 0.014613348059356213, 0.0060048759914934635, -0.021789545193314552, 0.0031521893106400967, 0.0048513468354940414, 0.05835850164294243, -0.00889018177986145, -0.005227949004620314, 0.04832368344068527, 0.036557093262672424, -0.008433515205979347, 0.01787525601685047, -...
11
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "move_player", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}}, "body": [{"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"args": [], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "Screen", "value": {"_type": "Name", "_fields": {"id": "turtle", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}, "targets": [{"_type": "Name", "_fields": {"id": "window", "ctx": {"_type": "Store", "_fields": {}}}}], "type_comment": null}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"kind": null, "value": "black"}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "bgcolor", "value": {"_type": "Name", "_fields": {"id": "window", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"kind": null, "value": 0}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "tracer", "value": {"_type": "Name", "_fields": {"id": "window", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"args": [], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "Turtle", "value": {"_type": "Name", "_fields": {"id": "turtle", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}, "targets": [{"_type": "Name", "_fields": {"id": "player", "ctx": {"_type": "Store", "_fields": {}}}}], "type_comment": null}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "penup", "value": {"_type": "Name", "_fields": {"id": "player", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "UnaryOp", "_fields": {"op": {"_type": "USub", "_fields": {}}, "operand": {"_type": "Name", "_fields": {"id": "PLAYGROUND_SIDE", "ctx": {"_type": "Load", "_fields": {}}}}}}, {"_type": "Constant", "_fields": {"kind": null, "value": 0}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "setposition", "value": {"_type": "Name", "_fields": {"id": "player", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"kind": null, "value": 0}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "speed", "value": {"_type": "Name", "_fields": {"id": "player", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"kind": null, "value": "white"}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "color", "value": {"_type": "Name", "_fields": {"id": "player", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Assign", "_fields": {"value": {"_type": "Constant", "_fields": {"kind": null, "value": true}}, "targets": [{"_type": "Name", "_fields": {"id": "play_game", "ctx": {"_type": "Store", "_fields": {}}}}], "type_comment": null}}, {"_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": {"kind": null, "value": false}}, "targets": [{"_type": "Name", "_fields": {"id": "play_game", "ctx": {"_type": "Store", "_fields": {}}}}], "type_comment": null}}], "name": "quit_game", "returns": null, "type_params": [], "type_comment": null, "decorator_list": []}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "listen", "value": {"_type": "Name", "_fields": {"id": "window", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Name", "_fields": {"id": "quit_game", "ctx": {"_type": "Load", "_fields": {}}}}, {"_type": "Constant", "_fields": {"kind": null, "value": "q"}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "onkey", "value": {"_type": "Name", "_fields": {"id": "window", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [], "func": {"_type": "Name", "_fields": {"id": "drow_border", "ctx": {"_type": "Load", "_fields": {}}}}, "keywords": []}}}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [], "func": {"_type": "Name", "_fields": {"id": "place_enemies", "ctx": {"_type": "Load", "_fields": {}}}}, "keywords": []}}}}, {"_type": "While", "_fields": {"body": [{"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"args": [], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "clock", "value": {"_type": "Name", "_fields": {"id": "time", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}, "targets": [{"_type": "Name", "_fields": {"id": "start_time", "ctx": {"_type": "Store", "_fields": {}}}}], "type_comment": null}}, {"_type": "Assign", "_fields": {"value": {"_type": "Tuple", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "elts": [{"_type": "Call", "_fields": {"args": [], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "xcor", "value": {"_type": "Name", "_fields": {"id": "player", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}, {"_type": "Call", "_fields": {"args": [], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "ycor", "value": {"_type": "Name", "_fields": {"id": "player", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}]}}, "targets": [{"_type": "Tuple", "_fields": {"ctx": {"_type": "Store", "_fields": {}}, "elts": [{"_type": "Name", "_fields": {"id": "old_x", "ctx": {"_type": "Store", "_fields": {}}}}, {"_type": "Name", "_fields": {"id": "old_y", "ctx": {"_type": "Store", "_fields": {}}}}]}}], "type_comment": null}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Name", "_fields": {"id": "player", "ctx": {"_type": "Load", "_fields": {}}}}], "func": {"_type": "Name", "_fields": {"id": "move_player", "ctx": {"_type": "Load", "_fields": {}}}}, "keywords": []}}}}, {"_type": "Assign", "_fields": {"value": {"_type": "Tuple", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "elts": [{"_type": "Call", "_fields": {"args": [], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "xcor", "value": {"_type": "Name", "_fields": {"id": "player", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}, {"_type": "Call", "_fields": {"args": [], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "ycor", "value": {"_type": "Name", "_fields": {"id": "player", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}]}}, "targets": [{"_type": "Tuple", "_fields": {"ctx": {"_type": "Store", "_fields": {}}, "elts": [{"_type": "Name", "_fields": {"id": "x", "ctx": {"_type": "Store", "_fields": {}}}}, {"_type": "Name", "_fields": {"id": "y", "ctx": {"_type": "Store", "_fields": {}}}}]}}], "type_comment": null}}, {"_type": "If", "_fields": {"body": [{"_type": "Assign", "_fields": {"value": {"_type": "Constant", "_fields": {"kind": null, "value": false}}, "targets": [{"_type": "Name", "_fields": {"id": "play_game", "ctx": {"_type": "Store", "_fields": {}}}}], "type_comment": null}}], "test": {"_type": "BoolOp", "_fields": {"op": {"_type": "Or", "_fields": {}}, "values": [{"_type": "Compare", "_fields": {"ops": [{"_type": "Lt", "_fields": {}}], "left": {"_type": "Constant", "_fields": {"kind": null, "value": 1}}, "comparators": [{"_type": "Call", "_fields": {"args": [{"_type": "BinOp", "_fields": {"op": {"_type": "Sub", "_fields": {}}, "left": {"_type": "Name", "_fields": {"id": "old_x", "ctx": {"_type": "Load", "_fields": {}}}}, "right": {"_type": "Name", "_fields": {"id": "x", "ctx": {"_type": "Load", "_fields": {}}}}}}], "func": {"_type": "Name", "_fields": {"id": "abs", "ctx": {"_type": "Load", "_fields": {}}}}, "keywords": []}}]}}, {"_type": "Compare", "_fields": {"ops": [{"_type": "Lt", "_fields": {}}], "left": {"_type": "Constant", "_fields": {"kind": null, "value": 1}}, "comparators": [{"_type": "Call", "_fields": {"args": [{"_type": "BinOp", "_fields": {"op": {"_type": "Sub", "_fields": {}}, "left": {"_type": "Name", "_fields": {"id": "old_y", "ctx": {"_type": "Load", "_fields": {}}}}, "right": {"_type": "Name", "_fields": {"id": "y", "ctx": {"_type": "Load", "_fields": {}}}}}}], "func": {"_type": "Name", "_fields": {"id": "abs", "ctx": {"_type": "Load", "_fields": {}}}}, "keywords": []}}]}}]}}, "orelse": [{"_type": "If", "_fields": {"body": [{"_type": "Assign", "_fields": {"value": {"_type": "Constant", "_fields": {"kind": null, "value": false}}, "targets": [{"_type": "Name", "_fields": {"id": "play_game", "ctx": {"_type": "Store", "_fields": {}}}}], "type_comment": null}}], "test": {"_type": "UnaryOp", "_fields": {"op": {"_type": "Not", "_fields": {}}, "operand": {"_type": "Call", "_fields": {"args": [{"_type": "Name", "_fields": {"id": "x", "ctx": {"_type": "Load", "_fields": {}}}}, {"_type": "Name", "_fields": {"id": "y", "ctx": {"_type": "Load", "_fields": {}}}}], "func": {"_type": "Name", "_fields": {"id": "can_move", "ctx": {"_type": "Load", "_fields": {}}}}, "keywords": []}}}}, "orelse": [{"_type": "If", "_fields": {"body": [{"_type": "Assign", "_fields": {"value": {"_type": "Constant", "_fields": {"kind": null, "value": false}}, "targets": [{"_type": "Name", "_fields": {"id": "play_game", "ctx": {"_type": "Store", "_fields": {}}}}], "type_comment": null}}], "test": {"_type": "Compare", "_fields": {"ops": [{"_type": "Eq", "_fields": {}}], "left": {"_type": "Call", "_fields": {"args": [], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "xcor", "value": {"_type": "Name", "_fields": {"id": "player", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}, "comparators": [{"_type": "Name", "_fields": {"id": "PLAYGROUND_SIDE", "ctx": {"_type": "Load", "_fields": {}}}}]}}, "orelse": []}}]}}]}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "update", "value": {"_type": "Name", "_fields": {"id": "window", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Assign", "_fields": {"value": {"_type": "BinOp", "_fields": {"op": {"_type": "Sub", "_fields": {}}, "left": {"_type": "Call", "_fields": {"args": [], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "clock", "value": {"_type": "Name", "_fields": {"id": "time", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}, "right": {"_type": "Name", "_fields": {"id": "start_time", "ctx": {"_type": "Load", "_fields": {}}}}}}, "targets": [{"_type": "Name", "_fields": {"id": "elapsed", "ctx": {"_type": "Store", "_fields": {}}}}], "type_comment": null}}, {"_type": "If", "_fields": {"body": [{"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "BinOp", "_fields": {"op": {"_type": "Sub", "_fields": {}}, "left": {"_type": "Name", "_fields": {"id": "FRAME_PERIOD", "ctx": {"_type": "Load", "_fields": {}}}}, "right": {"_type": "Name", "_fields": {"id": "elapsed", "ctx": {"_type": "Load", "_fields": {}}}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "sleep", "value": {"_type": "Name", "_fields": {"id": "time", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}], "test": {"_type": "Compare", "_fields": {"ops": [{"_type": "Lt", "_fields": {}}], "left": {"_type": "Name", "_fields": {"id": "elapsed", "ctx": {"_type": "Load", "_fields": {}}}}, "comparators": [{"_type": "Name", "_fields": {"id": "FRAME_PERIOD", "ctx": {"_type": "Load", "_fields": {}}}}]}}, "orelse": []}}], "test": {"_type": "Name", "_fields": {"id": "play_game", "ctx": {"_type": "Load", "_fields": {}}}}, "orelse": []}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "bye", "value": {"_type": "Name", "_fields": {"id": "window", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}], "name": "play", "returns": null, "type_params": [], "type_comment": null, "decorator_list": []}}], "type_ignores": []}}
def play(move_player): window = turtle.Screen() window.bgcolor('black') window.tracer(0) player = turtle.Turtle() player.penup() player.setposition(-PLAYGROUND_SIDE, 0) player.speed(0) player.color('white') play_game = True def quit_game(): play_game = False window.listen() window.onkey(quit_game, 'q') drow_border() place_enemies() while play_game: start_time = time.clock() old_x, old_y = player.xcor(), player.ycor() move_player(player) x, y = player.xcor(), player.ycor() if 1 < abs(old_x - x) or 1 < abs(old_y - y): play_game = False elif not can_move(x, y): play_game = False elif player.xcor() == PLAYGROUND_SIDE: play_game = False window.update() elapsed = time.clock() - start_time if elapsed < FRAME_PERIOD: time.sleep(FRAME_PERIOD - elapsed) window.bye()
14,149
[ 0.0031604422256350517, 0.019041243940591812, 0.05173470079898834, -0.005074671003967524, -0.01846865937113762, -0.03372635319828987, 0.00826318096369505, 0.0015409261686727405, -0.008010569959878922, 0.02907831408083439, 0.0027534582186490297, -0.021354036405682564, -0.015661871060729027, ...
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": "is_reftest", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "process_name", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "pid", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [{"_type": "Constant", "_fields": {"kind": null, "value": false}}, {"_type": "Constant", "_fields": {"kind": null, "value": "DumpRenderTree"}}, {"_type": "Constant", "_fields": {"kind": null, "value": null}}], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}}, "body": [{"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "__init__", "value": {"_type": "Call", "_fields": {"args": [{"_type": "Name", "_fields": {"id": "FailureCrash", "ctx": {"_type": "Load", "_fields": {}}}}, {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}], "func": {"_type": "Name", "_fields": {"id": "super", "ctx": {"_type": "Load", "_fields": {}}}}, "keywords": []}}}}, "keywords": []}}}}, {"_type": "Assign", "_fields": {"value": {"_type": "Name", "_fields": {"id": "process_name", "ctx": {"_type": "Load", "_fields": {}}}}, "targets": [{"_type": "Attribute", "_fields": {"ctx": {"_type": "Store", "_fields": {}}, "attr": "process_name", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}], "type_comment": null}}, {"_type": "Assign", "_fields": {"value": {"_type": "Name", "_fields": {"id": "pid", "ctx": {"_type": "Load", "_fields": {}}}}, "targets": [{"_type": "Attribute", "_fields": {"ctx": {"_type": "Store", "_fields": {}}, "attr": "pid", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}], "type_comment": null}}, {"_type": "Assign", "_fields": {"value": {"_type": "Name", "_fields": {"id": "is_reftest", "ctx": {"_type": "Load", "_fields": {}}}}, "targets": [{"_type": "Attribute", "_fields": {"ctx": {"_type": "Store", "_fields": {}}, "attr": "is_reftest", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}], "type_comment": null}}], "name": "__init__", "returns": null, "type_params": [], "type_comment": null, "decorator_list": []}}, {"_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": []}}, "body": [{"_type": "If", "_fields": {"body": [{"_type": "Return", "_fields": {"value": {"_type": "BinOp", "_fields": {"op": {"_type": "Mod", "_fields": {}}, "left": {"_type": "Constant", "_fields": {"kind": null, "value": "%s crashed [pid=%d]"}}, "right": {"_type": "Tuple", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "elts": [{"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "process_name", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}, {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "pid", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}]}}}}}}], "test": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "pid", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}, "orelse": []}}, {"_type": "Return", "_fields": {"value": {"_type": "BinOp", "_fields": {"op": {"_type": "Add", "_fields": {}}, "left": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "process_name", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}, "right": {"_type": "Constant", "_fields": {"kind": null, "value": " crashed"}}}}}}], "name": "message", "returns": null, "type_params": [], "type_comment": null, "decorator_list": []}}, {"_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": []}}, "body": [{"_type": "Return", "_fields": {"value": {"_type": "Constant", "_fields": {"kind": null, "value": true}}}}], "name": "driver_needs_restart", "returns": null, "type_params": [], "type_comment": null, "decorator_list": []}}], "name": "FailureCrash", "bases": [{"_type": "Name", "_fields": {"id": "TestFailure", "ctx": {"_type": "Load", "_fields": {}}}}], "keywords": [], "type_params": [], "decorator_list": []}}], "type_ignores": []}}
class FailureCrash(TestFailure): def __init__(self, is_reftest=False, process_name='DumpRenderTree', pid=None): super(FailureCrash, self).__init__() self.process_name = process_name self.pid = pid self.is_reftest = is_reftest def message(self): if self.pid: return "%s crashed [pid=%d]" % (self.process_name, self.pid) return self.process_name + " crashed" def driver_needs_restart(self): return True
14,150
[ 0.0023941604886204004, 0.03196663036942482, 0.012980186380445957, -0.015571774914860725, 0.015115744434297085, 0.023691343143582344, 0.020499128848314285, 0.03501424938440323, 0.016939867287874222, -0.000435175490565598, -0.01926450990140438, -0.020265553146600723, 0.014715326949954033, -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": [], "kw_defaults": [], "posonlyargs": []}}, "body": [{"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"kind": null, "value": "manage:error_trigger"}}], "func": {"_type": "Name", "_fields": {"id": "reverse", "ctx": {"_type": "Load", "_fields": {}}}}, "keywords": []}}, "targets": [{"_type": "Name", "_fields": {"id": "url", "ctx": {"_type": "Store", "_fields": {}}}}], "type_comment": null}}, {"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Name", "_fields": {"id": "url", "ctx": {"_type": "Load", "_fields": {}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "get", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "client", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}}}, "keywords": []}}, "targets": [{"_type": "Name", "_fields": {"id": "response", "ctx": {"_type": "Store", "_fields": {}}}}], "type_comment": null}}, {"_type": "Assert", "_fields": {"msg": null, "test": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "is_superuser", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "user", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}}}}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "status_code", "value": {"_type": "Name", "_fields": {"id": "response", "ctx": {"_type": "Load", "_fields": {}}}}}}, {"_type": "Constant", "_fields": {"kind": null, "value": 200}}], "func": {"_type": "Name", "_fields": {"id": "eq_", "ctx": {"_type": "Load", "_fields": {}}}}, "keywords": []}}}}, {"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Name", "_fields": {"id": "url", "ctx": {"_type": "Load", "_fields": {}}}}, {"_type": "Dict", "_fields": {"keys": [{"_type": "Constant", "_fields": {"kind": null, "value": "message"}}], "values": [{"_type": "Constant", "_fields": {"kind": null, "value": ""}}]}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "post", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "client", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}}}, "keywords": []}}, "targets": [{"_type": "Name", "_fields": {"id": "response", "ctx": {"_type": "Store", "_fields": {}}}}], "type_comment": null}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "status_code", "value": {"_type": "Name", "_fields": {"id": "response", "ctx": {"_type": "Load", "_fields": {}}}}}}, {"_type": "Constant", "_fields": {"kind": null, "value": 200}}], "func": {"_type": "Name", "_fields": {"id": "eq_", "ctx": {"_type": "Load", "_fields": {}}}}, "keywords": []}}}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Compare", "_fields": {"ops": [{"_type": "In", "_fields": {}}], "left": {"_type": "Constant", "_fields": {"kind": null, "value": "This field is required"}}, "comparators": [{"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "content", "value": {"_type": "Name", "_fields": {"id": "response", "ctx": {"_type": "Load", "_fields": {}}}}}}]}}], "func": {"_type": "Name", "_fields": {"id": "ok_", "ctx": {"_type": "Load", "_fields": {}}}}, "keywords": []}}}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Name", "_fields": {"id": "NameError", "ctx": {"_type": "Load", "_fields": {}}}}, {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "post", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "client", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}}}, {"_type": "Name", "_fields": {"id": "url", "ctx": {"_type": "Load", "_fields": {}}}}, {"_type": "Dict", "_fields": {"keys": [{"_type": "Constant", "_fields": {"kind": null, "value": "message"}}], "values": [{"_type": "Constant", "_fields": {"kind": null, "value": "Some Message"}}]}}], "func": {"_type": "Name", "_fields": {"id": "assert_raises", "ctx": {"_type": "Load", "_fields": {}}}}, "keywords": []}}}}], "name": "test_trigger_error", "returns": null, "type_params": [], "type_comment": null, "decorator_list": []}}, {"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "mocked_client", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}}, "body": [{"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"kind": null, "value": "manage:error_trigger"}}], "func": {"_type": "Name", "_fields": {"id": "reverse", "ctx": {"_type": "Load", "_fields": {}}}}, "keywords": []}}, "targets": [{"_type": "Name", "_fields": {"id": "url", "ctx": {"_type": "Store", "_fields": {}}}}], "type_comment": null}}, {"_type": "Assert", "_fields": {"msg": null, "test": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "is_superuser", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "user", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}}}}}, {"_type": "Assign", "_fields": {"value": {"_type": "Dict", "_fields": {"keys": [{"_type": "Constant", "_fields": {"kind": null, "value": "dsn"}}], "values": [{"_type": "Constant", "_fields": {"kind": null, "value": "fake123"}}]}}, "targets": [{"_type": "Name", "_fields": {"id": "raven_config", "ctx": {"_type": "Store", "_fields": {}}}}], "type_comment": null}}, {"_type": "With", "_fields": {"body": [{"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Name", "_fields": {"id": "url", "ctx": {"_type": "Load", "_fields": {}}}}, {"_type": "Dict", "_fields": {"keys": [{"_type": "Constant", "_fields": {"kind": null, "value": "message"}}, {"_type": "Constant", "_fields": {"kind": null, "value": "capture_with_raven"}}], "values": [{"_type": "Constant", "_fields": {"kind": null, "value": "Some Message"}}, {"_type": "Constant", "_fields": {"kind": null, "value": true}}]}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "post", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "client", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}}}, "keywords": []}}, "targets": [{"_type": "Name", "_fields": {"id": "response", "ctx": {"_type": "Store", "_fields": {}}}}], "type_comment": null}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "status_code", "value": {"_type": "Name", "_fields": {"id": "response", "ctx": {"_type": "Load", "_fields": {}}}}}}, {"_type": "Constant", "_fields": {"kind": null, "value": 302}}], "func": {"_type": "Name", "_fields": {"id": "eq_", "ctx": {"_type": "Load", "_fields": {}}}}, "keywords": []}}}}], "items": [{"_type": "withitem", "_fields": {"context_expr": {"_type": "Call", "_fields": {"args": [], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "settings", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": [{"_type": "keyword", "_fields": {"arg": "RAVEN_CONFIG", "value": {"_type": "Name", "_fields": {"id": "raven_config", "ctx": {"_type": "Load", "_fields": {}}}}}}]}}, "optional_vars": null}}], "type_comment": null}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "assert_called_with", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "captureException", "value": {"_type": "Call", "_fields": {"args": [], "func": {"_type": "Name", "_fields": {"id": "mocked_client", "ctx": {"_type": "Load", "_fields": {}}}}, "keywords": []}}}}}}, "keywords": []}}}}], "name": "test_trigger_error_with_raven", "returns": null, "type_params": [], "type_comment": null, "decorator_list": [{"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"kind": null, "value": "airmozilla.manage.views.errors.Client"}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "patch", "value": {"_type": "Name", "_fields": {"id": "mock", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}]}}], "name": "TestErrorTrigger", "bases": [{"_type": "Name", "_fields": {"id": "ManageTestCase", "ctx": {"_type": "Load", "_fields": {}}}}], "keywords": [], "type_params": [], "decorator_list": []}}], "type_ignores": []}}
class TestErrorTrigger(ManageTestCase): def test_trigger_error(self): url = reverse('manage:error_trigger') response = self.client.get(url) assert self.user.is_superuser eq_(response.status_code, 200) # sans a message response = self.client.post(url, {'message': ''}) eq_(response.status_code, 200) ok_('This field is required' in response.content) assert_raises( NameError, self.client.post, url, {'message': 'Some Message'} ) @mock.patch('airmozilla.manage.views.errors.Client') def test_trigger_error_with_raven(self, mocked_client): url = reverse('manage:error_trigger') assert self.user.is_superuser raven_config = { 'dsn': 'fake123' } with self.settings(RAVEN_CONFIG=raven_config): response = self.client.post(url, { 'message': 'Some Message', 'capture_with_raven': True }) eq_(response.status_code, 302) mocked_client().captureException.assert_called_with()
14,151
[ 0.030766960233449936, 0.04625869169831276, 0.01338687539100647, -0.06201503053307533, -0.051238175481557846, 0.004988505505025387, 0.0111617436632514, 0.0034880449529737234, -0.045079972594976425, 0.000662277452647686, 0.054702166467905045, 0.007541393395513296, 0.021806294098496437, 0.023...
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": {"args": [{"_type": "Name", "_fields": {"id": "script", "ctx": {"_type": "Load", "_fields": {}}}}, {"_type": "Constant", "_fields": {"kind": null, "value": "rb"}}], "func": {"_type": "Name", "_fields": {"id": "open", "ctx": {"_type": "Load", "_fields": {}}}}, "keywords": []}}, "targets": [{"_type": "Name", "_fields": {"id": "f", "ctx": {"_type": "Store", "_fields": {}}}}], "type_comment": null}}, {"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"args": [], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "read", "value": {"_type": "Name", "_fields": {"id": "f", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}, "targets": [{"_type": "Name", "_fields": {"id": "content", "ctx": {"_type": "Store", "_fields": {}}}}], "type_comment": null}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "close", "value": {"_type": "Name", "_fields": {"id": "f", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Assign", "_fields": {"value": {"_type": "List", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "elts": []}}, "targets": [{"_type": "Name", "_fields": {"id": "parts", "ctx": {"_type": "Store", "_fields": {}}}}], "type_comment": null}}, {"_type": "Assign", "_fields": {"value": {"_type": "Constant", "_fields": {"kind": null, "value": 0}}, "targets": [{"_type": "Name", "_fields": {"id": "last_pos", "ctx": {"_type": "Store", "_fields": {}}}}], "type_comment": null}}, {"_type": "Assign", "_fields": {"value": {"_type": "Constant", "_fields": {"kind": null, "value": null}}, "targets": [{"_type": "Name", "_fields": {"id": "match", "ctx": {"_type": "Store", "_fields": {}}}}], "type_comment": null}}, {"_type": "For", "_fields": {"body": [{"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Subscript", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "slice": {"_type": "Slice", "_fields": {"step": null, "lower": {"_type": "Name", "_fields": {"id": "last_pos", "ctx": {"_type": "Load", "_fields": {}}}}, "upper": {"_type": "Call", "_fields": {"args": [], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "start", "value": {"_type": "Name", "_fields": {"id": "match", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, "value": {"_type": "Name", "_fields": {"id": "content", "ctx": {"_type": "Load", "_fields": {}}}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "append", "value": {"_type": "Name", "_fields": {"id": "parts", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"args": [], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "end", "value": {"_type": "Name", "_fields": {"id": "match", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}, "targets": [{"_type": "Name", "_fields": {"id": "last_pos", "ctx": {"_type": "Store", "_fields": {}}}}], "type_comment": null}}, {"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"kind": null, "value": 1}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "group", "value": {"_type": "Name", "_fields": {"id": "match", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}, "targets": [{"_type": "Name", "_fields": {"id": "filename", "ctx": {"_type": "Store", "_fields": {}}}}], "type_comment": null}}, {"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"kind": null, "value": 2}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "group", "value": {"_type": "Name", "_fields": {"id": "match", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}, "targets": [{"_type": "Name", "_fields": {"id": "varname", "ctx": {"_type": "Store", "_fields": {}}}}], "type_comment": null}}, {"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"kind": null, "value": 3}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "group", "value": {"_type": "Name", "_fields": {"id": "match", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}, "targets": [{"_type": "Name", "_fields": {"id": "data", "ctx": {"_type": "Store", "_fields": {}}}}], "type_comment": null}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "BinOp", "_fields": {"op": {"_type": "Mod", "_fields": {}}, "left": {"_type": "Constant", "_fields": {"kind": null, "value": "Found reference to file %s"}}, "right": {"_type": "Name", "_fields": {"id": "filename", "ctx": {"_type": "Load", "_fields": {}}}}}}], "func": {"_type": "Name", "_fields": {"id": "print", "ctx": {"_type": "Load", "_fields": {}}}}, "keywords": []}}}}, {"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Name", "_fields": {"id": "here", "ctx": {"_type": "Load", "_fields": {}}}}, {"_type": "Constant", "_fields": {"kind": null, "value": ".."}}, {"_type": "Constant", "_fields": {"kind": null, "value": "virtualenv_embedded"}}, {"_type": "Name", "_fields": {"id": "filename", "ctx": {"_type": "Load", "_fields": {}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "join", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "path", "value": {"_type": "Name", "_fields": {"id": "os", "ctx": {"_type": "Load", "_fields": {}}}}}}}}, "keywords": []}}, "targets": [{"_type": "Name", "_fields": {"id": "pathname", "ctx": {"_type": "Store", "_fields": {}}}}], "type_comment": null}}, {"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Name", "_fields": {"id": "pathname", "ctx": {"_type": "Load", "_fields": {}}}}, {"_type": "Constant", "_fields": {"kind": null, "value": "rb"}}], "func": {"_type": "Name", "_fields": {"id": "open", "ctx": {"_type": "Load", "_fields": {}}}}, "keywords": []}}, "targets": [{"_type": "Name", "_fields": {"id": "f", "ctx": {"_type": "Store", "_fields": {}}}}], "type_comment": null}}, {"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"args": [], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "read", "value": {"_type": "Name", "_fields": {"id": "f", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}, "targets": [{"_type": "Name", "_fields": {"id": "c", "ctx": {"_type": "Store", "_fields": {}}}}], "type_comment": null}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "close", "value": {"_type": "Name", "_fields": {"id": "f", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"kind": null, "value": "base64"}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "encode", "value": {"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"kind": null, "value": "zlib"}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "encode", "value": {"_type": "Name", "_fields": {"id": "c", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, "keywords": []}}, "targets": [{"_type": "Name", "_fields": {"id": "new_data", "ctx": {"_type": "Store", "_fields": {}}}}], "type_comment": null}}, {"_type": "If", "_fields": {"body": [{"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "BinOp", "_fields": {"op": {"_type": "Mod", "_fields": {}}, "left": {"_type": "Constant", "_fields": {"kind": null, "value": " Reference up to date (%s bytes)"}}, "right": {"_type": "Call", "_fields": {"args": [{"_type": "Name", "_fields": {"id": "c", "ctx": {"_type": "Load", "_fields": {}}}}], "func": {"_type": "Name", "_fields": {"id": "len", "ctx": {"_type": "Load", "_fields": {}}}}, "keywords": []}}}}], "func": {"_type": "Name", "_fields": {"id": "print", "ctx": {"_type": "Load", "_fields": {}}}}, "keywords": []}}}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"kind": null, "value": 0}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "group", "value": {"_type": "Name", "_fields": {"id": "match", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "append", "value": {"_type": "Name", "_fields": {"id": "parts", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Continue", "_fields": {}}], "test": {"_type": "Compare", "_fields": {"ops": [{"_type": "Eq", "_fields": {}}], "left": {"_type": "Name", "_fields": {"id": "new_data", "ctx": {"_type": "Load", "_fields": {}}}}, "comparators": [{"_type": "Name", "_fields": {"id": "data", "ctx": {"_type": "Load", "_fields": {}}}}]}}, "orelse": []}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "BinOp", "_fields": {"op": {"_type": "Mod", "_fields": {}}, "left": {"_type": "Constant", "_fields": {"kind": null, "value": " Content changed (%s bytes -> %s bytes)"}}, "right": {"_type": "Tuple", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "elts": [{"_type": "Call", "_fields": {"args": [{"_type": "Name", "_fields": {"id": "data", "ctx": {"_type": "Load", "_fields": {}}}}], "func": {"_type": "Name", "_fields": {"id": "zipped_len", "ctx": {"_type": "Load", "_fields": {}}}}, "keywords": []}}, {"_type": "Call", "_fields": {"args": [{"_type": "Name", "_fields": {"id": "c", "ctx": {"_type": "Load", "_fields": {}}}}], "func": {"_type": "Name", "_fields": {"id": "len", "ctx": {"_type": "Load", "_fields": {}}}}, "keywords": []}}]}}}}], "func": {"_type": "Name", "_fields": {"id": "print", "ctx": {"_type": "Load", "_fields": {}}}}, "keywords": []}}}}, {"_type": "Assign", "_fields": {"value": {"_type": "BinOp", "_fields": {"op": {"_type": "Mod", "_fields": {}}, "left": {"_type": "Name", "_fields": {"id": "file_template", "ctx": {"_type": "Load", "_fields": {}}}}, "right": {"_type": "Call", "_fields": {"args": [], "func": {"_type": "Name", "_fields": {"id": "dict", "ctx": {"_type": "Load", "_fields": {}}}}, "keywords": [{"_type": "keyword", "_fields": {"arg": "filename", "value": {"_type": "Name", "_fields": {"id": "filename", "ctx": {"_type": "Load", "_fields": {}}}}}}, {"_type": "keyword", "_fields": {"arg": "varname", "value": {"_type": "Name", "_fields": {"id": "varname", "ctx": {"_type": "Load", "_fields": {}}}}}}, {"_type": "keyword", "_fields": {"arg": "data", "value": {"_type": "Name", "_fields": {"id": "new_data", "ctx": {"_type": "Load", "_fields": {}}}}}}]}}}}, "targets": [{"_type": "Name", "_fields": {"id": "new_match", "ctx": {"_type": "Store", "_fields": {}}}}], "type_comment": null}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Name", "_fields": {"id": "new_match", "ctx": {"_type": "Load", "_fields": {}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "append", "value": {"_type": "Name", "_fields": {"id": "parts", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}], "iter": {"_type": "Call", "_fields": {"args": [{"_type": "Name", "_fields": {"id": "content", "ctx": {"_type": "Load", "_fields": {}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "finditer", "value": {"_type": "Name", "_fields": {"id": "file_regex", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}, "orelse": [], "target": {"_type": "Name", "_fields": {"id": "match", "ctx": {"_type": "Store", "_fields": {}}}}, "type_comment": null}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Subscript", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "slice": {"_type": "Slice", "_fields": {"step": null, "lower": {"_type": "Name", "_fields": {"id": "last_pos", "ctx": {"_type": "Load", "_fields": {}}}}, "upper": null}}, "value": {"_type": "Name", "_fields": {"id": "content", "ctx": {"_type": "Load", "_fields": {}}}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "append", "value": {"_type": "Name", "_fields": {"id": "parts", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Name", "_fields": {"id": "parts", "ctx": {"_type": "Load", "_fields": {}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "join", "value": {"_type": "Constant", "_fields": {"kind": null, "value": ""}}}}, "keywords": []}}, "targets": [{"_type": "Name", "_fields": {"id": "new_content", "ctx": {"_type": "Store", "_fields": {}}}}], "type_comment": null}}, {"_type": "If", "_fields": {"body": [{"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"kind": null, "value": "Content updated; overwriting... "}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "write", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "stdout", "value": {"_type": "Name", "_fields": {"id": "sys", "ctx": {"_type": "Load", "_fields": {}}}}}}}}, "keywords": []}}}}, {"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Name", "_fields": {"id": "script", "ctx": {"_type": "Load", "_fields": {}}}}, {"_type": "Constant", "_fields": {"kind": null, "value": "wb"}}], "func": {"_type": "Name", "_fields": {"id": "open", "ctx": {"_type": "Load", "_fields": {}}}}, "keywords": []}}, "targets": [{"_type": "Name", "_fields": {"id": "f", "ctx": {"_type": "Store", "_fields": {}}}}], "type_comment": null}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Name", "_fields": {"id": "new_content", "ctx": {"_type": "Load", "_fields": {}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "write", "value": {"_type": "Name", "_fields": {"id": "f", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "close", "value": {"_type": "Name", "_fields": {"id": "f", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"kind": null, "value": "done."}}], "func": {"_type": "Name", "_fields": {"id": "print", "ctx": {"_type": "Load", "_fields": {}}}}, "keywords": []}}}}], "test": {"_type": "Compare", "_fields": {"ops": [{"_type": "NotEq", "_fields": {}}], "left": {"_type": "Name", "_fields": {"id": "new_content", "ctx": {"_type": "Load", "_fields": {}}}}, "comparators": [{"_type": "Name", "_fields": {"id": "content", "ctx": {"_type": "Load", "_fields": {}}}}]}}, "orelse": [{"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"kind": null, "value": "No changes in content"}}], "func": {"_type": "Name", "_fields": {"id": "print", "ctx": {"_type": "Load", "_fields": {}}}}, "keywords": []}}}}]}}, {"_type": "If", "_fields": {"body": [{"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"kind": null, "value": "No variables were matched/found"}}], "func": {"_type": "Name", "_fields": {"id": "print", "ctx": {"_type": "Load", "_fields": {}}}}, "keywords": []}}}}], "test": {"_type": "Compare", "_fields": {"ops": [{"_type": "Is", "_fields": {}}], "left": {"_type": "Name", "_fields": {"id": "match", "ctx": {"_type": "Load", "_fields": {}}}}, "comparators": [{"_type": "Constant", "_fields": {"kind": null, "value": null}}]}}, "orelse": []}}], "name": "rebuild", "returns": null, "type_params": [], "type_comment": null, "decorator_list": []}}], "type_ignores": []}}
def rebuild(): f = open(script, 'rb') content = f.read() f.close() parts = [] last_pos = 0 match = None for match in file_regex.finditer(content): parts.append(content[last_pos:match.start()]) last_pos = match.end() filename = match.group(1) varname = match.group(2) data = match.group(3) print('Found reference to file %s' % filename) pathname = os.path.join(here, '..', 'virtualenv_embedded', filename) f = open(pathname, 'rb') c = f.read() f.close() new_data = c.encode('zlib').encode('base64') if new_data == data: print(' Reference up to date (%s bytes)' % len(c)) parts.append(match.group(0)) continue print(' Content changed (%s bytes -> %s bytes)' % ( zipped_len(data), len(c))) new_match = file_template % dict( filename=filename, varname=varname, data=new_data) parts.append(new_match) parts.append(content[last_pos:]) new_content = ''.join(parts) if new_content != content: sys.stdout.write('Content updated; overwriting... ') f = open(script, 'wb') f.write(new_content) f.close() print('done.') else: print('No changes in content') if match is None: print('No variables were matched/found')
14,152
[ 0.0214717835187912, -0.00019660517864394933, 0.032601263374090195, -0.001283705118112266, 0.012497958727180958, 0.024281403049826622, 0.046479810029268265, 0.03514445200562477, 0.022077305242419243, -0.004565630108118057, -0.002832325641065836, -0.032431717962026596, 0.03102690912783146, -...
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": "mocked_client", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}}, "body": [{"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"kind": null, "value": "manage:error_trigger"}}], "func": {"_type": "Name", "_fields": {"id": "reverse", "ctx": {"_type": "Load", "_fields": {}}}}, "keywords": []}}, "targets": [{"_type": "Name", "_fields": {"id": "url", "ctx": {"_type": "Store", "_fields": {}}}}], "type_comment": null}}, {"_type": "Assert", "_fields": {"msg": null, "test": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "is_superuser", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "user", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}}}}}, {"_type": "Assign", "_fields": {"value": {"_type": "Dict", "_fields": {"keys": [{"_type": "Constant", "_fields": {"kind": null, "value": "dsn"}}], "values": [{"_type": "Constant", "_fields": {"kind": null, "value": "fake123"}}]}}, "targets": [{"_type": "Name", "_fields": {"id": "raven_config", "ctx": {"_type": "Store", "_fields": {}}}}], "type_comment": null}}, {"_type": "With", "_fields": {"body": [{"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Name", "_fields": {"id": "url", "ctx": {"_type": "Load", "_fields": {}}}}, {"_type": "Dict", "_fields": {"keys": [{"_type": "Constant", "_fields": {"kind": null, "value": "message"}}, {"_type": "Constant", "_fields": {"kind": null, "value": "capture_with_raven"}}], "values": [{"_type": "Constant", "_fields": {"kind": null, "value": "Some Message"}}, {"_type": "Constant", "_fields": {"kind": null, "value": true}}]}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "post", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "client", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}}}, "keywords": []}}, "targets": [{"_type": "Name", "_fields": {"id": "response", "ctx": {"_type": "Store", "_fields": {}}}}], "type_comment": null}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "status_code", "value": {"_type": "Name", "_fields": {"id": "response", "ctx": {"_type": "Load", "_fields": {}}}}}}, {"_type": "Constant", "_fields": {"kind": null, "value": 302}}], "func": {"_type": "Name", "_fields": {"id": "eq_", "ctx": {"_type": "Load", "_fields": {}}}}, "keywords": []}}}}], "items": [{"_type": "withitem", "_fields": {"context_expr": {"_type": "Call", "_fields": {"args": [], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "settings", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": [{"_type": "keyword", "_fields": {"arg": "RAVEN_CONFIG", "value": {"_type": "Name", "_fields": {"id": "raven_config", "ctx": {"_type": "Load", "_fields": {}}}}}}]}}, "optional_vars": null}}], "type_comment": null}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "assert_called_with", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "captureException", "value": {"_type": "Call", "_fields": {"args": [], "func": {"_type": "Name", "_fields": {"id": "mocked_client", "ctx": {"_type": "Load", "_fields": {}}}}, "keywords": []}}}}}}, "keywords": []}}}}], "name": "test_trigger_error_with_raven", "returns": null, "type_params": [], "type_comment": null, "decorator_list": []}}], "type_ignores": []}}
def test_trigger_error_with_raven(self, mocked_client): url = reverse('manage:error_trigger') assert self.user.is_superuser raven_config = { 'dsn': 'fake123' } with self.settings(RAVEN_CONFIG=raven_config): response = self.client.post(url, { 'message': 'Some Message', 'capture_with_raven': True }) eq_(response.status_code, 302) mocked_client().captureException.assert_called_with()
14,153
[ 0.03568042814731598, 0.027748750522732735, -0.006615797057747841, 0.008143918588757515, 0.03286674618721008, 0.012770731933414936, 0.017233816906809807, 0.060785286128520966, 0.03298802301287651, 0.006876547820866108, 0.006021527107805014, 0.003068371443077922, 0.004284198395907879, -0.011...
8
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}}, "body": [{"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"kind": null, "value": "manage:error_trigger"}}], "func": {"_type": "Name", "_fields": {"id": "reverse", "ctx": {"_type": "Load", "_fields": {}}}}, "keywords": []}}, "targets": [{"_type": "Name", "_fields": {"id": "url", "ctx": {"_type": "Store", "_fields": {}}}}], "type_comment": null}}, {"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Name", "_fields": {"id": "url", "ctx": {"_type": "Load", "_fields": {}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "get", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "client", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}}}, "keywords": []}}, "targets": [{"_type": "Name", "_fields": {"id": "response", "ctx": {"_type": "Store", "_fields": {}}}}], "type_comment": null}}, {"_type": "Assert", "_fields": {"msg": null, "test": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "is_superuser", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "user", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}}}}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "status_code", "value": {"_type": "Name", "_fields": {"id": "response", "ctx": {"_type": "Load", "_fields": {}}}}}}, {"_type": "Constant", "_fields": {"kind": null, "value": 200}}], "func": {"_type": "Name", "_fields": {"id": "eq_", "ctx": {"_type": "Load", "_fields": {}}}}, "keywords": []}}}}, {"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Name", "_fields": {"id": "url", "ctx": {"_type": "Load", "_fields": {}}}}, {"_type": "Dict", "_fields": {"keys": [{"_type": "Constant", "_fields": {"kind": null, "value": "message"}}], "values": [{"_type": "Constant", "_fields": {"kind": null, "value": ""}}]}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "post", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "client", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}}}, "keywords": []}}, "targets": [{"_type": "Name", "_fields": {"id": "response", "ctx": {"_type": "Store", "_fields": {}}}}], "type_comment": null}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "status_code", "value": {"_type": "Name", "_fields": {"id": "response", "ctx": {"_type": "Load", "_fields": {}}}}}}, {"_type": "Constant", "_fields": {"kind": null, "value": 200}}], "func": {"_type": "Name", "_fields": {"id": "eq_", "ctx": {"_type": "Load", "_fields": {}}}}, "keywords": []}}}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Compare", "_fields": {"ops": [{"_type": "In", "_fields": {}}], "left": {"_type": "Constant", "_fields": {"kind": null, "value": "This field is required"}}, "comparators": [{"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "content", "value": {"_type": "Name", "_fields": {"id": "response", "ctx": {"_type": "Load", "_fields": {}}}}}}]}}], "func": {"_type": "Name", "_fields": {"id": "ok_", "ctx": {"_type": "Load", "_fields": {}}}}, "keywords": []}}}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Name", "_fields": {"id": "NameError", "ctx": {"_type": "Load", "_fields": {}}}}, {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "post", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "client", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}}}, {"_type": "Name", "_fields": {"id": "url", "ctx": {"_type": "Load", "_fields": {}}}}, {"_type": "Dict", "_fields": {"keys": [{"_type": "Constant", "_fields": {"kind": null, "value": "message"}}], "values": [{"_type": "Constant", "_fields": {"kind": null, "value": "Some Message"}}]}}], "func": {"_type": "Name", "_fields": {"id": "assert_raises", "ctx": {"_type": "Load", "_fields": {}}}}, "keywords": []}}}}], "name": "test_trigger_error", "returns": null, "type_params": [], "type_comment": null, "decorator_list": []}}], "type_ignores": []}}
def test_trigger_error(self): url = reverse('manage:error_trigger') response = self.client.get(url) assert self.user.is_superuser eq_(response.status_code, 200) # sans a message response = self.client.post(url, {'message': ''}) eq_(response.status_code, 200) ok_('This field is required' in response.content) assert_raises( NameError, self.client.post, url, {'message': 'Some Message'} )
14,154
[ -0.0400574617087841, -0.04018287733197212, 0.06541632115840912, -0.0075311544351279736, -0.023452553898096085, -0.04101061448454857, -0.03632010519504547, -0.016968611627817154, 0.0593964159488678, -0.0036119441501796246, 0.024192500859498978, 0.011839150451123714, -0.013557331636548042, 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": {"args": [], "func": {"_type": "Name", "_fields": {"id": "get_fc_hbas", "ctx": {"_type": "Load", "_fields": {}}}}, "keywords": []}}, "targets": [{"_type": "Name", "_fields": {"id": "hbas", "ctx": {"_type": "Store", "_fields": {}}}}], "type_comment": null}}, {"_type": "Assign", "_fields": {"value": {"_type": "List", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "elts": []}}, "targets": [{"_type": "Name", "_fields": {"id": "wwpns", "ctx": {"_type": "Store", "_fields": {}}}}], "type_comment": null}}, {"_type": "For", "_fields": {"body": [{"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"kind": null, "value": "0x"}}, {"_type": "Constant", "_fields": {"kind": null, "value": ""}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "replace", "value": {"_type": "Subscript", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "slice": {"_type": "Constant", "_fields": {"kind": null, "value": "port_name"}}, "value": {"_type": "Name", "_fields": {"id": "hba", "ctx": {"_type": "Load", "_fields": {}}}}}}}}, "keywords": []}}, "targets": [{"_type": "Name", "_fields": {"id": "wwpn", "ctx": {"_type": "Store", "_fields": {}}}}], "type_comment": null}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Name", "_fields": {"id": "wwpn", "ctx": {"_type": "Load", "_fields": {}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "append", "value": {"_type": "Name", "_fields": {"id": "wwpns", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}], "iter": {"_type": "Name", "_fields": {"id": "hbas", "ctx": {"_type": "Load", "_fields": {}}}}, "orelse": [], "target": {"_type": "Name", "_fields": {"id": "hba", "ctx": {"_type": "Store", "_fields": {}}}}, "type_comment": null}}, {"_type": "Return", "_fields": {"value": {"_type": "Name", "_fields": {"id": "wwpns", "ctx": {"_type": "Load", "_fields": {}}}}}}], "name": "get_fc_wwpns", "returns": null, "type_params": [], "type_comment": null, "decorator_list": []}}], "type_ignores": []}}
def get_fc_wwpns(): hbas = get_fc_hbas() wwpns = [] for hba in hbas: wwpn = hba['port_name'].replace('0x', '') wwpns.append(wwpn) return wwpns
14,155
[ -0.0367591567337513, -0.030502814799547195, 0.06090512499213219, -0.003015105379745364, -0.03304052725434303, -0.06366897374391556, 0.003448526607826352, -0.009371952153742313, 0.028442492708563805, 0.013429781422019005, 0.0023775361478328705, 0.00011444051779108122, -0.02711082063615322, ...
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": {"args": [], "func": {"_type": "Name", "_fields": {"id": "get_fc_hbas", "ctx": {"_type": "Load", "_fields": {}}}}, "keywords": []}}, "targets": [{"_type": "Name", "_fields": {"id": "hbas", "ctx": {"_type": "Store", "_fields": {}}}}], "type_comment": null}}, {"_type": "Assign", "_fields": {"value": {"_type": "List", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "elts": []}}, "targets": [{"_type": "Name", "_fields": {"id": "wwnns", "ctx": {"_type": "Store", "_fields": {}}}}], "type_comment": null}}, {"_type": "For", "_fields": {"body": [{"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"kind": null, "value": "0x"}}, {"_type": "Constant", "_fields": {"kind": null, "value": ""}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "replace", "value": {"_type": "Subscript", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "slice": {"_type": "Constant", "_fields": {"kind": null, "value": "node_name"}}, "value": {"_type": "Name", "_fields": {"id": "hba", "ctx": {"_type": "Load", "_fields": {}}}}}}}}, "keywords": []}}, "targets": [{"_type": "Name", "_fields": {"id": "wwnn", "ctx": {"_type": "Store", "_fields": {}}}}], "type_comment": null}}], "iter": {"_type": "Name", "_fields": {"id": "hbas", "ctx": {"_type": "Load", "_fields": {}}}}, "orelse": [], "target": {"_type": "Name", "_fields": {"id": "hba", "ctx": {"_type": "Store", "_fields": {}}}}, "type_comment": null}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Name", "_fields": {"id": "wwnn", "ctx": {"_type": "Load", "_fields": {}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "append", "value": {"_type": "Name", "_fields": {"id": "wwnns", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Return", "_fields": {"value": {"_type": "Name", "_fields": {"id": "wwnns", "ctx": {"_type": "Load", "_fields": {}}}}}}], "name": "get_fc_wwnns", "returns": null, "type_params": [], "type_comment": null, "decorator_list": []}}], "type_ignores": []}}
def get_fc_wwnns(): hbas = get_fc_hbas() wwnns = [] for hba in hbas: wwnn = hba['node_name'].replace('0x', '') wwnns.append(wwnn) return wwnns
14,156
[ 0.033699408173561096, 0.051394023001194, -0.005030632019042969, -0.03280593454837799, 0.03305843845009804, -0.009090099483728409, 0.019840890541672707, 0.014654872007668018, 0.015179300680756569, 0.02701779454946518, -0.008157781325280666, -0.0031271495390683413, 0.023424487560987473, 0.01...
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": "path", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "mode", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [{"_type": "Constant", "_fields": {"kind": null, "value": null}}], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}}, "body": [{"_type": "If", "_fields": {"body": [{"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Subscript", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "slice": {"_type": "Name", "_fields": {"id": "path", "ctx": {"_type": "Load", "_fields": {}}}}, "value": {"_type": "Name", "_fields": {"id": "files", "ctx": {"_type": "Load", "_fields": {}}}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "StringIO", "value": {"_type": "Name", "_fields": {"id": "StringIO", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}, "targets": [{"_type": "Attribute", "_fields": {"ctx": {"_type": "Store", "_fields": {}}, "attr": "fp", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}], "type_comment": null}}], "test": {"_type": "Compare", "_fields": {"ops": [{"_type": "In", "_fields": {}}], "left": {"_type": "Name", "_fields": {"id": "path", "ctx": {"_type": "Load", "_fields": {}}}}, "comparators": [{"_type": "Name", "_fields": {"id": "files", "ctx": {"_type": "Load", "_fields": {}}}}]}}, "orelse": [{"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Subscript", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "slice": {"_type": "Subscript", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "slice": {"_type": "UnaryOp", "_fields": {"op": {"_type": "USub", "_fields": {}}, "operand": {"_type": "Constant", "_fields": {"kind": null, "value": 1}}}}, "value": {"_type": "Call", "_fields": {"args": [{"_type": "Name", "_fields": {"id": "path", "ctx": {"_type": "Load", "_fields": {}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "split", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "path", "value": {"_type": "Name", "_fields": {"id": "os", "ctx": {"_type": "Load", "_fields": {}}}}}}}}, "keywords": []}}}}, "value": {"_type": "Name", "_fields": {"id": "files", "ctx": {"_type": "Load", "_fields": {}}}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "StringIO", "value": {"_type": "Name", "_fields": {"id": "StringIO", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}, "targets": [{"_type": "Attribute", "_fields": {"ctx": {"_type": "Store", "_fields": {}}, "attr": "fp", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}], "type_comment": null}}]}}], "name": "__init__", "returns": null, "type_params": [], "type_comment": null, "decorator_list": []}}, {"_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": []}}, "body": [{"_type": "Return", "_fields": {"value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "fp", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}}}], "name": "__enter__", "returns": null, "type_params": [], "type_comment": null, "decorator_list": []}}, {"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": {"_type": "arg", "_fields": {"arg": "args", "annotation": null, "type_comment": null}}, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}}, "body": [{"_type": "Return", "_fields": {"value": null}}], "name": "__exit__", "returns": null, "type_params": [], "type_comment": null, "decorator_list": []}}, {"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": {"_type": "arg", "_fields": {"arg": "kwargs", "annotation": null, "type_comment": null}}, "vararg": {"_type": "arg", "_fields": {"arg": "args", "annotation": null, "type_comment": null}}, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}}, "body": [{"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "close", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "fp", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}}}, "keywords": []}}}}], "name": "close", "returns": null, "type_params": [], "type_comment": null, "decorator_list": []}}], "name": "File", "bases": [{"_type": "Name", "_fields": {"id": "object", "ctx": {"_type": "Load", "_fields": {}}}}], "keywords": [], "type_params": [], "decorator_list": []}}], "type_ignores": []}}
class File(object): def __init__(self, path, mode=None): if path in files: self.fp = StringIO.StringIO(files[path]) else: self.fp = StringIO.StringIO(files[os.path.split(path)[-1]]) def __enter__(self): return self.fp def __exit__(self, *args): return def close(self, *args, **kwargs): self.fp.close()
14,157
[ -0.05801554024219513, 0.021946515887975693, 0.023714719340205193, -0.04437842220067978, -0.05912500247359276, 0.0008884352282620966, -0.051405005156993866, 0.005342168267816305, 0.01982005126774311, 0.05403997376561165, -0.02387651614844799, -0.06721481680870056, 0.01665346510708332, -0.03...
11
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "client", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "module", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}}, "body": [{"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"args": [], "func": {"_type": "Name", "_fields": {"id": "dict", "ctx": {"_type": "Load", "_fields": {}}}}, "keywords": []}}, "targets": [{"_type": "Name", "_fields": {"id": "params", "ctx": {"_type": "Store", "_fields": {}}}}], "type_comment": null}}, {"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"kind": null, "value": "filters"}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "get", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "params", "value": {"_type": "Name", "_fields": {"id": "module", "ctx": {"_type": "Load", "_fields": {}}}}}}}}, "keywords": []}}], "func": {"_type": "Name", "_fields": {"id": "ansible_dict_to_boto3_filter_list", "ctx": {"_type": "Load", "_fields": {}}}}, "keywords": []}}, "targets": [{"_type": "Subscript", "_fields": {"ctx": {"_type": "Store", "_fields": {}}, "slice": {"_type": "Constant", "_fields": {"kind": null, "value": "Filters"}}, "value": {"_type": "Name", "_fields": {"id": "params", "ctx": {"_type": "Load", "_fields": {}}}}}}], "type_comment": null}}, {"_type": "Assign", "_fields": {"value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "check_mode", "value": {"_type": "Name", "_fields": {"id": "module", "ctx": {"_type": "Load", "_fields": {}}}}}}, "targets": [{"_type": "Subscript", "_fields": {"ctx": {"_type": "Store", "_fields": {}}, "slice": {"_type": "Constant", "_fields": {"kind": null, "value": "DryRun"}}, "value": {"_type": "Name", "_fields": {"id": "params", "ctx": {"_type": "Load", "_fields": {}}}}}}], "type_comment": null}}, {"_type": "If", "_fields": {"body": [{"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"kind": null, "value": "vpn_gateway_ids"}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "get", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "params", "value": {"_type": "Name", "_fields": {"id": "module", "ctx": {"_type": "Load", "_fields": {}}}}}}}}, "keywords": []}}, "targets": [{"_type": "Subscript", "_fields": {"ctx": {"_type": "Store", "_fields": {}}, "slice": {"_type": "Constant", "_fields": {"kind": null, "value": "VpnGatewayIds"}}, "value": {"_type": "Name", "_fields": {"id": "params", "ctx": {"_type": "Load", "_fields": {}}}}}}], "type_comment": null}}], "test": {"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"kind": null, "value": "vpn_gateway_ids"}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "get", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "params", "value": {"_type": "Name", "_fields": {"id": "module", "ctx": {"_type": "Load", "_fields": {}}}}}}}}, "keywords": []}}, "orelse": []}}, {"_type": "Try", "_fields": {"body": [{"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"args": [], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "describe_vpn_gateways", "value": {"_type": "Name", "_fields": {"id": "client", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": [{"_type": "keyword", "_fields": {"arg": null, "value": {"_type": "Name", "_fields": {"id": "params", "ctx": {"_type": "Load", "_fields": {}}}}}}]}}, "targets": [{"_type": "Name", "_fields": {"id": "all_virtual_gateways", "ctx": {"_type": "Store", "_fields": {}}}}], "type_comment": null}}], "orelse": [], "handlers": [{"_type": "ExceptHandler", "_fields": {"body": [{"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "fail_json", "value": {"_type": "Name", "_fields": {"id": "module", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": [{"_type": "keyword", "_fields": {"arg": "msg", "value": {"_type": "Call", "_fields": {"args": [{"_type": "Name", "_fields": {"id": "e", "ctx": {"_type": "Load", "_fields": {}}}}], "func": {"_type": "Name", "_fields": {"id": "str", "ctx": {"_type": "Load", "_fields": {}}}}, "keywords": []}}}}, {"_type": "keyword", "_fields": {"arg": "exception", "value": {"_type": "Call", "_fields": {"args": [], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "format_exc", "value": {"_type": "Name", "_fields": {"id": "traceback", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}]}}}}], "name": "e", "type": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "ClientError", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "exceptions", "value": {"_type": "Name", "_fields": {"id": "botocore", "ctx": {"_type": "Load", "_fields": {}}}}}}}}}}], "finalbody": []}}, {"_type": "Assign", "_fields": {"value": {"_type": "ListComp", "_fields": {"elt": {"_type": "Call", "_fields": {"args": [{"_type": "Call", "_fields": {"args": [{"_type": "Name", "_fields": {"id": "vgw", "ctx": {"_type": "Load", "_fields": {}}}}], "func": {"_type": "Name", "_fields": {"id": "get_virtual_gateway_info", "ctx": {"_type": "Load", "_fields": {}}}}, "keywords": []}}], "func": {"_type": "Name", "_fields": {"id": "camel_dict_to_snake_dict", "ctx": {"_type": "Load", "_fields": {}}}}, "keywords": []}}, "generators": [{"_type": "comprehension", "_fields": {"ifs": [], "iter": {"_type": "Subscript", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "slice": {"_type": "Constant", "_fields": {"kind": null, "value": "VpnGateways"}}, "value": {"_type": "Name", "_fields": {"id": "all_virtual_gateways", "ctx": {"_type": "Load", "_fields": {}}}}}}, "target": {"_type": "Name", "_fields": {"id": "vgw", "ctx": {"_type": "Store", "_fields": {}}}}, "is_async": 0}}]}}, "targets": [{"_type": "Name", "_fields": {"id": "snaked_vgws", "ctx": {"_type": "Store", "_fields": {}}}}], "type_comment": null}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "exit_json", "value": {"_type": "Name", "_fields": {"id": "module", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": [{"_type": "keyword", "_fields": {"arg": "virtual_gateways", "value": {"_type": "Name", "_fields": {"id": "snaked_vgws", "ctx": {"_type": "Load", "_fields": {}}}}}}]}}}}], "name": "list_virtual_gateways", "returns": null, "type_params": [], "type_comment": null, "decorator_list": []}}], "type_ignores": []}}
def list_virtual_gateways(client, module): params = dict() params['Filters'] = ansible_dict_to_boto3_filter_list(module.params.get('filters')) params['DryRun'] = module.check_mode if module.params.get("vpn_gateway_ids"): params['VpnGatewayIds'] = module.params.get("vpn_gateway_ids") try: all_virtual_gateways = client.describe_vpn_gateways(**params) except botocore.exceptions.ClientError as e: module.fail_json(msg=str(e),exception=traceback.format_exc()) snaked_vgws = [camel_dict_to_snake_dict(get_virtual_gateway_info(vgw)) for vgw in all_virtual_gateways['VpnGateways']] module.exit_json(virtual_gateways=snaked_vgws)
14,158
[ 0.02602938935160637, 0.022720148786902428, -0.01416304986923933, -0.01005737017840147, -0.03509275242686272, 0.06756775081157684, -0.00790266040712595, 0.02602938935160637, 0.017929160967469215, 0.0343024879693985, 0.04892240837216377, -0.04094566032290459, 0.007365526631474495, -0.0091991...
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": {"args": [{"_type": "Constant", "_fields": {"kind": null, "value": 2}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "GroveElectromagnet", "value": {"_type": "Name", "_fields": {"id": "upmGroveelectromagnet", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}, "targets": [{"_type": "Name", "_fields": {"id": "myElectromagnet", "ctx": {"_type": "Store", "_fields": {}}}}], "type_comment": null}}, {"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "signum", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "frame", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}}, "body": [{"_type": "Raise", "_fields": {"exc": {"_type": "Name", "_fields": {"id": "SystemExit", "ctx": {"_type": "Load", "_fields": {}}}}, "cause": null}}], "name": "SIGINTHandler", "returns": null, "type_params": [], "type_comment": null, "decorator_list": []}}, {"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}}, "body": [{"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"kind": null, "value": "Exiting"}}], "func": {"_type": "Name", "_fields": {"id": "print", "ctx": {"_type": "Load", "_fields": {}}}}, "keywords": []}}}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "off", "value": {"_type": "Name", "_fields": {"id": "myElectromagnet", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"kind": null, "value": 0}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "exit", "value": {"_type": "Name", "_fields": {"id": "sys", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}], "name": "exitHandler", "returns": null, "type_params": [], "type_comment": null, "decorator_list": []}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Name", "_fields": {"id": "exitHandler", "ctx": {"_type": "Load", "_fields": {}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "register", "value": {"_type": "Name", "_fields": {"id": "atexit", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "SIGINT", "value": {"_type": "Name", "_fields": {"id": "signal", "ctx": {"_type": "Load", "_fields": {}}}}}}, {"_type": "Name", "_fields": {"id": "SIGINTHandler", "ctx": {"_type": "Load", "_fields": {}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "signal", "value": {"_type": "Name", "_fields": {"id": "signal", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Assign", "_fields": {"value": {"_type": "Constant", "_fields": {"kind": null, "value": false}}, "targets": [{"_type": "Name", "_fields": {"id": "magnetState", "ctx": {"_type": "Store", "_fields": {}}}}], "type_comment": null}}, {"_type": "While", "_fields": {"body": [{"_type": "Assign", "_fields": {"value": {"_type": "UnaryOp", "_fields": {"op": {"_type": "Not", "_fields": {}}, "operand": {"_type": "Name", "_fields": {"id": "magnetState", "ctx": {"_type": "Load", "_fields": {}}}}}}, "targets": [{"_type": "Name", "_fields": {"id": "magnetState", "ctx": {"_type": "Store", "_fields": {}}}}], "type_comment": null}}, {"_type": "If", "_fields": {"body": [{"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "on", "value": {"_type": "Name", "_fields": {"id": "myElectromagnet", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}], "test": {"_type": "Name", "_fields": {"id": "magnetState", "ctx": {"_type": "Load", "_fields": {}}}}, "orelse": [{"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "off", "value": {"_type": "Name", "_fields": {"id": "myElectromagnet", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}]}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"kind": null, "value": "Turning magnet"}}, {"_type": "IfExp", "_fields": {"body": {"_type": "Constant", "_fields": {"kind": null, "value": "on"}}, "test": {"_type": "Name", "_fields": {"id": "magnetState", "ctx": {"_type": "Load", "_fields": {}}}}, "orelse": {"_type": "Constant", "_fields": {"kind": null, "value": "off"}}}}], "func": {"_type": "Name", "_fields": {"id": "print", "ctx": {"_type": "Load", "_fields": {}}}}, "keywords": []}}}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"kind": null, "value": 5}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "sleep", "value": {"_type": "Name", "_fields": {"id": "time", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}], "test": {"_type": "Constant", "_fields": {"kind": null, "value": 1}}, "orelse": []}}], "name": "main", "returns": null, "type_params": [], "type_comment": null, "decorator_list": []}}], "type_ignores": []}}
def main(): # This was tested with the Grove Electromagnetic Module # Instantiate a Grove Electromagnet on digital pin D2 myElectromagnet = upmGroveelectromagnet.GroveElectromagnet(2) ## Exit handlers ## # This stops python from printing a stacktrace when you hit control-C def SIGINTHandler(signum, frame): raise SystemExit # This lets you run code on exit, # including functions from myElectromagnet def exitHandler(): print("Exiting") myElectromagnet.off() sys.exit(0) # Register exit handlers atexit.register(exitHandler) signal.signal(signal.SIGINT, SIGINTHandler) magnetState = False # Turn magnet on and off every 5 seconds while(1): magnetState = not magnetState if (magnetState): myElectromagnet.on() else: myElectromagnet.off() print("Turning magnet", ("on" if magnetState else "off")) time.sleep(5)
14,159
[ 0.028236567974090576, 0.007643992081284523, 0.029453055933117867, -0.030692938715219498, -0.015381560660898685, 0.02828335575759411, -0.006316382437944412, 0.03682217001914978, 0.0489402636885643, 0.07153888046741486, 0.026926502585411072, -0.07397185266017914, -0.0001229099289048463, -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": "Call", "_fields": {"args": [], "func": {"_type": "Name", "_fields": {"id": "ec2_argument_spec", "ctx": {"_type": "Load", "_fields": {}}}}, "keywords": []}}, "targets": [{"_type": "Name", "_fields": {"id": "argument_spec", "ctx": {"_type": "Store", "_fields": {}}}}], "type_comment": null}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Call", "_fields": {"args": [], "func": {"_type": "Name", "_fields": {"id": "dict", "ctx": {"_type": "Load", "_fields": {}}}}, "keywords": [{"_type": "keyword", "_fields": {"arg": "filters", "value": {"_type": "Call", "_fields": {"args": [], "func": {"_type": "Name", "_fields": {"id": "dict", "ctx": {"_type": "Load", "_fields": {}}}}, "keywords": [{"_type": "keyword", "_fields": {"arg": "type", "value": {"_type": "Constant", "_fields": {"kind": null, "value": "dict"}}}}, {"_type": "keyword", "_fields": {"arg": "default", "value": {"_type": "Call", "_fields": {"args": [], "func": {"_type": "Name", "_fields": {"id": "dict", "ctx": {"_type": "Load", "_fields": {}}}}, "keywords": []}}}}]}}}}, {"_type": "keyword", "_fields": {"arg": "vpn_gateway_ids", "value": {"_type": "Call", "_fields": {"args": [], "func": {"_type": "Name", "_fields": {"id": "dict", "ctx": {"_type": "Load", "_fields": {}}}}, "keywords": [{"_type": "keyword", "_fields": {"arg": "type", "value": {"_type": "Constant", "_fields": {"kind": null, "value": "list"}}}}, {"_type": "keyword", "_fields": {"arg": "default", "value": {"_type": "Constant", "_fields": {"kind": null, "value": null}}}}]}}}}]}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "update", "value": {"_type": "Name", "_fields": {"id": "argument_spec", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"args": [], "func": {"_type": "Name", "_fields": {"id": "AnsibleModule", "ctx": {"_type": "Load", "_fields": {}}}}, "keywords": [{"_type": "keyword", "_fields": {"arg": "argument_spec", "value": {"_type": "Name", "_fields": {"id": "argument_spec", "ctx": {"_type": "Load", "_fields": {}}}}}}, {"_type": "keyword", "_fields": {"arg": "supports_check_mode", "value": {"_type": "Constant", "_fields": {"kind": null, "value": true}}}}]}}, "targets": [{"_type": "Name", "_fields": {"id": "module", "ctx": {"_type": "Store", "_fields": {}}}}], "type_comment": null}}, {"_type": "If", "_fields": {"body": [{"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "fail_json", "value": {"_type": "Name", "_fields": {"id": "module", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": [{"_type": "keyword", "_fields": {"arg": "msg", "value": {"_type": "Constant", "_fields": {"kind": null, "value": "json and boto3 is required."}}}}]}}}}], "test": {"_type": "UnaryOp", "_fields": {"op": {"_type": "Not", "_fields": {}}, "operand": {"_type": "Name", "_fields": {"id": "HAS_BOTO3", "ctx": {"_type": "Load", "_fields": {}}}}}}, "orelse": []}}, {"_type": "Try", "_fields": {"body": [{"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Name", "_fields": {"id": "module", "ctx": {"_type": "Load", "_fields": {}}}}], "func": {"_type": "Name", "_fields": {"id": "get_aws_connection_info", "ctx": {"_type": "Load", "_fields": {}}}}, "keywords": [{"_type": "keyword", "_fields": {"arg": "boto3", "value": {"_type": "Constant", "_fields": {"kind": null, "value": true}}}}]}}, "targets": [{"_type": "Tuple", "_fields": {"ctx": {"_type": "Store", "_fields": {}}, "elts": [{"_type": "Name", "_fields": {"id": "region", "ctx": {"_type": "Store", "_fields": {}}}}, {"_type": "Name", "_fields": {"id": "ec2_url", "ctx": {"_type": "Store", "_fields": {}}}}, {"_type": "Name", "_fields": {"id": "aws_connect_kwargs", "ctx": {"_type": "Store", "_fields": {}}}}]}}], "type_comment": null}}, {"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Name", "_fields": {"id": "module", "ctx": {"_type": "Load", "_fields": {}}}}], "func": {"_type": "Name", "_fields": {"id": "boto3_conn", "ctx": {"_type": "Load", "_fields": {}}}}, "keywords": [{"_type": "keyword", "_fields": {"arg": "conn_type", "value": {"_type": "Constant", "_fields": {"kind": null, "value": "client"}}}}, {"_type": "keyword", "_fields": {"arg": "resource", "value": {"_type": "Constant", "_fields": {"kind": null, "value": "ec2"}}}}, {"_type": "keyword", "_fields": {"arg": "region", "value": {"_type": "Name", "_fields": {"id": "region", "ctx": {"_type": "Load", "_fields": {}}}}}}, {"_type": "keyword", "_fields": {"arg": "endpoint", "value": {"_type": "Name", "_fields": {"id": "ec2_url", "ctx": {"_type": "Load", "_fields": {}}}}}}, {"_type": "keyword", "_fields": {"arg": null, "value": {"_type": "Name", "_fields": {"id": "aws_connect_kwargs", "ctx": {"_type": "Load", "_fields": {}}}}}}]}}, "targets": [{"_type": "Name", "_fields": {"id": "connection", "ctx": {"_type": "Store", "_fields": {}}}}], "type_comment": null}}], "orelse": [], "handlers": [{"_type": "ExceptHandler", "_fields": {"body": [{"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "fail_json", "value": {"_type": "Name", "_fields": {"id": "module", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": [{"_type": "keyword", "_fields": {"arg": "msg", "value": {"_type": "BinOp", "_fields": {"op": {"_type": "Add", "_fields": {}}, "left": {"_type": "Constant", "_fields": {"kind": null, "value": "Can't authorize connection - "}}, "right": {"_type": "Call", "_fields": {"args": [{"_type": "Name", "_fields": {"id": "e", "ctx": {"_type": "Load", "_fields": {}}}}], "func": {"_type": "Name", "_fields": {"id": "str", "ctx": {"_type": "Load", "_fields": {}}}}, "keywords": []}}}}}}]}}}}], "name": "e", "type": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "NoCredentialsError", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "exceptions", "value": {"_type": "Name", "_fields": {"id": "botocore", "ctx": {"_type": "Load", "_fields": {}}}}}}}}}}], "finalbody": []}}, {"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Name", "_fields": {"id": "connection", "ctx": {"_type": "Load", "_fields": {}}}}, {"_type": "Name", "_fields": {"id": "module", "ctx": {"_type": "Load", "_fields": {}}}}], "func": {"_type": "Name", "_fields": {"id": "list_virtual_gateways", "ctx": {"_type": "Load", "_fields": {}}}}, "keywords": []}}, "targets": [{"_type": "Name", "_fields": {"id": "results", "ctx": {"_type": "Store", "_fields": {}}}}], "type_comment": null}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "exit_json", "value": {"_type": "Name", "_fields": {"id": "module", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": [{"_type": "keyword", "_fields": {"arg": "result", "value": {"_type": "Name", "_fields": {"id": "results", "ctx": {"_type": "Load", "_fields": {}}}}}}]}}}}], "name": "main", "returns": null, "type_params": [], "type_comment": null, "decorator_list": []}}], "type_ignores": []}}
def main(): argument_spec = ec2_argument_spec() argument_spec.update( dict( filters = dict(type='dict', default=dict()), vpn_gateway_ids = dict(type='list', default=None) ) ) module = AnsibleModule(argument_spec=argument_spec, supports_check_mode=True) # Validate Requirements if not HAS_BOTO3: module.fail_json(msg='json and boto3 is required.') try: region, ec2_url, aws_connect_kwargs = get_aws_connection_info(module, boto3=True) connection = boto3_conn(module, conn_type='client', resource='ec2', region=region, endpoint=ec2_url, **aws_connect_kwargs) except botocore.exceptions.NoCredentialsError as e: module.fail_json(msg="Can't authorize connection - "+str(e)) # call your function here results = list_virtual_gateways(connection, module) module.exit_json(result=results)
14,160
[ 0.012085502035915852, 0.018785202875733376, -0.060936495661735535, -0.035652823746204376, 0.002749126171693206, -0.006729292683303356, 0.011339775286614895, -0.005353250075131655, 0.013695323839783669, 0.04024554789066315, 0.05648581311106682, -0.05459190532565117, -0.005518966820091009, -...
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": "url", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}}, "body": [{"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "_VALID_URL", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}, {"_type": "Name", "_fields": {"id": "url", "ctx": {"_type": "Load", "_fields": {}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "match", "value": {"_type": "Name", "_fields": {"id": "re", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}, "targets": [{"_type": "Name", "_fields": {"id": "mobj", "ctx": {"_type": "Store", "_fields": {}}}}], "type_comment": null}}, {"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"kind": null, "value": "id"}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "group", "value": {"_type": "Name", "_fields": {"id": "mobj", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}, "targets": [{"_type": "Name", "_fields": {"id": "video_id", "ctx": {"_type": "Store", "_fields": {}}}}], "type_comment": null}}, {"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Name", "_fields": {"id": "url", "ctx": {"_type": "Load", "_fields": {}}}}, {"_type": "Name", "_fields": {"id": "video_id", "ctx": {"_type": "Load", "_fields": {}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "_download_webpage", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}, "targets": [{"_type": "Name", "_fields": {"id": "webpage", "ctx": {"_type": "Store", "_fields": {}}}}], "type_comment": null}}, {"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"args": [], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "strip", "value": {"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"kind": null, "value": "<h1><strong>([^<]+)</strong>"}}, {"_type": "Name", "_fields": {"id": "webpage", "ctx": {"_type": "Load", "_fields": {}}}}, {"_type": "Constant", "_fields": {"kind": null, "value": "title"}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "_html_search_regex", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, "keywords": []}}, "targets": [{"_type": "Name", "_fields": {"id": "video_title", "ctx": {"_type": "Store", "_fields": {}}}}], "type_comment": null}}, {"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"kind": null, "value": "(?s)<div id=\"vidPlayer\"\\s+data-url=\"([^\"]+)\""}}, {"_type": "Name", "_fields": {"id": "webpage", "ctx": {"_type": "Load", "_fields": {}}}}, {"_type": "Constant", "_fields": {"kind": null, "value": "video URL"}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "_html_search_regex", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}, "targets": [{"_type": "Name", "_fields": {"id": "video_url", "ctx": {"_type": "Store", "_fields": {}}}}], "type_comment": null}}, {"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"kind": null, "value": "(?s)<div id=\"vidPlayer\"\\s+.*?previewer-file=\"([^\"]+)\""}}, {"_type": "Name", "_fields": {"id": "webpage", "ctx": {"_type": "Load", "_fields": {}}}}, {"_type": "Constant", "_fields": {"kind": null, "value": "thumbnail"}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "_html_search_regex", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": [{"_type": "keyword", "_fields": {"arg": "fatal", "value": {"_type": "Constant", "_fields": {"kind": null, "value": false}}}}]}}, "targets": [{"_type": "Name", "_fields": {"id": "thumbnail", "ctx": {"_type": "Store", "_fields": {}}}}], "type_comment": null}}, {"_type": "Return", "_fields": {"value": {"_type": "Dict", "_fields": {"keys": [{"_type": "Constant", "_fields": {"kind": null, "value": "id"}}, {"_type": "Constant", "_fields": {"kind": null, "value": "url"}}, {"_type": "Constant", "_fields": {"kind": null, "value": "title"}}, {"_type": "Constant", "_fields": {"kind": null, "value": "thumbnail"}}, {"_type": "Constant", "_fields": {"kind": null, "value": "age_limit"}}], "values": [{"_type": "Name", "_fields": {"id": "video_id", "ctx": {"_type": "Load", "_fields": {}}}}, {"_type": "Name", "_fields": {"id": "video_url", "ctx": {"_type": "Load", "_fields": {}}}}, {"_type": "Name", "_fields": {"id": "video_title", "ctx": {"_type": "Load", "_fields": {}}}}, {"_type": "Name", "_fields": {"id": "thumbnail", "ctx": {"_type": "Load", "_fields": {}}}}, {"_type": "Constant", "_fields": {"kind": null, "value": 18}}]}}}}], "name": "_real_extract", "returns": null, "type_params": [], "type_comment": null, "decorator_list": []}}], "type_ignores": []}}
def _real_extract(self, url): mobj = re.match(self._VALID_URL, url) video_id = mobj.group('id') webpage = self._download_webpage(url, video_id) video_title = self._html_search_regex(r'<h1><strong>([^<]+)</strong>', webpage, 'title').strip() video_url = self._html_search_regex( r'(?s)<div id="vidPlayer"\s+data-url="([^"]+)"', webpage, 'video URL') thumbnail = self._html_search_regex( r'(?s)<div id="vidPlayer"\s+.*?previewer-file="([^"]+)"', webpage, 'thumbnail', fatal=False) return { 'id': video_id, 'url': video_url, 'title': video_title, 'thumbnail': thumbnail, 'age_limit': 18 }
14,161
[ 0.015779603272676468, 0.025447892025113106, -0.09367498010396957, -0.06512368470430374, 0.006737962365150452, -0.027978358790278435, 0.01721194200217724, 0.0015382725978270173, 0.0013256598031148314, 0.024469127878546715, 0.06784513592720032, -0.03731243684887886, 0.0010578421643003821, -0...
10
{"_type": "Module", "_fields": {"body": [{"_type": "ClassDef", "_fields": {"body": [{"_type": "Assign", "_fields": {"value": {"_type": "Constant", "_fields": {"kind": null, "value": "^https?://(?:\\w+\\.)?slutload\\.com/video/[^/]+/(?P<id>[^/]+)/?$"}}, "targets": [{"_type": "Name", "_fields": {"id": "_VALID_URL", "ctx": {"_type": "Store", "_fields": {}}}}], "type_comment": null}}, {"_type": "Assign", "_fields": {"value": {"_type": "Dict", "_fields": {"keys": [{"_type": "Constant", "_fields": {"kind": null, "value": "url"}}, {"_type": "Constant", "_fields": {"kind": null, "value": "md5"}}, {"_type": "Constant", "_fields": {"kind": null, "value": "info_dict"}}], "values": [{"_type": "Constant", "_fields": {"kind": null, "value": "http://www.slutload.com/video/virginie-baisee-en-cam/TD73btpBqSxc/"}}, {"_type": "Constant", "_fields": {"kind": null, "value": "0cf531ae8006b530bd9df947a6a0df77"}}, {"_type": "Dict", "_fields": {"keys": [{"_type": "Constant", "_fields": {"kind": null, "value": "id"}}, {"_type": "Constant", "_fields": {"kind": null, "value": "ext"}}, {"_type": "Constant", "_fields": {"kind": null, "value": "title"}}, {"_type": "Constant", "_fields": {"kind": null, "value": "age_limit"}}, {"_type": "Constant", "_fields": {"kind": null, "value": "thumbnail"}}], "values": [{"_type": "Constant", "_fields": {"kind": null, "value": "TD73btpBqSxc"}}, {"_type": "Constant", "_fields": {"kind": null, "value": "mp4"}}, {"_type": "Constant", "_fields": {"kind": null, "value": "virginie baisee en cam"}}, {"_type": "Constant", "_fields": {"kind": null, "value": 18}}, {"_type": "Constant", "_fields": {"kind": null, "value": "re:https?://.*?\\.jpg"}}]}}]}}, "targets": [{"_type": "Name", "_fields": {"id": "_TEST", "ctx": {"_type": "Store", "_fields": {}}}}], "type_comment": null}}, {"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "url", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}}, "body": [{"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "_VALID_URL", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}, {"_type": "Name", "_fields": {"id": "url", "ctx": {"_type": "Load", "_fields": {}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "match", "value": {"_type": "Name", "_fields": {"id": "re", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}, "targets": [{"_type": "Name", "_fields": {"id": "mobj", "ctx": {"_type": "Store", "_fields": {}}}}], "type_comment": null}}, {"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"kind": null, "value": "id"}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "group", "value": {"_type": "Name", "_fields": {"id": "mobj", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}, "targets": [{"_type": "Name", "_fields": {"id": "video_id", "ctx": {"_type": "Store", "_fields": {}}}}], "type_comment": null}}, {"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Name", "_fields": {"id": "url", "ctx": {"_type": "Load", "_fields": {}}}}, {"_type": "Name", "_fields": {"id": "video_id", "ctx": {"_type": "Load", "_fields": {}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "_download_webpage", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}, "targets": [{"_type": "Name", "_fields": {"id": "webpage", "ctx": {"_type": "Store", "_fields": {}}}}], "type_comment": null}}, {"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"args": [], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "strip", "value": {"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"kind": null, "value": "<h1><strong>([^<]+)</strong>"}}, {"_type": "Name", "_fields": {"id": "webpage", "ctx": {"_type": "Load", "_fields": {}}}}, {"_type": "Constant", "_fields": {"kind": null, "value": "title"}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "_html_search_regex", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, "keywords": []}}, "targets": [{"_type": "Name", "_fields": {"id": "video_title", "ctx": {"_type": "Store", "_fields": {}}}}], "type_comment": null}}, {"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"kind": null, "value": "(?s)<div id=\"vidPlayer\"\\s+data-url=\"([^\"]+)\""}}, {"_type": "Name", "_fields": {"id": "webpage", "ctx": {"_type": "Load", "_fields": {}}}}, {"_type": "Constant", "_fields": {"kind": null, "value": "video URL"}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "_html_search_regex", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}, "targets": [{"_type": "Name", "_fields": {"id": "video_url", "ctx": {"_type": "Store", "_fields": {}}}}], "type_comment": null}}, {"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"kind": null, "value": "(?s)<div id=\"vidPlayer\"\\s+.*?previewer-file=\"([^\"]+)\""}}, {"_type": "Name", "_fields": {"id": "webpage", "ctx": {"_type": "Load", "_fields": {}}}}, {"_type": "Constant", "_fields": {"kind": null, "value": "thumbnail"}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "_html_search_regex", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": [{"_type": "keyword", "_fields": {"arg": "fatal", "value": {"_type": "Constant", "_fields": {"kind": null, "value": false}}}}]}}, "targets": [{"_type": "Name", "_fields": {"id": "thumbnail", "ctx": {"_type": "Store", "_fields": {}}}}], "type_comment": null}}, {"_type": "Return", "_fields": {"value": {"_type": "Dict", "_fields": {"keys": [{"_type": "Constant", "_fields": {"kind": null, "value": "id"}}, {"_type": "Constant", "_fields": {"kind": null, "value": "url"}}, {"_type": "Constant", "_fields": {"kind": null, "value": "title"}}, {"_type": "Constant", "_fields": {"kind": null, "value": "thumbnail"}}, {"_type": "Constant", "_fields": {"kind": null, "value": "age_limit"}}], "values": [{"_type": "Name", "_fields": {"id": "video_id", "ctx": {"_type": "Load", "_fields": {}}}}, {"_type": "Name", "_fields": {"id": "video_url", "ctx": {"_type": "Load", "_fields": {}}}}, {"_type": "Name", "_fields": {"id": "video_title", "ctx": {"_type": "Load", "_fields": {}}}}, {"_type": "Name", "_fields": {"id": "thumbnail", "ctx": {"_type": "Load", "_fields": {}}}}, {"_type": "Constant", "_fields": {"kind": null, "value": 18}}]}}}}], "name": "_real_extract", "returns": null, "type_params": [], "type_comment": null, "decorator_list": []}}], "name": "SlutloadIE", "bases": [{"_type": "Name", "_fields": {"id": "InfoExtractor", "ctx": {"_type": "Load", "_fields": {}}}}], "keywords": [], "type_params": [], "decorator_list": []}}], "type_ignores": []}}
class SlutloadIE(InfoExtractor): _VALID_URL = r'^https?://(?:\w+\.)?slutload\.com/video/[^/]+/(?P<id>[^/]+)/?$' _TEST = { 'url': 'http://www.slutload.com/video/virginie-baisee-en-cam/TD73btpBqSxc/', 'md5': '0cf531ae8006b530bd9df947a6a0df77', 'info_dict': { 'id': 'TD73btpBqSxc', 'ext': 'mp4', "title": "virginie baisee en cam", "age_limit": 18, 'thumbnail': 're:https?://.*?\.jpg' } } def _real_extract(self, url): mobj = re.match(self._VALID_URL, url) video_id = mobj.group('id') webpage = self._download_webpage(url, video_id) video_title = self._html_search_regex(r'<h1><strong>([^<]+)</strong>', webpage, 'title').strip() video_url = self._html_search_regex( r'(?s)<div id="vidPlayer"\s+data-url="([^"]+)"', webpage, 'video URL') thumbnail = self._html_search_regex( r'(?s)<div id="vidPlayer"\s+.*?previewer-file="([^"]+)"', webpage, 'thumbnail', fatal=False) return { 'id': video_id, 'url': video_url, 'title': video_title, 'thumbnail': thumbnail, 'age_limit': 18 }
14,162
[ 0.04324863478541374, 0.03393682837486267, 0.012878482230007648, -0.016092762351036072, -0.009455966763198376, 0.026077324524521828, 0.030113862827420235, -0.01414924394339323, 0.008265294134616852, -0.010368993505835533, 0.0018794467905536294, 0.0038283048197627068, 0.029174139723181725, 0...
14
{"_type": "Module", "_fields": {"body": [{"_type": "ClassDef", "_fields": {"body": [{"_type": "Assign", "_fields": {"value": {"_type": "Tuple", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "elts": [{"_type": "Constant", "_fields": {"kind": null, "value": "AvailabilityZone"}}, {"_type": "Constant", "_fields": {"kind": null, "value": "Size"}}, {"_type": "Constant", "_fields": {"kind": null, "value": "SnapshotId"}}, {"_type": "Constant", "_fields": {"kind": null, "value": "Tags"}}]}}, "targets": [{"_type": "Name", "_fields": {"id": "PROPERTIES", "ctx": {"_type": "Store", "_fields": {}}}}, {"_type": "Tuple", "_fields": {"ctx": {"_type": "Store", "_fields": {}}, "elts": [{"_type": "Name", "_fields": {"id": "AVAILABILITY_ZONE", "ctx": {"_type": "Store", "_fields": {}}}}, {"_type": "Name", "_fields": {"id": "SIZE", "ctx": {"_type": "Store", "_fields": {}}}}, {"_type": "Name", "_fields": {"id": "BACKUP_ID", "ctx": {"_type": "Store", "_fields": {}}}}, {"_type": "Name", "_fields": {"id": "TAGS", "ctx": {"_type": "Store", "_fields": {}}}}]}}], "type_comment": null}}, {"_type": "Assign", "_fields": {"value": {"_type": "Tuple", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "elts": [{"_type": "Constant", "_fields": {"kind": null, "value": "Key"}}, {"_type": "Constant", "_fields": {"kind": null, "value": "Value"}}]}}, "targets": [{"_type": "Name", "_fields": {"id": "_TAG_KEYS", "ctx": {"_type": "Store", "_fields": {}}}}, {"_type": "Tuple", "_fields": {"ctx": {"_type": "Store", "_fields": {}}, "elts": [{"_type": "Name", "_fields": {"id": "TAG_KEY", "ctx": {"_type": "Store", "_fields": {}}}}, {"_type": "Name", "_fields": {"id": "TAG_VALUE", "ctx": {"_type": "Store", "_fields": {}}}}]}}], "type_comment": null}}, {"_type": "Assign", "_fields": {"value": {"_type": "Dict", "_fields": {"keys": [{"_type": "Name", "_fields": {"id": "AVAILABILITY_ZONE", "ctx": {"_type": "Load", "_fields": {}}}}, {"_type": "Name", "_fields": {"id": "SIZE", "ctx": {"_type": "Load", "_fields": {}}}}, {"_type": "Name", "_fields": {"id": "BACKUP_ID", "ctx": {"_type": "Load", "_fields": {}}}}, {"_type": "Name", "_fields": {"id": "TAGS", "ctx": {"_type": "Load", "_fields": {}}}}], "values": [{"_type": "Call", "_fields": {"args": [{"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "STRING", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "Schema", "value": {"_type": "Name", "_fields": {"id": "properties", "ctx": {"_type": "Load", "_fields": {}}}}}}}}, {"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"kind": null, "value": "The availability zone in which the volume will be created."}}], "func": {"_type": "Name", "_fields": {"id": "_", "ctx": {"_type": "Load", "_fields": {}}}}, "keywords": []}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "Schema", "value": {"_type": "Name", "_fields": {"id": "properties", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": [{"_type": "keyword", "_fields": {"arg": "required", "value": {"_type": "Constant", "_fields": {"kind": null, "value": true}}}}, {"_type": "keyword", "_fields": {"arg": "immutable", "value": {"_type": "Constant", "_fields": {"kind": null, "value": true}}}}]}}, {"_type": "Call", "_fields": {"args": [{"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "INTEGER", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "Schema", "value": {"_type": "Name", "_fields": {"id": "properties", "ctx": {"_type": "Load", "_fields": {}}}}}}}}, {"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"kind": null, "value": "The size of the volume in GB."}}], "func": {"_type": "Name", "_fields": {"id": "_", "ctx": {"_type": "Load", "_fields": {}}}}, "keywords": []}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "Schema", "value": {"_type": "Name", "_fields": {"id": "properties", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": [{"_type": "keyword", "_fields": {"arg": "immutable", "value": {"_type": "Constant", "_fields": {"kind": null, "value": true}}}}, {"_type": "keyword", "_fields": {"arg": "constraints", "value": {"_type": "List", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "elts": [{"_type": "Call", "_fields": {"args": [], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "Range", "value": {"_type": "Name", "_fields": {"id": "constraints", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": [{"_type": "keyword", "_fields": {"arg": "min", "value": {"_type": "Constant", "_fields": {"kind": null, "value": 1}}}}]}}]}}}}]}}, {"_type": "Call", "_fields": {"args": [{"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "STRING", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "Schema", "value": {"_type": "Name", "_fields": {"id": "properties", "ctx": {"_type": "Load", "_fields": {}}}}}}}}, {"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"kind": null, "value": "If specified, the backup used as the source to create the volume."}}], "func": {"_type": "Name", "_fields": {"id": "_", "ctx": {"_type": "Load", "_fields": {}}}}, "keywords": []}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "Schema", "value": {"_type": "Name", "_fields": {"id": "properties", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": [{"_type": "keyword", "_fields": {"arg": "immutable", "value": {"_type": "Constant", "_fields": {"kind": null, "value": true}}}}, {"_type": "keyword", "_fields": {"arg": "constraints", "value": {"_type": "List", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "elts": [{"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"kind": null, "value": "cinder.backup"}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "CustomConstraint", "value": {"_type": "Name", "_fields": {"id": "constraints", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}]}}}}]}}, {"_type": "Call", "_fields": {"args": [{"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "LIST", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "Schema", "value": {"_type": "Name", "_fields": {"id": "properties", "ctx": {"_type": "Load", "_fields": {}}}}}}}}, {"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"kind": null, "value": "The list of tags to associate with the volume."}}], "func": {"_type": "Name", "_fields": {"id": "_", "ctx": {"_type": "Load", "_fields": {}}}}, "keywords": []}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "Schema", "value": {"_type": "Name", "_fields": {"id": "properties", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": [{"_type": "keyword", "_fields": {"arg": "immutable", "value": {"_type": "Constant", "_fields": {"kind": null, "value": true}}}}, {"_type": "keyword", "_fields": {"arg": "schema", "value": {"_type": "Call", "_fields": {"args": [{"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "MAP", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "Schema", "value": {"_type": "Name", "_fields": {"id": "properties", "ctx": {"_type": "Load", "_fields": {}}}}}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "Schema", "value": {"_type": "Name", "_fields": {"id": "properties", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": [{"_type": "keyword", "_fields": {"arg": "schema", "value": {"_type": "Dict", "_fields": {"keys": [{"_type": "Name", "_fields": {"id": "TAG_KEY", "ctx": {"_type": "Load", "_fields": {}}}}, {"_type": "Name", "_fields": {"id": "TAG_VALUE", "ctx": {"_type": "Load", "_fields": {}}}}], "values": [{"_type": "Call", "_fields": {"args": [{"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "STRING", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "Schema", "value": {"_type": "Name", "_fields": {"id": "properties", "ctx": {"_type": "Load", "_fields": {}}}}}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "Schema", "value": {"_type": "Name", "_fields": {"id": "properties", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": [{"_type": "keyword", "_fields": {"arg": "required", "value": {"_type": "Constant", "_fields": {"kind": null, "value": true}}}}]}}, {"_type": "Call", "_fields": {"args": [{"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "STRING", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "Schema", "value": {"_type": "Name", "_fields": {"id": "properties", "ctx": {"_type": "Load", "_fields": {}}}}}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "Schema", "value": {"_type": "Name", "_fields": {"id": "properties", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": [{"_type": "keyword", "_fields": {"arg": "required", "value": {"_type": "Constant", "_fields": {"kind": null, "value": true}}}}]}}]}}}}]}}}}]}}]}}, "targets": [{"_type": "Name", "_fields": {"id": "properties_schema", "ctx": {"_type": "Store", "_fields": {}}}}], "type_comment": null}}, {"_type": "Assign", "_fields": {"value": {"_type": "List", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "elts": [{"_type": "Constant", "_fields": {"kind": null, "value": "creating"}}, {"_type": "Constant", "_fields": {"kind": null, "value": "restoring-backup"}}]}}, "targets": [{"_type": "Name", "_fields": {"id": "_volume_creating_status", "ctx": {"_type": "Store", "_fields": {}}}}], "type_comment": null}}, {"_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": []}}, "body": [{"_type": "If", "_fields": {"body": [{"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "GeneratorExp", "_fields": {"elt": {"_type": "Tuple", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "elts": [{"_type": "Subscript", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "slice": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "TAG_KEY", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}, "value": {"_type": "Name", "_fields": {"id": "tm", "ctx": {"_type": "Load", "_fields": {}}}}}}, {"_type": "Subscript", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "slice": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "TAG_VALUE", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}, "value": {"_type": "Name", "_fields": {"id": "tm", "ctx": {"_type": "Load", "_fields": {}}}}}}]}}, "generators": [{"_type": "comprehension", "_fields": {"ifs": [], "iter": {"_type": "Subscript", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "slice": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "TAGS", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}, "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "properties", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}}}, "target": {"_type": "Name", "_fields": {"id": "tm", "ctx": {"_type": "Store", "_fields": {}}}}, "is_async": 0}}]}}], "func": {"_type": "Name", "_fields": {"id": "dict", "ctx": {"_type": "Load", "_fields": {}}}}, "keywords": []}}, "targets": [{"_type": "Name", "_fields": {"id": "tags", "ctx": {"_type": "Store", "_fields": {}}}}], "type_comment": null}}], "test": {"_type": "Subscript", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "slice": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "TAGS", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}, "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "properties", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}}}, "orelse": [{"_type": "Assign", "_fields": {"value": {"_type": "Constant", "_fields": {"kind": null, "value": null}}, "targets": [{"_type": "Name", "_fields": {"id": "tags", "ctx": {"_type": "Store", "_fields": {}}}}], "type_comment": null}}]}}, {"_type": "Return", "_fields": {"value": {"_type": "Dict", "_fields": {"keys": [{"_type": "Constant", "_fields": {"kind": null, "value": "size"}}, {"_type": "Constant", "_fields": {"kind": null, "value": "availability_zone"}}, {"_type": "Constant", "_fields": {"kind": null, "value": "metadata"}}], "values": [{"_type": "Subscript", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "slice": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "SIZE", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}, "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "properties", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}}}, {"_type": "BoolOp", "_fields": {"op": {"_type": "Or", "_fields": {}}, "values": [{"_type": "Subscript", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "slice": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "AVAILABILITY_ZONE", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}, "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "properties", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}}}, {"_type": "Constant", "_fields": {"kind": null, "value": null}}]}}, {"_type": "Name", "_fields": {"id": "tags", "ctx": {"_type": "Load", "_fields": {}}}}]}}}}], "name": "_create_arguments", "returns": null, "type_params": [], "type_comment": null, "decorator_list": []}}], "name": "Volume", "bases": [{"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "BaseVolume", "value": {"_type": "Name", "_fields": {"id": "vb", "ctx": {"_type": "Load", "_fields": {}}}}}}], "keywords": [], "type_params": [], "decorator_list": []}}], "type_ignores": []}}
class Volume(vb.BaseVolume): PROPERTIES = ( AVAILABILITY_ZONE, SIZE, BACKUP_ID, TAGS, ) = ( 'AvailabilityZone', 'Size', 'SnapshotId', 'Tags', ) _TAG_KEYS = ( TAG_KEY, TAG_VALUE, ) = ( 'Key', 'Value', ) properties_schema = { AVAILABILITY_ZONE: properties.Schema( properties.Schema.STRING, _('The availability zone in which the volume will be created.'), required=True, immutable=True ), SIZE: properties.Schema( properties.Schema.INTEGER, _('The size of the volume in GB.'), immutable=True, constraints=[ constraints.Range(min=1), ] ), BACKUP_ID: properties.Schema( properties.Schema.STRING, _('If specified, the backup used as the source to create the ' 'volume.'), immutable=True, constraints=[ constraints.CustomConstraint('cinder.backup') ] ), TAGS: properties.Schema( properties.Schema.LIST, _('The list of tags to associate with the volume.'), immutable=True, schema=properties.Schema( properties.Schema.MAP, schema={ TAG_KEY: properties.Schema( properties.Schema.STRING, required=True ), TAG_VALUE: properties.Schema( properties.Schema.STRING, required=True ), }, ) ), } _volume_creating_status = ['creating', 'restoring-backup'] def _create_arguments(self): if self.properties[self.TAGS]: tags = dict((tm[self.TAG_KEY], tm[self.TAG_VALUE]) for tm in self.properties[self.TAGS]) else: tags = None return { 'size': self.properties[self.SIZE], 'availability_zone': (self.properties[self.AVAILABILITY_ZONE] or None), 'metadata': tags }
14,163
[ 0.02433411031961441, 0.025379542261362076, 0.047155678272247314, -0.007935278117656708, -0.010037264786660671, -0.001615415676496923, 0.004673861898481846, -0.039326056838035583, -0.008063176646828651, -0.03594508394598961, 0.0014694443671032786, -0.012055838480591774, 0.03478843718767166, ...
11
{"_type": "Module", "_fields": {"body": [{"_type": "ClassDef", "_fields": {"body": [{"_type": "Assign", "_fields": {"value": {"_type": "Tuple", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "elts": [{"_type": "Constant", "_fields": {"kind": null, "value": "InstanceId"}}, {"_type": "Constant", "_fields": {"kind": null, "value": "VolumeId"}}, {"_type": "Constant", "_fields": {"kind": null, "value": "Device"}}]}}, "targets": [{"_type": "Name", "_fields": {"id": "PROPERTIES", "ctx": {"_type": "Store", "_fields": {}}}}, {"_type": "Tuple", "_fields": {"ctx": {"_type": "Store", "_fields": {}}, "elts": [{"_type": "Name", "_fields": {"id": "INSTANCE_ID", "ctx": {"_type": "Store", "_fields": {}}}}, {"_type": "Name", "_fields": {"id": "VOLUME_ID", "ctx": {"_type": "Store", "_fields": {}}}}, {"_type": "Name", "_fields": {"id": "DEVICE", "ctx": {"_type": "Store", "_fields": {}}}}]}}], "type_comment": null}}, {"_type": "Assign", "_fields": {"value": {"_type": "Dict", "_fields": {"keys": [{"_type": "Name", "_fields": {"id": "INSTANCE_ID", "ctx": {"_type": "Load", "_fields": {}}}}, {"_type": "Name", "_fields": {"id": "VOLUME_ID", "ctx": {"_type": "Load", "_fields": {}}}}, {"_type": "Name", "_fields": {"id": "DEVICE", "ctx": {"_type": "Load", "_fields": {}}}}], "values": [{"_type": "Call", "_fields": {"args": [{"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "STRING", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "Schema", "value": {"_type": "Name", "_fields": {"id": "properties", "ctx": {"_type": "Load", "_fields": {}}}}}}}}, {"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"kind": null, "value": "The ID of the instance to which the volume attaches."}}], "func": {"_type": "Name", "_fields": {"id": "_", "ctx": {"_type": "Load", "_fields": {}}}}, "keywords": []}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "Schema", "value": {"_type": "Name", "_fields": {"id": "properties", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": [{"_type": "keyword", "_fields": {"arg": "immutable", "value": {"_type": "Constant", "_fields": {"kind": null, "value": true}}}}, {"_type": "keyword", "_fields": {"arg": "required", "value": {"_type": "Constant", "_fields": {"kind": null, "value": true}}}}, {"_type": "keyword", "_fields": {"arg": "constraints", "value": {"_type": "List", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "elts": [{"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"kind": null, "value": "nova.server"}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "CustomConstraint", "value": {"_type": "Name", "_fields": {"id": "constraints", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}]}}}}]}}, {"_type": "Call", "_fields": {"args": [{"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "STRING", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "Schema", "value": {"_type": "Name", "_fields": {"id": "properties", "ctx": {"_type": "Load", "_fields": {}}}}}}}}, {"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"kind": null, "value": "The ID of the volume to be attached."}}], "func": {"_type": "Name", "_fields": {"id": "_", "ctx": {"_type": "Load", "_fields": {}}}}, "keywords": []}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "Schema", "value": {"_type": "Name", "_fields": {"id": "properties", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": [{"_type": "keyword", "_fields": {"arg": "immutable", "value": {"_type": "Constant", "_fields": {"kind": null, "value": true}}}}, {"_type": "keyword", "_fields": {"arg": "required", "value": {"_type": "Constant", "_fields": {"kind": null, "value": true}}}}, {"_type": "keyword", "_fields": {"arg": "constraints", "value": {"_type": "List", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "elts": [{"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"kind": null, "value": "cinder.volume"}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "CustomConstraint", "value": {"_type": "Name", "_fields": {"id": "constraints", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}]}}}}]}}, {"_type": "Call", "_fields": {"args": [{"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "STRING", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "Schema", "value": {"_type": "Name", "_fields": {"id": "properties", "ctx": {"_type": "Load", "_fields": {}}}}}}}}, {"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"kind": null, "value": "The device where the volume is exposed on the instance. This assignment may not be honored and it is advised that the path /dev/disk/by-id/virtio-<VolumeId> be used instead."}}], "func": {"_type": "Name", "_fields": {"id": "_", "ctx": {"_type": "Load", "_fields": {}}}}, "keywords": []}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "Schema", "value": {"_type": "Name", "_fields": {"id": "properties", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": [{"_type": "keyword", "_fields": {"arg": "immutable", "value": {"_type": "Constant", "_fields": {"kind": null, "value": true}}}}, {"_type": "keyword", "_fields": {"arg": "required", "value": {"_type": "Constant", "_fields": {"kind": null, "value": true}}}}, {"_type": "keyword", "_fields": {"arg": "constraints", "value": {"_type": "List", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "elts": [{"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"kind": null, "value": "/dev/vd[b-z]"}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "AllowedPattern", "value": {"_type": "Name", "_fields": {"id": "constraints", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}]}}}}]}}]}}, "targets": [{"_type": "Name", "_fields": {"id": "properties_schema", "ctx": {"_type": "Store", "_fields": {}}}}], "type_comment": null}}], "name": "VolumeAttachment", "bases": [{"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "BaseVolumeAttachment", "value": {"_type": "Name", "_fields": {"id": "vb", "ctx": {"_type": "Load", "_fields": {}}}}}}], "keywords": [], "type_params": [], "decorator_list": []}}], "type_ignores": []}}
class VolumeAttachment(vb.BaseVolumeAttachment): PROPERTIES = ( INSTANCE_ID, VOLUME_ID, DEVICE, ) = ( 'InstanceId', 'VolumeId', 'Device', ) properties_schema = { INSTANCE_ID: properties.Schema( properties.Schema.STRING, _('The ID of the instance to which the volume attaches.'), immutable=True, required=True, constraints=[ constraints.CustomConstraint('nova.server') ] ), VOLUME_ID: properties.Schema( properties.Schema.STRING, _('The ID of the volume to be attached.'), immutable=True, required=True, constraints=[ constraints.CustomConstraint('cinder.volume') ] ), DEVICE: properties.Schema( properties.Schema.STRING, _('The device where the volume is exposed on the instance. This ' 'assignment may not be honored and it is advised that the path ' '/dev/disk/by-id/virtio-<VolumeId> be used instead.'), immutable=True, required=True, constraints=[ constraints.AllowedPattern('/dev/vd[b-z]'), ] ), }
14,164
[ 0.03685373440384865, -0.0007540354272350669, 0.016003133729100227, -0.03921254724264145, 0.03488445281982422, 0.024951471015810966, 0.015018492005765438, 0.007785161957144737, 0.015591965056955814, 0.0013532061129808426, 0.0034732967615127563, -0.04254518076777458, -0.004049474373459816, 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": [], "kw_defaults": [], "posonlyargs": []}}, "body": [{"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Dict", "_fields": {"keys": [{"_type": "Constant", "_fields": {"kind": null, "value": "a"}}, {"_type": "Constant", "_fields": {"kind": null, "value": "c"}}], "values": [{"_type": "Constant", "_fields": {"kind": null, "value": "b"}}, {"_type": "Dict", "_fields": {"keys": [{"_type": "Constant", "_fields": {"kind": null, "value": "d"}}, {"_type": "Constant", "_fields": {"kind": null, "value": "f"}}], "values": [{"_type": "Constant", "_fields": {"kind": null, "value": "e"}}, {"_type": "Dict", "_fields": {"keys": [{"_type": "Constant", "_fields": {"kind": null, "value": "g"}}], "values": [{"_type": "Constant", "_fields": {"kind": null, "value": "h"}}]}}]}}]}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "from_dict", "value": {"_type": "Name", "_fields": {"id": "Specification", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}, "targets": [{"_type": "Name", "_fields": {"id": "spec", "ctx": {"_type": "Store", "_fields": {}}}}], "type_comment": null}}, {"_type": "Assert", "_fields": {"msg": null, "test": {"_type": "Compare", "_fields": {"ops": [{"_type": "Is", "_fields": {}}], "left": {"_type": "Call", "_fields": {"args": [{"_type": "Name", "_fields": {"id": "spec", "ctx": {"_type": "Load", "_fields": {}}}}], "func": {"_type": "Name", "_fields": {"id": "type", "ctx": {"_type": "Load", "_fields": {}}}}, "keywords": []}}, "comparators": [{"_type": "Name", "_fields": {"id": "Specification", "ctx": {"_type": "Load", "_fields": {}}}}]}}}}, {"_type": "Assert", "_fields": {"msg": null, "test": {"_type": "Compare", "_fields": {"ops": [{"_type": "In", "_fields": {}}], "left": {"_type": "Constant", "_fields": {"kind": null, "value": "a"}}, "comparators": [{"_type": "Name", "_fields": {"id": "spec", "ctx": {"_type": "Load", "_fields": {}}}}]}}}}, {"_type": "Assert", "_fields": {"msg": null, "test": {"_type": "Compare", "_fields": {"ops": [{"_type": "Eq", "_fields": {}}], "left": {"_type": "Subscript", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "slice": {"_type": "Constant", "_fields": {"kind": null, "value": "a"}}, "value": {"_type": "Name", "_fields": {"id": "spec", "ctx": {"_type": "Load", "_fields": {}}}}}}, "comparators": [{"_type": "Constant", "_fields": {"kind": null, "value": "b"}}]}}}}, {"_type": "Assert", "_fields": {"msg": null, "test": {"_type": "Compare", "_fields": {"ops": [{"_type": "Is", "_fields": {}}], "left": {"_type": "Call", "_fields": {"args": [{"_type": "Subscript", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "slice": {"_type": "Constant", "_fields": {"kind": null, "value": "c"}}, "value": {"_type": "Name", "_fields": {"id": "spec", "ctx": {"_type": "Load", "_fields": {}}}}}}], "func": {"_type": "Name", "_fields": {"id": "type", "ctx": {"_type": "Load", "_fields": {}}}}, "keywords": []}}, "comparators": [{"_type": "Name", "_fields": {"id": "Specification", "ctx": {"_type": "Load", "_fields": {}}}}]}}}}, {"_type": "Assert", "_fields": {"msg": null, "test": {"_type": "Compare", "_fields": {"ops": [{"_type": "Eq", "_fields": {}}], "left": {"_type": "Subscript", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "slice": {"_type": "Constant", "_fields": {"kind": null, "value": "d"}}, "value": {"_type": "Subscript", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "slice": {"_type": "Constant", "_fields": {"kind": null, "value": "c"}}, "value": {"_type": "Name", "_fields": {"id": "spec", "ctx": {"_type": "Load", "_fields": {}}}}}}}}, "comparators": [{"_type": "Constant", "_fields": {"kind": null, "value": "e"}}]}}}}, {"_type": "Assert", "_fields": {"msg": null, "test": {"_type": "Compare", "_fields": {"ops": [{"_type": "Is", "_fields": {}}], "left": {"_type": "Call", "_fields": {"args": [{"_type": "Subscript", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "slice": {"_type": "Constant", "_fields": {"kind": null, "value": "f"}}, "value": {"_type": "Subscript", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "slice": {"_type": "Constant", "_fields": {"kind": null, "value": "c"}}, "value": {"_type": "Name", "_fields": {"id": "spec", "ctx": {"_type": "Load", "_fields": {}}}}}}}}], "func": {"_type": "Name", "_fields": {"id": "type", "ctx": {"_type": "Load", "_fields": {}}}}, "keywords": []}}, "comparators": [{"_type": "Name", "_fields": {"id": "Specification", "ctx": {"_type": "Load", "_fields": {}}}}]}}}}, {"_type": "Assert", "_fields": {"msg": null, "test": {"_type": "Compare", "_fields": {"ops": [{"_type": "Eq", "_fields": {}}], "left": {"_type": "Subscript", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "slice": {"_type": "Constant", "_fields": {"kind": null, "value": "g"}}, "value": {"_type": "Subscript", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "slice": {"_type": "Constant", "_fields": {"kind": null, "value": "f"}}, "value": {"_type": "Subscript", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "slice": {"_type": "Constant", "_fields": {"kind": null, "value": "c"}}, "value": {"_type": "Name", "_fields": {"id": "spec", "ctx": {"_type": "Load", "_fields": {}}}}}}}}}}, "comparators": [{"_type": "Constant", "_fields": {"kind": null, "value": "h"}}]}}}}], "name": "test_from_dict_recursive", "returns": null, "type_params": [], "type_comment": null, "decorator_list": []}}, {"_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": []}}, "body": [{"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"args": [], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "empty", "value": {"_type": "Name", "_fields": {"id": "Specification", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}, "targets": [{"_type": "Name", "_fields": {"id": "spec", "ctx": {"_type": "Store", "_fields": {}}}}], "type_comment": null}}, {"_type": "Assert", "_fields": {"msg": null, "test": {"_type": "Compare", "_fields": {"ops": [{"_type": "Eq", "_fields": {}}], "left": {"_type": "Call", "_fields": {"args": [{"_type": "Name", "_fields": {"id": "spec", "ctx": {"_type": "Load", "_fields": {}}}}], "func": {"_type": "Name", "_fields": {"id": "len", "ctx": {"_type": "Load", "_fields": {}}}}, "keywords": []}}, "comparators": [{"_type": "Constant", "_fields": {"kind": null, "value": 0}}]}}}}], "name": "test_empty", "returns": null, "type_params": [], "type_comment": null, "decorator_list": []}}, {"_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": []}}, "body": [{"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Dict", "_fields": {"keys": [{"_type": "Constant", "_fields": {"kind": null, "value": "a"}}], "values": [{"_type": "Constant", "_fields": {"kind": null, "value": "b"}}]}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "from_dict", "value": {"_type": "Name", "_fields": {"id": "Specification", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}, "targets": [{"_type": "Name", "_fields": {"id": "spec", "ctx": {"_type": "Store", "_fields": {}}}}], "type_comment": null}}, {"_type": "Assert", "_fields": {"msg": null, "test": {"_type": "Compare", "_fields": {"ops": [{"_type": "Eq", "_fields": {}}], "left": {"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"kind": null, "value": "a"}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "get_or_fail", "value": {"_type": "Name", "_fields": {"id": "spec", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}, "comparators": [{"_type": "Constant", "_fields": {"kind": null, "value": "b"}}]}}}}], "name": "test_get_or_fail_successful", "returns": null, "type_params": [], "type_comment": null, "decorator_list": []}}, {"_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": []}}, "body": [{"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Dict", "_fields": {"keys": [{"_type": "Constant", "_fields": {"kind": null, "value": "a"}}], "values": [{"_type": "Constant", "_fields": {"kind": null, "value": "b"}}]}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "from_dict", "value": {"_type": "Name", "_fields": {"id": "Specification", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}, "targets": [{"_type": "Name", "_fields": {"id": "spec", "ctx": {"_type": "Store", "_fields": {}}}}], "type_comment": null}}, {"_type": "With", "_fields": {"body": [{"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"kind": null, "value": "???????????"}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "get_or_fail", "value": {"_type": "Name", "_fields": {"id": "spec", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}], "items": [{"_type": "withitem", "_fields": {"context_expr": {"_type": "Call", "_fields": {"args": [{"_type": "Name", "_fields": {"id": "MissingFieldInSpecification", "ctx": {"_type": "Load", "_fields": {}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "raises", "value": {"_type": "Name", "_fields": {"id": "pytest", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}, "optional_vars": null}}], "type_comment": null}}], "name": "test_get_or_fail_unsuccessful", "returns": null, "type_params": [], "type_comment": null, "decorator_list": []}}], "name": "TestSpecification", "bases": [{"_type": "Name", "_fields": {"id": "object", "ctx": {"_type": "Load", "_fields": {}}}}], "keywords": [], "type_params": [], "decorator_list": []}}], "type_ignores": []}}
class TestSpecification(object): def test_from_dict_recursive(self): spec = Specification.from_dict({'a': 'b', 'c': {'d': 'e', 'f': {'g': 'h'}}}) assert type(spec) is Specification assert 'a' in spec assert spec['a'] == 'b' assert type(spec['c']) is Specification assert spec['c']['d'] == 'e' assert type(spec['c']['f']) is Specification assert spec['c']['f']['g'] == 'h' def test_empty(self): spec = Specification.empty() assert len(spec) == 0 def test_get_or_fail_successful(self): spec = Specification.from_dict({'a': 'b'}) assert spec.get_or_fail('a') == 'b' def test_get_or_fail_unsuccessful(self): spec = Specification.from_dict({'a': 'b'}) with pytest.raises(MissingFieldInSpecification): spec.get_or_fail('???????????')
14,165
[ 0.046089883893728256, -0.01811729185283184, 0.005172977689653635, -0.04129940643906593, 0.010535886511206627, 0.02473321743309498, 0.010762748308479786, 0.039801064878702164, 0.014550813473761082, -0.0018069809302687645, 0.016239088028669357, -0.032752517610788345, 0.0006406868924386799, 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": []}}, "body": [{"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Dict", "_fields": {"keys": [{"_type": "Constant", "_fields": {"kind": null, "value": "a"}}, {"_type": "Constant", "_fields": {"kind": null, "value": "c"}}], "values": [{"_type": "Constant", "_fields": {"kind": null, "value": "b"}}, {"_type": "Dict", "_fields": {"keys": [{"_type": "Constant", "_fields": {"kind": null, "value": "d"}}, {"_type": "Constant", "_fields": {"kind": null, "value": "f"}}], "values": [{"_type": "Constant", "_fields": {"kind": null, "value": "e"}}, {"_type": "Dict", "_fields": {"keys": [{"_type": "Constant", "_fields": {"kind": null, "value": "g"}}], "values": [{"_type": "Constant", "_fields": {"kind": null, "value": "h"}}]}}]}}]}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "from_dict", "value": {"_type": "Name", "_fields": {"id": "Specification", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}, "targets": [{"_type": "Name", "_fields": {"id": "spec", "ctx": {"_type": "Store", "_fields": {}}}}], "type_comment": null}}, {"_type": "Assert", "_fields": {"msg": null, "test": {"_type": "Compare", "_fields": {"ops": [{"_type": "Is", "_fields": {}}], "left": {"_type": "Call", "_fields": {"args": [{"_type": "Name", "_fields": {"id": "spec", "ctx": {"_type": "Load", "_fields": {}}}}], "func": {"_type": "Name", "_fields": {"id": "type", "ctx": {"_type": "Load", "_fields": {}}}}, "keywords": []}}, "comparators": [{"_type": "Name", "_fields": {"id": "Specification", "ctx": {"_type": "Load", "_fields": {}}}}]}}}}, {"_type": "Assert", "_fields": {"msg": null, "test": {"_type": "Compare", "_fields": {"ops": [{"_type": "In", "_fields": {}}], "left": {"_type": "Constant", "_fields": {"kind": null, "value": "a"}}, "comparators": [{"_type": "Name", "_fields": {"id": "spec", "ctx": {"_type": "Load", "_fields": {}}}}]}}}}, {"_type": "Assert", "_fields": {"msg": null, "test": {"_type": "Compare", "_fields": {"ops": [{"_type": "Eq", "_fields": {}}], "left": {"_type": "Subscript", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "slice": {"_type": "Constant", "_fields": {"kind": null, "value": "a"}}, "value": {"_type": "Name", "_fields": {"id": "spec", "ctx": {"_type": "Load", "_fields": {}}}}}}, "comparators": [{"_type": "Constant", "_fields": {"kind": null, "value": "b"}}]}}}}, {"_type": "Assert", "_fields": {"msg": null, "test": {"_type": "Compare", "_fields": {"ops": [{"_type": "Is", "_fields": {}}], "left": {"_type": "Call", "_fields": {"args": [{"_type": "Subscript", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "slice": {"_type": "Constant", "_fields": {"kind": null, "value": "c"}}, "value": {"_type": "Name", "_fields": {"id": "spec", "ctx": {"_type": "Load", "_fields": {}}}}}}], "func": {"_type": "Name", "_fields": {"id": "type", "ctx": {"_type": "Load", "_fields": {}}}}, "keywords": []}}, "comparators": [{"_type": "Name", "_fields": {"id": "Specification", "ctx": {"_type": "Load", "_fields": {}}}}]}}}}, {"_type": "Assert", "_fields": {"msg": null, "test": {"_type": "Compare", "_fields": {"ops": [{"_type": "Eq", "_fields": {}}], "left": {"_type": "Subscript", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "slice": {"_type": "Constant", "_fields": {"kind": null, "value": "d"}}, "value": {"_type": "Subscript", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "slice": {"_type": "Constant", "_fields": {"kind": null, "value": "c"}}, "value": {"_type": "Name", "_fields": {"id": "spec", "ctx": {"_type": "Load", "_fields": {}}}}}}}}, "comparators": [{"_type": "Constant", "_fields": {"kind": null, "value": "e"}}]}}}}, {"_type": "Assert", "_fields": {"msg": null, "test": {"_type": "Compare", "_fields": {"ops": [{"_type": "Is", "_fields": {}}], "left": {"_type": "Call", "_fields": {"args": [{"_type": "Subscript", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "slice": {"_type": "Constant", "_fields": {"kind": null, "value": "f"}}, "value": {"_type": "Subscript", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "slice": {"_type": "Constant", "_fields": {"kind": null, "value": "c"}}, "value": {"_type": "Name", "_fields": {"id": "spec", "ctx": {"_type": "Load", "_fields": {}}}}}}}}], "func": {"_type": "Name", "_fields": {"id": "type", "ctx": {"_type": "Load", "_fields": {}}}}, "keywords": []}}, "comparators": [{"_type": "Name", "_fields": {"id": "Specification", "ctx": {"_type": "Load", "_fields": {}}}}]}}}}, {"_type": "Assert", "_fields": {"msg": null, "test": {"_type": "Compare", "_fields": {"ops": [{"_type": "Eq", "_fields": {}}], "left": {"_type": "Subscript", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "slice": {"_type": "Constant", "_fields": {"kind": null, "value": "g"}}, "value": {"_type": "Subscript", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "slice": {"_type": "Constant", "_fields": {"kind": null, "value": "f"}}, "value": {"_type": "Subscript", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "slice": {"_type": "Constant", "_fields": {"kind": null, "value": "c"}}, "value": {"_type": "Name", "_fields": {"id": "spec", "ctx": {"_type": "Load", "_fields": {}}}}}}}}}}, "comparators": [{"_type": "Constant", "_fields": {"kind": null, "value": "h"}}]}}}}], "name": "test_from_dict_recursive", "returns": null, "type_params": [], "type_comment": null, "decorator_list": []}}], "type_ignores": []}}
def test_from_dict_recursive(self): spec = Specification.from_dict({'a': 'b', 'c': {'d': 'e', 'f': {'g': 'h'}}}) assert type(spec) is Specification assert 'a' in spec assert spec['a'] == 'b' assert type(spec['c']) is Specification assert spec['c']['d'] == 'e' assert type(spec['c']['f']) is Specification assert spec['c']['f']['g'] == 'h'
14,166
[ 0.020813869312405586, 0.008338010869920254, 0.045541245490312576, -0.040979642421007156, -0.006278435233980417, -0.015155487693846226, -0.029637953266501427, -0.01805945858359337, 0.0031049433164298534, -0.0010219983523711562, 0.04693714529275894, -0.02547517977654934, 0.005415345076471567, ...
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": []}}, "body": [{"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"kind": null, "value": "google.protobuf.python.internal.Factory1Message"}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "FindFileContainingSymbol", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "pool", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}}}, "keywords": []}}, "targets": [{"_type": "Name", "_fields": {"id": "file_desc1", "ctx": {"_type": "Store", "_fields": {}}}}], "type_comment": null}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Name", "_fields": {"id": "file_desc1", "ctx": {"_type": "Load", "_fields": {}}}}, {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "FileDescriptor", "value": {"_type": "Name", "_fields": {"id": "descriptor", "ctx": {"_type": "Load", "_fields": {}}}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "assertIsInstance", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"kind": null, "value": "google/protobuf/internal/factory_test1.proto"}}, {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "name", "value": {"_type": "Name", "_fields": {"id": "file_desc1", "ctx": {"_type": "Load", "_fields": {}}}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "assertEqual", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"kind": null, "value": "google.protobuf.python.internal"}}, {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "package", "value": {"_type": "Name", "_fields": {"id": "file_desc1", "ctx": {"_type": "Load", "_fields": {}}}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "assertEqual", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"kind": null, "value": "Factory1Message"}}, {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "message_types_by_name", "value": {"_type": "Name", "_fields": {"id": "file_desc1", "ctx": {"_type": "Load", "_fields": {}}}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "assertIn", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"kind": null, "value": "google.protobuf.python.internal.Factory2Message"}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "FindFileContainingSymbol", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "pool", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}}}, "keywords": []}}, "targets": [{"_type": "Name", "_fields": {"id": "file_desc2", "ctx": {"_type": "Store", "_fields": {}}}}], "type_comment": null}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Name", "_fields": {"id": "file_desc2", "ctx": {"_type": "Load", "_fields": {}}}}, {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "FileDescriptor", "value": {"_type": "Name", "_fields": {"id": "descriptor", "ctx": {"_type": "Load", "_fields": {}}}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "assertIsInstance", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"kind": null, "value": "google/protobuf/internal/factory_test2.proto"}}, {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "name", "value": {"_type": "Name", "_fields": {"id": "file_desc2", "ctx": {"_type": "Load", "_fields": {}}}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "assertEqual", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"kind": null, "value": "google.protobuf.python.internal"}}, {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "package", "value": {"_type": "Name", "_fields": {"id": "file_desc2", "ctx": {"_type": "Load", "_fields": {}}}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "assertEqual", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"kind": null, "value": "Factory2Message"}}, {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "message_types_by_name", "value": {"_type": "Name", "_fields": {"id": "file_desc2", "ctx": {"_type": "Load", "_fields": {}}}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "assertIn", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"kind": null, "value": "google.protobuf.python.internal.another_field"}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "FindFileContainingSymbol", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "pool", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}}}, "keywords": []}}, "targets": [{"_type": "Name", "_fields": {"id": "file_desc3", "ctx": {"_type": "Store", "_fields": {}}}}], "type_comment": null}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Name", "_fields": {"id": "file_desc3", "ctx": {"_type": "Load", "_fields": {}}}}, {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "FileDescriptor", "value": {"_type": "Name", "_fields": {"id": "descriptor", "ctx": {"_type": "Load", "_fields": {}}}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "assertIsInstance", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"kind": null, "value": "google/protobuf/internal/factory_test2.proto"}}, {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "name", "value": {"_type": "Name", "_fields": {"id": "file_desc3", "ctx": {"_type": "Load", "_fields": {}}}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "assertEqual", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"kind": null, "value": "google.protobuf.python.internal.Factory2Message.one_more_field"}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "FindFileContainingSymbol", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "pool", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}}}, "keywords": []}}, "targets": [{"_type": "Name", "_fields": {"id": "file_desc4", "ctx": {"_type": "Store", "_fields": {}}}}], "type_comment": null}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Name", "_fields": {"id": "file_desc4", "ctx": {"_type": "Load", "_fields": {}}}}, {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "FileDescriptor", "value": {"_type": "Name", "_fields": {"id": "descriptor", "ctx": {"_type": "Load", "_fields": {}}}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "assertIsInstance", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"kind": null, "value": "google/protobuf/internal/factory_test2.proto"}}, {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "name", "value": {"_type": "Name", "_fields": {"id": "file_desc4", "ctx": {"_type": "Load", "_fields": {}}}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "assertEqual", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"kind": null, "value": "protobuf_unittest.TestService"}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "FindFileContainingSymbol", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "pool", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}}}, "keywords": []}}, "targets": [{"_type": "Name", "_fields": {"id": "file_desc5", "ctx": {"_type": "Store", "_fields": {}}}}], "type_comment": null}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Name", "_fields": {"id": "file_desc5", "ctx": {"_type": "Load", "_fields": {}}}}, {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "FileDescriptor", "value": {"_type": "Name", "_fields": {"id": "descriptor", "ctx": {"_type": "Load", "_fields": {}}}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "assertIsInstance", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"kind": null, "value": "google/protobuf/unittest.proto"}}, {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "name", "value": {"_type": "Name", "_fields": {"id": "file_desc5", "ctx": {"_type": "Load", "_fields": {}}}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "assertEqual", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}], "name": "testFindFileContainingSymbol", "returns": null, "type_params": [], "type_comment": null, "decorator_list": []}}], "type_ignores": []}}
def testFindFileContainingSymbol(self): file_desc1 = self.pool.FindFileContainingSymbol( 'google.protobuf.python.internal.Factory1Message') self.assertIsInstance(file_desc1, descriptor.FileDescriptor) self.assertEqual('google/protobuf/internal/factory_test1.proto', file_desc1.name) self.assertEqual('google.protobuf.python.internal', file_desc1.package) self.assertIn('Factory1Message', file_desc1.message_types_by_name) file_desc2 = self.pool.FindFileContainingSymbol( 'google.protobuf.python.internal.Factory2Message') self.assertIsInstance(file_desc2, descriptor.FileDescriptor) self.assertEqual('google/protobuf/internal/factory_test2.proto', file_desc2.name) self.assertEqual('google.protobuf.python.internal', file_desc2.package) self.assertIn('Factory2Message', file_desc2.message_types_by_name) # Tests top level extension. file_desc3 = self.pool.FindFileContainingSymbol( 'google.protobuf.python.internal.another_field') self.assertIsInstance(file_desc3, descriptor.FileDescriptor) self.assertEqual('google/protobuf/internal/factory_test2.proto', file_desc3.name) # Tests nested extension inside a message. file_desc4 = self.pool.FindFileContainingSymbol( 'google.protobuf.python.internal.Factory2Message.one_more_field') self.assertIsInstance(file_desc4, descriptor.FileDescriptor) self.assertEqual('google/protobuf/internal/factory_test2.proto', file_desc4.name) file_desc5 = self.pool.FindFileContainingSymbol( 'protobuf_unittest.TestService') self.assertIsInstance(file_desc5, descriptor.FileDescriptor) self.assertEqual('google/protobuf/unittest.proto', file_desc5.name)
14,167
[ 0.012618746608495712, -0.015133515000343323, 0.056178122758865356, -0.042953137308359146, 0.0005181797314435244, -0.03466787561774254, -0.042930684983730316, -0.023328963667154312, -0.0008812915184535086, -0.011119989678263664, 0.05254068970680237, 0.00585469463840127, 0.011832881718873978, ...
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": []}}, "body": [{"_type": "Assign", "_fields": {"value": {"_type": "Constant", "_fields": {"kind": null, "value": "google/protobuf/internal/factory_test1.proto"}}, "targets": [{"_type": "Name", "_fields": {"id": "name1", "ctx": {"_type": "Store", "_fields": {}}}}], "type_comment": null}}, {"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Name", "_fields": {"id": "name1", "ctx": {"_type": "Load", "_fields": {}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "FindFileByName", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "pool", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}}}, "keywords": []}}, "targets": [{"_type": "Name", "_fields": {"id": "file_desc1", "ctx": {"_type": "Store", "_fields": {}}}}], "type_comment": null}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Name", "_fields": {"id": "file_desc1", "ctx": {"_type": "Load", "_fields": {}}}}, {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "FileDescriptor", "value": {"_type": "Name", "_fields": {"id": "descriptor", "ctx": {"_type": "Load", "_fields": {}}}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "assertIsInstance", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Name", "_fields": {"id": "name1", "ctx": {"_type": "Load", "_fields": {}}}}, {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "name", "value": {"_type": "Name", "_fields": {"id": "file_desc1", "ctx": {"_type": "Load", "_fields": {}}}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "assertEqual", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"kind": null, "value": "google.protobuf.python.internal"}}, {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "package", "value": {"_type": "Name", "_fields": {"id": "file_desc1", "ctx": {"_type": "Load", "_fields": {}}}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "assertEqual", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"kind": null, "value": "Factory1Message"}}, {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "message_types_by_name", "value": {"_type": "Name", "_fields": {"id": "file_desc1", "ctx": {"_type": "Load", "_fields": {}}}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "assertIn", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Assign", "_fields": {"value": {"_type": "Constant", "_fields": {"kind": null, "value": "google/protobuf/internal/factory_test2.proto"}}, "targets": [{"_type": "Name", "_fields": {"id": "name2", "ctx": {"_type": "Store", "_fields": {}}}}], "type_comment": null}}, {"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Name", "_fields": {"id": "name2", "ctx": {"_type": "Load", "_fields": {}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "FindFileByName", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "pool", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}}}, "keywords": []}}, "targets": [{"_type": "Name", "_fields": {"id": "file_desc2", "ctx": {"_type": "Store", "_fields": {}}}}], "type_comment": null}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Name", "_fields": {"id": "file_desc2", "ctx": {"_type": "Load", "_fields": {}}}}, {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "FileDescriptor", "value": {"_type": "Name", "_fields": {"id": "descriptor", "ctx": {"_type": "Load", "_fields": {}}}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "assertIsInstance", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Name", "_fields": {"id": "name2", "ctx": {"_type": "Load", "_fields": {}}}}, {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "name", "value": {"_type": "Name", "_fields": {"id": "file_desc2", "ctx": {"_type": "Load", "_fields": {}}}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "assertEqual", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"kind": null, "value": "google.protobuf.python.internal"}}, {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "package", "value": {"_type": "Name", "_fields": {"id": "file_desc2", "ctx": {"_type": "Load", "_fields": {}}}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "assertEqual", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"kind": null, "value": "Factory2Message"}}, {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "message_types_by_name", "value": {"_type": "Name", "_fields": {"id": "file_desc2", "ctx": {"_type": "Load", "_fields": {}}}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "assertIn", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}], "name": "testFindFileByName", "returns": null, "type_params": [], "type_comment": null, "decorator_list": []}}], "type_ignores": []}}
def testFindFileByName(self): name1 = 'google/protobuf/internal/factory_test1.proto' file_desc1 = self.pool.FindFileByName(name1) self.assertIsInstance(file_desc1, descriptor.FileDescriptor) self.assertEqual(name1, file_desc1.name) self.assertEqual('google.protobuf.python.internal', file_desc1.package) self.assertIn('Factory1Message', file_desc1.message_types_by_name) name2 = 'google/protobuf/internal/factory_test2.proto' file_desc2 = self.pool.FindFileByName(name2) self.assertIsInstance(file_desc2, descriptor.FileDescriptor) self.assertEqual(name2, file_desc2.name) self.assertEqual('google.protobuf.python.internal', file_desc2.package) self.assertIn('Factory2Message', file_desc2.message_types_by_name)
14,168
[ -0.011927932500839233, -0.037225380539894104, 0.08161216974258423, -0.0177640151232481, -0.0021492948289960623, -0.03129629045724869, 0.004769429098814726, 0.02534394897520542, -0.015729524195194244, -0.0020577427931129932, 0.014718092046678066, -0.005385589320212603, -0.008353040553629398, ...
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": [], "kw_defaults": [], "posonlyargs": []}}, "body": [{"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"args": [], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "Default", "value": {"_type": "Name", "_fields": {"id": "descriptor_pool", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}, "targets": [{"_type": "Attribute", "_fields": {"ctx": {"_type": "Store", "_fields": {}}, "attr": "pool", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}], "type_comment": null}}, {"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "serialized_pb", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "DESCRIPTOR", "value": {"_type": "Name", "_fields": {"id": "factory_test1_pb2", "ctx": {"_type": "Load", "_fields": {}}}}}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "FromString", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "FileDescriptorProto", "value": {"_type": "Name", "_fields": {"id": "descriptor_pb2", "ctx": {"_type": "Load", "_fields": {}}}}}}}}, "keywords": []}}, "targets": [{"_type": "Attribute", "_fields": {"ctx": {"_type": "Store", "_fields": {}}, "attr": "factory_test1_fd", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}], "type_comment": null}}, {"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "serialized_pb", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "DESCRIPTOR", "value": {"_type": "Name", "_fields": {"id": "factory_test2_pb2", "ctx": {"_type": "Load", "_fields": {}}}}}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "FromString", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "FileDescriptorProto", "value": {"_type": "Name", "_fields": {"id": "descriptor_pb2", "ctx": {"_type": "Load", "_fields": {}}}}}}}}, "keywords": []}}, "targets": [{"_type": "Attribute", "_fields": {"ctx": {"_type": "Store", "_fields": {}}, "attr": "factory_test2_fd", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}], "type_comment": null}}], "name": "setUp", "returns": null, "type_params": [], "type_comment": null, "decorator_list": []}}, {"_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": []}}, "body": [{"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"kind": null, "value": "google/protobuf/unittest.proto"}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "FindFileByName", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "pool", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}}}, "keywords": []}}, {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "DESCRIPTOR", "value": {"_type": "Name", "_fields": {"id": "unittest_pb2", "ctx": {"_type": "Load", "_fields": {}}}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "assertIs", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"kind": null, "value": "protobuf_unittest.TestAllTypes"}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "FindMessageTypeByName", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "pool", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}}}, "keywords": []}}, {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "DESCRIPTOR", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "TestAllTypes", "value": {"_type": "Name", "_fields": {"id": "unittest_pb2", "ctx": {"_type": "Load", "_fields": {}}}}}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "assertIs", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"kind": null, "value": "protobuf_unittest.TestAllTypes.optional_int32"}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "FindFieldByName", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "pool", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}}}, "keywords": []}}, {"_type": "Subscript", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "slice": {"_type": "Constant", "_fields": {"kind": null, "value": "optional_int32"}}, "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "fields_by_name", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "DESCRIPTOR", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "TestAllTypes", "value": {"_type": "Name", "_fields": {"id": "unittest_pb2", "ctx": {"_type": "Load", "_fields": {}}}}}}}}}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "assertIs", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"kind": null, "value": "protobuf_unittest.ForeignEnum"}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "FindEnumTypeByName", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "pool", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}}}, "keywords": []}}, {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "DESCRIPTOR", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "ForeignEnum", "value": {"_type": "Name", "_fields": {"id": "unittest_pb2", "ctx": {"_type": "Load", "_fields": {}}}}}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "assertIs", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"kind": null, "value": "protobuf_unittest.optional_int32_extension"}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "FindExtensionByName", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "pool", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}}}, "keywords": []}}, {"_type": "Subscript", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "slice": {"_type": "Constant", "_fields": {"kind": null, "value": "optional_int32_extension"}}, "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "extensions_by_name", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "DESCRIPTOR", "value": {"_type": "Name", "_fields": {"id": "unittest_pb2", "ctx": {"_type": "Load", "_fields": {}}}}}}}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "assertIs", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"kind": null, "value": "protobuf_unittest.TestAllTypes.oneof_field"}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "FindOneofByName", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "pool", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}}}, "keywords": []}}, {"_type": "Subscript", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "slice": {"_type": "Constant", "_fields": {"kind": null, "value": "oneof_field"}}, "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "oneofs_by_name", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "DESCRIPTOR", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "TestAllTypes", "value": {"_type": "Name", "_fields": {"id": "unittest_pb2", "ctx": {"_type": "Load", "_fields": {}}}}}}}}}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "assertIs", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"kind": null, "value": "protobuf_unittest.TestService"}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "FindServiceByName", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "pool", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}}}, "keywords": []}}, {"_type": "Subscript", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "slice": {"_type": "Constant", "_fields": {"kind": null, "value": "TestService"}}, "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "services_by_name", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "DESCRIPTOR", "value": {"_type": "Name", "_fields": {"id": "unittest_pb2", "ctx": {"_type": "Load", "_fields": {}}}}}}}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "assertIs", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}], "name": "testFindMethods", "returns": null, "type_params": [], "type_comment": null, "decorator_list": []}}], "name": "DefaultDescriptorPoolTest", "bases": [{"_type": "Name", "_fields": {"id": "DescriptorPoolTestBase", "ctx": {"_type": "Load", "_fields": {}}}}, {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "TestCase", "value": {"_type": "Name", "_fields": {"id": "unittest", "ctx": {"_type": "Load", "_fields": {}}}}}}], "keywords": [], "type_params": [], "decorator_list": []}}], "type_ignores": []}}
class DefaultDescriptorPoolTest(DescriptorPoolTestBase, unittest.TestCase): def setUp(self): self.pool = descriptor_pool.Default() self.factory_test1_fd = descriptor_pb2.FileDescriptorProto.FromString( factory_test1_pb2.DESCRIPTOR.serialized_pb) self.factory_test2_fd = descriptor_pb2.FileDescriptorProto.FromString( factory_test2_pb2.DESCRIPTOR.serialized_pb) def testFindMethods(self): self.assertIs( self.pool.FindFileByName('google/protobuf/unittest.proto'), unittest_pb2.DESCRIPTOR) self.assertIs( self.pool.FindMessageTypeByName('protobuf_unittest.TestAllTypes'), unittest_pb2.TestAllTypes.DESCRIPTOR) self.assertIs( self.pool.FindFieldByName( 'protobuf_unittest.TestAllTypes.optional_int32'), unittest_pb2.TestAllTypes.DESCRIPTOR.fields_by_name['optional_int32']) self.assertIs( self.pool.FindEnumTypeByName('protobuf_unittest.ForeignEnum'), unittest_pb2.ForeignEnum.DESCRIPTOR) self.assertIs( self.pool.FindExtensionByName( 'protobuf_unittest.optional_int32_extension'), unittest_pb2.DESCRIPTOR.extensions_by_name['optional_int32_extension']) self.assertIs( self.pool.FindOneofByName('protobuf_unittest.TestAllTypes.oneof_field'), unittest_pb2.TestAllTypes.DESCRIPTOR.oneofs_by_name['oneof_field']) self.assertIs( self.pool.FindServiceByName('protobuf_unittest.TestService'), unittest_pb2.DESCRIPTOR.services_by_name['TestService'])
14,169
[ -0.008997578173875809, -0.009278370998799801, 0.05884440615773201, -0.041264332830905914, -0.03215688094496727, -0.019313661381602287, -0.0341346375644207, -0.017750989645719528, -0.004776529967784882, -0.006140816491097212, 0.04023883119225502, -0.0013459742767736316, 0.029886120930314064, ...
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": []}}, "body": [{"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"kind": null, "value": "google/protobuf/unittest.proto"}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "FindFileByName", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "pool", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}}}, "keywords": []}}, {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "DESCRIPTOR", "value": {"_type": "Name", "_fields": {"id": "unittest_pb2", "ctx": {"_type": "Load", "_fields": {}}}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "assertIs", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"kind": null, "value": "protobuf_unittest.TestAllTypes"}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "FindMessageTypeByName", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "pool", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}}}, "keywords": []}}, {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "DESCRIPTOR", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "TestAllTypes", "value": {"_type": "Name", "_fields": {"id": "unittest_pb2", "ctx": {"_type": "Load", "_fields": {}}}}}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "assertIs", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"kind": null, "value": "protobuf_unittest.TestAllTypes.optional_int32"}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "FindFieldByName", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "pool", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}}}, "keywords": []}}, {"_type": "Subscript", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "slice": {"_type": "Constant", "_fields": {"kind": null, "value": "optional_int32"}}, "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "fields_by_name", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "DESCRIPTOR", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "TestAllTypes", "value": {"_type": "Name", "_fields": {"id": "unittest_pb2", "ctx": {"_type": "Load", "_fields": {}}}}}}}}}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "assertIs", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"kind": null, "value": "protobuf_unittest.ForeignEnum"}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "FindEnumTypeByName", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "pool", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}}}, "keywords": []}}, {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "DESCRIPTOR", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "ForeignEnum", "value": {"_type": "Name", "_fields": {"id": "unittest_pb2", "ctx": {"_type": "Load", "_fields": {}}}}}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "assertIs", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"kind": null, "value": "protobuf_unittest.optional_int32_extension"}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "FindExtensionByName", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "pool", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}}}, "keywords": []}}, {"_type": "Subscript", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "slice": {"_type": "Constant", "_fields": {"kind": null, "value": "optional_int32_extension"}}, "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "extensions_by_name", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "DESCRIPTOR", "value": {"_type": "Name", "_fields": {"id": "unittest_pb2", "ctx": {"_type": "Load", "_fields": {}}}}}}}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "assertIs", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"kind": null, "value": "protobuf_unittest.TestAllTypes.oneof_field"}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "FindOneofByName", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "pool", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}}}, "keywords": []}}, {"_type": "Subscript", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "slice": {"_type": "Constant", "_fields": {"kind": null, "value": "oneof_field"}}, "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "oneofs_by_name", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "DESCRIPTOR", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "TestAllTypes", "value": {"_type": "Name", "_fields": {"id": "unittest_pb2", "ctx": {"_type": "Load", "_fields": {}}}}}}}}}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "assertIs", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"kind": null, "value": "protobuf_unittest.TestService"}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "FindServiceByName", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "pool", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}}}, "keywords": []}}, {"_type": "Subscript", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "slice": {"_type": "Constant", "_fields": {"kind": null, "value": "TestService"}}, "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "services_by_name", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "DESCRIPTOR", "value": {"_type": "Name", "_fields": {"id": "unittest_pb2", "ctx": {"_type": "Load", "_fields": {}}}}}}}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "assertIs", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}], "name": "testFindMethods", "returns": null, "type_params": [], "type_comment": null, "decorator_list": []}}], "type_ignores": []}}
def testFindMethods(self): self.assertIs( self.pool.FindFileByName('google/protobuf/unittest.proto'), unittest_pb2.DESCRIPTOR) self.assertIs( self.pool.FindMessageTypeByName('protobuf_unittest.TestAllTypes'), unittest_pb2.TestAllTypes.DESCRIPTOR) self.assertIs( self.pool.FindFieldByName( 'protobuf_unittest.TestAllTypes.optional_int32'), unittest_pb2.TestAllTypes.DESCRIPTOR.fields_by_name['optional_int32']) self.assertIs( self.pool.FindEnumTypeByName('protobuf_unittest.ForeignEnum'), unittest_pb2.ForeignEnum.DESCRIPTOR) self.assertIs( self.pool.FindExtensionByName( 'protobuf_unittest.optional_int32_extension'), unittest_pb2.DESCRIPTOR.extensions_by_name['optional_int32_extension']) self.assertIs( self.pool.FindOneofByName('protobuf_unittest.TestAllTypes.oneof_field'), unittest_pb2.TestAllTypes.DESCRIPTOR.oneofs_by_name['oneof_field']) self.assertIs( self.pool.FindServiceByName('protobuf_unittest.TestService'), unittest_pb2.DESCRIPTOR.services_by_name['TestService'])
14,170
[ 0.011517205275595188, -0.025168629363179207, 0.059505563229322433, -0.03495572879910469, 0.00854319054633379, -0.02384263649582863, 0.015709873288869858, 0.03710257634520531, 0.016846438869833946, -0.010753180831670761, 0.04139627143740654, -0.02861621417105198, -0.026494624093174934, -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": []}}, "body": [{"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"args": [], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "DescriptorPool", "value": {"_type": "Name", "_fields": {"id": "descriptor_pool", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}, "targets": [{"_type": "Attribute", "_fields": {"ctx": {"_type": "Store", "_fields": {}}, "attr": "pool", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}], "type_comment": null}}, {"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "serialized_pb", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "DESCRIPTOR", "value": {"_type": "Name", "_fields": {"id": "factory_test1_pb2", "ctx": {"_type": "Load", "_fields": {}}}}}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "FromString", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "FileDescriptorProto", "value": {"_type": "Name", "_fields": {"id": "descriptor_pb2", "ctx": {"_type": "Load", "_fields": {}}}}}}}}, "keywords": []}}, "targets": [{"_type": "Attribute", "_fields": {"ctx": {"_type": "Store", "_fields": {}}, "attr": "factory_test1_fd", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}], "type_comment": null}}, {"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "serialized_pb", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "DESCRIPTOR", "value": {"_type": "Name", "_fields": {"id": "factory_test2_pb2", "ctx": {"_type": "Load", "_fields": {}}}}}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "FromString", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "FileDescriptorProto", "value": {"_type": "Name", "_fields": {"id": "descriptor_pb2", "ctx": {"_type": "Load", "_fields": {}}}}}}}}, "keywords": []}}, "targets": [{"_type": "Attribute", "_fields": {"ctx": {"_type": "Store", "_fields": {}}, "attr": "factory_test2_fd", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}], "type_comment": null}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "factory_test1_fd", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "Add", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "pool", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}}}, "keywords": []}}}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "factory_test2_fd", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "Add", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "pool", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}}}, "keywords": []}}}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Call", "_fields": {"args": [{"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "serialized_pb", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "DESCRIPTOR", "value": {"_type": "Name", "_fields": {"id": "unittest_import_public_pb2", "ctx": {"_type": "Load", "_fields": {}}}}}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "FromString", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "FileDescriptorProto", "value": {"_type": "Name", "_fields": {"id": "descriptor_pb2", "ctx": {"_type": "Load", "_fields": {}}}}}}}}, "keywords": []}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "Add", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "pool", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}}}, "keywords": []}}}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Call", "_fields": {"args": [{"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "serialized_pb", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "DESCRIPTOR", "value": {"_type": "Name", "_fields": {"id": "unittest_import_pb2", "ctx": {"_type": "Load", "_fields": {}}}}}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "FromString", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "FileDescriptorProto", "value": {"_type": "Name", "_fields": {"id": "descriptor_pb2", "ctx": {"_type": "Load", "_fields": {}}}}}}}}, "keywords": []}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "Add", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "pool", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}}}, "keywords": []}}}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Call", "_fields": {"args": [{"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "serialized_pb", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "DESCRIPTOR", "value": {"_type": "Name", "_fields": {"id": "unittest_pb2", "ctx": {"_type": "Load", "_fields": {}}}}}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "FromString", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "FileDescriptorProto", "value": {"_type": "Name", "_fields": {"id": "descriptor_pb2", "ctx": {"_type": "Load", "_fields": {}}}}}}}}, "keywords": []}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "Add", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "pool", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}}}, "keywords": []}}}}], "name": "setUp", "returns": null, "type_params": [], "type_comment": null, "decorator_list": []}}], "type_ignores": []}}
def setUp(self): self.pool = descriptor_pool.DescriptorPool() self.factory_test1_fd = descriptor_pb2.FileDescriptorProto.FromString( factory_test1_pb2.DESCRIPTOR.serialized_pb) self.factory_test2_fd = descriptor_pb2.FileDescriptorProto.FromString( factory_test2_pb2.DESCRIPTOR.serialized_pb) self.pool.Add(self.factory_test1_fd) self.pool.Add(self.factory_test2_fd) self.pool.Add(descriptor_pb2.FileDescriptorProto.FromString( unittest_import_public_pb2.DESCRIPTOR.serialized_pb)) self.pool.Add(descriptor_pb2.FileDescriptorProto.FromString( unittest_import_pb2.DESCRIPTOR.serialized_pb)) self.pool.Add(descriptor_pb2.FileDescriptorProto.FromString( unittest_pb2.DESCRIPTOR.serialized_pb))
14,171
[ 0.00456464197486639, -0.03328028693795204, 0.05789857730269432, -0.03305233642458916, 0.014930538833141327, -0.04036944359540939, 0.021085111424326897, 0.04292244836688042, -0.005841145757585764, 0.016275426372885704, 0.00809212401509285, -0.02621392346918583, -0.017415162175893784, -0.056...
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": [], "kw_defaults": [], "posonlyargs": []}}, "body": [{"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"args": [], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "DescriptorPool", "value": {"_type": "Name", "_fields": {"id": "descriptor_pool", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}, "targets": [{"_type": "Attribute", "_fields": {"ctx": {"_type": "Store", "_fields": {}}, "attr": "pool", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}], "type_comment": null}}, {"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "serialized_pb", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "DESCRIPTOR", "value": {"_type": "Name", "_fields": {"id": "factory_test1_pb2", "ctx": {"_type": "Load", "_fields": {}}}}}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "FromString", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "FileDescriptorProto", "value": {"_type": "Name", "_fields": {"id": "descriptor_pb2", "ctx": {"_type": "Load", "_fields": {}}}}}}}}, "keywords": []}}, "targets": [{"_type": "Attribute", "_fields": {"ctx": {"_type": "Store", "_fields": {}}, "attr": "factory_test1_fd", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}], "type_comment": null}}, {"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "serialized_pb", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "DESCRIPTOR", "value": {"_type": "Name", "_fields": {"id": "factory_test2_pb2", "ctx": {"_type": "Load", "_fields": {}}}}}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "FromString", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "FileDescriptorProto", "value": {"_type": "Name", "_fields": {"id": "descriptor_pb2", "ctx": {"_type": "Load", "_fields": {}}}}}}}}, "keywords": []}}, "targets": [{"_type": "Attribute", "_fields": {"ctx": {"_type": "Store", "_fields": {}}, "attr": "factory_test2_fd", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}], "type_comment": null}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "factory_test1_fd", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "Add", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "pool", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}}}, "keywords": []}}}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "factory_test2_fd", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "Add", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "pool", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}}}, "keywords": []}}}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Call", "_fields": {"args": [{"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "serialized_pb", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "DESCRIPTOR", "value": {"_type": "Name", "_fields": {"id": "unittest_import_public_pb2", "ctx": {"_type": "Load", "_fields": {}}}}}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "FromString", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "FileDescriptorProto", "value": {"_type": "Name", "_fields": {"id": "descriptor_pb2", "ctx": {"_type": "Load", "_fields": {}}}}}}}}, "keywords": []}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "Add", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "pool", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}}}, "keywords": []}}}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Call", "_fields": {"args": [{"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "serialized_pb", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "DESCRIPTOR", "value": {"_type": "Name", "_fields": {"id": "unittest_import_pb2", "ctx": {"_type": "Load", "_fields": {}}}}}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "FromString", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "FileDescriptorProto", "value": {"_type": "Name", "_fields": {"id": "descriptor_pb2", "ctx": {"_type": "Load", "_fields": {}}}}}}}}, "keywords": []}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "Add", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "pool", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}}}, "keywords": []}}}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Call", "_fields": {"args": [{"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "serialized_pb", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "DESCRIPTOR", "value": {"_type": "Name", "_fields": {"id": "unittest_pb2", "ctx": {"_type": "Load", "_fields": {}}}}}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "FromString", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "FileDescriptorProto", "value": {"_type": "Name", "_fields": {"id": "descriptor_pb2", "ctx": {"_type": "Load", "_fields": {}}}}}}}}, "keywords": []}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "Add", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "pool", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}}}, "keywords": []}}}}], "name": "setUp", "returns": null, "type_params": [], "type_comment": null, "decorator_list": []}}], "name": "CreateDescriptorPoolTest", "bases": [{"_type": "Name", "_fields": {"id": "DescriptorPoolTestBase", "ctx": {"_type": "Load", "_fields": {}}}}, {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "TestCase", "value": {"_type": "Name", "_fields": {"id": "unittest", "ctx": {"_type": "Load", "_fields": {}}}}}}], "keywords": [], "type_params": [], "decorator_list": []}}], "type_ignores": []}}
class CreateDescriptorPoolTest(DescriptorPoolTestBase, unittest.TestCase): def setUp(self): self.pool = descriptor_pool.DescriptorPool() self.factory_test1_fd = descriptor_pb2.FileDescriptorProto.FromString( factory_test1_pb2.DESCRIPTOR.serialized_pb) self.factory_test2_fd = descriptor_pb2.FileDescriptorProto.FromString( factory_test2_pb2.DESCRIPTOR.serialized_pb) self.pool.Add(self.factory_test1_fd) self.pool.Add(self.factory_test2_fd) self.pool.Add(descriptor_pb2.FileDescriptorProto.FromString( unittest_import_public_pb2.DESCRIPTOR.serialized_pb)) self.pool.Add(descriptor_pb2.FileDescriptorProto.FromString( unittest_import_pb2.DESCRIPTOR.serialized_pb)) self.pool.Add(descriptor_pb2.FileDescriptorProto.FromString( unittest_pb2.DESCRIPTOR.serialized_pb))
14,172
[ 0.005226972047239542, -0.019945256412029266, 0.08264543861150742, -0.027658047154545784, 0.026930203661322594, -0.01919393427670002, 0.04275492578744888, 0.03484256565570831, 0.01093525905162096, -0.005520456936210394, -0.0012407087488099933, -0.02955983206629753, 0.02014482580125332, -0.0...
10
{"_type": "Module", "_fields": {"body": [{"_type": "ClassDef", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}}, "body": [{"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "serialized_pb", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "DESCRIPTOR", "value": {"_type": "Name", "_fields": {"id": "factory_test1_pb2", "ctx": {"_type": "Load", "_fields": {}}}}}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "FromString", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "FileDescriptorProto", "value": {"_type": "Name", "_fields": {"id": "descriptor_pb2", "ctx": {"_type": "Load", "_fields": {}}}}}}}}, "keywords": []}}, "targets": [{"_type": "Attribute", "_fields": {"ctx": {"_type": "Store", "_fields": {}}, "attr": "factory_test1_fd", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}], "type_comment": null}}, {"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "serialized_pb", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "DESCRIPTOR", "value": {"_type": "Name", "_fields": {"id": "factory_test2_pb2", "ctx": {"_type": "Load", "_fields": {}}}}}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "FromString", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "FileDescriptorProto", "value": {"_type": "Name", "_fields": {"id": "descriptor_pb2", "ctx": {"_type": "Load", "_fields": {}}}}}}}}, "keywords": []}}, "targets": [{"_type": "Attribute", "_fields": {"ctx": {"_type": "Store", "_fields": {}}, "attr": "factory_test2_fd", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}], "type_comment": null}}, {"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"args": [], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "DescriptorDatabase", "value": {"_type": "Name", "_fields": {"id": "descriptor_database", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}, "targets": [{"_type": "Name", "_fields": {"id": "db", "ctx": {"_type": "Store", "_fields": {}}}}], "type_comment": null}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "factory_test1_fd", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "Add", "value": {"_type": "Name", "_fields": {"id": "db", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "factory_test2_fd", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "Add", "value": {"_type": "Name", "_fields": {"id": "db", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Call", "_fields": {"args": [{"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "serialized_pb", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "DESCRIPTOR", "value": {"_type": "Name", "_fields": {"id": "unittest_import_public_pb2", "ctx": {"_type": "Load", "_fields": {}}}}}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "FromString", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "FileDescriptorProto", "value": {"_type": "Name", "_fields": {"id": "descriptor_pb2", "ctx": {"_type": "Load", "_fields": {}}}}}}}}, "keywords": []}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "Add", "value": {"_type": "Name", "_fields": {"id": "db", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Call", "_fields": {"args": [{"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "serialized_pb", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "DESCRIPTOR", "value": {"_type": "Name", "_fields": {"id": "unittest_import_pb2", "ctx": {"_type": "Load", "_fields": {}}}}}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "FromString", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "FileDescriptorProto", "value": {"_type": "Name", "_fields": {"id": "descriptor_pb2", "ctx": {"_type": "Load", "_fields": {}}}}}}}}, "keywords": []}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "Add", "value": {"_type": "Name", "_fields": {"id": "db", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Call", "_fields": {"args": [{"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "serialized_pb", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "DESCRIPTOR", "value": {"_type": "Name", "_fields": {"id": "unittest_pb2", "ctx": {"_type": "Load", "_fields": {}}}}}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "FromString", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "FileDescriptorProto", "value": {"_type": "Name", "_fields": {"id": "descriptor_pb2", "ctx": {"_type": "Load", "_fields": {}}}}}}}}, "keywords": []}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "Add", "value": {"_type": "Name", "_fields": {"id": "db", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"args": [], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "DescriptorPool", "value": {"_type": "Name", "_fields": {"id": "descriptor_pool", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": [{"_type": "keyword", "_fields": {"arg": "descriptor_db", "value": {"_type": "Name", "_fields": {"id": "db", "ctx": {"_type": "Load", "_fields": {}}}}}}]}}, "targets": [{"_type": "Attribute", "_fields": {"ctx": {"_type": "Store", "_fields": {}}, "attr": "pool", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}], "type_comment": null}}], "name": "setUp", "returns": null, "type_params": [], "type_comment": null, "decorator_list": []}}], "name": "SecondaryDescriptorFromDescriptorDB", "bases": [{"_type": "Name", "_fields": {"id": "DescriptorPoolTestBase", "ctx": {"_type": "Load", "_fields": {}}}}, {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "TestCase", "value": {"_type": "Name", "_fields": {"id": "unittest", "ctx": {"_type": "Load", "_fields": {}}}}}}], "keywords": [], "type_params": [], "decorator_list": []}}], "type_ignores": []}}
class SecondaryDescriptorFromDescriptorDB(DescriptorPoolTestBase, unittest.TestCase): def setUp(self): self.factory_test1_fd = descriptor_pb2.FileDescriptorProto.FromString( factory_test1_pb2.DESCRIPTOR.serialized_pb) self.factory_test2_fd = descriptor_pb2.FileDescriptorProto.FromString( factory_test2_pb2.DESCRIPTOR.serialized_pb) db = descriptor_database.DescriptorDatabase() db.Add(self.factory_test1_fd) db.Add(self.factory_test2_fd) db.Add(descriptor_pb2.FileDescriptorProto.FromString( unittest_import_public_pb2.DESCRIPTOR.serialized_pb)) db.Add(descriptor_pb2.FileDescriptorProto.FromString( unittest_import_pb2.DESCRIPTOR.serialized_pb)) db.Add(descriptor_pb2.FileDescriptorProto.FromString( unittest_pb2.DESCRIPTOR.serialized_pb)) self.pool = descriptor_pool.DescriptorPool(descriptor_db=db)
14,173
[ 0.0034923909697681665, -0.02877386473119259, 0.06987237185239792, -0.03731764107942581, -0.0022249415051192045, -0.019935477524995804, 0.020242365077137947, 0.02512802928686142, 0.023961853235960007, -0.023667240515351295, 0.047015316784381866, -0.028675660490989685, 0.0016679390100762248, ...
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": []}}, "body": [{"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "serialized_pb", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "DESCRIPTOR", "value": {"_type": "Name", "_fields": {"id": "factory_test1_pb2", "ctx": {"_type": "Load", "_fields": {}}}}}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "FromString", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "FileDescriptorProto", "value": {"_type": "Name", "_fields": {"id": "descriptor_pb2", "ctx": {"_type": "Load", "_fields": {}}}}}}}}, "keywords": []}}, "targets": [{"_type": "Attribute", "_fields": {"ctx": {"_type": "Store", "_fields": {}}, "attr": "factory_test1_fd", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}], "type_comment": null}}, {"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "serialized_pb", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "DESCRIPTOR", "value": {"_type": "Name", "_fields": {"id": "factory_test2_pb2", "ctx": {"_type": "Load", "_fields": {}}}}}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "FromString", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "FileDescriptorProto", "value": {"_type": "Name", "_fields": {"id": "descriptor_pb2", "ctx": {"_type": "Load", "_fields": {}}}}}}}}, "keywords": []}}, "targets": [{"_type": "Attribute", "_fields": {"ctx": {"_type": "Store", "_fields": {}}, "attr": "factory_test2_fd", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}], "type_comment": null}}, {"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"args": [], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "DescriptorDatabase", "value": {"_type": "Name", "_fields": {"id": "descriptor_database", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}, "targets": [{"_type": "Name", "_fields": {"id": "db", "ctx": {"_type": "Store", "_fields": {}}}}], "type_comment": null}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "factory_test1_fd", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "Add", "value": {"_type": "Name", "_fields": {"id": "db", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "factory_test2_fd", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "Add", "value": {"_type": "Name", "_fields": {"id": "db", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Call", "_fields": {"args": [{"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "serialized_pb", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "DESCRIPTOR", "value": {"_type": "Name", "_fields": {"id": "unittest_import_public_pb2", "ctx": {"_type": "Load", "_fields": {}}}}}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "FromString", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "FileDescriptorProto", "value": {"_type": "Name", "_fields": {"id": "descriptor_pb2", "ctx": {"_type": "Load", "_fields": {}}}}}}}}, "keywords": []}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "Add", "value": {"_type": "Name", "_fields": {"id": "db", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Call", "_fields": {"args": [{"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "serialized_pb", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "DESCRIPTOR", "value": {"_type": "Name", "_fields": {"id": "unittest_import_pb2", "ctx": {"_type": "Load", "_fields": {}}}}}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "FromString", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "FileDescriptorProto", "value": {"_type": "Name", "_fields": {"id": "descriptor_pb2", "ctx": {"_type": "Load", "_fields": {}}}}}}}}, "keywords": []}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "Add", "value": {"_type": "Name", "_fields": {"id": "db", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Call", "_fields": {"args": [{"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "serialized_pb", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "DESCRIPTOR", "value": {"_type": "Name", "_fields": {"id": "unittest_pb2", "ctx": {"_type": "Load", "_fields": {}}}}}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "FromString", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "FileDescriptorProto", "value": {"_type": "Name", "_fields": {"id": "descriptor_pb2", "ctx": {"_type": "Load", "_fields": {}}}}}}}}, "keywords": []}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "Add", "value": {"_type": "Name", "_fields": {"id": "db", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"args": [], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "DescriptorPool", "value": {"_type": "Name", "_fields": {"id": "descriptor_pool", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": [{"_type": "keyword", "_fields": {"arg": "descriptor_db", "value": {"_type": "Name", "_fields": {"id": "db", "ctx": {"_type": "Load", "_fields": {}}}}}}]}}, "targets": [{"_type": "Attribute", "_fields": {"ctx": {"_type": "Store", "_fields": {}}, "attr": "pool", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}], "type_comment": null}}], "name": "setUp", "returns": null, "type_params": [], "type_comment": null, "decorator_list": []}}], "type_ignores": []}}
def setUp(self): self.factory_test1_fd = descriptor_pb2.FileDescriptorProto.FromString( factory_test1_pb2.DESCRIPTOR.serialized_pb) self.factory_test2_fd = descriptor_pb2.FileDescriptorProto.FromString( factory_test2_pb2.DESCRIPTOR.serialized_pb) db = descriptor_database.DescriptorDatabase() db.Add(self.factory_test1_fd) db.Add(self.factory_test2_fd) db.Add(descriptor_pb2.FileDescriptorProto.FromString( unittest_import_public_pb2.DESCRIPTOR.serialized_pb)) db.Add(descriptor_pb2.FileDescriptorProto.FromString( unittest_import_pb2.DESCRIPTOR.serialized_pb)) db.Add(descriptor_pb2.FileDescriptorProto.FromString( unittest_pb2.DESCRIPTOR.serialized_pb)) self.pool = descriptor_pool.DescriptorPool(descriptor_db=db)
14,174
[ -0.015575517900288105, 0.0058626336976885796, 0.05034775286912918, -0.0320018008351326, 0.007133325561881065, -0.04659566655755043, -0.031521882861852646, 0.02497754618525505, -0.0009018912096507847, 0.043345313519239426, 0.0062280260026454926, -0.01949121244251728, 0.03411780297756195, -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}}, {"_type": "arg", "_fields": {"arg": "name", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "package", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "messages", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "dependencies", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "public_dependencies", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [{"_type": "Constant", "_fields": {"kind": null, "value": null}}, {"_type": "Constant", "_fields": {"kind": null, "value": null}}], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}}, "body": [{"_type": "Assign", "_fields": {"value": {"_type": "Name", "_fields": {"id": "name", "ctx": {"_type": "Load", "_fields": {}}}}, "targets": [{"_type": "Attribute", "_fields": {"ctx": {"_type": "Store", "_fields": {}}, "attr": "name", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}], "type_comment": null}}, {"_type": "Assign", "_fields": {"value": {"_type": "Name", "_fields": {"id": "package", "ctx": {"_type": "Load", "_fields": {}}}}, "targets": [{"_type": "Attribute", "_fields": {"ctx": {"_type": "Store", "_fields": {}}, "attr": "package", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}], "type_comment": null}}, {"_type": "Assign", "_fields": {"value": {"_type": "Name", "_fields": {"id": "messages", "ctx": {"_type": "Load", "_fields": {}}}}, "targets": [{"_type": "Attribute", "_fields": {"ctx": {"_type": "Store", "_fields": {}}, "attr": "messages", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}], "type_comment": null}}, {"_type": "Assign", "_fields": {"value": {"_type": "BoolOp", "_fields": {"op": {"_type": "Or", "_fields": {}}, "values": [{"_type": "Name", "_fields": {"id": "dependencies", "ctx": {"_type": "Load", "_fields": {}}}}, {"_type": "List", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "elts": []}}]}}, "targets": [{"_type": "Attribute", "_fields": {"ctx": {"_type": "Store", "_fields": {}}, "attr": "dependencies", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}], "type_comment": null}}, {"_type": "Assign", "_fields": {"value": {"_type": "BoolOp", "_fields": {"op": {"_type": "Or", "_fields": {}}, "values": [{"_type": "Name", "_fields": {"id": "public_dependencies", "ctx": {"_type": "Load", "_fields": {}}}}, {"_type": "List", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "elts": []}}]}}, "targets": [{"_type": "Attribute", "_fields": {"ctx": {"_type": "Store", "_fields": {}}, "attr": "public_dependencies", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}], "type_comment": null}}], "name": "__init__", "returns": null, "type_params": [], "type_comment": null, "decorator_list": []}}, {"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "test", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "pool", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}}, "body": [{"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "name", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "FindFileByName", "value": {"_type": "Name", "_fields": {"id": "pool", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}, "targets": [{"_type": "Name", "_fields": {"id": "file_desc", "ctx": {"_type": "Store", "_fields": {}}}}], "type_comment": null}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "name", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}, {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "name", "value": {"_type": "Name", "_fields": {"id": "file_desc", "ctx": {"_type": "Load", "_fields": {}}}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "assertEqual", "value": {"_type": "Name", "_fields": {"id": "test", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "package", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}, {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "package", "value": {"_type": "Name", "_fields": {"id": "file_desc", "ctx": {"_type": "Load", "_fields": {}}}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "assertEqual", "value": {"_type": "Name", "_fields": {"id": "test", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Assign", "_fields": {"value": {"_type": "ListComp", "_fields": {"elt": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "name", "value": {"_type": "Name", "_fields": {"id": "f", "ctx": {"_type": "Load", "_fields": {}}}}}}, "generators": [{"_type": "comprehension", "_fields": {"ifs": [], "iter": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "dependencies", "value": {"_type": "Name", "_fields": {"id": "file_desc", "ctx": {"_type": "Load", "_fields": {}}}}}}, "target": {"_type": "Name", "_fields": {"id": "f", "ctx": {"_type": "Store", "_fields": {}}}}, "is_async": 0}}]}}, "targets": [{"_type": "Name", "_fields": {"id": "dependencies_names", "ctx": {"_type": "Store", "_fields": {}}}}], "type_comment": null}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "dependencies", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}, {"_type": "Name", "_fields": {"id": "dependencies_names", "ctx": {"_type": "Load", "_fields": {}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "assertEqual", "value": {"_type": "Name", "_fields": {"id": "test", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Assign", "_fields": {"value": {"_type": "ListComp", "_fields": {"elt": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "name", "value": {"_type": "Name", "_fields": {"id": "f", "ctx": {"_type": "Load", "_fields": {}}}}}}, "generators": [{"_type": "comprehension", "_fields": {"ifs": [], "iter": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "public_dependencies", "value": {"_type": "Name", "_fields": {"id": "file_desc", "ctx": {"_type": "Load", "_fields": {}}}}}}, "target": {"_type": "Name", "_fields": {"id": "f", "ctx": {"_type": "Store", "_fields": {}}}}, "is_async": 0}}]}}, "targets": [{"_type": "Name", "_fields": {"id": "public_dependencies_names", "ctx": {"_type": "Store", "_fields": {}}}}], "type_comment": null}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "public_dependencies", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}, {"_type": "Name", "_fields": {"id": "public_dependencies_names", "ctx": {"_type": "Load", "_fields": {}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "assertEqual", "value": {"_type": "Name", "_fields": {"id": "test", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "For", "_fields": {"body": [{"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Name", "_fields": {"id": "test", "ctx": {"_type": "Load", "_fields": {}}}}, {"_type": "Constant", "_fields": {"kind": null, "value": null}}, {"_type": "Name", "_fields": {"id": "name", "ctx": {"_type": "Load", "_fields": {}}}}, {"_type": "Name", "_fields": {"id": "file_desc", "ctx": {"_type": "Load", "_fields": {}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "CheckType", "value": {"_type": "Name", "_fields": {"id": "msg_type", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}], "iter": {"_type": "Call", "_fields": {"args": [], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "items", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "messages", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}}}, "keywords": []}}, "orelse": [], "target": {"_type": "Tuple", "_fields": {"ctx": {"_type": "Store", "_fields": {}}, "elts": [{"_type": "Name", "_fields": {"id": "name", "ctx": {"_type": "Store", "_fields": {}}}}, {"_type": "Name", "_fields": {"id": "msg_type", "ctx": {"_type": "Store", "_fields": {}}}}]}}, "type_comment": null}}], "name": "CheckFile", "returns": null, "type_params": [], "type_comment": null, "decorator_list": []}}], "name": "ProtoFile", "bases": [{"_type": "Name", "_fields": {"id": "object", "ctx": {"_type": "Load", "_fields": {}}}}], "keywords": [], "type_params": [], "decorator_list": []}}], "type_ignores": []}}
class ProtoFile(object): def __init__(self, name, package, messages, dependencies=None, public_dependencies=None): self.name = name self.package = package self.messages = messages self.dependencies = dependencies or [] self.public_dependencies = public_dependencies or [] def CheckFile(self, test, pool): file_desc = pool.FindFileByName(self.name) test.assertEqual(self.name, file_desc.name) test.assertEqual(self.package, file_desc.package) dependencies_names = [f.name for f in file_desc.dependencies] test.assertEqual(self.dependencies, dependencies_names) public_dependencies_names = [f.name for f in file_desc.public_dependencies] test.assertEqual(self.public_dependencies, public_dependencies_names) for name, msg_type in self.messages.items(): msg_type.CheckType(test, None, name, file_desc)
14,175
[ -0.004154895432293415, 0.02718537487089634, 0.04557348042726517, -0.021040890365839005, 0.020213311538100243, -0.0404946431517601, -0.027253394946455956, 0.012062234804034233, 0.00523754907771945, 0.05849730223417282, 0.025054076686501503, -0.004517669789493084, 0.0254621971398592, 0.00727...
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": "test", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "pool", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}}, "body": [{"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "name", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "FindFileByName", "value": {"_type": "Name", "_fields": {"id": "pool", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}, "targets": [{"_type": "Name", "_fields": {"id": "file_desc", "ctx": {"_type": "Store", "_fields": {}}}}], "type_comment": null}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "name", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}, {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "name", "value": {"_type": "Name", "_fields": {"id": "file_desc", "ctx": {"_type": "Load", "_fields": {}}}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "assertEqual", "value": {"_type": "Name", "_fields": {"id": "test", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "package", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}, {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "package", "value": {"_type": "Name", "_fields": {"id": "file_desc", "ctx": {"_type": "Load", "_fields": {}}}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "assertEqual", "value": {"_type": "Name", "_fields": {"id": "test", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Assign", "_fields": {"value": {"_type": "ListComp", "_fields": {"elt": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "name", "value": {"_type": "Name", "_fields": {"id": "f", "ctx": {"_type": "Load", "_fields": {}}}}}}, "generators": [{"_type": "comprehension", "_fields": {"ifs": [], "iter": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "dependencies", "value": {"_type": "Name", "_fields": {"id": "file_desc", "ctx": {"_type": "Load", "_fields": {}}}}}}, "target": {"_type": "Name", "_fields": {"id": "f", "ctx": {"_type": "Store", "_fields": {}}}}, "is_async": 0}}]}}, "targets": [{"_type": "Name", "_fields": {"id": "dependencies_names", "ctx": {"_type": "Store", "_fields": {}}}}], "type_comment": null}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "dependencies", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}, {"_type": "Name", "_fields": {"id": "dependencies_names", "ctx": {"_type": "Load", "_fields": {}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "assertEqual", "value": {"_type": "Name", "_fields": {"id": "test", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Assign", "_fields": {"value": {"_type": "ListComp", "_fields": {"elt": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "name", "value": {"_type": "Name", "_fields": {"id": "f", "ctx": {"_type": "Load", "_fields": {}}}}}}, "generators": [{"_type": "comprehension", "_fields": {"ifs": [], "iter": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "public_dependencies", "value": {"_type": "Name", "_fields": {"id": "file_desc", "ctx": {"_type": "Load", "_fields": {}}}}}}, "target": {"_type": "Name", "_fields": {"id": "f", "ctx": {"_type": "Store", "_fields": {}}}}, "is_async": 0}}]}}, "targets": [{"_type": "Name", "_fields": {"id": "public_dependencies_names", "ctx": {"_type": "Store", "_fields": {}}}}], "type_comment": null}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "public_dependencies", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}, {"_type": "Name", "_fields": {"id": "public_dependencies_names", "ctx": {"_type": "Load", "_fields": {}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "assertEqual", "value": {"_type": "Name", "_fields": {"id": "test", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "For", "_fields": {"body": [{"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Name", "_fields": {"id": "test", "ctx": {"_type": "Load", "_fields": {}}}}, {"_type": "Constant", "_fields": {"kind": null, "value": null}}, {"_type": "Name", "_fields": {"id": "name", "ctx": {"_type": "Load", "_fields": {}}}}, {"_type": "Name", "_fields": {"id": "file_desc", "ctx": {"_type": "Load", "_fields": {}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "CheckType", "value": {"_type": "Name", "_fields": {"id": "msg_type", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}], "iter": {"_type": "Call", "_fields": {"args": [], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "items", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "messages", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}}}, "keywords": []}}, "orelse": [], "target": {"_type": "Tuple", "_fields": {"ctx": {"_type": "Store", "_fields": {}}, "elts": [{"_type": "Name", "_fields": {"id": "name", "ctx": {"_type": "Store", "_fields": {}}}}, {"_type": "Name", "_fields": {"id": "msg_type", "ctx": {"_type": "Store", "_fields": {}}}}]}}, "type_comment": null}}], "name": "CheckFile", "returns": null, "type_params": [], "type_comment": null, "decorator_list": []}}], "type_ignores": []}}
def CheckFile(self, test, pool): file_desc = pool.FindFileByName(self.name) test.assertEqual(self.name, file_desc.name) test.assertEqual(self.package, file_desc.package) dependencies_names = [f.name for f in file_desc.dependencies] test.assertEqual(self.dependencies, dependencies_names) public_dependencies_names = [f.name for f in file_desc.public_dependencies] test.assertEqual(self.public_dependencies, public_dependencies_names) for name, msg_type in self.messages.items(): msg_type.CheckType(test, None, name, file_desc)
14,176
[ 0.01351925265043974, 0.054482925683259964, 0.0011028789449483156, -0.031210416927933693, -0.015142915770411491, 0.00929659977555275, 0.02949655055999756, -0.007819517515599728, -0.006263507064431906, 0.04880010336637497, 0.03283407911658287, 0.0019266908057034016, 0.04884520545601845, 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}}, {"_type": "arg", "_fields": {"arg": "test", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "containing_type_desc", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "name", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "file_desc", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}}, "body": [{"_type": "If", "_fields": {"body": [{"_type": "Assign", "_fields": {"value": {"_type": "Subscript", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "slice": {"_type": "Name", "_fields": {"id": "name", "ctx": {"_type": "Load", "_fields": {}}}}, "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "message_types_by_name", "value": {"_type": "Name", "_fields": {"id": "file_desc", "ctx": {"_type": "Load", "_fields": {}}}}}}}}, "targets": [{"_type": "Name", "_fields": {"id": "desc", "ctx": {"_type": "Store", "_fields": {}}}}], "type_comment": null}}, {"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "List", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "elts": [{"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "package", "value": {"_type": "Name", "_fields": {"id": "file_desc", "ctx": {"_type": "Load", "_fields": {}}}}}}, {"_type": "Name", "_fields": {"id": "name", "ctx": {"_type": "Load", "_fields": {}}}}]}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "join", "value": {"_type": "Constant", "_fields": {"kind": null, "value": "."}}}}, "keywords": []}}, "targets": [{"_type": "Name", "_fields": {"id": "expected_full_name", "ctx": {"_type": "Store", "_fields": {}}}}], "type_comment": null}}], "test": {"_type": "Compare", "_fields": {"ops": [{"_type": "Is", "_fields": {}}], "left": {"_type": "Name", "_fields": {"id": "containing_type_desc", "ctx": {"_type": "Load", "_fields": {}}}}, "comparators": [{"_type": "Constant", "_fields": {"kind": null, "value": null}}]}}, "orelse": [{"_type": "Assign", "_fields": {"value": {"_type": "Subscript", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "slice": {"_type": "Name", "_fields": {"id": "name", "ctx": {"_type": "Load", "_fields": {}}}}, "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "nested_types_by_name", "value": {"_type": "Name", "_fields": {"id": "containing_type_desc", "ctx": {"_type": "Load", "_fields": {}}}}}}}}, "targets": [{"_type": "Name", "_fields": {"id": "desc", "ctx": {"_type": "Store", "_fields": {}}}}], "type_comment": null}}, {"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "List", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "elts": [{"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "full_name", "value": {"_type": "Name", "_fields": {"id": "containing_type_desc", "ctx": {"_type": "Load", "_fields": {}}}}}}, {"_type": "Name", "_fields": {"id": "name", "ctx": {"_type": "Load", "_fields": {}}}}]}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "join", "value": {"_type": "Constant", "_fields": {"kind": null, "value": "."}}}}, "keywords": []}}, "targets": [{"_type": "Name", "_fields": {"id": "expected_full_name", "ctx": {"_type": "Store", "_fields": {}}}}], "type_comment": null}}]}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Name", "_fields": {"id": "name", "ctx": {"_type": "Load", "_fields": {}}}}, {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "name", "value": {"_type": "Name", "_fields": {"id": "desc", "ctx": {"_type": "Load", "_fields": {}}}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "assertEqual", "value": {"_type": "Name", "_fields": {"id": "test", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Name", "_fields": {"id": "expected_full_name", "ctx": {"_type": "Load", "_fields": {}}}}, {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "full_name", "value": {"_type": "Name", "_fields": {"id": "desc", "ctx": {"_type": "Load", "_fields": {}}}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "assertEqual", "value": {"_type": "Name", "_fields": {"id": "test", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Name", "_fields": {"id": "containing_type_desc", "ctx": {"_type": "Load", "_fields": {}}}}, {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "containing_type", "value": {"_type": "Name", "_fields": {"id": "desc", "ctx": {"_type": "Load", "_fields": {}}}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "assertEqual", "value": {"_type": "Name", "_fields": {"id": "test", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "file", "value": {"_type": "Name", "_fields": {"id": "desc", "ctx": {"_type": "Load", "_fields": {}}}}}}, {"_type": "Name", "_fields": {"id": "file_desc", "ctx": {"_type": "Load", "_fields": {}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "assertEqual", "value": {"_type": "Name", "_fields": {"id": "test", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "is_extendable", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}, {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "is_extendable", "value": {"_type": "Name", "_fields": {"id": "desc", "ctx": {"_type": "Load", "_fields": {}}}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "assertEqual", "value": {"_type": "Name", "_fields": {"id": "test", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "For", "_fields": {"body": [{"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Name", "_fields": {"id": "test", "ctx": {"_type": "Load", "_fields": {}}}}, {"_type": "Name", "_fields": {"id": "desc", "ctx": {"_type": "Load", "_fields": {}}}}, {"_type": "Name", "_fields": {"id": "name", "ctx": {"_type": "Load", "_fields": {}}}}, {"_type": "Name", "_fields": {"id": "file_desc", "ctx": {"_type": "Load", "_fields": {}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "CheckType", "value": {"_type": "Name", "_fields": {"id": "subtype", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}], "iter": {"_type": "Call", "_fields": {"args": [], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "items", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "type_dict", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}}}, "keywords": []}}, "orelse": [], "target": {"_type": "Tuple", "_fields": {"ctx": {"_type": "Store", "_fields": {}}, "elts": [{"_type": "Name", "_fields": {"id": "name", "ctx": {"_type": "Store", "_fields": {}}}}, {"_type": "Name", "_fields": {"id": "subtype", "ctx": {"_type": "Store", "_fields": {}}}}]}}, "type_comment": null}}, {"_type": "For", "_fields": {"body": [{"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Name", "_fields": {"id": "test", "ctx": {"_type": "Load", "_fields": {}}}}, {"_type": "Name", "_fields": {"id": "desc", "ctx": {"_type": "Load", "_fields": {}}}}, {"_type": "Name", "_fields": {"id": "name", "ctx": {"_type": "Load", "_fields": {}}}}, {"_type": "Name", "_fields": {"id": "index", "ctx": {"_type": "Load", "_fields": {}}}}, {"_type": "Name", "_fields": {"id": "file_desc", "ctx": {"_type": "Load", "_fields": {}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "CheckField", "value": {"_type": "Name", "_fields": {"id": "field", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}], "iter": {"_type": "Call", "_fields": {"args": [{"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "field_list", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}], "func": {"_type": "Name", "_fields": {"id": "enumerate", "ctx": {"_type": "Load", "_fields": {}}}}, "keywords": []}}, "orelse": [], "target": {"_type": "Tuple", "_fields": {"ctx": {"_type": "Store", "_fields": {}}, "elts": [{"_type": "Name", "_fields": {"id": "index", "ctx": {"_type": "Store", "_fields": {}}}}, {"_type": "Tuple", "_fields": {"ctx": {"_type": "Store", "_fields": {}}, "elts": [{"_type": "Name", "_fields": {"id": "name", "ctx": {"_type": "Store", "_fields": {}}}}, {"_type": "Name", "_fields": {"id": "field", "ctx": {"_type": "Store", "_fields": {}}}}]}}]}}, "type_comment": null}}, {"_type": "For", "_fields": {"body": [{"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Name", "_fields": {"id": "test", "ctx": {"_type": "Load", "_fields": {}}}}, {"_type": "Name", "_fields": {"id": "desc", "ctx": {"_type": "Load", "_fields": {}}}}, {"_type": "Name", "_fields": {"id": "name", "ctx": {"_type": "Load", "_fields": {}}}}, {"_type": "Name", "_fields": {"id": "index", "ctx": {"_type": "Load", "_fields": {}}}}, {"_type": "Name", "_fields": {"id": "file_desc", "ctx": {"_type": "Load", "_fields": {}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "CheckField", "value": {"_type": "Name", "_fields": {"id": "field", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}], "iter": {"_type": "Call", "_fields": {"args": [{"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "extensions", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}], "func": {"_type": "Name", "_fields": {"id": "enumerate", "ctx": {"_type": "Load", "_fields": {}}}}, "keywords": []}}, "orelse": [], "target": {"_type": "Tuple", "_fields": {"ctx": {"_type": "Store", "_fields": {}}, "elts": [{"_type": "Name", "_fields": {"id": "index", "ctx": {"_type": "Store", "_fields": {}}}}, {"_type": "Tuple", "_fields": {"ctx": {"_type": "Store", "_fields": {}}, "elts": [{"_type": "Name", "_fields": {"id": "name", "ctx": {"_type": "Store", "_fields": {}}}}, {"_type": "Name", "_fields": {"id": "field", "ctx": {"_type": "Store", "_fields": {}}}}]}}]}}, "type_comment": null}}], "name": "CheckType", "returns": null, "type_params": [], "type_comment": null, "decorator_list": []}}], "type_ignores": []}}
def CheckType(self, test, containing_type_desc, name, file_desc): if containing_type_desc is None: desc = file_desc.message_types_by_name[name] expected_full_name = '.'.join([file_desc.package, name]) else: desc = containing_type_desc.nested_types_by_name[name] expected_full_name = '.'.join([containing_type_desc.full_name, name]) test.assertEqual(name, desc.name) test.assertEqual(expected_full_name, desc.full_name) test.assertEqual(containing_type_desc, desc.containing_type) test.assertEqual(desc.file, file_desc) test.assertEqual(self.is_extendable, desc.is_extendable) for name, subtype in self.type_dict.items(): subtype.CheckType(test, desc, name, file_desc) for index, (name, field) in enumerate(self.field_list): field.CheckField(test, desc, name, index, file_desc) for index, (name, field) in enumerate(self.extensions): field.CheckField(test, desc, name, index, file_desc)
14,177
[ -0.002538656583055854, 0.025717929005622864, 0.008679533377289772, -0.028368819504976273, -0.026273760944604874, 0.011405249126255512, 0.03255894035100937, -0.00200019427575171, -0.027342667803168297, 0.0366421677172184, 0.035380858927965164, -0.01587328501045704, 0.037176623940467834, 0.0...
10
{"_type": "Module", "_fields": {"body": [{"_type": "ClassDef", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "type_dict", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "field_list", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "is_extendable", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "extensions", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [{"_type": "Constant", "_fields": {"kind": null, "value": false}}, {"_type": "Constant", "_fields": {"kind": null, "value": null}}], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}}, "body": [{"_type": "Assign", "_fields": {"value": {"_type": "Name", "_fields": {"id": "type_dict", "ctx": {"_type": "Load", "_fields": {}}}}, "targets": [{"_type": "Attribute", "_fields": {"ctx": {"_type": "Store", "_fields": {}}, "attr": "type_dict", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}], "type_comment": null}}, {"_type": "Assign", "_fields": {"value": {"_type": "Name", "_fields": {"id": "field_list", "ctx": {"_type": "Load", "_fields": {}}}}, "targets": [{"_type": "Attribute", "_fields": {"ctx": {"_type": "Store", "_fields": {}}, "attr": "field_list", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}], "type_comment": null}}, {"_type": "Assign", "_fields": {"value": {"_type": "Name", "_fields": {"id": "is_extendable", "ctx": {"_type": "Load", "_fields": {}}}}, "targets": [{"_type": "Attribute", "_fields": {"ctx": {"_type": "Store", "_fields": {}}, "attr": "is_extendable", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}], "type_comment": null}}, {"_type": "Assign", "_fields": {"value": {"_type": "BoolOp", "_fields": {"op": {"_type": "Or", "_fields": {}}, "values": [{"_type": "Name", "_fields": {"id": "extensions", "ctx": {"_type": "Load", "_fields": {}}}}, {"_type": "List", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "elts": []}}]}}, "targets": [{"_type": "Attribute", "_fields": {"ctx": {"_type": "Store", "_fields": {}}, "attr": "extensions", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}], "type_comment": null}}], "name": "__init__", "returns": null, "type_params": [], "type_comment": null, "decorator_list": []}}, {"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "test", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "containing_type_desc", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "name", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "file_desc", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}}, "body": [{"_type": "If", "_fields": {"body": [{"_type": "Assign", "_fields": {"value": {"_type": "Subscript", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "slice": {"_type": "Name", "_fields": {"id": "name", "ctx": {"_type": "Load", "_fields": {}}}}, "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "message_types_by_name", "value": {"_type": "Name", "_fields": {"id": "file_desc", "ctx": {"_type": "Load", "_fields": {}}}}}}}}, "targets": [{"_type": "Name", "_fields": {"id": "desc", "ctx": {"_type": "Store", "_fields": {}}}}], "type_comment": null}}, {"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "List", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "elts": [{"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "package", "value": {"_type": "Name", "_fields": {"id": "file_desc", "ctx": {"_type": "Load", "_fields": {}}}}}}, {"_type": "Name", "_fields": {"id": "name", "ctx": {"_type": "Load", "_fields": {}}}}]}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "join", "value": {"_type": "Constant", "_fields": {"kind": null, "value": "."}}}}, "keywords": []}}, "targets": [{"_type": "Name", "_fields": {"id": "expected_full_name", "ctx": {"_type": "Store", "_fields": {}}}}], "type_comment": null}}], "test": {"_type": "Compare", "_fields": {"ops": [{"_type": "Is", "_fields": {}}], "left": {"_type": "Name", "_fields": {"id": "containing_type_desc", "ctx": {"_type": "Load", "_fields": {}}}}, "comparators": [{"_type": "Constant", "_fields": {"kind": null, "value": null}}]}}, "orelse": [{"_type": "Assign", "_fields": {"value": {"_type": "Subscript", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "slice": {"_type": "Name", "_fields": {"id": "name", "ctx": {"_type": "Load", "_fields": {}}}}, "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "nested_types_by_name", "value": {"_type": "Name", "_fields": {"id": "containing_type_desc", "ctx": {"_type": "Load", "_fields": {}}}}}}}}, "targets": [{"_type": "Name", "_fields": {"id": "desc", "ctx": {"_type": "Store", "_fields": {}}}}], "type_comment": null}}, {"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "List", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "elts": [{"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "full_name", "value": {"_type": "Name", "_fields": {"id": "containing_type_desc", "ctx": {"_type": "Load", "_fields": {}}}}}}, {"_type": "Name", "_fields": {"id": "name", "ctx": {"_type": "Load", "_fields": {}}}}]}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "join", "value": {"_type": "Constant", "_fields": {"kind": null, "value": "."}}}}, "keywords": []}}, "targets": [{"_type": "Name", "_fields": {"id": "expected_full_name", "ctx": {"_type": "Store", "_fields": {}}}}], "type_comment": null}}]}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Name", "_fields": {"id": "name", "ctx": {"_type": "Load", "_fields": {}}}}, {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "name", "value": {"_type": "Name", "_fields": {"id": "desc", "ctx": {"_type": "Load", "_fields": {}}}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "assertEqual", "value": {"_type": "Name", "_fields": {"id": "test", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Name", "_fields": {"id": "expected_full_name", "ctx": {"_type": "Load", "_fields": {}}}}, {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "full_name", "value": {"_type": "Name", "_fields": {"id": "desc", "ctx": {"_type": "Load", "_fields": {}}}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "assertEqual", "value": {"_type": "Name", "_fields": {"id": "test", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Name", "_fields": {"id": "containing_type_desc", "ctx": {"_type": "Load", "_fields": {}}}}, {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "containing_type", "value": {"_type": "Name", "_fields": {"id": "desc", "ctx": {"_type": "Load", "_fields": {}}}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "assertEqual", "value": {"_type": "Name", "_fields": {"id": "test", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "file", "value": {"_type": "Name", "_fields": {"id": "desc", "ctx": {"_type": "Load", "_fields": {}}}}}}, {"_type": "Name", "_fields": {"id": "file_desc", "ctx": {"_type": "Load", "_fields": {}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "assertEqual", "value": {"_type": "Name", "_fields": {"id": "test", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "is_extendable", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}, {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "is_extendable", "value": {"_type": "Name", "_fields": {"id": "desc", "ctx": {"_type": "Load", "_fields": {}}}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "assertEqual", "value": {"_type": "Name", "_fields": {"id": "test", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "For", "_fields": {"body": [{"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Name", "_fields": {"id": "test", "ctx": {"_type": "Load", "_fields": {}}}}, {"_type": "Name", "_fields": {"id": "desc", "ctx": {"_type": "Load", "_fields": {}}}}, {"_type": "Name", "_fields": {"id": "name", "ctx": {"_type": "Load", "_fields": {}}}}, {"_type": "Name", "_fields": {"id": "file_desc", "ctx": {"_type": "Load", "_fields": {}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "CheckType", "value": {"_type": "Name", "_fields": {"id": "subtype", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}], "iter": {"_type": "Call", "_fields": {"args": [], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "items", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "type_dict", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}}}, "keywords": []}}, "orelse": [], "target": {"_type": "Tuple", "_fields": {"ctx": {"_type": "Store", "_fields": {}}, "elts": [{"_type": "Name", "_fields": {"id": "name", "ctx": {"_type": "Store", "_fields": {}}}}, {"_type": "Name", "_fields": {"id": "subtype", "ctx": {"_type": "Store", "_fields": {}}}}]}}, "type_comment": null}}, {"_type": "For", "_fields": {"body": [{"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Name", "_fields": {"id": "test", "ctx": {"_type": "Load", "_fields": {}}}}, {"_type": "Name", "_fields": {"id": "desc", "ctx": {"_type": "Load", "_fields": {}}}}, {"_type": "Name", "_fields": {"id": "name", "ctx": {"_type": "Load", "_fields": {}}}}, {"_type": "Name", "_fields": {"id": "index", "ctx": {"_type": "Load", "_fields": {}}}}, {"_type": "Name", "_fields": {"id": "file_desc", "ctx": {"_type": "Load", "_fields": {}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "CheckField", "value": {"_type": "Name", "_fields": {"id": "field", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}], "iter": {"_type": "Call", "_fields": {"args": [{"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "field_list", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}], "func": {"_type": "Name", "_fields": {"id": "enumerate", "ctx": {"_type": "Load", "_fields": {}}}}, "keywords": []}}, "orelse": [], "target": {"_type": "Tuple", "_fields": {"ctx": {"_type": "Store", "_fields": {}}, "elts": [{"_type": "Name", "_fields": {"id": "index", "ctx": {"_type": "Store", "_fields": {}}}}, {"_type": "Tuple", "_fields": {"ctx": {"_type": "Store", "_fields": {}}, "elts": [{"_type": "Name", "_fields": {"id": "name", "ctx": {"_type": "Store", "_fields": {}}}}, {"_type": "Name", "_fields": {"id": "field", "ctx": {"_type": "Store", "_fields": {}}}}]}}]}}, "type_comment": null}}, {"_type": "For", "_fields": {"body": [{"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Name", "_fields": {"id": "test", "ctx": {"_type": "Load", "_fields": {}}}}, {"_type": "Name", "_fields": {"id": "desc", "ctx": {"_type": "Load", "_fields": {}}}}, {"_type": "Name", "_fields": {"id": "name", "ctx": {"_type": "Load", "_fields": {}}}}, {"_type": "Name", "_fields": {"id": "index", "ctx": {"_type": "Load", "_fields": {}}}}, {"_type": "Name", "_fields": {"id": "file_desc", "ctx": {"_type": "Load", "_fields": {}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "CheckField", "value": {"_type": "Name", "_fields": {"id": "field", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}], "iter": {"_type": "Call", "_fields": {"args": [{"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "extensions", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}], "func": {"_type": "Name", "_fields": {"id": "enumerate", "ctx": {"_type": "Load", "_fields": {}}}}, "keywords": []}}, "orelse": [], "target": {"_type": "Tuple", "_fields": {"ctx": {"_type": "Store", "_fields": {}}, "elts": [{"_type": "Name", "_fields": {"id": "index", "ctx": {"_type": "Store", "_fields": {}}}}, {"_type": "Tuple", "_fields": {"ctx": {"_type": "Store", "_fields": {}}, "elts": [{"_type": "Name", "_fields": {"id": "name", "ctx": {"_type": "Store", "_fields": {}}}}, {"_type": "Name", "_fields": {"id": "field", "ctx": {"_type": "Store", "_fields": {}}}}]}}]}}, "type_comment": null}}], "name": "CheckType", "returns": null, "type_params": [], "type_comment": null, "decorator_list": []}}], "name": "MessageType", "bases": [{"_type": "Name", "_fields": {"id": "object", "ctx": {"_type": "Load", "_fields": {}}}}], "keywords": [], "type_params": [], "decorator_list": []}}], "type_ignores": []}}
class MessageType(object): def __init__(self, type_dict, field_list, is_extendable=False, extensions=None): self.type_dict = type_dict self.field_list = field_list self.is_extendable = is_extendable self.extensions = extensions or [] def CheckType(self, test, containing_type_desc, name, file_desc): if containing_type_desc is None: desc = file_desc.message_types_by_name[name] expected_full_name = '.'.join([file_desc.package, name]) else: desc = containing_type_desc.nested_types_by_name[name] expected_full_name = '.'.join([containing_type_desc.full_name, name]) test.assertEqual(name, desc.name) test.assertEqual(expected_full_name, desc.full_name) test.assertEqual(containing_type_desc, desc.containing_type) test.assertEqual(desc.file, file_desc) test.assertEqual(self.is_extendable, desc.is_extendable) for name, subtype in self.type_dict.items(): subtype.CheckType(test, desc, name, file_desc) for index, (name, field) in enumerate(self.field_list): field.CheckField(test, desc, name, index, file_desc) for index, (name, field) in enumerate(self.extensions): field.CheckField(test, desc, name, index, file_desc)
14,178
[ 0.03034883365035057, 0.028264984488487244, 0.0071881734766066074, -0.02691269852221012, 0.016892485320568085, 0.014010565355420113, 0.017424531280994415, -0.012613941915333271, 0.001351592713035643, 0.05812611058354378, 0.02607029117643833, -0.016548871994018555, 0.05236227065324783, 0.000...
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": "test", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "msg_desc", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "name", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "index", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "file_desc", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}}, "body": [{"_type": "Assign", "_fields": {"value": {"_type": "Subscript", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "slice": {"_type": "Name", "_fields": {"id": "name", "ctx": {"_type": "Load", "_fields": {}}}}, "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "fields_by_name", "value": {"_type": "Name", "_fields": {"id": "msg_desc", "ctx": {"_type": "Load", "_fields": {}}}}}}}}, "targets": [{"_type": "Name", "_fields": {"id": "field_desc", "ctx": {"_type": "Store", "_fields": {}}}}], "type_comment": null}}, {"_type": "Assign", "_fields": {"value": {"_type": "Subscript", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "slice": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "type_name", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}, "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "enum_types_by_name", "value": {"_type": "Name", "_fields": {"id": "msg_desc", "ctx": {"_type": "Load", "_fields": {}}}}}}}}, "targets": [{"_type": "Name", "_fields": {"id": "enum_desc", "ctx": {"_type": "Store", "_fields": {}}}}], "type_comment": null}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Name", "_fields": {"id": "name", "ctx": {"_type": "Load", "_fields": {}}}}, {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "name", "value": {"_type": "Name", "_fields": {"id": "field_desc", "ctx": {"_type": "Load", "_fields": {}}}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "assertEqual", "value": {"_type": "Name", "_fields": {"id": "test", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "List", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "elts": [{"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "full_name", "value": {"_type": "Name", "_fields": {"id": "msg_desc", "ctx": {"_type": "Load", "_fields": {}}}}}}, {"_type": "Name", "_fields": {"id": "name", "ctx": {"_type": "Load", "_fields": {}}}}]}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "join", "value": {"_type": "Constant", "_fields": {"kind": null, "value": "."}}}}, "keywords": []}}, "targets": [{"_type": "Name", "_fields": {"id": "expected_field_full_name", "ctx": {"_type": "Store", "_fields": {}}}}], "type_comment": null}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Name", "_fields": {"id": "expected_field_full_name", "ctx": {"_type": "Load", "_fields": {}}}}, {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "full_name", "value": {"_type": "Name", "_fields": {"id": "field_desc", "ctx": {"_type": "Load", "_fields": {}}}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "assertEqual", "value": {"_type": "Name", "_fields": {"id": "test", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Name", "_fields": {"id": "index", "ctx": {"_type": "Load", "_fields": {}}}}, {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "index", "value": {"_type": "Name", "_fields": {"id": "field_desc", "ctx": {"_type": "Load", "_fields": {}}}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "assertEqual", "value": {"_type": "Name", "_fields": {"id": "test", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "number", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}, {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "number", "value": {"_type": "Name", "_fields": {"id": "field_desc", "ctx": {"_type": "Load", "_fields": {}}}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "assertEqual", "value": {"_type": "Name", "_fields": {"id": "test", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "TYPE_ENUM", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "FieldDescriptor", "value": {"_type": "Name", "_fields": {"id": "descriptor", "ctx": {"_type": "Load", "_fields": {}}}}}}}}, {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "type", "value": {"_type": "Name", "_fields": {"id": "field_desc", "ctx": {"_type": "Load", "_fields": {}}}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "assertEqual", "value": {"_type": "Name", "_fields": {"id": "test", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "CPPTYPE_ENUM", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "FieldDescriptor", "value": {"_type": "Name", "_fields": {"id": "descriptor", "ctx": {"_type": "Load", "_fields": {}}}}}}}}, {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "cpp_type", "value": {"_type": "Name", "_fields": {"id": "field_desc", "ctx": {"_type": "Load", "_fields": {}}}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "assertEqual", "value": {"_type": "Name", "_fields": {"id": "test", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "has_default_value", "value": {"_type": "Name", "_fields": {"id": "field_desc", "ctx": {"_type": "Load", "_fields": {}}}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "assertTrue", "value": {"_type": "Name", "_fields": {"id": "test", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "number", "value": {"_type": "Subscript", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "slice": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "default_value", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}, "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "values_by_name", "value": {"_type": "Name", "_fields": {"id": "enum_desc", "ctx": {"_type": "Load", "_fields": {}}}}}}}}}}, {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "default_value", "value": {"_type": "Name", "_fields": {"id": "field_desc", "ctx": {"_type": "Load", "_fields": {}}}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "assertEqual", "value": {"_type": "Name", "_fields": {"id": "test", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "has_options", "value": {"_type": "Subscript", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "slice": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "default_value", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}, "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "values_by_name", "value": {"_type": "Name", "_fields": {"id": "enum_desc", "ctx": {"_type": "Load", "_fields": {}}}}}}}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "assertFalse", "value": {"_type": "Name", "_fields": {"id": "test", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Name", "_fields": {"id": "msg_desc", "ctx": {"_type": "Load", "_fields": {}}}}, {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "containing_type", "value": {"_type": "Name", "_fields": {"id": "field_desc", "ctx": {"_type": "Load", "_fields": {}}}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "assertEqual", "value": {"_type": "Name", "_fields": {"id": "test", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Name", "_fields": {"id": "enum_desc", "ctx": {"_type": "Load", "_fields": {}}}}, {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "enum_type", "value": {"_type": "Name", "_fields": {"id": "field_desc", "ctx": {"_type": "Load", "_fields": {}}}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "assertEqual", "value": {"_type": "Name", "_fields": {"id": "test", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Name", "_fields": {"id": "file_desc", "ctx": {"_type": "Load", "_fields": {}}}}, {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "file", "value": {"_type": "Name", "_fields": {"id": "enum_desc", "ctx": {"_type": "Load", "_fields": {}}}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "assertEqual", "value": {"_type": "Name", "_fields": {"id": "test", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}], "name": "CheckField", "returns": null, "type_params": [], "type_comment": null, "decorator_list": []}}], "type_ignores": []}}
def CheckField(self, test, msg_desc, name, index, file_desc): field_desc = msg_desc.fields_by_name[name] enum_desc = msg_desc.enum_types_by_name[self.type_name] test.assertEqual(name, field_desc.name) expected_field_full_name = '.'.join([msg_desc.full_name, name]) test.assertEqual(expected_field_full_name, field_desc.full_name) test.assertEqual(index, field_desc.index) test.assertEqual(self.number, field_desc.number) test.assertEqual(descriptor.FieldDescriptor.TYPE_ENUM, field_desc.type) test.assertEqual(descriptor.FieldDescriptor.CPPTYPE_ENUM, field_desc.cpp_type) test.assertTrue(field_desc.has_default_value) test.assertEqual(enum_desc.values_by_name[self.default_value].number, field_desc.default_value) test.assertFalse(enum_desc.values_by_name[self.default_value].has_options) test.assertEqual(msg_desc, field_desc.containing_type) test.assertEqual(enum_desc, field_desc.enum_type) test.assertEqual(file_desc, enum_desc.file)
14,179
[ -0.0072493660263717175, 0.01460364367812872, -0.017677541822195053, -0.011792022734880447, 0.042237263172864914, 0.0301514882594347, 0.016649411991238594, -0.017593612894415855, 0.013281761668622494, 0.04418861120939255, 0.011781531386077404, -0.033047039061784744, 0.050735071301460266, -0...
10
{"_type": "Module", "_fields": {"body": [{"_type": "ClassDef", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "number", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "type_name", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "default_value", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}}, "body": [{"_type": "Assign", "_fields": {"value": {"_type": "Name", "_fields": {"id": "number", "ctx": {"_type": "Load", "_fields": {}}}}, "targets": [{"_type": "Attribute", "_fields": {"ctx": {"_type": "Store", "_fields": {}}, "attr": "number", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}], "type_comment": null}}, {"_type": "Assign", "_fields": {"value": {"_type": "Name", "_fields": {"id": "type_name", "ctx": {"_type": "Load", "_fields": {}}}}, "targets": [{"_type": "Attribute", "_fields": {"ctx": {"_type": "Store", "_fields": {}}, "attr": "type_name", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}], "type_comment": null}}, {"_type": "Assign", "_fields": {"value": {"_type": "Name", "_fields": {"id": "default_value", "ctx": {"_type": "Load", "_fields": {}}}}, "targets": [{"_type": "Attribute", "_fields": {"ctx": {"_type": "Store", "_fields": {}}, "attr": "default_value", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}], "type_comment": null}}], "name": "__init__", "returns": null, "type_params": [], "type_comment": null, "decorator_list": []}}, {"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "test", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "msg_desc", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "name", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "index", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "file_desc", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}}, "body": [{"_type": "Assign", "_fields": {"value": {"_type": "Subscript", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "slice": {"_type": "Name", "_fields": {"id": "name", "ctx": {"_type": "Load", "_fields": {}}}}, "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "fields_by_name", "value": {"_type": "Name", "_fields": {"id": "msg_desc", "ctx": {"_type": "Load", "_fields": {}}}}}}}}, "targets": [{"_type": "Name", "_fields": {"id": "field_desc", "ctx": {"_type": "Store", "_fields": {}}}}], "type_comment": null}}, {"_type": "Assign", "_fields": {"value": {"_type": "Subscript", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "slice": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "type_name", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}, "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "enum_types_by_name", "value": {"_type": "Name", "_fields": {"id": "msg_desc", "ctx": {"_type": "Load", "_fields": {}}}}}}}}, "targets": [{"_type": "Name", "_fields": {"id": "enum_desc", "ctx": {"_type": "Store", "_fields": {}}}}], "type_comment": null}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Name", "_fields": {"id": "name", "ctx": {"_type": "Load", "_fields": {}}}}, {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "name", "value": {"_type": "Name", "_fields": {"id": "field_desc", "ctx": {"_type": "Load", "_fields": {}}}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "assertEqual", "value": {"_type": "Name", "_fields": {"id": "test", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "List", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "elts": [{"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "full_name", "value": {"_type": "Name", "_fields": {"id": "msg_desc", "ctx": {"_type": "Load", "_fields": {}}}}}}, {"_type": "Name", "_fields": {"id": "name", "ctx": {"_type": "Load", "_fields": {}}}}]}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "join", "value": {"_type": "Constant", "_fields": {"kind": null, "value": "."}}}}, "keywords": []}}, "targets": [{"_type": "Name", "_fields": {"id": "expected_field_full_name", "ctx": {"_type": "Store", "_fields": {}}}}], "type_comment": null}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Name", "_fields": {"id": "expected_field_full_name", "ctx": {"_type": "Load", "_fields": {}}}}, {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "full_name", "value": {"_type": "Name", "_fields": {"id": "field_desc", "ctx": {"_type": "Load", "_fields": {}}}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "assertEqual", "value": {"_type": "Name", "_fields": {"id": "test", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Name", "_fields": {"id": "index", "ctx": {"_type": "Load", "_fields": {}}}}, {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "index", "value": {"_type": "Name", "_fields": {"id": "field_desc", "ctx": {"_type": "Load", "_fields": {}}}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "assertEqual", "value": {"_type": "Name", "_fields": {"id": "test", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "number", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}, {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "number", "value": {"_type": "Name", "_fields": {"id": "field_desc", "ctx": {"_type": "Load", "_fields": {}}}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "assertEqual", "value": {"_type": "Name", "_fields": {"id": "test", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "TYPE_ENUM", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "FieldDescriptor", "value": {"_type": "Name", "_fields": {"id": "descriptor", "ctx": {"_type": "Load", "_fields": {}}}}}}}}, {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "type", "value": {"_type": "Name", "_fields": {"id": "field_desc", "ctx": {"_type": "Load", "_fields": {}}}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "assertEqual", "value": {"_type": "Name", "_fields": {"id": "test", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "CPPTYPE_ENUM", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "FieldDescriptor", "value": {"_type": "Name", "_fields": {"id": "descriptor", "ctx": {"_type": "Load", "_fields": {}}}}}}}}, {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "cpp_type", "value": {"_type": "Name", "_fields": {"id": "field_desc", "ctx": {"_type": "Load", "_fields": {}}}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "assertEqual", "value": {"_type": "Name", "_fields": {"id": "test", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "has_default_value", "value": {"_type": "Name", "_fields": {"id": "field_desc", "ctx": {"_type": "Load", "_fields": {}}}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "assertTrue", "value": {"_type": "Name", "_fields": {"id": "test", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "number", "value": {"_type": "Subscript", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "slice": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "default_value", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}, "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "values_by_name", "value": {"_type": "Name", "_fields": {"id": "enum_desc", "ctx": {"_type": "Load", "_fields": {}}}}}}}}}}, {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "default_value", "value": {"_type": "Name", "_fields": {"id": "field_desc", "ctx": {"_type": "Load", "_fields": {}}}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "assertEqual", "value": {"_type": "Name", "_fields": {"id": "test", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "has_options", "value": {"_type": "Subscript", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "slice": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "default_value", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}, "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "values_by_name", "value": {"_type": "Name", "_fields": {"id": "enum_desc", "ctx": {"_type": "Load", "_fields": {}}}}}}}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "assertFalse", "value": {"_type": "Name", "_fields": {"id": "test", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Name", "_fields": {"id": "msg_desc", "ctx": {"_type": "Load", "_fields": {}}}}, {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "containing_type", "value": {"_type": "Name", "_fields": {"id": "field_desc", "ctx": {"_type": "Load", "_fields": {}}}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "assertEqual", "value": {"_type": "Name", "_fields": {"id": "test", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Name", "_fields": {"id": "enum_desc", "ctx": {"_type": "Load", "_fields": {}}}}, {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "enum_type", "value": {"_type": "Name", "_fields": {"id": "field_desc", "ctx": {"_type": "Load", "_fields": {}}}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "assertEqual", "value": {"_type": "Name", "_fields": {"id": "test", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Name", "_fields": {"id": "file_desc", "ctx": {"_type": "Load", "_fields": {}}}}, {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "file", "value": {"_type": "Name", "_fields": {"id": "enum_desc", "ctx": {"_type": "Load", "_fields": {}}}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "assertEqual", "value": {"_type": "Name", "_fields": {"id": "test", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}], "name": "CheckField", "returns": null, "type_params": [], "type_comment": null, "decorator_list": []}}], "name": "EnumField", "bases": [{"_type": "Name", "_fields": {"id": "object", "ctx": {"_type": "Load", "_fields": {}}}}], "keywords": [], "type_params": [], "decorator_list": []}}], "type_ignores": []}}
class EnumField(object): def __init__(self, number, type_name, default_value): self.number = number self.type_name = type_name self.default_value = default_value def CheckField(self, test, msg_desc, name, index, file_desc): field_desc = msg_desc.fields_by_name[name] enum_desc = msg_desc.enum_types_by_name[self.type_name] test.assertEqual(name, field_desc.name) expected_field_full_name = '.'.join([msg_desc.full_name, name]) test.assertEqual(expected_field_full_name, field_desc.full_name) test.assertEqual(index, field_desc.index) test.assertEqual(self.number, field_desc.number) test.assertEqual(descriptor.FieldDescriptor.TYPE_ENUM, field_desc.type) test.assertEqual(descriptor.FieldDescriptor.CPPTYPE_ENUM, field_desc.cpp_type) test.assertTrue(field_desc.has_default_value) test.assertEqual(enum_desc.values_by_name[self.default_value].number, field_desc.default_value) test.assertFalse(enum_desc.values_by_name[self.default_value].has_options) test.assertEqual(msg_desc, field_desc.containing_type) test.assertEqual(enum_desc, field_desc.enum_type) test.assertEqual(file_desc, enum_desc.file)
14,180
[ 0.019204910844564438, 0.024071021005511284, 0.01113798376172781, -0.017874842509627342, 0.005785263143479824, -0.01683673821389675, 0.008964454755187035, -0.020881015807390213, -0.0022532788570970297, 0.021875865757465363, 0.0159175843000412, 0.0017423374811187387, 0.027769263833761215, 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": "test", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "msg_desc", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "name", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "index", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "file_desc", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}}, "body": [{"_type": "Assign", "_fields": {"value": {"_type": "Subscript", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "slice": {"_type": "Name", "_fields": {"id": "name", "ctx": {"_type": "Load", "_fields": {}}}}, "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "fields_by_name", "value": {"_type": "Name", "_fields": {"id": "msg_desc", "ctx": {"_type": "Load", "_fields": {}}}}}}}}, "targets": [{"_type": "Name", "_fields": {"id": "field_desc", "ctx": {"_type": "Store", "_fields": {}}}}], "type_comment": null}}, {"_type": "Assign", "_fields": {"value": {"_type": "Subscript", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "slice": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "type_name", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}, "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "nested_types_by_name", "value": {"_type": "Name", "_fields": {"id": "msg_desc", "ctx": {"_type": "Load", "_fields": {}}}}}}}}, "targets": [{"_type": "Name", "_fields": {"id": "field_type_desc", "ctx": {"_type": "Store", "_fields": {}}}}], "type_comment": null}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Name", "_fields": {"id": "name", "ctx": {"_type": "Load", "_fields": {}}}}, {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "name", "value": {"_type": "Name", "_fields": {"id": "field_desc", "ctx": {"_type": "Load", "_fields": {}}}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "assertEqual", "value": {"_type": "Name", "_fields": {"id": "test", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "List", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "elts": [{"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "full_name", "value": {"_type": "Name", "_fields": {"id": "msg_desc", "ctx": {"_type": "Load", "_fields": {}}}}}}, {"_type": "Name", "_fields": {"id": "name", "ctx": {"_type": "Load", "_fields": {}}}}]}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "join", "value": {"_type": "Constant", "_fields": {"kind": null, "value": "."}}}}, "keywords": []}}, "targets": [{"_type": "Name", "_fields": {"id": "expected_field_full_name", "ctx": {"_type": "Store", "_fields": {}}}}], "type_comment": null}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Name", "_fields": {"id": "expected_field_full_name", "ctx": {"_type": "Load", "_fields": {}}}}, {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "full_name", "value": {"_type": "Name", "_fields": {"id": "field_desc", "ctx": {"_type": "Load", "_fields": {}}}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "assertEqual", "value": {"_type": "Name", "_fields": {"id": "test", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Name", "_fields": {"id": "index", "ctx": {"_type": "Load", "_fields": {}}}}, {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "index", "value": {"_type": "Name", "_fields": {"id": "field_desc", "ctx": {"_type": "Load", "_fields": {}}}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "assertEqual", "value": {"_type": "Name", "_fields": {"id": "test", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "number", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}, {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "number", "value": {"_type": "Name", "_fields": {"id": "field_desc", "ctx": {"_type": "Load", "_fields": {}}}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "assertEqual", "value": {"_type": "Name", "_fields": {"id": "test", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "TYPE_MESSAGE", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "FieldDescriptor", "value": {"_type": "Name", "_fields": {"id": "descriptor", "ctx": {"_type": "Load", "_fields": {}}}}}}}}, {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "type", "value": {"_type": "Name", "_fields": {"id": "field_desc", "ctx": {"_type": "Load", "_fields": {}}}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "assertEqual", "value": {"_type": "Name", "_fields": {"id": "test", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "CPPTYPE_MESSAGE", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "FieldDescriptor", "value": {"_type": "Name", "_fields": {"id": "descriptor", "ctx": {"_type": "Load", "_fields": {}}}}}}}}, {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "cpp_type", "value": {"_type": "Name", "_fields": {"id": "field_desc", "ctx": {"_type": "Load", "_fields": {}}}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "assertEqual", "value": {"_type": "Name", "_fields": {"id": "test", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "has_default_value", "value": {"_type": "Name", "_fields": {"id": "field_desc", "ctx": {"_type": "Load", "_fields": {}}}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "assertFalse", "value": {"_type": "Name", "_fields": {"id": "test", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Name", "_fields": {"id": "msg_desc", "ctx": {"_type": "Load", "_fields": {}}}}, {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "containing_type", "value": {"_type": "Name", "_fields": {"id": "field_desc", "ctx": {"_type": "Load", "_fields": {}}}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "assertEqual", "value": {"_type": "Name", "_fields": {"id": "test", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Name", "_fields": {"id": "field_type_desc", "ctx": {"_type": "Load", "_fields": {}}}}, {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "message_type", "value": {"_type": "Name", "_fields": {"id": "field_desc", "ctx": {"_type": "Load", "_fields": {}}}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "assertEqual", "value": {"_type": "Name", "_fields": {"id": "test", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Name", "_fields": {"id": "file_desc", "ctx": {"_type": "Load", "_fields": {}}}}, {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "file", "value": {"_type": "Name", "_fields": {"id": "field_desc", "ctx": {"_type": "Load", "_fields": {}}}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "assertEqual", "value": {"_type": "Name", "_fields": {"id": "test", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "If", "_fields": {"body": [{"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Name", "_fields": {"id": "NotImplementedError", "ctx": {"_type": "Load", "_fields": {}}}}, {"_type": "Name", "_fields": {"id": "getattr", "ctx": {"_type": "Load", "_fields": {}}}}, {"_type": "Name", "_fields": {"id": "field_desc", "ctx": {"_type": "Load", "_fields": {}}}}, {"_type": "Constant", "_fields": {"kind": null, "value": "default_value"}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "assertRaises", "value": {"_type": "Name", "_fields": {"id": "test", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}], "test": {"_type": "Compare", "_fields": {"ops": [{"_type": "Eq", "_fields": {}}], "left": {"_type": "Call", "_fields": {"args": [], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "Type", "value": {"_type": "Name", "_fields": {"id": "api_implementation", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}, "comparators": [{"_type": "Constant", "_fields": {"kind": null, "value": "cpp"}}]}}, "orelse": []}}], "name": "CheckField", "returns": null, "type_params": [], "type_comment": null, "decorator_list": []}}], "type_ignores": []}}
def CheckField(self, test, msg_desc, name, index, file_desc): field_desc = msg_desc.fields_by_name[name] field_type_desc = msg_desc.nested_types_by_name[self.type_name] test.assertEqual(name, field_desc.name) expected_field_full_name = '.'.join([msg_desc.full_name, name]) test.assertEqual(expected_field_full_name, field_desc.full_name) test.assertEqual(index, field_desc.index) test.assertEqual(self.number, field_desc.number) test.assertEqual(descriptor.FieldDescriptor.TYPE_MESSAGE, field_desc.type) test.assertEqual(descriptor.FieldDescriptor.CPPTYPE_MESSAGE, field_desc.cpp_type) test.assertFalse(field_desc.has_default_value) test.assertEqual(msg_desc, field_desc.containing_type) test.assertEqual(field_type_desc, field_desc.message_type) test.assertEqual(file_desc, field_desc.file) # TODO(jieluo): Fix python and cpp extension diff for message field # default value. if api_implementation.Type() == 'cpp': test.assertRaises( NotImplementedError, getattr, field_desc, 'default_value')
14,181
[ -0.010476402938365936, -0.013290724717080593, -0.011603179387748241, 0.009360107593238354, 0.01521934662014246, -0.023646589368581772, 0.009931357577443123, -0.029327640309929848, -0.0010278562549501657, 0.0239400751888752, 0.007646359037607908, -0.011896666139364243, 0.02500920183956623, ...
9
{"_type": "Module", "_fields": {"body": [{"_type": "ClassDef", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "number", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "type_name", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}}, "body": [{"_type": "Assign", "_fields": {"value": {"_type": "Name", "_fields": {"id": "number", "ctx": {"_type": "Load", "_fields": {}}}}, "targets": [{"_type": "Attribute", "_fields": {"ctx": {"_type": "Store", "_fields": {}}, "attr": "number", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}], "type_comment": null}}, {"_type": "Assign", "_fields": {"value": {"_type": "Name", "_fields": {"id": "type_name", "ctx": {"_type": "Load", "_fields": {}}}}, "targets": [{"_type": "Attribute", "_fields": {"ctx": {"_type": "Store", "_fields": {}}, "attr": "type_name", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}], "type_comment": null}}], "name": "__init__", "returns": null, "type_params": [], "type_comment": null, "decorator_list": []}}, {"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "test", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "msg_desc", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "name", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "index", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "file_desc", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}}, "body": [{"_type": "Assign", "_fields": {"value": {"_type": "Subscript", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "slice": {"_type": "Name", "_fields": {"id": "name", "ctx": {"_type": "Load", "_fields": {}}}}, "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "fields_by_name", "value": {"_type": "Name", "_fields": {"id": "msg_desc", "ctx": {"_type": "Load", "_fields": {}}}}}}}}, "targets": [{"_type": "Name", "_fields": {"id": "field_desc", "ctx": {"_type": "Store", "_fields": {}}}}], "type_comment": null}}, {"_type": "Assign", "_fields": {"value": {"_type": "Subscript", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "slice": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "type_name", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}, "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "nested_types_by_name", "value": {"_type": "Name", "_fields": {"id": "msg_desc", "ctx": {"_type": "Load", "_fields": {}}}}}}}}, "targets": [{"_type": "Name", "_fields": {"id": "field_type_desc", "ctx": {"_type": "Store", "_fields": {}}}}], "type_comment": null}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Name", "_fields": {"id": "name", "ctx": {"_type": "Load", "_fields": {}}}}, {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "name", "value": {"_type": "Name", "_fields": {"id": "field_desc", "ctx": {"_type": "Load", "_fields": {}}}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "assertEqual", "value": {"_type": "Name", "_fields": {"id": "test", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "List", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "elts": [{"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "full_name", "value": {"_type": "Name", "_fields": {"id": "msg_desc", "ctx": {"_type": "Load", "_fields": {}}}}}}, {"_type": "Name", "_fields": {"id": "name", "ctx": {"_type": "Load", "_fields": {}}}}]}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "join", "value": {"_type": "Constant", "_fields": {"kind": null, "value": "."}}}}, "keywords": []}}, "targets": [{"_type": "Name", "_fields": {"id": "expected_field_full_name", "ctx": {"_type": "Store", "_fields": {}}}}], "type_comment": null}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Name", "_fields": {"id": "expected_field_full_name", "ctx": {"_type": "Load", "_fields": {}}}}, {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "full_name", "value": {"_type": "Name", "_fields": {"id": "field_desc", "ctx": {"_type": "Load", "_fields": {}}}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "assertEqual", "value": {"_type": "Name", "_fields": {"id": "test", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Name", "_fields": {"id": "index", "ctx": {"_type": "Load", "_fields": {}}}}, {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "index", "value": {"_type": "Name", "_fields": {"id": "field_desc", "ctx": {"_type": "Load", "_fields": {}}}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "assertEqual", "value": {"_type": "Name", "_fields": {"id": "test", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "number", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}, {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "number", "value": {"_type": "Name", "_fields": {"id": "field_desc", "ctx": {"_type": "Load", "_fields": {}}}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "assertEqual", "value": {"_type": "Name", "_fields": {"id": "test", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "TYPE_MESSAGE", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "FieldDescriptor", "value": {"_type": "Name", "_fields": {"id": "descriptor", "ctx": {"_type": "Load", "_fields": {}}}}}}}}, {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "type", "value": {"_type": "Name", "_fields": {"id": "field_desc", "ctx": {"_type": "Load", "_fields": {}}}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "assertEqual", "value": {"_type": "Name", "_fields": {"id": "test", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "CPPTYPE_MESSAGE", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "FieldDescriptor", "value": {"_type": "Name", "_fields": {"id": "descriptor", "ctx": {"_type": "Load", "_fields": {}}}}}}}}, {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "cpp_type", "value": {"_type": "Name", "_fields": {"id": "field_desc", "ctx": {"_type": "Load", "_fields": {}}}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "assertEqual", "value": {"_type": "Name", "_fields": {"id": "test", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "has_default_value", "value": {"_type": "Name", "_fields": {"id": "field_desc", "ctx": {"_type": "Load", "_fields": {}}}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "assertFalse", "value": {"_type": "Name", "_fields": {"id": "test", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Name", "_fields": {"id": "msg_desc", "ctx": {"_type": "Load", "_fields": {}}}}, {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "containing_type", "value": {"_type": "Name", "_fields": {"id": "field_desc", "ctx": {"_type": "Load", "_fields": {}}}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "assertEqual", "value": {"_type": "Name", "_fields": {"id": "test", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Name", "_fields": {"id": "field_type_desc", "ctx": {"_type": "Load", "_fields": {}}}}, {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "message_type", "value": {"_type": "Name", "_fields": {"id": "field_desc", "ctx": {"_type": "Load", "_fields": {}}}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "assertEqual", "value": {"_type": "Name", "_fields": {"id": "test", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Name", "_fields": {"id": "file_desc", "ctx": {"_type": "Load", "_fields": {}}}}, {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "file", "value": {"_type": "Name", "_fields": {"id": "field_desc", "ctx": {"_type": "Load", "_fields": {}}}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "assertEqual", "value": {"_type": "Name", "_fields": {"id": "test", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "If", "_fields": {"body": [{"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Name", "_fields": {"id": "NotImplementedError", "ctx": {"_type": "Load", "_fields": {}}}}, {"_type": "Name", "_fields": {"id": "getattr", "ctx": {"_type": "Load", "_fields": {}}}}, {"_type": "Name", "_fields": {"id": "field_desc", "ctx": {"_type": "Load", "_fields": {}}}}, {"_type": "Constant", "_fields": {"kind": null, "value": "default_value"}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "assertRaises", "value": {"_type": "Name", "_fields": {"id": "test", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}], "test": {"_type": "Compare", "_fields": {"ops": [{"_type": "Eq", "_fields": {}}], "left": {"_type": "Call", "_fields": {"args": [], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "Type", "value": {"_type": "Name", "_fields": {"id": "api_implementation", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}, "comparators": [{"_type": "Constant", "_fields": {"kind": null, "value": "cpp"}}]}}, "orelse": []}}], "name": "CheckField", "returns": null, "type_params": [], "type_comment": null, "decorator_list": []}}], "name": "MessageField", "bases": [{"_type": "Name", "_fields": {"id": "object", "ctx": {"_type": "Load", "_fields": {}}}}], "keywords": [], "type_params": [], "decorator_list": []}}], "type_ignores": []}}
class MessageField(object): def __init__(self, number, type_name): self.number = number self.type_name = type_name def CheckField(self, test, msg_desc, name, index, file_desc): field_desc = msg_desc.fields_by_name[name] field_type_desc = msg_desc.nested_types_by_name[self.type_name] test.assertEqual(name, field_desc.name) expected_field_full_name = '.'.join([msg_desc.full_name, name]) test.assertEqual(expected_field_full_name, field_desc.full_name) test.assertEqual(index, field_desc.index) test.assertEqual(self.number, field_desc.number) test.assertEqual(descriptor.FieldDescriptor.TYPE_MESSAGE, field_desc.type) test.assertEqual(descriptor.FieldDescriptor.CPPTYPE_MESSAGE, field_desc.cpp_type) test.assertFalse(field_desc.has_default_value) test.assertEqual(msg_desc, field_desc.containing_type) test.assertEqual(field_type_desc, field_desc.message_type) test.assertEqual(file_desc, field_desc.file) # TODO(jieluo): Fix python and cpp extension diff for message field # default value. if api_implementation.Type() == 'cpp': test.assertRaises( NotImplementedError, getattr, field_desc, 'default_value')
14,182
[ 0.03629430755972862, 0.025089647620916367, 0.011116779409348965, -0.019915731623768806, 0.006926016882061958, -0.00475923391059041, 0.009073576889932156, -0.012511868961155415, 0.0042566717602312565, 0.05830816552042961, 0.032691240310668945, -0.002932984149083495, 0.03886478766798973, -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": "test", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "msg_desc", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "name", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "index", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "file_desc", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}}, "body": [{"_type": "Assign", "_fields": {"value": {"_type": "Subscript", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "slice": {"_type": "Name", "_fields": {"id": "name", "ctx": {"_type": "Load", "_fields": {}}}}, "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "fields_by_name", "value": {"_type": "Name", "_fields": {"id": "msg_desc", "ctx": {"_type": "Load", "_fields": {}}}}}}}}, "targets": [{"_type": "Name", "_fields": {"id": "field_desc", "ctx": {"_type": "Store", "_fields": {}}}}], "type_comment": null}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Name", "_fields": {"id": "name", "ctx": {"_type": "Load", "_fields": {}}}}, {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "name", "value": {"_type": "Name", "_fields": {"id": "field_desc", "ctx": {"_type": "Load", "_fields": {}}}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "assertEqual", "value": {"_type": "Name", "_fields": {"id": "test", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "List", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "elts": [{"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "full_name", "value": {"_type": "Name", "_fields": {"id": "msg_desc", "ctx": {"_type": "Load", "_fields": {}}}}}}, {"_type": "Name", "_fields": {"id": "name", "ctx": {"_type": "Load", "_fields": {}}}}]}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "join", "value": {"_type": "Constant", "_fields": {"kind": null, "value": "."}}}}, "keywords": []}}, "targets": [{"_type": "Name", "_fields": {"id": "expected_field_full_name", "ctx": {"_type": "Store", "_fields": {}}}}], "type_comment": null}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Name", "_fields": {"id": "expected_field_full_name", "ctx": {"_type": "Load", "_fields": {}}}}, {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "full_name", "value": {"_type": "Name", "_fields": {"id": "field_desc", "ctx": {"_type": "Load", "_fields": {}}}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "assertEqual", "value": {"_type": "Name", "_fields": {"id": "test", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Name", "_fields": {"id": "index", "ctx": {"_type": "Load", "_fields": {}}}}, {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "index", "value": {"_type": "Name", "_fields": {"id": "field_desc", "ctx": {"_type": "Load", "_fields": {}}}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "assertEqual", "value": {"_type": "Name", "_fields": {"id": "test", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "number", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}, {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "number", "value": {"_type": "Name", "_fields": {"id": "field_desc", "ctx": {"_type": "Load", "_fields": {}}}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "assertEqual", "value": {"_type": "Name", "_fields": {"id": "test", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "TYPE_STRING", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "FieldDescriptor", "value": {"_type": "Name", "_fields": {"id": "descriptor", "ctx": {"_type": "Load", "_fields": {}}}}}}}}, {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "type", "value": {"_type": "Name", "_fields": {"id": "field_desc", "ctx": {"_type": "Load", "_fields": {}}}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "assertEqual", "value": {"_type": "Name", "_fields": {"id": "test", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "CPPTYPE_STRING", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "FieldDescriptor", "value": {"_type": "Name", "_fields": {"id": "descriptor", "ctx": {"_type": "Load", "_fields": {}}}}}}}}, {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "cpp_type", "value": {"_type": "Name", "_fields": {"id": "field_desc", "ctx": {"_type": "Load", "_fields": {}}}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "assertEqual", "value": {"_type": "Name", "_fields": {"id": "test", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "has_default_value", "value": {"_type": "Name", "_fields": {"id": "field_desc", "ctx": {"_type": "Load", "_fields": {}}}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "assertTrue", "value": {"_type": "Name", "_fields": {"id": "test", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "default_value", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}, {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "default_value", "value": {"_type": "Name", "_fields": {"id": "field_desc", "ctx": {"_type": "Load", "_fields": {}}}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "assertEqual", "value": {"_type": "Name", "_fields": {"id": "test", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Name", "_fields": {"id": "file_desc", "ctx": {"_type": "Load", "_fields": {}}}}, {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "file", "value": {"_type": "Name", "_fields": {"id": "field_desc", "ctx": {"_type": "Load", "_fields": {}}}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "assertEqual", "value": {"_type": "Name", "_fields": {"id": "test", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}], "name": "CheckField", "returns": null, "type_params": [], "type_comment": null, "decorator_list": []}}], "type_ignores": []}}
def CheckField(self, test, msg_desc, name, index, file_desc): field_desc = msg_desc.fields_by_name[name] test.assertEqual(name, field_desc.name) expected_field_full_name = '.'.join([msg_desc.full_name, name]) test.assertEqual(expected_field_full_name, field_desc.full_name) test.assertEqual(index, field_desc.index) test.assertEqual(self.number, field_desc.number) test.assertEqual(descriptor.FieldDescriptor.TYPE_STRING, field_desc.type) test.assertEqual(descriptor.FieldDescriptor.CPPTYPE_STRING, field_desc.cpp_type) test.assertTrue(field_desc.has_default_value) test.assertEqual(self.default_value, field_desc.default_value) test.assertEqual(file_desc, field_desc.file)
14,183
[ -0.011155921034514904, -0.015678884461522102, -0.010517512448132038, -0.01487816870212555, 0.03276443108916283, 0.010322744026780128, 0.0018070212099701166, -0.0019585080444812775, 0.024627426639199257, 0.0464848093688488, -0.004414758179336786, -0.0120540214702487, 0.016739292070269585, -...
9
{"_type": "Module", "_fields": {"body": [{"_type": "ClassDef", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "number", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "default_value", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}}, "body": [{"_type": "Assign", "_fields": {"value": {"_type": "Name", "_fields": {"id": "number", "ctx": {"_type": "Load", "_fields": {}}}}, "targets": [{"_type": "Attribute", "_fields": {"ctx": {"_type": "Store", "_fields": {}}, "attr": "number", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}], "type_comment": null}}, {"_type": "Assign", "_fields": {"value": {"_type": "Name", "_fields": {"id": "default_value", "ctx": {"_type": "Load", "_fields": {}}}}, "targets": [{"_type": "Attribute", "_fields": {"ctx": {"_type": "Store", "_fields": {}}, "attr": "default_value", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}], "type_comment": null}}], "name": "__init__", "returns": null, "type_params": [], "type_comment": null, "decorator_list": []}}, {"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "test", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "msg_desc", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "name", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "index", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "file_desc", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}}, "body": [{"_type": "Assign", "_fields": {"value": {"_type": "Subscript", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "slice": {"_type": "Name", "_fields": {"id": "name", "ctx": {"_type": "Load", "_fields": {}}}}, "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "fields_by_name", "value": {"_type": "Name", "_fields": {"id": "msg_desc", "ctx": {"_type": "Load", "_fields": {}}}}}}}}, "targets": [{"_type": "Name", "_fields": {"id": "field_desc", "ctx": {"_type": "Store", "_fields": {}}}}], "type_comment": null}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Name", "_fields": {"id": "name", "ctx": {"_type": "Load", "_fields": {}}}}, {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "name", "value": {"_type": "Name", "_fields": {"id": "field_desc", "ctx": {"_type": "Load", "_fields": {}}}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "assertEqual", "value": {"_type": "Name", "_fields": {"id": "test", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "List", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "elts": [{"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "full_name", "value": {"_type": "Name", "_fields": {"id": "msg_desc", "ctx": {"_type": "Load", "_fields": {}}}}}}, {"_type": "Name", "_fields": {"id": "name", "ctx": {"_type": "Load", "_fields": {}}}}]}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "join", "value": {"_type": "Constant", "_fields": {"kind": null, "value": "."}}}}, "keywords": []}}, "targets": [{"_type": "Name", "_fields": {"id": "expected_field_full_name", "ctx": {"_type": "Store", "_fields": {}}}}], "type_comment": null}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Name", "_fields": {"id": "expected_field_full_name", "ctx": {"_type": "Load", "_fields": {}}}}, {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "full_name", "value": {"_type": "Name", "_fields": {"id": "field_desc", "ctx": {"_type": "Load", "_fields": {}}}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "assertEqual", "value": {"_type": "Name", "_fields": {"id": "test", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Name", "_fields": {"id": "index", "ctx": {"_type": "Load", "_fields": {}}}}, {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "index", "value": {"_type": "Name", "_fields": {"id": "field_desc", "ctx": {"_type": "Load", "_fields": {}}}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "assertEqual", "value": {"_type": "Name", "_fields": {"id": "test", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "number", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}, {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "number", "value": {"_type": "Name", "_fields": {"id": "field_desc", "ctx": {"_type": "Load", "_fields": {}}}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "assertEqual", "value": {"_type": "Name", "_fields": {"id": "test", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "TYPE_STRING", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "FieldDescriptor", "value": {"_type": "Name", "_fields": {"id": "descriptor", "ctx": {"_type": "Load", "_fields": {}}}}}}}}, {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "type", "value": {"_type": "Name", "_fields": {"id": "field_desc", "ctx": {"_type": "Load", "_fields": {}}}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "assertEqual", "value": {"_type": "Name", "_fields": {"id": "test", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "CPPTYPE_STRING", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "FieldDescriptor", "value": {"_type": "Name", "_fields": {"id": "descriptor", "ctx": {"_type": "Load", "_fields": {}}}}}}}}, {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "cpp_type", "value": {"_type": "Name", "_fields": {"id": "field_desc", "ctx": {"_type": "Load", "_fields": {}}}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "assertEqual", "value": {"_type": "Name", "_fields": {"id": "test", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "has_default_value", "value": {"_type": "Name", "_fields": {"id": "field_desc", "ctx": {"_type": "Load", "_fields": {}}}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "assertTrue", "value": {"_type": "Name", "_fields": {"id": "test", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "default_value", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}, {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "default_value", "value": {"_type": "Name", "_fields": {"id": "field_desc", "ctx": {"_type": "Load", "_fields": {}}}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "assertEqual", "value": {"_type": "Name", "_fields": {"id": "test", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Name", "_fields": {"id": "file_desc", "ctx": {"_type": "Load", "_fields": {}}}}, {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "file", "value": {"_type": "Name", "_fields": {"id": "field_desc", "ctx": {"_type": "Load", "_fields": {}}}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "assertEqual", "value": {"_type": "Name", "_fields": {"id": "test", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}], "name": "CheckField", "returns": null, "type_params": [], "type_comment": null, "decorator_list": []}}], "name": "StringField", "bases": [{"_type": "Name", "_fields": {"id": "object", "ctx": {"_type": "Load", "_fields": {}}}}], "keywords": [], "type_params": [], "decorator_list": []}}], "type_ignores": []}}
class StringField(object): def __init__(self, number, default_value): self.number = number self.default_value = default_value def CheckField(self, test, msg_desc, name, index, file_desc): field_desc = msg_desc.fields_by_name[name] test.assertEqual(name, field_desc.name) expected_field_full_name = '.'.join([msg_desc.full_name, name]) test.assertEqual(expected_field_full_name, field_desc.full_name) test.assertEqual(index, field_desc.index) test.assertEqual(self.number, field_desc.number) test.assertEqual(descriptor.FieldDescriptor.TYPE_STRING, field_desc.type) test.assertEqual(descriptor.FieldDescriptor.CPPTYPE_STRING, field_desc.cpp_type) test.assertTrue(field_desc.has_default_value) test.assertEqual(self.default_value, field_desc.default_value) test.assertEqual(file_desc, field_desc.file)
14,184
[ 0.02492458187043667, 0.01620766706764698, 0.01837017387151718, -0.019975336268544197, -0.0037035744171589613, 0.004765321500599384, 0.009552937000989914, -0.014713974669575691, 0.004573036450892687, 0.0529257208108902, 0.030966229736804962, 0.0036617734003812075, 0.037877339869737625, -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": "test", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "msg_desc", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "name", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "index", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "file_desc", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}}, "body": [{"_type": "Assign", "_fields": {"value": {"_type": "Subscript", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "slice": {"_type": "Name", "_fields": {"id": "name", "ctx": {"_type": "Load", "_fields": {}}}}, "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "extensions_by_name", "value": {"_type": "Name", "_fields": {"id": "msg_desc", "ctx": {"_type": "Load", "_fields": {}}}}}}}}, "targets": [{"_type": "Name", "_fields": {"id": "field_desc", "ctx": {"_type": "Store", "_fields": {}}}}], "type_comment": null}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Name", "_fields": {"id": "name", "ctx": {"_type": "Load", "_fields": {}}}}, {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "name", "value": {"_type": "Name", "_fields": {"id": "field_desc", "ctx": {"_type": "Load", "_fields": {}}}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "assertEqual", "value": {"_type": "Name", "_fields": {"id": "test", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "List", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "elts": [{"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "full_name", "value": {"_type": "Name", "_fields": {"id": "msg_desc", "ctx": {"_type": "Load", "_fields": {}}}}}}, {"_type": "Name", "_fields": {"id": "name", "ctx": {"_type": "Load", "_fields": {}}}}]}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "join", "value": {"_type": "Constant", "_fields": {"kind": null, "value": "."}}}}, "keywords": []}}, "targets": [{"_type": "Name", "_fields": {"id": "expected_field_full_name", "ctx": {"_type": "Store", "_fields": {}}}}], "type_comment": null}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Name", "_fields": {"id": "expected_field_full_name", "ctx": {"_type": "Load", "_fields": {}}}}, {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "full_name", "value": {"_type": "Name", "_fields": {"id": "field_desc", "ctx": {"_type": "Load", "_fields": {}}}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "assertEqual", "value": {"_type": "Name", "_fields": {"id": "test", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "number", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}, {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "number", "value": {"_type": "Name", "_fields": {"id": "field_desc", "ctx": {"_type": "Load", "_fields": {}}}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "assertEqual", "value": {"_type": "Name", "_fields": {"id": "test", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Name", "_fields": {"id": "index", "ctx": {"_type": "Load", "_fields": {}}}}, {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "index", "value": {"_type": "Name", "_fields": {"id": "field_desc", "ctx": {"_type": "Load", "_fields": {}}}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "assertEqual", "value": {"_type": "Name", "_fields": {"id": "test", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "TYPE_MESSAGE", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "FieldDescriptor", "value": {"_type": "Name", "_fields": {"id": "descriptor", "ctx": {"_type": "Load", "_fields": {}}}}}}}}, {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "type", "value": {"_type": "Name", "_fields": {"id": "field_desc", "ctx": {"_type": "Load", "_fields": {}}}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "assertEqual", "value": {"_type": "Name", "_fields": {"id": "test", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "CPPTYPE_MESSAGE", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "FieldDescriptor", "value": {"_type": "Name", "_fields": {"id": "descriptor", "ctx": {"_type": "Load", "_fields": {}}}}}}}}, {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "cpp_type", "value": {"_type": "Name", "_fields": {"id": "field_desc", "ctx": {"_type": "Load", "_fields": {}}}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "assertEqual", "value": {"_type": "Name", "_fields": {"id": "test", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "has_default_value", "value": {"_type": "Name", "_fields": {"id": "field_desc", "ctx": {"_type": "Load", "_fields": {}}}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "assertFalse", "value": {"_type": "Name", "_fields": {"id": "test", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "is_extension", "value": {"_type": "Name", "_fields": {"id": "field_desc", "ctx": {"_type": "Load", "_fields": {}}}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "assertTrue", "value": {"_type": "Name", "_fields": {"id": "test", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Name", "_fields": {"id": "msg_desc", "ctx": {"_type": "Load", "_fields": {}}}}, {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "extension_scope", "value": {"_type": "Name", "_fields": {"id": "field_desc", "ctx": {"_type": "Load", "_fields": {}}}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "assertEqual", "value": {"_type": "Name", "_fields": {"id": "test", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Name", "_fields": {"id": "msg_desc", "ctx": {"_type": "Load", "_fields": {}}}}, {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "message_type", "value": {"_type": "Name", "_fields": {"id": "field_desc", "ctx": {"_type": "Load", "_fields": {}}}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "assertEqual", "value": {"_type": "Name", "_fields": {"id": "test", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "extended_type", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}, {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "name", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "containing_type", "value": {"_type": "Name", "_fields": {"id": "field_desc", "ctx": {"_type": "Load", "_fields": {}}}}}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "assertEqual", "value": {"_type": "Name", "_fields": {"id": "test", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Name", "_fields": {"id": "file_desc", "ctx": {"_type": "Load", "_fields": {}}}}, {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "file", "value": {"_type": "Name", "_fields": {"id": "field_desc", "ctx": {"_type": "Load", "_fields": {}}}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "assertEqual", "value": {"_type": "Name", "_fields": {"id": "test", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}], "name": "CheckField", "returns": null, "type_params": [], "type_comment": null, "decorator_list": []}}], "type_ignores": []}}
def CheckField(self, test, msg_desc, name, index, file_desc): field_desc = msg_desc.extensions_by_name[name] test.assertEqual(name, field_desc.name) expected_field_full_name = '.'.join([msg_desc.full_name, name]) test.assertEqual(expected_field_full_name, field_desc.full_name) test.assertEqual(self.number, field_desc.number) test.assertEqual(index, field_desc.index) test.assertEqual(descriptor.FieldDescriptor.TYPE_MESSAGE, field_desc.type) test.assertEqual(descriptor.FieldDescriptor.CPPTYPE_MESSAGE, field_desc.cpp_type) test.assertFalse(field_desc.has_default_value) test.assertTrue(field_desc.is_extension) test.assertEqual(msg_desc, field_desc.extension_scope) test.assertEqual(msg_desc, field_desc.message_type) test.assertEqual(self.extended_type, field_desc.containing_type.name) test.assertEqual(file_desc, field_desc.file)
14,185
[ -0.006111219525337219, 0.0034811822697520256, 0.012937400490045547, -0.016466815024614334, -0.010338571853935719, 0.016307935118675232, 0.010826561599969864, -0.019587678834795952, -0.007456028368324041, 0.04146777465939522, 0.027055056765675545, -0.02360508218407631, 0.03629281371831894, ...
9
{"_type": "Module", "_fields": {"body": [{"_type": "ClassDef", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "number", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "extended_type", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}}, "body": [{"_type": "Assign", "_fields": {"value": {"_type": "Name", "_fields": {"id": "number", "ctx": {"_type": "Load", "_fields": {}}}}, "targets": [{"_type": "Attribute", "_fields": {"ctx": {"_type": "Store", "_fields": {}}, "attr": "number", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}], "type_comment": null}}, {"_type": "Assign", "_fields": {"value": {"_type": "Name", "_fields": {"id": "extended_type", "ctx": {"_type": "Load", "_fields": {}}}}, "targets": [{"_type": "Attribute", "_fields": {"ctx": {"_type": "Store", "_fields": {}}, "attr": "extended_type", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}], "type_comment": null}}], "name": "__init__", "returns": null, "type_params": [], "type_comment": null, "decorator_list": []}}, {"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "test", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "msg_desc", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "name", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "index", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "file_desc", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}}, "body": [{"_type": "Assign", "_fields": {"value": {"_type": "Subscript", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "slice": {"_type": "Name", "_fields": {"id": "name", "ctx": {"_type": "Load", "_fields": {}}}}, "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "extensions_by_name", "value": {"_type": "Name", "_fields": {"id": "msg_desc", "ctx": {"_type": "Load", "_fields": {}}}}}}}}, "targets": [{"_type": "Name", "_fields": {"id": "field_desc", "ctx": {"_type": "Store", "_fields": {}}}}], "type_comment": null}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Name", "_fields": {"id": "name", "ctx": {"_type": "Load", "_fields": {}}}}, {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "name", "value": {"_type": "Name", "_fields": {"id": "field_desc", "ctx": {"_type": "Load", "_fields": {}}}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "assertEqual", "value": {"_type": "Name", "_fields": {"id": "test", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "List", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "elts": [{"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "full_name", "value": {"_type": "Name", "_fields": {"id": "msg_desc", "ctx": {"_type": "Load", "_fields": {}}}}}}, {"_type": "Name", "_fields": {"id": "name", "ctx": {"_type": "Load", "_fields": {}}}}]}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "join", "value": {"_type": "Constant", "_fields": {"kind": null, "value": "."}}}}, "keywords": []}}, "targets": [{"_type": "Name", "_fields": {"id": "expected_field_full_name", "ctx": {"_type": "Store", "_fields": {}}}}], "type_comment": null}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Name", "_fields": {"id": "expected_field_full_name", "ctx": {"_type": "Load", "_fields": {}}}}, {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "full_name", "value": {"_type": "Name", "_fields": {"id": "field_desc", "ctx": {"_type": "Load", "_fields": {}}}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "assertEqual", "value": {"_type": "Name", "_fields": {"id": "test", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "number", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}, {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "number", "value": {"_type": "Name", "_fields": {"id": "field_desc", "ctx": {"_type": "Load", "_fields": {}}}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "assertEqual", "value": {"_type": "Name", "_fields": {"id": "test", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Name", "_fields": {"id": "index", "ctx": {"_type": "Load", "_fields": {}}}}, {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "index", "value": {"_type": "Name", "_fields": {"id": "field_desc", "ctx": {"_type": "Load", "_fields": {}}}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "assertEqual", "value": {"_type": "Name", "_fields": {"id": "test", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "TYPE_MESSAGE", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "FieldDescriptor", "value": {"_type": "Name", "_fields": {"id": "descriptor", "ctx": {"_type": "Load", "_fields": {}}}}}}}}, {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "type", "value": {"_type": "Name", "_fields": {"id": "field_desc", "ctx": {"_type": "Load", "_fields": {}}}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "assertEqual", "value": {"_type": "Name", "_fields": {"id": "test", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "CPPTYPE_MESSAGE", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "FieldDescriptor", "value": {"_type": "Name", "_fields": {"id": "descriptor", "ctx": {"_type": "Load", "_fields": {}}}}}}}}, {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "cpp_type", "value": {"_type": "Name", "_fields": {"id": "field_desc", "ctx": {"_type": "Load", "_fields": {}}}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "assertEqual", "value": {"_type": "Name", "_fields": {"id": "test", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "has_default_value", "value": {"_type": "Name", "_fields": {"id": "field_desc", "ctx": {"_type": "Load", "_fields": {}}}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "assertFalse", "value": {"_type": "Name", "_fields": {"id": "test", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "is_extension", "value": {"_type": "Name", "_fields": {"id": "field_desc", "ctx": {"_type": "Load", "_fields": {}}}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "assertTrue", "value": {"_type": "Name", "_fields": {"id": "test", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Name", "_fields": {"id": "msg_desc", "ctx": {"_type": "Load", "_fields": {}}}}, {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "extension_scope", "value": {"_type": "Name", "_fields": {"id": "field_desc", "ctx": {"_type": "Load", "_fields": {}}}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "assertEqual", "value": {"_type": "Name", "_fields": {"id": "test", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Name", "_fields": {"id": "msg_desc", "ctx": {"_type": "Load", "_fields": {}}}}, {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "message_type", "value": {"_type": "Name", "_fields": {"id": "field_desc", "ctx": {"_type": "Load", "_fields": {}}}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "assertEqual", "value": {"_type": "Name", "_fields": {"id": "test", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "extended_type", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}, {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "name", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "containing_type", "value": {"_type": "Name", "_fields": {"id": "field_desc", "ctx": {"_type": "Load", "_fields": {}}}}}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "assertEqual", "value": {"_type": "Name", "_fields": {"id": "test", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Name", "_fields": {"id": "file_desc", "ctx": {"_type": "Load", "_fields": {}}}}, {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "file", "value": {"_type": "Name", "_fields": {"id": "field_desc", "ctx": {"_type": "Load", "_fields": {}}}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "assertEqual", "value": {"_type": "Name", "_fields": {"id": "test", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}], "name": "CheckField", "returns": null, "type_params": [], "type_comment": null, "decorator_list": []}}], "name": "ExtensionField", "bases": [{"_type": "Name", "_fields": {"id": "object", "ctx": {"_type": "Load", "_fields": {}}}}], "keywords": [], "type_params": [], "decorator_list": []}}], "type_ignores": []}}
class ExtensionField(object): def __init__(self, number, extended_type): self.number = number self.extended_type = extended_type def CheckField(self, test, msg_desc, name, index, file_desc): field_desc = msg_desc.extensions_by_name[name] test.assertEqual(name, field_desc.name) expected_field_full_name = '.'.join([msg_desc.full_name, name]) test.assertEqual(expected_field_full_name, field_desc.full_name) test.assertEqual(self.number, field_desc.number) test.assertEqual(index, field_desc.index) test.assertEqual(descriptor.FieldDescriptor.TYPE_MESSAGE, field_desc.type) test.assertEqual(descriptor.FieldDescriptor.CPPTYPE_MESSAGE, field_desc.cpp_type) test.assertFalse(field_desc.has_default_value) test.assertTrue(field_desc.is_extension) test.assertEqual(msg_desc, field_desc.extension_scope) test.assertEqual(msg_desc, field_desc.message_type) test.assertEqual(self.extended_type, field_desc.containing_type.name) test.assertEqual(file_desc, field_desc.file)
14,186
[ 0.004193737171590328, -0.03418062627315521, 0.054242637008428574, -0.018157698214054108, 0.03505394235253334, -0.027776306495070457, -0.007271570153534412, 0.026951508596539497, 0.021990586072206497, 0.008854455314576626, 0.01077089924365282, -0.025350427255034447, 0.0030975432600826025, 0...
10
{"_type": "Module", "_fields": {"body": [{"_type": "ClassDef", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "prefix", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}}, "body": [{"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"args": [], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "DescriptorPool", "value": {"_type": "Name", "_fields": {"id": "descriptor_pool", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}, "targets": [{"_type": "Name", "_fields": {"id": "pool", "ctx": {"_type": "Store", "_fields": {}}}}], "type_comment": null}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "DESCRIPTOR", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "TestAllTypes", "value": {"_type": "Name", "_fields": {"id": "unittest_pb2", "ctx": {"_type": "Load", "_fields": {}}}}}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "AddDescriptor", "value": {"_type": "Name", "_fields": {"id": "pool", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"kind": null, "value": "protobuf_unittest.TestAllTypes"}}, {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "full_name", "value": {"_type": "Call", "_fields": {"args": [{"_type": "BinOp", "_fields": {"op": {"_type": "Add", "_fields": {}}, "left": {"_type": "Name", "_fields": {"id": "prefix", "ctx": {"_type": "Load", "_fields": {}}}}, "right": {"_type": "Constant", "_fields": {"kind": null, "value": "protobuf_unittest.TestAllTypes"}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "FindMessageTypeByName", "value": {"_type": "Name", "_fields": {"id": "pool", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "assertEqual", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "With", "_fields": {"body": [{"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "BinOp", "_fields": {"op": {"_type": "Add", "_fields": {}}, "left": {"_type": "Name", "_fields": {"id": "prefix", "ctx": {"_type": "Load", "_fields": {}}}}, "right": {"_type": "Constant", "_fields": {"kind": null, "value": "protobuf_unittest.TestAllTypes.NestedMessage"}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "FindMessageTypeByName", "value": {"_type": "Name", "_fields": {"id": "pool", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}], "items": [{"_type": "withitem", "_fields": {"context_expr": {"_type": "Call", "_fields": {"args": [{"_type": "Name", "_fields": {"id": "KeyError", "ctx": {"_type": "Load", "_fields": {}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "assertRaises", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}, "optional_vars": null}}], "type_comment": null}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "DESCRIPTOR", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "NestedMessage", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "TestAllTypes", "value": {"_type": "Name", "_fields": {"id": "unittest_pb2", "ctx": {"_type": "Load", "_fields": {}}}}}}}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "AddDescriptor", "value": {"_type": "Name", "_fields": {"id": "pool", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"kind": null, "value": "protobuf_unittest.TestAllTypes.NestedMessage"}}, {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "full_name", "value": {"_type": "Call", "_fields": {"args": [{"_type": "BinOp", "_fields": {"op": {"_type": "Add", "_fields": {}}, "left": {"_type": "Name", "_fields": {"id": "prefix", "ctx": {"_type": "Load", "_fields": {}}}}, "right": {"_type": "Constant", "_fields": {"kind": null, "value": "protobuf_unittest.TestAllTypes.NestedMessage"}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "FindMessageTypeByName", "value": {"_type": "Name", "_fields": {"id": "pool", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "assertEqual", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"kind": null, "value": "google/protobuf/unittest.proto"}}, {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "name", "value": {"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"kind": null, "value": "google/protobuf/unittest.proto"}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "FindFileByName", "value": {"_type": "Name", "_fields": {"id": "pool", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "assertEqual", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"kind": null, "value": "google/protobuf/unittest.proto"}}, {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "name", "value": {"_type": "Call", "_fields": {"args": [{"_type": "BinOp", "_fields": {"op": {"_type": "Add", "_fields": {}}, "left": {"_type": "Name", "_fields": {"id": "prefix", "ctx": {"_type": "Load", "_fields": {}}}}, "right": {"_type": "Constant", "_fields": {"kind": null, "value": "protobuf_unittest.TestAllTypes.NestedMessage"}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "FindFileContainingSymbol", "value": {"_type": "Name", "_fields": {"id": "pool", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "assertEqual", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}], "name": "_TestMessage", "returns": null, "type_params": [], "type_comment": null, "decorator_list": []}}, {"_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": []}}, "body": [{"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"kind": null, "value": ""}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "_TestMessage", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"kind": null, "value": "."}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "_TestMessage", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}], "name": "testMessage", "returns": null, "type_params": [], "type_comment": null, "decorator_list": [{"_type": "Call", "_fields": {"args": [{"_type": "Compare", "_fields": {"ops": [{"_type": "Eq", "_fields": {}}], "left": {"_type": "Call", "_fields": {"args": [], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "Type", "value": {"_type": "Name", "_fields": {"id": "api_implementation", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}, "comparators": [{"_type": "Constant", "_fields": {"kind": null, "value": "cpp"}}]}}, {"_type": "Constant", "_fields": {"kind": null, "value": "With the cpp implementation, Add() must be called first"}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "skipIf", "value": {"_type": "Name", "_fields": {"id": "unittest", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}]}}, {"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "prefix", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}}, "body": [{"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"args": [], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "DescriptorPool", "value": {"_type": "Name", "_fields": {"id": "descriptor_pool", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}, "targets": [{"_type": "Name", "_fields": {"id": "pool", "ctx": {"_type": "Store", "_fields": {}}}}], "type_comment": null}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "DESCRIPTOR", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "ForeignEnum", "value": {"_type": "Name", "_fields": {"id": "unittest_pb2", "ctx": {"_type": "Load", "_fields": {}}}}}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "AddEnumDescriptor", "value": {"_type": "Name", "_fields": {"id": "pool", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"kind": null, "value": "protobuf_unittest.ForeignEnum"}}, {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "full_name", "value": {"_type": "Call", "_fields": {"args": [{"_type": "BinOp", "_fields": {"op": {"_type": "Add", "_fields": {}}, "left": {"_type": "Name", "_fields": {"id": "prefix", "ctx": {"_type": "Load", "_fields": {}}}}, "right": {"_type": "Constant", "_fields": {"kind": null, "value": "protobuf_unittest.ForeignEnum"}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "FindEnumTypeByName", "value": {"_type": "Name", "_fields": {"id": "pool", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "assertEqual", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "With", "_fields": {"body": [{"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "BinOp", "_fields": {"op": {"_type": "Add", "_fields": {}}, "left": {"_type": "Name", "_fields": {"id": "prefix", "ctx": {"_type": "Load", "_fields": {}}}}, "right": {"_type": "Constant", "_fields": {"kind": null, "value": "protobuf_unittest.ForeignEnum.NestedEnum"}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "FindEnumTypeByName", "value": {"_type": "Name", "_fields": {"id": "pool", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}], "items": [{"_type": "withitem", "_fields": {"context_expr": {"_type": "Call", "_fields": {"args": [{"_type": "Name", "_fields": {"id": "KeyError", "ctx": {"_type": "Load", "_fields": {}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "assertRaises", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}, "optional_vars": null}}], "type_comment": null}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "DESCRIPTOR", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "NestedEnum", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "TestAllTypes", "value": {"_type": "Name", "_fields": {"id": "unittest_pb2", "ctx": {"_type": "Load", "_fields": {}}}}}}}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "AddEnumDescriptor", "value": {"_type": "Name", "_fields": {"id": "pool", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"kind": null, "value": "protobuf_unittest.TestAllTypes.NestedEnum"}}, {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "full_name", "value": {"_type": "Call", "_fields": {"args": [{"_type": "BinOp", "_fields": {"op": {"_type": "Add", "_fields": {}}, "left": {"_type": "Name", "_fields": {"id": "prefix", "ctx": {"_type": "Load", "_fields": {}}}}, "right": {"_type": "Constant", "_fields": {"kind": null, "value": "protobuf_unittest.TestAllTypes.NestedEnum"}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "FindEnumTypeByName", "value": {"_type": "Name", "_fields": {"id": "pool", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "assertEqual", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"kind": null, "value": "google/protobuf/unittest.proto"}}, {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "name", "value": {"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"kind": null, "value": "google/protobuf/unittest.proto"}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "FindFileByName", "value": {"_type": "Name", "_fields": {"id": "pool", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "assertEqual", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"kind": null, "value": "google/protobuf/unittest.proto"}}, {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "name", "value": {"_type": "Call", "_fields": {"args": [{"_type": "BinOp", "_fields": {"op": {"_type": "Add", "_fields": {}}, "left": {"_type": "Name", "_fields": {"id": "prefix", "ctx": {"_type": "Load", "_fields": {}}}}, "right": {"_type": "Constant", "_fields": {"kind": null, "value": "protobuf_unittest.TestAllTypes.NestedEnum"}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "FindFileContainingSymbol", "value": {"_type": "Name", "_fields": {"id": "pool", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "assertEqual", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}], "name": "_TestEnum", "returns": null, "type_params": [], "type_comment": null, "decorator_list": []}}, {"_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": []}}, "body": [{"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"kind": null, "value": ""}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "_TestEnum", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"kind": null, "value": "."}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "_TestEnum", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}], "name": "testEnum", "returns": null, "type_params": [], "type_comment": null, "decorator_list": [{"_type": "Call", "_fields": {"args": [{"_type": "Compare", "_fields": {"ops": [{"_type": "Eq", "_fields": {}}], "left": {"_type": "Call", "_fields": {"args": [], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "Type", "value": {"_type": "Name", "_fields": {"id": "api_implementation", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}, "comparators": [{"_type": "Constant", "_fields": {"kind": null, "value": "cpp"}}]}}, {"_type": "Constant", "_fields": {"kind": null, "value": "With the cpp implementation, Add() must be called first"}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "skipIf", "value": {"_type": "Name", "_fields": {"id": "unittest", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}]}}, {"_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": []}}, "body": [{"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"args": [], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "DescriptorPool", "value": {"_type": "Name", "_fields": {"id": "descriptor_pool", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}, "targets": [{"_type": "Name", "_fields": {"id": "pool", "ctx": {"_type": "Store", "_fields": {}}}}], "type_comment": null}}, {"_type": "With", "_fields": {"body": [{"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"kind": null, "value": "protobuf_unittest.TestService"}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "FindServiceByName", "value": {"_type": "Name", "_fields": {"id": "pool", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}], "items": [{"_type": "withitem", "_fields": {"context_expr": {"_type": "Call", "_fields": {"args": [{"_type": "Name", "_fields": {"id": "KeyError", "ctx": {"_type": "Load", "_fields": {}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "assertRaises", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}, "optional_vars": null}}], "type_comment": null}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "_TESTSERVICE", "value": {"_type": "Name", "_fields": {"id": "unittest_pb2", "ctx": {"_type": "Load", "_fields": {}}}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "AddServiceDescriptor", "value": {"_type": "Name", "_fields": {"id": "pool", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"kind": null, "value": "protobuf_unittest.TestService"}}, {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "full_name", "value": {"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"kind": null, "value": "protobuf_unittest.TestService"}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "FindServiceByName", "value": {"_type": "Name", "_fields": {"id": "pool", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "assertEqual", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}], "name": "testService", "returns": null, "type_params": [], "type_comment": null, "decorator_list": [{"_type": "Call", "_fields": {"args": [{"_type": "Compare", "_fields": {"ops": [{"_type": "Eq", "_fields": {}}], "left": {"_type": "Call", "_fields": {"args": [], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "Type", "value": {"_type": "Name", "_fields": {"id": "api_implementation", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}, "comparators": [{"_type": "Constant", "_fields": {"kind": null, "value": "cpp"}}]}}, {"_type": "Constant", "_fields": {"kind": null, "value": "With the cpp implementation, Add() must be called first"}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "skipIf", "value": {"_type": "Name", "_fields": {"id": "unittest", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}]}}, {"_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": []}}, "body": [{"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"args": [], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "DescriptorPool", "value": {"_type": "Name", "_fields": {"id": "descriptor_pool", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}, "targets": [{"_type": "Name", "_fields": {"id": "pool", "ctx": {"_type": "Store", "_fields": {}}}}], "type_comment": null}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "DESCRIPTOR", "value": {"_type": "Name", "_fields": {"id": "unittest_pb2", "ctx": {"_type": "Load", "_fields": {}}}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "AddFileDescriptor", "value": {"_type": "Name", "_fields": {"id": "pool", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"kind": null, "value": "google/protobuf/unittest.proto"}}, {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "name", "value": {"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"kind": null, "value": "google/protobuf/unittest.proto"}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "FindFileByName", "value": {"_type": "Name", "_fields": {"id": "pool", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "assertEqual", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "With", "_fields": {"body": [{"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"kind": null, "value": "protobuf_unittest.TestAllTypes"}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "FindFileContainingSymbol", "value": {"_type": "Name", "_fields": {"id": "pool", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}], "items": [{"_type": "withitem", "_fields": {"context_expr": {"_type": "Call", "_fields": {"args": [{"_type": "Name", "_fields": {"id": "KeyError", "ctx": {"_type": "Load", "_fields": {}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "assertRaises", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}, "optional_vars": null}}], "type_comment": null}}], "name": "testFile", "returns": null, "type_params": [], "type_comment": null, "decorator_list": [{"_type": "Call", "_fields": {"args": [{"_type": "Compare", "_fields": {"ops": [{"_type": "Eq", "_fields": {}}], "left": {"_type": "Call", "_fields": {"args": [], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "Type", "value": {"_type": "Name", "_fields": {"id": "api_implementation", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}, "comparators": [{"_type": "Constant", "_fields": {"kind": null, "value": "cpp"}}]}}, {"_type": "Constant", "_fields": {"kind": null, "value": "With the cpp implementation, Add() must be called first"}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "skipIf", "value": {"_type": "Name", "_fields": {"id": "unittest", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}]}}, {"_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": []}}, "body": [{"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"args": [], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "DescriptorPool", "value": {"_type": "Name", "_fields": {"id": "descriptor_pool", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}, "targets": [{"_type": "Name", "_fields": {"id": "pool", "ctx": {"_type": "Store", "_fields": {}}}}], "type_comment": null}}, {"_type": "Assign", "_fields": {"value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "name", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "DESCRIPTOR", "value": {"_type": "Name", "_fields": {"id": "descriptor_pb2", "ctx": {"_type": "Load", "_fields": {}}}}}}}}, "targets": [{"_type": "Name", "_fields": {"id": "proto_file_name", "ctx": {"_type": "Store", "_fields": {}}}}], "type_comment": null}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Name", "_fields": {"id": "KeyError", "ctx": {"_type": "Load", "_fields": {}}}}, {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "FindFileByName", "value": {"_type": "Name", "_fields": {"id": "pool", "ctx": {"_type": "Load", "_fields": {}}}}}}, {"_type": "Name", "_fields": {"id": "proto_file_name", "ctx": {"_type": "Load", "_fields": {}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "assertRaises", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"args": [], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "FileDescriptorProto", "value": {"_type": "Name", "_fields": {"id": "descriptor_pb2", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}, "targets": [{"_type": "Name", "_fields": {"id": "file_descriptor", "ctx": {"_type": "Store", "_fields": {}}}}], "type_comment": null}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Name", "_fields": {"id": "file_descriptor", "ctx": {"_type": "Load", "_fields": {}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "CopyToProto", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "DESCRIPTOR", "value": {"_type": "Name", "_fields": {"id": "descriptor_pb2", "ctx": {"_type": "Load", "_fields": {}}}}}}}}, "keywords": []}}}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Name", "_fields": {"id": "file_descriptor", "ctx": {"_type": "Load", "_fields": {}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "Add", "value": {"_type": "Name", "_fields": {"id": "pool", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Call", "_fields": {"args": [{"_type": "Name", "_fields": {"id": "proto_file_name", "ctx": {"_type": "Load", "_fields": {}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "FindFileByName", "value": {"_type": "Name", "_fields": {"id": "pool", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "assertTrue", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}], "name": "testEmptyDescriptorPool", "returns": null, "type_params": [], "type_comment": null, "decorator_list": []}}, {"_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": []}}, "body": [{"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"args": [], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "DescriptorPool", "value": {"_type": "Name", "_fields": {"id": "descriptor_pool", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}, "targets": [{"_type": "Name", "_fields": {"id": "pool", "ctx": {"_type": "Store", "_fields": {}}}}], "type_comment": null}}, {"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"args": [], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "FileDescriptorProto", "value": {"_type": "Name", "_fields": {"id": "descriptor_pb2", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": [{"_type": "keyword", "_fields": {"arg": "name", "value": {"_type": "Constant", "_fields": {"kind": null, "value": "some/file.proto"}}}}, {"_type": "keyword", "_fields": {"arg": "package", "value": {"_type": "Constant", "_fields": {"kind": null, "value": "package"}}}}]}}, "targets": [{"_type": "Name", "_fields": {"id": "file_desc", "ctx": {"_type": "Store", "_fields": {}}}}], "type_comment": null}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "add", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "message_type", "value": {"_type": "Name", "_fields": {"id": "file_desc", "ctx": {"_type": "Load", "_fields": {}}}}}}}}, "keywords": [{"_type": "keyword", "_fields": {"arg": "name", "value": {"_type": "Constant", "_fields": {"kind": null, "value": "Message"}}}}]}}}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Name", "_fields": {"id": "file_desc", "ctx": {"_type": "Load", "_fields": {}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "Add", "value": {"_type": "Name", "_fields": {"id": "pool", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "name", "value": {"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"kind": null, "value": "some/file.proto"}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "FindFileByName", "value": {"_type": "Name", "_fields": {"id": "pool", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Constant", "_fields": {"kind": null, "value": "some/file.proto"}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "assertEqual", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "name", "value": {"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"kind": null, "value": "package.Message"}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "FindMessageTypeByName", "value": {"_type": "Name", "_fields": {"id": "pool", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Constant", "_fields": {"kind": null, "value": "Message"}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "assertEqual", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"args": [], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "FileDescriptorProto", "value": {"_type": "Name", "_fields": {"id": "descriptor_pb2", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": [{"_type": "keyword", "_fields": {"arg": "name", "value": {"_type": "Constant", "_fields": {"kind": null, "value": "some/filename/container.proto"}}}}]}}, "targets": [{"_type": "Name", "_fields": {"id": "file_proto", "ctx": {"_type": "Store", "_fields": {}}}}], "type_comment": null}}, {"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"args": [], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "add", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "message_type", "value": {"_type": "Name", "_fields": {"id": "file_proto", "ctx": {"_type": "Load", "_fields": {}}}}}}}}, "keywords": [{"_type": "keyword", "_fields": {"arg": "name", "value": {"_type": "Constant", "_fields": {"kind": null, "value": "TopMessage"}}}}]}}, "targets": [{"_type": "Name", "_fields": {"id": "message_proto", "ctx": {"_type": "Store", "_fields": {}}}}], "type_comment": null}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "add", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "field", "value": {"_type": "Name", "_fields": {"id": "message_proto", "ctx": {"_type": "Load", "_fields": {}}}}}}}}, "keywords": [{"_type": "keyword", "_fields": {"arg": "name", "value": {"_type": "Constant", "_fields": {"kind": null, "value": "bb"}}}}, {"_type": "keyword", "_fields": {"arg": "number", "value": {"_type": "Constant", "_fields": {"kind": null, "value": 1}}}}, {"_type": "keyword", "_fields": {"arg": "type", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "TYPE_INT32", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "FieldDescriptorProto", "value": {"_type": "Name", "_fields": {"id": "descriptor_pb2", "ctx": {"_type": "Load", "_fields": {}}}}}}}}}}, {"_type": "keyword", "_fields": {"arg": "label", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "LABEL_OPTIONAL", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "FieldDescriptorProto", "value": {"_type": "Name", "_fields": {"id": "descriptor_pb2", "ctx": {"_type": "Load", "_fields": {}}}}}}}}}}]}}}}, {"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"args": [], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "add", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "enum_type", "value": {"_type": "Name", "_fields": {"id": "file_proto", "ctx": {"_type": "Load", "_fields": {}}}}}}}}, "keywords": [{"_type": "keyword", "_fields": {"arg": "name", "value": {"_type": "Constant", "_fields": {"kind": null, "value": "TopEnum"}}}}]}}, "targets": [{"_type": "Name", "_fields": {"id": "enum_proto", "ctx": {"_type": "Store", "_fields": {}}}}], "type_comment": null}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "add", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "value", "value": {"_type": "Name", "_fields": {"id": "enum_proto", "ctx": {"_type": "Load", "_fields": {}}}}}}}}, "keywords": [{"_type": "keyword", "_fields": {"arg": "name", "value": {"_type": "Constant", "_fields": {"kind": null, "value": "FOREIGN_FOO"}}}}, {"_type": "keyword", "_fields": {"arg": "number", "value": {"_type": "Constant", "_fields": {"kind": null, "value": 4}}}}]}}}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "add", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "service", "value": {"_type": "Name", "_fields": {"id": "file_proto", "ctx": {"_type": "Load", "_fields": {}}}}}}}}, "keywords": [{"_type": "keyword", "_fields": {"arg": "name", "value": {"_type": "Constant", "_fields": {"kind": null, "value": "TopService"}}}}]}}}}, {"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"args": [], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "DescriptorPool", "value": {"_type": "Name", "_fields": {"id": "descriptor_pool", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}, "targets": [{"_type": "Name", "_fields": {"id": "pool", "ctx": {"_type": "Store", "_fields": {}}}}], "type_comment": null}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Name", "_fields": {"id": "file_proto", "ctx": {"_type": "Load", "_fields": {}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "Add", "value": {"_type": "Name", "_fields": {"id": "pool", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"kind": null, "value": "TopMessage"}}, {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "name", "value": {"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"kind": null, "value": "TopMessage"}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "FindMessageTypeByName", "value": {"_type": "Name", "_fields": {"id": "pool", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "assertEqual", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"kind": null, "value": "TopEnum"}}, {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "name", "value": {"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"kind": null, "value": "TopEnum"}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "FindEnumTypeByName", "value": {"_type": "Name", "_fields": {"id": "pool", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "assertEqual", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"kind": null, "value": "TopService"}}, {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "name", "value": {"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"kind": null, "value": "TopService"}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "FindServiceByName", "value": {"_type": "Name", "_fields": {"id": "pool", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "assertEqual", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}], "name": "testCustomDescriptorPool", "returns": null, "type_params": [], "type_comment": null, "decorator_list": []}}, {"_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": []}}, "body": [{"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"args": [], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "DescriptorPool", "value": {"_type": "Name", "_fields": {"id": "descriptor_pool", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}, "targets": [{"_type": "Name", "_fields": {"id": "pool", "ctx": {"_type": "Store", "_fields": {}}}}], "type_comment": null}}, {"_type": "Assign", "_fields": {"value": {"_type": "Constant", "_fields": {"kind": null, "value": "file_descriptor_options_with_custom_descriptor_pool.proto"}}, "targets": [{"_type": "Name", "_fields": {"id": "file_name", "ctx": {"_type": "Store", "_fields": {}}}}], "type_comment": null}}, {"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"args": [], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "FileDescriptorProto", "value": {"_type": "Name", "_fields": {"id": "descriptor_pb2", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": [{"_type": "keyword", "_fields": {"arg": "name", "value": {"_type": "Name", "_fields": {"id": "file_name", "ctx": {"_type": "Load", "_fields": {}}}}}}]}}, "targets": [{"_type": "Name", "_fields": {"id": "file_descriptor_proto", "ctx": {"_type": "Store", "_fields": {}}}}], "type_comment": null}}, {"_type": "Assign", "_fields": {"value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "foo_options", "value": {"_type": "Name", "_fields": {"id": "file_options_test_pb2", "ctx": {"_type": "Load", "_fields": {}}}}}}, "targets": [{"_type": "Name", "_fields": {"id": "extension_id", "ctx": {"_type": "Store", "_fields": {}}}}], "type_comment": null}}, {"_type": "Assign", "_fields": {"value": {"_type": "Constant", "_fields": {"kind": null, "value": "foo"}}, "targets": [{"_type": "Attribute", "_fields": {"ctx": {"_type": "Store", "_fields": {}}, "attr": "foo_name", "value": {"_type": "Subscript", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "slice": {"_type": "Name", "_fields": {"id": "extension_id", "ctx": {"_type": "Load", "_fields": {}}}}, "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "Extensions", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "options", "value": {"_type": "Name", "_fields": {"id": "file_descriptor_proto", "ctx": {"_type": "Load", "_fields": {}}}}}}}}}}}}], "type_comment": null}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Name", "_fields": {"id": "file_descriptor_proto", "ctx": {"_type": "Load", "_fields": {}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "Add", "value": {"_type": "Name", "_fields": {"id": "pool", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Name", "_fields": {"id": "file_name", "ctx": {"_type": "Load", "_fields": {}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "FindFileByName", "value": {"_type": "Name", "_fields": {"id": "pool", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}, "targets": [{"_type": "Name", "_fields": {"id": "file_descriptor", "ctx": {"_type": "Store", "_fields": {}}}}], "type_comment": null}}, {"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"args": [], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "GetOptions", "value": {"_type": "Name", "_fields": {"id": "file_descriptor", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}, "targets": [{"_type": "Name", "_fields": {"id": "options", "ctx": {"_type": "Store", "_fields": {}}}}], "type_comment": null}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"kind": null, "value": "foo"}}, {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "foo_name", "value": {"_type": "Subscript", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "slice": {"_type": "Name", "_fields": {"id": "extension_id", "ctx": {"_type": "Load", "_fields": {}}}}, "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "Extensions", "value": {"_type": "Name", "_fields": {"id": "options", "ctx": {"_type": "Load", "_fields": {}}}}}}}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "assertEqual", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Name", "_fields": {"id": "options", "ctx": {"_type": "Load", "_fields": {}}}}, {"_type": "Call", "_fields": {"args": [], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "GetOptions", "value": {"_type": "Name", "_fields": {"id": "file_descriptor", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "assertIs", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}], "name": "testFileDescriptorOptionsWithCustomDescriptorPool", "returns": null, "type_params": [], "type_comment": null, "decorator_list": []}}, {"_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": []}}, "body": [{"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"args": [], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "DescriptorPool", "value": {"_type": "Name", "_fields": {"id": "descriptor_pool", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}, "targets": [{"_type": "Name", "_fields": {"id": "pool", "ctx": {"_type": "Store", "_fields": {}}}}], "type_comment": null}}, {"_type": "With", "_fields": {"body": [{"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"kind": null, "value": 0}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "AddDescriptor", "value": {"_type": "Name", "_fields": {"id": "pool", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}], "items": [{"_type": "withitem", "_fields": {"context_expr": {"_type": "Call", "_fields": {"args": [{"_type": "Name", "_fields": {"id": "TypeError", "ctx": {"_type": "Load", "_fields": {}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "assertRaises", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}, "optional_vars": null}}], "type_comment": null}}, {"_type": "With", "_fields": {"body": [{"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"kind": null, "value": 0}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "AddEnumDescriptor", "value": {"_type": "Name", "_fields": {"id": "pool", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}], "items": [{"_type": "withitem", "_fields": {"context_expr": {"_type": "Call", "_fields": {"args": [{"_type": "Name", "_fields": {"id": "TypeError", "ctx": {"_type": "Load", "_fields": {}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "assertRaises", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}, "optional_vars": null}}], "type_comment": null}}, {"_type": "With", "_fields": {"body": [{"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"kind": null, "value": 0}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "AddServiceDescriptor", "value": {"_type": "Name", "_fields": {"id": "pool", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}], "items": [{"_type": "withitem", "_fields": {"context_expr": {"_type": "Call", "_fields": {"args": [{"_type": "Name", "_fields": {"id": "TypeError", "ctx": {"_type": "Load", "_fields": {}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "assertRaises", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}, "optional_vars": null}}], "type_comment": null}}, {"_type": "With", "_fields": {"body": [{"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"kind": null, "value": 0}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "AddExtensionDescriptor", "value": {"_type": "Name", "_fields": {"id": "pool", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}], "items": [{"_type": "withitem", "_fields": {"context_expr": {"_type": "Call", "_fields": {"args": [{"_type": "Name", "_fields": {"id": "TypeError", "ctx": {"_type": "Load", "_fields": {}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "assertRaises", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}, "optional_vars": null}}], "type_comment": null}}, {"_type": "With", "_fields": {"body": [{"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"kind": null, "value": 0}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "AddFileDescriptor", "value": {"_type": "Name", "_fields": {"id": "pool", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}], "items": [{"_type": "withitem", "_fields": {"context_expr": {"_type": "Call", "_fields": {"args": [{"_type": "Name", "_fields": {"id": "TypeError", "ctx": {"_type": "Load", "_fields": {}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "assertRaises", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}, "optional_vars": null}}], "type_comment": null}}], "name": "testAddTypeError", "returns": null, "type_params": [], "type_comment": null, "decorator_list": []}}], "name": "AddDescriptorTest", "bases": [{"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "TestCase", "value": {"_type": "Name", "_fields": {"id": "unittest", "ctx": {"_type": "Load", "_fields": {}}}}}}], "keywords": [], "type_params": [], "decorator_list": []}}], "type_ignores": []}}
class AddDescriptorTest(unittest.TestCase): def _TestMessage(self, prefix): pool = descriptor_pool.DescriptorPool() pool.AddDescriptor(unittest_pb2.TestAllTypes.DESCRIPTOR) self.assertEqual( 'protobuf_unittest.TestAllTypes', pool.FindMessageTypeByName( prefix + 'protobuf_unittest.TestAllTypes').full_name) # AddDescriptor is not recursive. with self.assertRaises(KeyError): pool.FindMessageTypeByName( prefix + 'protobuf_unittest.TestAllTypes.NestedMessage') pool.AddDescriptor(unittest_pb2.TestAllTypes.NestedMessage.DESCRIPTOR) self.assertEqual( 'protobuf_unittest.TestAllTypes.NestedMessage', pool.FindMessageTypeByName( prefix + 'protobuf_unittest.TestAllTypes.NestedMessage').full_name) # Files are implicitly also indexed when messages are added. self.assertEqual( 'google/protobuf/unittest.proto', pool.FindFileByName( 'google/protobuf/unittest.proto').name) self.assertEqual( 'google/protobuf/unittest.proto', pool.FindFileContainingSymbol( prefix + 'protobuf_unittest.TestAllTypes.NestedMessage').name) @unittest.skipIf(api_implementation.Type() == 'cpp', 'With the cpp implementation, Add() must be called first') def testMessage(self): self._TestMessage('') self._TestMessage('.') def _TestEnum(self, prefix): pool = descriptor_pool.DescriptorPool() pool.AddEnumDescriptor(unittest_pb2.ForeignEnum.DESCRIPTOR) self.assertEqual( 'protobuf_unittest.ForeignEnum', pool.FindEnumTypeByName( prefix + 'protobuf_unittest.ForeignEnum').full_name) # AddEnumDescriptor is not recursive. with self.assertRaises(KeyError): pool.FindEnumTypeByName( prefix + 'protobuf_unittest.ForeignEnum.NestedEnum') pool.AddEnumDescriptor(unittest_pb2.TestAllTypes.NestedEnum.DESCRIPTOR) self.assertEqual( 'protobuf_unittest.TestAllTypes.NestedEnum', pool.FindEnumTypeByName( prefix + 'protobuf_unittest.TestAllTypes.NestedEnum').full_name) # Files are implicitly also indexed when enums are added. self.assertEqual( 'google/protobuf/unittest.proto', pool.FindFileByName( 'google/protobuf/unittest.proto').name) self.assertEqual( 'google/protobuf/unittest.proto', pool.FindFileContainingSymbol( prefix + 'protobuf_unittest.TestAllTypes.NestedEnum').name) @unittest.skipIf(api_implementation.Type() == 'cpp', 'With the cpp implementation, Add() must be called first') def testEnum(self): self._TestEnum('') self._TestEnum('.') @unittest.skipIf(api_implementation.Type() == 'cpp', 'With the cpp implementation, Add() must be called first') def testService(self): pool = descriptor_pool.DescriptorPool() with self.assertRaises(KeyError): pool.FindServiceByName('protobuf_unittest.TestService') pool.AddServiceDescriptor(unittest_pb2._TESTSERVICE) self.assertEqual( 'protobuf_unittest.TestService', pool.FindServiceByName('protobuf_unittest.TestService').full_name) @unittest.skipIf(api_implementation.Type() == 'cpp', 'With the cpp implementation, Add() must be called first') def testFile(self): pool = descriptor_pool.DescriptorPool() pool.AddFileDescriptor(unittest_pb2.DESCRIPTOR) self.assertEqual( 'google/protobuf/unittest.proto', pool.FindFileByName( 'google/protobuf/unittest.proto').name) # AddFileDescriptor is not recursive; messages and enums within files must # be explicitly registered. with self.assertRaises(KeyError): pool.FindFileContainingSymbol( 'protobuf_unittest.TestAllTypes') def testEmptyDescriptorPool(self): # Check that an empty DescriptorPool() contains no messages. pool = descriptor_pool.DescriptorPool() proto_file_name = descriptor_pb2.DESCRIPTOR.name self.assertRaises(KeyError, pool.FindFileByName, proto_file_name) # Add the above file to the pool file_descriptor = descriptor_pb2.FileDescriptorProto() descriptor_pb2.DESCRIPTOR.CopyToProto(file_descriptor) pool.Add(file_descriptor) # Now it exists. self.assertTrue(pool.FindFileByName(proto_file_name)) def testCustomDescriptorPool(self): # Create a new pool, and add a file descriptor. pool = descriptor_pool.DescriptorPool() file_desc = descriptor_pb2.FileDescriptorProto( name='some/file.proto', package='package') file_desc.message_type.add(name='Message') pool.Add(file_desc) self.assertEqual(pool.FindFileByName('some/file.proto').name, 'some/file.proto') self.assertEqual(pool.FindMessageTypeByName('package.Message').name, 'Message') # Test no package file_proto = descriptor_pb2.FileDescriptorProto( name='some/filename/container.proto') message_proto = file_proto.message_type.add( name='TopMessage') message_proto.field.add( name='bb', number=1, type=descriptor_pb2.FieldDescriptorProto.TYPE_INT32, label=descriptor_pb2.FieldDescriptorProto.LABEL_OPTIONAL) enum_proto = file_proto.enum_type.add(name='TopEnum') enum_proto.value.add(name='FOREIGN_FOO', number=4) file_proto.service.add(name='TopService') pool = descriptor_pool.DescriptorPool() pool.Add(file_proto) self.assertEqual('TopMessage', pool.FindMessageTypeByName('TopMessage').name) self.assertEqual('TopEnum', pool.FindEnumTypeByName('TopEnum').name) self.assertEqual('TopService', pool.FindServiceByName('TopService').name) def testFileDescriptorOptionsWithCustomDescriptorPool(self): # Create a descriptor pool, and add a new FileDescriptorProto to it. pool = descriptor_pool.DescriptorPool() file_name = 'file_descriptor_options_with_custom_descriptor_pool.proto' file_descriptor_proto = descriptor_pb2.FileDescriptorProto(name=file_name) extension_id = file_options_test_pb2.foo_options file_descriptor_proto.options.Extensions[extension_id].foo_name = 'foo' pool.Add(file_descriptor_proto) # The options set on the FileDescriptorProto should be available in the # descriptor even if they contain extensions that cannot be deserialized # using the pool. file_descriptor = pool.FindFileByName(file_name) options = file_descriptor.GetOptions() self.assertEqual('foo', options.Extensions[extension_id].foo_name) # The object returned by GetOptions() is cached. self.assertIs(options, file_descriptor.GetOptions()) def testAddTypeError(self): pool = descriptor_pool.DescriptorPool() with self.assertRaises(TypeError): pool.AddDescriptor(0) with self.assertRaises(TypeError): pool.AddEnumDescriptor(0) with self.assertRaises(TypeError): pool.AddServiceDescriptor(0) with self.assertRaises(TypeError): pool.AddExtensionDescriptor(0) with self.assertRaises(TypeError): pool.AddFileDescriptor(0)
14,187
[ 0.0035241192672401667, -0.044558506458997726, 0.04904962703585625, -0.016894610598683357, 0.01209781039506197, -0.009146838448941708, -0.019939636811614037, 0.040302522480487823, -0.0027584536001086235, -0.01543675921857357, -0.0031508388929069042, 0.000015499768778681755, 0.0129443053156137...
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": "prefix", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}}, "body": [{"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"args": [], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "DescriptorPool", "value": {"_type": "Name", "_fields": {"id": "descriptor_pool", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}, "targets": [{"_type": "Name", "_fields": {"id": "pool", "ctx": {"_type": "Store", "_fields": {}}}}], "type_comment": null}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "DESCRIPTOR", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "TestAllTypes", "value": {"_type": "Name", "_fields": {"id": "unittest_pb2", "ctx": {"_type": "Load", "_fields": {}}}}}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "AddDescriptor", "value": {"_type": "Name", "_fields": {"id": "pool", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"kind": null, "value": "protobuf_unittest.TestAllTypes"}}, {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "full_name", "value": {"_type": "Call", "_fields": {"args": [{"_type": "BinOp", "_fields": {"op": {"_type": "Add", "_fields": {}}, "left": {"_type": "Name", "_fields": {"id": "prefix", "ctx": {"_type": "Load", "_fields": {}}}}, "right": {"_type": "Constant", "_fields": {"kind": null, "value": "protobuf_unittest.TestAllTypes"}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "FindMessageTypeByName", "value": {"_type": "Name", "_fields": {"id": "pool", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "assertEqual", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "With", "_fields": {"body": [{"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "BinOp", "_fields": {"op": {"_type": "Add", "_fields": {}}, "left": {"_type": "Name", "_fields": {"id": "prefix", "ctx": {"_type": "Load", "_fields": {}}}}, "right": {"_type": "Constant", "_fields": {"kind": null, "value": "protobuf_unittest.TestAllTypes.NestedMessage"}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "FindMessageTypeByName", "value": {"_type": "Name", "_fields": {"id": "pool", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}], "items": [{"_type": "withitem", "_fields": {"context_expr": {"_type": "Call", "_fields": {"args": [{"_type": "Name", "_fields": {"id": "KeyError", "ctx": {"_type": "Load", "_fields": {}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "assertRaises", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}, "optional_vars": null}}], "type_comment": null}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "DESCRIPTOR", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "NestedMessage", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "TestAllTypes", "value": {"_type": "Name", "_fields": {"id": "unittest_pb2", "ctx": {"_type": "Load", "_fields": {}}}}}}}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "AddDescriptor", "value": {"_type": "Name", "_fields": {"id": "pool", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"kind": null, "value": "protobuf_unittest.TestAllTypes.NestedMessage"}}, {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "full_name", "value": {"_type": "Call", "_fields": {"args": [{"_type": "BinOp", "_fields": {"op": {"_type": "Add", "_fields": {}}, "left": {"_type": "Name", "_fields": {"id": "prefix", "ctx": {"_type": "Load", "_fields": {}}}}, "right": {"_type": "Constant", "_fields": {"kind": null, "value": "protobuf_unittest.TestAllTypes.NestedMessage"}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "FindMessageTypeByName", "value": {"_type": "Name", "_fields": {"id": "pool", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "assertEqual", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"kind": null, "value": "google/protobuf/unittest.proto"}}, {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "name", "value": {"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"kind": null, "value": "google/protobuf/unittest.proto"}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "FindFileByName", "value": {"_type": "Name", "_fields": {"id": "pool", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "assertEqual", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"kind": null, "value": "google/protobuf/unittest.proto"}}, {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "name", "value": {"_type": "Call", "_fields": {"args": [{"_type": "BinOp", "_fields": {"op": {"_type": "Add", "_fields": {}}, "left": {"_type": "Name", "_fields": {"id": "prefix", "ctx": {"_type": "Load", "_fields": {}}}}, "right": {"_type": "Constant", "_fields": {"kind": null, "value": "protobuf_unittest.TestAllTypes.NestedMessage"}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "FindFileContainingSymbol", "value": {"_type": "Name", "_fields": {"id": "pool", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "assertEqual", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}], "name": "_TestMessage", "returns": null, "type_params": [], "type_comment": null, "decorator_list": []}}], "type_ignores": []}}
def _TestMessage(self, prefix): pool = descriptor_pool.DescriptorPool() pool.AddDescriptor(unittest_pb2.TestAllTypes.DESCRIPTOR) self.assertEqual( 'protobuf_unittest.TestAllTypes', pool.FindMessageTypeByName( prefix + 'protobuf_unittest.TestAllTypes').full_name) # AddDescriptor is not recursive. with self.assertRaises(KeyError): pool.FindMessageTypeByName( prefix + 'protobuf_unittest.TestAllTypes.NestedMessage') pool.AddDescriptor(unittest_pb2.TestAllTypes.NestedMessage.DESCRIPTOR) self.assertEqual( 'protobuf_unittest.TestAllTypes.NestedMessage', pool.FindMessageTypeByName( prefix + 'protobuf_unittest.TestAllTypes.NestedMessage').full_name) # Files are implicitly also indexed when messages are added. self.assertEqual( 'google/protobuf/unittest.proto', pool.FindFileByName( 'google/protobuf/unittest.proto').name) self.assertEqual( 'google/protobuf/unittest.proto', pool.FindFileContainingSymbol( prefix + 'protobuf_unittest.TestAllTypes.NestedMessage').name)
14,188
[ 0.005009796470403671, -0.02669619396328926, 0.037783633917570114, -0.02671891450881958, 0.0390559621155262, 0.016165396198630333, -0.015154349617660046, 0.01044559571892023, 0.007270452566444874, 0.03642042353749275, 0.0050211562775075436, -0.016426678746938705, 0.03966940566897392, -0.016...
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": "prefix", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}}, "body": [{"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"args": [], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "DescriptorPool", "value": {"_type": "Name", "_fields": {"id": "descriptor_pool", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}, "targets": [{"_type": "Name", "_fields": {"id": "pool", "ctx": {"_type": "Store", "_fields": {}}}}], "type_comment": null}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "DESCRIPTOR", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "ForeignEnum", "value": {"_type": "Name", "_fields": {"id": "unittest_pb2", "ctx": {"_type": "Load", "_fields": {}}}}}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "AddEnumDescriptor", "value": {"_type": "Name", "_fields": {"id": "pool", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"kind": null, "value": "protobuf_unittest.ForeignEnum"}}, {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "full_name", "value": {"_type": "Call", "_fields": {"args": [{"_type": "BinOp", "_fields": {"op": {"_type": "Add", "_fields": {}}, "left": {"_type": "Name", "_fields": {"id": "prefix", "ctx": {"_type": "Load", "_fields": {}}}}, "right": {"_type": "Constant", "_fields": {"kind": null, "value": "protobuf_unittest.ForeignEnum"}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "FindEnumTypeByName", "value": {"_type": "Name", "_fields": {"id": "pool", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "assertEqual", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "With", "_fields": {"body": [{"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "BinOp", "_fields": {"op": {"_type": "Add", "_fields": {}}, "left": {"_type": "Name", "_fields": {"id": "prefix", "ctx": {"_type": "Load", "_fields": {}}}}, "right": {"_type": "Constant", "_fields": {"kind": null, "value": "protobuf_unittest.ForeignEnum.NestedEnum"}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "FindEnumTypeByName", "value": {"_type": "Name", "_fields": {"id": "pool", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}], "items": [{"_type": "withitem", "_fields": {"context_expr": {"_type": "Call", "_fields": {"args": [{"_type": "Name", "_fields": {"id": "KeyError", "ctx": {"_type": "Load", "_fields": {}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "assertRaises", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}, "optional_vars": null}}], "type_comment": null}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "DESCRIPTOR", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "NestedEnum", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "TestAllTypes", "value": {"_type": "Name", "_fields": {"id": "unittest_pb2", "ctx": {"_type": "Load", "_fields": {}}}}}}}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "AddEnumDescriptor", "value": {"_type": "Name", "_fields": {"id": "pool", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"kind": null, "value": "protobuf_unittest.TestAllTypes.NestedEnum"}}, {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "full_name", "value": {"_type": "Call", "_fields": {"args": [{"_type": "BinOp", "_fields": {"op": {"_type": "Add", "_fields": {}}, "left": {"_type": "Name", "_fields": {"id": "prefix", "ctx": {"_type": "Load", "_fields": {}}}}, "right": {"_type": "Constant", "_fields": {"kind": null, "value": "protobuf_unittest.TestAllTypes.NestedEnum"}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "FindEnumTypeByName", "value": {"_type": "Name", "_fields": {"id": "pool", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "assertEqual", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"kind": null, "value": "google/protobuf/unittest.proto"}}, {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "name", "value": {"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"kind": null, "value": "google/protobuf/unittest.proto"}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "FindFileByName", "value": {"_type": "Name", "_fields": {"id": "pool", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "assertEqual", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"kind": null, "value": "google/protobuf/unittest.proto"}}, {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "name", "value": {"_type": "Call", "_fields": {"args": [{"_type": "BinOp", "_fields": {"op": {"_type": "Add", "_fields": {}}, "left": {"_type": "Name", "_fields": {"id": "prefix", "ctx": {"_type": "Load", "_fields": {}}}}, "right": {"_type": "Constant", "_fields": {"kind": null, "value": "protobuf_unittest.TestAllTypes.NestedEnum"}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "FindFileContainingSymbol", "value": {"_type": "Name", "_fields": {"id": "pool", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "assertEqual", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}], "name": "_TestEnum", "returns": null, "type_params": [], "type_comment": null, "decorator_list": []}}], "type_ignores": []}}
def _TestEnum(self, prefix): pool = descriptor_pool.DescriptorPool() pool.AddEnumDescriptor(unittest_pb2.ForeignEnum.DESCRIPTOR) self.assertEqual( 'protobuf_unittest.ForeignEnum', pool.FindEnumTypeByName( prefix + 'protobuf_unittest.ForeignEnum').full_name) # AddEnumDescriptor is not recursive. with self.assertRaises(KeyError): pool.FindEnumTypeByName( prefix + 'protobuf_unittest.ForeignEnum.NestedEnum') pool.AddEnumDescriptor(unittest_pb2.TestAllTypes.NestedEnum.DESCRIPTOR) self.assertEqual( 'protobuf_unittest.TestAllTypes.NestedEnum', pool.FindEnumTypeByName( prefix + 'protobuf_unittest.TestAllTypes.NestedEnum').full_name) # Files are implicitly also indexed when enums are added. self.assertEqual( 'google/protobuf/unittest.proto', pool.FindFileByName( 'google/protobuf/unittest.proto').name) self.assertEqual( 'google/protobuf/unittest.proto', pool.FindFileContainingSymbol( prefix + 'protobuf_unittest.TestAllTypes.NestedEnum').name)
14,189
[ -0.016960108652710915, -0.03359174728393555, 0.0539570152759552, -0.031182950362563133, 0.02327772229909897, -0.009553063660860062, -0.03092017211019993, 0.04716859012842178, 0.0004297509731259197, -0.012919901870191097, 0.024591609835624695, -0.014704600907862186, 0.01685061864554882, -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": []}}, "body": [{"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"args": [], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "DescriptorPool", "value": {"_type": "Name", "_fields": {"id": "descriptor_pool", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}, "targets": [{"_type": "Name", "_fields": {"id": "pool", "ctx": {"_type": "Store", "_fields": {}}}}], "type_comment": null}}, {"_type": "With", "_fields": {"body": [{"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"kind": null, "value": "protobuf_unittest.TestService"}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "FindServiceByName", "value": {"_type": "Name", "_fields": {"id": "pool", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}], "items": [{"_type": "withitem", "_fields": {"context_expr": {"_type": "Call", "_fields": {"args": [{"_type": "Name", "_fields": {"id": "KeyError", "ctx": {"_type": "Load", "_fields": {}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "assertRaises", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}, "optional_vars": null}}], "type_comment": null}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "_TESTSERVICE", "value": {"_type": "Name", "_fields": {"id": "unittest_pb2", "ctx": {"_type": "Load", "_fields": {}}}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "AddServiceDescriptor", "value": {"_type": "Name", "_fields": {"id": "pool", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"kind": null, "value": "protobuf_unittest.TestService"}}, {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "full_name", "value": {"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"kind": null, "value": "protobuf_unittest.TestService"}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "FindServiceByName", "value": {"_type": "Name", "_fields": {"id": "pool", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "assertEqual", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}], "name": "testService", "returns": null, "type_params": [], "type_comment": null, "decorator_list": []}}], "type_ignores": []}}
def testService(self): pool = descriptor_pool.DescriptorPool() with self.assertRaises(KeyError): pool.FindServiceByName('protobuf_unittest.TestService') pool.AddServiceDescriptor(unittest_pb2._TESTSERVICE) self.assertEqual( 'protobuf_unittest.TestService', pool.FindServiceByName('protobuf_unittest.TestService').full_name)
14,190
[ 0.021207045763731003, -0.004202788695693016, 0.034076664596796036, -0.00495531503111124, 0.06033841520547867, -0.04711667075753212, 0.0234901811927557, 0.05297785624861717, 0.017322305589914322, 0.0021297915372997522, 0.020116591826081276, -0.034735482186079025, -0.025966418907046318, -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": []}}, "body": [{"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"args": [], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "DescriptorPool", "value": {"_type": "Name", "_fields": {"id": "descriptor_pool", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}, "targets": [{"_type": "Name", "_fields": {"id": "pool", "ctx": {"_type": "Store", "_fields": {}}}}], "type_comment": null}}, {"_type": "Assign", "_fields": {"value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "name", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "DESCRIPTOR", "value": {"_type": "Name", "_fields": {"id": "descriptor_pb2", "ctx": {"_type": "Load", "_fields": {}}}}}}}}, "targets": [{"_type": "Name", "_fields": {"id": "proto_file_name", "ctx": {"_type": "Store", "_fields": {}}}}], "type_comment": null}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Name", "_fields": {"id": "KeyError", "ctx": {"_type": "Load", "_fields": {}}}}, {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "FindFileByName", "value": {"_type": "Name", "_fields": {"id": "pool", "ctx": {"_type": "Load", "_fields": {}}}}}}, {"_type": "Name", "_fields": {"id": "proto_file_name", "ctx": {"_type": "Load", "_fields": {}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "assertRaises", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"args": [], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "FileDescriptorProto", "value": {"_type": "Name", "_fields": {"id": "descriptor_pb2", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}, "targets": [{"_type": "Name", "_fields": {"id": "file_descriptor", "ctx": {"_type": "Store", "_fields": {}}}}], "type_comment": null}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Name", "_fields": {"id": "file_descriptor", "ctx": {"_type": "Load", "_fields": {}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "CopyToProto", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "DESCRIPTOR", "value": {"_type": "Name", "_fields": {"id": "descriptor_pb2", "ctx": {"_type": "Load", "_fields": {}}}}}}}}, "keywords": []}}}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Name", "_fields": {"id": "file_descriptor", "ctx": {"_type": "Load", "_fields": {}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "Add", "value": {"_type": "Name", "_fields": {"id": "pool", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Call", "_fields": {"args": [{"_type": "Name", "_fields": {"id": "proto_file_name", "ctx": {"_type": "Load", "_fields": {}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "FindFileByName", "value": {"_type": "Name", "_fields": {"id": "pool", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "assertTrue", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}], "name": "testEmptyDescriptorPool", "returns": null, "type_params": [], "type_comment": null, "decorator_list": []}}], "type_ignores": []}}
def testEmptyDescriptorPool(self): # Check that an empty DescriptorPool() contains no messages. pool = descriptor_pool.DescriptorPool() proto_file_name = descriptor_pb2.DESCRIPTOR.name self.assertRaises(KeyError, pool.FindFileByName, proto_file_name) # Add the above file to the pool file_descriptor = descriptor_pb2.FileDescriptorProto() descriptor_pb2.DESCRIPTOR.CopyToProto(file_descriptor) pool.Add(file_descriptor) # Now it exists. self.assertTrue(pool.FindFileByName(proto_file_name))
14,191
[ 0.007113500963896513, -0.00951814278960228, 0.05347121134400368, -0.017429472878575325, 0.022205282002687454, -0.04360715672373772, -0.01691618375480175, 0.02878875657916069, -0.005682432092726231, -0.025954514741897583, 0.032716523855924606, -0.003216418204829097, 0.013100000098347664, -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": []}}, "body": [{"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"args": [], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "DescriptorPool", "value": {"_type": "Name", "_fields": {"id": "descriptor_pool", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}, "targets": [{"_type": "Name", "_fields": {"id": "pool", "ctx": {"_type": "Store", "_fields": {}}}}], "type_comment": null}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "DESCRIPTOR", "value": {"_type": "Name", "_fields": {"id": "unittest_pb2", "ctx": {"_type": "Load", "_fields": {}}}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "AddFileDescriptor", "value": {"_type": "Name", "_fields": {"id": "pool", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"kind": null, "value": "google/protobuf/unittest.proto"}}, {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "name", "value": {"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"kind": null, "value": "google/protobuf/unittest.proto"}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "FindFileByName", "value": {"_type": "Name", "_fields": {"id": "pool", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "assertEqual", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "With", "_fields": {"body": [{"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"kind": null, "value": "protobuf_unittest.TestAllTypes"}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "FindFileContainingSymbol", "value": {"_type": "Name", "_fields": {"id": "pool", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}], "items": [{"_type": "withitem", "_fields": {"context_expr": {"_type": "Call", "_fields": {"args": [{"_type": "Name", "_fields": {"id": "KeyError", "ctx": {"_type": "Load", "_fields": {}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "assertRaises", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}, "optional_vars": null}}], "type_comment": null}}], "name": "testFile", "returns": null, "type_params": [], "type_comment": null, "decorator_list": []}}], "type_ignores": []}}
def testFile(self): pool = descriptor_pool.DescriptorPool() pool.AddFileDescriptor(unittest_pb2.DESCRIPTOR) self.assertEqual( 'google/protobuf/unittest.proto', pool.FindFileByName( 'google/protobuf/unittest.proto').name) # AddFileDescriptor is not recursive; messages and enums within files must # be explicitly registered. with self.assertRaises(KeyError): pool.FindFileContainingSymbol( 'protobuf_unittest.TestAllTypes')
14,192
[ 0.012784561142325401, -0.023825278505682945, 0.07101807743310928, -0.01727496087551117, 0.023040547966957092, -0.056326184421777725, 0.007754659280180931, 0.036206576973199844, 0.018844421952962875, -0.0025939689949154854, 0.03910571709275246, -0.017133275046944618, -0.0019972471054643393, ...
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": []}}, "body": [{"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"args": [], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "DescriptorPool", "value": {"_type": "Name", "_fields": {"id": "descriptor_pool", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}, "targets": [{"_type": "Name", "_fields": {"id": "pool", "ctx": {"_type": "Store", "_fields": {}}}}], "type_comment": null}}, {"_type": "Assign", "_fields": {"value": {"_type": "Constant", "_fields": {"kind": null, "value": "file_descriptor_options_with_custom_descriptor_pool.proto"}}, "targets": [{"_type": "Name", "_fields": {"id": "file_name", "ctx": {"_type": "Store", "_fields": {}}}}], "type_comment": null}}, {"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"args": [], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "FileDescriptorProto", "value": {"_type": "Name", "_fields": {"id": "descriptor_pb2", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": [{"_type": "keyword", "_fields": {"arg": "name", "value": {"_type": "Name", "_fields": {"id": "file_name", "ctx": {"_type": "Load", "_fields": {}}}}}}]}}, "targets": [{"_type": "Name", "_fields": {"id": "file_descriptor_proto", "ctx": {"_type": "Store", "_fields": {}}}}], "type_comment": null}}, {"_type": "Assign", "_fields": {"value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "foo_options", "value": {"_type": "Name", "_fields": {"id": "file_options_test_pb2", "ctx": {"_type": "Load", "_fields": {}}}}}}, "targets": [{"_type": "Name", "_fields": {"id": "extension_id", "ctx": {"_type": "Store", "_fields": {}}}}], "type_comment": null}}, {"_type": "Assign", "_fields": {"value": {"_type": "Constant", "_fields": {"kind": null, "value": "foo"}}, "targets": [{"_type": "Attribute", "_fields": {"ctx": {"_type": "Store", "_fields": {}}, "attr": "foo_name", "value": {"_type": "Subscript", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "slice": {"_type": "Name", "_fields": {"id": "extension_id", "ctx": {"_type": "Load", "_fields": {}}}}, "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "Extensions", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "options", "value": {"_type": "Name", "_fields": {"id": "file_descriptor_proto", "ctx": {"_type": "Load", "_fields": {}}}}}}}}}}}}], "type_comment": null}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Name", "_fields": {"id": "file_descriptor_proto", "ctx": {"_type": "Load", "_fields": {}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "Add", "value": {"_type": "Name", "_fields": {"id": "pool", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Name", "_fields": {"id": "file_name", "ctx": {"_type": "Load", "_fields": {}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "FindFileByName", "value": {"_type": "Name", "_fields": {"id": "pool", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}, "targets": [{"_type": "Name", "_fields": {"id": "file_descriptor", "ctx": {"_type": "Store", "_fields": {}}}}], "type_comment": null}}, {"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"args": [], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "GetOptions", "value": {"_type": "Name", "_fields": {"id": "file_descriptor", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}, "targets": [{"_type": "Name", "_fields": {"id": "options", "ctx": {"_type": "Store", "_fields": {}}}}], "type_comment": null}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"kind": null, "value": "foo"}}, {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "foo_name", "value": {"_type": "Subscript", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "slice": {"_type": "Name", "_fields": {"id": "extension_id", "ctx": {"_type": "Load", "_fields": {}}}}, "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "Extensions", "value": {"_type": "Name", "_fields": {"id": "options", "ctx": {"_type": "Load", "_fields": {}}}}}}}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "assertEqual", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Name", "_fields": {"id": "options", "ctx": {"_type": "Load", "_fields": {}}}}, {"_type": "Call", "_fields": {"args": [], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "GetOptions", "value": {"_type": "Name", "_fields": {"id": "file_descriptor", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "assertIs", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}], "name": "testFileDescriptorOptionsWithCustomDescriptorPool", "returns": null, "type_params": [], "type_comment": null, "decorator_list": []}}], "type_ignores": []}}
def testFileDescriptorOptionsWithCustomDescriptorPool(self): # Create a descriptor pool, and add a new FileDescriptorProto to it. pool = descriptor_pool.DescriptorPool() file_name = 'file_descriptor_options_with_custom_descriptor_pool.proto' file_descriptor_proto = descriptor_pb2.FileDescriptorProto(name=file_name) extension_id = file_options_test_pb2.foo_options file_descriptor_proto.options.Extensions[extension_id].foo_name = 'foo' pool.Add(file_descriptor_proto) # The options set on the FileDescriptorProto should be available in the # descriptor even if they contain extensions that cannot be deserialized # using the pool. file_descriptor = pool.FindFileByName(file_name) options = file_descriptor.GetOptions() self.assertEqual('foo', options.Extensions[extension_id].foo_name) # The object returned by GetOptions() is cached. self.assertIs(options, file_descriptor.GetOptions())
14,193
[ 0.013554448261857033, -0.02353370003402233, 0.05469930171966553, -0.012314565479755402, 0.03185174986720085, -0.04754890874028206, 0.016371268779039383, 0.04439502954483032, 0.010966342873871326, 0.015745310112833977, 0.027518177404999733, -0.032886993139982224, 0.002234497806057334, -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": []}}, "body": [{"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"args": [], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "DescriptorPool", "value": {"_type": "Name", "_fields": {"id": "descriptor_pool", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}, "targets": [{"_type": "Name", "_fields": {"id": "pool", "ctx": {"_type": "Store", "_fields": {}}}}], "type_comment": null}}, {"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"args": [], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "FileDescriptorProto", "value": {"_type": "Name", "_fields": {"id": "descriptor_pb2", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": [{"_type": "keyword", "_fields": {"arg": "name", "value": {"_type": "Constant", "_fields": {"kind": null, "value": "some/file.proto"}}}}, {"_type": "keyword", "_fields": {"arg": "package", "value": {"_type": "Constant", "_fields": {"kind": null, "value": "package"}}}}]}}, "targets": [{"_type": "Name", "_fields": {"id": "file_desc", "ctx": {"_type": "Store", "_fields": {}}}}], "type_comment": null}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "add", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "message_type", "value": {"_type": "Name", "_fields": {"id": "file_desc", "ctx": {"_type": "Load", "_fields": {}}}}}}}}, "keywords": [{"_type": "keyword", "_fields": {"arg": "name", "value": {"_type": "Constant", "_fields": {"kind": null, "value": "Message"}}}}]}}}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Name", "_fields": {"id": "file_desc", "ctx": {"_type": "Load", "_fields": {}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "Add", "value": {"_type": "Name", "_fields": {"id": "pool", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "name", "value": {"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"kind": null, "value": "some/file.proto"}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "FindFileByName", "value": {"_type": "Name", "_fields": {"id": "pool", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Constant", "_fields": {"kind": null, "value": "some/file.proto"}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "assertEqual", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "name", "value": {"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"kind": null, "value": "package.Message"}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "FindMessageTypeByName", "value": {"_type": "Name", "_fields": {"id": "pool", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Constant", "_fields": {"kind": null, "value": "Message"}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "assertEqual", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"args": [], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "FileDescriptorProto", "value": {"_type": "Name", "_fields": {"id": "descriptor_pb2", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": [{"_type": "keyword", "_fields": {"arg": "name", "value": {"_type": "Constant", "_fields": {"kind": null, "value": "some/filename/container.proto"}}}}]}}, "targets": [{"_type": "Name", "_fields": {"id": "file_proto", "ctx": {"_type": "Store", "_fields": {}}}}], "type_comment": null}}, {"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"args": [], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "add", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "message_type", "value": {"_type": "Name", "_fields": {"id": "file_proto", "ctx": {"_type": "Load", "_fields": {}}}}}}}}, "keywords": [{"_type": "keyword", "_fields": {"arg": "name", "value": {"_type": "Constant", "_fields": {"kind": null, "value": "TopMessage"}}}}]}}, "targets": [{"_type": "Name", "_fields": {"id": "message_proto", "ctx": {"_type": "Store", "_fields": {}}}}], "type_comment": null}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "add", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "field", "value": {"_type": "Name", "_fields": {"id": "message_proto", "ctx": {"_type": "Load", "_fields": {}}}}}}}}, "keywords": [{"_type": "keyword", "_fields": {"arg": "name", "value": {"_type": "Constant", "_fields": {"kind": null, "value": "bb"}}}}, {"_type": "keyword", "_fields": {"arg": "number", "value": {"_type": "Constant", "_fields": {"kind": null, "value": 1}}}}, {"_type": "keyword", "_fields": {"arg": "type", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "TYPE_INT32", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "FieldDescriptorProto", "value": {"_type": "Name", "_fields": {"id": "descriptor_pb2", "ctx": {"_type": "Load", "_fields": {}}}}}}}}}}, {"_type": "keyword", "_fields": {"arg": "label", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "LABEL_OPTIONAL", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "FieldDescriptorProto", "value": {"_type": "Name", "_fields": {"id": "descriptor_pb2", "ctx": {"_type": "Load", "_fields": {}}}}}}}}}}]}}}}, {"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"args": [], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "add", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "enum_type", "value": {"_type": "Name", "_fields": {"id": "file_proto", "ctx": {"_type": "Load", "_fields": {}}}}}}}}, "keywords": [{"_type": "keyword", "_fields": {"arg": "name", "value": {"_type": "Constant", "_fields": {"kind": null, "value": "TopEnum"}}}}]}}, "targets": [{"_type": "Name", "_fields": {"id": "enum_proto", "ctx": {"_type": "Store", "_fields": {}}}}], "type_comment": null}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "add", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "value", "value": {"_type": "Name", "_fields": {"id": "enum_proto", "ctx": {"_type": "Load", "_fields": {}}}}}}}}, "keywords": [{"_type": "keyword", "_fields": {"arg": "name", "value": {"_type": "Constant", "_fields": {"kind": null, "value": "FOREIGN_FOO"}}}}, {"_type": "keyword", "_fields": {"arg": "number", "value": {"_type": "Constant", "_fields": {"kind": null, "value": 4}}}}]}}}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "add", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "service", "value": {"_type": "Name", "_fields": {"id": "file_proto", "ctx": {"_type": "Load", "_fields": {}}}}}}}}, "keywords": [{"_type": "keyword", "_fields": {"arg": "name", "value": {"_type": "Constant", "_fields": {"kind": null, "value": "TopService"}}}}]}}}}, {"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"args": [], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "DescriptorPool", "value": {"_type": "Name", "_fields": {"id": "descriptor_pool", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}, "targets": [{"_type": "Name", "_fields": {"id": "pool", "ctx": {"_type": "Store", "_fields": {}}}}], "type_comment": null}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Name", "_fields": {"id": "file_proto", "ctx": {"_type": "Load", "_fields": {}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "Add", "value": {"_type": "Name", "_fields": {"id": "pool", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"kind": null, "value": "TopMessage"}}, {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "name", "value": {"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"kind": null, "value": "TopMessage"}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "FindMessageTypeByName", "value": {"_type": "Name", "_fields": {"id": "pool", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "assertEqual", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"kind": null, "value": "TopEnum"}}, {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "name", "value": {"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"kind": null, "value": "TopEnum"}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "FindEnumTypeByName", "value": {"_type": "Name", "_fields": {"id": "pool", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "assertEqual", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"kind": null, "value": "TopService"}}, {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "name", "value": {"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"kind": null, "value": "TopService"}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "FindServiceByName", "value": {"_type": "Name", "_fields": {"id": "pool", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "assertEqual", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}], "name": "testCustomDescriptorPool", "returns": null, "type_params": [], "type_comment": null, "decorator_list": []}}], "type_ignores": []}}
def testCustomDescriptorPool(self): # Create a new pool, and add a file descriptor. pool = descriptor_pool.DescriptorPool() file_desc = descriptor_pb2.FileDescriptorProto( name='some/file.proto', package='package') file_desc.message_type.add(name='Message') pool.Add(file_desc) self.assertEqual(pool.FindFileByName('some/file.proto').name, 'some/file.proto') self.assertEqual(pool.FindMessageTypeByName('package.Message').name, 'Message') # Test no package file_proto = descriptor_pb2.FileDescriptorProto( name='some/filename/container.proto') message_proto = file_proto.message_type.add( name='TopMessage') message_proto.field.add( name='bb', number=1, type=descriptor_pb2.FieldDescriptorProto.TYPE_INT32, label=descriptor_pb2.FieldDescriptorProto.LABEL_OPTIONAL) enum_proto = file_proto.enum_type.add(name='TopEnum') enum_proto.value.add(name='FOREIGN_FOO', number=4) file_proto.service.add(name='TopService') pool = descriptor_pool.DescriptorPool() pool.Add(file_proto) self.assertEqual('TopMessage', pool.FindMessageTypeByName('TopMessage').name) self.assertEqual('TopEnum', pool.FindEnumTypeByName('TopEnum').name) self.assertEqual('TopService', pool.FindServiceByName('TopService').name)
14,194
[ -0.0029999546241015196, 0.017306780442595482, -0.02114897593855858, -0.017250442877411842, -0.030354470014572144, 0.03382483869791031, -0.006833699531853199, -0.003932334948331118, 0.022377125918865204, -0.02173488214612007, 0.036731839179992676, -0.004290075972676277, -0.028146052733063698,...
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": "event", "annotation": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "TopologyDescriptionChangedEvent", "value": {"_type": "Name", "_fields": {"id": "monitoring", "ctx": {"_type": "Load", "_fields": {}}}}}}, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}}, "body": [{"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "JoinedStr", "_fields": {"values": [{"_type": "Constant", "_fields": {"kind": null, "value": "Topology description updated for topology id "}}, {"_type": "FormattedValue", "_fields": {"value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "topology_id", "value": {"_type": "Name", "_fields": {"id": "event", "ctx": {"_type": "Load", "_fields": {}}}}}}, "conversion": -1, "format_spec": null}}]}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "info", "value": {"_type": "Name", "_fields": {"id": "logging", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Assign", "_fields": {"value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "topology_type", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "previous_description", "value": {"_type": "Name", "_fields": {"id": "event", "ctx": {"_type": "Load", "_fields": {}}}}}}}}, "targets": [{"_type": "Name", "_fields": {"id": "previous_topology_type", "ctx": {"_type": "Store", "_fields": {}}}}], "type_comment": null}}, {"_type": "Assign", "_fields": {"value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "topology_type", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "new_description", "value": {"_type": "Name", "_fields": {"id": "event", "ctx": {"_type": "Load", "_fields": {}}}}}}}}, "targets": [{"_type": "Name", "_fields": {"id": "new_topology_type", "ctx": {"_type": "Store", "_fields": {}}}}], "type_comment": null}}, {"_type": "If", "_fields": {"body": [{"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "JoinedStr", "_fields": {"values": [{"_type": "Constant", "_fields": {"kind": null, "value": "Topology "}}, {"_type": "FormattedValue", "_fields": {"value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "topology_id", "value": {"_type": "Name", "_fields": {"id": "event", "ctx": {"_type": "Load", "_fields": {}}}}}}, "conversion": -1, "format_spec": null}}, {"_type": "Constant", "_fields": {"kind": null, "value": " changed type from "}}, {"_type": "FormattedValue", "_fields": {"value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "topology_type_name", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "previous_description", "value": {"_type": "Name", "_fields": {"id": "event", "ctx": {"_type": "Load", "_fields": {}}}}}}}}, "conversion": -1, "format_spec": null}}, {"_type": "Constant", "_fields": {"kind": null, "value": " to "}}, {"_type": "FormattedValue", "_fields": {"value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "topology_type_name", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "new_description", "value": {"_type": "Name", "_fields": {"id": "event", "ctx": {"_type": "Load", "_fields": {}}}}}}}}, "conversion": -1, "format_spec": null}}]}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "info", "value": {"_type": "Name", "_fields": {"id": "logging", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}], "test": {"_type": "Compare", "_fields": {"ops": [{"_type": "NotEq", "_fields": {}}], "left": {"_type": "Name", "_fields": {"id": "new_topology_type", "ctx": {"_type": "Load", "_fields": {}}}}, "comparators": [{"_type": "Name", "_fields": {"id": "previous_topology_type", "ctx": {"_type": "Load", "_fields": {}}}}]}}, "orelse": []}}, {"_type": "If", "_fields": {"body": [{"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"kind": null, "value": "No writable servers available."}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "warning", "value": {"_type": "Name", "_fields": {"id": "logging", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}], "test": {"_type": "UnaryOp", "_fields": {"op": {"_type": "Not", "_fields": {}}, "operand": {"_type": "Call", "_fields": {"args": [], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "has_writable_server", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "new_description", "value": {"_type": "Name", "_fields": {"id": "event", "ctx": {"_type": "Load", "_fields": {}}}}}}}}, "keywords": []}}}}, "orelse": []}}, {"_type": "If", "_fields": {"body": [{"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"kind": null, "value": "No readable servers available."}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "warning", "value": {"_type": "Name", "_fields": {"id": "logging", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}], "test": {"_type": "UnaryOp", "_fields": {"op": {"_type": "Not", "_fields": {}}, "operand": {"_type": "Call", "_fields": {"args": [], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "has_readable_server", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "new_description", "value": {"_type": "Name", "_fields": {"id": "event", "ctx": {"_type": "Load", "_fields": {}}}}}}}}, "keywords": []}}}}, "orelse": []}}], "name": "description_changed", "returns": {"_type": "Constant", "_fields": {"kind": null, "value": null}}, "type_params": [], "type_comment": null, "decorator_list": []}}], "type_ignores": []}}
def description_changed(self, event: monitoring.TopologyDescriptionChangedEvent) -> None: logging.info(f"Topology description updated for topology id {event.topology_id}") previous_topology_type = event.previous_description.topology_type new_topology_type = event.new_description.topology_type if new_topology_type != previous_topology_type: # topology_type_name was added in PyMongo 3.4 logging.info( f"Topology {event.topology_id} changed type from " f"{event.previous_description.topology_type_name} to " f"{event.new_description.topology_type_name}" ) # The has_writable_server and has_readable_server methods # were added in PyMongo 3.4. if not event.new_description.has_writable_server(): logging.warning("No writable servers available.") if not event.new_description.has_readable_server(): logging.warning("No readable servers available.")
14,195
[ -0.0123982485383749, -0.019068721681833267, 0.02565566450357437, -0.022278662770986557, 0.0297605711966753, -0.05694364383816719, -0.005146048963069916, 0.05417521670460701, 0.020775122568011284, -0.0047999960370361805, 0.006127527449280024, -0.036347512155771255, -0.010053440928459167, 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": []}}, "body": [{"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"args": [], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "DescriptorPool", "value": {"_type": "Name", "_fields": {"id": "descriptor_pool", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}, "targets": [{"_type": "Name", "_fields": {"id": "pool", "ctx": {"_type": "Store", "_fields": {}}}}], "type_comment": null}}, {"_type": "With", "_fields": {"body": [{"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"kind": null, "value": 0}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "AddDescriptor", "value": {"_type": "Name", "_fields": {"id": "pool", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}], "items": [{"_type": "withitem", "_fields": {"context_expr": {"_type": "Call", "_fields": {"args": [{"_type": "Name", "_fields": {"id": "TypeError", "ctx": {"_type": "Load", "_fields": {}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "assertRaises", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}, "optional_vars": null}}], "type_comment": null}}, {"_type": "With", "_fields": {"body": [{"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"kind": null, "value": 0}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "AddEnumDescriptor", "value": {"_type": "Name", "_fields": {"id": "pool", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}], "items": [{"_type": "withitem", "_fields": {"context_expr": {"_type": "Call", "_fields": {"args": [{"_type": "Name", "_fields": {"id": "TypeError", "ctx": {"_type": "Load", "_fields": {}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "assertRaises", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}, "optional_vars": null}}], "type_comment": null}}, {"_type": "With", "_fields": {"body": [{"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"kind": null, "value": 0}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "AddServiceDescriptor", "value": {"_type": "Name", "_fields": {"id": "pool", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}], "items": [{"_type": "withitem", "_fields": {"context_expr": {"_type": "Call", "_fields": {"args": [{"_type": "Name", "_fields": {"id": "TypeError", "ctx": {"_type": "Load", "_fields": {}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "assertRaises", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}, "optional_vars": null}}], "type_comment": null}}, {"_type": "With", "_fields": {"body": [{"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"kind": null, "value": 0}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "AddExtensionDescriptor", "value": {"_type": "Name", "_fields": {"id": "pool", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}], "items": [{"_type": "withitem", "_fields": {"context_expr": {"_type": "Call", "_fields": {"args": [{"_type": "Name", "_fields": {"id": "TypeError", "ctx": {"_type": "Load", "_fields": {}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "assertRaises", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}, "optional_vars": null}}], "type_comment": null}}, {"_type": "With", "_fields": {"body": [{"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"kind": null, "value": 0}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "AddFileDescriptor", "value": {"_type": "Name", "_fields": {"id": "pool", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}], "items": [{"_type": "withitem", "_fields": {"context_expr": {"_type": "Call", "_fields": {"args": [{"_type": "Name", "_fields": {"id": "TypeError", "ctx": {"_type": "Load", "_fields": {}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "assertRaises", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}, "optional_vars": null}}], "type_comment": null}}], "name": "testAddTypeError", "returns": null, "type_params": [], "type_comment": null, "decorator_list": []}}], "type_ignores": []}}
def testAddTypeError(self): pool = descriptor_pool.DescriptorPool() with self.assertRaises(TypeError): pool.AddDescriptor(0) with self.assertRaises(TypeError): pool.AddEnumDescriptor(0) with self.assertRaises(TypeError): pool.AddServiceDescriptor(0) with self.assertRaises(TypeError): pool.AddExtensionDescriptor(0) with self.assertRaises(TypeError): pool.AddFileDescriptor(0)
14,196
[ -0.034508660435676575, 0.043237801641225815, 0.0209866501390934, 0.01892673596739769, -0.014001297764480114, -0.010809450410306454, 0.014602956362068653, -0.06032897159457207, -0.022842613980174065, 0.006541757378727198, 0.013287466019392014, -0.016775043681263924, 0.012573635205626488, 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": {"_type": "arg", "_fields": {"arg": "kwargs", "annotation": null, "type_comment": null}}, "vararg": {"_type": "arg", "_fields": {"arg": "args", "annotation": null, "type_comment": null}}, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}}, "body": [{"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Starred", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "value": {"_type": "Name", "_fields": {"id": "args", "ctx": {"_type": "Load", "_fields": {}}}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "__init__", "value": {"_type": "Call", "_fields": {"args": [], "func": {"_type": "Name", "_fields": {"id": "super", "ctx": {"_type": "Load", "_fields": {}}}}, "keywords": []}}}}, "keywords": [{"_type": "keyword", "_fields": {"arg": null, "value": {"_type": "Name", "_fields": {"id": "kwargs", "ctx": {"_type": "Load", "_fields": {}}}}}}]}}}}, {"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"kind": null, "value": "maximize"}}, {"_type": "Constant", "_fields": {"kind": null, "value": null}}, {"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"kind": null, "value": false}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "new_boolean", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "Variant", "value": {"_type": "Name", "_fields": {"id": "GLib", "ctx": {"_type": "Load", "_fields": {}}}}}}}}, "keywords": []}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "new_stateful", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "SimpleAction", "value": {"_type": "Name", "_fields": {"id": "Gio", "ctx": {"_type": "Load", "_fields": {}}}}}}}}, "keywords": []}}, "targets": [{"_type": "Name", "_fields": {"id": "max_action", "ctx": {"_type": "Store", "_fields": {}}}}], "type_comment": null}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"kind": null, "value": "change-state"}}, {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "on_maximize_toggle", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "connect", "value": {"_type": "Name", "_fields": {"id": "max_action", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Name", "_fields": {"id": "max_action", "ctx": {"_type": "Load", "_fields": {}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "add_action", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"kind": null, "value": "notify::is-maximized"}}, {"_type": "Lambda", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "obj", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "pspec", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}}, "body": {"_type": "Call", "_fields": {"args": [{"_type": "Call", "_fields": {"args": [{"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "is_maximized", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "props", "value": {"_type": "Name", "_fields": {"id": "obj", "ctx": {"_type": "Load", "_fields": {}}}}}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "new_boolean", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "Variant", "value": {"_type": "Name", "_fields": {"id": "GLib", "ctx": {"_type": "Load", "_fields": {}}}}}}}}, "keywords": []}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "set_state", "value": {"_type": "Name", "_fields": {"id": "max_action", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "connect", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"kind": null, "value": "String 1"}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "new_string", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "Variant", "value": {"_type": "Name", "_fields": {"id": "GLib", "ctx": {"_type": "Load", "_fields": {}}}}}}}}, "keywords": []}}, "targets": [{"_type": "Name", "_fields": {"id": "lbl_variant", "ctx": {"_type": "Store", "_fields": {}}}}], "type_comment": null}}, {"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"kind": null, "value": "change_label"}}, {"_type": "Call", "_fields": {"args": [], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "get_type", "value": {"_type": "Name", "_fields": {"id": "lbl_variant", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}, {"_type": "Name", "_fields": {"id": "lbl_variant", "ctx": {"_type": "Load", "_fields": {}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "new_stateful", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "SimpleAction", "value": {"_type": "Name", "_fields": {"id": "Gio", "ctx": {"_type": "Load", "_fields": {}}}}}}}}, "keywords": []}}, "targets": [{"_type": "Name", "_fields": {"id": "lbl_action", "ctx": {"_type": "Store", "_fields": {}}}}], "type_comment": null}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"kind": null, "value": "change-state"}}, {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "on_change_label_state", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "connect", "value": {"_type": "Name", "_fields": {"id": "lbl_action", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Name", "_fields": {"id": "lbl_action", "ctx": {"_type": "Load", "_fields": {}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "add_action", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"args": [], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "Label", "value": {"_type": "Name", "_fields": {"id": "Gtk", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": [{"_type": "keyword", "_fields": {"arg": "label", "value": {"_type": "Call", "_fields": {"args": [], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "get_string", "value": {"_type": "Name", "_fields": {"id": "lbl_variant", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "keyword", "_fields": {"arg": "margin", "value": {"_type": "Constant", "_fields": {"kind": null, "value": 30}}}}]}}, "targets": [{"_type": "Attribute", "_fields": {"ctx": {"_type": "Store", "_fields": {}}, "attr": "label", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}], "type_comment": null}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "label", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "add", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "show", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "label", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}}}, "keywords": []}}}}], "name": "__init__", "returns": null, "type_params": [], "type_comment": null, "decorator_list": []}}, {"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "action", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "value", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}}, "body": [{"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Name", "_fields": {"id": "value", "ctx": {"_type": "Load", "_fields": {}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "set_state", "value": {"_type": "Name", "_fields": {"id": "action", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Call", "_fields": {"args": [], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "get_string", "value": {"_type": "Name", "_fields": {"id": "value", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "set_text", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "label", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}}}, "keywords": []}}}}], "name": "on_change_label_state", "returns": null, "type_params": [], "type_comment": null, "decorator_list": []}}, {"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "action", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "value", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}}, "body": [{"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Name", "_fields": {"id": "value", "ctx": {"_type": "Load", "_fields": {}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "set_state", "value": {"_type": "Name", "_fields": {"id": "action", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "If", "_fields": {"body": [{"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "maximize", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}], "test": {"_type": "Call", "_fields": {"args": [], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "get_boolean", "value": {"_type": "Name", "_fields": {"id": "value", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}, "orelse": [{"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "unmaximize", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}]}}], "name": "on_maximize_toggle", "returns": null, "type_params": [], "type_comment": null, "decorator_list": []}}], "name": "AppWindow", "bases": [{"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "ApplicationWindow", "value": {"_type": "Name", "_fields": {"id": "Gtk", "ctx": {"_type": "Load", "_fields": {}}}}}}], "keywords": [], "type_params": [], "decorator_list": []}}], "type_ignores": []}}
class AppWindow(Gtk.ApplicationWindow): def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) # This will be in the windows group and have the "win" prefix max_action = Gio.SimpleAction.new_stateful("maximize", None, GLib.Variant.new_boolean(False)) max_action.connect("change-state", self.on_maximize_toggle) self.add_action(max_action) # Keep it in sync with the actual state self.connect("notify::is-maximized", lambda obj, pspec: max_action.set_state( GLib.Variant.new_boolean(obj.props.is_maximized))) lbl_variant = GLib.Variant.new_string("String 1") lbl_action = Gio.SimpleAction.new_stateful("change_label", lbl_variant.get_type(), lbl_variant) lbl_action.connect("change-state", self.on_change_label_state) self.add_action(lbl_action) self.label = Gtk.Label(label=lbl_variant.get_string(), margin=30) self.add(self.label) self.label.show() def on_change_label_state(self, action, value): action.set_state(value) self.label.set_text(value.get_string()) def on_maximize_toggle(self, action, value): action.set_state(value) if value.get_boolean(): self.maximize() else: self.unmaximize()
14,197
[ -0.020024975761771202, 0.0525655597448349, 0.019410783424973488, 0.04454629868268967, -0.029852045699954033, -0.014532012864947319, 0.014149591326713562, -0.03685151785612106, -0.028276005759835243, 0.019491903483867645, 0.026792675256729126, 0.018495289608836174, -0.00877830944955349, 0.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": {"_type": "arg", "_fields": {"arg": "kwargs", "annotation": null, "type_comment": null}}, "vararg": {"_type": "arg", "_fields": {"arg": "args", "annotation": null, "type_comment": null}}, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}}, "body": [{"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Starred", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "value": {"_type": "Name", "_fields": {"id": "args", "ctx": {"_type": "Load", "_fields": {}}}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "__init__", "value": {"_type": "Call", "_fields": {"args": [], "func": {"_type": "Name", "_fields": {"id": "super", "ctx": {"_type": "Load", "_fields": {}}}}, "keywords": []}}}}, "keywords": [{"_type": "keyword", "_fields": {"arg": null, "value": {"_type": "Name", "_fields": {"id": "kwargs", "ctx": {"_type": "Load", "_fields": {}}}}}}]}}}}, {"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"kind": null, "value": "maximize"}}, {"_type": "Constant", "_fields": {"kind": null, "value": null}}, {"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"kind": null, "value": false}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "new_boolean", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "Variant", "value": {"_type": "Name", "_fields": {"id": "GLib", "ctx": {"_type": "Load", "_fields": {}}}}}}}}, "keywords": []}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "new_stateful", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "SimpleAction", "value": {"_type": "Name", "_fields": {"id": "Gio", "ctx": {"_type": "Load", "_fields": {}}}}}}}}, "keywords": []}}, "targets": [{"_type": "Name", "_fields": {"id": "max_action", "ctx": {"_type": "Store", "_fields": {}}}}], "type_comment": null}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"kind": null, "value": "change-state"}}, {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "on_maximize_toggle", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "connect", "value": {"_type": "Name", "_fields": {"id": "max_action", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Name", "_fields": {"id": "max_action", "ctx": {"_type": "Load", "_fields": {}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "add_action", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"kind": null, "value": "notify::is-maximized"}}, {"_type": "Lambda", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "obj", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "pspec", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}}, "body": {"_type": "Call", "_fields": {"args": [{"_type": "Call", "_fields": {"args": [{"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "is_maximized", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "props", "value": {"_type": "Name", "_fields": {"id": "obj", "ctx": {"_type": "Load", "_fields": {}}}}}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "new_boolean", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "Variant", "value": {"_type": "Name", "_fields": {"id": "GLib", "ctx": {"_type": "Load", "_fields": {}}}}}}}}, "keywords": []}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "set_state", "value": {"_type": "Name", "_fields": {"id": "max_action", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "connect", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"kind": null, "value": "String 1"}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "new_string", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "Variant", "value": {"_type": "Name", "_fields": {"id": "GLib", "ctx": {"_type": "Load", "_fields": {}}}}}}}}, "keywords": []}}, "targets": [{"_type": "Name", "_fields": {"id": "lbl_variant", "ctx": {"_type": "Store", "_fields": {}}}}], "type_comment": null}}, {"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"kind": null, "value": "change_label"}}, {"_type": "Call", "_fields": {"args": [], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "get_type", "value": {"_type": "Name", "_fields": {"id": "lbl_variant", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}, {"_type": "Name", "_fields": {"id": "lbl_variant", "ctx": {"_type": "Load", "_fields": {}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "new_stateful", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "SimpleAction", "value": {"_type": "Name", "_fields": {"id": "Gio", "ctx": {"_type": "Load", "_fields": {}}}}}}}}, "keywords": []}}, "targets": [{"_type": "Name", "_fields": {"id": "lbl_action", "ctx": {"_type": "Store", "_fields": {}}}}], "type_comment": null}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"kind": null, "value": "change-state"}}, {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "on_change_label_state", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "connect", "value": {"_type": "Name", "_fields": {"id": "lbl_action", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Name", "_fields": {"id": "lbl_action", "ctx": {"_type": "Load", "_fields": {}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "add_action", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"args": [], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "Label", "value": {"_type": "Name", "_fields": {"id": "Gtk", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": [{"_type": "keyword", "_fields": {"arg": "label", "value": {"_type": "Call", "_fields": {"args": [], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "get_string", "value": {"_type": "Name", "_fields": {"id": "lbl_variant", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "keyword", "_fields": {"arg": "margin", "value": {"_type": "Constant", "_fields": {"kind": null, "value": 30}}}}]}}, "targets": [{"_type": "Attribute", "_fields": {"ctx": {"_type": "Store", "_fields": {}}, "attr": "label", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}], "type_comment": null}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "label", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "add", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "show", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "label", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}}}, "keywords": []}}}}], "name": "__init__", "returns": null, "type_params": [], "type_comment": null, "decorator_list": []}}], "type_ignores": []}}
def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) # This will be in the windows group and have the "win" prefix max_action = Gio.SimpleAction.new_stateful("maximize", None, GLib.Variant.new_boolean(False)) max_action.connect("change-state", self.on_maximize_toggle) self.add_action(max_action) # Keep it in sync with the actual state self.connect("notify::is-maximized", lambda obj, pspec: max_action.set_state( GLib.Variant.new_boolean(obj.props.is_maximized))) lbl_variant = GLib.Variant.new_string("String 1") lbl_action = Gio.SimpleAction.new_stateful("change_label", lbl_variant.get_type(), lbl_variant) lbl_action.connect("change-state", self.on_change_label_state) self.add_action(lbl_action) self.label = Gtk.Label(label=lbl_variant.get_string(), margin=30) self.add(self.label) self.label.show()
14,198
[ -0.009131698869168758, 0.02394605427980423, 0.031856995075941086, -0.01922294683754444, 0.012644710950553417, -0.013582935556769371, -0.0018937747227028012, -0.007644399534910917, -0.004048759583383799, 0.04279584437608719, -0.011983688920736313, -0.04639947786927223, 0.02356223575770855, ...
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": {"_type": "arg", "_fields": {"arg": "kwargs", "annotation": null, "type_comment": null}}, "vararg": {"_type": "arg", "_fields": {"arg": "args", "annotation": null, "type_comment": null}}, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}}, "body": [{"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Starred", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "value": {"_type": "Name", "_fields": {"id": "args", "ctx": {"_type": "Load", "_fields": {}}}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "__init__", "value": {"_type": "Call", "_fields": {"args": [], "func": {"_type": "Name", "_fields": {"id": "super", "ctx": {"_type": "Load", "_fields": {}}}}, "keywords": []}}}}, "keywords": [{"_type": "keyword", "_fields": {"arg": "application_id", "value": {"_type": "Constant", "_fields": {"kind": null, "value": "org.example.myapp"}}}}, {"_type": "keyword", "_fields": {"arg": "flags", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "HANDLES_COMMAND_LINE", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "ApplicationFlags", "value": {"_type": "Name", "_fields": {"id": "Gio", "ctx": {"_type": "Load", "_fields": {}}}}}}}}}}, {"_type": "keyword", "_fields": {"arg": null, "value": {"_type": "Name", "_fields": {"id": "kwargs", "ctx": {"_type": "Load", "_fields": {}}}}}}]}}}}, {"_type": "Assign", "_fields": {"value": {"_type": "Constant", "_fields": {"kind": null, "value": null}}, "targets": [{"_type": "Attribute", "_fields": {"ctx": {"_type": "Store", "_fields": {}}, "attr": "window", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}], "type_comment": null}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"kind": null, "value": "test"}}, {"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"kind": null, "value": "t"}}], "func": {"_type": "Name", "_fields": {"id": "ord", "ctx": {"_type": "Load", "_fields": {}}}}, "keywords": []}}, {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "NONE", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "OptionFlags", "value": {"_type": "Name", "_fields": {"id": "GLib", "ctx": {"_type": "Load", "_fields": {}}}}}}}}, {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "NONE", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "OptionArg", "value": {"_type": "Name", "_fields": {"id": "GLib", "ctx": {"_type": "Load", "_fields": {}}}}}}}}, {"_type": "Constant", "_fields": {"kind": null, "value": "Command line test"}}, {"_type": "Constant", "_fields": {"kind": null, "value": null}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "add_main_option", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}], "name": "__init__", "returns": null, "type_params": [], "type_comment": null, "decorator_list": []}}, {"_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": []}}, "body": [{"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "do_startup", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "Application", "value": {"_type": "Name", "_fields": {"id": "Gtk", "ctx": {"_type": "Load", "_fields": {}}}}}}}}, "keywords": []}}}}, {"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"kind": null, "value": "about"}}, {"_type": "Constant", "_fields": {"kind": null, "value": null}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "new", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "SimpleAction", "value": {"_type": "Name", "_fields": {"id": "Gio", "ctx": {"_type": "Load", "_fields": {}}}}}}}}, "keywords": []}}, "targets": [{"_type": "Name", "_fields": {"id": "action", "ctx": {"_type": "Store", "_fields": {}}}}], "type_comment": null}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"kind": null, "value": "activate"}}, {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "on_about", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "connect", "value": {"_type": "Name", "_fields": {"id": "action", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Name", "_fields": {"id": "action", "ctx": {"_type": "Load", "_fields": {}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "add_action", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"kind": null, "value": "quit"}}, {"_type": "Constant", "_fields": {"kind": null, "value": null}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "new", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "SimpleAction", "value": {"_type": "Name", "_fields": {"id": "Gio", "ctx": {"_type": "Load", "_fields": {}}}}}}}}, "keywords": []}}, "targets": [{"_type": "Name", "_fields": {"id": "action", "ctx": {"_type": "Store", "_fields": {}}}}], "type_comment": null}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"kind": null, "value": "activate"}}, {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "on_quit", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "connect", "value": {"_type": "Name", "_fields": {"id": "action", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Name", "_fields": {"id": "action", "ctx": {"_type": "Load", "_fields": {}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "add_action", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Name", "_fields": {"id": "MENU_XML", "ctx": {"_type": "Load", "_fields": {}}}}, {"_type": "UnaryOp", "_fields": {"op": {"_type": "USub", "_fields": {}}, "operand": {"_type": "Constant", "_fields": {"kind": null, "value": 1}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "new_from_string", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "Builder", "value": {"_type": "Name", "_fields": {"id": "Gtk", "ctx": {"_type": "Load", "_fields": {}}}}}}}}, "keywords": []}}, "targets": [{"_type": "Name", "_fields": {"id": "builder", "ctx": {"_type": "Store", "_fields": {}}}}], "type_comment": null}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"kind": null, "value": "app-menu"}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "get_object", "value": {"_type": "Name", "_fields": {"id": "builder", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "set_app_menu", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}], "name": "do_startup", "returns": null, "type_params": [], "type_comment": null, "decorator_list": []}}, {"_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": []}}, "body": [{"_type": "If", "_fields": {"body": [{"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"args": [], "func": {"_type": "Name", "_fields": {"id": "AppWindow", "ctx": {"_type": "Load", "_fields": {}}}}, "keywords": [{"_type": "keyword", "_fields": {"arg": "application", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}, {"_type": "keyword", "_fields": {"arg": "title", "value": {"_type": "Constant", "_fields": {"kind": null, "value": "Main Window"}}}}]}}, "targets": [{"_type": "Attribute", "_fields": {"ctx": {"_type": "Store", "_fields": {}}, "attr": "window", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}], "type_comment": null}}], "test": {"_type": "UnaryOp", "_fields": {"op": {"_type": "Not", "_fields": {}}, "operand": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "window", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}}}, "orelse": []}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "present", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "window", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}}}, "keywords": []}}}}], "name": "do_activate", "returns": null, "type_params": [], "type_comment": null, "decorator_list": []}}, {"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "command_line", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}}, "body": [{"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"args": [], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "get_options_dict", "value": {"_type": "Name", "_fields": {"id": "command_line", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}, "targets": [{"_type": "Name", "_fields": {"id": "options", "ctx": {"_type": "Store", "_fields": {}}}}], "type_comment": null}}, {"_type": "If", "_fields": {"body": [{"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"kind": null, "value": "Test argument recieved"}}], "func": {"_type": "Name", "_fields": {"id": "print", "ctx": {"_type": "Load", "_fields": {}}}}, "keywords": []}}}}], "test": {"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"kind": null, "value": "test"}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "contains", "value": {"_type": "Name", "_fields": {"id": "options", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}, "orelse": []}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "activate", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Return", "_fields": {"value": {"_type": "Constant", "_fields": {"kind": null, "value": 0}}}}], "name": "do_command_line", "returns": null, "type_params": [], "type_comment": null, "decorator_list": []}}, {"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "action", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "param", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}}, "body": [{"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"args": [], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "AboutDialog", "value": {"_type": "Name", "_fields": {"id": "Gtk", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": [{"_type": "keyword", "_fields": {"arg": "transient_for", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "window", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}}}, {"_type": "keyword", "_fields": {"arg": "modal", "value": {"_type": "Constant", "_fields": {"kind": null, "value": true}}}}]}}, "targets": [{"_type": "Name", "_fields": {"id": "about_dialog", "ctx": {"_type": "Store", "_fields": {}}}}], "type_comment": null}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "present", "value": {"_type": "Name", "_fields": {"id": "about_dialog", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}], "name": "on_about", "returns": null, "type_params": [], "type_comment": null, "decorator_list": []}}, {"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "action", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "param", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}}, "body": [{"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "quit", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}], "name": "on_quit", "returns": null, "type_params": [], "type_comment": null, "decorator_list": []}}], "name": "Application", "bases": [{"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "Application", "value": {"_type": "Name", "_fields": {"id": "Gtk", "ctx": {"_type": "Load", "_fields": {}}}}}}], "keywords": [], "type_params": [], "decorator_list": []}}], "type_ignores": []}}
class Application(Gtk.Application): def __init__(self, *args, **kwargs): super().__init__(*args, application_id="org.example.myapp", flags=Gio.ApplicationFlags.HANDLES_COMMAND_LINE, **kwargs) self.window = None self.add_main_option("test", ord("t"), GLib.OptionFlags.NONE, GLib.OptionArg.NONE, "Command line test", None) def do_startup(self): Gtk.Application.do_startup(self) action = Gio.SimpleAction.new("about", None) action.connect("activate", self.on_about) self.add_action(action) action = Gio.SimpleAction.new("quit", None) action.connect("activate", self.on_quit) self.add_action(action) builder = Gtk.Builder.new_from_string(MENU_XML, -1) self.set_app_menu(builder.get_object("app-menu")) def do_activate(self): # We only allow a single window and raise any existing ones if not self.window: # Windows are associated with the application # when the last one is closed the application shuts down self.window = AppWindow(application=self, title="Main Window") self.window.present() def do_command_line(self, command_line): options = command_line.get_options_dict() if options.contains("test"): # This is printed on the main instance print("Test argument recieved") self.activate() return 0 def on_about(self, action, param): about_dialog = Gtk.AboutDialog(transient_for=self.window, modal=True) about_dialog.present() def on_quit(self, action, param): self.quit()
14,199
[ -0.005520456004887819, 0.010155707597732544, 0.05502215400338173, 0.005045664496719837, 0.007167472504079342, -0.04137391597032547, 0.03811207041144371, -0.014313485473394394, -0.0007021279889158905, 0.06596650183200836, -0.015622515231370926, -0.01825130358338356, 0.02824070118367672, -0....
9
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": {"_type": "arg", "_fields": {"arg": "kwargs", "annotation": null, "type_comment": null}}, "vararg": {"_type": "arg", "_fields": {"arg": "args", "annotation": null, "type_comment": null}}, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}}, "body": [{"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Starred", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "value": {"_type": "Name", "_fields": {"id": "args", "ctx": {"_type": "Load", "_fields": {}}}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "__init__", "value": {"_type": "Call", "_fields": {"args": [], "func": {"_type": "Name", "_fields": {"id": "super", "ctx": {"_type": "Load", "_fields": {}}}}, "keywords": []}}}}, "keywords": [{"_type": "keyword", "_fields": {"arg": "application_id", "value": {"_type": "Constant", "_fields": {"kind": null, "value": "org.example.myapp"}}}}, {"_type": "keyword", "_fields": {"arg": "flags", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "HANDLES_COMMAND_LINE", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "ApplicationFlags", "value": {"_type": "Name", "_fields": {"id": "Gio", "ctx": {"_type": "Load", "_fields": {}}}}}}}}}}, {"_type": "keyword", "_fields": {"arg": null, "value": {"_type": "Name", "_fields": {"id": "kwargs", "ctx": {"_type": "Load", "_fields": {}}}}}}]}}}}, {"_type": "Assign", "_fields": {"value": {"_type": "Constant", "_fields": {"kind": null, "value": null}}, "targets": [{"_type": "Attribute", "_fields": {"ctx": {"_type": "Store", "_fields": {}}, "attr": "window", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}], "type_comment": null}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"kind": null, "value": "test"}}, {"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"kind": null, "value": "t"}}], "func": {"_type": "Name", "_fields": {"id": "ord", "ctx": {"_type": "Load", "_fields": {}}}}, "keywords": []}}, {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "NONE", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "OptionFlags", "value": {"_type": "Name", "_fields": {"id": "GLib", "ctx": {"_type": "Load", "_fields": {}}}}}}}}, {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "NONE", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "OptionArg", "value": {"_type": "Name", "_fields": {"id": "GLib", "ctx": {"_type": "Load", "_fields": {}}}}}}}}, {"_type": "Constant", "_fields": {"kind": null, "value": "Command line test"}}, {"_type": "Constant", "_fields": {"kind": null, "value": null}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "add_main_option", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}], "name": "__init__", "returns": null, "type_params": [], "type_comment": null, "decorator_list": []}}], "type_ignores": []}}
def __init__(self, *args, **kwargs): super().__init__(*args, application_id="org.example.myapp", flags=Gio.ApplicationFlags.HANDLES_COMMAND_LINE, **kwargs) self.window = None self.add_main_option("test", ord("t"), GLib.OptionFlags.NONE, GLib.OptionArg.NONE, "Command line test", None)
14,200
[ -0.018360944464802742, 0.0526927150785923, 0.015221850015223026, 0.011895512230694294, -0.01421954296529293, -0.01739167980849743, 0.029650665819644928, 0.030597900971770287, 0.014461859129369259, 0.01599285565316677, -0.01586068421602249, -0.02035454288125038, 0.015926769003272057, -0.060...
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": []}}, "body": [{"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "do_startup", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "Application", "value": {"_type": "Name", "_fields": {"id": "Gtk", "ctx": {"_type": "Load", "_fields": {}}}}}}}}, "keywords": []}}}}, {"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"kind": null, "value": "about"}}, {"_type": "Constant", "_fields": {"kind": null, "value": null}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "new", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "SimpleAction", "value": {"_type": "Name", "_fields": {"id": "Gio", "ctx": {"_type": "Load", "_fields": {}}}}}}}}, "keywords": []}}, "targets": [{"_type": "Name", "_fields": {"id": "action", "ctx": {"_type": "Store", "_fields": {}}}}], "type_comment": null}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"kind": null, "value": "activate"}}, {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "on_about", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "connect", "value": {"_type": "Name", "_fields": {"id": "action", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Name", "_fields": {"id": "action", "ctx": {"_type": "Load", "_fields": {}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "add_action", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"kind": null, "value": "quit"}}, {"_type": "Constant", "_fields": {"kind": null, "value": null}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "new", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "SimpleAction", "value": {"_type": "Name", "_fields": {"id": "Gio", "ctx": {"_type": "Load", "_fields": {}}}}}}}}, "keywords": []}}, "targets": [{"_type": "Name", "_fields": {"id": "action", "ctx": {"_type": "Store", "_fields": {}}}}], "type_comment": null}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"kind": null, "value": "activate"}}, {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "on_quit", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "connect", "value": {"_type": "Name", "_fields": {"id": "action", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Name", "_fields": {"id": "action", "ctx": {"_type": "Load", "_fields": {}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "add_action", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}, {"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Name", "_fields": {"id": "MENU_XML", "ctx": {"_type": "Load", "_fields": {}}}}, {"_type": "UnaryOp", "_fields": {"op": {"_type": "USub", "_fields": {}}, "operand": {"_type": "Constant", "_fields": {"kind": null, "value": 1}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "new_from_string", "value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "Builder", "value": {"_type": "Name", "_fields": {"id": "Gtk", "ctx": {"_type": "Load", "_fields": {}}}}}}}}, "keywords": []}}, "targets": [{"_type": "Name", "_fields": {"id": "builder", "ctx": {"_type": "Store", "_fields": {}}}}], "type_comment": null}}, {"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"kind": null, "value": "app-menu"}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "get_object", "value": {"_type": "Name", "_fields": {"id": "builder", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "set_app_menu", "value": {"_type": "Name", "_fields": {"id": "self", "ctx": {"_type": "Load", "_fields": {}}}}}}, "keywords": []}}}}], "name": "do_startup", "returns": null, "type_params": [], "type_comment": null, "decorator_list": []}}], "type_ignores": []}}
def do_startup(self): Gtk.Application.do_startup(self) action = Gio.SimpleAction.new("about", None) action.connect("activate", self.on_about) self.add_action(action) action = Gio.SimpleAction.new("quit", None) action.connect("activate", self.on_quit) self.add_action(action) builder = Gtk.Builder.new_from_string(MENU_XML, -1) self.set_app_menu(builder.get_object("app-menu"))