Used pylama.ini from other project

This commit is contained in:
Tobias Schmidl 2020-09-21 08:10:19 +02:00
parent 17ecea90fa
commit bdb0fd33cc
3 changed files with 26 additions and 5 deletions

View file

@ -1,5 +1,8 @@
[style] [style]
# Insert a blank line before a module docstring.
blank_line_before_module_docstring=True
# The column limit. # The column limit.
column_limit=120 column_limit=120
@ -11,7 +14,7 @@ column_limit=120
# #
# foo = ('This is a really long string: {}, {}, {}, {}' # foo = ('This is a really long string: {}, {}, {}, {}'
# .format(a, b, c, d)) # .format(a, b, c, d))
split_before_dot=False split_before_dot=True
# Set to True to split list comprehensions and generators that have # Set to True to split list comprehensions and generators that have
# non-trivial expressions and multiple clauses before each of these # non-trivial expressions and multiple clauses before each of these

View file

@ -1,6 +1,7 @@
#! /usr/bin/env python3 #! /usr/bin/env python3
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
""" Simulates httping for `argos <https://github.com/p-e-w/argos>`"""
"""Simulates httping for `argos <https://github.com/p-e-w/argos>`."""
# <bitbar.title>httping</bitbar.title> # <bitbar.title>httping</bitbar.title>
# <bitbar.version>v1.0</bitbar.version> # <bitbar.version>v1.0</bitbar.version>
# <bitbar.author>Tobias Schmidl</bitbar.author> # <bitbar.author>Tobias Schmidl</bitbar.author>
@ -29,17 +30,18 @@ MAX_PING_IN_MS = MAX_PING.total_seconds() * 1000
def in_bucket(element, bucket): def in_bucket(element, bucket):
""" Returns True if element is in bucket """ """Return True if element is in bucket."""
return bucket[0] <= element <= bucket[1] return bucket[0] <= element <= bucket[1]
def generate_buckets(min_val, max_val, step_width=2): def generate_buckets(min_val, max_val, step_width=2):
""" Generates a list of partitioned lists between min_val and max_val.""" """Generate a list of partitioned lists between min_val and max_val."""
return [[x, x + step_width - 1] for x in range(min_val, max_val, step_width)] return [[x, x + step_width - 1] for x in range(min_val, max_val, step_width)]
class Themes: class Themes:
"""Maintains a list of themes and generates buckets between 0 and MAX_PING_IN_MS based on the selected theme.""" """Maintain a list of themes and generates buckets between 0 and MAX_PING_IN_MS based on the selected theme."""
# Themes are from http://colorbrewer2.org/ # Themes are from http://colorbrewer2.org/
purple_green = ["#762a83", "#9970ab", "#c2a5cf", "#a6dba0", "#5aae61", "#1b7837"] purple_green = ["#762a83", "#9970ab", "#c2a5cf", "#a6dba0", "#5aae61", "#1b7837"]
red_green = ["#d73027", "#fc8d59", "#fee08b", "#d9ef8b", "#91cf60", "#1a9850"] red_green = ["#d73027", "#fc8d59", "#fee08b", "#d9ef8b", "#91cf60", "#1a9850"]
@ -48,6 +50,7 @@ class Themes:
buckets = None buckets = None
def __init__(self, selected_colors): def __init__(self, selected_colors):
"""Initialize class with a selected theme."""
self.selected_colors = selected_colors self.selected_colors = selected_colors
self.buckets = generate_buckets(0, int(MAX_PING_IN_MS), int(MAX_PING_IN_MS / (len(selected_colors) - 1))) self.buckets = generate_buckets(0, int(MAX_PING_IN_MS), int(MAX_PING_IN_MS / (len(selected_colors) - 1)))

15
pylama.ini Normal file
View file

@ -0,0 +1,15 @@
[pylama]
format = pylint
linters = mccabe,pep257,pydocstyle,pep8,pycodestyle,pyflakes,pylint,isort
ignore = D203
skip=.env/*
[pylama:pycodestyle]
max_line_length = 120
[pylama:pep8]
max_line_length = 120
[pylama:pylint]
max_line_length = 120