Skip to content

Commit f889e02

Browse files
authored
V0.6 (#8)
* allow to be re-used by avoiding import time logic
1 parent 70576fc commit f889e02

File tree

13 files changed

+776
-124
lines changed

13 files changed

+776
-124
lines changed

.travis.yml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
language: python
2+
3+
sudo: false
4+
5+
python:
6+
- "2.7"
7+
- "3.5"
8+
- "3.6"
9+
- "pypy"
10+
- "pypy3.5"
11+
- "nightly"
12+
13+
matrix:
14+
fast_finish: true
15+
allow_failures:
16+
- python: "nightly"
17+
include:
18+
- python: 3.7
19+
dist: xenial
20+
sudo: true
21+
22+
install:
23+
- pip install --upgrade pytest setuptools
24+
- pip install --editable .
25+
- pip install -r tests/requirements.txt
26+
27+
script:
28+
- pytest
29+
30+
notifications:
31+
email: false

README.rst

Lines changed: 26 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Advent of Code data
22
===================
33

4-
|pyversions|_ |pypi|_ |womm|_
4+
|pyversions|_ |pypi|_ |womm|_ |travis|_
55

66
.. |pyversions| image:: https://img.shields.io/pypi/pyversions/advent-of-code-data.svg
77
.. _pyversions:
@@ -12,6 +12,10 @@ Advent of Code data
1212
.. |womm| image:: https://cdn.rawgit.com/nikku/works-on-my-machine/v0.2.0/badge.svg
1313
.. _womm: https://github.com/nikku/works-on-my-machine
1414

15+
.. |travis| image:: https://img.shields.io/travis/wimglenn/advent-of-code-data.svg?branch=master
16+
.. _travis: https://travis-ci.com/wimglenn/advent-of-code-data
17+
18+
1519
Get your puzzle data with a single import statement:
1620

1721
.. code-block:: python
@@ -20,28 +24,38 @@ Get your puzzle data with a single import statement:
2024
2125
Might be useful for lazy Pythonistas and speedhackers.
2226

23-
**Note: Please use version 0.3+ of this library.** It memoizes successful requests client side and rate-limits the get_data function, as `requested by the AoC author <https://www.reddit.com/r/adventofcode/comments/3v64sb/aoc_is_fragile_please_be_gentle/>`_. Thanks!
27+
**Note: Please use version 0.3+ of this library.** It memoizes successful
28+
requests client side and rate-limits the get_data function, as
29+
`requested by the AoC author <https://www.reddit.com/r/adventofcode/comments/3v64sb/aoc_is_fragile_please_be_gentle/>`_.
30+
Thanks!
2431

2532

2633
Automated submission
2734
--------------------
2835

29-
New in version 0.4.0.
36+
New in version 0.4.0. Basic use:
3037

3138
.. code-block:: python
3239
3340
from aocd import submit
3441
submit(my_answer, level=1, day=25, year=2017)
3542
36-
The same filename introspection of year/day also works for the automated submission. There is no introspection of the "level", i.e. part A or part B, but there are convenience functions:
43+
Note that the same filename introspection of year/day also works for automated
44+
submission. There's also introspection of the "level", i.e. part 1 or part 2,
45+
aocd can automatically determine if you have already completed part 1 or not,
46+
and submit an answer for the correct part accordingly. In this case, just use:
3747

3848
.. code-block:: python
3949
40-
from aocd import submit1, submit2
41-
submit1(my_answer_part_1)
42-
submit2(my_answer_part_2)
50+
from aocd import submit
51+
submit(my_answer)
4352
44-
The response message from AoC will be printed in the terminal. If you gave the right answer, then the puzzle will be refreshed in your web browser (so you can read the instructions for the next part, for example). **Proceed with caution!** If you submit wrong guesses, your user **WILL** get rate-limited by Eric, so don't call submit until you're fairly confident you have a correct answer!
53+
The response message from AoC will be printed in the terminal. If you gave
54+
the right answer, then the puzzle will be refreshed in your web browser
55+
(so you can read the instructions for the next part, for example).
56+
**Proceed with caution!** If you submit wrong guesses, your user **WILL**
57+
get rate-limited by Eric, so don't call submit until you're fairly confident
58+
you have a correct answer!
4559

4660

4761
Setup Guide
@@ -75,23 +89,20 @@ It will automatically get today's data at import time, if used within the
7589
interactive interpreter. Otherwise, the date is found by introspection of the
7690
path and file name from which ``aocd`` module was imported.
7791

78-
This means your filenames should be something sensible. The examples below
79-
should all parse correctly:
92+
This means your filenames should be something sensible. The examples below
93+
should all parse correctly, because they have digits in the path that are
94+
unambiguously recognisable as AoC years (2015+) or days (1-25).
8095

8196
.. code-block::
8297
8398
q03.py
8499
xmas_problem_2016_25b_dawg.py
85100
~/src/aoc/2015/p8.py
86101
87-
A filename like ``problem_one.py`` will break shit, so don't do that. If
102+
A filename like ``problem_one.py`` will not work, so don't do that. If
88103
you don't like weird frame hacks, just use the ``aocd.get_data()`` function
89104
instead and have a nice day!
90105

91-
*Please be aware that Python won't import the same module twice, so if you
92-
want to get data for multiple problems from within the same interpreter session
93-
then you should be using the* ``get_data`` *function directly.*
94-
95106
.. code-block:: python
96107
97108
>>> from aocd import get_data

0 commit comments

Comments
 (0)