Skip to content

Commit

Permalink
try-fix tests in travis
Browse files Browse the repository at this point in the history
  • Loading branch information
sirfoga committed Oct 12, 2018
1 parent 485977a commit 34f0d20
Show file tree
Hide file tree
Showing 48 changed files with 234 additions and 236 deletions.
6 changes: 3 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ install:
- "cd pyhal"
- "make pip-install" # install
script:
- "pytest --cov=./" # test coverage
- "codecov"
- "pylint3 -j 8 hal/* || pylint-exit $?" # measure code lint
- "# pytest --cov=./" # test coverage
- "# codecov"
- "pylint3 -j 8 hal/*" # measure code lint
notifications:
email: "false" # no email notify
cache: "pip"
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
10.2.3 (a3598ce79ae74bb18a671a37286ef51a10095617)
10.2.3 (3259d026a3439aace50534b46527f164954e4fe9)
2 changes: 1 addition & 1 deletion hal/__version__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
__description__ = 'Your swiss knife to perform fast and easy pythonic stuff'
__url__ = 'https://sirfoga.github.io/pyhal/'
__version__ = '10.2.3'
__build__ = 'a3598ce79ae74bb18a671a37286ef51a10095617'
__build__ = '3259d026a3439aace50534b46527f164954e4fe9'
__author__ = 'Stefano Fogarollo'
__author_email__ = 'sirfoga@protonmail.com'
__license__ = 'MIT'
Expand Down
2 changes: 1 addition & 1 deletion hal/charts/correlation.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ def create_correlation_matrix_plot(correlation_matrix, title, feature_list):
:param correlation_matrix: Correlation matrix of features
:param title: Title of plot
:param feature_list: List of names of features
:returns: Shows the given correlation matrix as image
:return: Shows the given correlation matrix as image
"""
chart = SimpleChart(title)
ax1 = chart.get_ax()
Expand Down
10 changes: 5 additions & 5 deletions hal/charts/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,14 @@ def setup(bottom):
def get_fig(self):
"""Gets chart canvas
:returns: matplotlib figure
:return: matplotlib figure
"""
return self.fig

def get_ax(self):
"""Adds to figure
:returns: operation completed successfully?
:return: operation completed successfully?
"""
return self.fig.add_subplot(111)

Expand All @@ -51,7 +51,7 @@ def create_bar_chart(self, x_labels, y_values, y_label):
:param x_labels: Names for each variable
:param y_values: Values of x labels
:param y_label: Label of y axis
:returns: chart: Bar chart
:return: chart: Bar chart
"""
self.setup(0.25)
ax1 = self.get_ax()
Expand All @@ -73,7 +73,7 @@ def create_multiple_bar_chart(self, x_labels, mul_y_values, mul_y_labels,
:param mul_y_values: list of values of x labels
:param mul_y_labels: list of labels for each y value
:param normalize: True iff you want to normalize each y series
:returns: Bar chart
:return: Bar chart
"""
self.setup(0.25)
ax1 = self.get_ax()
Expand Down Expand Up @@ -116,7 +116,7 @@ def create_sym_log_bar_chart(self, x_labels, y_values, y_label):
:param x_labels: Names for each variable
:param y_values: Values of x labels
:param y_label: Label of y axis
:returns: Sym-log bar chart
:return: Sym-log bar chart
"""
ax1 = self.create_bar_chart(x_labels, y_values, y_label)
ax1.set_yscale("sym-log", linthreshy=1e-12) # logarithmic plot
Expand Down
4 changes: 2 additions & 2 deletions hal/charts/plotter.py
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ def get_precision(min_val, max_val):
:param min_val: minimum
:param max_val: maximum
:returns: precision: prevision of values
:return: precision: prevision of values
"""
return int((max_val - min_val) * (1 + precision))

Expand All @@ -202,7 +202,7 @@ def get_precision_delta(min_val, max_val):
:param min_val: minimum
:param max_val: maximum
:returns: delta: Precision delta
:return: delta: Precision delta
"""
return float(max_val - min_val) / float(10 * precision)

Expand Down
18 changes: 9 additions & 9 deletions hal/cvs/gits.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ def __str__(self):
def get_totals(self):
"""Calculates total additions and deletions
:returns: Dictionary with totals
:return: Dictionary with totals
"""
total_added = 0
total_removed = 0
Expand Down Expand Up @@ -63,7 +63,7 @@ def __str__(self, date_format="%H:%M:%S %y-%m-%d %z"):
Converts to string
:param date_format: Format date and times with this format
:returns: Pretty description of commit
:return: Pretty description of commit
"""
hash_value = self.commit.hexsha
date_time = self.commit.authored_datetime.strftime(date_format)
Expand All @@ -72,7 +72,7 @@ def __str__(self, date_format="%H:%M:%S %y-%m-%d %z"):
def get_author(self):
"""Gets author
:returns: author of commit
:return: author of commit
"""
author = self.commit.author

Expand All @@ -99,14 +99,14 @@ def __init__(self, repo_path):
def get_last_commit(self):
"""Gets last commit
:returns: Last commit of repository
:return: Last commit of repository
"""
return self.repo.head.commit

def get_diff_amounts(self):
"""Gets list of total diff
:returns: List of total diff between 2 consecutive commits since start
:return: List of total diff between 2 consecutive commits since start
"""
diffs = []

Expand All @@ -126,7 +126,7 @@ def get_diff(self, commit, other_commit):
:param commit: First commit
:param other_commit: Second commit
:returns: dictionary: Dictionary with total additions and deletions
:return: dictionary: Dictionary with total additions and deletions
"""
diff = self.repo.git.diff(commit.hexsha, other_commit.hexsha)
return Diff(diff).get_totals()
Expand All @@ -135,7 +135,7 @@ def get_version(self, diff_to_increase_ratio):
"""Gets version
:param diff_to_increase_ratio: Ratio to convert number of changes into
:returns: Version of this code, based on commits diffs
:return: Version of this code, based on commits diffs
"""
diffs = self.get_diff_amounts()
version = Version()
Expand All @@ -150,7 +150,7 @@ def get_pretty_version(self, diff_to_increase_ratio):
:param diff_to_increase_ratio: Ratio to convert number of changes into
version increases
:returns: string: Pretty version of this repository
:return: string: Pretty version of this repository
"""
version = self.get_version(diff_to_increase_ratio)
build = self.get_last_commit_hash()
Expand All @@ -159,7 +159,7 @@ def get_pretty_version(self, diff_to_increase_ratio):
def get_last_commit_hash(self):
"""Gets hash of last commit
:returns: hash of last commit
:return: hash of last commit
"""
last = self.get_last_commit()
return str(last.hexsha)
14 changes: 7 additions & 7 deletions hal/cvs/versioning.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,15 @@ class VersionNumber:
def get_current_amount(self):
"""Gets current set amount
:returns: Current set amount
:return: Current set amount
"""
pass

def can_increase(self, amount):
"""Checks iff can increase by such amount
:param amount: Amount to increase
:returns: True iff this number can be increased by such amount
:return: True iff this number can be increased by such amount
"""
return amount <= self.max_amount_allowed()

Expand All @@ -33,7 +33,7 @@ def increase(self, amount=1):
"""Increase version by this amount
:param amount: Increase number by this amount
:returns: True iff increase was successful
:return: True iff increase was successful
"""
pass

Expand All @@ -51,15 +51,15 @@ def reset(self):
def max_amount_allowed(self):
"""Calculates number of increases available
:returns: Number of increases that can be done before reaching
:return: Number of increases that can be done before reaching
"""
pass

@abstractmethod
def max(self):
"""Calculates max increases
:returns: Number of increases that can be done before reaching
:return: Number of increases that can be done before reaching
"""
pass

Expand Down Expand Up @@ -220,7 +220,7 @@ def increase_by_changes(self, changes_amount, ratio):
:param changes_amount: Number of changes done
:param ratio: Ratio changes
:returns: Increases version accordingly to changes
:return: Increases version accordingly to changes
"""
increases = round(changes_amount * ratio)
return self.increase(int(increases))
Expand All @@ -238,7 +238,7 @@ def from_str(string, max_number=9, separator="."):
:param string: Version
:param max_number: Max number reachable by sub
:param separator: Version numbers are separated with this split
:returns: Parses string and returns object
:return: Parses string and returns object
"""
tokens = string.split(separator)
tokens = list(reversed(tokens)) # reverse order of importance
Expand Down
6 changes: 3 additions & 3 deletions hal/data/dicts.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ def how_similar_dicts(dict1, dict2):
:param dict1: Dictionary
:param dict2: Dictionary
:returns: measure of how much similar values of dictionaries are
:return: measure of how much similar values of dictionaries are
"""
values = []
for k in dict1: # iterate keys
Expand All @@ -27,7 +27,7 @@ def get_inner_keys(dictionary):
"""Gets 2nd-level dictionary keys
:param dictionary: dict
:returns: inner keys
:return: inner keys
"""

keys = []
Expand All @@ -46,7 +46,7 @@ def get_inner_data(dictionary):
"""Gets 2nd-level data into 1st-level dictionary
:param dictionary: dict
:returns: with 2nd-level data
:return: with 2nd-level data
"""

out = {}
Expand Down
22 changes: 11 additions & 11 deletions hal/data/linked_list.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,14 @@ def __init__(self, lst):
def get_head(self):
"""Gets head
:returns: Head of linked list
:return: Head of linked list
"""
return self.head

def get_tail(self):
"""Gets tail
:returns: Tail of linked list
:return: Tail of linked list
"""
node = self.head
last_node = self.head
Expand All @@ -50,7 +50,7 @@ def get_tail(self):
def length(self):
"""Gets length
:returns: How many items in linked list of linked list
:return: How many items in linked list of linked list
"""
item = self.head
counter = 0
Expand All @@ -65,7 +65,7 @@ def append(self, val):
"""Appends to list
:param val: Object to insert
:returns: bool: Appends element to last
:return: bool: Appends element to last
"""
return self.insert(val, self.length())

Expand All @@ -74,7 +74,7 @@ def insert(self, val, position=0):
:param val: Object to insert
:param position: Index of insertion
:returns: bool: True iff insertion completed successfully
:return: bool: True iff insertion completed successfully
"""
if position < 0 or position > self.length():
return False
Expand Down Expand Up @@ -105,7 +105,7 @@ def insert(self, val, position=0):
def remove_first(self):
"""Removes first
:returns: True iff head has been removed
:return: True iff head has been removed
"""
if self.head.next_node is not None:
self.head = self.head.next_node
Expand All @@ -116,7 +116,7 @@ def remove_first(self):
def remove_last(self):
"""Removes last
:returns: True iff last element has been removed
:return: True iff last element has been removed
"""
node = self.head

Expand All @@ -133,7 +133,7 @@ def remove(self, position):
"""Removes at index
:param position: Index of removal
:returns: bool: True iff removal completed successfully
:return: bool: True iff removal completed successfully
"""
if position < 0 or position > self.length():
return False
Expand Down Expand Up @@ -162,7 +162,7 @@ def remove(self, position):
def to_lst(self):
"""Cycle all items and puts them in a list
:returns: list representation
:return: list representation
"""
out = []
node = self.head
Expand All @@ -177,7 +177,7 @@ def execute(self, func):
"""Executes function on each item
:param func: Function to execute on each item
:returns: list: Results of calling the function on each item
:return: list: Results of calling the function on each item
"""
return [
func(item) for item in self.to_lst()
Expand All @@ -195,7 +195,7 @@ def from_list(lst):
"""Parses list
:param lst: list of elements
:returns: LinkedList: Nodes from list
:return: LinkedList: Nodes from list
"""
if not lst:
return None
Expand Down

0 comments on commit 34f0d20

Please sign in to comment.