Skip to content

Commit

Permalink
Merge pull request #95 from treasure-data/lint
Browse files Browse the repository at this point in the history
Fix lint error by formatting
  • Loading branch information
takuti committed Dec 25, 2020
2 parents 7366a31 + 4be791a commit 27dcc5a
Show file tree
Hide file tree
Showing 7 changed files with 12 additions and 21 deletions.
2 changes: 1 addition & 1 deletion noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ def lint(session):
session.install(*lint_tools)
session.run("flake8", *targets)
session.run("black", "--diff", "--check", *targets)
session.run("isort", "--check-only")
session.run("isort", "--diff", "--check", *targets)


@nox.session
Expand Down
3 changes: 1 addition & 2 deletions pytd/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -161,8 +161,7 @@ def get_job(self, job_id):
return self.api_client.job(job_id)

def close(self):
"""Close a client I/O session to Treasure Data.
"""
"""Close a client I/O session to Treasure Data."""
self.default_engine.close()
self.api_client.close()

Expand Down
15 changes: 5 additions & 10 deletions pytd/query_engine.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,7 @@ def __init__(self, apikey, endpoint, database, header):

@property
def user_agent(self):
"""User agent passed to a query engine connection.
"""
"""User agent passed to a query engine connection."""
return "pytd/{0}".format(__version__)

def execute(self, query, **kwargs):
Expand Down Expand Up @@ -260,8 +259,7 @@ def __init__(self, apikey, endpoint, database, header):

@property
def user_agent(self):
"""User agent passed to a Presto connection.
"""
"""User agent passed to a Presto connection."""
return "pytd/{0} (prestodb/{1}; tdclient/{2})".format(
__version__, prestodb.__version__, tdclient.__version__
)
Expand Down Expand Up @@ -314,8 +312,7 @@ def cursor(self, force_tdclient=False, **kwargs):
return self._get_tdclient_cursor(self.tdclient_connection, **kwargs)

def close(self):
"""Close a connection to Presto.
"""
"""Close a connection to Presto."""
self.prestodb_connection.close()
self.tdclient_connection.close()

Expand Down Expand Up @@ -364,8 +361,7 @@ def __init__(self, apikey, endpoint, database, header):

@property
def user_agent(self):
"""User agent passed to a Hive connection.
"""
"""User agent passed to a Hive connection."""
return "pytd/{0} (tdclient/{1})".format(__version__, tdclient.__version__)

def cursor(self, force_tdclient=True, **kwargs):
Expand Down Expand Up @@ -408,8 +404,7 @@ def cursor(self, force_tdclient=True, **kwargs):
return self._get_tdclient_cursor(self.engine, **kwargs)

def close(self):
"""Close a connection to Hive.
"""
"""Close a connection to Hive."""
self.engine.close()

def _connect(self):
Expand Down
2 changes: 1 addition & 1 deletion pytd/spark.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,9 +86,9 @@ def fetch_td_spark_context(
Connection of td-spark
"""
try:
import td_pyspark
from pyspark.conf import SparkConf
from pyspark.sql import SparkSession
import td_pyspark
from td_pyspark import TDSparkContextBuilder
except ImportError:
raise RuntimeError("td_pyspark is not installed")
Expand Down
3 changes: 1 addition & 2 deletions pytd/table.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,7 @@ def create(self, column_names=[], column_types=[]):
self.client.api_client.create_log_table(self.database, self.table)

def delete(self):
"""Delete a table from Treasure Data.
"""
"""Delete a table from Treasure Data."""
self.client.api_client.delete_table(self.database, self.table)

def import_dataframe(self, dataframe, writer, if_exists="error", **kwargs):
Expand Down
6 changes: 2 additions & 4 deletions pytd/writer.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,7 @@ def _isinstance_or_null(x, t):


def _replace_pd_na(dataframe):
"""Replace np.nan to None to avoid Int64 conversion issue
"""
"""Replace np.nan to None to avoid Int64 conversion issue"""
if dataframe.isnull().any().any():
dataframe.replace({np.nan: None}, inplace=True)

Expand Down Expand Up @@ -679,7 +678,6 @@ def write_dataframe(self, dataframe, table, if_exists):
)

def close(self):
"""Close a PySpark session connected to Treasure Data.
"""
"""Close a PySpark session connected to Treasure Data."""
if self.td_spark is not None:
self.td_spark.spark.stop()
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@


def setup_package():
from setuptools import setup, find_packages
from setuptools import find_packages, setup

metadata = dict(
name=DISTNAME,
Expand Down

0 comments on commit 27dcc5a

Please sign in to comment.