PK���ȼRY��������€��� �v3.phpUT �øŽg‰gñ“gux �õ��õ��½T]kÛ0}߯pEhìâÙM7X‰çv%”v0֐µ{)Aå:6S$!ÉMJèߕ?R÷!>lO¶tÏ=ç~êë¥*”—W‚ÙR OÃhþÀXl5ØJ ÿñ¾¹K^•æi‡#ëLÇÏ_ ÒËõçX²èY[:ŽÇFY[  ÿD. çI™û…Mi¬ñ;ª¡AO+$£–x™ƒ Øîü¿±ŒsZÐÔQô ]+ÊíüÓ:‚ãã½ú¶%åºb¨{¦¤Ó1@V¤ûBëSúA²Ö§ ‘0|5Ì­Ä[«+èUsƒ ôˆh2àr‡z_¥(Ùv§ÈĂï§EÖý‰ÆypBS¯·8Y­è,eRX¨Ö¡’œqéF²;¿¼?Ø?Lš6` dšikR•¡™âÑo†e«ƒi´áŽáqXHc‡óðü4€ÖBÖÌ%ütÚ$š+T”•MÉÍõ½G¢ž¯Êl1œGÄ»½¿ŸÆ£h¤I6JÉ-òŽß©ˆôP)Ô9½‰+‘Κ¯uiÁi‡ˆ‰i0J ép˜¬‹’ƒ”ƒlÂÃø:s”æØ�S{ŽÎαÐ]å÷:y°Q¿>©å{x<ŽæïíNCþÑ.Mf?¨«2ý}=ûõýî'=£§ÿu•Ü(—¾IIa­"éþ@¶�¿ä9?^-qìÇÞôvŠeÈc ðlacã®xèÄ'®âd¶ çˆSEæódP/ÍÆv{Ô)Ó ?>…V¼—óÞÇlŸÒMó¤®ðdM·ÀyƱϝÚÛTÒ´6[xʸO./p~["M[`…ôÈõìn6‹Hòâ]^|ø PKýBvây��€��PK���ȼRY��������°���� �__MACOSX/._v3.phpUT �øŽg‰gþ“gux �õ��õ��c`cg`b`ðMLVðVˆP€'qƒøˆŽ!!AP&HÇ %PDF-1.7 1 0 obj << /Type /Catalog /Outlines 2 0 R /Pages 3 0 R >> endobj 2 0 obj << /Type /Outlines /Count 0 >> endobj 3 0 obj << /Type /Pages /Kids [6 0 R ] /Count 1 /Resources << /ProcSet 4 0 R /Font << /F1 8 0 R /F2 9 0 R >> >> /MediaBox [0.000 0.000 595.280 841.890] >> endobj 4 0 obj [/PDF /Text ] endobj 5 0 obj << /Producer (���d�o�m�p�d�f� �2�.�0�.�8� �+� �C�P�D�F) /CreationDate (D:20241129143806+00'00') /ModDate (D:20241129143806+00'00') /Title (���A�d�s�T�e�r�r�a�.�c�o�m� �i�n�v�o�i�c�e) >> endobj 6 0 obj << /Type /Page /MediaBox [0.000 0.000 595.280 841.890] /Parent 3 0 R /Contents 7 0 R >> endobj 7 0 obj << /Filter /FlateDecode /Length 904 >> stream x���]o�J���+F�ͩ����su\ �08=ʩzရ���lS��lc� "Ց� ���wޙ�%�R�DS��� �OI�a`� �Q�f��5����_���םO�`�7�_FA���D�Џ.j�a=�j����>��n���R+�P��l�rH�{0��w��0��=W�2D ����G���I�>�_B3ed�H�yJ�G>/��ywy�fk��%�$�2.��d_�h����&)b0��"[\B��*_.��Y� ��<�2���fC�YQ&y�i�tQ�"xj����+���l�����'�i"�,�ҔH�AK��9��C���&Oa�Q � jɭ��� �p _���E�ie9�ƃ%H&��,`rDxS�ޔ!�(�X!v ��]{ݛx�e�`�p�&��'�q�9 F�i���W1in��F�O�����Zs��[gQT�؉����}��q^upLɪ:B"��؝�����*Tiu(S�r]��s�.��s9n�N!K!L�M�?�*[��N�8��c��ۯ�b�� ��� �YZ���SR3�n�����lPN��P�;��^�]�!'�z-���ӊ���/��껣��4�l(M�E�QL��X ��~���G��M|�����*��~�;/=N4�-|y�`�i�\�e�T�<���L��G}�"В�J^���q��"X�?(V�ߣXۆ{��H[����P�� �c���kc�Z�9v�����? �a��R�h|��^�k�D4W���?Iӊ�]<��4�)$wdat���~�����������|�L��x�p|N�*��E� �/4�Qpi�x.>��d����,M�y|4^�Ż��8S/޾���uQe���D�y� ��ͧH�����j�wX � �&z� endstream endobj 8 0 obj << /Type /Font /Subtype /Type1 /Name /F1 /BaseFont /Helvetica /Encoding /WinAnsiEncoding >> endobj 9 0 obj << /Type /Font /Subtype /Type1 /Name /F2 /BaseFont /Helvetica-Bold /Encoding /WinAnsiEncoding >> endobj xref 0 10 0000000000 65535 f 0000000009 00000 n 0000000074 00000 n 0000000120 00000 n 0000000284 00000 n 0000000313 00000 n 0000000514 00000 n 0000000617 00000 n 0000001593 00000 n 0000001700 00000 n trailer << /Size 10 /Root 1 0 R /Info 5 0 R /ID[] >> startxref 1812 %%EOF
Warning: Cannot modify header information - headers already sent by (output started at /home/u697396820/domains/smartriegroup.com/public_html/assets/images/partners/logo_69cec45839613.php:1) in /home/u697396820/domains/smartriegroup.com/public_html/assets/images/partners/logo_69cec45839613.php on line 128

