Conversation
|
I will review this after we close the PR #7 |
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| # See the License for the specific language governing permissions and | ||
| # limitations under the License. | ||
| """Package LogParser.""" |
There was a problem hiding this comment.
Package LogParser or LogParser Package?
| """ | ||
| from __future__ import absolute_import | ||
| import debug.debug as debug | ||
| import logparser.debug.debug as debug |
There was a problem hiding this comment.
We should do something with this
There was a problem hiding this comment.
We will discuss the import statements in the log files in #13.
| for kind in filter(None, content.get('kind', '').split("|")): | ||
| for subkind in KIND_TO_COLOR[kind].split("|"): | ||
| color += COLORS[subkind] | ||
| if len(color) > 0: |
There was a problem hiding this comment.
It is not necessary the comparation
if len(color):|
|
||
| def countset_add_element(countset, el): | ||
| """Add an element to the countset.""" | ||
| if el not in countset: |
There was a problem hiding this comment.
You are doing this because you don't want have "el" repeated in the countset, true? So, we should use a set, not a list:
https://docs.python.org/2/library/stdtypes.html#set
(countset --> count-set --> count set. Oh! Wait!! It is a set!) 💃
There was a problem hiding this comment.
The CountSet is a class that count the number of times that a given entry is added. Every entry is in the object once and it has an ID and count. We will refactor that code for #12.
| for typ in stats[addr]: | ||
| # If this is a port with dictionary of statistics types | ||
| if isinstance(stats[addr][typ], dict): | ||
| # Show statistics per port with verbosity >= 1 |
Pull Request #8
|
Applied code review changes. Thanks for the feedback! |
|
|
||
| def countset_add_element(countset, el): | ||
| """Add an element to the countset.""" | ||
| if el not in countset: |
Note: This branch contains changes from the formatter branch. Please, don't review this PR until #7 is accepted and merged into master
The main script logic was inside the main log parser module. This Pull Request converts the LogParser logic into a class that can be used later for many other scripts. The current main script will execute the LogParser class as always. This allows to use this application as a library too by importing the logparser package.