Skip to content

Commit

Permalink
removed additional python 2-related checks
Browse files Browse the repository at this point in the history
  • Loading branch information
Samuel Hoffman committed May 9, 2019
1 parent a20b051 commit 0bf1153
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 33 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,7 @@
import argparse
import os
import platform
try:
from commands import getoutput
except ImportError:
from subprocess import getoutput
from subprocess import getoutput
import logging
import datetime
import pickle
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,7 @@
import argparse
import os
import platform
try:
from commands import getoutput
except ImportError:
from subprocess import getoutput
from subprocess import getoutput
import logging
import datetime
import pickle
Expand Down
3 changes: 1 addition & 2 deletions aif360/algorithms/inprocessing/prejudice_remover.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,7 @@
- kamfadm-2012ecmlpkdd/train_lr.py
- kamfadm-2012ecmlpkdd/train_nb.py
* fixed typo in kamfadm-2012ecmlpkdd/fadm/lr/pr.py:244 (typeError -> TypeError)
* removed commands.py and instead use subprocess.getoutput if commands is
not available
* removed commands.py and instead use subprocess.getoutput
Notes from fairness-comparison's KamishimaAlgorithm.py on changes made to
original Kamishima code.
Expand Down
14 changes: 4 additions & 10 deletions aif360/datasets/dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,14 @@
from __future__ import print_function
from __future__ import unicode_literals

import abc
from abc import ABC, abstractmethod
import copy
import sys

if sys.version_info >= (3, 4):
ABC = abc.ABC
else:
ABC = abc.ABCMeta(str('ABC'), (), {})


class Dataset(ABC):
"""Abstract base class for datasets."""

@abc.abstractmethod
@abstractmethod
def __init__(self, **kwargs):
self.metadata = kwargs.pop('metadata', dict()) or dict()
self.metadata.update({
Expand Down Expand Up @@ -51,12 +45,12 @@ def copy(self, deepcopy=False):
})
return cpy

@abc.abstractmethod
@abstractmethod
def export_dataset(self):
"""Save this Dataset to disk."""
raise NotImplementedError

@abc.abstractmethod
@abstractmethod
def split(self, num_or_size_splits, shuffle=False):
"""Split this dataset into multiple partitions.
Expand Down
10 changes: 2 additions & 8 deletions aif360/explainers/explainer.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,12 @@
from __future__ import print_function
from __future__ import unicode_literals

import abc
import sys

if sys.version_info >= (3, 4):
ABC = abc.ABC
else:
ABC = abc.ABCMeta(str('ABC'), (), {})
from abc import ABC, abstractmethod


class Explainer(ABC):
"""Base class for explainers."""

@abc.abstractmethod
@abstractmethod
def __init__(self):
pass
6 changes: 1 addition & 5 deletions tests/notebook_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
# http://www.christianmoscardi.com/blog/2016/01/20/jupyter-testing.html

import os
import sys
import subprocess
import tempfile

Expand All @@ -15,10 +14,7 @@ def notebook_run(path):
dirname, __ = os.path.split(path)
os.chdir(dirname)

if sys.version.startswith('2'):
kername = "python2"
else:
kername = "python3"
kername = "python3"

with tempfile.NamedTemporaryFile(suffix=".ipynb") as fout:
args = ["jupyter", "nbconvert", "--to", "notebook", "--execute",
Expand Down

0 comments on commit 0bf1153

Please sign in to comment.