Fix execution in Python 3.11

This fixes the following error:

  ValueError: mutable default <class 'slither.utils.loc.LoCInfo'> for field src is not allowed: use default_factory
pull/2002/head
Emilio López 1 year ago
parent 273cca4167
commit cbe6716afd
  1. 8
      slither/utils/loc.py

@ -1,4 +1,4 @@
from dataclasses import dataclass
from dataclasses import dataclass, field
from pathlib import Path
from typing import List, Tuple
@ -19,9 +19,9 @@ class LoCInfo:
@dataclass
class LoC:
src: LoCInfo = LoCInfo()
dep: LoCInfo = LoCInfo()
test: LoCInfo = LoCInfo()
src: LoCInfo = field(default_factory=LoCInfo)
dep: LoCInfo = field(default_factory=LoCInfo)
test: LoCInfo = field(default_factory=LoCInfo)
def to_pretty_table(self) -> MyPrettyTable:
table = MyPrettyTable(["", "src", "dep", "test"])

Loading…
Cancel
Save