We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
Human-summary printer: show number of lines of assemly code
The human summary printer should show if a contract uses inline assembly, and if so, shows the number of lines of assembly code

--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `slither/printers/summary/human_summary.py`
Content:
```
1 """
2 Module printing summary of the contract
3 """
4 import logging
5 
6 from slither.printers.abstract_printer import AbstractPrinter
7 from slither.utils import output
8 from slither.utils.code_complexity import compute_cyclomatic_complexity
9 from slither.utils.colors import green, red, yellow
10 from slither.utils.standard_libraries import is_standard_library
11 
12 class PrinterHumanSummary(AbstractPrinter):
13     ARGUMENT = 'human-summary'
14     HELP = 'Print a human-readable summary of the contracts'
15 
16     WIKI = 'https://github.com/trailofbits/slither/wiki/Printer-documentation#human-summary'
17 
18     @staticmethod
19     def _get_summary_erc20(contract):
20 
21         functions_name = [f.name for f in contract.functions]
22         state_variables = [v.name for v in contract.state_variables]
23 
24         pause = 'pause' in functions_name
25 
26         if 'mint' in functions_name:
27             if not 'mintingFinished' in state_variables:
28                 mint_limited = False
29             else:
30                 mint_limited = True
31         else:
32             mint_limited = None # no minting
33 
34         race_condition_mitigated = 'increaseApproval' in functions_name or\
35                                    'safeIncreaseAllowance' in functions_name
36 
37         return pause, mint_limited, race_condition_mitigated
38 
39 
40     def get_summary_erc20(self, contract):
41         txt = ''
42 
43         pause, mint_limited, race_condition_mitigated = self._get_summary_erc20(contract)
44 
45         if pause:
46             txt += "\t\t Can be paused? : {}\n".format(yellow('Yes'))
47         else:
48             txt += "\t\t Can be paused? : {}\n".format(green('No'))
49 
50         if mint_limited is None:
51             txt += "\t\t Minting restriction? : {}\n".format(green('No Minting'))
52         else:
53             if mint_limited:
54                 txt += "\t\t Minting restriction? : {}\n".format(red('Yes'))
55             else:
56                 txt += "\t\t Minting restriction? : {}\n".format(yellow('No'))
57 
58         if race_condition_mitigated:
59             txt += "\t\t ERC20 race condition mitigation: {}\n".format(green('Yes'))
60         else:
61             txt += "\t\t ERC20 race condition mitigation: {}\n".format(red('No'))
62 
63         return txt
64 
65     def _get_detectors_result(self):
66         # disable detectors logger
67         logger = logging.getLogger('Detectors')
68         logger.setLevel(logging.ERROR)
69 
70         checks_optimization = self.slither.detectors_optimization
71         checks_informational = self.slither.detectors_informational
72         checks_low = self.slither.detectors_low
73         checks_medium = self.slither.detectors_medium
74         checks_high = self.slither.detectors_high
75 
76         issues_optimization = [c.detect() for c in checks_optimization]
77         issues_optimization = [c for c in issues_optimization if c]
78         issues_optimization = [item for sublist in issues_optimization for item in sublist]
79 
80         issues_informational = [c.detect() for c in checks_informational]
81         issues_informational = [c for c in issues_informational if c]
82         issues_informational = [item for sublist in issues_informational for item in sublist]
83 
84         issues_low = [c.detect() for c in checks_low]
85         issues_low = [c for c in issues_low if c]
86         issues_low = [item for sublist in issues_low for item in sublist]
87 
88         issues_medium = (c.detect() for c in checks_medium)
89         issues_medium = [c for c in issues_medium if c]
90         issues_medium = [item for sublist in issues_medium for item in sublist]
91 
92         issues_high = [c.detect() for c in checks_high]
93         issues_high = [c for c in issues_high if c]
94         issues_high = [item for sublist in issues_high for item in sublist]
95 
96 
97 
98         return (len(issues_optimization),
99                 len(issues_informational),
100                 len(issues_low),
101                 len(issues_medium),
102                 len(issues_high))
103 
104     def get_detectors_result(self):
105         issues_optimization, issues_informational, issues_low, issues_medium, issues_high = self._get_detectors_result()
106         txt = "Number of optimization issues: {}\n".format(green(issues_optimization))
107         txt += "Number of informational issues: {}\n".format(green(issues_informational))
108         txt += "Number of low issues: {}\n".format(green(issues_low))
109         if issues_medium > 0:
110             txt += "Number of medium issues: {}\n".format(yellow(issues_medium))
111         else:
112             txt += "Number of medium issues: {}\n".format(green(issues_medium))
113         if issues_high > 0:
114             txt += "Number of high issues: {}\n".format(red(issues_high))
115         else:
116             txt += "Number of high issues: {}\n\n".format(green(issues_high))
117 
118         return txt
119 
120     @staticmethod
121     def _is_complex_code(contract):
122         for f in contract.functions:
123             if compute_cyclomatic_complexity(f) > 7:
124                 return True
125         return False
126 
127     def is_complex_code(self, contract):
128         """
129             Check if the code is complex
130             Heuristic, the code is complex if:
131                 - One function has a cyclomatic complexity > 7
132         Args:
133             contract
134         """
135 
136         is_complex = self._is_complex_code(contract)
137 
138         result = red('Yes') if is_complex else green('No')
139 
140         return "\tComplex code? {}\n".format(result)
141 
142     @staticmethod
143     def _number_functions(contract):
144         return len(contract.functions)
145 
146     def _lines_number(self):
147         if not self.slither.source_code:
148             return None
149         total_dep_lines = 0
150         total_lines = 0
151         for filename, source_code in self.slither.source_code.items():
152             lines = len(source_code.splitlines())
153             is_dep = False
154             if self.slither.crytic_compile:
155                 is_dep = self.slither.crytic_compile.is_dependency(filename)
156             if is_dep:
157                 total_dep_lines += lines
158             else:
159                 total_lines += lines
160         return total_lines, total_dep_lines
161 
162     def _compilation_type(self):
163         if self.slither.crytic_compile is None:
164             return 'Compilation non standard\n'
165         return f'Compiled with {self.slither.crytic_compile.type}\n'
166 
167     def _number_contracts(self):
168         if self.slither.crytic_compile is None:
169             len(self.slither.contracts), 0
170         deps = [c for c in self.slither.contracts if c.is_from_dependency()]
171         contracts = [c for c in self.slither.contracts if not c.is_from_dependency()]
172         return len(contracts), len(deps)
173 
174     def _standard_libraries(self):
175         libraries = []
176         for contract in self.contracts:
177             lib = is_standard_library(contract)
178             if lib:
179                 libraries.append(lib)
180 
181         return libraries
182 
183     def _ercs(self):
184         ercs = []
185         for contract in self.contracts:
186             ercs += contract.ercs()
187         return list(set(ercs))
188 
189     def output(self, _filename):
190         """
191         _filename is not used
192             Args:
193                 _filename(string)
194         """
195 
196         txt = "\n"
197         txt += self._compilation_type()
198 
199         results = {
200             'contracts': {
201                 "elements": []
202             },
203             'number_lines': 0,
204             'number_lines_in_dependencies': 0,
205             'standard_libraries': [],
206             'ercs': [],
207         }
208 
209 
210         lines_number = self._lines_number()
211         if lines_number:
212             total_lines, total_dep_lines = lines_number
213             txt += f'Number of lines: {total_lines} (+ {total_dep_lines} in dependencies)\n'
214             results['number_lines'] = total_lines
215             results['number_lines__dependencies'] = total_dep_lines
216 
217         number_contracts, number_contracts_deps = self._number_contracts()
218         txt += f'Number of contracts: {number_contracts} (+ {number_contracts_deps} in dependencies) \n\n'
219 
220         txt += self.get_detectors_result()
221 
222         libs = self._standard_libraries()
223         if libs:
224             txt += f'\nUse: {", ".join(libs)}\n'
225             results['standard_libraries'] = [str(l) for l in libs]
226 
227         ercs = self._ercs()
228         if ercs:
229             txt += f'ERCs: {", ".join(ercs)}\n'
230             results['ercs'] = [str(e) for e in ercs]
231 
232         for contract in self.slither.contracts_derived:
233             txt += "\nContract {}\n".format(contract.name)
234             txt += self.is_complex_code(contract)
235             txt += '\tNumber of functions: {}\n'.format(self._number_functions(contract))
236             ercs = contract.ercs()
237             if ercs:
238                 txt += '\tERCs: ' + ','.join(ercs) + '\n'
239             is_erc20 = contract.is_erc20()
240             if is_erc20:
241                 txt += '\tERC20 info:\n'
242                 txt += self.get_summary_erc20(contract)
243 
244         self.info(txt)
245 
246         results_contract = output.Output('')
247         for contract in self.slither.contracts_derived:
248             optimization, info, low, medium, high = self._get_detectors_result()
249             contract_d = {'contract_name': contract.name,
250                           'is_complex_code': self._is_complex_code(contract),
251                           'optimization_issues': optimization,
252                           'informational_issues': info,
253                           'low_issues': low,
254                           'medium_issues': medium,
255                           'high_issues': high,
256                           'is_erc20': contract.is_erc20(),
257                           'number_functions': self._number_functions(contract)}
258             if contract_d['is_erc20']:
259                 pause, mint_limited, race_condition_mitigated = self._get_summary_erc20(contract)
260                 contract_d['erc20_pause'] = pause
261                 if mint_limited is not None:
262                     contract_d['erc20_can_mint'] = True
263                     contract_d['erc20_mint_limited'] = mint_limited
264                 else:
265                     contract_d['erc20_can_mint'] = False
266                 contract_d['erc20_race_condition_mitigated'] = race_condition_mitigated
267 
268             results_contract.add_contract(contract, additional_fields=contract_d)
269 
270         results['contracts']['elements'] = results_contract.elements
271 
272         json = self.generate_output(txt, additional_fields=results)
273 
274         return json
275 
276
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/slither/printers/summary/human_summary.py b/slither/printers/summary/human_summary.py
--- a/slither/printers/summary/human_summary.py
+++ b/slither/printers/summary/human_summary.py
@@ -8,6 +8,8 @@
 from slither.utils.code_complexity import compute_cyclomatic_complexity
 from slither.utils.colors import green, red, yellow
 from slither.utils.standard_libraries import is_standard_library
+from slither.core.cfg.node import NodeType
+
 
 class PrinterHumanSummary(AbstractPrinter):
     ARGUMENT = 'human-summary'
@@ -29,14 +31,13 @@
             else:
                 mint_limited = True
         else:
-            mint_limited = None # no minting
+            mint_limited = None  # no minting
 
-        race_condition_mitigated = 'increaseApproval' in functions_name or\
+        race_condition_mitigated = 'increaseApproval' in functions_name or \
                                    'safeIncreaseAllowance' in functions_name
 
         return pause, mint_limited, race_condition_mitigated
 
-
     def get_summary_erc20(self, contract):
         txt = ''
 
@@ -93,8 +94,6 @@
         issues_high = [c for c in issues_high if c]
         issues_high = [item for sublist in issues_high for item in sublist]
 
-
-
         return (len(issues_optimization),
                 len(issues_informational),
                 len(issues_low),
@@ -159,6 +158,17 @@
                 total_lines += lines
         return total_lines, total_dep_lines
 
+    def _get_number_of_assembly_lines(self):
+        total_asm_lines = 0
+        for contract in self.contracts:
+            for function in contract.functions_declared:
+                for node in function.nodes:
+                    if node.type == NodeType.ASSEMBLY:
+                        inline_asm = node.inline_asm
+                        if inline_asm:
+                            total_asm_lines += len(inline_asm.splitlines())
+        return total_asm_lines
+
     def _compilation_type(self):
         if self.slither.crytic_compile is None:
             return 'Compilation non standard\n'
@@ -202,17 +212,20 @@
             },
             'number_lines': 0,
             'number_lines_in_dependencies': 0,
+            'number_lines_assembly': 0,
             'standard_libraries': [],
             'ercs': [],
         }
 
-
         lines_number = self._lines_number()
         if lines_number:
             total_lines, total_dep_lines = lines_number
             txt += f'Number of lines: {total_lines} (+ {total_dep_lines} in dependencies)\n'
             results['number_lines'] = total_lines
             results['number_lines__dependencies'] = total_dep_lines
+            total_asm_lines = self._get_number_of_assembly_lines()
+            txt += f"Number of assembly lines: {total_asm_lines}\n"
+            results['number_lines_assembly'] = total_asm_lines
 
         number_contracts, number_contracts_deps = self._number_contracts()
         txt += f'Number of contracts: {number_contracts} (+ {number_contracts_deps} in dependencies) \n\n'
@@ -272,4 +285,3 @@
         json = self.generate_output(txt, additional_fields=results)
 
         return json
-

{"golden_diff": "diff --git a/slither/printers/summary/human_summary.py b/slither/printers/summary/human_summary.py\n--- a/slither/printers/summary/human_summary.py\n+++ b/slither/printers/summary/human_summary.py\n@@ -8,6 +8,8 @@\n from slither.utils.code_complexity import compute_cyclomatic_complexity\n from slither.utils.colors import green, red, yellow\n from slither.utils.standard_libraries import is_standard_library\n+from slither.core.cfg.node import NodeType\n+\n \n class PrinterHumanSummary(AbstractPrinter):\n     ARGUMENT = 'human-summary'\n@@ -29,14 +31,13 @@\n             else:\n                 mint_limited = True\n         else:\n-            mint_limited = None # no minting\n+            mint_limited = None  # no minting\n \n-        race_condition_mitigated = 'increaseApproval' in functions_name or\\\n+        race_condition_mitigated = 'increaseApproval' in functions_name or \\\n                                    'safeIncreaseAllowance' in functions_name\n \n         return pause, mint_limited, race_condition_mitigated\n \n-\n     def get_summary_erc20(self, contract):\n         txt = ''\n \n@@ -93,8 +94,6 @@\n         issues_high = [c for c in issues_high if c]\n         issues_high = [item for sublist in issues_high for item in sublist]\n \n-\n-\n         return (len(issues_optimization),\n                 len(issues_informational),\n                 len(issues_low),\n@@ -159,6 +158,17 @@\n                 total_lines += lines\n         return total_lines, total_dep_lines\n \n+    def _get_number_of_assembly_lines(self):\n+        total_asm_lines = 0\n+        for contract in self.contracts:\n+            for function in contract.functions_declared:\n+                for node in function.nodes:\n+                    if node.type == NodeType.ASSEMBLY:\n+                        inline_asm = node.inline_asm\n+                        if inline_asm:\n+                            total_asm_lines += len(inline_asm.splitlines())\n+        return total_asm_lines\n+\n     def _compilation_type(self):\n         if self.slither.crytic_compile is None:\n             return 'Compilation non standard\\n'\n@@ -202,17 +212,20 @@\n             },\n             'number_lines': 0,\n             'number_lines_in_dependencies': 0,\n+            'number_lines_assembly': 0,\n             'standard_libraries': [],\n             'ercs': [],\n         }\n \n-\n         lines_number = self._lines_number()\n         if lines_number:\n             total_lines, total_dep_lines = lines_number\n             txt += f'Number of lines: {total_lines} (+ {total_dep_lines} in dependencies)\\n'\n             results['number_lines'] = total_lines\n             results['number_lines__dependencies'] = total_dep_lines\n+            total_asm_lines = self._get_number_of_assembly_lines()\n+            txt += f\"Number of assembly lines: {total_asm_lines}\\n\"\n+            results['number_lines_assembly'] = total_asm_lines\n \n         number_contracts, number_contracts_deps = self._number_contracts()\n         txt += f'Number of contracts: {number_contracts} (+ {number_contracts_deps} in dependencies) \\n\\n'\n@@ -272,4 +285,3 @@\n         json = self.generate_output(txt, additional_fields=results)\n \n         return json\n-\n", "issue": "Human-summary printer: show number of lines of assemly code\nThe human summary printer should show if a contract uses inline assembly, and if so, shows the number of lines of assembly code\n", "before_files": [{"content": "\"\"\"\nModule printing summary of the contract\n\"\"\"\nimport logging\n\nfrom slither.printers.abstract_printer import AbstractPrinter\nfrom slither.utils import output\nfrom slither.utils.code_complexity import compute_cyclomatic_complexity\nfrom slither.utils.colors import green, red, yellow\nfrom slither.utils.standard_libraries import is_standard_library\n\nclass PrinterHumanSummary(AbstractPrinter):\n    ARGUMENT = 'human-summary'\n    HELP = 'Print a human-readable summary of the contracts'\n\n    WIKI = 'https://github.com/trailofbits/slither/wiki/Printer-documentation#human-summary'\n\n    @staticmethod\n    def _get_summary_erc20(contract):\n\n        functions_name = [f.name for f in contract.functions]\n        state_variables = [v.name for v in contract.state_variables]\n\n        pause = 'pause' in functions_name\n\n        if 'mint' in functions_name:\n            if not 'mintingFinished' in state_variables:\n                mint_limited = False\n            else:\n                mint_limited = True\n        else:\n            mint_limited = None # no minting\n\n        race_condition_mitigated = 'increaseApproval' in functions_name or\\\n                                   'safeIncreaseAllowance' in functions_name\n\n        return pause, mint_limited, race_condition_mitigated\n\n\n    def get_summary_erc20(self, contract):\n        txt = ''\n\n        pause, mint_limited, race_condition_mitigated = self._get_summary_erc20(contract)\n\n        if pause:\n            txt += \"\\t\\t Can be paused? : {}\\n\".format(yellow('Yes'))\n        else:\n            txt += \"\\t\\t Can be paused? : {}\\n\".format(green('No'))\n\n        if mint_limited is None:\n            txt += \"\\t\\t Minting restriction? : {}\\n\".format(green('No Minting'))\n        else:\n            if mint_limited:\n                txt += \"\\t\\t Minting restriction? : {}\\n\".format(red('Yes'))\n            else:\n                txt += \"\\t\\t Minting restriction? : {}\\n\".format(yellow('No'))\n\n        if race_condition_mitigated:\n            txt += \"\\t\\t ERC20 race condition mitigation: {}\\n\".format(green('Yes'))\n        else:\n            txt += \"\\t\\t ERC20 race condition mitigation: {}\\n\".format(red('No'))\n\n        return txt\n\n    def _get_detectors_result(self):\n        # disable detectors logger\n        logger = logging.getLogger('Detectors')\n        logger.setLevel(logging.ERROR)\n\n        checks_optimization = self.slither.detectors_optimization\n        checks_informational = self.slither.detectors_informational\n        checks_low = self.slither.detectors_low\n        checks_medium = self.slither.detectors_medium\n        checks_high = self.slither.detectors_high\n\n        issues_optimization = [c.detect() for c in checks_optimization]\n        issues_optimization = [c for c in issues_optimization if c]\n        issues_optimization = [item for sublist in issues_optimization for item in sublist]\n\n        issues_informational = [c.detect() for c in checks_informational]\n        issues_informational = [c for c in issues_informational if c]\n        issues_informational = [item for sublist in issues_informational for item in sublist]\n\n        issues_low = [c.detect() for c in checks_low]\n        issues_low = [c for c in issues_low if c]\n        issues_low = [item for sublist in issues_low for item in sublist]\n\n        issues_medium = (c.detect() for c in checks_medium)\n        issues_medium = [c for c in issues_medium if c]\n        issues_medium = [item for sublist in issues_medium for item in sublist]\n\n        issues_high = [c.detect() for c in checks_high]\n        issues_high = [c for c in issues_high if c]\n        issues_high = [item for sublist in issues_high for item in sublist]\n\n\n\n        return (len(issues_optimization),\n                len(issues_informational),\n                len(issues_low),\n                len(issues_medium),\n                len(issues_high))\n\n    def get_detectors_result(self):\n        issues_optimization, issues_informational, issues_low, issues_medium, issues_high = self._get_detectors_result()\n        txt = \"Number of optimization issues: {}\\n\".format(green(issues_optimization))\n        txt += \"Number of informational issues: {}\\n\".format(green(issues_informational))\n        txt += \"Number of low issues: {}\\n\".format(green(issues_low))\n        if issues_medium > 0:\n            txt += \"Number of medium issues: {}\\n\".format(yellow(issues_medium))\n        else:\n            txt += \"Number of medium issues: {}\\n\".format(green(issues_medium))\n        if issues_high > 0:\n            txt += \"Number of high issues: {}\\n\".format(red(issues_high))\n        else:\n            txt += \"Number of high issues: {}\\n\\n\".format(green(issues_high))\n\n        return txt\n\n    @staticmethod\n    def _is_complex_code(contract):\n        for f in contract.functions:\n            if compute_cyclomatic_complexity(f) > 7:\n                return True\n        return False\n\n    def is_complex_code(self, contract):\n        \"\"\"\n            Check if the code is complex\n            Heuristic, the code is complex if:\n                - One function has a cyclomatic complexity > 7\n        Args:\n            contract\n        \"\"\"\n\n        is_complex = self._is_complex_code(contract)\n\n        result = red('Yes') if is_complex else green('No')\n\n        return \"\\tComplex code? {}\\n\".format(result)\n\n    @staticmethod\n    def _number_functions(contract):\n        return len(contract.functions)\n\n    def _lines_number(self):\n        if not self.slither.source_code:\n            return None\n        total_dep_lines = 0\n        total_lines = 0\n        for filename, source_code in self.slither.source_code.items():\n            lines = len(source_code.splitlines())\n            is_dep = False\n            if self.slither.crytic_compile:\n                is_dep = self.slither.crytic_compile.is_dependency(filename)\n            if is_dep:\n                total_dep_lines += lines\n            else:\n                total_lines += lines\n        return total_lines, total_dep_lines\n\n    def _compilation_type(self):\n        if self.slither.crytic_compile is None:\n            return 'Compilation non standard\\n'\n        return f'Compiled with {self.slither.crytic_compile.type}\\n'\n\n    def _number_contracts(self):\n        if self.slither.crytic_compile is None:\n            len(self.slither.contracts), 0\n        deps = [c for c in self.slither.contracts if c.is_from_dependency()]\n        contracts = [c for c in self.slither.contracts if not c.is_from_dependency()]\n        return len(contracts), len(deps)\n\n    def _standard_libraries(self):\n        libraries = []\n        for contract in self.contracts:\n            lib = is_standard_library(contract)\n            if lib:\n                libraries.append(lib)\n\n        return libraries\n\n    def _ercs(self):\n        ercs = []\n        for contract in self.contracts:\n            ercs += contract.ercs()\n        return list(set(ercs))\n\n    def output(self, _filename):\n        \"\"\"\n        _filename is not used\n            Args:\n                _filename(string)\n        \"\"\"\n\n        txt = \"\\n\"\n        txt += self._compilation_type()\n\n        results = {\n            'contracts': {\n                \"elements\": []\n            },\n            'number_lines': 0,\n            'number_lines_in_dependencies': 0,\n            'standard_libraries': [],\n            'ercs': [],\n        }\n\n\n        lines_number = self._lines_number()\n        if lines_number:\n            total_lines, total_dep_lines = lines_number\n            txt += f'Number of lines: {total_lines} (+ {total_dep_lines} in dependencies)\\n'\n            results['number_lines'] = total_lines\n            results['number_lines__dependencies'] = total_dep_lines\n\n        number_contracts, number_contracts_deps = self._number_contracts()\n        txt += f'Number of contracts: {number_contracts} (+ {number_contracts_deps} in dependencies) \\n\\n'\n\n        txt += self.get_detectors_result()\n\n        libs = self._standard_libraries()\n        if libs:\n            txt += f'\\nUse: {\", \".join(libs)}\\n'\n            results['standard_libraries'] = [str(l) for l in libs]\n\n        ercs = self._ercs()\n        if ercs:\n            txt += f'ERCs: {\", \".join(ercs)}\\n'\n            results['ercs'] = [str(e) for e in ercs]\n\n        for contract in self.slither.contracts_derived:\n            txt += \"\\nContract {}\\n\".format(contract.name)\n            txt += self.is_complex_code(contract)\n            txt += '\\tNumber of functions: {}\\n'.format(self._number_functions(contract))\n            ercs = contract.ercs()\n            if ercs:\n                txt += '\\tERCs: ' + ','.join(ercs) + '\\n'\n            is_erc20 = contract.is_erc20()\n            if is_erc20:\n                txt += '\\tERC20 info:\\n'\n                txt += self.get_summary_erc20(contract)\n\n        self.info(txt)\n\n        results_contract = output.Output('')\n        for contract in self.slither.contracts_derived:\n            optimization, info, low, medium, high = self._get_detectors_result()\n            contract_d = {'contract_name': contract.name,\n                          'is_complex_code': self._is_complex_code(contract),\n                          'optimization_issues': optimization,\n                          'informational_issues': info,\n                          'low_issues': low,\n                          'medium_issues': medium,\n                          'high_issues': high,\n                          'is_erc20': contract.is_erc20(),\n                          'number_functions': self._number_functions(contract)}\n            if contract_d['is_erc20']:\n                pause, mint_limited, race_condition_mitigated = self._get_summary_erc20(contract)\n                contract_d['erc20_pause'] = pause\n                if mint_limited is not None:\n                    contract_d['erc20_can_mint'] = True\n                    contract_d['erc20_mint_limited'] = mint_limited\n                else:\n                    contract_d['erc20_can_mint'] = False\n                contract_d['erc20_race_condition_mitigated'] = race_condition_mitigated\n\n            results_contract.add_contract(contract, additional_fields=contract_d)\n\n        results['contracts']['elements'] = results_contract.elements\n\n        json = self.generate_output(txt, additional_fields=results)\n\n        return json\n\n", "path": "slither/printers/summary/human_summary.py"}], "after_files": [{"content": "\"\"\"\nModule printing summary of the contract\n\"\"\"\nimport logging\n\nfrom slither.printers.abstract_printer import AbstractPrinter\nfrom slither.utils import output\nfrom slither.utils.code_complexity import compute_cyclomatic_complexity\nfrom slither.utils.colors import green, red, yellow\nfrom slither.utils.standard_libraries import is_standard_library\nfrom slither.core.cfg.node import NodeType\n\n\nclass PrinterHumanSummary(AbstractPrinter):\n    ARGUMENT = 'human-summary'\n    HELP = 'Print a human-readable summary of the contracts'\n\n    WIKI = 'https://github.com/trailofbits/slither/wiki/Printer-documentation#human-summary'\n\n    @staticmethod\n    def _get_summary_erc20(contract):\n\n        functions_name = [f.name for f in contract.functions]\n        state_variables = [v.name for v in contract.state_variables]\n\n        pause = 'pause' in functions_name\n\n        if 'mint' in functions_name:\n            if not 'mintingFinished' in state_variables:\n                mint_limited = False\n            else:\n                mint_limited = True\n        else:\n            mint_limited = None  # no minting\n\n        race_condition_mitigated = 'increaseApproval' in functions_name or \\\n                                   'safeIncreaseAllowance' in functions_name\n\n        return pause, mint_limited, race_condition_mitigated\n\n    def get_summary_erc20(self, contract):\n        txt = ''\n\n        pause, mint_limited, race_condition_mitigated = self._get_summary_erc20(contract)\n\n        if pause:\n            txt += \"\\t\\t Can be paused? : {}\\n\".format(yellow('Yes'))\n        else:\n            txt += \"\\t\\t Can be paused? : {}\\n\".format(green('No'))\n\n        if mint_limited is None:\n            txt += \"\\t\\t Minting restriction? : {}\\n\".format(green('No Minting'))\n        else:\n            if mint_limited:\n                txt += \"\\t\\t Minting restriction? : {}\\n\".format(red('Yes'))\n            else:\n                txt += \"\\t\\t Minting restriction? : {}\\n\".format(yellow('No'))\n\n        if race_condition_mitigated:\n            txt += \"\\t\\t ERC20 race condition mitigation: {}\\n\".format(green('Yes'))\n        else:\n            txt += \"\\t\\t ERC20 race condition mitigation: {}\\n\".format(red('No'))\n\n        return txt\n\n    def _get_detectors_result(self):\n        # disable detectors logger\n        logger = logging.getLogger('Detectors')\n        logger.setLevel(logging.ERROR)\n\n        checks_optimization = self.slither.detectors_optimization\n        checks_informational = self.slither.detectors_informational\n        checks_low = self.slither.detectors_low\n        checks_medium = self.slither.detectors_medium\n        checks_high = self.slither.detectors_high\n\n        issues_optimization = [c.detect() for c in checks_optimization]\n        issues_optimization = [c for c in issues_optimization if c]\n        issues_optimization = [item for sublist in issues_optimization for item in sublist]\n\n        issues_informational = [c.detect() for c in checks_informational]\n        issues_informational = [c for c in issues_informational if c]\n        issues_informational = [item for sublist in issues_informational for item in sublist]\n\n        issues_low = [c.detect() for c in checks_low]\n        issues_low = [c for c in issues_low if c]\n        issues_low = [item for sublist in issues_low for item in sublist]\n\n        issues_medium = (c.detect() for c in checks_medium)\n        issues_medium = [c for c in issues_medium if c]\n        issues_medium = [item for sublist in issues_medium for item in sublist]\n\n        issues_high = [c.detect() for c in checks_high]\n        issues_high = [c for c in issues_high if c]\n        issues_high = [item for sublist in issues_high for item in sublist]\n\n        return (len(issues_optimization),\n                len(issues_informational),\n                len(issues_low),\n                len(issues_medium),\n                len(issues_high))\n\n    def get_detectors_result(self):\n        issues_optimization, issues_informational, issues_low, issues_medium, issues_high = self._get_detectors_result()\n        txt = \"Number of optimization issues: {}\\n\".format(green(issues_optimization))\n        txt += \"Number of informational issues: {}\\n\".format(green(issues_informational))\n        txt += \"Number of low issues: {}\\n\".format(green(issues_low))\n        if issues_medium > 0:\n            txt += \"Number of medium issues: {}\\n\".format(yellow(issues_medium))\n        else:\n            txt += \"Number of medium issues: {}\\n\".format(green(issues_medium))\n        if issues_high > 0:\n            txt += \"Number of high issues: {}\\n\".format(red(issues_high))\n        else:\n            txt += \"Number of high issues: {}\\n\\n\".format(green(issues_high))\n\n        return txt\n\n    @staticmethod\n    def _is_complex_code(contract):\n        for f in contract.functions:\n            if compute_cyclomatic_complexity(f) > 7:\n                return True\n        return False\n\n    def is_complex_code(self, contract):\n        \"\"\"\n            Check if the code is complex\n            Heuristic, the code is complex if:\n                - One function has a cyclomatic complexity > 7\n        Args:\n            contract\n        \"\"\"\n\n        is_complex = self._is_complex_code(contract)\n\n        result = red('Yes') if is_complex else green('No')\n\n        return \"\\tComplex code? {}\\n\".format(result)\n\n    @staticmethod\n    def _number_functions(contract):\n        return len(contract.functions)\n\n    def _lines_number(self):\n        if not self.slither.source_code:\n            return None\n        total_dep_lines = 0\n        total_lines = 0\n        for filename, source_code in self.slither.source_code.items():\n            lines = len(source_code.splitlines())\n            is_dep = False\n            if self.slither.crytic_compile:\n                is_dep = self.slither.crytic_compile.is_dependency(filename)\n            if is_dep:\n                total_dep_lines += lines\n            else:\n                total_lines += lines\n        return total_lines, total_dep_lines\n\n    def _get_number_of_assembly_lines(self):\n        total_asm_lines = 0\n        for contract in self.contracts:\n            for function in contract.functions_declared:\n                for node in function.nodes:\n                    if node.type == NodeType.ASSEMBLY:\n                        inline_asm = node.inline_asm\n                        if inline_asm:\n                            total_asm_lines += len(inline_asm.splitlines())\n        return total_asm_lines\n\n    def _compilation_type(self):\n        if self.slither.crytic_compile is None:\n            return 'Compilation non standard\\n'\n        return f'Compiled with {self.slither.crytic_compile.type}\\n'\n\n    def _number_contracts(self):\n        if self.slither.crytic_compile is None:\n            len(self.slither.contracts), 0\n        deps = [c for c in self.slither.contracts if c.is_from_dependency()]\n        contracts = [c for c in self.slither.contracts if not c.is_from_dependency()]\n        return len(contracts), len(deps)\n\n    def _standard_libraries(self):\n        libraries = []\n        for contract in self.contracts:\n            lib = is_standard_library(contract)\n            if lib:\n                libraries.append(lib)\n\n        return libraries\n\n    def _ercs(self):\n        ercs = []\n        for contract in self.contracts:\n            ercs += contract.ercs()\n        return list(set(ercs))\n\n    def output(self, _filename):\n        \"\"\"\n        _filename is not used\n            Args:\n                _filename(string)\n        \"\"\"\n\n        txt = \"\\n\"\n        txt += self._compilation_type()\n\n        results = {\n            'contracts': {\n                \"elements\": []\n            },\n            'number_lines': 0,\n            'number_lines_in_dependencies': 0,\n            'number_lines_assembly': 0,\n            'standard_libraries': [],\n            'ercs': [],\n        }\n\n        lines_number = self._lines_number()\n        if lines_number:\n            total_lines, total_dep_lines = lines_number\n            txt += f'Number of lines: {total_lines} (+ {total_dep_lines} in dependencies)\\n'\n            results['number_lines'] = total_lines\n            results['number_lines__dependencies'] = total_dep_lines\n            total_asm_lines = self._get_number_of_assembly_lines()\n            txt += f\"Number of assembly lines: {total_asm_lines}\\n\"\n            results['number_lines_assembly'] = total_asm_lines\n\n        number_contracts, number_contracts_deps = self._number_contracts()\n        txt += f'Number of contracts: {number_contracts} (+ {number_contracts_deps} in dependencies) \\n\\n'\n\n        txt += self.get_detectors_result()\n\n        libs = self._standard_libraries()\n        if libs:\n            txt += f'\\nUse: {\", \".join(libs)}\\n'\n            results['standard_libraries'] = [str(l) for l in libs]\n\n        ercs = self._ercs()\n        if ercs:\n            txt += f'ERCs: {\", \".join(ercs)}\\n'\n            results['ercs'] = [str(e) for e in ercs]\n\n        for contract in self.slither.contracts_derived:\n            txt += \"\\nContract {}\\n\".format(contract.name)\n            txt += self.is_complex_code(contract)\n            txt += '\\tNumber of functions: {}\\n'.format(self._number_functions(contract))\n            ercs = contract.ercs()\n            if ercs:\n                txt += '\\tERCs: ' + ','.join(ercs) + '\\n'\n            is_erc20 = contract.is_erc20()\n            if is_erc20:\n                txt += '\\tERC20 info:\\n'\n                txt += self.get_summary_erc20(contract)\n\n        self.info(txt)\n\n        results_contract = output.Output('')\n        for contract in self.slither.contracts_derived:\n            optimization, info, low, medium, high = self._get_detectors_result()\n            contract_d = {'contract_name': contract.name,\n                          'is_complex_code': self._is_complex_code(contract),\n                          'optimization_issues': optimization,\n                          'informational_issues': info,\n                          'low_issues': low,\n                          'medium_issues': medium,\n                          'high_issues': high,\n                          'is_erc20': contract.is_erc20(),\n                          'number_functions': self._number_functions(contract)}\n            if contract_d['is_erc20']:\n                pause, mint_limited, race_condition_mitigated = self._get_summary_erc20(contract)\n                contract_d['erc20_pause'] = pause\n                if mint_limited is not None:\n                    contract_d['erc20_can_mint'] = True\n                    contract_d['erc20_mint_limited'] = mint_limited\n                else:\n                    contract_d['erc20_can_mint'] = False\n                contract_d['erc20_race_condition_mitigated'] = race_condition_mitigated\n\n            results_contract.add_contract(contract, additional_fields=contract_d)\n\n        results['contracts']['elements'] = results_contract.elements\n\n        json = self.generate_output(txt, additional_fields=results)\n\n        return json\n", "path": "slither/printers/summary/human_summary.py"}]}