Skip to content

Commit

Permalink
pep8 fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
hellais committed May 1, 2015
1 parent 72c9d35 commit 5e7c422
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
3 changes: 3 additions & 0 deletions luigi/file.py
Expand Up @@ -32,7 +32,9 @@
from luigi.target import FileSystem, FileSystemTarget, AtomicLocalFile
from luigi.target import AtomicLocalFileAppend


class atomic_file(AtomicLocalFile):

"""Simple class that writes to a temp file and moves it on close()
Also cleans up the temp file if close is not invoked
"""
Expand All @@ -45,6 +47,7 @@ def generate_tmp_path(self, path):


class LocalFileSystem(FileSystem):

"""
Wrapper for access to file system operations.
Expand Down
13 changes: 12 additions & 1 deletion luigi/target.py
Expand Up @@ -38,6 +38,7 @@ class FileLockException(Exception):

@six.add_metaclass(abc.ABCMeta)
class Target(object):

"""
A Target is a resource generated by a :py:class:`~luigi.task.Task`.
Expand All @@ -58,13 +59,15 @@ def exists(self):


class FileSystemException(Exception):

"""
Base class for generic file system exceptions.
"""
pass


class FileAlreadyExists(FileSystemException):

"""
Raised when a file system operation can't be performed because
a directory exists but is required to not exist.
Expand All @@ -73,6 +76,7 @@ class FileAlreadyExists(FileSystemException):


class MissingParentDirectory(FileSystemException):

"""
Raised when a parent directory doesn't exist.
(Imagine mkdir without -p)
Expand All @@ -82,6 +86,7 @@ class MissingParentDirectory(FileSystemException):

@six.add_metaclass(abc.ABCMeta)
class FileSystem(object):

"""
FileSystem abstraction used in conjunction with :py:class:`FileSystemTarget`.
Expand Down Expand Up @@ -141,10 +146,13 @@ def isdir(self, path):
*Note*: This method is optional, not all FileSystem subclasses implements it.
"""
raise NotImplementedError("isdir() not implemented on {0}".format(self.__class__.__name__))
raise NotImplementedError(
"isdir() not implemented on {0}".format(
self.__class__.__name__))


class FileSystemTarget(Target):

"""
Base class for FileSystem Targets like :class:`~luigi.file.LocalTarget` and :class:`~luigi.contrib.hdfs.HdfsTarget`.
Expand Down Expand Up @@ -207,6 +215,7 @@ def remove(self):


class AtomicLocalFile(io.BufferedWriter):

"""Abstract class to create Target that create
a tempoprary file in the local filesystem before
moving it to there final destination
Expand Down Expand Up @@ -244,7 +253,9 @@ def __exit__(self, exc_type, exc, traceback):
return
return super(AtomicLocalFile, self).__exit__(exc_type, exc, traceback)


class AtomicLocalFileAppend(io.BufferedWriter):

def __init__(self, path, timeout=10, delay=.05):
self.path = path
self.is_locked = False
Expand Down

0 comments on commit 5e7c422

Please sign in to comment.