713 Commits

Author SHA1 Message Date
Bill Flynn
aea58dea29 [#95] refactored exception into standardize_doi 2018-01-05 21:31:19 -05:00
Bill Flynn
e2ad39ca08 [Fix #95] robust handling of DOIs
Added DOI regex function to utils.py which is called in add_cmd.py
upon specifying a new DOI.  DOI validation applies directly on
argument parsing by using a custom argparse.Action.
2018-01-05 19:22:00 -05:00
Olivier Mangin
28a026d308
Merge pull request #102 from pubs/feature/year-range
Feature: year ranges in query. [Fixes #90]

Enables queries of the following form: "year:2000", "year:2000-2010", "year:2000-", "year:-2010".
2018-01-05 18:10:28 -05:00
Olivier Mangin
e069da518f Fixes query tests (assertFalse(not ...) and wrong name). 2018-01-05 18:04:59 -05:00
Olivier Mangin
3ad4a73da1 Moves query code from list_cmd to didicated module. 2018-01-05 14:34:24 -05:00
Olivier Mangin
0bd8d5b8dc Actually adds the functionality as well as a few more tests. 2018-01-05 14:34:24 -05:00
Olivier Mangin
832a20d743 Typo. 2018-01-05 14:34:24 -05:00
Olivier Mangin
84553d8eb3 [Fix #90] Adds year ranges to queries. 2018-01-05 14:34:24 -05:00
Olivier Mangin
c54de5c3b6 Refactors paper filtering from queries. 2018-01-05 14:34:24 -05:00
Olivier Mangin
e3f2e7db26 Cosmit. 2018-01-02 15:47:44 -05:00
Olivier Mangin
f8362911d3
Merge pull request #104 from wflynny/alias-desc
Allows aliases with descriptions.

Alias can be defined as currently supported and as subsections of the `[[alias]]` section of `conf.py` of the form:
```
[[[alias-name]]]
command = alias-command-definition
description = alias-description
```

Note that aliases defined this way must be placed at the end of the [[alias]] section or they will gobble up aliases defined in the current format. This is a limitation of `ConfigObj` sectioning.
2018-01-02 15:44:47 -05:00
Bill Flynn
ebbd2d4f19 added another test for #98 2017-12-20 09:23:10 -05:00
Bill Flynn
4362c649b2 Added alias description functionality to conf #98
Changed Alias constructor, added tests for this behavior, and added
a few lines in the default conf describing how to define alias
descriptions.
2017-12-20 09:13:22 -05:00
Olivier Mangin
6dd4b319ea Merges PR #66 2017-12-11 15:51:15 -05:00
Olivier Mangin
3e31c4455e Fixes argument and adds tests for overwrite on import. 2017-12-11 15:49:06 -05:00
Dennis Wilson
1cd95bdeec overwrite argument on import 2017-12-11 15:28:56 -05:00
Olivier Mangin
f808ff5f5c Updates list of contributors. 2017-12-11 15:07:38 -05:00
Olivier Mangin
88a6921fad Merge branch Print help when no subcommand is provided #100.
Fixes #99.
2017-12-11 14:54:46 -05:00
Olivier Mangin
b7d135f1c8 Adds wflynny to contributors. 2017-12-11 14:53:56 -05:00
Bill Flynn
37f076049b Many tests on MacOS 10.12.06 were failing due to fakefs path issues.
Not sure if this is needed.  Will see in the CI builds.
2017-12-08 17:51:06 -05:00
Bill Flynn
0c7ba85af9 Revisions subject to comments on PR #100
Additionally, reverted FakeSystemExit subclassing Exception, but added
an explicit __init__ so that we can emulate the SystemExit.code
functionality without having to change the superclass.
2017-12-08 17:49:19 -05:00
Bill Flynn
66c90c5d43 Added unittest to cover new behavior pubs
Unittest just checks that both `pubs` and `pubs --help` raise a
`SystemExit` exception with error code 0.  Due to how argparse
handles the `--help` keyword, this is the best way I could think to
provide test coverage without heavily modifying the parser structure
or the unittest infrastructure.

To ensure the `pubs` matches the behavior of `pubs --help`, it now
raises the same `SystemExit(0)` exception via `sys.exit(0)`.  And
in order to catch it in the unittest, I had to modify the
`FakeSystemExit` behavior slightly.
2017-11-30 14:48:50 -05:00
Bill Flynn
ac3a8d8bf2 Print help menu when no subcommands applied
Made subparsers not required in the main parser, but if no commands are parsed,
then the parser prints its help.  When a command is present, the normal
functionality preserved.

Removed the single unittest that checks for this exact behavior.
2017-11-28 17:32:13 -05:00
Olivier Mangin
5676cb49a9
Merge pull request #96 from pubs/fix/content
Fixes content not read from urls because of call to `os.abspath`
2017-11-02 13:45:23 -04:00
Olivier Mangin
4ea9f2101d
Merge pull request #97 from pubs/fix/config
Fix defaults not used in config.
2017-11-02 13:44:41 -04:00
Olivier Mangin
66b51997ea Fix defaults not used in config.
Basically the validation takes care of setting results that
post-processing was relying on. Hence the validation should occur before
the postprocessing. It actually makes more sense to validate within
post-process.
2017-10-19 16:40:45 -04:00
Olivier Mangin
6a26216c3e COSMIT 2017-10-19 15:46:42 -04:00
Olivier Mangin
a65873a7e0 Fixes abspath called on urls preventing to get content from url.
Fix #7
2017-10-19 15:40:58 -04:00
Olivier Mangin
f6035cac80 Merge pull request #94 from pubs/fix/93
Fix #93: actually save the modifications on `edit -m`.
2017-10-18 10:58:17 -04:00
Olivier Mangin
47f5c918ea Fix #93: saves the modifications on edit -m. 2017-10-17 16:50:23 -04:00
Olivier Mangin
2cab1666e8 Merge pull request #91 from pubs/fix/88
[Fix #88] Adds proper escaping for arguments in alias plugin.
2017-10-03 23:04:30 -04:00
Olivier Mangin
922781a89a Moves shell_quote import out of p3.py 2017-10-03 22:53:08 -04:00
Olivier Mangin
5c74f942c4 [Fix #88] Adds proper escaping for arguments in alias plugin. 2017-09-28 17:34:32 -04:00
Olivier Mangin
be3c124079 Fix update code. 2017-08-06 18:58:45 -04:00
Olivier Mangin
d40b86a9cf Updates version everywhere. 2017-08-06 18:58:45 -04:00
Olivier Mangin
3e05ad6d19 Releases 0.7.0 2017-08-06 18:07:18 -04:00
Olivier Mangin
b63a132ac4 Version update. 2017-08-06 18:02:24 -04:00
Fabien C. Y. Benureau
6cccc021f8 Minor fix for isbn2index docstring 2017-08-06 18:02:24 -04:00
Olivier Mangin
a286b118f4 Improves instructions in README. 2017-08-06 17:49:32 -04:00
Olivier Mangin
bd872e807d Lowercase license file. 2017-08-02 20:33:54 -04:00
Olivier Mangin
4f638ba9b6 Merge pull request #82 from pubs/bug/conf_cmd
Fixes bug in conf command and adds unittest
2017-08-01 23:49:08 -04:00
Olivier Mangin
69d7587108 Adds test for configuration file content in usecase. 2017-08-01 23:43:06 -04:00
Fabien C. Y. Benureau
366575763c Remove duplicate test 2017-08-01 23:43:06 -04:00
Fabien C. Y. Benureau
0942df3b50 Fix pubs conf command 2017-08-01 23:43:06 -04:00
Olivier Mangin
fd084bb827 Merge branch 'fix/76' 2017-07-22 15:45:52 -04:00
Olivier Mangin
da6f07c6c9 Adds basic API test for DOI and ISBN. 2017-07-22 15:42:12 -04:00
Olivier Mangin
38fc68adbc Refactors filebroker to remove file duplication. 2017-07-22 13:35:13 -04:00
Olivier Mangin
983d1892e0 Removes unused imports. 2017-07-22 13:35:13 -04:00
Olivier Mangin
7b19a9dcdd Forces utf8 when no encoding in header for DOI request.
The default behavior from the requests library is to use the guess from
chardet which is not always reliable while doi.org seems to always
return utf8 encoded data. It's unlikely that this changes without also
updating the header.
2017-07-22 13:35:13 -04:00
Olivier Mangin
cf596206b0 FIX: Encode unicode before writing to file in python2.
This is necessary because _open returns a file descriptor in binary mode
for python2.
2017-07-22 13:35:13 -04:00