1919from abc import ABCMeta
2020from functools import lru_cache
2121from pathlib import Path
22- from typing import Any , List , Optional , Union
22+ from typing import Any , Optional , Union
2323
2424from pytkdocs .parsers .docstrings .base import Parser , Section
2525from pytkdocs .properties import NAME_CLASS_PRIVATE , NAME_PRIVATE , NAME_SPECIAL , ApplicableNameProperty
@@ -32,7 +32,7 @@ class Source:
3232 [`inspect.getsourceslines`](https://docs.python.org/3/library/inspect.html#inspect.getsourcelines).
3333 """
3434
35- def __init__ (self , lines : Union [str , List [str ]], line_start : int ) -> None :
35+ def __init__ (self , lines : Union [str , list [str ]], line_start : int ) -> None :
3636 """Initialize the object.
3737
3838 Arguments:
@@ -52,7 +52,7 @@ class Object(metaclass=ABCMeta): # noqa: B024
5252 Each instance additionally stores references to its children, grouped by category.
5353 """
5454
55- possible_name_properties : List [ApplicableNameProperty ] = [] # noqa: RUF012
55+ possible_name_properties : list [ApplicableNameProperty ] = [] # noqa: RUF012
5656 """
5757 The properties that we can apply to the object based on its name.
5858
@@ -65,7 +65,7 @@ def __init__(
6565 path : str ,
6666 file_path : str ,
6767 docstring : Optional [str ] = "" ,
68- properties : Optional [List [str ]] = None ,
68+ properties : Optional [list [str ]] = None ,
6969 source : Optional [Source ] = None ,
7070 ) -> None :
7171 """Initialize the object.
@@ -86,9 +86,9 @@ def __init__(
8686 """The file path of the object's direct parent module."""
8787 self .docstring = docstring
8888 """The object's docstring."""
89- self .docstring_sections : List [Section ] = []
89+ self .docstring_sections : list [Section ] = []
9090 """The object's docstring parsed into sections."""
91- self .docstring_errors : List [str ] = []
91+ self .docstring_errors : list [str ] = []
9292 """The errors detected while parsing the docstring."""
9393 self .properties = properties or []
9494 """The object's properties."""
@@ -100,17 +100,17 @@ def __init__(
100100 self ._path_map = {self .path : self }
101101 self ._parsed = False
102102
103- self .attributes : List [Attribute ] = []
103+ self .attributes : list [Attribute ] = []
104104 """The list of all the object's attributes."""
105- self .methods : List [Method ] = []
105+ self .methods : list [Method ] = []
106106 """The list of all the object's methods."""
107- self .functions : List [Function ] = []
107+ self .functions : list [Function ] = []
108108 """The list of all the object's functions."""
109- self .modules : List [Module ] = []
109+ self .modules : list [Module ] = []
110110 """The list of all the object's submodules."""
111- self .classes : List [Class ] = []
111+ self .classes : list [Class ] = []
112112 """The list of all the object's classes."""
113- self .children : List [Object ] = []
113+ self .children : list [Object ] = []
114114 """The list of all the object's children."""
115115
116116 def __str__ (self ) -> str :
@@ -193,7 +193,7 @@ def name_to_check(self) -> str:
193193 return self .name
194194
195195 @property
196- def name_properties (self ) -> List [str ]:
196+ def name_properties (self ) -> list [str ]:
197197 """Return the object's name properties.
198198
199199 Returns:
@@ -253,7 +253,7 @@ def add_child(self, obj: "Object") -> None:
253253
254254 self ._path_map [obj .path ] = obj
255255
256- def add_children (self , children : List ["Object" ]) -> None :
256+ def add_children (self , children : list ["Object" ]) -> None :
257257 """Add a list of objects as children of this object.
258258
259259 Arguments:
@@ -309,7 +309,7 @@ def has_contents(self) -> bool:
309309class Module (Object ):
310310 """A class to store information about a module."""
311311
312- possible_name_properties : List [ApplicableNameProperty ] = [NAME_SPECIAL , NAME_PRIVATE ] # noqa: RUF012
312+ possible_name_properties : list [ApplicableNameProperty ] = [NAME_SPECIAL , NAME_PRIVATE ] # noqa: RUF012
313313
314314 @property
315315 def file_name (self ) -> str :
@@ -328,9 +328,9 @@ def name_to_check(self) -> str: # noqa: D102
328328class Class (Object ):
329329 """A class to store information about a class."""
330330
331- possible_name_properties : List [ApplicableNameProperty ] = [NAME_PRIVATE ] # noqa: RUF012
331+ possible_name_properties : list [ApplicableNameProperty ] = [NAME_PRIVATE ] # noqa: RUF012
332332
333- def __init__ (self , * args : Any , bases : Optional [List [str ]] = None , ** kwargs : Any ):
333+ def __init__ (self , * args : Any , bases : Optional [list [str ]] = None , ** kwargs : Any ):
334334 """Initialize the object.
335335
336336 Arguments:
@@ -348,7 +348,7 @@ class Function(Object):
348348 It accepts an additional `signature` argument at instantiation.
349349 """
350350
351- possible_name_properties : List [ApplicableNameProperty ] = [NAME_PRIVATE ] # noqa: RUF012
351+ possible_name_properties : list [ApplicableNameProperty ] = [NAME_PRIVATE ] # noqa: RUF012
352352
353353 def __init__ (self , * args : Any , signature : Optional [inspect .Signature ] = None , ** kwargs : Any ):
354354 """Initialize the object.
@@ -368,7 +368,7 @@ class Method(Object):
368368 It accepts an additional `signature` argument at instantiation.
369369 """
370370
371- possible_name_properties : List [ApplicableNameProperty ] = [NAME_SPECIAL , NAME_PRIVATE ] # noqa: RUF012
371+ possible_name_properties : list [ApplicableNameProperty ] = [NAME_SPECIAL , NAME_PRIVATE ] # noqa: RUF012
372372
373373 def __init__ (self , * args : Any , signature : Optional [inspect .Signature ] = None , ** kwargs : Any ):
374374 """Initialize the object.
@@ -388,7 +388,7 @@ class Attribute(Object):
388388 It accepts an additional `attr_type` argument at instantiation.
389389 """
390390
391- possible_name_properties : List [ApplicableNameProperty ] = [NAME_SPECIAL , NAME_CLASS_PRIVATE , NAME_PRIVATE ] # noqa: RUF012
391+ possible_name_properties : list [ApplicableNameProperty ] = [NAME_SPECIAL , NAME_CLASS_PRIVATE , NAME_PRIVATE ] # noqa: RUF012
392392
393393 def __init__ (self , * args : Any , attr_type : Optional [Any ] = None , ** kwargs : Any ):
394394 """Initialize the object.
0 commit comments