Skip to content

Commit

Permalink
Merge branch 'master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
EricApostal committed Dec 31, 2022
2 parents 064f162 + 8d3fb1e commit 2c833a0
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 47 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/run_tests.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: tests

# We run the test suite on every push
on: [push]
on: [push, pull_request]

jobs:
build-linux:
Expand Down
8 changes: 7 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,14 @@ All notable changes to this project will be documented in this file.

This project adheres to [Semantic Versioning](http://semver.org/).

### v0.17.6
### v0.17.7
* Add pythonic aliases for comparison predicates.
* Add alias tests to test_predicates.py

### v0.17.6
* Removed a deprecated function which allowed calling non-table attributes on a table.
* Removed a deprecated function which created an empty table.
* Fixes bug with copying markers.

### v0.17.5
* Eliminated deprecation warnings involved arrays containing arrays/sequences.
Expand Down
2 changes: 1 addition & 1 deletion datascience/maps.py
Original file line number Diff line number Diff line change
Expand Up @@ -523,7 +523,7 @@ def lat_lons(self):

def copy(self):
"""Return a deep copy"""
return type(self)(self.lat_lon[:], **self._attrs)
return type(self)(self.lat_lon[0], self.lat_lon[1], **self._attrs)

@property
def _folium_kwargs(self):
Expand Down
46 changes: 3 additions & 43 deletions datascience/tables.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,26 +69,6 @@ def __init__(self, labels=None, formatter=_formats.default_formatter):
self.take = _RowTaker(self)
self.exclude = _RowExcluder(self)

# Deprecated
@classmethod
def empty(cls, labels=None):
"""Creates an empty table. Column labels are optional. [Deprecated]
Args:
``labels`` (None or list): If ``None``, a table with 0
columns is created.
If a list, each element is a column label in a table with
0 rows.
Returns:
A new instance of ``Table``.
"""
warnings.warn("Table.empty(labels) is deprecated. Use Table(labels)", FutureWarning)
if labels is None:
return cls()
values = [[] for label in labels]
return cls(values, labels)

# Deprecated
@classmethod
def from_rows(cls, rows, labels):
Expand Down Expand Up @@ -295,28 +275,6 @@ def __len__(self):
def __iter__(self):
return iter(self.labels)

# Deprecated
def __getattr__(self, attr):
"""Return a method that applies to all columns or a table of attributes. [Deprecated]
E.g., t.sum() on a Table will return a table with the sum of each column.
"""
if self.columns and all(hasattr(c, attr) for c in self.columns):
warnings.warn("Implicit column method lookup is deprecated.", FutureWarning)
attrs = [getattr(c, attr) for c in self.columns]
if all(callable(attr) for attr in attrs):
@functools.wraps(attrs[0])
def method(*args, **vargs):
"""Create a table from the results of calling attrs."""
columns = [attr(*args, **vargs) for attr in attrs]
return self._with_columns(columns)
return method
else:
return self._with_columns([[attr] for attr in attrs])
else:
msg = "'{0}' object has no attribute '{1}'".format(type(self).__name__, attr)
raise AttributeError(msg)

####################
# Accessing Values #
####################
Expand Down Expand Up @@ -3642,7 +3600,8 @@ def draw(axis, label, color):
axis.bar(index-0.5, self[label], 1.0, color=color, **options)

def annotate(axis, ticks):
if (ticks is not None) :
if (ticks is not None):
axis.set_xticks(axis.get_xticks())
tick_labels = [ticks[int(l)] if 0<=l<len(ticks) else '' for l in axis.get_xticks()]
axis.set_xticklabels(tick_labels, stretch='ultra-condensed')

Expand Down Expand Up @@ -5862,6 +5821,7 @@ def _vertical_x(axis, ticks=None, max_width=5):
if (np.array(ticks) == np.rint(ticks)).all():
ticks = np.rint(ticks).astype(np.int64)
if max([len(str(tick)) for tick in ticks]) > max_width:
axis.set_xticks(ticks)
axis.set_xticklabels(ticks, rotation='vertical')

###################
Expand Down
2 changes: 1 addition & 1 deletion datascience/version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = '0.17.5'
__version__ = '0.17.6'
8 changes: 8 additions & 0 deletions tests/test_maps.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,14 @@ def test_circle_map():
ds.Circle.map(lats, lons).show()
ds.Circle.map(lats, lons, labels).show()

def test_marker_copy():
lat, lon = 51, 52
a = ds.Marker(lat, lon)
b = a.copy()
b_lat_lon = b.lat_lon
assert lat == b_lat_lon[0]
assert lon == b_lat_lon[1]


##########
# Region #
Expand Down

0 comments on commit 2c833a0

Please sign in to comment.