pyLynx 2.0.1b2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- pylynx-2.0.1b2/LICENSE +232 -0
- pylynx-2.0.1b2/Lynx/__init__.py +49 -0
- pylynx-2.0.1b2/Lynx/modules/__init__.py +1 -0
- pylynx-2.0.1b2/Lynx/modules/compare.py +32 -0
- pylynx-2.0.1b2/Lynx/modules/generate.py +42 -0
- pylynx-2.0.1b2/Lynx/modules/init.py +57 -0
- pylynx-2.0.1b2/Lynx/templates/cpp/additional_file/.gitkeep +0 -0
- pylynx-2.0.1b2/Lynx/templates/cpp/problem.yaml +0 -0
- pylynx-2.0.1b2/Lynx/templates/cpp/problem_zh.md +3 -0
- pylynx-2.0.1b2/Lynx/templates/cpp/programs/checker.cpp +14 -0
- pylynx-2.0.1b2/Lynx/templates/cpp/programs/std.cpp +1 -0
- pylynx-2.0.1b2/Lynx/templates/cpp/programs/validator.cpp +17 -0
- pylynx-2.0.1b2/Lynx/templates/cpp/testdata/config.yaml +95 -0
- pylynx-2.0.1b2/Lynx/templates/generator.py +9 -0
- pylynx-2.0.1b2/Lynx/utils/__init__.py +1 -0
- pylynx-2.0.1b2/Lynx/utils/config.py +18 -0
- pylynx-2.0.1b2/Lynx/utils/constants.py +51 -0
- pylynx-2.0.1b2/Lynx/utils/language/__init__.py +1 -0
- pylynx-2.0.1b2/Lynx/utils/language/cpp.py +44 -0
- pylynx-2.0.1b2/Lynx/utils/log.py +17 -0
- pylynx-2.0.1b2/MANIFEST.in +10 -0
- pylynx-2.0.1b2/PKG-INFO +28 -0
- pylynx-2.0.1b2/README.md +5 -0
- pylynx-2.0.1b2/pyLynx.egg-info/PKG-INFO +28 -0
- pylynx-2.0.1b2/pyLynx.egg-info/SOURCES.txt +67 -0
- pylynx-2.0.1b2/pyLynx.egg-info/dependency_links.txt +1 -0
- pylynx-2.0.1b2/pyLynx.egg-info/entry_points.txt +2 -0
- pylynx-2.0.1b2/pyLynx.egg-info/requires.txt +4 -0
- pylynx-2.0.1b2/pyLynx.egg-info/top_level.txt +2 -0
- pylynx-2.0.1b2/setup.cfg +8 -0
- pylynx-2.0.1b2/setup.py +36 -0
- pylynx-2.0.1b2/testlib/.git +1 -0
- pylynx-2.0.1b2/testlib/.gitattributes +1 -0
- pylynx-2.0.1b2/testlib/.gitignore +7 -0
- pylynx-2.0.1b2/testlib/LICENSE +21 -0
- pylynx-2.0.1b2/testlib/README.md +107 -0
- pylynx-2.0.1b2/testlib/checkers/.gitignore +19 -0
- pylynx-2.0.1b2/testlib/checkers/acmp.cpp +17 -0
- pylynx-2.0.1b2/testlib/checkers/caseicmp.cpp +64 -0
- pylynx-2.0.1b2/testlib/checkers/casencmp.cpp +87 -0
- pylynx-2.0.1b2/testlib/checkers/casewcmp.cpp +80 -0
- pylynx-2.0.1b2/testlib/checkers/dcmp.cpp +16 -0
- pylynx-2.0.1b2/testlib/checkers/fcmp.cpp +33 -0
- pylynx-2.0.1b2/testlib/checkers/hcmp.cpp +32 -0
- pylynx-2.0.1b2/testlib/checkers/icmp.cpp +14 -0
- pylynx-2.0.1b2/testlib/checkers/lcmp.cpp +52 -0
- pylynx-2.0.1b2/testlib/checkers/ncmp.cpp +53 -0
- pylynx-2.0.1b2/testlib/checkers/nyesno.cpp +65 -0
- pylynx-2.0.1b2/testlib/checkers/pointscmp.cpp +13 -0
- pylynx-2.0.1b2/testlib/checkers/pointsinfo.cpp +14 -0
- pylynx-2.0.1b2/testlib/checkers/rcmp.cpp +17 -0
- pylynx-2.0.1b2/testlib/checkers/rcmp4.cpp +28 -0
- pylynx-2.0.1b2/testlib/checkers/rcmp6.cpp +28 -0
- pylynx-2.0.1b2/testlib/checkers/rcmp9.cpp +28 -0
- pylynx-2.0.1b2/testlib/checkers/rncmp.cpp +22 -0
- pylynx-2.0.1b2/testlib/checkers/uncmp.cpp +51 -0
- pylynx-2.0.1b2/testlib/checkers/wcmp.cpp +34 -0
- pylynx-2.0.1b2/testlib/checkers/yesno.cpp +26 -0
- pylynx-2.0.1b2/testlib/read.me +19 -0
- pylynx-2.0.1b2/testlib/testlib.h +6299 -0
- pylynx-2.0.1b2/testlib/validators/bipartite-graph-validator.cpp +31 -0
- pylynx-2.0.1b2/testlib/validators/case-nval.cpp +27 -0
- pylynx-2.0.1b2/testlib/validators/ival.cpp +16 -0
- pylynx-2.0.1b2/testlib/validators/nval.cpp +21 -0
- pylynx-2.0.1b2/testlib/validators/sval.cpp +17 -0
- pylynx-2.0.1b2/testlib/validators/undirected-graph-validator.cpp +32 -0
- pylynx-2.0.1b2/testlib/validators/undirected-tree-validator.cpp +54 -0
- pylynx-2.0.1b2/testlib/validators/validate-using-testset-and-group.cpp +31 -0
pylynx-2.0.1b2/LICENSE
ADDED
|
@@ -0,0 +1,232 @@
|
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2023 Chester Alfred
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
testlib.h
|
|
25
|
+
|
|
26
|
+
The MIT License (MIT)
|
|
27
|
+
|
|
28
|
+
Copyright (c) 2015 Mike Mirzayanov
|
|
29
|
+
|
|
30
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
31
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
32
|
+
in the Software without restriction, including without limitation the rights
|
|
33
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
34
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
35
|
+
furnished to do so, subject to the following conditions:
|
|
36
|
+
|
|
37
|
+
The above copyright notice and this permission notice shall be included in all
|
|
38
|
+
copies or substantial portions of the Software.
|
|
39
|
+
|
|
40
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
41
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
42
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
43
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
44
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
45
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
46
|
+
SOFTWARE.
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
python-fire
|
|
50
|
+
|
|
51
|
+
Copyright 2017 Google Inc. All rights reserved.
|
|
52
|
+
|
|
53
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
54
|
+
you may not use this file except in compliance with the License.
|
|
55
|
+
You may obtain a copy of the License at
|
|
56
|
+
|
|
57
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
58
|
+
|
|
59
|
+
Unless required by applicable law or agreed to in writing, software
|
|
60
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
61
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
62
|
+
See the License for the specific language governing permissions and
|
|
63
|
+
limitations under the License.
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
cyaron
|
|
67
|
+
|
|
68
|
+
GNU LESSER GENERAL PUBLIC LICENSE
|
|
69
|
+
Version 3, 29 June 2007
|
|
70
|
+
|
|
71
|
+
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
|
|
72
|
+
Everyone is permitted to copy and distribute verbatim copies
|
|
73
|
+
of this license document, but changing it is not allowed.
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
This version of the GNU Lesser General Public License incorporates
|
|
77
|
+
the terms and conditions of version 3 of the GNU General Public
|
|
78
|
+
License, supplemented by the additional permissions listed below.
|
|
79
|
+
|
|
80
|
+
0. Additional Definitions.
|
|
81
|
+
|
|
82
|
+
As used herein, "this License" refers to version 3 of the GNU Lesser
|
|
83
|
+
General Public License, and the "GNU GPL" refers to version 3 of the GNU
|
|
84
|
+
General Public License.
|
|
85
|
+
|
|
86
|
+
"The Library" refers to a covered work governed by this License,
|
|
87
|
+
other than an Application or a Combined Work as defined below.
|
|
88
|
+
|
|
89
|
+
An "Application" is any work that makes use of an interface provided
|
|
90
|
+
by the Library, but which is not otherwise based on the Library.
|
|
91
|
+
Defining a subclass of a class defined by the Library is deemed a mode
|
|
92
|
+
of using an interface provided by the Library.
|
|
93
|
+
|
|
94
|
+
A "Combined Work" is a work produced by combining or linking an
|
|
95
|
+
Application with the Library. The particular version of the Library
|
|
96
|
+
with which the Combined Work was made is also called the "Linked
|
|
97
|
+
Version".
|
|
98
|
+
|
|
99
|
+
The "Minimal Corresponding Source" for a Combined Work means the
|
|
100
|
+
Corresponding Source for the Combined Work, excluding any source code
|
|
101
|
+
for portions of the Combined Work that, considered in isolation, are
|
|
102
|
+
based on the Application, and not on the Linked Version.
|
|
103
|
+
|
|
104
|
+
The "Corresponding Application Code" for a Combined Work means the
|
|
105
|
+
object code and/or source code for the Application, including any data
|
|
106
|
+
and utility programs needed for reproducing the Combined Work from the
|
|
107
|
+
Application, but excluding the System Libraries of the Combined Work.
|
|
108
|
+
|
|
109
|
+
1. Exception to Section 3 of the GNU GPL.
|
|
110
|
+
|
|
111
|
+
You may convey a covered work under sections 3 and 4 of this License
|
|
112
|
+
without being bound by section 3 of the GNU GPL.
|
|
113
|
+
|
|
114
|
+
2. Conveying Modified Versions.
|
|
115
|
+
|
|
116
|
+
If you modify a copy of the Library, and, in your modifications, a
|
|
117
|
+
facility refers to a function or data to be supplied by an Application
|
|
118
|
+
that uses the facility (other than as an argument passed when the
|
|
119
|
+
facility is invoked), then you may convey a copy of the modified
|
|
120
|
+
version:
|
|
121
|
+
|
|
122
|
+
a) under this License, provided that you make a good faith effort to
|
|
123
|
+
ensure that, in the event an Application does not supply the
|
|
124
|
+
function or data, the facility still operates, and performs
|
|
125
|
+
whatever part of its purpose remains meaningful, or
|
|
126
|
+
|
|
127
|
+
b) under the GNU GPL, with none of the additional permissions of
|
|
128
|
+
this License applicable to that copy.
|
|
129
|
+
|
|
130
|
+
3. Object Code Incorporating Material from Library Header Files.
|
|
131
|
+
|
|
132
|
+
The object code form of an Application may incorporate material from
|
|
133
|
+
a header file that is part of the Library. You may convey such object
|
|
134
|
+
code under terms of your choice, provided that, if the incorporated
|
|
135
|
+
material is not limited to numerical parameters, data structure
|
|
136
|
+
layouts and accessors, or small macros, inline functions and templates
|
|
137
|
+
(ten or fewer lines in length), you do both of the following:
|
|
138
|
+
|
|
139
|
+
a) Give prominent notice with each copy of the object code that the
|
|
140
|
+
Library is used in it and that the Library and its use are
|
|
141
|
+
covered by this License.
|
|
142
|
+
|
|
143
|
+
b) Accompany the object code with a copy of the GNU GPL and this license
|
|
144
|
+
document.
|
|
145
|
+
|
|
146
|
+
4. Combined Works.
|
|
147
|
+
|
|
148
|
+
You may convey a Combined Work under terms of your choice that,
|
|
149
|
+
taken together, effectively do not restrict modification of the
|
|
150
|
+
portions of the Library contained in the Combined Work and reverse
|
|
151
|
+
engineering for debugging such modifications, if you also do each of
|
|
152
|
+
the following:
|
|
153
|
+
|
|
154
|
+
a) Give prominent notice with each copy of the Combined Work that
|
|
155
|
+
the Library is used in it and that the Library and its use are
|
|
156
|
+
covered by this License.
|
|
157
|
+
|
|
158
|
+
b) Accompany the Combined Work with a copy of the GNU GPL and this license
|
|
159
|
+
document.
|
|
160
|
+
|
|
161
|
+
c) For a Combined Work that displays copyright notices during
|
|
162
|
+
execution, include the copyright notice for the Library among
|
|
163
|
+
these notices, as well as a reference directing the user to the
|
|
164
|
+
copies of the GNU GPL and this license document.
|
|
165
|
+
|
|
166
|
+
d) Do one of the following:
|
|
167
|
+
|
|
168
|
+
0) Convey the Minimal Corresponding Source under the terms of this
|
|
169
|
+
License, and the Corresponding Application Code in a form
|
|
170
|
+
suitable for, and under terms that permit, the user to
|
|
171
|
+
recombine or relink the Application with a modified version of
|
|
172
|
+
the Linked Version to produce a modified Combined Work, in the
|
|
173
|
+
manner specified by section 6 of the GNU GPL for conveying
|
|
174
|
+
Corresponding Source.
|
|
175
|
+
|
|
176
|
+
1) Use a suitable shared library mechanism for linking with the
|
|
177
|
+
Library. A suitable mechanism is one that (a) uses at run time
|
|
178
|
+
a copy of the Library already present on the user's computer
|
|
179
|
+
system, and (b) will operate properly with a modified version
|
|
180
|
+
of the Library that is interface-compatible with the Linked
|
|
181
|
+
Version.
|
|
182
|
+
|
|
183
|
+
e) Provide Installation Information, but only if you would otherwise
|
|
184
|
+
be required to provide such information under section 6 of the
|
|
185
|
+
GNU GPL, and only to the extent that such information is
|
|
186
|
+
necessary to install and execute a modified version of the
|
|
187
|
+
Combined Work produced by recombining or relinking the
|
|
188
|
+
Application with a modified version of the Linked Version. (If
|
|
189
|
+
you use option 4d0, the Installation Information must accompany
|
|
190
|
+
the Minimal Corresponding Source and Corresponding Application
|
|
191
|
+
Code. If you use option 4d1, you must provide the Installation
|
|
192
|
+
Information in the manner specified by section 6 of the GNU GPL
|
|
193
|
+
for conveying Corresponding Source.)
|
|
194
|
+
|
|
195
|
+
5. Combined Libraries.
|
|
196
|
+
|
|
197
|
+
You may place library facilities that are a work based on the
|
|
198
|
+
Library side by side in a single library together with other library
|
|
199
|
+
facilities that are not Applications and are not covered by this
|
|
200
|
+
License, and convey such a combined library under terms of your
|
|
201
|
+
choice, if you do both of the following:
|
|
202
|
+
|
|
203
|
+
a) Accompany the combined library with a copy of the same work based
|
|
204
|
+
on the Library, uncombined with any other library facilities,
|
|
205
|
+
conveyed under the terms of this License.
|
|
206
|
+
|
|
207
|
+
b) Give prominent notice with the combined library that part of it
|
|
208
|
+
is a work based on the Library, and explaining where to find the
|
|
209
|
+
accompanying uncombined form of the same work.
|
|
210
|
+
|
|
211
|
+
6. Revised Versions of the GNU Lesser General Public License.
|
|
212
|
+
|
|
213
|
+
The Free Software Foundation may publish revised and/or new versions
|
|
214
|
+
of the GNU Lesser General Public License from time to time. Such new
|
|
215
|
+
versions will be similar in spirit to the present version, but may
|
|
216
|
+
differ in detail to address new problems or concerns.
|
|
217
|
+
|
|
218
|
+
Each version is given a distinguishing version number. If the
|
|
219
|
+
Library as you received it specifies that a certain numbered version
|
|
220
|
+
of the GNU Lesser General Public License "or any later version"
|
|
221
|
+
applies to it, you have the option of following the terms and
|
|
222
|
+
conditions either of that published version or of any later version
|
|
223
|
+
published by the Free Software Foundation. If the Library as you
|
|
224
|
+
received it does not specify a version number of the GNU Lesser
|
|
225
|
+
General Public License, you may choose any version of the GNU Lesser
|
|
226
|
+
General Public License ever published by the Free Software Foundation.
|
|
227
|
+
|
|
228
|
+
If the Library as you received it specifies that a proxy can decide
|
|
229
|
+
whether future versions of the GNU Lesser General Public License shall
|
|
230
|
+
apply, that proxy's public statement of acceptance of any version is
|
|
231
|
+
permanent authorization for you to choose that version for the
|
|
232
|
+
Library.
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
# Copyright (c) 2023-present FredB-mine
|
|
2
|
+
|
|
3
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
4
|
+
# of this software and associated documentation files (the "Software"), to deal
|
|
5
|
+
# in the Software without restriction, including without limitation the rights
|
|
6
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
7
|
+
# copies of the Software, and to permit persons to whom the Software is
|
|
8
|
+
# furnished to do so, subject to the following conditions:
|
|
9
|
+
|
|
10
|
+
# The above copyright notice and this permission notice shall be included in all
|
|
11
|
+
# copies or substantial portions of the Software.
|
|
12
|
+
|
|
13
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
14
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
15
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
16
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
17
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
18
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
19
|
+
# SOFTWARE.
|
|
20
|
+
|
|
21
|
+
import click
|
|
22
|
+
from Lynx.utils.constants import VERSION
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
def print_version(ctx, param, value):
|
|
26
|
+
if not value or ctx.resilient_parsing:
|
|
27
|
+
return
|
|
28
|
+
click.echo(VERSION)
|
|
29
|
+
ctx.exit()
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
# register CLI group, must be placed before importing submodules
|
|
33
|
+
@click.group()
|
|
34
|
+
@click.option(
|
|
35
|
+
"--version",
|
|
36
|
+
is_flag=True,
|
|
37
|
+
is_eager=True,
|
|
38
|
+
expose_value=False,
|
|
39
|
+
callback=print_version,
|
|
40
|
+
help="Show the version of lynx.",
|
|
41
|
+
)
|
|
42
|
+
def cli():
|
|
43
|
+
"""lynx: Next generation testcase tool set for OI / ACM contests."""
|
|
44
|
+
pass
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
import Lynx.modules.generate
|
|
48
|
+
import Lynx.modules.compare
|
|
49
|
+
import Lynx.modules.init
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
# just for setuptools to find
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import click
|
|
2
|
+
import os
|
|
3
|
+
import Lynx.utils.config as config
|
|
4
|
+
|
|
5
|
+
from Lynx import cli
|
|
6
|
+
from Lynx.utils.language import cpp
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
@cli.command()
|
|
10
|
+
@click.argument("problem", type=click.Path())
|
|
11
|
+
@click.argument("program1", type=click.File("r"))
|
|
12
|
+
@click.argument("program2", type=click.File("r"), required=False)
|
|
13
|
+
@click.option(
|
|
14
|
+
"--testcase", type=int, default=0, help="The index of the testcase to compare."
|
|
15
|
+
)
|
|
16
|
+
# checker will be supported in the future when cyaron implements it.
|
|
17
|
+
# @click.option(
|
|
18
|
+
# "--checker",
|
|
19
|
+
# is_flag=True,
|
|
20
|
+
# default=False,
|
|
21
|
+
# help="Use checker (special judge).",
|
|
22
|
+
# )
|
|
23
|
+
def compare(problem, program1, program2, testcase):
|
|
24
|
+
"""This command compares two programs using a lynx problem description.
|
|
25
|
+
|
|
26
|
+
PROBLEM is the lynx problem directory.
|
|
27
|
+
|
|
28
|
+
PROGRAM1 is the program to compare with.
|
|
29
|
+
|
|
30
|
+
PROGRAM2 is the second program to compare with, it is set to the standard solution to the problem by default.
|
|
31
|
+
"""
|
|
32
|
+
pass
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import click
|
|
2
|
+
import os
|
|
3
|
+
import random
|
|
4
|
+
import Lynx.utils.config as config
|
|
5
|
+
|
|
6
|
+
from cyaron import *
|
|
7
|
+
from Lynx import cli
|
|
8
|
+
from Lynx.utils.language import cpp
|
|
9
|
+
from Lynx.utils.constants import SUPPORTED_OJ
|
|
10
|
+
|
|
11
|
+
# Warning: This may cause security risks. We should try to replace it.
|
|
12
|
+
from importlib import import_module
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
@cli.command()
|
|
16
|
+
@click.argument("problem", type=click.Path())
|
|
17
|
+
@click.option(
|
|
18
|
+
"--oj",
|
|
19
|
+
type=click.Choice(SUPPORTED_OJ),
|
|
20
|
+
default="hydro",
|
|
21
|
+
help="The online judge to upload the problem to, used when packing data.",
|
|
22
|
+
)
|
|
23
|
+
@click.option(
|
|
24
|
+
"--seed",
|
|
25
|
+
type=int,
|
|
26
|
+
required=False,
|
|
27
|
+
help="The random seed to specify (optional).",
|
|
28
|
+
)
|
|
29
|
+
@click.option(
|
|
30
|
+
"--no-validate",
|
|
31
|
+
is_flag=True,
|
|
32
|
+
default=False,
|
|
33
|
+
help="Not to validate when generating data.",
|
|
34
|
+
)
|
|
35
|
+
def generate(problem, oj, seed, no_validate):
|
|
36
|
+
"""This command generates testcases of a lynx problem."""
|
|
37
|
+
# check if the problem directory exists
|
|
38
|
+
if seed is not None:
|
|
39
|
+
random.seed(seed) # Write unit tests for setting seed.
|
|
40
|
+
|
|
41
|
+
# maybe you forget to specify --no-validator?
|
|
42
|
+
pass
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import click
|
|
2
|
+
import os
|
|
3
|
+
import Lynx.utils.config as config
|
|
4
|
+
|
|
5
|
+
from Lynx import cli
|
|
6
|
+
from Lynx.utils.log import *
|
|
7
|
+
from Lynx.utils.language import cpp
|
|
8
|
+
from Lynx.utils.constants import CPP_STANDARDS, CHECKERS, VALIDATORS
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
@cli.command()
|
|
12
|
+
@click.argument("problem", type=click.Path())
|
|
13
|
+
@click.option( # language
|
|
14
|
+
"--language",
|
|
15
|
+
default="c++14",
|
|
16
|
+
help="The language used when generating data.",
|
|
17
|
+
type=click.Choice(CPP_STANDARDS),
|
|
18
|
+
)
|
|
19
|
+
@click.option( # checker
|
|
20
|
+
"--checker",
|
|
21
|
+
type=click.Choice(CHECKERS),
|
|
22
|
+
default="custom",
|
|
23
|
+
help="Use a checker (special judge). You can specify the checker provided by testlib or use your customized checker by just giving a flag.",
|
|
24
|
+
)
|
|
25
|
+
@click.option( # validator
|
|
26
|
+
"--validator",
|
|
27
|
+
type=click.Choice(VALIDATORS),
|
|
28
|
+
default="custom",
|
|
29
|
+
help="Use a validator. You can also use the validator provided by testlib in a similar way as the checker.",
|
|
30
|
+
)
|
|
31
|
+
@click.option("--testcase", type=int, default=20, help="The number of testcases.")
|
|
32
|
+
@click.option(
|
|
33
|
+
"--time-limit",
|
|
34
|
+
type=int,
|
|
35
|
+
default=1000,
|
|
36
|
+
help="The time limit of the problem, uses ms as unit.",
|
|
37
|
+
)
|
|
38
|
+
@click.option(
|
|
39
|
+
"--memory-limit",
|
|
40
|
+
type=int,
|
|
41
|
+
default=512,
|
|
42
|
+
help="The memory limit of the problem, uses MB as unit.",
|
|
43
|
+
)
|
|
44
|
+
def init(problem, language, checker, validator, testcase, time_limit, memory_limit):
|
|
45
|
+
"""This command initializes a lynx problem directory."""
|
|
46
|
+
# Turn the problem path into an absolute path
|
|
47
|
+
if not os.path.isabs(problem):
|
|
48
|
+
problem = os.path.join(os.getcwd(), problem)
|
|
49
|
+
debug(f"problem route is {problem}")
|
|
50
|
+
if os.path.exists(problem):
|
|
51
|
+
error_and_exit(f"Problem directory {problem} already exists.")
|
|
52
|
+
if language in CPP_STANDARDS:
|
|
53
|
+
cpp.init_problem(
|
|
54
|
+
problem, language, checker, validator, testcase, time_limit, memory_limit
|
|
55
|
+
)
|
|
56
|
+
else: # Other languages will be supported in the future
|
|
57
|
+
assert False # This should never happen
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This checker will be compiled into an executive,
|
|
3
|
+
* and the testcase-tools will provide it with the input
|
|
4
|
+
* file and the output file in a way that testlib recognizes.
|
|
5
|
+
*
|
|
6
|
+
* So you can use the built-in io functions in testlib.h
|
|
7
|
+
* to write your checker.
|
|
8
|
+
*/
|
|
9
|
+
#include "testlib.h"
|
|
10
|
+
|
|
11
|
+
int main(int argc, char *argv[]) {
|
|
12
|
+
registerTestlibCmd(argc, argv);
|
|
13
|
+
return 0;
|
|
14
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
// Write your standard solution to the problem here.
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This validator will be compiled into an executive,
|
|
3
|
+
* and the testcase-tools will provide it with the input
|
|
4
|
+
* file in a way that testlib recognizes.
|
|
5
|
+
*
|
|
6
|
+
* So you can use the built-in io functions in testlib.h
|
|
7
|
+
* to write your validator.
|
|
8
|
+
*
|
|
9
|
+
* You can just leave it empty if you don't need to check the output.
|
|
10
|
+
* Just remember to specify --no-validator when generating in that case.
|
|
11
|
+
*/
|
|
12
|
+
#include "testlib.h"
|
|
13
|
+
|
|
14
|
+
int main(int argc, char *argv[]) {
|
|
15
|
+
registerValidation(argc, argv);
|
|
16
|
+
return 0;
|
|
17
|
+
}
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
# 题目类型,可以为 default(比对输出,可以含spj), objective(客观题), interactive(交互题)
|
|
2
|
+
type: default
|
|
3
|
+
|
|
4
|
+
# 全局时空限制(此处的限制优先级低于测试点的限制)
|
|
5
|
+
time: 1s
|
|
6
|
+
memory: 128m
|
|
7
|
+
|
|
8
|
+
# 输入输出文件名(例:使用 foo.in 和 foo.out),若使用标准 IO 删除此配置项即可
|
|
9
|
+
filename: foo
|
|
10
|
+
|
|
11
|
+
# 此部分设置当题目类型为 default 时生效
|
|
12
|
+
# 比较器类型,支持的值有 default(直接比对,忽略行末空格和文件末换行), ccr, cena, hustoj, lemon, qduoj, syzoj, testlib(比较常用)
|
|
13
|
+
checker_type: default
|
|
14
|
+
# 比较器文件(当比较器类型不为 default 时填写)
|
|
15
|
+
# 文件路径(位于压缩包中的路径)
|
|
16
|
+
# 将通过扩展名识别语言,与编译命令处一致。在默认配置下,C++ 扩展名应为 .cc 而非 .cpp
|
|
17
|
+
checker: chk.cc
|
|
18
|
+
|
|
19
|
+
# 此部分设置当题目类型为interactive时生效
|
|
20
|
+
# 交互器路径(位于压缩包中的路径)
|
|
21
|
+
interactor: interactor.cc
|
|
22
|
+
|
|
23
|
+
# Extra files 额外文件
|
|
24
|
+
# These files will be copied to the working directory 这些文件将被复制到工作目录。
|
|
25
|
+
# 提示:您无需手动上传 testlib.h。
|
|
26
|
+
user_extra_files:
|
|
27
|
+
- extra_input.txt
|
|
28
|
+
judge_extra_files:
|
|
29
|
+
- extra_file.txt
|
|
30
|
+
|
|
31
|
+
# Test Cases 测试数据列表
|
|
32
|
+
# If neither CASES or SUBTASKS are set(or config.yaml doesn't exist), judge will try to locate them automaticly.
|
|
33
|
+
# 如果 CASES 和 SUBTASKS 都没有设置或 config.yaml 不存在, 系统会自动尝试识别数据点。
|
|
34
|
+
# We support these names for auto mode: 自动识别支持以下命名方式:
|
|
35
|
+
# 1. [name(optional)][number].(in/out/ans) RegExp: /^([a-zA-Z]*)([0-9]+).in$/
|
|
36
|
+
# examples:
|
|
37
|
+
# - c1.in / c1.out
|
|
38
|
+
# - 1.in / 1.out
|
|
39
|
+
# - c1.in / c1.ans
|
|
40
|
+
# 2. input[number].txt / output[number].txt RegExp: /^(input)([0-9]+).txt$/
|
|
41
|
+
# - example: input1.txt / input2.txt
|
|
42
|
+
#
|
|
43
|
+
# The CASES option has higher priority than the SUBTASKS option!
|
|
44
|
+
# 在有 CASES 设置项时,不会读取 SUBTASKS 设置项!
|
|
45
|
+
#
|
|
46
|
+
# The CASES option has been deprecated in the new version, please use the more personalized SUBTASKS!
|
|
47
|
+
# CASES 已于新版本中被废弃,请使用个性化程度更高的SUBTASKS!
|
|
48
|
+
# score: 50 # 单个测试点分数
|
|
49
|
+
# time: 1s # 时间限制
|
|
50
|
+
# memory: 256m # 内存限制
|
|
51
|
+
# cases:
|
|
52
|
+
# - input: abc.in
|
|
53
|
+
# output: def.out
|
|
54
|
+
# - input: ghi.in
|
|
55
|
+
# output: jkl.out
|
|
56
|
+
# 或使用Subtask项:
|
|
57
|
+
subtasks:
|
|
58
|
+
- score: 30
|
|
59
|
+
type: min # 可选 min/max/sum,分别表示分数取所有测试点最小值、所有测试点最大值、所有测试点之和
|
|
60
|
+
time: 1s
|
|
61
|
+
memory: 64m
|
|
62
|
+
cases:
|
|
63
|
+
- time: 0.5s
|
|
64
|
+
memory: 32m # 可对单个测试点单独设置时间限制和内存限制
|
|
65
|
+
input: a.in
|
|
66
|
+
output: a.out
|
|
67
|
+
- input: b.in
|
|
68
|
+
output: b.out
|
|
69
|
+
- score: 70
|
|
70
|
+
time: 0.5s
|
|
71
|
+
memory: 32m
|
|
72
|
+
if: [0] # 可选,传入数组,表示仅在subtask0通过时此subtask才计分
|
|
73
|
+
cases:
|
|
74
|
+
- input: c.in
|
|
75
|
+
output: c.out
|
|
76
|
+
- input: d.in
|
|
77
|
+
output: d.out
|
|
78
|
+
|
|
79
|
+
# 提交语言限制
|
|
80
|
+
# 列举出所有本题允许使用的语言对应的代码(需要和评测机 lang.yaml 内的语言代码相同)
|
|
81
|
+
# 使用语言ID而非名称!对于有子类的选项,请详细至子分类!
|
|
82
|
+
langs:
|
|
83
|
+
- c
|
|
84
|
+
- cc
|
|
85
|
+
- cc.cc11o2
|
|
86
|
+
- pas
|
|
87
|
+
|
|
88
|
+
# 时间内存倍率
|
|
89
|
+
# 对某语言设置时间或内存倍率(需要和评测机 lang.yaml 内的语言代码相同)
|
|
90
|
+
# 部分语言默认已存在倍率,请前往控制面板中查看!
|
|
91
|
+
# 使用语言ID而非名称!对于有子类的选项,请详细至子分类!
|
|
92
|
+
time_limit_rate:
|
|
93
|
+
py.py3: 2
|
|
94
|
+
memory_limit_rate:
|
|
95
|
+
java: 1.5
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
# just for setuptools to find
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import yaml
|
|
2
|
+
import os
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
# Used to manage the range of variables more easily
|
|
6
|
+
# It will be replaced by some features of cyaron in the future.
|
|
7
|
+
class SubtaskManager: ...
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
class CppProblemConfig:
|
|
11
|
+
def __init__(self, problem_path: str):
|
|
12
|
+
self.problem_path = problem_path
|
|
13
|
+
self.problem_config_path = os.path.join(problem_path, "problem.yaml")
|
|
14
|
+
self.testdata_config_path = os.path.join(
|
|
15
|
+
problem_path, "testdata", "config.yaml"
|
|
16
|
+
)
|
|
17
|
+
|
|
18
|
+
def init_configs(self, standard, testcase, time_limit, memory_limit): ...
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import os
|
|
2
|
+
|
|
3
|
+
VERSION = "2.0.1b2"
|
|
4
|
+
|
|
5
|
+
# Some directories
|
|
6
|
+
LYNX_ROOT = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
|
|
7
|
+
TEMPLATES_ROOT = os.path.join(LYNX_ROOT, "templates")
|
|
8
|
+
CPP_TEMPLATES_ROOT = os.path.join(TEMPLATES_ROOT, "cpp")
|
|
9
|
+
|
|
10
|
+
# Standards
|
|
11
|
+
CPP_STANDARDS = ["c++98", "c++03", "c++11", "c++14", "c++17"]
|
|
12
|
+
|
|
13
|
+
# Testlib checkers and validators
|
|
14
|
+
CHECKERS = [
|
|
15
|
+
"custom",
|
|
16
|
+
"nyesno",
|
|
17
|
+
"ncmp",
|
|
18
|
+
"casencmp",
|
|
19
|
+
"lcmp",
|
|
20
|
+
"rncmp",
|
|
21
|
+
"yesno",
|
|
22
|
+
"dcmp",
|
|
23
|
+
"hcmp",
|
|
24
|
+
"pointscmp",
|
|
25
|
+
"rcmp",
|
|
26
|
+
"fcmp",
|
|
27
|
+
"rcmp9",
|
|
28
|
+
"rcmp4",
|
|
29
|
+
"wcmp",
|
|
30
|
+
"rcmp6",
|
|
31
|
+
".gitignore",
|
|
32
|
+
"casewcmp",
|
|
33
|
+
"acmp",
|
|
34
|
+
"icmp",
|
|
35
|
+
"pointsinfo",
|
|
36
|
+
"uncmp",
|
|
37
|
+
"caseicmp",
|
|
38
|
+
]
|
|
39
|
+
VALIDATORS = [
|
|
40
|
+
"custom",
|
|
41
|
+
"validate-using-testset-and-group",
|
|
42
|
+
"undirected-graph-validator",
|
|
43
|
+
"bipartite-graph-validator",
|
|
44
|
+
"nval",
|
|
45
|
+
"undirected-tree-validator",
|
|
46
|
+
"sval",
|
|
47
|
+
"ival",
|
|
48
|
+
"case-nval",
|
|
49
|
+
]
|
|
50
|
+
|
|
51
|
+
SUPPORTED_OJ = ["luogu", "hydro", "qdu"]
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
# just for setuptools to find.
|