You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Get your puzzle data with a single import statement:
16
20
17
21
.. code-block:: python
@@ -20,28 +24,38 @@ Get your puzzle data with a single import statement:
20
24
21
25
Might be useful for lazy Pythonistas and speedhackers.
22
26
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!
24
31
25
32
26
33
Automated submission
27
34
--------------------
28
35
29
-
New in version 0.4.0.
36
+
New in version 0.4.0. Basic use:
30
37
31
38
.. code-block:: python
32
39
33
40
from aocd import submit
34
41
submit(my_answer, level=1, day=25, year=2017)
35
42
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:
37
47
38
48
.. code-block:: python
39
49
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)
43
52
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!
45
59
46
60
47
61
Setup Guide
@@ -75,23 +89,20 @@ It will automatically get today's data at import time, if used within the
75
89
interactive interpreter. Otherwise, the date is found by introspection of the
76
90
path and file name from which ``aocd`` module was imported.
77
91
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).
80
95
81
96
.. code-block::
82
97
83
98
q03.py
84
99
xmas_problem_2016_25b_dawg.py
85
100
~/src/aoc/2015/p8.py
86
101
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
88
103
you don't like weird frame hacks, just use the ``aocd.get_data()`` function
89
104
instead and have a nice day!
90
105
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.*
0 commit comments