Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/beta' into release
Browse files Browse the repository at this point in the history
  • Loading branch information
mmcardle committed Nov 30, 2013
2 parents 6ca35e5 + 00c914b commit ac75ac7
Show file tree
Hide file tree
Showing 5 changed files with 13,212 additions and 40 deletions.
25 changes: 11 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,21 +42,21 @@ Create Size File objects in memory:

from sizefs import SizeFS
sfs = SizeFS()
sfs.read('/ones/1B', 1, 0, None, create=True)
sfs.read('/ones/2B', 2, 0, None, create=True)
sfs.read('/ones/2K', 1024, 0, None, create=True)
sfs.read('/ones/128K', 1024*128, 0, None, create=True)
sfs.read('/ones/4G', 4*1024*1024, 0, None, create=True)
sfs.read('/1B', 1, 0, None)
sfs.read('/2B', 2, 0, None)
sfs.read('/2K', 1024, 0, None)
sfs.read('/128K', 1024*128, 0, None)
sfs.read('/4G', 4*1024*1024, 0, None)

The folder structure is used to determine the content of the files:
The folder structure can be used to determine the content of the files:

sfs.read('/zeros/5B', 5, 0, None, create=True).read(0, 5)
sfs.read('/zeros/5B', 5, 0, None).read(0, 5)
out> 00000

sfs.read('/ones/5B', 5, 0, None, create=True).read(0, 5)
sfs.read('/ones/5B', 5, 0, None).read(0, 5)
out> 11111

sfs.read('/alpha_num/5B', 5, 0, None, create=True).read(0, 5)
sfs.read('/alpha_num/5B', 5, 0, None).read(0, 5)
out> TMdEv

The folders 'ones', 'zeros' and 'alpha_num' are always present,
Expand All @@ -67,7 +67,7 @@ the file's xattrs are updated:
sfs.mkdir('/regex1', None)
sfs.setxattr('/regex1', 'generator', 'regex', None)
sfs.setxattr('/regex1', 'filler', 'regex', None)
print sfs.read('/regex1/5B', 5, 0, None, create=True).read(0, 5)
print sfs.read('/regex1/5B', 5, 0, None).read(0, 5)

out> regex

Expand All @@ -81,7 +81,7 @@ the file's xattrs are updated:

out> aabbc

Files can also be added to SizeFS using sfs.create:
Files can also be added to SizeFS without reading their contents using sfs.create():

sfs.mkdir('/folder', None)
sfs.create('/folder/5B', None)
Expand All @@ -91,19 +91,16 @@ Files can also be added to SizeFS using sfs.create:

And as discussed above, the name of the file determines its size:

sfs.create('/regex3/128K', None)
# Try to read more contents than the files contains
print len(sfs.read('/regex3/128K', 256*1000, 0, None))

out> 128000

sfs.create('/regex3/128K-1B', None)
# Try to read more contents than the files contains
print len(sfs.read('/regex3/128K-1B', 256*1000, 0, None))

out> 127999

sfs.create('/regex3/128K+1B', None)
# Try to read more contents than the files contains
print len(sfs.read('/alphanum/128K+1B', 256*1000, 0, None))

Expand Down
8 changes: 6 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,21 @@
__author__ = 'mm'

from distutils.core import setup
from distutils.extension import Extension

setup(
name='SizeFS',
version='0.2.2',
version='0.2.3',
author='Mark McArdle',
author_email='[email protected]',
packages=['sizefs', 'tests'],
scripts=[],
url='http://pypi.python.org/pypi/SizeFS/',
download_url='https://github.com/sohonetlabs/sizefs',
license='LICENSE.txt',
ext_modules=[
Extension("sizefs.contents", ["sizefs/contents.pyx"]),
Extension("sizefs.contents", ["sizefs/contents.c"])
],
description='SizeFS is a mock filesystem for creating files of particular '
'sizes with specified contents.',
long_description=open('README.txt').read(),
Expand Down
Loading

0 comments on commit ac75ac7

Please sign in to comment.