MCPcopy Index your code
hub / github.com/python/mypy / ParamSpecExpr

Class ParamSpecExpr

mypy/nodes.py:3280–3328  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3278
3279
3280class ParamSpecExpr(TypeVarLikeExpr):
3281 __slots__ = ()
3282
3283 __match_args__ = ("name", "upper_bound", "default")
3284
3285 def accept(self, visitor: ExpressionVisitor[T]) -> T:
3286 return visitor.visit_paramspec_expr(self)
3287
3288 def serialize(self) -> JsonDict:
3289 return {
3290 ".class": "ParamSpecExpr",
3291 "name": self._name,
3292 "fullname": self._fullname,
3293 "upper_bound": self.upper_bound.serialize(),
3294 "default": self.default.serialize(),
3295 "variance": self.variance,
3296 }
3297
3298 @classmethod
3299 def deserialize(cls, data: JsonDict) -> ParamSpecExpr:
3300 assert data[".class"] == "ParamSpecExpr"
3301 return ParamSpecExpr(
3302 data["name"],
3303 data["fullname"],
3304 mypy.types.deserialize_type(data["upper_bound"]),
3305 mypy.types.deserialize_type(data["default"]),
3306 data["variance"],
3307 )
3308
3309 def write(self, data: WriteBuffer) -> None:
3310 write_tag(data, PARAM_SPEC_EXPR)
3311 write_str(data, self._name)
3312 write_str(data, self._fullname)
3313 self.upper_bound.write(data)
3314 self.default.write(data)
3315 write_int(data, self.variance)
3316 write_tag(data, END_TAG)
3317
3318 @classmethod
3319 def read(cls, data: ReadBuffer) -> ParamSpecExpr:
3320 ret = ParamSpecExpr(
3321 read_str(data),
3322 read_str(data),
3323 mypy.types.read_type(data),
3324 mypy.types.read_type(data),
3325 read_int(data),
3326 )
3327 assert read_tag(data) == END_TAG
3328 return ret
3329
3330
3331class TypeVarTupleExpr(TypeVarLikeExpr):

Callers 5

analyze_type_paramMethod · 0.90
visit_paramspec_exprMethod · 0.90
deserializeMethod · 0.85
readMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…