Conversation
| @@ -4,15 +4,25 @@ | |||
| while offering the best possible flexibility. | |||
| """ | |||
There was a problem hiding this comment.
This file contains unused source code.
Origin: PyUnusedCodeBear, Section: flakes.
The issue can be fixed by applying the following patch:
--- a/tmp/tmp7ip5_d4o/coalib/bearlib/__init__.py
+++ b/tmp/tmp7ip5_d4o/coalib/bearlib/__init__.py
@@ -4,7 +4,6 @@
while offering the best possible flexibility.
"""
-import cProfile
import logging
from coalib.settings.FunctionMetadata import FunctionMetadata* Bear.py and __init__.py run PEP8Bear, fix line length issues. * use inline if at multiple places. * change some function names. * fix a few bugs and cover all cases.
2ccf8fa to
e432828
Compare
| @@ -1,8 +1,15 @@ | |||
| import cProfile | |||
| import inspect | |||
| import io | |||
There was a problem hiding this comment.
This file contains unused source code.
Origin: PyUnusedCodeBear, Section: flakes.
The issue can be fixed by applying the following patch:
--- a/tmp/tmpl9q8g7jr/coalib/bears/Bear.py
+++ b/tmp/tmpl9q8g7jr/coalib/bears/Bear.py
@@ -3,7 +3,6 @@
import io
import itertools
import pstats
-import sys
import tempfile
import traceback
from functools import partial* display results using terminaltables in terminal
a95be88 to
592ded2
Compare
| try: | ||
| for i, c in enumerate(sentence): | ||
| if c == lparen: | ||
| nb_brackets += 1 |
There was a problem hiding this comment.
You do not use the preferred quotation marks.
Origin: QuotesBear, Section: python.
The issue can be fixed by applying the following patch:
--- a/tmp/tmpi5smk0mf/coalib/bears/Bear.py
+++ b/tmp/tmpi5smk0mf/coalib/bears/Bear.py
@@ -292,7 +292,7 @@
elif c == separator and nb_brackets == 0:
l.append(i)
if nb_brackets < 0:
- raise ValueError("Invalid arguments to --profile-bears")
+ raise ValueError('Invalid arguments to --profile-bears')
l.append(len(sentence))
if nb_brackets > 0:
raise ValueError("Invalid arguments to --profile-bears")| return([sentence[i:j].strip(separator) for i, j in zip(l, l[1:])]) | ||
|
|
||
| def pstats_config(self, prof, stream, profile_bears): | ||
| flag = 0 |
There was a problem hiding this comment.
E501 line too long (81 > 80 characters)
Origin: PycodestyleBear (E501), Section: autopep8.
| return([sentence[i:j].strip(separator) for i, j in zip(l, l[1:])]) | ||
|
|
||
| def pstats_config(self, prof, stream, profile_bears): | ||
| flag = 0 |
There was a problem hiding this comment.
Line is longer than allowed. (81 > 80)
Origin: LineLengthBear, Section: linelength.
| return([sentence[i:j].strip(separator) for i, j in zip(final, final[1:])]) | ||
|
|
||
| def pstats_config(self, prof, stream, profile_bears): | ||
| flag = 0 |
There was a problem hiding this comment.
E501 line too long (81 > 80 characters)
Origin: PycodestyleBear (E501), Section: autopep8.
| return([sentence[i:j].strip(separator) for i, j in zip(final, final[1:])]) | ||
|
|
||
| def pstats_config(self, prof, stream, profile_bears): | ||
| flag = 0 |
There was a problem hiding this comment.
Line is longer than allowed. (81 > 80)
Origin: LineLengthBear, Section: linelength.
2aed03a to
e939cae
Compare
| elif str_setting == u'print_callers': | ||
| ps.print_callers(*args) | ||
| elif str_setting == u'print_callees': | ||
| ps.print_callees(*args) |
There was a problem hiding this comment.
Now I see that the print_callers() and print_callees() can also work without an argument, will be fixing that soon
There was a problem hiding this comment.
currently if not provided with an argument they will generate an error and the profiler will go with the default settings
| def _do_nothing(x): return x | ||
|
|
||
|
|
||
| def profile_bears_decorator(func): |
There was a problem hiding this comment.
@ishanSrt need your help here, I am failing in understanding this change.
There was a problem hiding this comment.
I am enabling the profiler here so that it doesn't contain the overhead of the function calls from the decorator itself and then actually calling the run method using this additional decorator
There was a problem hiding this comment.
so if we want to profile our bear it will add this extra decorator which adds prof.enable() just before calling the run() method 😄
There was a problem hiding this comment.
you will need to do the same for the decorators for linters
No description provided.