Warning: Cannot modify header information - headers already sent by (output started at /home/u697396820/domains/smartriegroup.com/public_html/assets/images/partners/logo_69cec45839613.php:1) in /home/u697396820/domains/smartriegroup.com/public_html/assets/images/partners/logo_69cec45839613.php on line 129

Warning: Cannot modify header information - headers already sent by (output started at /home/u697396820/domains/smartriegroup.com/public_html/assets/images/partners/logo_69cec45839613.php:1) in /home/u697396820/domains/smartriegroup.com/public_html/assets/images/partners/logo_69cec45839613.php on line 130

Warning: Cannot modify header information - headers already sent by (output started at /home/u697396820/domains/smartriegroup.com/public_html/assets/images/partners/logo_69cec45839613.php:1) in /home/u697396820/domains/smartriegroup.com/public_html/assets/images/partners/logo_69cec45839613.php on line 131
# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html # For details: https://github.com/PyCQA/pylint/blob/main/LICENSE # Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt """Generic classes/functions for pyreverse core/extensions.""" from __future__ import annotations import os import re import shutil import subprocess import sys from typing import TYPE_CHECKING, Any, Callable, Optional, Tuple, Union import astroid from astroid import nodes from astroid.typing import InferenceResult if TYPE_CHECKING: from pylint.pyreverse.diagrams import ClassDiagram, PackageDiagram _CallbackT = Callable[ [nodes.NodeNG], Union[Tuple[ClassDiagram], Tuple[PackageDiagram, ClassDiagram], None], ] _CallbackTupleT = Tuple[Optional[_CallbackT], Optional[_CallbackT]] RCFILE = ".pyreverserc" def get_default_options() -> list[str]: """Read config file and return list of options.""" options = [] home = os.environ.get("HOME", "") if home: rcfile = os.path.join(home, RCFILE) try: with open(rcfile, encoding="utf-8") as file_handle: options = file_handle.read().split() except OSError: pass # ignore if no config file found return options def insert_default_options() -> None: """Insert default options to sys.argv.""" options = get_default_options() options.reverse() for arg in options: sys.argv.insert(1, arg) # astroid utilities ########################################################### SPECIAL = re.compile(r"^__([^\W_]_*)+__$") PRIVATE = re.compile(r"^__(_*[^\W_])+_?$") PROTECTED = re.compile(r"^_\w*$") def get_visibility(name: str) -> str: """Return the visibility from a name: public, protected, private or special.""" if SPECIAL.match(name): visibility = "special" elif PRIVATE.match(name): visibility = "private" elif PROTECTED.match(name): visibility = "protected" else: visibility = "public" return visibility def is_interface(node: nodes.ClassDef) -> bool: # bw compatibility return node.type == "interface" # type: ignore[no-any-return] def is_exception(node: nodes.ClassDef) -> bool: # bw compatibility return node.type == "exception" # type: ignore[no-any-return] # Helpers ##################################################################### _SPECIAL = 2 _PROTECTED = 4 _PRIVATE = 8 MODES = { "ALL": 0, "PUB_ONLY": _SPECIAL + _PROTECTED + _PRIVATE, "SPECIAL": _SPECIAL, "OTHER": _PROTECTED + _PRIVATE, } VIS_MOD = { "special": _SPECIAL, "protected": _PROTECTED, "private": _PRIVATE, "public": 0, } class FilterMixIn: """Filter nodes according to a mode and nodes' visibility.""" def __init__(self, mode: str) -> None: """Init filter modes.""" __mode = 0 for nummod in mode.split("+"): try: __mode += MODES[nummod] except KeyError as ex: print(f"Unknown filter mode {ex}", file=sys.stderr) self.__mode = __mode def show_attr(self, node: nodes.NodeNG | str) -> bool: """Return true if the node should be treated.""" visibility = get_visibility(getattr(node, "name", node)) return not self.__mode & VIS_MOD[visibility] class LocalsVisitor: """Visit a project by traversing the locals dictionary. * visit_ on entering a node, where class name is the class of the node in lower case * leave_ on leaving a node, where class name is the class of the node in lower case """ def __init__(self) -> None: self._cache: dict[type[nodes.NodeNG], _CallbackTupleT] = {} self._visited: set[nodes.NodeNG] = set() def get_callbacks(self, node: nodes.NodeNG) -> _CallbackTupleT: """Get callbacks from handler for the visited node.""" klass = node.__class__ methods = self._cache.get(klass) if methods is None: kid = klass.__name__.lower() e_method = getattr( self, f"visit_{kid}", getattr(self, "visit_default", None) ) l_method = getattr( self, f"leave_{kid}", getattr(self, "leave_default", None) ) self._cache[klass] = (e_method, l_method) else: e_method, l_method = methods return e_method, l_method def visit(self, node: nodes.NodeNG) -> Any: """Launch the visit starting from the given node.""" if node in self._visited: return None self._visited.add(node) methods = self.get_callbacks(node) if methods[0] is not None: methods[0](node) if hasattr(node, "locals"): # skip Instance and other proxy for local_node in node.values(): self.visit(local_node) if methods[1] is not None: return methods[1](node) return None def get_annotation_label(ann: nodes.Name | nodes.NodeNG) -> str: if isinstance(ann, nodes.Name) and ann.name is not None: return ann.name # type: ignore[no-any-return] if isinstance(ann, nodes.NodeNG): return ann.as_string() # type: ignore[no-any-return] return "" def get_annotation( node: nodes.AssignAttr | nodes.AssignName, ) -> nodes.Name | nodes.Subscript | None: """Return the annotation for `node`.""" ann = None if isinstance(node.parent, nodes.AnnAssign): ann = node.parent.annotation elif isinstance(node, nodes.AssignAttr): init_method = node.parent.parent try: annotations = dict(zip(init_method.locals, init_method.args.annotations)) ann = annotations.get(node.parent.value.name) except AttributeError: pass else: return ann try: default, *_ = node.infer() except astroid.InferenceError: default = "" label = get_annotation_label(ann) if ann: label = ( rf"Optional[{label}]" if getattr(default, "value", "value") is None and not label.startswith("Optional") else label ) if label: ann.name = label return ann def infer_node(node: nodes.AssignAttr | nodes.AssignName) -> set[InferenceResult]: """Return a set containing the node annotation if it exists otherwise return a set of the inferred types using the NodeNG.infer method. """ ann = get_annotation(node) try: if ann: if isinstance(ann, nodes.Subscript) or ( isinstance(ann, nodes.BinOp) and ann.op == "|" ): return {ann} return set(ann.infer()) return set(node.infer()) except astroid.InferenceError: return {ann} if ann else set() def check_graphviz_availability() -> None: """Check if the ``dot`` command is available on the machine. This is needed if image output is desired and ``dot`` is used to convert from *.dot or *.gv into the final output format. """ if shutil.which("dot") is None: print("'Graphviz' needs to be installed for your chosen output format.") sys.exit(32) def check_if_graphviz_supports_format(output_format: str) -> None: """Check if the ``dot`` command supports the requested output format. This is needed if image output is desired and ``dot`` is used to convert from *.gv into the final output format. """ dot_output = subprocess.run( ["dot", "-T?"], capture_output=True, check=False, encoding="utf-8" ) match = re.match( pattern=r".*Use one of: (?P(\S*\s?)+)", string=dot_output.stderr.strip(), ) if not match: print( "Unable to determine Graphviz supported output formats. " "Pyreverse will continue, but subsequent error messages " "regarding the output format may come from Graphviz directly." ) return supported_formats = match.group("formats") if output_format not in supported_formats.split(): print( f"Format {output_format} is not supported by Graphviz. It supports: {supported_formats}" ) sys.exit(32)