Skip to content

Commit

Permalink
flakes
Browse files Browse the repository at this point in the history
  • Loading branch information
ask committed Oct 26, 2015
1 parent 7aff49e commit 6b183f9
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 45 deletions.
37 changes: 0 additions & 37 deletions celery/platforms.py
Original file line number Diff line number Diff line change
Expand Up @@ -265,43 +265,6 @@ def _create_pidlock(pidfile):
pidlock.acquire()
return pidlock

def fd_by_path(paths):
"""
Return a list of fds.
This method returns list of fds corresponding to
file paths passed in paths variable.
:keyword paths: List of file paths go get fd for.
:returns: :list:.
**Example**:
.. code-block:: python
keep = fd_by_path(['/dev/urandom',
'/my/precious/'])
"""
stats = set()
for path in paths:
try:
fd = os.open(path, os.O_RDONLY)
except OSError:
continue
try:
stats.add(os.fstat(fd)[1:3])
finally:
os.close(fd)

def fd_in_stats(fd):
try:
return os.fstat(fd)[1:3] in stats
except OSError:
return False

return [fd for fd in range(get_fdmax(2048)) if fd_in_stats(fd)]


def fd_by_path(paths):
"""Return a list of fds.
Expand Down
8 changes: 0 additions & 8 deletions celery/tests/utils/test_platforms.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,14 +56,6 @@ def test_short_opt(self):
'bar'
)

class test_fd_by_path(Case):

def test_finds(self):
test_file = tempfile.NamedTemporaryFile()
keep = fd_by_path([test_file.name])
self.assertEqual(keep, [test_file.file.fileno()])
test_file.close()


class test_fd_by_path(Case):

Expand Down

0 comments on commit 6b183f9

Please sign in to comment.