Skip to content

Commit

Permalink
beginning documenting .rst
Browse files Browse the repository at this point in the history
  • Loading branch information
carvetighter committed Feb 28, 2018
1 parent 2790394 commit debbb79
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 18 deletions.
2 changes: 1 addition & 1 deletion FileSampler/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ class FileSamplerBase(object):
m_bool_estimate is False, if the flag is True a sampling of the file will occur to
estimate the file length
num_of_lies
number_of_lines
property, the number of lines in the file
estimate_mode
Expand Down
29 changes: 22 additions & 7 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -21,24 +21,39 @@ Usage
::

from randomAccessReader import RandomAccessReader
from FileSamper import TextSamper

reader = RandomAccessReader('~/myfile.txt')
sampler_text = TextSampler('c:\file path\text_file.txt')

# single line
line = reader.get_lines(2)[0]
print line
string_line = sampler_text.get_a_line(int_line_number)
print(string_line)

# multiple lines
lines = reader.get_lines(3, 3)
for l in lines:
print l
list_lines = sampler_text.get_lines(list_line_numbers)
for line in list_lines:
print(line)

# random lines
list_random_lines = sampler_text.get_random_lines(int_number_of_lines)
for line in list_random_lines:
print(line)

| Optional arguments in the constructor:
- ``endline_character`` - self-explanatory (default is endline character ``\n``)
- ``ignore_blank_lines`` - if set to ``True``, blank lines in the file will not be read or indexed (default is ``False``)

|
| Each instance of a TextSampler or CsvSamper class has the properies:
- number_of_lines -> type: int; returns the number of lines in the file
- estimate_mode -> type: bool; flag if the class counted all the line lenghts in the
file or estimated the line length based on a sample

|
| Each
|
| **Csv example:**
Expand Down
19 changes: 9 additions & 10 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,25 +10,25 @@
long_description = f.read()

setup(
name='random-access-file-reader',
name='FileSampler',

# Versions should comply with PEP440. For a discussion on single-sourcing
# the version across setup.py and the project code, see
# https://packaging.python.org/en/latest/single_source_version.html
version='0.3.0',
version='0.0.0'

description='A python random access file reader',
description='light weight sampler package for data files',
long_description=long_description,

# The project's main homepage.
url='https://github.com/jegesh/python-random-access-file-reader',
url='https://github.com/carvetighter/FileSampler',

# Author details
author='Yaakov Gesher',
author_email='[email protected]',
author='Brent Allen',
author_email='[email protected]',

# Choose your license
license='Apache Software License',
license='MIT',

# See https://pypi.python.org/pypi?%3Aaction=list_classifiers
classifiers=[
Expand All @@ -43,16 +43,15 @@
'Topic :: Software Development :: Libraries',

# Pick your license as you wish (should match "license" above)
'License :: OSI Approved :: Apache Software License',
'License :: OSI Approved :: MIT License',

# Specify the Python versions you support here. In particular, ensure
# that you indicate whether you support Python 2, Python 3 or both.
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3.5',
],

# You can just specify the packages manually here if your project is
# simple. Or you can use find_packages().
packages=['randomAccessReader'],
# packages=['<package name>'],

)

0 comments on commit debbb79

Please sign in to comment.