Skip to content

Commit

Permalink
PyLint changes
Browse files Browse the repository at this point in the history
  • Loading branch information
levi-rs committed Dec 8, 2016
1 parent 5de6f6c commit 4e3690c
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 14 deletions.
2 changes: 1 addition & 1 deletion dankbot/dankbot.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ def __init__(self, config, logger):
self.logger = logger

# Create DB connection
self.db = DB(create_db=True)
self.db = DB(logger, create_db=True) # pylint: disable=C0103

def find_and_post_memes(self):
""" Find memes from subreddits and post them to slack
Expand Down
13 changes: 6 additions & 7 deletions dankbot/db.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
import os
from appdirs import user_data_dir
import logging
import sqlite3 as lite
from os.path import join
from contextlib import closing

from dankbot import APPNAME, APPAUTHOR

logger = logging.getLogger(__name__)

DB_NAME = 'dankbot.db'


Expand All @@ -17,7 +14,9 @@ class DB(object):
db_path = None
db_con = None

def __init__(self, db_dir=None, db_name=None, create_db=False):
def __init__(self, logger, db_dir=None, create_db=False):
self.logger = logger

self.db_dir = db_dir or user_data_dir(APPNAME, APPAUTHOR)
self.db_path = join(self.db_dir, DB_NAME)

Expand All @@ -39,15 +38,15 @@ def _create_db_and_table(self):
""" Create the database and table if it doesn't exist
"""
if os.path.exists(self.db_path): # pragma: no cover
logger.info("Will not create database: already exists at:"
" {0}".format(self.db_path))
self.logger.info("Will not create database: already exists at:"
" {0}".format(self.db_path)) # pylint: disable=W1202
return

# Create the data directory if it doesn't exist
if not os.path.exists(self.db_dir): # pragma: no cover
os.makedirs(self.db_dir)

logger.info("Creating database at: {0}".format(self.db_path))
self.logger.info("Creating database at: {0}".format(self.db_path)) # pylint: disable=W1202

query = """CREATE TABLE IF NOT EXISTS memes (
reddit_id VARCHAR(255) PRIMARY KEY NOT NULL,
Expand Down
12 changes: 6 additions & 6 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@

import versioneer

here = path.dirname(path.abspath(__file__))
HERE = path.dirname(path.abspath(__file__))

# Get the long description from the README file
with open(path.join(here, 'README.rst')) as f:
long_description = f.read()
with open(path.join(HERE, 'README.rst')) as f:
LONG_DESCRIPTION = f.read()

install_requires = [
INSTALL_REQUIRES = [
'appdirs==1.4.0',
'configparser==3.5.0',
'imgurpython==1.1.7',
Expand All @@ -32,10 +32,10 @@
description="Slack bot for posting dank memes from Reddit",
packages=find_packages(),
license='MIT',
long_description=long_description,
long_description=LONG_DESCRIPTION,
test_suite="tests",
tests_require=['tox'],
install_requires=install_requires,
install_requires=INSTALL_REQUIRES,
entry_points={
"console_scripts": [
"dankbot=dankbot.cli:main",
Expand Down

0 comments on commit 4e3690c

Please sign in to comment.