-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #38 from VIDA-NYU/automatic-formatter
Automatic formatting using black
- Loading branch information
Showing
21 changed files
with
468 additions
and
327 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
name: Lint | ||
|
||
on: [push, pull_request] | ||
|
||
jobs: | ||
lint: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: psf/black@stable | ||
with: | ||
src: ./bdikit/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,14 @@ | ||
all: test | ||
SRC := ./bdikit/ | ||
|
||
PHONY: test | ||
all: lint test | ||
|
||
PHONY: format test lint | ||
|
||
lint: | ||
black --check ${SRC} | ||
|
||
test: | ||
python3 -m pytest | ||
|
||
format: | ||
black ${SRC} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
__version__ = '0.2.0.dev0' | ||
__version__ = "0.2.0.dev0" | ||
# To shortcut the import path | ||
from bdikit.api import APIManager | ||
from bdikit.api import APIManager |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,41 +1,43 @@ | ||
from enum import Enum | ||
|
||
|
||
class ColumnType(Enum): | ||
STRING = 'string' | ||
FLOAT = 'float' | ||
INTEGER = 'integer' | ||
# TODO semantic types? | ||
STRING = "string" | ||
FLOAT = "float" | ||
INTEGER = "integer" | ||
# TODO semantic types? | ||
|
||
|
||
class Column: | ||
def __init__(self, df_name, column_name, column_type=ColumnType.STRING, domain_values=None, null_values_representations=None): | ||
def __init__( | ||
self, | ||
df_name, | ||
column_name, | ||
column_type=ColumnType.STRING, | ||
domain_values=None, | ||
null_values_representations=None, | ||
): | ||
self.df_name = df_name | ||
self.column_name = column_name | ||
self.column_type = column_type | ||
|
||
if domain_values is None: | ||
self.domain_values = set() | ||
else: | ||
self.domain_values = set(domain_values) | ||
|
||
if null_values_representations is None: | ||
self.null_values_representations = set() | ||
else: | ||
self.null_values_representations = set(null_values_representations) | ||
|
||
|
||
|
||
def __str__(self): | ||
return f"Column(df_name={self.df_name}, column_name={self.column_name}, column_type={self.column_type}, domain_values={self.domain_values}, null_values_representations={self.null_values_representations})" | ||
|
||
def __eq__(self, value): | ||
if not isinstance(value, Column): | ||
return False | ||
return self.df_name == value.df_name and self.column_name == value.column_name | ||
|
||
def __hash__(self): | ||
return hash((self.df_name, self.column_name)) | ||
|
||
|
||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,4 +4,4 @@ | |
def load_dataframe(dataset_path): | ||
dataset = pd.read_csv(dataset_path) | ||
|
||
return dataset | ||
return dataset |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.