-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 2c7c31c
Showing
44 changed files
with
1,640 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
[run] | ||
source = dhelp | ||
omit = | ||
*tests* | ||
setup.py | ||
|
||
[report] | ||
omit = | ||
nose/* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# OS Files | ||
.DS_Store | ||
~* | ||
|
||
# Python Files | ||
__pycache__ | ||
*.pyc | ||
|
||
# Build Files | ||
*.egg-info | ||
MANIFEST | ||
htmlcov | ||
build | ||
dist | ||
|
||
|
||
# Testing files | ||
.pypirc | ||
.testing* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# test in python | ||
language: python | ||
# python versions tested | ||
python: | ||
- "3.5" | ||
# enable the use of sudo | ||
sudo: required | ||
# operating system to use | ||
os: linux | ||
# distribution to use | ||
dist: precise | ||
# setting environment variables | ||
env: | ||
- PACKAGE_VERSION=0.0.0 | ||
# command to install dependencies | ||
install: | ||
- pip install -r requirements-dev.txt | ||
# command to run tests | ||
script: | ||
- nose2 | ||
after_success: | ||
coveralls | ||
notifications: | ||
on_success: never | ||
on_failure: never |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
# Contributing | ||
|
||
When contributing to this repository, please first discuss the change you wish to make via issue, email, or any other method with the owners of this repository before making a change. | ||
|
||
Please note we have a code of conduct, please follow it in all your interactions with the project. | ||
|
||
## Pull Request Process | ||
|
||
1. Ensure any install or build dependencies are removed before the end of the layer when doing a build. | ||
2. Update the README.md with details of changes to the interface, this includes new environment variables, exposed ports, useful file locations and container parameters. | ||
3. Increase the version numbers in any examples files and the README.md to the new version that this Pull Request would represent. The versioning scheme we use is [SemVer](http://semver.org/). | ||
4. You may merge the Pull Request in once you have the sign-off of two other developers, or if you do not have permission to do that, you may request the second reviewer to merge it for you. | ||
|
||
## Contributor Code of Conduct | ||
|
||
As contributors and maintainers of this project, and in the interest of fostering an open and welcoming community, we pledge to respect all people who contribute through reporting issues, posting feature requests, updating documentation, submitting pull requests or patches, and other activities. | ||
|
||
We are committed to making participation in this project a harassment-free experience for everyone, regardless of level of experience, gender, gender identity and expression, sexual orientation, disability, personal appearance, body size, race, ethnicity, age, religion, or nationality. | ||
|
||
Examples of unacceptable behavior by participants include: | ||
|
||
* The use of sexualized language or imagery | ||
* Personal attacks | ||
* Trolling or insulting/derogatory comments | ||
* Public or private harassment | ||
* Publishing other's private information, such as physical or electronic addresses, without explicit permission | ||
* Other unethical or unprofessional conduct. | ||
|
||
Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct. By adopting this Code of Conduct, project maintainers commit themselves to fairly and consistently | ||
applying these principles to every aspect of managing this project. Project maintainers who do not follow or enforce the Code of Conduct may be permanently removed from the project team. | ||
|
||
This code of conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. | ||
|
||
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by opening an issue or contacting one or more of the project maintainers. | ||
|
||
This Code of Conduct is adapted from the [Contributor Covenant](http://contributor-covenant.org), version 1.2.0, available at [http://contributor-covenant.org/version/1/2/0/](http://contributor-covenant.org/version/1/2/0/) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
The MIT License (MIT) | ||
|
||
Copyright (c) 2018, David J. Thomas, thePortus.com | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,107 @@ | ||
# dhelp | ||
|
||
Helper objects for various Digital Humanities related tasks. Contains modules | ||
to work with text files/folders, CSVs, webpages, and perform natural language | ||
processing. | ||
|
||
[David J. Thomas](mailto:[email protected]), [thePortus.com](http://thePortus.com)<br> | ||
Instructor of Ancient History and Digital Humanities, [University of South Florida](https://github.com/usf-portal) | ||
|
||
``` | ||
pip install dhelp | ||
``` | ||
|
||
--- | ||
|
||
## Text Files | ||
|
||
Load and save plain text data to/from files with TextFile. | ||
|
||
```python | ||
from dhelp import TextFile | ||
|
||
# load file as a string | ||
file_data = TextFile('some/path.txt').load() | ||
# remove all endlines | ||
file_data = file_data.replace('\n') | ||
# save altered text, specifying the overwrite option | ||
TextFile('some/path.txt').save(file_data, options={'overwrite': True}) | ||
|
||
``` | ||
|
||
--- | ||
|
||
## Text Folders | ||
|
||
Modify entire folders of plain text data easily with TextFolder. You can use | ||
.load() to get a list of TextFile objects, each one already linked to the | ||
location of a file in the folder. Better yet, to streamline text processing, | ||
you can use .modify(). Once you define a function showing how to alter the data | ||
of a single file, you can then load, modify, and save every single file in | ||
a folder in a single line of code. | ||
|
||
```python | ||
from dhelp import TextFolder | ||
|
||
# load .txts in folder as list of TextFile objs, each linked to file loc | ||
folder_files = TextFolder('some/folder').load() | ||
# loop through each TextFile object, load data and print | ||
for folder_file in folder_files: | ||
print(folder_file.load()) | ||
``` | ||
|
||
Setting options... | ||
|
||
```python | ||
# options dict, specifying all possible options, including output dir | ||
options_settings = { | ||
'encoding': 'utf-8', | ||
'extensions': ['txt', 'html', 'rtf'] | ||
} | ||
# pass the dict as the options argument | ||
TextFolder('some/folder').load(options=options_settings) | ||
``` | ||
|
||
Modify all files, simplified | ||
|
||
```python | ||
# make a function defining how to modify the data of a single record | ||
# function must have single arg (e.g. record_data), alter it, and return it | ||
def modify_record(record_data): | ||
# remove all endlines | ||
record_data = record_data.replace('\n', '') | ||
# return altered data | ||
return record_data | ||
|
||
# if you don't specify destination, a backup will automatically be created | ||
options_settings = {'destination': 'some/other-folder'} | ||
|
||
# use TextFolder().modify, pass your function as 1st arg | ||
# TextFolder will then load, modify, and save each file automatically! | ||
TextFolder('some/folder').modify(modify_record, options=options_settings) | ||
|
||
``` | ||
|
||
--- | ||
|
||
## CSV Files | ||
|
||
```python | ||
|
||
``` | ||
|
||
--- | ||
|
||
## Web Pages | ||
|
||
```python | ||
|
||
``` | ||
|
||
--- | ||
|
||
## Natural Language Processing | ||
|
||
```python | ||
|
||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
#!/usr/bin/python | ||
|
||
""" dhelp | ||
David J. Thomas, thePortus.com, Copyright, 2018 | ||
Helper objects for various Digital Humanities related tasks. Contains modules | ||
to work with text files/folders, CSVs, webpages, and perform natural language | ||
processing. | ||
""" | ||
|
||
from .files import CSVFile, TextFile, TextFolder | ||
from .web import WebPage |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
#!/usr/bin/python | ||
|
||
""" dhelp/files | ||
David J. Thomas, thePortus.com, Copyright, 2018 | ||
Module for loading/saving/modifying individual or groups of files. Primarily | ||
used for loading of plain text files (individually or by folder) or CSVs. | ||
""" | ||
|
||
from .text_file import TextFile | ||
from .text_folder import TextFolder | ||
from .csv_file import CSVFile |
Oops, something went wrong.